--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Sat Feb 04 14:05:08 2017 -0500
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Feb 06 13:12:30 2017 +0530
@@ -2947,6 +2947,14 @@
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 &&