temp hack against KT-1214
This commit is contained in:
+16
@@ -1367,6 +1367,22 @@ public class JavaDescriptorResolver {
|
|||||||
throw new IllegalStateException("unresolved PsiTypeParameter " + psiTypeParameter.getName() + " in method " + method.getName() + " in class " + psiClass.getQualifiedName()); // TODO: report properly
|
throw new IllegalStateException("unresolved PsiTypeParameter " + psiTypeParameter.getName() + " in method " + method.getName() + " in class " + psiClass.getQualifiedName()); // TODO: report properly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public TypeParameterDescriptor getTypeVariableByPsiByName(@NotNull String name) {
|
||||||
|
for (TypeParameterDescriptorInitialization typeParameter : methodTypeParametersInitialization) {
|
||||||
|
if (typeParameter.psiTypeParameter.getName().equals(name)) {
|
||||||
|
return typeParameter.descriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (TypeParameterDescriptorInitialization typeParameter : classTypeParameterDescriptorsInitialization) {
|
||||||
|
if (typeParameter.psiTypeParameter.getName().equals(name)) {
|
||||||
|
return typeParameter.descriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("unresolved PsiTypeParameter " + name + " in method " + method.getName() + " in class " + psiClass.getQualifiedName()); // TODO: report properly
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public TypeParameterDescriptor getTypeVariable(@NotNull String name) {
|
public TypeParameterDescriptor getTypeVariable(@NotNull String name) {
|
||||||
|
|||||||
+13
-1
@@ -142,13 +142,25 @@ public class JavaTypeTransformer {
|
|||||||
return typeParameter;
|
return typeParameter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalStateException();
|
return typeVariableByPsiResolver.getTypeVariableByPsiByName(psiTypeParameter.getName());
|
||||||
} else if (classData instanceof JavaDescriptorResolver.ResolverBinaryClassData) {
|
} else if (classData instanceof JavaDescriptorResolver.ResolverBinaryClassData) {
|
||||||
return new TypeVariableByPsiResolverImpl(((JavaDescriptorResolver.ResolverBinaryClassData) classData).typeParameters, typeVariableByPsiResolver).getTypeVariable(psiTypeParameter);
|
return new TypeVariableByPsiResolverImpl(((JavaDescriptorResolver.ResolverBinaryClassData) classData).typeParameters, typeVariableByPsiResolver).getTypeVariable(psiTypeParameter);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public TypeParameterDescriptor getTypeVariableByPsiByName(@NotNull String name) {
|
||||||
|
for (TypeParameterDescriptor typeParameter : classData.getClassDescriptor().getTypeConstructor().getParameters()) {
|
||||||
|
if (typeParameter.getName().equals(name)) {
|
||||||
|
// TODO?
|
||||||
|
return typeParameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
arguments.add(transformToTypeProjection(psiArgument, typeParameterDescriptor, typeVariableByPsiResolver2));
|
arguments.add(transformToTypeProjection(psiArgument, typeParameterDescriptor, typeVariableByPsiResolver2));
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -12,4 +12,8 @@ import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
|||||||
public interface TypeVariableByPsiResolver {
|
public interface TypeVariableByPsiResolver {
|
||||||
@NotNull
|
@NotNull
|
||||||
TypeParameterDescriptor getTypeVariable(@NotNull PsiTypeParameter psiTypeParameter);
|
TypeParameterDescriptor getTypeVariable(@NotNull PsiTypeParameter psiTypeParameter);
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
|
@NotNull
|
||||||
|
TypeParameterDescriptor getTypeVariableByPsiByName(@NotNull String name);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -36,4 +36,17 @@ public class TypeVariableByPsiResolverImpl implements TypeVariableByPsiResolver
|
|||||||
throw new RuntimeException("type parameter not found by PsiTypeParameter " + psiTypeParameter.getName()); // TODO report properly
|
throw new RuntimeException("type parameter not found by PsiTypeParameter " + psiTypeParameter.getName()); // TODO report properly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public TypeParameterDescriptor getTypeVariableByPsiByName(@NotNull String name) {
|
||||||
|
for (JavaDescriptorResolver.TypeParameterDescriptorInitialization typeParameter : typeParameters) {
|
||||||
|
if (typeParameter.psiTypeParameter.getName().equals(name)) {
|
||||||
|
return typeParameter.descriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (parent != null) {
|
||||||
|
return parent.getTypeVariableByPsiByName(name);
|
||||||
|
}
|
||||||
|
throw new RuntimeException("type parameter not found by PsiTypeParameter " + name); // TODO report properly
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user