Summary: | [1.5][compiler] VerifyError due to generic cast to a non visible type | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Philipe Mulet <philippe_mulet> | ||||||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P3 | CC: | jerome_lanneluc, philippe_mulet | ||||||||
Version: | 3.4 | Flags: | philippe_mulet:
pmc_approved+
|
||||||||
Target Milestone: | 3.3.2 | ||||||||||
Hardware: | PC | ||||||||||
OS: | Windows XP | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
Philipe Mulet
2007-11-08 05:24:14 EST
Should also reject: Main.java: public class Main { public static void main(String[] args) { a.A myA = new a.A(); myA.p = myA.vec.get(0); } } a/A.java: package a; import java.util.Vector; public class A { class P {} public P p; public Vector<P> vec; public A() { vec = new Vector<P>(); vec.add(new P()); } } Should also reject: Main.java: public class Main { public static void main(String[] args) { a.A myA = new a.A(); myA.p = myA.vec.get(0); } } a/A.java: package a; import java.util.Vector; public class A { protected class P {} public P p; public Vector<P> vec; public A() { vec = new Vector<P>(); vec.add(new P()); } } The problem comes from the generic cast which gets inserted, and introducing an illegal reference to non-visible type P. Created attachment 82445 [details]
Proposed patch
Created attachment 82458 [details]
Patch for 3.3.x
Created attachment 82459 [details]
Better patch
If not rejecting the code, a verify error is issued at runtime. Also see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6495506 Released for 3.4M4 (HEAD). Fixed Released for 3.3.2 (R3_2_maintenance) Fixed Without the fix, the compiler may issue code which doesn't verify. The fix is quite simple. +1 for 3.3.2 Verified for 3.4M4 using build I20071210-1800. |