Buggy code:
public class ClassScope extends Scope { public TypeDeclaration referenceContext ; public TypeReference superTypeReference ; ArrayList deferredBoundChecks ; public ClassScope ( Scope parent , TypeDeclaration context ) { } void buildAnonymousTypeBinding ( SourceTypeBinding enclosingType , ReferenceBinding supertype ) { } void buildFields ( ) { } void buildFieldsAndMethods ( ) { } private LocalTypeBinding buildLocalType ( SourceTypeBinding enclosingType , ReferenceBinding anonymousOriginalSuperType , PackageBinding packageBinding ) { } void buildLocalTypeBinding ( SourceTypeBinding enclosingType ) { } private void buildMemberTypes ( AccessRestriction accessRestriction ) { } void buildMethods ( ) { SourceTypeBinding sourceType = this . referenceContext . binding ; if ( sourceType . areMethodsInitialized ( ) ) return ; boolean isEnum = ( TypeDeclaration . kind ( this . referenceContext . modifiers ) ) == ( TypeDeclaration . ENUM_DECL ) ; if ( ( ( this . referenceContext . methods ) == null ) && ( ! isEnum ) ) { this . referenceContext . binding . setMethods ( Binding . NO_METHODS ) ; return ; } AbstractMethodDeclaration [ ] methods = this . referenceContext . methods ; int size = ( methods == null ) ? 0 : methods . length ; int clinitIndex = - 1 ; for ( int i = 0 ; i < size ; i ++ ) { if ( methods [ i ] . isClinit ( ) ) { clinitIndex = i ; break ; } } int count = ( isEnum ) ? 2 : 0 ; MethodBinding [ ] methodBindings = new MethodBinding [ ( clinitIndex == ( - 1 ) ? size : size - 1 ) + count ] ; if ( isEnum ) { methodBindings [ 0 ] = sourceType . addSyntheticEnumMethod ( TypeConstants . VALUES ) ; methodBindings [ 1 ] = sourceType . addSyntheticEnumMethod ( TypeConstants . VALUEOF ) ; } boolean hasNativeMethods = false ; if ( sourceType . isAbstract ( ) ) { for ( int i = 0 ; i < size ; i ++ ) { if ( i != clinitIndex ) { MethodScope scope = new MethodScope ( this , methods [ i ] , false ) ; MethodBinding methodBinding = scope . createMethod ( methods [ i ] ) ; if ( methodBinding != null ) { methodBindings [ ( count ++ ) ] = methodBinding ; hasNativeMethods = hasNativeMethods || ( methodBinding . isNative ( ) ) ; } } } } else { boolean hasAbstractMethods = false ; for ( int i = 0 ; i < size ; i ++ ) { if ( i != clinitIndex ) { MethodScope scope = new MethodScope ( this , methods [ i ] , false ) ; MethodBinding methodBinding = scope . createMethod ( methods [ i ] ) ; if ( methodBinding != null ) { methodBindings [ ( count ++ ) ] = methodBinding ; hasAbstractMethods = hasAbstractMethods || ( methodBinding . isAbstract ( ) ) ; hasNativeMethods = hasNativeMethods || ( methodBinding . isNative ( ) ) ; } } } if ( hasAbstractMethods ) problemReporter ( ) . abstractMethodInConcreteClass ( sourceType ) ; } if ( count != ( methodBindings . length ) ) System . arraycopy ( methodBindings , 0 , ( methodBindings = new MethodBinding [ count ] ) , 0 , count ) ; sourceType . tagBits &= ~ ( ( TagBits . AreMethodsSorted ) | ( TagBits . AreMethodsComplete ) ) ; sourceType . setMethods ( methodBindings ) ; if ( hasNativeMethods ) { for ( int i = 0 ; i < ( methodBindings . length ) ; i ++ ) { methodBindings [ i ] . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } <START_BUG> FieldBinding [ ] fields = sourceType . fields ( ) ; <END_BUG> for ( int i = 0 ; i < ( fields . length ) ; i ++ ) { fields [ i ] . modifiers |= ExtraCompilerModifiers . AccLocallyUsed ; } } } SourceTypeBinding buildType ( SourceTypeBinding enclosingType , PackageBinding packageBinding , AccessRestriction accessRestriction ) { } private void buildTypeVariables ( ) { } private void checkAndSetModifiers ( ) { } private void checkAndSetModifiersForField ( FieldBinding fieldBinding , FieldDeclaration fieldDecl ) { } public void checkParameterizedSuperTypeCollisions ( ) { } private void checkForInheritedMemberTypes ( SourceTypeBinding sourceType ) { } public void checkParameterizedTypeBounds ( ) { } private void connectMemberTypes ( ) { } private boolean connectSuperclass ( ) { } private boolean connectEnumSuperclass ( ) { } private boolean connectSuperInterfaces ( ) { } void connectTypeHierarchy ( ) { } private void connectTypeHierarchyWithoutMembers ( ) { } public boolean detectHierarchyCycle ( TypeBinding superType , TypeReference reference ) { } private boolean detectHierarchyCycle ( SourceTypeBinding sourceType , ReferenceBinding superType , TypeReference reference ) { } private ReferenceBinding findSupertype ( TypeReference typeReference ) { } public ProblemReporter problemReporter ( ) { } public TypeDeclaration referenceType ( ) { } public String toString ( ) { } }

Fix:
FieldBinding [ ] fields = sourceType . unResolvedFields ( ) ;