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

Print this page




 394         ConstructorAccessor ca = constructorAccessor;   // read volatile
 395         if (ca == null) {
 396             ca = acquireConstructorAccessor();
 397         }
 398         @SuppressWarnings("unchecked")
 399         T inst = (T) ca.newInstance(initargs);
 400         return inst;
 401     }
 402 
 403     /**
 404      * {@inheritDoc}
 405      * @since 1.5
 406      */
 407     @Override
 408     public boolean isVarArgs() {
 409         return super.isVarArgs();
 410     }
 411 
 412     /**
 413      * {@inheritDoc}

 414      * @since 1.5
 415      */
 416     @Override
 417     public boolean isSynthetic() {
 418         return super.isSynthetic();
 419     }
 420 
 421     // NOTE that there is no synchronization used here. It is correct
 422     // (though not efficient) to generate more than one
 423     // ConstructorAccessor for a given Constructor. However, avoiding
 424     // synchronization will probably make the implementation more
 425     // scalable.
 426     private ConstructorAccessor acquireConstructorAccessor() {
 427         // First check to see if one has been created yet, and take it
 428         // if so.
 429         ConstructorAccessor tmp = null;
 430         if (root != null) tmp = root.getConstructorAccessor();
 431         if (tmp != null) {
 432             constructorAccessor = tmp;
 433         } else {




 394         ConstructorAccessor ca = constructorAccessor;   // read volatile
 395         if (ca == null) {
 396             ca = acquireConstructorAccessor();
 397         }
 398         @SuppressWarnings("unchecked")
 399         T inst = (T) ca.newInstance(initargs);
 400         return inst;
 401     }
 402 
 403     /**
 404      * {@inheritDoc}
 405      * @since 1.5
 406      */
 407     @Override
 408     public boolean isVarArgs() {
 409         return super.isVarArgs();
 410     }
 411 
 412     /**
 413      * {@inheritDoc}
 414      * @jls 13.1 The Form of a Binary
 415      * @since 1.5
 416      */
 417     @Override
 418     public boolean isSynthetic() {
 419         return super.isSynthetic();
 420     }
 421 
 422     // NOTE that there is no synchronization used here. It is correct
 423     // (though not efficient) to generate more than one
 424     // ConstructorAccessor for a given Constructor. However, avoiding
 425     // synchronization will probably make the implementation more
 426     // scalable.
 427     private ConstructorAccessor acquireConstructorAccessor() {
 428         // First check to see if one has been created yet, and take it
 429         // if so.
 430         ConstructorAccessor tmp = null;
 431         if (root != null) tmp = root.getConstructorAccessor();
 432         if (tmp != null) {
 433             constructorAccessor = tmp;
 434         } else {