Buggy code:
public class LookupEnvironment implements ProblemReasons , TypeConstants { static final int BUILD_FIELDS_AND_METHODS = 4 ; static final int BUILD_TYPE_HIERARCHY = 1 ; static final int CHECK_AND_SET_IMPORTS = 2 ; static final int CONNECT_TYPE_HIERARCHY = 3 ; static final ProblemPackageBinding TheNotFoundPackage = new ProblemPackageBinding ( CharOperation . NO_CHAR , ProblemReasons . NotFound ) ; static final ProblemReferenceBinding TheNotFoundType = new ProblemReferenceBinding ( CharOperation . NO_CHAR , null , ProblemReasons . NotFound ) ; private Map accessRestrictions ; ImportBinding [ ] defaultImports ; PackageBinding defaultPackage ; HashtableOfPackage knownPackages ; private int lastCompletedUnitIndex = - 1 ; private int lastUnitIndex = - 1 ; public INameEnvironment nameEnvironment ; public CompilerOptions globalOptions ; public ProblemReporter problemReporter ; public ClassFilePool classFilePool ; private int stepCompleted ; public ITypeRequestor typeRequestor ; private ArrayBinding [ ] [ ] uniqueArrayBindings ; private SimpleLookupTable uniqueParameterizedTypeBindings ; private SimpleLookupTable uniqueRawTypeBindings ; private SimpleLookupTable uniqueWildcardBindings ; private SimpleLookupTable uniqueParameterizedGenericMethodBindings ; public CompilationUnitDeclaration unitBeingCompleted = null ; private CompilationUnitDeclaration [ ] units = new CompilationUnitDeclaration [ 4 ] ; private MethodVerifier verifier ; public LookupEnvironment ( ITypeRequestor typeRequestor , CompilerOptions globalOptions , ProblemReporter problemReporter , INameEnvironment nameEnvironment ) { } public ReferenceBinding askForType ( char [ ] [ ] compoundName ) { } ReferenceBinding askForType ( PackageBinding packageBinding , char [ ] name ) { } public void buildTypeBindings ( CompilationUnitDeclaration unit , AccessRestriction accessRestriction ) { } public BinaryTypeBinding cacheBinaryType ( IBinaryType binaryType , AccessRestriction accessRestriction ) { } public BinaryTypeBinding cacheBinaryType ( IBinaryType binaryType , boolean needFieldsAndMethods , AccessRestriction accessRestriction ) { } public void completeTypeBindings ( ) { } public void completeTypeBindings ( CompilationUnitDeclaration parsedUnit ) { } public void completeTypeBindings ( CompilationUnitDeclaration parsedUnit , boolean buildFieldsAndMethods ) { } public TypeBinding computeBoxingType ( TypeBinding type ) { } private PackageBinding computePackageFrom ( char [ ] [ ] constantPoolName ) { } public ReferenceBinding convertToParameterizedType ( ReferenceBinding originalType ) { } public TypeBinding convertToRawType ( TypeBinding type ) { } public TypeBinding convertUnresolvedBinaryToRawType ( TypeBinding type ) { } public ArrayBinding createArrayType ( TypeBinding leafComponentType , int dimensionCount ) { } public BinaryTypeBinding createBinaryTypeFrom ( IBinaryType binaryType , PackageBinding packageBinding , AccessRestriction accessRestriction ) { } public BinaryTypeBinding createBinaryTypeFrom ( IBinaryType binaryType , PackageBinding packageBinding , boolean needFieldsAndMethods , AccessRestriction accessRestriction ) { } PackageBinding createPackage ( char [ ] [ ] compoundName ) { } public ParameterizedGenericMethodBinding createParameterizedGenericMethod ( MethodBinding genericMethod , RawTypeBinding rawType ) { } public ParameterizedGenericMethodBinding createParameterizedGenericMethod ( MethodBinding genericMethod , TypeBinding [ ] typeArguments ) { } public ParameterizedTypeBinding createParameterizedType ( ReferenceBinding genericType , TypeBinding [ ] typeArguments , ReferenceBinding enclosingType ) { } public RawTypeBinding createRawType ( ReferenceBinding genericType , ReferenceBinding enclosingType ) { } public WildcardBinding createWildcard ( ReferenceBinding genericType , int rank , TypeBinding bound , TypeBinding [ ] otherBounds , int boundKind ) { } public AccessRestriction getAccessRestriction ( TypeBinding type ) { } public ReferenceBinding getCachedType ( char [ ] [ ] compoundName ) { } PackageBinding getPackage0 ( char [ ] name ) { } public ReferenceBinding getResolvedType ( char [ ] [ ] compoundName , Scope scope ) { } PackageBinding getTopLevelPackage ( char [ ] name ) { } public ReferenceBinding getType ( char [ ] [ ] compoundName ) { } private TypeBinding [ ] getTypeArgumentsFromSignature ( SignatureWrapper wrapper , TypeVariableBinding [ ] staticVariables , ReferenceBinding enclosingType , ReferenceBinding genericType ) { } ReferenceBinding getTypeFromCompoundName ( char [ ] [ ] compoundName , boolean isParameterized ) { ReferenceBinding binding = getCachedType ( compoundName ) ; if ( binding == null ) { PackageBinding packageBinding = computePackageFrom ( compoundName ) ; binding = new UnresolvedReferenceBinding ( compoundName , packageBinding ) ; packageBinding . addType ( binding ) ; } else if ( binding == ( LookupEnvironment . TheNotFoundType ) ) { problemReporter . isClassPathCorrect ( compoundName , null ) ; return null ; } else if ( ! isParameterized ) { <START_BUG> binding = ( ( ReferenceBinding ) ( convertToRawType ( binding ) ) ) ; <END_BUG> } return binding ; } ReferenceBinding getTypeFromConstantPoolName ( char [ ] signature , int start , int end , boolean isParameterized ) { } TypeBinding getTypeFromSignature ( char [ ] signature , int start , int end , boolean isParameterized , TypeBinding enclosingType ) { } TypeBinding getTypeFromTypeSignature ( SignatureWrapper wrapper , TypeVariableBinding [ ] staticVariables , ReferenceBinding enclosingType ) { } TypeBinding getTypeFromVariantTypeSignature ( SignatureWrapper wrapper , TypeVariableBinding [ ] staticVariables , ReferenceBinding enclosingType , ReferenceBinding genericType , int rank ) { } boolean isPackage ( char [ ] [ ] compoundName , char [ ] name ) { } public MethodVerifier methodVerifier ( ) { } public void reset ( ) { } public void setAccessRestriction ( ReferenceBinding type , AccessRestriction accessRestriction ) { } void updateCaches ( UnresolvedReferenceBinding unresolvedType , ReferenceBinding resolvedType ) { } }

Fix:
binding = ( ( ReferenceBinding ) ( convertUnresolvedBinaryToRawType ( binding ) ) ) ;