### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java,v retrieving revision 1.127 diff -u -r1.127 FieldReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 5 Feb 2009 09:38:12 -0000 1.127 +++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 18 Jan 2010 11:05:36 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; @@ -541,7 +542,15 @@ // problem already got signaled on receiver, do not report secondary problem return null; } - scope.problemReporter().invalidField(this, this.actualReceiverType); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007 avoid secondary errors in case of + // missing super type for anonymous classes ... + ReferenceBinding declaringClass = fieldBinding.declaringClass; + boolean avoidSecondary = declaringClass != null && + declaringClass.isAnonymousType() && + declaringClass.superclass() instanceof MissingTypeBinding; + if (!avoidSecondary) { + scope.problemReporter().invalidField(this, this.actualReceiverType); + } return null; } // handle indirect inheritance thru variable secondary bound Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v retrieving revision 1.145 diff -u -r1.145 MessageSend.java --- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 25 Nov 2009 04:56:02 -0000 1.145 +++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 18 Jan 2010 11:05:42 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; @@ -409,7 +410,14 @@ return null; } } - scope.problemReporter().invalidMethod(this, this.binding); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007 avoid secondary errors in case of + // missing super type for anonymous classes ... + ReferenceBinding declaringClass = this.binding.declaringClass; + boolean avoidSecondary = declaringClass != null && + declaringClass.isAnonymousType() && + declaringClass.superclass() instanceof MissingTypeBinding; + if (!avoidSecondary) + scope.problemReporter().invalidMethod(this, this.binding); MethodBinding closestMatch = ((ProblemMethodBinding)this.binding).closestMatch; switch (this.binding.problemId()) { case ProblemReasons.Ambiguous : Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v retrieving revision 1.98 diff -u -r1.98 QualifiedAllocationExpression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 13 Jan 2010 15:38:21 -0000 1.98 +++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 18 Jan 2010 11:05:44 -0000 @@ -352,8 +352,6 @@ } } } - } else { - return null; } if (this.anonymousType != null) { // insert anonymous type in scope (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=210070) #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java,v retrieving revision 1.26 diff -u -r1.26 ProblemTypeAndMethodTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 13 Jan 2010 16:35:57 -0000 1.26 +++ src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 18 Jan 2010 11:06:17 -0000 @@ -5306,4 +5306,32 @@ }, ""); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007 +public void test106() { + this.runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String[] args) {\n" + + " new Listener() {\n" + + " void foo(int a) { }\n" + + " }.bar();\n" + + " new Listener() {\n" + + " void foo(int a) { }\n" + + " }.field = 10;\n" + + " }\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " new Listener() {\n" + + " ^^^^^^^^\n" + + "Listener cannot be resolved to a type\n" + + "----------\n" + + "2. ERROR in X.java (at line 6)\n" + + " new Listener() {\n" + + " ^^^^^^^^\n" + + "Listener cannot be resolved to a type\n" + + "----------\n"); +} } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java,v retrieving revision 1.28 diff -u -r1.28 ASTConverterAST3Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java 29 Nov 2008 22:35:14 -0000 1.28 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterAST3Test.java 18 Jan 2010 11:07:15 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7409,7 +7409,7 @@ checkSourceRange(name, "j", source); //$NON-NLS-1$ IBinding binding = name.resolveBinding(); ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); - assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$ + assertNotNull("No declaring node is available", declaringNode); //$NON-NLS-1$ } /** Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterBugsTest.java,v retrieving revision 1.27 diff -u -r1.27 ASTConverterBugsTest.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterBugsTest.java 27 Aug 2009 15:26:53 -0000 1.27 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterBugsTest.java 18 Jan 2010 11:07:20 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -859,7 +859,11 @@ "8. ERROR in /Converter15/src/a/X.java (at line 16)\n" + " }takeParam((int) c);\n" + " ^\n" + - "Syntax error, insert \";\" to complete Statement\n", + "Syntax error, insert \";\" to complete Statement\n" + + "9. ERROR in /Converter15/src/a/X.java (at line 16)\n" + + " }takeParam((int) c);\n" + + " ^^^^^^^^^^\n" + + "Return type for the method is missing\n", result); } /** Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java,v retrieving revision 1.86 diff -u -r1.86 ASTConverterTest.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java 29 Nov 2008 22:35:14 -0000 1.86 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest.java 18 Jan 2010 11:07:56 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7581,7 +7581,7 @@ checkSourceRange(name, "j", source); //$NON-NLS-1$ IBinding binding = name.resolveBinding(); ASTNode declaringNode = compilationUnit.findDeclaringNode(binding); - assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$ + assertNotNull("No declaring node is available", declaringNode); //$NON-NLS-1$ } /** Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v retrieving revision 1.170 diff -u -r1.170 ASTConverterTestAST3_2.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 10 Dec 2009 16:02:33 -0000 1.170 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 18 Jan 2010 11:08:29 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8021,7 +8021,23 @@ " CharsetDecoder(CharSet\n" + " ^^^^^^^^^^^^^^^^^^^^^^\n" + "Syntax error on token(s), misplaced construct(s)\n" + - "11. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + + "11. ERROR in /Converter/src/TestCharset.java (at line 10)\n" + + " CharsetDecoder(CharSet\n" + + " ^^^^^^^^^^^^^^^\n" + + "Return type for the method is missing\n" + + "12. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + " protected CoderResult decodeLoop(ByteBuffer in,\n" + + " ^^^^^^^^^^^\n" + + "CoderResult cannot be resolved to a type\n" + + "13. ERROR in /Converter/src/TestCharset.java (at line 11)\n" + + " protected CoderResult decodeLoop(ByteBuffer in,\n" + + " ^^^^^^^^^^\n" + + "ByteBuffer cannot be resolved to a type\n" + + "14. ERROR in /Converter/src/TestCharset.java (at line 12)\n" + + " CharBuffer out) {\n" + + " ^^^^^^^^^^\n" + + "CharBuffer cannot be resolved to a type\n" + + "15. ERROR in /Converter/src/TestCharset.java (at line 17)\n" + " public CharsetEncoder newEncoder() {\n" + " ^^^^^^^^^^^^^^\n" + "CharsetEncoder cannot be resolved to a type\n",