RFC: Changing Class.newInstance() to add VM specific feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Wielaard wrote:
> And I might misunderstand the semantics of the @Internal access
> modifier. As I read your suggestion the VMClass.checkAccess() 
> method is only invoked when the Constructor of the Class is not
> public.

It is invoked when either the constructor or the class is not public.

> If I am totally wrong (maybe it is intended to also cover 
> public classes and I just misunderstood the patch) then I think the
> VMClass.checkAccess() idea is pretty sane.

Yeah. I'll try to explain the idea a little more clearly:

There is a new access modifier: @Internal. It can be applied to types
and members. In your source you typically mark the type or member as
public and the annotation, this allows the Java compiler to see the
type/member, but at runtime the type/member will appear to be package
accessible (i.e. none of the standard Java access modifiers are set),
but actually using the type (either in bytecode or by reflection) will
honour the new @Internal access level.

Here's an example from IKVM:

@Internal
public class VMClass { ... }

This allows me to use VMClass from other packages (notably
java.lang.reflect), but at runtime VMClass is still invisible to
standard Java code.

Regards,
Jeroen


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux