Buggy code:
public final class ImportRewrite { public abstract static class ImportRewriteContext { public static final int RES_NAME_FOUND = 1 ; public static final int RES_NAME_UNKNOWN = 2 ; public static final int RES_NAME_CONFLICT = 3 ; public static final int KIND_TYPE = 1 ; public static final int KIND_STATIC_FIELD = 2 ; public static final int KIND_STATIC_METHOD = 3 ; public abstract int findInContext ( String qualifier , String name , int kind ) { } } private static final char STATIC_PREFIX = 's' ; private static final char NORMAL_PREFIX = 'n' ; private final ImportRewrite . ImportRewriteContext defaultContext ; private final ICompilationUnit compilationUnit ; private final CompilationUnit astRoot ; private final boolean restoreExistingImports ; private final List existingImports ; private String [ ] importOrder ; private int importOnDemandThreshold ; private int staticImportOnDemandThreshold ; private List addedImports ; private List removedImports ; private String [ ] createdImports ; private String [ ] createdStaticImports ; private boolean filterImplicitImports ; public static ImportRewrite create ( ICompilationUnit cu , boolean restoreExistingImports ) throws JavaModelException { } public static ImportRewrite create ( CompilationUnit astRoot , boolean restoreExistingImports ) { } private ImportRewrite ( ICompilationUnit cu , CompilationUnit astRoot , List existingImports ) { } public void setImportOrder ( String [ ] order ) { } public void setOnDemandImportThreshold ( int threshold ) { } public void setStaticOnDemandImportThreshold ( int threshold ) { } public ICompilationUnit getCompilationUnit ( ) { } public ImportRewrite . ImportRewriteContext getDefaultImportRewriteContext ( ) { } public void setFilterImplicitImports ( boolean filterImplicitImports ) { } private static int compareImport ( char prefix , String qualifier , String name , String curr ) { } final int findInImports ( String qualifier , String name , int kind ) { } public Type addImportFromSignature ( String typeSig , AST ast ) { } public Type addImportFromSignature ( String typeSig , AST ast , ImportRewrite . ImportRewriteContext context ) { } public String addImport ( ITypeBinding binding ) { } public String addImport ( ITypeBinding binding , ImportRewrite . ImportRewriteContext context ) { <START_BUG> if ( ( binding . isPrimitive ( ) ) || ( binding . isTypeVariable ( ) ) ) { <END_BUG> return binding . getName ( ) ; } ITypeBinding normalizedBinding = ImportRewrite . normalizeTypeBinding ( binding ) ; if ( normalizedBinding == null ) { return "invalid" ; } if ( normalizedBinding . isWildcardType ( ) ) { StringBuffer res = new StringBuffer ( "?" ) ; ITypeBinding bound = normalizedBinding . getBound ( ) ; if ( ( ( bound != null ) && ( ! ( bound . isWildcardType ( ) ) ) ) && ( ! ( bound . isCapture ( ) ) ) ) { if ( normalizedBinding . isUpperbound ( ) ) { res . append ( "<seq2seq4repair_space>extends<seq2seq4repair_space>" ) ; } else { res . append ( "<seq2seq4repair_space>super<seq2seq4repair_space>" ) ; } res . append ( addImport ( bound , context ) ) ; } return res . toString ( ) ; } if ( normalizedBinding . isArray ( ) ) { StringBuffer res = new StringBuffer ( addImport ( normalizedBinding . getElementType ( ) , context ) ) ; for ( int i = normalizedBinding . getDimensions ( ) ; i > 0 ; i -- ) { res . append ( "[]" ) ; } return res . toString ( ) ; } String qualifiedName = ImportRewrite . getRawQualifiedName ( normalizedBinding ) ; if ( ( qualifiedName . length ( ) ) > 0 ) { String str = internalAddImport ( qualifiedName , context ) ; ITypeBinding [ ] typeArguments = normalizedBinding . getTypeArguments ( ) ; if ( ( typeArguments . length ) > 0 ) { StringBuffer res = new StringBuffer ( str ) ; res . append ( '<' ) ; for ( int i = 0 ; i < ( typeArguments . length ) ; i ++ ) { if ( i > 0 ) { res . append ( ',' ) ; } ITypeBinding curr = typeArguments [ i ] ; if ( containsNestedCapture ( curr , false ) ) { res . append ( '?' ) ; } else { res . append ( addImport ( curr , context ) ) ; } } res . append ( '>' ) ; return res . toString ( ) ; } return str ; } return ImportRewrite . getRawName ( normalizedBinding ) ; } private boolean containsNestedCapture ( ITypeBinding binding , boolean isNested ) { } private boolean containsNestedCapture ( String signature ) { } private static ITypeBinding normalizeTypeBinding ( ITypeBinding binding ) { } public Type addImport ( ITypeBinding binding , AST ast ) { } public Type addImport ( ITypeBinding binding , AST ast , ImportRewrite . ImportRewriteContext context ) { } public String addImport ( String qualifiedTypeName , ImportRewrite . ImportRewriteContext context ) { } public String addImport ( String qualifiedTypeName ) { } public String addStaticImport ( IBinding binding ) { } public String addStaticImport ( IBinding binding , ImportRewrite . ImportRewriteContext context ) { } public String addStaticImport ( String declaringTypeName , String simpleName , boolean isField ) { } public String addStaticImport ( String declaringTypeName , String simpleName , boolean isField , ImportRewrite . ImportRewriteContext context ) { } private String internalAddImport ( String fullTypeName , ImportRewrite . ImportRewriteContext context ) { } private void addEntry ( String entry ) { } private boolean removeEntry ( String entry ) { } public boolean removeImport ( String qualifiedName ) { } public boolean removeStaticImport ( String qualifiedName ) { } private static String getRawName ( ITypeBinding normalizedBinding ) { } private static String getRawQualifiedName ( ITypeBinding normalizedBinding ) { } public final TextEdit rewriteImports ( IProgressMonitor monitor ) throws CoreException { } public String [ ] getCreatedImports ( ) { } public String [ ] getCreatedStaticImports ( ) { } public String [ ] getAddedImports ( ) { } public String [ ] getAddedStaticImports ( ) { }

Fix:
if ( ( ( binding . isPrimitive ( ) ) || ( binding . isTypeVariable ( ) ) ) || ( binding . isRecovered ( ) ) ) {