src/share/classes/com/sun/tools/javac/code/Symbol.java

changeset 1820
6b48ebae2569
parent 1802
8fb68f73d4b1
child 1853
831467c4c6a7
equal deleted inserted replaced
1819:7fe655cad9b1 1820:6b48ebae2569
1535 public boolean isStaticOrInstanceInit() { 1535 public boolean isStaticOrInstanceInit() {
1536 return getKind() == ElementKind.STATIC_INIT || 1536 return getKind() == ElementKind.STATIC_INIT ||
1537 getKind() == ElementKind.INSTANCE_INIT; 1537 getKind() == ElementKind.INSTANCE_INIT;
1538 } 1538 }
1539 1539
1540 /**
1541 * A polymorphic signature method (JLS SE 7, 8.4.1) is a method that
1542 * (i) is declared in the java.lang.invoke.MethodHandle class, (ii) takes
1543 * a single variable arity parameter (iii) whose declared type is Object[],
1544 * (iv) has a return type of Object and (v) is native.
1545 */
1546 public boolean isSignaturePolymorphic(Types types) {
1547 List<Type> argtypes = type.getParameterTypes();
1548 Type firstElemType = argtypes.nonEmpty() ?
1549 types.elemtype(argtypes.head) :
1550 null;
1551 return owner == types.syms.methodHandleType.tsym &&
1552 argtypes.length() == 1 &&
1553 firstElemType != null &&
1554 types.isSameType(firstElemType, types.syms.objectType) &&
1555 types.isSameType(type.getReturnType(), types.syms.objectType) &&
1556 (flags() & NATIVE) != 0;
1557 }
1558
1559 public Attribute getDefaultValue() { 1540 public Attribute getDefaultValue() {
1560 return defaultValue; 1541 return defaultValue;
1561 } 1542 }
1562 1543
1563 public List<VarSymbol> getParameters() { 1544 public List<VarSymbol> getParameters() {

mercurial