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 184322 Details for
Bug 331446
[1.4/1.5] Unexpected ambiguous error for 1.4 project
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch + tests - Take 2
patch.txt (text/plain), 12.87 KB, created by
Srikanth Sankaran
on 2010-12-02 00:51:33 EST
(
hide
)
Description:
Proposed patch + tests - Take 2
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-12-02 00:51:33 EST
Size:
12.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.379 >diff -u -r1.379 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 19 Nov 2010 14:22:00 -0000 1.379 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2 Dec 2010 05:48:24 -0000 >@@ -2842,13 +2842,21 @@ > int oneParamsLength = oneParams.length; > int twoParamsLength = twoParams.length; > if (oneParamsLength == twoParamsLength) { >+ /* Below 1.5, discard any generics we have left in for the method verifier's benefit, (so it >+ can detect method overriding properly in the presence of generic super types.) This is so >+ as to allow us to determine whether we have been handed an acceptable method in 1.4 terms >+ without all the 1.5ism below kicking in and spoiling the party. >+ See https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >+ */ >+ boolean applyErasure = environment().globalOptions.sourceLevel < ClassFileConstants.JDK1_5; > next : for (int i = 0; i < oneParamsLength; i++) { >- TypeBinding oneParam = oneParams[i]; >- TypeBinding twoParam = twoParams[i]; >+ TypeBinding oneParam = applyErasure ? oneParams[i].erasure() : oneParams[i]; >+ TypeBinding twoParam = applyErasure ? twoParams[i].erasure() : twoParams[i]; > if (oneParam == twoParam || oneParam.isCompatibleWith(twoParam)) { > if (two.declaringClass.isRawType()) continue next; > >- TypeBinding originalTwoParam = two.original().parameters[i].leafComponentType(); >+ TypeBinding leafComponentType = two.original().parameters[i].leafComponentType(); >+ TypeBinding originalTwoParam = applyErasure ? leafComponentType.erasure() : leafComponentType; > switch (originalTwoParam.kind()) { > case Binding.TYPE_PARAMETER : > if (((TypeVariableBinding) originalTwoParam).hasOnlyRawBounds()) >#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.220 >diff -u -r1.220 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 1 Dec 2010 23:36:47 -0000 1.220 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 2 Dec 2010 05:48:27 -0000 >@@ -11533,8 +11533,8 @@ > false, > compilerOptions14); > } >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >-public void _test331446() { >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >+public void test331446() { > Map compilerOptions15 = getCompilerOptions(); > compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); > compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >@@ -11573,9 +11573,6 @@ > null); > > Map compilerOptions14 = getCompilerOptions(); >-// compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); >-// compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >-// compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); > compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); > compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); > compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >@@ -11606,20 +11603,38 @@ > compilerOptions14, > null); > } >-public void test1415Mix() { >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >+public void test331446a() { > Map compilerOptions15 = getCompilerOptions(); >- compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >- compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >- compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4); >+ compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4); > this.runConformTest( > new String[] { >- "Abstract.java", >- "abstract class Generic<T> {\n" + >- " abstract void foo(T t);\n" + >- "}\n" + >- "public abstract class Abstract extends Generic<String> {\n" + >- "}" >- }, >+ "Test.java", >+ "import java.util.Comparator;\n" + >+ "import java.util.List;\n" + >+ "\n" + >+ "public class Test {\n" + >+ " public static void assertEquals(String message,\n" + >+ " Comparator comparator, List expected, List actual) {\n" + >+ " if (expected.size() != actual.size()) {\n" + >+ " //failNotEquals(message, expected, actual);\n" + >+ " }\n" + >+ " for (int i = 0, l = expected.size(); i < l; i++) {\n" + >+ " assertEquals(message, comparator, expected.get(i), actual.get(i));\n" + >+ " }\n" + >+ " }\n" + >+ " public static void assertEquals(String message,\n" + >+ " Comparator comparator, Object expected, Object actual) {\n" + >+ " if (comparator.compare(expected, actual) == 0) {\n" + >+ " return;\n" + >+ " }\n" + >+ " //failNotEquals(message, expected, actual);\n" + >+ " }\n" + >+ "}\n" + >+ "" >+ }, > "", > null, > true, >@@ -11632,64 +11647,34 @@ > compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); > compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); > compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); >- this.runNegativeTest( >- new String[] { >- "Concrete.java", >- "public class Concrete extends Abstract {\n" + >- "}", >- }, >- "----------\n" + >- "1. ERROR in Concrete.java (at line 1)\n" + >- " public class Concrete extends Abstract {\n" + >- " ^^^^^^^^\n" + >- "The type Concrete must implement the inherited abstract method Generic<String>.foo(String)\n" + >- "----------\n", >- null, >- false, >- compilerOptions14); >-} >-public void test1415Mix2() { >- Map compilerOptions15 = getCompilerOptions(); >- compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >- compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >- compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); > this.runConformTest( > new String[] { >- "Abstract.java", >- "abstract class Generic<T> {\n" + >- " abstract void foo(T t);\n" + >- "}\n" + >- "public abstract class Abstract extends Generic<String> {\n" + >- "}" >- }, >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "import java.util.Comparator;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static void testAmbiguity() {\n" + >+ " Comparator comparator = new Comparator() {\n" + >+ " \n" + >+ " public int compare(Object o1, Object o2) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " };\n" + >+ " Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + >+ " }\n" + >+ "}\n" + >+ "", >+ }, > "", > null, >- true, >+ false, > null, >- compilerOptions15, >+ compilerOptions14, > null); >- >- Map compilerOptions14 = getCompilerOptions(); >- compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >- compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >- compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >- compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); >- this.runConformTest( >- new String[] { >- "Concrete.java", >- "public class Concrete extends Abstract {\n" + >- " void foo(String s) {}\n" + >- "}", >- }, >- "", >- null, >- false, >- null, >- compilerOptions14, >- null); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.4) >-public void test331446a() { >+public void test331446b() { > Map compilerOptions14 = getCompilerOptions(); > compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_4); > compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >@@ -11727,7 +11712,7 @@ > null); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (1.4/1.5 mix) >-public void _test331446b() { >+public void test331446c() { > Map compilerOptions15 = getCompilerOptions(); > compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); > compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >@@ -11770,7 +11755,7 @@ > null); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 (all 1.5) >-public void test331446c() { >+public void test331446d() { > Map compilerOptions15 = getCompilerOptions(); > compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); > compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >@@ -11806,4 +11791,88 @@ > compilerOptions15, > null); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >+public void test1415Mix() { >+ Map compilerOptions15 = getCompilerOptions(); >+ compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); >+ this.runConformTest( >+ new String[] { >+ "Abstract.java", >+ "abstract class Generic<T> {\n" + >+ " abstract void foo(T t);\n" + >+ "}\n" + >+ "public abstract class Abstract extends Generic<String> {\n" + >+ "}" >+ }, >+ "", >+ null, >+ true, >+ null, >+ compilerOptions15, >+ null); >+ >+ Map compilerOptions14 = getCompilerOptions(); >+ compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >+ compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >+ compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); >+ this.runNegativeTest( >+ new String[] { >+ "Concrete.java", >+ "public class Concrete extends Abstract {\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in Concrete.java (at line 1)\n" + >+ " public class Concrete extends Abstract {\n" + >+ " ^^^^^^^^\n" + >+ "The type Concrete must implement the inherited abstract method Generic<String>.foo(String)\n" + >+ "----------\n", >+ null, >+ false, >+ compilerOptions14); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=331446 >+public void test1415Mix2() { >+ Map compilerOptions15 = getCompilerOptions(); >+ compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); >+ this.runConformTest( >+ new String[] { >+ "Abstract.java", >+ "abstract class Generic<T> {\n" + >+ " abstract void foo(T t);\n" + >+ "}\n" + >+ "public abstract class Abstract extends Generic<String> {\n" + >+ "}" >+ }, >+ "", >+ null, >+ true, >+ null, >+ compilerOptions15, >+ null); >+ >+ Map compilerOptions14 = getCompilerOptions(); >+ compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >+ compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >+ compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); >+ this.runConformTest( >+ new String[] { >+ "Concrete.java", >+ "public class Concrete extends Abstract {\n" + >+ " void foo(String s) {}\n" + >+ "}", >+ }, >+ "", >+ null, >+ false, >+ null, >+ compilerOptions14, >+ null); >+} > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v >retrieving revision 1.163 >diff -u -r1.163 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 1 Dec 2010 22:00:43 -0000 1.163 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 2 Dec 2010 05:48:30 -0000 >@@ -5227,7 +5227,7 @@ > deleteProject(project14); > } > } >-public void _testGenericAPIUsageFromA14Project9() throws CoreException { >+public void testGenericAPIUsageFromA14Project9() throws CoreException { > IJavaProject project14 = null; > IJavaProject project15 = null; > try {
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 331446
:
184140
|
184250
|
184261
| 184322