mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
reflection fix + tests
This commit is contained in:
+16
-2
@@ -96,10 +96,20 @@ public class JavaLangClassMemberReference extends PsiReferenceBase<PsiLiteralExp
|
||||
if (psiClass != null && type != null) {
|
||||
if (type == Type.DECLARED_FIELD) {
|
||||
return psiClass.getFields();
|
||||
} else if (type == Type.DECLARED_METHOD) {
|
||||
} else if (type == Type.FIELD) {
|
||||
final List<PsiField> fields = new ArrayList<PsiField>();
|
||||
for (PsiField field : psiClass.getFields()) {
|
||||
if (isPublic(field)) {
|
||||
fields.add(field);
|
||||
}
|
||||
}
|
||||
return fields.toArray();
|
||||
} else if (type == Type.DECLARED_METHOD || type == Type.METHOD) {
|
||||
final List<LookupElementBuilder> elements = new ArrayList<LookupElementBuilder>();
|
||||
for (PsiMethod method : psiClass.getMethods()) {
|
||||
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).setInsertHandler(this));
|
||||
if (type == Type.DECLARED_METHOD || isPublic(method)) {
|
||||
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).setInsertHandler(this));
|
||||
}
|
||||
}
|
||||
return elements.toArray();
|
||||
}
|
||||
@@ -126,6 +136,10 @@ public class JavaLangClassMemberReference extends PsiReferenceBase<PsiLiteralExp
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPublic(final PsiMember psiField) {
|
||||
return psiField.hasModifierProperty(PsiModifier.PUBLIC);
|
||||
}
|
||||
|
||||
private static String getMethodTypes(PsiMethod method) {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
for (PsiParameter parameter : method.getParameterList().getParameters()) {
|
||||
|
||||
Reference in New Issue
Block a user