private void convertClassInitializer ( AbstractTypeDeclaration typeDecl ) { EntityDeclaration decl = classFile . getMethod ( "<clinit>" , "()V" ) ; if ( decl == null ) { return ; // Class doesn't have a static initializer. } MethodTranslator translator = new MethodTranslator ( parserEnv , translationEnv , null , typeDecl , null ) ; Block block = ( Block ) decl . acceptVisitor ( translator , null ) ; for ( Statement stmt : block . getStatements ( ) ) { typeDecl . addClassInitStatement ( stmt . copy ( ) ) ; } }
The clinit method isn t converted into a member element by javac so extract it separately from the classfile .