protected void addConstructors ( ClassFile proxyClassType , List < DeferredBytecode > initialValueBytecode ) { try { if ( getBeanType ( ) . isInterface ( ) ) { ConstructorUtils . addDefaultConstructor ( proxyClassType , initialValueBytecode , ! useConstructedFlag ( ) ) ; } else { boolean constructorFound = false ; for ( Constructor < ? > constructor : AccessController . doPrivileged ( new GetDeclaredConstructorsAction ( getBeanType ( ) ) ) ) { if ( ( constructor . getModifiers ( ) & Modifier . PRIVATE ) == 0 ) { constructorFound = true ; String [ ] exceptions = new String [ constructor . getExceptionTypes ( ) . length ] ; for ( int i = 0 ; i < exceptions . length ; ++ i ) { exceptions [ i ] = constructor . getExceptionTypes ( ) [ i ] . getName ( ) ; } ConstructorUtils . addConstructor ( BytecodeUtils . VOID_CLASS_DESCRIPTOR , DescriptorUtils . parameterDescriptors ( constructor . getParameterTypes ( ) ) , exceptions , proxyClassType , initialValueBytecode , ! useConstructedFlag ( ) ) ; } } if ( ! constructorFound ) { // the bean only has private constructors, we need to generate // two fake constructors that call each other addConstructorsForBeanWithPrivateConstructors ( proxyClassType ) ; } } } catch ( Exception e ) { throw new WeldException ( e ) ; } }
Adds a constructor for the proxy for each constructor declared by the base bean type .