### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.266 diff -u -r1.266 ASTConverter15Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 8 May 2008 19:24:20 -0000 1.266 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 23 May 2008 13:39:20 -0000 @@ -10114,4 +10114,17 @@ IMethodBinding binding = declaration.resolveBinding(); assertNotNull("No binding", binding); } + + /* + * Ensures that requesting a binding with a non-existing parameterized type doesn't throw an OutOfMemoryError + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=233625 ) + */ + public void test0312() throws JavaModelException { + String[] bindingKeys = new String[] {"Ljava/util/Map;Ljava/util/List;>;"}; + BindingRequestor requestor = new BindingRequestor(); + resolveASTs(new ICompilationUnit[] {} , bindingKeys, requestor, getJavaProject("Converter15"), null); + assertBindingsEqual( + "", + requestor.getBindings(bindingKeys)); + } } \ No newline at end of file #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java,v retrieving revision 1.33 diff -u -r1.33 BindingKeyParser.java --- model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java 18 Jan 2008 15:31:39 -0000 1.33 +++ model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java 23 May 2008 13:39:22 -0000 @@ -568,82 +568,78 @@ } public void parse(boolean pauseAfterFullyQualifiedName) { - try { - if (!this.parsingPaused) { - // fully qualified name - parseFullyQualifiedName(); - parseSecondaryType(); - if (pauseAfterFullyQualifiedName) { - this.parsingPaused = true; - return; - } - } - if (!hasTypeName()) { - consumeKey(); + if (!this.parsingPaused) { + // fully qualified name + parseFullyQualifiedName(); + parseSecondaryType(); + if (pauseAfterFullyQualifiedName) { + this.parsingPaused = true; return; } - consumeTopLevelType(); - parseInnerType(); - - if (this.scanner.isAtParametersStart()) { - this.scanner.skipParametersStart(); - if (this.scanner.isAtTypeParameterStart()) { - // generic type - parseGenericType(); - // skip ";>" - this.scanner.skipParametersEnd(); - // local type in generic type - parseInnerType(); - } else if (this.scanner.isAtTypeArgumentStart()) - // parameterized type - parseParameterizedType(null/*top level type or member type with raw enclosing type*/, false/*no raw*/); - else if (this.scanner.isAtRawTypeEnd()) - // raw type - parseRawType(); - } else { - // non-generic type - consumeNonGenericType(); - } - - consumeType(); - this.scanner.skipTypeEnd(); - - if (this.scanner.isAtFieldOrMethodStart()) { - switch (this.scanner.nextToken()) { - case Scanner.FIELD: - parseField(); - if (this.scanner.isAtAnnotationStart()) { - parseAnnotation(); - } - return; - case Scanner.METHOD: - parseMethod(); - if (this.scanner.isAtLocalVariableStart()) { - parseLocalVariable(); - } else if (this.scanner.isAtTypeVariableStart()) { - parseTypeVariable(); - } else if (this.scanner.isAtAnnotationStart()) { - parseAnnotation(); - } - break; - default: - malformedKey(); - return; - } - } else if (this.scanner.isAtTypeVariableStart()) { - parseTypeVariable(); - } else if (this.scanner.isAtWildcardStart()) { - parseWildcard(); - } else if (this.scanner.isAtTypeWithCaptureStart()) { - parseTypeWithCapture(); - } else if (this.scanner.isAtAnnotationStart()) { - parseAnnotation(); - } - + } + if (!hasTypeName()) { consumeKey(); - } catch (IllegalArgumentException e) { - // the given key was illegal + return; + } + consumeTopLevelType(); + parseInnerType(); + + if (this.scanner.isAtParametersStart()) { + this.scanner.skipParametersStart(); + if (this.scanner.isAtTypeParameterStart()) { + // generic type + parseGenericType(); + // skip ";>" + this.scanner.skipParametersEnd(); + // local type in generic type + parseInnerType(); + } else if (this.scanner.isAtTypeArgumentStart()) + // parameterized type + parseParameterizedType(null/*top level type or member type with raw enclosing type*/, false/*no raw*/); + else if (this.scanner.isAtRawTypeEnd()) + // raw type + parseRawType(); + } else { + // non-generic type + consumeNonGenericType(); + } + + consumeType(); + this.scanner.skipTypeEnd(); + + if (this.scanner.isAtFieldOrMethodStart()) { + switch (this.scanner.nextToken()) { + case Scanner.FIELD: + parseField(); + if (this.scanner.isAtAnnotationStart()) { + parseAnnotation(); + } + return; + case Scanner.METHOD: + parseMethod(); + if (this.scanner.isAtLocalVariableStart()) { + parseLocalVariable(); + } else if (this.scanner.isAtTypeVariableStart()) { + parseTypeVariable(); + } else if (this.scanner.isAtAnnotationStart()) { + parseAnnotation(); + } + break; + default: + malformedKey(); + return; + } + } else if (this.scanner.isAtTypeVariableStart()) { + parseTypeVariable(); + } else if (this.scanner.isAtWildcardStart()) { + parseWildcard(); + } else if (this.scanner.isAtTypeWithCaptureStart()) { + parseTypeWithCapture(); + } else if (this.scanner.isAtAnnotationStart()) { + parseAnnotation(); } + + consumeKey(); } private void parseFullyQualifiedName() { Index: model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java,v retrieving revision 1.49 diff -u -r1.49 BindingKeyResolver.java --- model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 5 Feb 2008 15:48:31 -0000 1.49 +++ model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java 23 May 2008 13:39:22 -0000 @@ -242,6 +242,10 @@ if (this.methodBinding == null) return; TypeBinding[] arguments = getTypeBindingArguments(); + if (arguments == null) { + this.methodBinding = null; + return; + } if (arguments.length != this.methodBinding.typeVariables().length) this.methodBinding = this.environment.createParameterizedGenericMethod(this.methodBinding, (RawTypeBinding) null); else @@ -302,6 +306,10 @@ public void consumeParameterizedType(char[] simpleTypeName, boolean isRaw) { TypeBinding[] arguments = getTypeBindingArguments(); + if (arguments == null) { + this.typeBinding = null; + return; + } if (simpleTypeName != null) { if (this.genericType == null) { // parameterized member type with raw enclosing type @@ -527,7 +535,7 @@ BindingKeyResolver resolver = (BindingKeyResolver) this.types.get(i); TypeBinding compilerBinding2 = (TypeBinding) resolver.compilerBinding; if (compilerBinding2 == null) { - throw new IllegalArgumentException(); + return null; } arguments[i] = compilerBinding2; }