mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
register local refs to java if references are registered in literal expression by foreign contributor (e.g. reflection, data providers, etc) (IDEA-171495)
This commit is contained in:
@@ -793,6 +793,15 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (myHolder.hasErrorResults()) return;
|
||||
myHolder.add(HighlightUtil.checkLiteralExpressionParsingError(expression, myLanguageLevel,myFile));
|
||||
if (myRefCountHolder != null && !myHolder.hasErrorResults()) registerReferencesFromInjectedFragments(expression);
|
||||
|
||||
if (myRefCountHolder != null && !myHolder.hasErrorResults()) {
|
||||
for (PsiReference reference : expression.getReferences()) {
|
||||
PsiElement resolve = reference.resolve();
|
||||
if (resolve instanceof PsiMember) {
|
||||
myRefCountHolder.registerReference(reference, new CandidateInfo(resolve, PsiSubstitutor.EMPTY));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class MyTest {
|
||||
public static void main(String[] args) throws Throwable {
|
||||
MyTest.class.getMethod("abcdef");
|
||||
}
|
||||
|
||||
private void abcdef() {}
|
||||
}
|
||||
@@ -184,6 +184,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testTryWithResourcesWithMultipleCloseInterfaces() { doTest(false, false);}
|
||||
public void testIDEA138978() { doTest(false, false); }
|
||||
public void testIntersectionTypeCast() { doTest(false, false); }
|
||||
public void testUsedMethodCalledViaReflectionInTheSameFile() { doTest(true, false); }
|
||||
|
||||
public void testArrayInitializerTypeCheckVariableType() { doTest(false, false);}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user