implementation inconsistency with scope rules for Java generic types
Nick Radov
nradov at axolotl.com
Wed Jun 18 12:35:38 PDT 2008
Maurizio,
Thanks for explaining the issue. I found a few existing bugs that seem
somewhat related, but not exactly the same.
http://bugs.sun.com/view_bug.do?bug_id=6558551
http://bugs.sun.com/view_bug.do?bug_id=6246814
http://bugs.sun.com/view_bug.do?bug_id=6569404
Should I create a new bug report for this case, or would you like to do
that?
Nick Radov | Director, Research & Development | Axolotl Corp
www.axolotl.com, d: 408.920.0800 x116, f: 408.920.0880
160 West Santa Clara St., Suite 1000, San Jose, CA, 95113
THE MARKET LEADER IN HEALTH INFORMATION EXCHANGE ? PROVIDING PATIENT
INFORMATION WHEN AND WHERE IT IS NEEDED.
The information contained in this e-mail transmission may contain
confidential information. It is intended for the use of the addressee. If
you are not the intended recipient, any disclosure, copying, or
distribution of this information is strictly prohibited. If you receive
this message in error, please inform the sender immediately and remove any
record of this message.
From:
Maurizio Cimadamore <Maurizio.Cimadamore at Sun.COM>
To:
Nick Radov <nradov at axolotl.com>
Cc:
Alexander Buckley <Alex.Buckley at Sun.COM>, compiler-dev at openjdk.java.net
Date:
06/18/2008 10:54 AM
Subject:
Re: implementation inconsistency with scope rules for Java generic types
Hi Nick,
this is definitively an interesting question; if your example might look
like a straight javac bug at first, it' less clear whether it should be
considered as such when Subclass and NestedSubclass live in completely
unrelated packages; I think that one in principle could exploit an
eventual vulnerability (as the one you described for Eclipse) for
acquiring access to members of a private type that otherwise cannot be
accessed.
In this particular case however, since the class referencing the private
type is the class in which that type is defined, I don't think that an
error should be raised - so this is indeed a javac bug.
Alex do you have any JLS paragraph handy to support this?
Maurizio
Nick Radov wrote:
>
> I've run across an interesting inconsistency between javac and the
> Java compiler built in to the Eclipse 3.3.2 IDE. Try compiling this
> piece of code.
>
> public class X<T> {
> }
> class Subclass extends X<Subclass.NestedSubclass> {
> @SuppressWarnings("unchecked")
> private final class NestedSubclass extends X {
> }
> }
>
> The javac compiler reports one error because the generic type
> parameter of the Subclass class has private access, but Eclipse
> reports no errors. I had reported this as an Eclipse bug, but one of
> the Eclipse team thinks it may be a javac bug. You can see the Eclipse
> bug report here: <https://bugs.eclipse.org/bugs/show_bug.cgi?id=237656>.
>
> Does anyone know for sure which is correct? As far as I can tell the
> JLS doesn't explicitly state whether this is allowed, although it may
> be implicit in the scope rules.
>
> *Nick Radov | Director, Research & Development | Axolotl Corp*
> www.axolotl.com <http://www.axolotl.com/>, d: 408.920.0800 x116, f:
> 408.920.0880
> 160 West Santa Clara St., Suite 1000, San Jose, CA, 95113
>
> THE MARKET LEADER IN HEALTH INFORMATION EXCHANGE ? PROVIDING PATIENT
> INFORMATION WHEN AND WHERE IT IS NEEDED.
>
> /The information contained in this e-mail transmission may contain
> confidential information. It is intended for the use of the addressee.
> If you are not the intended recipient, any disclosure, copying, or
> distribution of this information is strictly prohibited. If you
> receive this message in error, please inform the sender immediately
> and remove any record of this message./
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20080618/911a2744/attachment.html
More information about the compiler-dev
mailing list