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 59545 Details for
Bug 174588
[compiler] Code in abstract class calls wrong overloaded method. Correct method is defined in the implemented interface.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix + test cases
patch.txt (text/plain), 4.91 KB, created by
Maxime Daniel
on 2007-02-22 03:39:33 EST
(
hide
)
Description:
Fix + test cases
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2007-02-22 03:39:33 EST
Size:
4.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >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 >retrieving revision 1.67 >diff -u -r1.67 LookupTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 29 Jan 2007 07:36:58 -0000 1.67 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java 22 Feb 2007 08:35:23 -0000 >@@ -2729,6 +2729,116 @@ > }, > "X\nX"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174588 >+public void test081() { >+ this.runConformTest( >+ new String[] { >+ "X.java", //=================== >+ "public class X extends Y {\n" + >+ " public void set(int value) {\n" + >+ " System.out.println(\"set(\" + value + \")\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X();\n" + >+ " x.set(1L);\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class Y implements I {\n" + >+ " public void set(long value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ " public void set(double value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ "}\n" + >+ "interface I {\n" + >+ " void set(int value);\n" + >+ " void set(long value);\n" + >+ "}\n", // ================= >+ }, >+ "set(1)"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174588 >+// variant >+public void test082() { >+ this.runConformTest( >+ new String[] { >+ "X.java", //=================== >+ "public class X extends Y {\n" + >+ " public void set(int value) {\n" + >+ " System.out.println(\"set(\" + value + \")\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X();\n" + >+ " x.set(1L);\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class Y implements I {\n" + >+ " public abstract void set(int value);\n" + >+ " public void set(long value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ " public void set(double value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ "}\n" + >+ "interface I {\n" + >+ " void set(int value);\n" + >+ " void set(long value);\n" + >+ "}\n", // ================= >+ }, >+ "set(1)"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174588 >+// variant >+public void test083() { >+ String src[] = >+ new String[] { >+ "X.java", >+ "public class X extends Z {\n" + >+ " public void set(int value) {\n" + >+ " System.out.println(\"set(\" + value + \")\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X();\n" + >+ " x.set(1L);\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class Z extends Y {\n" + >+ " public void set(long value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ " public void set(double value) {\n" + >+ " set((int)value);\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class Y implements I {\n" + >+ "}\n" + >+ "interface I {\n" + >+ " void set(int value);\n" + >+ " void set(long value);\n" + >+ "}\n", >+ }; >+ if (complianceLevel.compareTo(COMPLIANCE_1_3) <= 0) { >+ this.runNegativeTest( >+ src, >+ "----------\n" + >+ "1. ERROR in X.java (at line 12)\r\n" + >+ " set((int)value);\r\n" + >+ " ^^^\n" + >+ "The method set(long) is ambiguous for the type Z\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 15)\r\n" + >+ " set((int)value);\r\n" + >+ " ^^^\n" + >+ "The method set(long) is ambiguous for the type Z\n" + >+ "----------\n"); >+ } else { >+ this.runConformTest( >+ src, >+ "set(1)"); >+ } >+} > public static Class testClass() { return LookupTest.class; > } > } >#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.299 >diff -u -r1.299 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 29 Jan 2007 07:37:02 -0000 1.299 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 22 Feb 2007 08:35:27 -0000 >@@ -1108,7 +1108,14 @@ > } > currentType = currentType.superclass(); > } >- >+ >+ // superinterfaces lookup for abstract classes >+ if (isCompliant14 && classHierarchyStart.isAbstract()) { >+ for (currentType = classHierarchyStart; currentType != null; currentType = currentType.superclass()) { >+ findMethodInSuperInterfaces(currentType, selector, found); >+ } >+ } >+ > // if found several candidates, then eliminate those not matching argument types > int foundSize = found.size; > MethodBinding[] candidates = null;
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 174588
:
59468
| 59545 |
59636
|
59643
|
60024
|
60148
|
60207
|
60210