Skip to content

Commit bb3d226

Browse files
author
Vicente Romero
committed
8238213: Method resolution should stop on static error
Reviewed-by: jlahoda
1 parent 81fdeb5 commit bb3d226

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3417,7 +3417,7 @@ abstract class LookupHelper {
34173417
*/
34183418
final boolean shouldStop(Symbol sym, MethodResolutionPhase phase) {
34193419
return phase.ordinal() > maxPhase.ordinal() ||
3420-
!sym.kind.isResolutionError() || sym.kind == AMBIGUOUS;
3420+
!sym.kind.isResolutionError() || sym.kind == AMBIGUOUS || sym.kind == STATICERR;
34213421
}
34223422

34233423
/**
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @test /nodynamiccopyright/
3+
* @bug 8238213
4+
* @summary Method resolution should stop on static error
5+
* @compile/fail/ref=ShouldStopOnStaticError.out -XDrawDiagnostics ShouldStopOnStaticError.java
6+
*/
7+
8+
public class ShouldStopOnStaticError {
9+
static void foo() {
10+
test1(5.0);
11+
test2((Double)5.0);
12+
}
13+
14+
void test1(double d) {}
15+
void test1(Double d) {}
16+
17+
void test2(Number n) {}
18+
static void test2(Double... d) {}
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ShouldStopOnStaticError.java:10:9: compiler.err.non-static.cant.be.ref: kindname.method, test1(double)
2+
ShouldStopOnStaticError.java:11:9: compiler.err.non-static.cant.be.ref: kindname.method, test2(java.lang.Number)
3+
2 errors

0 commit comments

Comments
 (0)