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 159756 Details for
Bug 298362
[1.5][compiler] Compiler returns java.lang.Object instead of generic type T when javac returns T
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch under consideration
patch.txt (text/plain), 5.40 KB, created by
Srikanth Sankaran
on 2010-02-22 04:47:48 EST
(
hide
)
Description:
Patch under consideration
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-02-22 04:47:48 EST
Size:
5.40 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java,v >retrieving revision 1.109 >diff -u -r1.109 MethodVerifier15.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 19 Feb 2010 10:14:13 -0000 1.109 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 22 Feb 2010 09:40:39 -0000 >@@ -130,8 +130,11 @@ > problemReporter().unsafeReturnTypeOverride(concreteMethod, originalInherited, this.type); > > // check whether bridge method is already defined above for interface methods >+ // skip generation of bridge method for current class & method if an equivalent >+ // bridge will be/would have been generated in the context of the super class since >+ // the bridge itself will be inherited. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362 > if (originalInherited.declaringClass.isInterface()) { >- if ((concreteMethod.declaringClass == this.type.superclass && this.type.superclass.isParameterizedType()) >+ if ((concreteMethod.declaringClass == this.type.superclass && this.type.superclass.isParameterizedType() && !areMethodsCompatible(concreteMethod, originalInherited)) > || this.type.superclass.erasure().findSuperTypeOriginatingFrom(originalInherited.declaringClass) == null) > this.type.addSyntheticBridgeMethod(originalInherited, concreteMethod.original()); > } >#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.196 >diff -u -r1.196 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 11 Nov 2009 05:38:49 -0000 1.196 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 22 Feb 2010 09:40:47 -0000 >@@ -10731,4 +10731,101 @@ > "Name clash: The method put(K, V) of type OverrideBug<K,V> has the same erasure as put(K, V) of type Map<K,V> but does not override it\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362 >+public void test205() { >+ this.runConformTest( >+ new String[] { >+ "Tester.java", >+ "import java.lang.reflect.Method;\n" + >+ "\n" + >+ "public class Tester {\n" + >+ "\n" + >+ " public static interface Converter<T> {\n" + >+ " T convert(String input);\n" + >+ " }\n" + >+ "\n" + >+ " public static abstract class EnumConverter<T extends Enum<T>> implements Converter<Enum<T>> {\n" + >+ " public final T convert(String input) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " public static class SomeEnumConverter extends EnumConverter<Thread.State> {\n" + >+ " }\n" + >+ "\n" + >+ " public static void main(String[] args) throws Exception {\n" + >+ " Method m = SomeEnumConverter.class.getMethod(\"convert\", String.class);\n" + >+ " System.out.println(m.getGenericReturnType());\n" + >+ " }\n" + >+ "\n" + >+ "}\n" >+ >+ }, >+ "T"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362 (variation) >+public void test206() { >+ this.runConformTest( >+ new String[] { >+ "Tester.java", >+ "import java.lang.reflect.Method;\n" + >+ "\n" + >+ "public class Tester {\n" + >+ "\n" + >+ " public static interface Converter<T> {\n" + >+ " T convert(String input);\n" + >+ " }\n" + >+ "\n" + >+ " public static abstract class EnumConverter<T extends Enum<T>> implements Converter<T> {\n" + >+ " public final T convert(String input) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " public static class SomeEnumConverter extends EnumConverter<Thread.State> {\n" + >+ " }\n" + >+ "\n" + >+ " public static void main(String[] args) throws Exception {\n" + >+ " Method m = SomeEnumConverter.class.getMethod(\"convert\", String.class);\n" + >+ " System.out.println(m.getGenericReturnType());\n" + >+ " }\n" + >+ "\n" + >+ "}\n" >+ >+ }, >+ "T"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362 (variation) >+// Note that this test prints "T" with javac5 and "class java.lang.Object with javac 6,7 >+public void test207() { >+ this.runConformTest( >+ new String[] { >+ "Tester.java", >+ "import java.lang.reflect.Method;\n" + >+ "\n" + >+ "public class Tester {\n" + >+ "\n" + >+ " public static interface Converter<T> {\n" + >+ " T convert(String input);\n" + >+ " }\n" + >+ "\n" + >+ " public static abstract class EnumConverter<T extends Enum<T>, K> implements Converter<T> {\n" + >+ " public final T convert(K input) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " public static class SomeEnumConverter extends EnumConverter<Thread.State, String> {\n" + >+ " }\n" + >+ "\n" + >+ " public static void main(String[] args) throws Exception {\n" + >+ " Method m = SomeEnumConverter.class.getMethod(\"convert\", String.class);\n" + >+ " System.out.println(m.getGenericReturnType());\n" + >+ " }\n" + >+ "\n" + >+ "}\n" >+ >+ }, >+ "class java.lang.Object"); >+} > }
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 298362
: 159756