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 61146 Details for
Bug 174445
[1.5][compiler] missing unchecked conversion warning upon parametrized method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Alternative patch
patch.txt (text/plain), 3.93 KB, created by
Kent Johnson
on 2007-03-16 14:16:01 EDT
(
hide
)
Description:
Alternative patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-03-16 14:16:01 EDT
Size:
3.93 KB
patch
obsolete
>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.120 >diff -u -r1.120 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 12 Mar 2007 08:14:52 -0000 1.120 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 16 Mar 2007 18:13:40 -0000 >@@ -7510,4 +7510,38 @@ > "The method bar(String, String) of type X is not generic; it cannot be parameterized with arguments <String>\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174445 >+public void test127() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " enum Enum1 {\n" + >+ " value;\n" + >+ " }\n" + >+ " enum Enum2 {\n" + >+ " value;\n" + >+ " }\n" + >+ " static abstract class A<T> {\n" + >+ " abstract <U extends T> U foo();\n" + >+ " }\n" + >+ " static class B extends A<Enum<?>> {\n" + >+ " @Override\n" + >+ " Enum<?> foo() {\n" + >+ " return Enum1.value;\n" + >+ " } \n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " A<Enum<?>> a = new B();\n" + >+ " Enum2 value = a.foo();\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 13)\n" + >+ " Enum<?> foo() {\n" + >+ " ^^^^\n" + >+ "Type safety: The return type Enum<?> for foo() from the type X.B needs unchecked conversion to conform to U from the type X.A<T>\n" + >+ "----------\n"); >+} > } >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.70 >diff -u -r1.70 MethodVerifier15.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 12 Mar 2007 08:14:55 -0000 1.70 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 16 Mar 2007 18:13:40 -0000 >@@ -134,9 +134,8 @@ > if (originalInherited.returnType != currentMethod.returnType) { > // if (currentMethod.returnType.needsUncheckedConversion(inheritedMethod.returnType)) { > // problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type); >- if (inheritedMethod.returnType.leafComponentType().isParameterizedType()) { >- if (currentMethod.returnType.leafComponentType().isRawType()) >- problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type); >+ if (inheritedMethod.returnType.leafComponentType().isParameterizedType() && currentMethod.returnType.leafComponentType().isRawType()) { >+ problemReporter(currentMethod).unsafeReturnTypeOverride(currentMethod, originalInherited, this.type); > } else if (inheritedMethod.hasSubstitutedReturnType() && originalInherited.returnType.leafComponentType().isTypeVariable()) { > if (((TypeVariableBinding) originalInherited.returnType.leafComponentType()).declaringElement == originalInherited) { // see 81618 - type variable from inherited method > TypeBinding currentReturnType = currentMethod.returnType.leafComponentType(); >@@ -527,7 +526,7 @@ > int inheritedLength = inheritedTypeVariables.length; > TypeVariableBinding[] typeVariables = currentMethod.typeVariables; > int length = typeVariables.length; >- if (length > 0 && inheritedLength != length) return inheritedMethod; >+ if (length > 0 && inheritedLength != length) return inheritedMethod; // no match JLS 8.4.2 > TypeBinding[] arguments = new TypeBinding[inheritedLength]; > if (inheritedLength <= length) { > System.arraycopy(typeVariables, 0, arguments, 0, inheritedLength);
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 174445
:
60532
|
60533
|
61057
| 61146