8193561: Cyclic hierarchy causes a NullPointerException when setting DEFAULT flag
When marking interface as having default methods, use .owner as it is always defined. Reviewed-by: mcimadamore
This commit is contained in:
parent
36873c3c7b
commit
ee0ac147a2
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/langtools/tools/javac/cycle
@ -183,7 +183,7 @@ public class MemberEnter extends JCTree.Visitor {
|
||||
|
||||
//if this is a default method, add the DEFAULT flag to the enclosing interface
|
||||
if ((tree.mods.flags & DEFAULT) != 0) {
|
||||
m.enclClass().flags_field |= DEFAULT;
|
||||
m.owner.flags_field |= DEFAULT;
|
||||
}
|
||||
|
||||
Env<AttrContext> localEnv = methodEnv(tree, env);
|
||||
|
21
test/langtools/tools/javac/cycle/T8193561.java
Normal file
21
test/langtools/tools/javac/cycle/T8193561.java
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8193561
|
||||
* @summary Verify that there is no crash for default methods in mutually dependent interfaces
|
||||
* @compile/fail/ref=T8193561.out -XDrawDiagnostics T8193561.java
|
||||
*/
|
||||
package p;
|
||||
|
||||
interface T8193561 extends p.T8193561.I {
|
||||
|
||||
interface I extends T8193561 {
|
||||
default boolean m() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
default boolean m() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
2
test/langtools/tools/javac/cycle/T8193561.out
Normal file
2
test/langtools/tools/javac/cycle/T8193561.out
Normal file
@ -0,0 +1,2 @@
|
||||
T8193561.java:9:1: compiler.err.cyclic.inheritance: p.T8193561
|
||||
1 error
|
Loading…
x
Reference in New Issue
Block a user