Index: src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java,v --- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 18 May 2006 17:52:43 -0000 1.56 +++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 13 Nov 2008 10:05:46 -0000 @@ -2395,6 +2395,7 @@ null /* no custom requestor*/, false /* do not skip javac for this peculiar test */); } + public void test072() { this.runNegativeTest( new String[] { @@ -2422,6 +2423,39 @@ "The method foo(String) is ambiguous for the type AX\n" + "----------\n"); } + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150758 +public void test075() { + this.runConformTest( + new String[] { + "package1/Test.java",//=================== + "package package1;\n" + + "import package2.MyList;\n" + + "public class Test {\n" + + " public void reproduce(String sortKey, boolean isAscending) {\n" + + " MyList recList = new MyList();\n" + + " recList.add(null);\n" + + " }\n" + + "}\n",//=================== + "package2/MyList.java",//=================== + "package package2;\n" + + "import java.util.AbstractList;\n" + + "import java.util.List;\n" + + "public class MyList extends AbstractList implements List {\n" + + " void add(Integer i) {\n" + + " }\n" + + " public Object get(int index) {\n" + + " return null;\n" + + " }\n" + + " public int size() {\n" + + " return 0;\n" + + " }\n" + + "}", // ================= + }, + ""); +} + + public static Class testClass() { return LookupTest.class; } } 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 --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 18 May 2006 19:59:45 -0000 1.279 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 13 Nov 2008 10:05:48 -0000 @@ -1219,12 +1219,12 @@ // check for duplicate parameterized methods if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { - for (int i = 0; i < candidatesCount; i++) { + for (int i = 0; i < visiblesCount; i++) { MethodBinding current = candidates[i]; if (current instanceof ParameterizedGenericMethodBinding) current = ((ParameterizedGenericMethodBinding) current).originalMethod; if (current instanceof ParameterizedMethodBinding) - for (int j = i + 1; j < candidatesCount; j++) + for (int j = i + 1; j < visiblesCount; j++) if (current.declaringClass == candidates[j].declaringClass && current.areParametersEqual(candidates[j])) return new ProblemMethodBinding(candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); }