mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-25 23:29:55 +00:00
8173456: com.sun.tools.javac.util.Assert.error during code compilation
Reviewed-by: mcimadamore
This commit is contained in:
parent
1ded7c8c04
commit
1b5251ab0c
@ -2947,6 +2947,14 @@ public class Attr extends JCTree.Visitor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!env.info.isSpeculative && that.getMode() == JCMemberReference.ReferenceMode.NEW) {
|
||||
Type enclosingType = exprType.getEnclosingType();
|
||||
if (enclosingType != null && enclosingType.hasTag(CLASS)) {
|
||||
// Check for the existence of an apropriate outer instance
|
||||
rs.resolveImplicitThis(that.pos(), env, exprType);
|
||||
}
|
||||
}
|
||||
|
||||
if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
|
||||
|
||||
if (that.getMode() == ReferenceMode.INVOKE &&
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8173456
|
||||
* @summary com.sun.tools.javac.util.Assert.error during code compilation
|
||||
* @compile/fail/ref=MethodReferenceNoThisTest.out -XDrawDiagnostics MethodReferenceNoThisTest.java
|
||||
*/
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
abstract class MethodReferenceNoThisTest_Base {
|
||||
protected MethodReferenceNoThisTest_Base(Function<MethodReferenceNoThisTest_Base, MethodReferenceNoThisTest_AV> x) {}
|
||||
}
|
||||
|
||||
abstract class MethodReferenceNoThisTest_AV {
|
||||
MethodReferenceNoThisTest_AV(MethodReferenceNoThisTest_Base b) {
|
||||
}
|
||||
}
|
||||
|
||||
public class MethodReferenceNoThisTest extends MethodReferenceNoThisTest_Base {
|
||||
|
||||
public MethodReferenceNoThisTest() {
|
||||
super(V::new);
|
||||
}
|
||||
|
||||
private class V extends MethodReferenceNoThisTest_AV {
|
||||
|
||||
V(MethodReferenceNoThisTest_Base b) {
|
||||
super(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
MethodReferenceNoThisTest.java:22:15: compiler.err.cant.ref.before.ctor.called: this
|
||||
1 error
|
||||
Loading…
x
Reference in New Issue
Block a user