minor JDR refactoring
* function descriptor cache is no longer needed in JDR * fixed incorrect assertion * removed unused parameter * better exception message Related to http://ea.jetbrains.com/browser/ea_problems/33872
This commit is contained in:
+3
-16
@@ -187,7 +187,6 @@ public class JavaDescriptorResolver {
|
|||||||
protected final Map<String, ResolverNamespaceData> namespaceDescriptorCacheByFqn = Maps.newHashMap();
|
protected final Map<String, ResolverNamespaceData> namespaceDescriptorCacheByFqn = Maps.newHashMap();
|
||||||
protected final Map<PsiElement, ResolverNamespaceData> namespaceDescriptorCache = Maps.newHashMap();
|
protected final Map<PsiElement, ResolverNamespaceData> namespaceDescriptorCache = Maps.newHashMap();
|
||||||
|
|
||||||
protected final Map<PsiMethod, FunctionDescriptorImpl> methodDescriptorCache = Maps.newHashMap();
|
|
||||||
protected final JavaPsiFacade javaFacade;
|
protected final JavaPsiFacade javaFacade;
|
||||||
protected final GlobalSearchScope javaSearchScope;
|
protected final GlobalSearchScope javaSearchScope;
|
||||||
protected final JavaSemanticServices semanticServices;
|
protected final JavaSemanticServices semanticServices;
|
||||||
@@ -1205,7 +1204,6 @@ public class JavaDescriptorResolver {
|
|||||||
Set<NamedFunctionDescriptor> functionsFromCurrent = Sets.newHashSet();
|
Set<NamedFunctionDescriptor> functionsFromCurrent = Sets.newHashSet();
|
||||||
for (PsiMethodWrapper method : namedMembers.methods) {
|
for (PsiMethodWrapper method : namedMembers.methods) {
|
||||||
FunctionDescriptorImpl function = resolveMethodToFunctionDescriptor(owner, psiClass,
|
FunctionDescriptorImpl function = resolveMethodToFunctionDescriptor(owner, psiClass,
|
||||||
typeSubstitutorForGenericSuperclasses,
|
|
||||||
method);
|
method);
|
||||||
if (function != null) {
|
if (function != null) {
|
||||||
functionsFromCurrent.add((NamedFunctionDescriptor) function);
|
functionsFromCurrent.add((NamedFunctionDescriptor) function);
|
||||||
@@ -1324,21 +1322,12 @@ public class JavaDescriptorResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private FunctionDescriptorImpl resolveMethodToFunctionDescriptor(ClassOrNamespaceDescriptor owner, final PsiClass psiClass, TypeSubstitutor typeSubstitutorForGenericSuperclasses, final PsiMethodWrapper method) {
|
private FunctionDescriptorImpl resolveMethodToFunctionDescriptor(ClassOrNamespaceDescriptor owner, final PsiClass psiClass, final PsiMethodWrapper method) {
|
||||||
|
|
||||||
PsiType returnType = method.getReturnType();
|
PsiType returnType = method.getReturnType();
|
||||||
if (returnType == null) {
|
if (returnType == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
FunctionDescriptorImpl functionDescriptor = methodDescriptorCache.get(method.getPsiMethod());
|
|
||||||
if (functionDescriptor != null) {
|
|
||||||
if (method.getPsiMethod().getContainingClass() != psiClass) {
|
|
||||||
//functionDescriptor = functionDescriptor.substitute(typeSubstitutorForGenericSuperclasses);
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
return functionDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResolverScopeData scopeData = getResolverScopeData(owner, new PsiClassWrapper(psiClass));
|
ResolverScopeData scopeData = getResolverScopeData(owner, new PsiClassWrapper(psiClass));
|
||||||
|
|
||||||
boolean kotlin;
|
boolean kotlin;
|
||||||
@@ -1388,7 +1377,6 @@ public class JavaDescriptorResolver {
|
|||||||
method.getName(),
|
method.getName(),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION
|
||||||
);
|
);
|
||||||
methodDescriptorCache.put(method.getPsiMethod(), functionDescriptorImpl);
|
|
||||||
|
|
||||||
final TypeVariableResolver typeVariableResolverForParameters = TypeVariableResolvers.classTypeVariableResolver(classDescriptor);
|
final TypeVariableResolver typeVariableResolverForParameters = TypeVariableResolvers.classTypeVariableResolver(classDescriptor);
|
||||||
|
|
||||||
@@ -1409,9 +1397,8 @@ public class JavaDescriptorResolver {
|
|||||||
);
|
);
|
||||||
semanticServices.getTrace().record(BindingContext.FUNCTION, method.getPsiMethod(), functionDescriptorImpl);
|
semanticServices.getTrace().record(BindingContext.FUNCTION, method.getPsiMethod(), functionDescriptorImpl);
|
||||||
FunctionDescriptor substitutedFunctionDescriptor = functionDescriptorImpl;
|
FunctionDescriptor substitutedFunctionDescriptor = functionDescriptorImpl;
|
||||||
if (method.getPsiMethod().getContainingClass() != psiClass) {
|
if (method.getPsiMethod().getContainingClass() != psiClass && !method.isStatic()) {
|
||||||
//substitutedFunctionDescriptor = functionDescriptorImpl.substitute(typeSubstitutorForGenericSuperclasses);
|
throw new IllegalStateException("non-static method in subclass");
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
}
|
||||||
return (FunctionDescriptorImpl) substitutedFunctionDescriptor;
|
return (FunctionDescriptorImpl) substitutedFunctionDescriptor;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user