src/share/classes/java/lang/reflect/Method.java

Print this page




 487     }
 488 
 489     /**
 490      * {@inheritDoc}
 491      * @since 1.5
 492      */
 493     @Override
 494     public boolean isVarArgs() {
 495         return super.isVarArgs();
 496     }
 497 
 498     /**
 499      * {@inheritDoc}
 500      * @since 1.5
 501      */
 502     @Override
 503     public boolean isSynthetic() {
 504         return super.isSynthetic();
 505     }
 506 
















 507     // NOTE that there is no synchronization used here. It is correct
 508     // (though not efficient) to generate more than one MethodAccessor
 509     // for a given Method. However, avoiding synchronization will
 510     // probably make the implementation more scalable.
 511     private MethodAccessor acquireMethodAccessor() {
 512         // First check to see if one has been created yet, and take it
 513         // if so
 514         MethodAccessor tmp = null;
 515         if (root != null) tmp = root.getMethodAccessor();
 516         if (tmp != null) {
 517             methodAccessor = tmp;
 518         } else {
 519             // Otherwise fabricate one and propagate it up to the root
 520             tmp = reflectionFactory.newMethodAccessor(this);
 521             setMethodAccessor(tmp);
 522         }
 523 
 524         return tmp;
 525     }
 526 




 487     }
 488 
 489     /**
 490      * {@inheritDoc}
 491      * @since 1.5
 492      */
 493     @Override
 494     public boolean isVarArgs() {
 495         return super.isVarArgs();
 496     }
 497 
 498     /**
 499      * {@inheritDoc}
 500      * @since 1.5
 501      */
 502     @Override
 503     public boolean isSynthetic() {
 504         return super.isSynthetic();
 505     }
 506 
 507     /**
 508      * Returns {@code true} if this method is a default
 509      * method; returns {@code false} otherwise.
 510      *
 511      * A default method is a non-abstract method, that is a method with
 512      * a body, declared in an interface type.
 513      *
 514      * @return true if and only if this method is a default
 515      * method as defined by the Java Language Specification.
 516      * @since 1.8
 517      */
 518     public boolean isDefault() {
 519         return (getModifiers() & Modifier.ABSTRACT) == 0 &&
 520             getDeclaringClass().isInterface();
 521     }
 522 
 523     // NOTE that there is no synchronization used here. It is correct
 524     // (though not efficient) to generate more than one MethodAccessor
 525     // for a given Method. However, avoiding synchronization will
 526     // probably make the implementation more scalable.
 527     private MethodAccessor acquireMethodAccessor() {
 528         // First check to see if one has been created yet, and take it
 529         // if so
 530         MethodAccessor tmp = null;
 531         if (root != null) tmp = root.getMethodAccessor();
 532         if (tmp != null) {
 533             methodAccessor = tmp;
 534         } else {
 535             // Otherwise fabricate one and propagate it up to the root
 536             tmp = reflectionFactory.newMethodAccessor(this);
 537             setMethodAccessor(tmp);
 538         }
 539 
 540         return tmp;
 541     }
 542