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 */ |
1382 } |
1377 } |
1383 |
1378 |
1384 // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc) |
1379 // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc) |
1385 // has type <T>, and T can be a primitive type. |
1380 // has type <T>, and T can be a primitive type. |
1386 if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) { |
1381 if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) { |
1387 Type selt = ((JCFieldAccess) tree.meth).selected.type; |
1382 JCFieldAccess mfield = (JCFieldAccess) tree.meth; |
1388 if ((selt == syms.methodHandleType && methName == names.invoke) || selt == syms.invokeDynamicType) { |
1383 if ((mfield.selected.type.tsym != null && |
|
1384 (mfield.selected.type.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0) |
|
1385 || |
|
1386 (mfield.sym != null && |
|
1387 (mfield.sym.flags() & POLYMORPHIC_SIGNATURE) != 0)) { |
1389 assert types.isSameType(restype, typeargtypes.head) : mtype; |
1388 assert types.isSameType(restype, typeargtypes.head) : mtype; |
|
1389 assert mfield.selected.type == syms.methodHandleType |
|
1390 || mfield.selected.type == syms.invokeDynamicType; |
1390 typeargtypesNonRefOK = true; |
1391 typeargtypesNonRefOK = true; |
1391 } |
1392 } |
1392 } |
1393 } |
1393 |
1394 |
1394 if (!typeargtypesNonRefOK) { |
1395 if (!typeargtypesNonRefOK) { |