Buggy code:
public class SourceTypeConverter implements CompilerModifiers { public static final int FIELD = 1 ; public static final int CONSTRUCTOR = 2 ; public static final int METHOD = 4 ; public static final int MEMBER_TYPE = 8 ; public static final int FIELD_INITIALIZATION = 16 ; public static final int FIELD_AND_METHOD = ( ( SourceTypeConverter . FIELD ) | ( SourceTypeConverter . CONSTRUCTOR ) ) | ( SourceTypeConverter . METHOD ) ; public static final int NONE = 0 ; private int flags ; private CompilationUnitDeclaration unit ; private Parser parser ; private ProblemReporter problemReporter ; private SourceTypeConverter ( int flags , ProblemReporter problemReporter ) { } public static CompilationUnitDeclaration buildCompilationUnit ( ISourceType [ ] sourceTypes , int flags , ProblemReporter problemReporter , CompilationResult compilationResult ) { } private CompilationUnitDeclaration convert ( ISourceType [ ] sourceTypes , CompilationResult compilationResult ) { } private FieldDeclaration convert ( ISourceField sourceField , TypeDeclaration type ) { } private AbstractMethodDeclaration convert ( ISourceMethod sourceMethod , CompilationResult compilationResult ) { } private TypeDeclaration convert ( ISourceType sourceType , CompilationResult compilationResult ) { <START_BUG> TypeDeclaration type = type = new TypeDeclaration ( compilationResult ) ; <END_BUG> if ( ( sourceType . getEnclosingType ( ) ) != null ) { type . bits |= IsMemberTypeMASK ; } type . name = sourceType . getName ( ) ; int start ; int end ; type . sourceStart = start = sourceType . getNameSourceStart ( ) ; type . sourceEnd = end = sourceType . getNameSourceEnd ( ) ; type . modifiers = sourceType . getModifiers ( ) ; type . declarationSourceStart = sourceType . getDeclarationSourceStart ( ) ; type . declarationSourceEnd = sourceType . getDeclarationSourceEnd ( ) ; type . bodyEnd = type . declarationSourceEnd ; if ( ( sourceType . getSuperclassName ( ) ) != null ) type . superclass = createTypeReference ( sourceType . getSuperclassName ( ) , start , end ) ; char [ ] [ ] interfaceNames = sourceType . getInterfaceNames ( ) ; int interfaceCount = ( interfaceNames == null ) ? 0 : interfaceNames . length ; type . superInterfaces = new TypeReference [ interfaceCount ] ; for ( int i = 0 ; i < interfaceCount ; i ++ ) { type . superInterfaces [ i ] = createTypeReference ( interfaceNames [ i ] , start , end ) ; } if ( ( ( this . flags ) & ( SourceTypeConverter . MEMBER_TYPE ) ) != 0 ) { ISourceType [ ] sourceMemberTypes = sourceType . getMemberTypes ( ) ; int sourceMemberTypeCount = ( sourceMemberTypes == null ) ? 0 : sourceMemberTypes . length ; type . memberTypes = new TypeDeclaration [ sourceMemberTypeCount ] ; for ( int i = 0 ; i < sourceMemberTypeCount ; i ++ ) { type . memberTypes [ i ] = convert ( sourceMemberTypes [ i ] , compilationResult ) ; } } if ( ( ( this . flags ) & ( SourceTypeConverter . FIELD ) ) != 0 ) { ISourceField [ ] sourceFields = sourceType . getFields ( ) ; int sourceFieldCount = ( sourceFields == null ) ? 0 : sourceFields . length ; type . fields = new FieldDeclaration [ sourceFieldCount ] ; for ( int i = 0 ; i < sourceFieldCount ; i ++ ) { type . fields [ i ] = convert ( sourceFields [ i ] , type ) ; } } boolean needConstructor = ( ( this . flags ) & ( SourceTypeConverter . CONSTRUCTOR ) ) != 0 ; boolean needMethod = ( ( this . flags ) & ( SourceTypeConverter . METHOD ) ) != 0 ; if ( needConstructor || needMethod ) { ISourceMethod [ ] sourceMethods = sourceType . getMethods ( ) ; int sourceMethodCount = ( sourceMethods == null ) ? 0 : sourceMethods . length ; int extraConstructor = 0 ; int methodCount = 0 ; boolean isInterface = type . isInterface ( ) ; if ( ! isInterface ) { extraConstructor = ( needConstructor ) ? 1 : 0 ; for ( int i = 0 ; i < sourceMethodCount ; i ++ ) { if ( sourceMethods [ i ] . isConstructor ( ) ) { if ( needConstructor ) { extraConstructor = 0 ; methodCount ++ ; } } else if ( needMethod ) { methodCount ++ ; } } } else { methodCount = ( needMethod ) ? sourceMethodCount : 0 ; } type . methods = new AbstractMethodDeclaration [ methodCount + extraConstructor ] ; if ( extraConstructor != 0 ) { type . methods [ 0 ] = type . createsInternalConstructor ( false , false ) ; } int index = 0 ; for ( int i = 0 ; i < sourceMethodCount ; i ++ ) { ISourceMethod sourceMethod = sourceMethods [ i ] ; boolean isConstructor = sourceMethod . isConstructor ( ) ; if ( ( isConstructor && needConstructor ) || ( ( ! isConstructor ) && needMethod ) ) { AbstractMethodDeclaration method = convert ( sourceMethod , compilationResult ) ; if ( isInterface || ( method . isAbstract ( ) ) ) { method . modifiers |= AccSemicolonBody ; } type . methods [ ( extraConstructor + ( index ++ ) ) ] = method ; } } } return type ; } private ImportReference createImportReference ( char [ ] importName , int start , int end , boolean onDemand , int modifiers ) { } private TypeReference createTypeReference ( char [ ] typeSignature , int start , int end ) { } }

Fix:
TypeDeclaration type = new TypeDeclaration ( compilationResult ) ;