private void addArcInitialization ( EnumDeclaration node ) { String enumClassName = nameTable . getFullName ( node . getTypeElement ( ) ) ; List < Statement > stmts = node . getClassInitStatements ( ) . subList ( 0 , 0 ) ; int i = 0 ; for ( EnumConstantDeclaration constant : node . getEnumConstants ( ) ) { VariableElement varElement = constant . getVariableElement ( ) ; ClassInstanceCreation creation = new ClassInstanceCreation ( constant . getExecutablePair ( ) ) ; TreeUtil . copyList ( constant . getArguments ( ) , creation . getArguments ( ) ) ; Expression constName = options . stripEnumConstants ( ) ? new StringLiteral ( "JAVA_LANG_ENUM_NAME_STRIPPED" , typeUtil ) : new NativeExpression ( UnicodeUtils . format ( "JreEnumConstantName(%s_class_(), %d)" , enumClassName , i ) , typeUtil . getJavaString ( ) . asType ( ) ) ; creation . addArgument ( constName ) ; creation . addArgument ( new NumberLiteral ( i ++ , typeUtil ) ) ; creation . setHasRetainedResult ( true ) ; stmts . add ( new ExpressionStatement ( new Assignment ( new SimpleName ( varElement ) , creation ) ) ) ; } }
the shared allocation optimization .