public final void addClinit(){
  if (needClassInitMethod()) {
    int length;
    AbstractMethodDeclaration[] methodDeclarations;
    if ((methodDeclarations=this.methods) == null) {
      length=0;
      methodDeclarations=new AbstractMethodDeclaration[1];
    }
 else {
      length=methodDeclarations.length;
      System.arraycopy(methodDeclarations,0,(methodDeclarations=new AbstractMethodDeclaration[length + 1]),1,length);
    }
    Clinit clinit=new Clinit(this.compilationResult);
    methodDeclarations[0]=clinit;
    clinit.declarationSourceStart=clinit.sourceStart=this.sourceStart;
    clinit.declarationSourceEnd=clinit.sourceEnd=this.sourceEnd;
    clinit.bodyEnd=this.sourceEnd;
    this.methods=methodDeclarations;
  }
}

public final void addClinit ( ) { if ( needClassInitMethod ( ) ) { int length ; AbstractMethodDeclaration [ ] methodDeclarations ; if ( ( methodDeclarations = this . methods ) == null ) { length = 0 ; methodDeclarations = new AbstractMethodDeclaration [ 1 ] ; } else { length = methodDeclarations . length ; System . arraycopy ( methodDeclarations , 0 , ( methodDeclarations = new AbstractMethodDeclaration [ length + 1 ] ) , 1 , length ) ; } Clinit clinit = new Clinit ( this . compilationResult ) ; methodDeclarations [ 0 ] = clinit ; clinit . declarationSourceStart = clinit . sourceStart = this . sourceStart ; clinit . declarationSourceEnd = clinit . sourceEnd = this . sourceEnd ; clinit . bodyEnd = this . sourceEnd ; this . methods = methodDeclarations ; } }
this method is responsible for adding a < clinit > method declaration to the type method collections . note that this implementation is inserting it in first place ( as vaj or javac ) , and that this impacts the behavior of the method constantpool . resetforclinit ( int . int ) , in so far as the latter will have to reset the constant pool state accordingly ( if it was added first , it does not need to preserve some of the method specific cached entries since this will be the first method ) . inserts the clinit method declaration in the first position .
