Skip to content

Commit a680947

Browse files
committed
SONARJAVA-1585 Fix lookup in static on demand imports
1 parent 3998184 commit a680947

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

java-frontend/src/main/java/org/sonar/java/resolve/Scope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public List<JavaSymbol> lookup(String name) {
125125
}
126126

127127
// site is a type, try to find a matching type or field
128-
if ((site.kind & JavaSymbol.TYP) != 0) {
128+
if ((site.kind & JavaSymbol.TYP) != 0 && site.kind < JavaSymbol.ERRONEOUS) {
129129
List<JavaSymbol> resolved = ((JavaSymbol.TypeJavaSymbol) site).members().lookup(name);
130130
for (JavaSymbol symbol : resolved) {
131131
// TODO check accessibility

java-frontend/src/test/files/sym/ImportResolution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import static java.net.HttpURLConnection.HTTP_OK;
1717
import static java.util.Collections.reverse;
1818
import static java.util.Collections.sort;; // extra empty statements should be ignored
19-
19+
import static java.util.Collections.FOO.*;
2020
@SuppressWarnings("all")
2121
class ImportResolution {
2222
private NotImplementedTreeImpl annotationTree;

0 commit comments

Comments
 (0)