Bug 216692 - [1.5][compiler] Protected type not visible in subclass
Summary: [1.5][compiler] Protected type not visible in subclass
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 230466 232174 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-01-27 00:30 EST by Olivier Lefevre CLA
Modified: 2008-05-15 05:58 EDT (History)
5 users (show)

See Also:


Attachments
The script to run (1.06 KB, text/plain)
2008-01-27 00:31 EST, Olivier Lefevre CLA
no flags Details
Proposed patch (3.48 KB, patch)
2008-01-28 17:41 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Lefevre CLA 2008-01-27 00:30:21 EST
Run the attached script. ecj will put:
-----------------------------------------------
1. ERROR in src\pkg2\SubFoo.java (at line 6)
        Field field = fields.get("test");
                      ^^^^^^^^^^^^^^^^^^
The type Foo<T>.Field is not visible
-----------------------------------------------
which does not make sense. First, it does not complain 
about the 'Field field = null' declaration, which should 
be equally problematic if the Field type was invisible.
Second, the Field type is protected in the super and 
thus _is_ visible anyhow.

One workaround is to make the Field type public. More
surprisingly, removing the type parameter of the Foo and
SubFoo classes also makes the problem disappear.
Comment 1 Olivier Lefevre CLA 2008-01-27 00:31:29 EST
Created attachment 87963 [details]
The script to run
Comment 2 Philipe Mulet CLA 2008-01-28 17:38:18 EST
Bug in visibility check, was not properly stepping through erased types (this explains why manually removing type parameters did seem to address the issue).

Comment 3 Philipe Mulet CLA 2008-01-28 17:41:06 EST
Created attachment 88069 [details]
Proposed patch
Comment 4 Philipe Mulet CLA 2008-01-28 17:42:10 EST
re: comment 2.
Most type visibility checks where actually behaving properly, but one code path did fail. Field/methods were fine already.
Comment 5 Philipe Mulet CLA 2008-01-29 05:16:55 EST
Released for 3.4M5.
Added GenericTypeTest#test1268
Fixed
Comment 6 Eric Jodet CLA 2008-02-04 06:40:16 EST
Verified for 3.4M5 using build I20080204-0010
Comment 7 Laurent Voisin CLA 2008-02-12 12:36:40 EST
Is there any chance that this fix is also applied to maintenance release 3.3.2 ?  Indeed, this bug was not there in release 3.3.1.1 and has been introduced in the maintenance branch for 3.3.2.
Comment 8 Philipe Mulet CLA 2008-02-28 07:38:14 EST
Released fix in 3.3.x maintenance branch (post 3.3.2).

Unfortunately, Laurent, 3.3.2 is out already.
If you are desperate, we could post a JDT/Core patch including this fix (based on 3.3.2 + this fix).
Comment 9 Philipe Mulet CLA 2008-05-07 05:11:43 EDT
*** Bug 230466 has been marked as a duplicate of this bug. ***
Comment 10 Philipe Mulet CLA 2008-05-15 05:56:42 EDT
*** Bug 232174 has been marked as a duplicate of this bug. ***
Comment 11 Philipe Mulet CLA 2008-05-15 05:58:36 EDT
Fix is available in 3.4 and in 3.3 maintenance branch post 3.3.2.
A patch is posted at: http://www.eclipse.org/jdt/core/r3.3/index.php#UPDATES
(use the 3.3.3 preview)