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 79233 Details for
Bug 204534
[1.5][compiler] Annoying consequence of method verification problem
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch with testcase
patch.txt (text/plain), 4.90 KB, created by
Kent Johnson
on 2007-09-26 15:08:27 EDT
(
hide
)
Description:
Proposed patch with testcase
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-09-26 15:08:27 EDT
Size:
4.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.648 >diff -u -r1.648 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 25 Sep 2007 20:15:11 -0000 1.648 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 26 Sep 2007 19:06:04 -0000 >@@ -39409,7 +39409,7 @@ > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204534 >-public void _test1181() { >+public void test1181() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -39430,7 +39430,42 @@ > " }\n" + > "}\n", // ================= > }, >- "should not see errors like: R cannot be resolved to a type"); >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + >+ " ^\n" + >+ "Cannot specify any additional bound T when first bound is a type parameter\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + >+ " public static <S, T extends Comparable<S>, R extends S & T> R max(T arg1, S arg2) {\n" + >+ " ^^^^^^^^^^^^^^^^^^^\n" + >+ "Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 3)\n" + >+ " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked cast from Object to R\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 6)\n" + >+ " public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Cannot specify any additional bound Comparable<S> when first bound is a type parameter\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 6)\n" + >+ " public static <T extends Comparable<S>, S, R extends S & Comparable<S>> R max(T arg1, S arg2) {\n" + >+ " ^^^^^^^^^^^^^^^^^^^\n" + >+ "Method max(T, S) has the same erasure max(Comparable<T>, Object) as another method in type X\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 7)\n" + >+ " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked cast from Object to R\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 11)\n" + >+ " return (R) ((arg1.compareTo(arg2) > 0) ? arg1 : arg2);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked cast from Object to R\n" + >+ "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204536 > public void test1182() { >#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.314 >diff -u -r1.314 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 25 Sep 2007 20:15:18 -0000 1.314 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 26 Sep 2007 19:06:07 -0000 >@@ -2271,9 +2271,19 @@ > case METHOD_SCOPE : > MethodScope methodScope = (MethodScope) scope; > AbstractMethodDeclaration methodDecl = methodScope.referenceMethod(); >- if (methodDecl != null && methodDecl.binding != null) { >- TypeVariableBinding typeVariable = methodDecl.binding.getTypeVariable(name); >- if (typeVariable != null) return typeVariable; >+ if (methodDecl != null) { >+ if (methodDecl.binding != null) { >+ TypeVariableBinding typeVariable = methodDecl.binding.getTypeVariable(name); >+ if (typeVariable != null) >+ return typeVariable; >+ } else { >+ // use the methodDecl's typeParameters to handle problem cases when the method binding doesn't exist >+ TypeParameter[] params = methodDecl.typeParameters(); >+ for (int i = params == null ? 0 : params.length; --i >= 0;) >+ if (CharOperation.equals(params[i].name, name)) >+ if (params[i].binding != null && params[i].binding.isValidBinding()) >+ return params[i].binding; >+ } > } > insideStaticContext |= methodScope.isStatic; > insideTypeAnnotation = methodScope.insideTypeAnnotation;
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 204534
:
79152
| 79233