Unused abstraction removed
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.lazy;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Segment;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.SmartPsiElementPointer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IdentitySmartPointer<E extends PsiElement> implements SmartPsiElementPointer<E> {
|
||||
private final E element;
|
||||
|
||||
public IdentitySmartPointer(@NotNull E element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiFile getContainingFile() {
|
||||
return element.getContainingFile();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return element.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile getVirtualFile() {
|
||||
return element.getContainingFile().getVirtualFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Segment getRange() {
|
||||
return element.getTextRange();
|
||||
}
|
||||
}
|
||||
+5
-13
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.jet.lang.resolve.lazy;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.psi.SmartPsiElementPointer;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||
@@ -43,7 +42,7 @@ import java.util.Set;
|
||||
public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, LazyDescriptor {
|
||||
private final ResolveSession resolveSession;
|
||||
|
||||
private final SmartPsiElementPointer<JetTypeParameter> jetTypeParameterSmartPsiElementPointer;
|
||||
private final JetTypeParameter jetTypeParameter;
|
||||
private final Variance variance;
|
||||
private final int index;
|
||||
private final LazyClassDescriptor containingDeclaration;
|
||||
@@ -66,7 +65,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
int index) {
|
||||
this.resolveSession = resolveSession;
|
||||
// TODO: different smart pointer implementations in IDE and compiler
|
||||
this.jetTypeParameterSmartPsiElementPointer = new IdentitySmartPointer<JetTypeParameter>(jetTypeParameter);
|
||||
this.jetTypeParameter = jetTypeParameter;
|
||||
this.variance = jetTypeParameter.getVariance();
|
||||
this.containingDeclaration = containingDeclaration;
|
||||
this.index = index;
|
||||
@@ -90,7 +89,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
if (upperBounds == null) {
|
||||
upperBounds = Sets.newLinkedHashSet();
|
||||
|
||||
JetTypeParameter jetTypeParameter = getElement();
|
||||
JetTypeParameter jetTypeParameter = this.jetTypeParameter;
|
||||
|
||||
resolveUpperBoundsFromWhereClause(upperBounds, false);
|
||||
|
||||
@@ -107,7 +106,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
}
|
||||
|
||||
private void resolveUpperBoundsFromWhereClause(Set<JetType> upperBounds, boolean forClassObject) {
|
||||
JetTypeParameter jetTypeParameter = getElement();
|
||||
JetTypeParameter jetTypeParameter = this.jetTypeParameter;
|
||||
|
||||
JetClassOrObject classOrObject = PsiTreeUtil.getParentOfType(jetTypeParameter, JetClassOrObject.class);
|
||||
if (classOrObject instanceof JetClass) {
|
||||
@@ -130,14 +129,6 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
|
||||
}
|
||||
|
||||
private JetTypeParameter getElement() {
|
||||
JetTypeParameter jetTypeParameter = jetTypeParameterSmartPsiElementPointer.getElement();
|
||||
if (jetTypeParameter == null) {
|
||||
throw new IllegalStateException("Psi element not found for type parameter: " + this);
|
||||
}
|
||||
return jetTypeParameter;
|
||||
}
|
||||
|
||||
private JetType resolveBoundType(@NotNull JetTypeReference boundTypeReference) {
|
||||
return resolveSession.getInjector().getTypeResolver()
|
||||
.resolveType(containingDeclaration.getScopeForClassHeaderResolution(), boundTypeReference,
|
||||
@@ -241,6 +232,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DeclarationDescriptor getContainingDeclaration() {
|
||||
return containingDeclaration;
|
||||
|
||||
Reference in New Issue
Block a user