Buggy code:
public class Clinit extends AbstractMethodDeclaration { private static int ENUM_CONSTANTS_THRESHOLD = 2000 ; private FieldBinding assertionSyntheticFieldBinding = null ; private FieldBinding classLiteralSyntheticField = null ; public Clinit ( CompilationResult compilationResult ) { } public void analyseCode ( ClassScope classScope , InitializationFlowContext staticInitializerFlowContext , FlowInfo flowInfo ) { } public void generateCode ( ClassScope classScope , ClassFile classFile ) { } private void generateCode ( ClassScope classScope , ClassFile classFile , int clinitOffset ) { ConstantPool constantPool = classFile . constantPool ; int constantPoolOffset = constantPool . currentOffset ; int constantPoolIndex = constantPool . currentIndex ; classFile . generateMethodInfoHeaderForClinit ( ) ; int codeAttributeOffset = classFile . contentsOffset ; classFile . generateCodeAttributeHeader ( ) ; CodeStream codeStream = classFile . codeStream ; resolve ( classScope ) ; codeStream . reset ( this , classFile ) ; TypeDeclaration declaringType = classScope . referenceContext ; MethodScope staticInitializerScope = declaringType . staticInitializerScope ; staticInitializerScope . computeLocalVariablePositions ( 0 , codeStream ) ; if ( ( this . assertionSyntheticFieldBinding ) != null ) { codeStream . generateClassLiteralAccessForType ( classScope . outerMostClassScope ( ) . enclosingSourceType ( ) , this . classLiteralSyntheticField ) ; codeStream . invokeJavaLangClassDesiredAssertionStatus ( ) ; BranchLabel falseLabel = new BranchLabel ( codeStream ) ; codeStream . ifne ( falseLabel ) ; codeStream . iconst_1 ( ) ; BranchLabel jumpLabel = new BranchLabel ( codeStream ) ; codeStream . decrStackSize ( 1 ) ; codeStream . goto_ ( jumpLabel ) ; falseLabel . place ( ) ; codeStream . iconst_0 ( ) ; jumpLabel . place ( ) ; codeStream . fieldAccess ( Opcodes . OPC_putstatic , this . assertionSyntheticFieldBinding , null ) ; } final FieldDeclaration [ ] fieldDeclarations = declaringType . fields ; BlockScope lastInitializerScope = null ; int remainingFieldCount = 0 ; if ( ( TypeDeclaration . kind ( declaringType . modifiers ) ) == ( TypeDeclaration . ENUM_DECL ) ) { int enumCount = declaringType . enumConstantsCounter ; if ( enumCount > ( Clinit . ENUM_CONSTANTS_THRESHOLD ) ) { int begin = - 1 ; int count = 0 ; if ( fieldDeclarations != null ) { int max = fieldDeclarations . length ; for ( int i = 0 ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( fieldDecl . isStatic ( ) ) { if ( ( fieldDecl . getKind ( ) ) == ( AbstractVariableDeclaration . ENUM_CONSTANT ) ) { if ( begin == ( - 1 ) ) { begin = i ; } count ++ ; if ( count > ( Clinit . ENUM_CONSTANTS_THRESHOLD ) ) { SyntheticMethodBinding syntheticMethod = declaringType . binding . addSyntheticMethodForEnumInitialization ( begin , i ) ; codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticMethod , null ) ; begin = i ; <START_BUG> count = 0 ; <END_BUG> } } } } if ( count != 0 ) { SyntheticMethodBinding syntheticMethod = declaringType . binding . addSyntheticMethodForEnumInitialization ( begin , max ) ; codeStream . invoke ( Opcodes . OPC_invokestatic , syntheticMethod , null ) ; } } } else if ( fieldDeclarations != null ) { for ( int i = 0 , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( fieldDecl . isStatic ( ) ) { if ( ( fieldDecl . getKind ( ) ) == ( AbstractVariableDeclaration . ENUM_CONSTANT ) ) { fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; } else { remainingFieldCount ++ ; } } } } codeStream . generateInlinedValue ( enumCount ) ; codeStream . anewarray ( declaringType . binding ) ; if ( enumCount > 0 ) { if ( fieldDeclarations != null ) { for ( int i = 0 , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; if ( ( fieldDecl . getKind ( ) ) == ( AbstractVariableDeclaration . ENUM_CONSTANT ) ) { codeStream . dup ( ) ; codeStream . generateInlinedValue ( fieldDecl . binding . id ) ; codeStream . fieldAccess ( Opcodes . OPC_getstatic , fieldDecl . binding , null ) ; codeStream . aastore ( ) ; } } } } codeStream . fieldAccess ( Opcodes . OPC_putstatic , declaringType . enumValuesSyntheticfield , null ) ; if ( remainingFieldCount != 0 ) { for ( int i = 0 , max = fieldDeclarations . length ; ( i < max ) && ( remainingFieldCount >= 0 ) ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; switch ( fieldDecl . getKind ( ) ) { case AbstractVariableDeclaration . ENUM_CONSTANT : break ; case AbstractVariableDeclaration . INITIALIZER : if ( ! ( fieldDecl . isStatic ( ) ) ) { break ; } remainingFieldCount -- ; lastInitializerScope = ( ( Initializer ) ( fieldDecl ) ) . block . scope ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; case AbstractVariableDeclaration . FIELD : if ( ! ( fieldDecl . binding . isStatic ( ) ) ) { break ; } remainingFieldCount -- ; lastInitializerScope = null ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; } } } } else { if ( fieldDeclarations != null ) { for ( int i = 0 , max = fieldDeclarations . length ; i < max ; i ++ ) { FieldDeclaration fieldDecl = fieldDeclarations [ i ] ; switch ( fieldDecl . getKind ( ) ) { case AbstractVariableDeclaration . INITIALIZER : if ( ! ( fieldDecl . isStatic ( ) ) ) break ; lastInitializerScope = ( ( Initializer ) ( fieldDecl ) ) . block . scope ; fieldDecl . generateCode ( staticInitializerScope , codeStream ) ; break ; case AbstractVariableDeclaration . FIELD : if ( ! ( fieldDecl . binding . isStatic ( ) ) ) break ; lastInitializerScope = null ;

Fix:
count = 1 ;