void normalizeMethod ( JCMethodDecl md , List < JCStatement > initCode , List < TypeCompound > initTAs ) { if ( md . name == names . init && TreeInfo . isInitialConstructor ( md ) ) { // We are seeing a constructor that does not call another // constructor of the same class. List < JCStatement > stats = md . body . stats ; ListBuffer < JCStatement > newstats = new ListBuffer < JCStatement > ( ) ; if ( stats . nonEmpty ( ) ) { // Copy initializers of synthetic variables generated in // the translation of inner classes. while ( TreeInfo . isSyntheticInit ( stats . head ) ) { newstats . append ( stats . head ) ; stats = stats . tail ; } // Copy superclass constructor call newstats . append ( stats . head ) ; stats = stats . tail ; // Copy remaining synthetic initializers. while ( stats . nonEmpty ( ) && TreeInfo . isSyntheticInit ( stats . head ) ) { newstats . append ( stats . head ) ; stats = stats . tail ; } // Now insert the initializer code. newstats . appendList ( initCode ) ; // And copy all remaining statements. while ( stats . nonEmpty ( ) ) { newstats . append ( stats . head ) ; stats = stats . tail ; } } md . body . stats = newstats . toList ( ) ; if ( md . body . endpos == Position . NOPOS ) md . body . endpos = TreeInfo . endPos ( md . body . stats . last ( ) ) ; md . sym . appendUniqueTypeAttributes ( initTAs ) ; } }
Insert instance initializer code into initial constructor .