Buggy code:
private toCharArray ( ) ; private static final char [ ] DOT = "." . toCharArray ( ) ; private static final char [ ] VARARGS = "..." . toCharArray ( ) ; private static final char [ ] IMPORT = "import" . toCharArray ( ) ; private static final char [ ] STATIC = "static" . toCharArray ( ) ; private static final char [ ] ON_DEMAND = ".*" . toCharArray ( ) ; private static final char [ ] IMPORT_END = ";\n" . toCharArray ( ) ; private static final char [ ] JAVA_LANG_OBJECT_SIGNATURE = CompletionEngine . createTypeSignature ( CharOperation . concatWith ( TypeConstants . JAVA_LANG , '.' ) , TypeConstants . OBJECT ) ; private static final char [ ] JAVA_LANG_NAME = CharOperation . concatWith ( TypeConstants . JAVA_LANG , '.' ) ; private static final int NONE = 0 ; private static final int SUPERTYPE = 1 ; private static final int SUBTYPE = 2 ; private static final int FIELD = 0 ; private static final int LOCAL = 1 ; private static final int ARGUMENT = 2 ; int expectedTypesPtr = - 1 ; TypeBinding [ ] expectedTypes = new TypeBinding [ 1 ] ; int expectedTypesFilter ; boolean hasJavaLangObjectAsExpectedType = false ; int uninterestingBindingsPtr = - 1 ; Binding [ ] uninterestingBindings = new Binding [ 1 ] ; int forbbidenBindingsPtr = - 1 ; Binding [ ] forbbidenBindings = new Binding [ 1 ] ; int forbbidenBindingsFilter ; ImportBinding [ ] favoriteReferenceBindings ; boolean assistNodeIsClass ; boolean assistNodeIsEnum ; boolean assistNodeIsException ; boolean assistNodeIsInterface ; boolean assistNodeIsAnnotation ; boolean assistNodeIsConstructor ; boolean assistNodeIsSuperType ; int assistNodeInJavadoc = 0 ; boolean assistNodeCanBeSingleMemberAnnotation = false ; long targetedElement ; IJavaProject javaProject ; CompletionParser parser ; CompletionRequestor requestor ; CompletionEngine . CompletionProblemFactory problemFactory ; ProblemReporter problemReporter ; char [ ] source ; char [ ] completionToken ; char [ ] qualifiedCompletionToken ; boolean resolvingImports = false ; boolean resolvingStaticImports = false ; boolean insideQualifiedReference = false ; boolean noProposal = true ; CategorizedProblem problem = null ; char [ ] fileName = null ; int startPosition ; int actualCompletionPosition ; int endPosition ; int offset ; int tokenStart ; int tokenEnd ; int javadocTagPosition ; HashtableOfObject knownPkgs = new HashtableOfObject ( 10 ) ; HashtableOfObject knownTypes = new HashtableOfObject ( 10 ) ; Scanner nameScanner ; static final BaseTypeBinding [ ] BASE_TYPES = new BaseTypeBinding [ ] { TypeBinding . BOOLEAN , TypeBinding . BYTE , TypeBinding . CHAR , TypeBinding . DOUBLE , TypeBinding . FLOAT , TypeBinding . INT , TypeBinding . LONG , TypeBinding . SHORT , TypeBinding . VOID } ; static final int BASE_TYPES_LENGTH = CompletionEngine . BASE_TYPES . length ; static final char [ ] [ ] BASE_TYPE_NAMES = new char [ CompletionEngine . BASE_TYPES_LENGTH ] [ ] ; static final int BASE_TYPES_WITHOUT_VOID_LENGTH = ( CompletionEngine . BASE_TYPES . length ) - 1 ; static final char [ ] [ ] BASE_TYPE_NAMES_WITHOUT_VOID = new char [ CompletionEngine . BASE_TYPES_WITHOUT_VOID_LENGTH ] [ ] ; static final char [ ] classField = "class" . toCharArray ( ) ; static final char [ ] lengthField = "length" . toCharArray ( ) ; static final char [ ] cloneMethod = "clone" . toCharArray ( ) ; static final char [ ] THIS = "this" . toCharArray ( ) ; static final char [ ] THROWS = "throws" . toCharArray ( ) ; static InvocationSite FakeInvocationSite = new InvocationSite ( ) { public TypeBinding [ ] genericTypeArguments ( ) { } public boolean isSuperAccess ( ) { } public boolean isTypeAccess ( ) { } public void setActualReceiverType ( ReferenceBinding receiverType ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int depth ) { } public int sourceStart ( ) { } public int sourceEnd ( ) { } } ; private ObjectVector acceptedTypes ; public CompletionEngine ( SearchableEnvironment nameEnvironment , CompletionRequestor requestor , Map settings , IJavaProject javaProject ) { } public void acceptType ( char [ ] packageName , char [ ] simpleTypeName , char [ ] [ ] enclosingTypeNames , int modifiers , AccessRestriction accessRestriction ) { } private void acceptTypes ( Scope scope ) { } public void acceptUnresolvedName ( char [ ] name ) { } private final boolean areParametersCompatibleWith ( TypeBinding [ ] parameters , TypeBinding [ ] arguments , boolean isVarargs ) { } private void proposeType ( char [ ] packageName , char [ ] simpleTypeName , int modifiers , int accessibility , char [ ] typeName , char [ ] fullyQualifiedName , boolean isQualified , Scope scope ) { } public void acceptPackage ( char [ ] packageName ) { } private void buildContext ( ASTNode astNode , ASTNode astNodeParent , Binding qualifiedBinding , Scope scope ) { } private boolean complete ( ASTNode astNode , ASTNode astNodeParent , ASTNode enclosingNode , Binding qualifiedBinding , Scope scope , boolean insideTypeAnnotation ) { } private void findFieldsAndMethodsFromCastedReceiver ( ASTNode enclosingNode , Binding qualifiedBinding , Scope scope , ObjectVector fieldsFound , ObjectVector methodsFound , InvocationSite invocationSite , Scope invocationScope , Expression receiver ) { } public void complete ( IType type , char [ ] snippet , int position , char [ ] [ ] localVariableTypeNames , char [ ] [ ] localVariableNames , int [ ] localVariableModifiers , boolean isStatic ) { if ( ( this . requestor ) != null ) { this . requestor . beginReporting ( ) ; } boolean contextAccepted = false ; IType topLevelType = type ; while ( ( topLevelType . getDeclaringType ( ) ) != null ) { topLevelType = topLevelType . getDeclaringType ( ) ; } this . fileName = topLevelType . getParent ( ) . getElementName ( ) . toCharArray ( ) ; CompilationResult compilationResult = new CompilationResult ( this . fileName , 1 , 1 , this . compilerOptions . maxProblemsPerUnit ) ; CompilationUnitDeclaration compilationUnit = null ; try { TypeDeclaration typeDeclaration = null ; if ( type instanceof SourceType ) { SourceType sourceType = ( ( SourceType ) ( type ) ) ; ISourceType info = ( ( ISourceType ) ( sourceType . getElementInfo ( ) ) ) ; compilationUnit = SourceTypeConverter . buildCompilationUnit ( new ISourceType [ ] { info } , ( ( SourceTypeConverter . FIELD_AND_METHOD ) | ( SourceTypeConverter . MEMBER_TYPE ) ) , this . problemReporter , compilationResult ) ; if ( ( compilationUnit . types ) != null ) typeDeclaration = compilationUnit . types [ 0 ] ; } else { compilationUnit = new CompilationUnitDeclaration ( this . problemReporter , compilationResult , 0 ) ; <START_BUG> typeDeclaration = BinaryTypeConverter . buildTypeDeclaration ( type , compilationUnit , compilationResult ) ; <END_BUG>

Fix:
typeDeclaration = BinaryTypeConverter . buildTypeDeclaration ( type , compilationUnit , compilationResult , null ) ;