(reflect) Accessing members of inner annotations types

Gunnar Morling gunnar at hibernate.org
Fri Jan 10 12:33:33 UTC 2014


Hi,

Many thanks for the investigation and suggested workarounds.

Bean Validation recommends to declare an inner @List annotation to specify
several constraints of the same type on a given element, but its ok to
deviate from that pattern in the rare cases of package-private constraint
types.

> I can file a bug/rfe for this.

I think that would be great; Taking the referenced types into account when
determining the package for generated proxy classes sounds reasonable to me.

Thanks again,

--Gunnar



2014/1/8 Joel Borggren-Franck <joel.franck at oracle.com>

> On 2014-01-08, Peter Levart wrote:
> > On 01/08/2014 01:00 PM, Joel Borggren-Franck wrote:
> > >>
> > >Perhaps an alternative would be to check if the interface a proxy is
> > >proxying is nested. In that case use the outermost interface's access
> > >level for the package calculation.
> > >
> > >This would probably lead to a few more proxies being generated into the
> > >"real" package compared to your proposal. I don't know if that is ok or
> > >not.
>
> > The nested public interface need not be referencing the outer
> > class/interface. In this case, proxy class can be generated in
> > com.sun.proxy.
>
> Yes, this is the reason for my remark about more proxies being generated
> into the real package. I'm not sure this is a problem, however it is
> moot considering you second point.
>
> > More importantly, even if the outer interface/class
> > was public, the nested interface could be referencing some other
> > package-private type. For example:
> >
>
> Ugh. Acknowledged. (This feels like a really bad practice but that
> doesn't matter here.)
>
> cheers
> /Joel
>



More information about the core-libs-dev mailing list