505 */ 506 @Override 507 public boolean isVarArgs() { 508 return super.isVarArgs(); 509 } 510 511 /** 512 * {@inheritDoc} 513 * @jls 13.1 The Form of a Binary 514 * @since 1.5 515 */ 516 @Override 517 public boolean isSynthetic() { 518 return super.isSynthetic(); 519 } 520 521 /** 522 * Returns {@code true} if this method is a default 523 * method; returns {@code false} otherwise. 524 * 525 * A default method is a non-abstract method, that is, a method 526 * with a body, declared in an interface type. 527 * 528 * @return true if and only if this method is a default 529 * method as defined by the Java Language Specification. 530 * @since 1.8 531 */ 532 public boolean isDefault() { 533 return (getModifiers() & Modifier.ABSTRACT) == 0 && 534 getDeclaringClass().isInterface(); 535 } 536 537 // NOTE that there is no synchronization used here. It is correct 538 // (though not efficient) to generate more than one MethodAccessor 539 // for a given Method. However, avoiding synchronization will 540 // probably make the implementation more scalable. 541 private MethodAccessor acquireMethodAccessor() { 542 // First check to see if one has been created yet, and take it 543 // if so 544 MethodAccessor tmp = null; 545 if (root != null) tmp = root.getMethodAccessor(); 546 if (tmp != null) { 547 methodAccessor = tmp; 548 } else { 549 // Otherwise fabricate one and propagate it up to the root 550 tmp = reflectionFactory.newMethodAccessor(this); 551 setMethodAccessor(tmp); 552 } 553 554 return tmp; | 505 */ 506 @Override 507 public boolean isVarArgs() { 508 return super.isVarArgs(); 509 } 510 511 /** 512 * {@inheritDoc} 513 * @jls 13.1 The Form of a Binary 514 * @since 1.5 515 */ 516 @Override 517 public boolean isSynthetic() { 518 return super.isSynthetic(); 519 } 520 521 /** 522 * Returns {@code true} if this method is a default 523 * method; returns {@code false} otherwise. 524 * 525 * A default method is a public non-abstract instance method, that 526 * is, a non-static method with a body, declared in an interface 527 * type. 528 * 529 * @return true if and only if this method is a default 530 * method as defined by the Java Language Specification. 531 * @since 1.8 532 */ 533 public boolean isDefault() { 534 // Default methods are public non-abstract instance methods 535 // declared in an interface. 536 return ((getModifiers() & (Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC)) == 537 Modifier.PUBLIC) && getDeclaringClass().isInterface(); 538 } 539 540 // NOTE that there is no synchronization used here. It is correct 541 // (though not efficient) to generate more than one MethodAccessor 542 // for a given Method. However, avoiding synchronization will 543 // probably make the implementation more scalable. 544 private MethodAccessor acquireMethodAccessor() { 545 // First check to see if one has been created yet, and take it 546 // if so 547 MethodAccessor tmp = null; 548 if (root != null) tmp = root.getMethodAccessor(); 549 if (tmp != null) { 550 methodAccessor = tmp; 551 } else { 552 // Otherwise fabricate one and propagate it up to the root 553 tmp = reflectionFactory.newMethodAccessor(this); 554 setMethodAccessor(tmp); 555 } 556 557 return tmp; |