Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115301 Details for
Bug 146768
[compiler] Should be more resilient with duplicate fields/methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcases
patch.txt (text/plain), 39.64 KB, created by
Kent Johnson
on 2008-10-16 15:35:00 EDT
(
hide
)
Description:
Proposed patch with testcases
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2008-10-16 15:35:00 EDT
Size:
39.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >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.150 >diff -u -r1.150 ASTConverterTestAST3_2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 29 Sep 2008 15:15:16 -0000 1.150 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 16 Oct 2008 19:28:43 -0000 >@@ -1316,7 +1316,7 @@ > ASTNode result = runConversion(AST.JLS3, sourceUnit, true); > assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$ > CompilationUnit unit = (CompilationUnit) result; >- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< >+ assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< > ASTNode node = getASTNode(unit, 0); > assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType()); > TypeDeclaration typeDeclaration = (TypeDeclaration) node; >@@ -1326,7 +1326,6 @@ > assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType()); > MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration; > assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier()); >- assertNull("Got a binding", methodDeclaration.resolveBinding()); > bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1); > assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType()); > assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier()); >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java,v >retrieving revision 1.188 >diff -u -r1.188 ASTConverterTest2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 27 Jun 2008 16:02:37 -0000 1.188 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTest2.java 16 Oct 2008 19:28:42 -0000 >@@ -1233,7 +1233,7 @@ > ASTNode result = runConversion(sourceUnit, true); > assertTrue("not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); //$NON-NLS-1$ > CompilationUnit unit = (CompilationUnit) result; >- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$< >+ assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$< > ASTNode node = getASTNode(unit, 0); > assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType()); > TypeDeclaration typeDeclaration = (TypeDeclaration) node; >@@ -1243,7 +1243,6 @@ > assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType()); > MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration; > assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier()); >- assertNull("Got a binding", methodDeclaration.resolveBinding()); > bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1); > assertEquals("Wrong type", ASTNode.METHOD_DECLARATION, bodyDeclaration.getNodeType()); > assertEquals("Wrong name", "foo", ((MethodDeclaration) bodyDeclaration).getName().getIdentifier()); >Index: src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java,v >retrieving revision 1.16 >diff -u -r1.16 CompletionContextTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java 9 Sep 2008 12:43:37 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java 16 Oct 2008 19:28:43 -0000 >@@ -4859,6 +4859,7 @@ > "completion token location={STATEMENT_START}\n" + > "visibleElements={\n" + > " source [in addDataDependencies(int)#2 [in Foo [in [Working copy] X.java [in test [in src3 [in Completion]]]]]],\n" + >+ " addDataDependencies(int) {key=Ltest/X~Foo;.addDataDependencies(I)I} [in Foo [in [Working copy] X.java [in test [in src3 [in Completion]]]]],\n" + > " hashCode() {key=Ljava/lang/Object;.hashCode()I} [in Object [in Object.class [in java.lang [in "+jclPath+"]]]],\n" + > "}", > result.context); >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.165 >diff -u -r1.165 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 3 Oct 2008 08:45:44 -0000 1.165 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 16 Oct 2008 19:28:44 -0000 >@@ -1165,23 +1165,6 @@ > } > boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES)); > // report duplicate >- if (methodDecl == null) { >- methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special >- if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method >- if (isEnumSpecialMethod) { >- this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl); >- } else { >- this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2)); >- } >- methodDecl.binding = null; >- // do not alter original method array until resolution is over, due to reentrance (143259) >- if (resolvedMethods == this.methods) { >- System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); >- } >- resolvedMethods[i] = null; >- failed++; >- } >- } > AbstractMethodDeclaration method2Decl = method2.sourceMethod(); > if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method > if (isEnumSpecialMethod) { >@@ -1191,22 +1174,19 @@ > } > method2Decl.binding = null; > // do not alter original method array until resolution is over, due to reentrance (143259) >- if (resolvedMethods == this.methods) { >+ if (resolvedMethods == this.methods) > System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); >- } > resolvedMethods[j] = null; > failed++; > } > } > if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions > methodDecl = method.sourceMethod(); >- if (methodDecl != null) { >+ if (methodDecl != null) > methodDecl.binding = null; >- } > // do not alter original method array until resolution is over, due to reentrance (143259) >- if (resolvedMethods == this.methods) { >+ if (resolvedMethods == this.methods) > System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); >- } > resolvedMethods[i] = null; > failed++; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.162 >diff -u -r1.162 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 3 Oct 2008 16:20:02 -0000 1.162 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 16 Oct 2008 19:28:44 -0000 >@@ -91,7 +91,6 @@ > // iterate the field declarations to create the bindings, lose all duplicates > FieldBinding[] fieldBindings = new FieldBinding[count]; > HashtableOfObject knownFieldNames = new HashtableOfObject(count); >- boolean duplicate = false; > count = 0; > for (int i = 0; i < size; i++) { > FieldDeclaration field = fields[i]; >@@ -105,19 +104,6 @@ > checkAndSetModifiersForField(fieldBinding, field); > > if (knownFieldNames.containsKey(field.name)) { >- duplicate = true; >- FieldBinding previousBinding = (FieldBinding) knownFieldNames.get(field.name); >- if (previousBinding != null) { >- for (int f = 0; f < i; f++) { >- FieldDeclaration previousField = fields[f]; >- if (previousField.binding == previousBinding) { >- problemReporter().duplicateFieldInType(sourceType, previousField); >- previousField.binding = null; >- break; >- } >- } >- } >- knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed > problemReporter().duplicateFieldInType(sourceType, field); > field.binding = null; > } else { >@@ -128,20 +114,6 @@ > } > } > // remove duplicate fields >- if (duplicate) { >- FieldBinding[] newFieldBindings = new FieldBinding[fieldBindings.length]; >- // we know we'll be removing at least 1 duplicate name >- size = count; >- count = 0; >- for (int i = 0; i < size; i++) { >- FieldBinding fieldBinding = fieldBindings[i]; >- if (knownFieldNames.get(fieldBinding.name) != null) { >- fieldBinding.id = count; >- newFieldBindings[count++] = fieldBinding; >- } >- } >- fieldBindings = newFieldBindings; >- } > if (count != fieldBindings.length) > System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count); > sourceType.tagBits &= ~(TagBits.AreFieldsSorted|TagBits.AreFieldsComplete); // in case some static imports reached already into this type >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v >retrieving revision 1.162 >diff -u -r1.162 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 10 Oct 2008 17:24:24 -0000 1.162 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 16 Oct 2008 19:28:50 -0000 >@@ -3379,17 +3379,12 @@ > "class A {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 5)\n" + >- " class Y<T extends A> extends X<T> {\n" + >- " ^\n" + >- "Duplicate methods named id with the parameters (A) and (T) are defined by the type X<T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 6)\n" + >+ "1. ERROR in X.java (at line 6)\n" + > " @Override T id(T x) { return x; }\n" + > " ^^^^^^^\n" + >- "Method id(T) has the same erasure id(A) as another method in type Y<T>\n" + >+ "Name clash: The method id(T) of type Y<T> has the same erasure as id(A) of type X<T> but does not override it\n" + > "----------\n" + >- "3. ERROR in X.java (at line 7)\n" + >+ "2. ERROR in X.java (at line 7)\n" + > " @Override A id(A x) { return x; }\n" + > " ^^^^^^^\n" + > "Method id(A) has the same erasure id(A) as another method in type Y<T>\n" + >@@ -3500,32 +3495,17 @@ > "class Z {}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " Y foo(Object o) { return null; } // duplicate\n" + >- " ^^^^^^^^^^^^^\n" + >- "Duplicate method foo(Object) in type X.C1\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 4)\n" + >+ "1. ERROR in X.java (at line 4)\n" + > " Z foo(Object o) { return null; } // duplicate\n" + > " ^^^^^^^^^^^^^\n" + > "Duplicate method foo(Object) in type X.C1\n" + > "----------\n" + >- "3. ERROR in X.java (at line 11)\n" + >- " A<Y> foo(Object o) { return null; } // duplicate\n" + >- " ^^^^^^^^^^^^^\n" + >- "Duplicate method foo(Object) in type X.C3\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 12)\n" + >+ "2. ERROR in X.java (at line 12)\n" + > " A<Z> foo(Object o) { return null; } // duplicate\n" + > " ^^^^^^^^^^^^^\n" + > "Duplicate method foo(Object) in type X.C3\n" + > "----------\n" + >- "5. ERROR in X.java (at line 15)\n" + >- " Y foo(Object o) { return null; } // duplicate\n" + >- " ^^^^^^^^^^^^^\n" + >- "Duplicate method foo(Object) in type X.C4\n" + >- "----------\n" + >- "6. ERROR in X.java (at line 16)\n" + >+ "3. ERROR in X.java (at line 16)\n" + > " <T extends Z> T foo(Object o) { return null; } // duplicate\n" + > " ^^^^^^^^^^^^^\n" + > "Duplicate method foo(Object) in type X.C4\n" + >@@ -3555,12 +3535,7 @@ > "class Z {}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " A<Y> foo(A<Y> o) { return null; } // duplicate\n" + >- " ^^^^^^^^^^^\n" + >- "Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 4)\n" + >+ "1. ERROR in X.java (at line 4)\n" + > " A<Z> foo(A<Z> o) { return null; } // duplicate\n" + > " ^^^^^^^^^^^\n" + > "Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + >@@ -3619,12 +3594,7 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " <N extends B> N a(A<String> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " <N> B a(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + >@@ -3645,12 +3615,7 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " <N extends B> N b(A<String> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " <N extends B> B b(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + >@@ -3671,12 +3636,7 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " B c(A<String> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " B c(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + >@@ -3717,22 +3677,12 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " <N extends B> N a(A<Number> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Duplicate method a(A<Number>) in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " <N> B a(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Duplicate method a(A<Number>) in type X\n" + > "----------\n" + >- "3. ERROR in X.java (at line 4)\n" + >- " <N extends B> N b(A<Number> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 5)\n" + >+ "2. ERROR in X.java (at line 5)\n" + > " <N> B b(A<String> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + >@@ -3756,22 +3706,12 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " <N extends B> void a(A<Number> s) {}\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Duplicate method a(A<Number>) in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " <N extends B> B a(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Duplicate method a(A<Number>) in type X\n" + > "----------\n" + >- "3. ERROR in X.java (at line 4)\n" + >- " <N extends B> Object b(A<Number> s) { return null; }\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Duplicate method b(A<Number>) in type X\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 5)\n" + >+ "2. ERROR in X.java (at line 5)\n" + > " <N extends B> B b(A<Number> n) { return null; }\n" + > " ^^^^^^^^^^^^^^\n" + > "Duplicate method b(A<Number>) in type X\n" + >@@ -3795,22 +3735,12 @@ > "class B {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\r\n" + >- " void a(A<Number> s) {}\r\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Duplicate method a(A<Number>) in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\r\n" + >+ "1. ERROR in X.java (at line 3)\r\n" + > " B a(A<Number> n) { return null; }\r\n" + > " ^^^^^^^^^^^^^^\n" + > "Duplicate method a(A<Number>) in type X\n" + > "----------\n" + >- "3. ERROR in X.java (at line 4)\r\n" + >- " Object b(A<Number> s) {}\r\n" + >- " ^^^^^^^^^^^^^^\n" + >- "Duplicate method b(A<Number>) in type X\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 5)\r\n" + >+ "2. ERROR in X.java (at line 5)\r\n" + > " B b(A<Number> n) { return null; }\r\n" + > " ^^^^^^^^^^^^^^\n" + > "Duplicate method b(A<Number>) in type X\n" + >@@ -3853,12 +3783,7 @@ > "class A<T> {}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void foo(A<String> a) {}\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " void foo(A<Integer> a) {}\n" + > " ^^^^^^^^^^^^^^^^^\n" + > "Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + >@@ -4003,12 +3928,7 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void a(Object x) {}\n" + >- " ^^^^^^^^^^^\n" + >- "Method a(Object) has the same erasure a(Object) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " <T> T a(T x) { return null; }\n" + > " ^^^^^^\n" + > "Method a(T) has the same erasure a(Object) as another method in type X\n" + >@@ -4034,12 +3954,7 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 6)\n" + >- " String a(X x) { return null; }\n" + >- " ^^^^^^\n" + >- "Method a(X) has the same erasure a(X) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 7)\n" + >+ "1. ERROR in X.java (at line 7)\n" + > " <T extends X> T a(T x) { return null; }\n" + > " ^^^^^^\n" + > "Method a(T) has the same erasure a(X) as another method in type X\n" + >@@ -4071,12 +3986,7 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\r\n" + >- " <T1 extends X<T1>> void dupT() {}\r\n" + >- " ^^^^^^\n" + >- "Duplicate method dupT() in type X<T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\r\n" + >+ "1. ERROR in X.java (at line 3)\r\n" + > " <T2 extends X<T2>> Object dupT() {return null;}\r\n" + > " ^^^^^^\n" + > "Duplicate method dupT() in type X<T>\n" + >@@ -5026,12 +4936,7 @@ > "interface J {}\n" > }, > "----------\n" + >- "1. ERROR in A.java (at line 2)\r\n" + >- " <T, S extends J & I<T>> void foo() { }\r\n" + >- " ^^^^^\n" + >- "Duplicate method foo() in type A\n" + >- "----------\n" + >- "2. ERROR in A.java (at line 3)\r\n" + >+ "1. ERROR in A.java (at line 3)\r\n" + > " <T, S extends I<T> & J> void foo() { }\r\n" + > " ^^^^^\n" + > "Duplicate method foo() in type A\n" + >@@ -5052,12 +4957,7 @@ > "interface K extends J {}" > }, > "----------\n" + >- "1. ERROR in A.java (at line 2)\r\n" + >- " <T, S extends J & I<T>> void foo() { }\r\n" + >- " ^^^^^\n" + >- "Duplicate method foo() in type A\n" + >- "----------\n" + >- "2. ERROR in A.java (at line 3)\r\n" + >+ "1. ERROR in A.java (at line 3)\r\n" + > " <T, S extends I<T> & K> void foo() { }\r\n" + > " ^^^^^\n" + > "Duplicate method foo() in type A\n" + >@@ -5978,54 +5878,59 @@ > "5. ERROR in DataSet.java (at line 6)\n" + > " public <S> S[] toArray(S[] s) {\n" + > " ^^^^^^^^^^^^^^\n" + >- "Method toArray(S[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" + >+ "Name clash: The method toArray(S[]) of type DataSet<T> has the same erasure as toArray(Object[]) of type List but does not override it\n" + >+ "----------\n" + >+ "6. ERROR in DataSet.java (at line 6)\n" + >+ " public <S> S[] toArray(S[] s) {\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "Name clash: The method toArray(S[]) of type DataSet<T> has the same erasure as toArray(Object[]) of type Collection but does not override it\n" + > "----------\n" + >- "6. ERROR in DataSet.java (at line 9)\n" + >+ "7. ERROR in DataSet.java (at line 9)\n" + > " public Object[] toArray(Object[] o) {\n" + > " ^^^^^^^^^^^^^^^^^^^\n" + > "Method toArray(Object[]) has the same erasure toArray(Object[]) as another method in type DataSet<T>\n" + > "----------\n" + >- "7. WARNING in DataSet.java (at line 14)\n" + >+ "8. WARNING in DataSet.java (at line 14)\n" + > " public boolean addAll(Collection c) { return false; }\n" + > " ^^^^^^^^^^\n" + > "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + > "----------\n" + >- "8. WARNING in DataSet.java (at line 15)\n" + >+ "9. WARNING in DataSet.java (at line 15)\n" + > " public boolean addAll(int index, Collection c) { return false; }\n" + > " ^^^^^^^^^^\n" + > "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + > "----------\n" + >- "9. WARNING in DataSet.java (at line 18)\n" + >+ "10. WARNING in DataSet.java (at line 18)\n" + > " public boolean containsAll(Collection c) { return false; }\n" + > " ^^^^^^^^^^\n" + > "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + > "----------\n" + >- "10. WARNING in DataSet.java (at line 22)\n" + >+ "11. WARNING in DataSet.java (at line 22)\n" + > " public Iterator iterator() { return null; }\n" + > " ^^^^^^^^\n" + > "Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" + > "----------\n" + >- "11. WARNING in DataSet.java (at line 24)\n" + >+ "12. WARNING in DataSet.java (at line 24)\n" + > " public ListIterator listIterator() { return null; }\n" + > " ^^^^^^^^^^^^\n" + > "ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" + > "----------\n" + >- "12. WARNING in DataSet.java (at line 25)\n" + >+ "13. WARNING in DataSet.java (at line 25)\n" + > " public ListIterator listIterator(int index) { return null; }\n" + > " ^^^^^^^^^^^^\n" + > "ListIterator is a raw type. References to generic type ListIterator<E> should be parameterized\n" + > "----------\n" + >- "13. WARNING in DataSet.java (at line 28)\n" + >+ "14. WARNING in DataSet.java (at line 28)\n" + > " public boolean removeAll(Collection c) { return false; }\n" + > " ^^^^^^^^^^\n" + > "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + > "----------\n" + >- "14. WARNING in DataSet.java (at line 29)\n" + >+ "15. WARNING in DataSet.java (at line 29)\n" + > " public boolean retainAll(Collection c) { return false; }\n" + > " ^^^^^^^^^^\n" + > "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + > "----------\n" + >- "15. WARNING in DataSet.java (at line 32)\n" + >+ "16. WARNING in DataSet.java (at line 32)\n" + > " public List subList(int fromIndex, int toIndex) { return null; }\n" + > " ^^^^\n" + > "List is a raw type. References to generic type List<E> should be parameterized\n" + >@@ -6219,12 +6124,7 @@ > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 11)\n" + >- " Integer getX(List<Integer> l) {\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Duplicate method getX(List<Integer>) in type Y\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 14)\n" + >+ "1. ERROR in X.java (at line 14)\n" + > " String getX(List<Integer> l) {\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "Duplicate method getX(List<Integer>) in type Y\n" + >@@ -8176,26 +8076,22 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date){\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Method method3(X.D1<String>, X.D1<String>, X.D1<Date>) has the same erasure method3(X.D1<T>, X.D1<T>, X.D1<T>) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 7)\n" + >+ "1. ERROR in X.java (at line 7)\n" + > " public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date){\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Method method3(X.D1<String>, X.D1<String>, X.D1<String>) has the same erasure method3(X.D1<T>, X.D1<T>, X.D1<T>) as another method in type X\n" + > "----------\n" + >- "3. WARNING in X.java (at line 11)\n" + >+ "2. WARNING in X.java (at line 11)\n" + > " public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<java.util.Date> date, D1 ... notUsed){\n" + > " ^^\n" + > "X.D1 is a raw type. References to generic type X.D1<T> should be parameterized\n" + > "----------\n" + >- "4. WARNING in X.java (at line 15)\n" + >+ "3. WARNING in X.java (at line 15)\n" + > " public MyT<Void> method3(D1<String> harg, D1<String> oarg, D1<String> date, D2 ... notUsed){\n" + > " ^^\n" + > "X.D2 is a raw type. References to generic type X.D2<T> should be parameterized\n" + >- "----------\n"); >+ "----------\n" >+ ); > } > public void test151() { > this.runConformTest( >Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java,v >retrieving revision 1.130 >diff -u -r1.130 EnumTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 3 Oct 2008 16:20:03 -0000 1.130 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 16 Oct 2008 19:28:46 -0000 >@@ -176,12 +176,7 @@ > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " BLEU, \n" + >- " ^^^^\n" + >- "Duplicate field X.BLEU\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 6)\n" + >+ "1. ERROR in X.java (at line 6)\n" + > " BLEU;\n" + > " ^^^^\n" + > "Duplicate field X.BLEU\n" + >@@ -328,32 +323,27 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 7)\n" + >- " void dup() {} \n" + >- " ^^^^^\n" + >- "Duplicate method dup() in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 8)\n" + >+ "1. ERROR in X.java (at line 8)\n" + > " void values() {} \n" + > " ^^^^^^^^\n" + > "The enum X already defines the method values() implicitly\n" + > "----------\n" + >- "3. ERROR in X.java (at line 9)\n" + >+ "2. ERROR in X.java (at line 9)\n" + > " void dup() {} \n" + > " ^^^^^\n" + > "Duplicate method dup() in type X\n" + > "----------\n" + >- "4. ERROR in X.java (at line 10)\n" + >+ "3. ERROR in X.java (at line 10)\n" + > " void values() {} \n" + > " ^^^^^^^^\n" + > "The enum X already defines the method values() implicitly\n" + > "----------\n" + >- "5. ERROR in X.java (at line 11)\n" + >+ "4. ERROR in X.java (at line 11)\n" + > " Missing dup() {} \n" + > " ^^^^^^^\n" + > "Missing cannot be resolved to a type\n" + > "----------\n" + >- "6. ERROR in X.java (at line 11)\n" + >+ "5. ERROR in X.java (at line 11)\n" + > " Missing dup() {} \n" + > " ^^^^^\n" + > "Duplicate method dup() in type X\n" + >@@ -1957,16 +1947,27 @@ > "}", > }, > "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " abstract int getSquare();\n" + >- " ^^^^^^^^^^^\n" + >- "Duplicate method getSquare() in type X\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " ONE, TWO, THREE;\n" + >+ " ^^^\n" + >+ "The enum constant ONE must define the abstract method getSquare()\n" + > "----------\n" + >- "2. ERROR in X.java (at line 4)\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " ONE, TWO, THREE;\n" + >+ " ^^^\n" + >+ "The enum constant TWO must define the abstract method getSquare()\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 2)\n" + >+ " ONE, TWO, THREE;\n" + >+ " ^^^^^\n" + >+ "The enum constant THREE must define the abstract method getSquare()\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 4)\n" + > " abstract int getSquare();\n" + > " ^^^^^^^^^^^\n" + > "Duplicate method getSquare() in type X\n" + >- "----------\n"); >+ "----------\n" >+ ); > } > > /** >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.758 >diff -u -r1.758 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 30 Sep 2008 15:31:35 -0000 1.758 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 16 Oct 2008 19:28:50 -0000 >@@ -867,12 +867,7 @@ > "}\n" , > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void foo(E e){}\n" + >- " ^^^^^^^^\n" + >- "Method foo(E) has the same erasure foo(Object) as another method in type X<E,T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " void foo(T t){}\n" + > " ^^^^^^^^\n" + > "Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" + >@@ -889,12 +884,7 @@ > "}\n" , > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void foo(E e){}\n" + >- " ^^^^^^^^\n" + >- "Method foo(E) has the same erasure foo(Exception) as another method in type X<E,T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " void foo(T t){}\n" + > " ^^^^^^^^\n" + > "Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" + >@@ -911,12 +901,7 @@ > "}\n" , > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void foo(E e, Thread t){}\n" + >- " ^^^^^^^^^^^^^^^^^^\n" + >- "Method foo(E, Thread) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " void foo(Exception e, T t){}\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" + >@@ -989,22 +974,17 @@ > "}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " void foo(L<E> l1){}\n" + >- " ^^^^^^^^^^^^\n" + >- "Method foo(L<E>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 3)\n" + >+ "1. ERROR in X.java (at line 3)\n" + > " void foo(L<T> l2){}\n" + > " ^^^^^^^^^^^^\n" + > "Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" + > "----------\n" + >- "3. ERROR in X.java (at line 4)\n" + >+ "2. ERROR in X.java (at line 4)\n" + > " void foo(L l){}\n" + > " ^^^^^^^^\n" + > "Method foo(L) has the same erasure foo(L<E>) as another method in type X<E,T>\n" + > "----------\n" + >- "4. WARNING in X.java (at line 4)\n" + >+ "3. WARNING in X.java (at line 4)\n" + > " void foo(L l){}\n" + > " ^\n" + > "L is a raw type. References to generic type L<E> should be parameterized\n" + >@@ -7313,17 +7293,12 @@ > "}\n" > }, > "----------\n" + >- "1. ERROR in SubTypes.java (at line 5)\n" + >- " @Override public X foo() { return new X(); }\n" + >- " ^^^^^\n" + >- "Duplicate method foo() in type B\n" + >- "----------\n" + >- "2. ERROR in SubTypes.java (at line 6)\n" + >+ "1. ERROR in SubTypes.java (at line 6)\n" + > " @Override public B foo() { return this; }\n" + > " ^^^^^\n" + > "Duplicate method foo() in type B\n" + > "----------\n" + >- "3. ERROR in SubTypes.java (at line 9)\n" + >+ "2. ERROR in SubTypes.java (at line 9)\n" + > " @Override public X foo() { return new X(); }\n" + > " ^\n" + > "The return type is incompatible with A.foo()\n" + >@@ -39784,32 +39759,27 @@ > " ^\n" + > "Cannot specify any additional bound T when first bound is a type parameter\n" + > "----------\n" + >- "2. ERROR in X.java (at line 2)\n" + >- " public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + >- " ^^^^^^^^^^^^^^^^^^^\n" + >- "Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 3)\n" + >+ "2. WARNING in X.java (at line 3)\n" + > " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Type safety: Unchecked cast from Object to R\n" + > "----------\n" + >- "4. ERROR in X.java (at line 6)\n" + >+ "3. ERROR in X.java (at line 6)\n" + > " public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + > " ^^^^^^^^^^\n" + > "Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" + > "----------\n" + >- "5. ERROR in X.java (at line 6)\n" + >+ "4. ERROR in X.java (at line 6)\n" + > " public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + > " ^^^^^^^^^^^^^^^^^^^\n" + > "Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + > "----------\n" + >- "6. WARNING in X.java (at line 7)\n" + >+ "5. WARNING in X.java (at line 7)\n" + > " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Type safety: Unchecked cast from Object to R\n" + > "----------\n" + >- "7. WARNING in X.java (at line 11)\n" + >+ "6. WARNING in X.java (at line 11)\n" + > " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Type safety: Unchecked cast from Object to R\n" + >@@ -39903,27 +39873,17 @@ > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >- " <T> void foo(Class<X> c) {};\n" + >- " ^^^^^^^^^^^^^^^\n" + >- "Method foo(Class<X>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 2)\n" + >+ "1. WARNING in X.java (at line 2)\n" + > " <T> void foo(Class<X> c) {};\n" + > " ^\n" + > "X is a raw type. References to generic type X<U,V> should be parameterized\n" + > "----------\n" + >- "3. ERROR in X.java (at line 3)\n" + >+ "2. ERROR in X.java (at line 3)\n" + > " <A, B> void foo(Class<X<A, B>> c) {}\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "Method foo(Class<X<A,B>>) has the same erasure foo(Class<T>) as another method in type X<U,V>\n" + > "----------\n" + >- "4. ERROR in X.java (at line 4)\n" + >- " void foo2(Class<X<U, V>> c) {};\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" + >- "----------\n" + >- "5. ERROR in X.java (at line 5)\n" + >+ "3. ERROR in X.java (at line 5)\n" + > " <A, B> void foo2(Class<X<U, V>> c) {}\n" + > " ^^^^^^^^^^^^^^^^^^^^^^\n" + > "Duplicate method foo2(Class<X<U,V>>) in type X<U,V>\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java,v >retrieving revision 1.54 >diff -u -r1.54 AmbiguousMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 27 Jun 2008 16:04:45 -0000 1.54 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 16 Oct 2008 19:28:46 -0000 >@@ -391,20 +391,10 @@ > "}" > }, > "----------\n" + >- "1. ERROR in X.java (at line 4)\r\n" + >- " static <L1 extends Listener & ErrorListener> Object createParser(L1 l) { return null; }\r\n" + >- " ^^^^^^^^^^^^^^^^^^\n" + >- "Method createParser(L1) has the same erasure createParser(X.Listener) as another method in type X\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 5)\r\n" + >+ "1. ERROR in X.java (at line 5)\r\n" + > " static <L2 extends ErrorListener & Listener> Object createParser(L2 l) { return null; }\r\n" + > " ^^^^^^^^^^^^^^^^^^\n" + > "Method createParser(L2) has the same erasure createParser(X.ErrorListener) as another method in type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 8)\r\n" + >- " createParser(new A());\r\n" + >- " ^^^^^^^^^^^^\n" + >- "The method createParser(A) is undefined for the type X\n" + > "----------\n" > ); > } >@@ -1355,12 +1345,7 @@ > "}", > }, > "----------\n" + >- "1. ERROR in J.java (at line 2)\n" + >- " <T extends Number> T foo(final Number p);\n" + >- " ^^^^^^^^^^^^^^^^^^^\n" + >- "Duplicate method foo(Number) in type J\n" + >- "----------\n" + >- "2. ERROR in J.java (at line 3)\n" + >+ "1. ERROR in J.java (at line 3)\n" + > " Float foo(final Number p);\n" + > " ^^^^^^^^^^^^^^^^^^^\n" + > "Duplicate method foo(Number) in type J\n" +
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 146768
:
115077
|
115301
|
115727