Buggy code:
public class ClassFile implements CompilerModifiers , AttributeNamesConstants , TypeConstants , TypeIds { public SourceTypeBinding referenceBinding ; public ConstantPool constantPool ; public ClassFile enclosingClassFile ; public int produceDebugAttributes ; public ReferenceBinding [ ] innerClassesBindings ; public int numberOfInnerClasses ; public byte [ ] header ; public byte [ ] contents ; public int headerOffset ; public int contentsOffset ; public int constantPoolOffset ; public int methodCountOffset ; public int methodCount ; protected boolean creatingProblemType ; public static final int INITIAL_CONTENTS_SIZE = 1000 ; public static final int INITIAL_HEADER_SIZE = 1000 ; public static final int INCREMENT_SIZE = 1000 ; public static final int INNER_CLASSES_SIZE = 5 ; protected HashtableOfType nameUsage ; public CodeStream codeStream ; protected int problemLine ; public ClassFile ( ) { } public ClassFile ( SourceTypeBinding aType , ClassFile enclosingClassFile , boolean creatingProblemType ) { } public void addAbstractMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding ) { } public void addAttributes ( ) { } public void addDefaultAbstractMethods ( ) { } public void addFieldInfo ( FieldBinding fieldBinding ) { } public void addFieldInfos ( ) { } public void addInnerClasses ( ReferenceBinding referenceBinding ) { } public void addProblemClinit ( IProblem [ ] problems ) { } public void addProblemConstructor ( AbstractMethodDeclaration method , MethodBinding methodBinding , IProblem [ ] problems ) { } public void addProblemConstructor ( AbstractMethodDeclaration method , MethodBinding methodBinding , IProblem [ ] problems , int savedOffset ) { } public void addProblemMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding , IProblem [ ] problems ) { } public void addProblemMethod ( AbstractMethodDeclaration method , MethodBinding methodBinding , IProblem [ ] problems , int savedOffset ) { } public void addSpecialMethods ( ) { } public void generateMissingAbstractMethods ( MethodDeclaration [ ] methodDeclarations , CompilationResult compilationResult ) { } private void addMissingAbstractProblemMethod ( MethodDeclaration methodDeclaration , MethodBinding methodBinding , IProblem problem , CompilationResult compilationResult ) { } public void completeCodeAttributeForMissingAbstractProblemMethod ( MethodBinding binding , int codeAttributeOffset , int [ ] exceptionHandler , int [ ] startLineIndexes ) { } public void addSyntheticConstructorAccessMethod ( SyntheticAccessMethodBinding methodBinding ) { } public void addSyntheticFieldReadAccessMethod ( SyntheticAccessMethodBinding methodBinding ) { } public void addSyntheticFieldWriteAccessMethod ( SyntheticAccessMethodBinding methodBinding ) { } public void addSyntheticMethodAccessMethod ( SyntheticAccessMethodBinding methodBinding ) { } public static String buildAllDirectoriesInto ( String outputPath , String relativeFileName ) throws IOException { } public void completeCodeAttribute ( int codeAttributeOffset ) { } public void completeCodeAttributeForClinit ( int codeAttributeOffset ) { } public void completeCodeAttributeForClinit ( int codeAttributeOffset , int [ ] exceptionHandler , int [ ] startLineIndexes ) { } public void completeCodeAttributeForProblemMethod ( AbstractMethodDeclaration method , MethodBinding binding , int codeAttributeOffset , int [ ] exceptionHandler , int [ ] startLineIndexes ) { } public void completeCodeAttributeForSyntheticAccessMethod ( SyntheticAccessMethodBinding binding , int codeAttributeOffset , int [ ] startLineIndexes ) { } public void completeMethodInfo ( int methodAttributeOffset , int attributeNumber ) { } public char [ ] computeConstantPoolName ( LocalTypeBinding localType ) { } public static void createProblemType ( TypeDeclaration typeDeclaration , CompilationResult unitResult ) { SourceTypeBinding typeBinding = typeDeclaration . binding ; ClassFile classFile = new ClassFile ( typeBinding , null , true ) ; if ( typeBinding . isMemberType ( ) ) classFile . recordEnclosingTypeAttributes ( typeBinding ) ; FieldBinding [ ] fields = typeBinding . fields ; if ( ( fields != null ) && ( fields != ( NoFields ) ) ) { for ( int i = 0 , max = fields . length ; i < max ; i ++ ) { if ( ( fields [ i ] . constant ) == null ) { <START_BUG> org . eclipse . jdt . internal . compiler . ast . FieldReference . getConstantFor ( fields [ i ] , false , null , null , 0 ) ; <END_BUG> } } classFile . addFieldInfos ( ) ; } else { classFile . contents [ ( ( classFile . contentsOffset ) ++ ) ] = 0 ; classFile . contents [ ( ( classFile . contentsOffset ) ++ ) ] = 0 ; } classFile . setForMethodInfos ( ) ; MethodBinding [ ] methods = typeBinding . methods ; AbstractMethodDeclaration [ ] methodDeclarations = typeDeclaration . methods ; int maxMethodDecl = ( methodDeclarations == null ) ? 0 : methodDeclarations . length ; int problemsLength ; IProblem [ ] problems = unitResult . getErrors ( ) ; if ( problems == null ) { problems = new IProblem [ 0 ] ; } IProblem [ ] problemsCopy = new IProblem [ problemsLength = problems . length ] ; System . arraycopy ( problems , 0 , problemsCopy , 0 , problemsLength ) ; if ( methods != null ) { if ( typeBinding . isInterface ( ) ) { classFile . addProblemClinit ( problemsCopy ) ; for ( int i = 0 , max = methods . length ; i < max ; i ++ ) { MethodBinding methodBinding ; if ( ( methodBinding = methods [ i ] ) != null ) { for ( int j = 0 ; j < maxMethodDecl ; j ++ ) { if ( ( ( methodDeclarations [ j ] ) != null ) && ( ( methodDeclarations [ j ] . binding ) == ( methods [ i ] ) ) ) { if ( ! ( methodBinding . isConstructor ( ) ) ) { classFile . addAbstractMethod ( methodDeclarations [ j ] , methodBinding ) ; } break ; } } } } } else { for ( int i = 0 , max = methods . length ; i < max ; i ++ ) { MethodBinding methodBinding ; if ( ( methodBinding = methods [ i ] ) != null ) { for ( int j = 0 ; j < maxMethodDecl ;

Fix:
org . eclipse . jdt . internal . compiler . ast . FieldReference . getConstantFor ( fields [ i ] , null , false , null ) ;