src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 571
f0e3ec1f9d9f
parent 537
9d9d08922405
child 573
005bec70ca27
equal deleted inserted replaced
544:98cba5876cb5 571:f0e3ec1f9d9f
120 allowStringsInSwitch = source.allowStringsInSwitch(); 120 allowStringsInSwitch = source.allowStringsInSwitch();
121 sourceName = source.name; 121 sourceName = source.name;
122 relax = (options.get("-retrofit") != null || 122 relax = (options.get("-retrofit") != null ||
123 options.get("-relax") != null); 123 options.get("-relax") != null);
124 useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null; 124 useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null;
125 allowInvokedynamic = options.get("invokedynamic") != null;
126 enableSunApiLintControl = options.get("enableSunApiLintControl") != null; 125 enableSunApiLintControl = options.get("enableSunApiLintControl") != null;
127 } 126 }
128 127
129 /** Switch: relax some constraints for retrofit mode. 128 /** Switch: relax some constraints for retrofit mode.
130 */ 129 */
152 151
153 /** Switch: allow references to surrounding object from anonymous 152 /** Switch: allow references to surrounding object from anonymous
154 * objects during constructor call? 153 * objects during constructor call?
155 */ 154 */
156 boolean allowAnonOuterThis; 155 boolean allowAnonOuterThis;
157
158 /** Switch: allow invokedynamic syntax
159 */
160 boolean allowInvokedynamic;
161 156
162 /** 157 /**
163 * Switch: warn about use of variable before declaration? 158 * Switch: warn about use of variable before declaration?
164 * RFE: 6425594 159 * RFE: 6425594
165 */ 160 */
1375 } 1370 }
1376 1371
1377 // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc) 1372 // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
1378 // has type <T>, and T can be a primitive type. 1373 // has type <T>, and T can be a primitive type.
1379 if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) { 1374 if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) {
1380 Type selt = ((JCFieldAccess) tree.meth).selected.type; 1375 JCFieldAccess mfield = (JCFieldAccess) tree.meth;
1381 if ((selt == syms.methodHandleType && methName == names.invoke) || selt == syms.invokeDynamicType) { 1376 if ((mfield.selected.type.tsym != null &&
1377 (mfield.selected.type.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0)
1378 ||
1379 (mfield.sym != null &&
1380 (mfield.sym.flags() & POLYMORPHIC_SIGNATURE) != 0)) {
1382 assert types.isSameType(restype, typeargtypes.head) : mtype; 1381 assert types.isSameType(restype, typeargtypes.head) : mtype;
1382 assert mfield.selected.type == syms.methodHandleType
1383 || mfield.selected.type == syms.invokeDynamicType;
1383 typeargtypesNonRefOK = true; 1384 typeargtypesNonRefOK = true;
1384 } 1385 }
1385 } 1386 }
1386 1387
1387 if (!typeargtypesNonRefOK) { 1388 if (!typeargtypesNonRefOK) {

mercurial