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 159297 Details for
Bug 302919
misreported cast Error when mixing generic and raw class in nested class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Revised patch under consideration
castpatch.txt (text/plain), 6.79 KB, created by
Srikanth Sankaran
on 2010-02-17 07:52:39 EST
(
hide
)
Description:
Revised patch under consideration
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-02-17 07:52:39 EST
Size:
6.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.107 >diff -u -r1.107 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2 Dec 2009 18:35:40 -0000 1.107 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 17 Feb 2010 12:46:54 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -612,7 +612,7 @@ > ReferenceBinding otherEnclosing = otherParamType.enclosingType(); > if (otherEnclosing == null) return true; > if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) { >- if (enclosing != otherEnclosing) return true; >+ if (enclosing.isProvablyDistinct(otherEnclosing)) return true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919 > } else { > if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) return true; > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CastTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CastTest.java,v >retrieving revision 1.50 >diff -u -r1.50 CastTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/CastTest.java 25 Sep 2009 16:58:36 -0000 1.50 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CastTest.java 17 Feb 2010 12:47:03 -0000 >@@ -1782,6 +1782,93 @@ > "----------\n" > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919 >+public void test048() { >+ CompilerOptions options = new CompilerOptions(getCompilerOptions()); >+ if (options.sourceLevel < ClassFileConstants.JDK1_5) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java", >+ "public class A<T> extends D<T> {\n" + >+ " public class A1 extends D1 {\n" + >+ " }\n" + >+ " void m1(A<T> tree) {\n" + >+ " A.A1 v = ((A.A1) tree.root);\n" + >+ " }\n" + >+ " Zork z;\n" + >+ "}\n" + >+ "class D<T> {\n" + >+ " protected D1 root;\n" + >+ " protected class D1 {\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in A.java (at line 7)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919 >+public void test049() { >+ CompilerOptions options = new CompilerOptions(getCompilerOptions()); >+ if (options.sourceLevel < ClassFileConstants.JDK1_5) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java", >+ "public class A {\n" + >+ " void foo(Other2<?>.Member2<?> om2) {\n" + >+ " Other<?>.Member m = (Other<?>.Member) om2;\n" + >+ " m = om2;\n" + >+ " }\n" + >+ "}\n" + >+ "class Other<T> {\n" + >+ " class Member {}\n" + >+ "}\n" + >+ "class Other2<T> extends Other<T> {\n" + >+ " class Member2<U> extends Other<U>.Member {\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. WARNING in A.java (at line 3)\n" + >+ " Other<?>.Member m = (Other<?>.Member) om2;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Unnecessary cast from Other2<?>.Member2<capture#1-of ?> to Other<?>.Member\n" + >+ "----------\n" >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919 >+public void test050() { >+ CompilerOptions options = new CompilerOptions(getCompilerOptions()); >+ if (options.sourceLevel < ClassFileConstants.JDK1_5) return; >+ this.runNegativeTest( >+ new String[] { >+ "A.java", >+ "public class A<T> extends D<T> {\n" + >+ " public class A1 extends D.D1 {\n" + >+ " }\n" + >+ " void m1(A<T> tree) {\n" + >+ " A.A1 v = ((A.A1) tree.root);\n" + >+ " }\n" + >+ " Zork z;\n" + >+ "}\n" + >+ "class D<T> {\n" + >+ " protected D1 root;\n" + >+ " protected class D1 {\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in A.java (at line 7)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" >+ ); >+} > public static Class testClass() { > return CastTest.class; > } >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.811 >diff -u -r1.811 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 25 Nov 2009 04:56:21 -0000 1.811 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 17 Feb 2010 12:47:56 -0000 >@@ -45577,11 +45577,11 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " Other<String>.Member m = (Other<String>.Member) om2;\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Cannot cast from Other2<?>.Member2<capture#1-of ?> to Other<String>.Member\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " Other<String>.Member m = (Other<String>.Member) om2;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked cast from Other2<?>.Member2<capture#1-of ?> to Other<String>.Member\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=233800 - variation >@@ -45602,11 +45602,11 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " Other<String>.Member m = (Other<String>.Member) om2;\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " Other<String>.Member m = (Other<String>.Member) om2;\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=234619
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 302919
:
159276
| 159297