Buggy code:
public class CodeSnippetClassFile extends ClassFile { public CodeSnippetClassFile ( SourceTypeBinding aType , ClassFile enclosingClassFile , boolean creatingProblemType ) { } public static void createProblemType ( TypeDeclaration typeDeclaration , CompilationResult unitResult ) { SourceTypeBinding typeBinding = typeDeclaration . binding ; ClassFile classFile = new CodeSnippetClassFile ( 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 ; j ++ ) { if ( ( ( methodDeclarations [ j ] ) != null ) && ( ( methodDeclarations [ j ] . binding ) == ( methods [ i ] ) ) ) { AbstractMethodDeclaration methodDecl ; if ( ( methodDecl = methodDeclarations [ j ] ) . isConstructor ( ) ) { classFile . addProblemConstructor ( methodDecl , methodBinding , problemsCopy ) ; } else { classFile . addProblemMethod ( methodDecl , methodBinding , problemsCopy ) ; } break ; } } } } } classFile . addDefaultAbstractMethods ( ) ; } if ( ( typeDeclaration . memberTypes ) != null ) { for ( int i = 0 , max = typeDeclaration . memberTypes . length ; i < max ; i ++ ) { TypeDeclaration memberType = typeDeclaration . memberTypes [ i ] ; if ( ( memberType . binding ) != null ) { classFile . recordNestedMemberAttribute ( memberType . binding ) ; ClassFile . createProblemType ( memberType , unitResult ) ; } } } classFile . addAttributes ( ) ; unitResult . record ( typeBinding . constantPoolName ( ) , classFile ) ; } }

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