public final class RuntimePackageCheck
extends Object
Reports what statically compiled code accesses in another run-time package,
which is the package name and the class loader, when
CompilerConfiguration.RUNTIME_PACKAGE_CHECK applies. The language
allows such access, as the package name is the same, but the JVM refuses it
at run time with IllegalAccessError.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static void |
checkAnonymousClass(WriterController controller, ConstructorCallExpression call)Checks the constructor of the superclass that the generated constructor of an anonymous class calls. |
|
public static void |
checkConstructor(WriterController controller, ConstructorNode ctor, boolean superCall, ASTNode call)Checks a call of a constructor. |
|
public static void |
checkField(WriterController controller, FieldNode field, ClassNode receiverType, ASTNode expression)Checks a read or write of a field. |
|
public static void |
checkMethod(WriterController controller, MethodNode method, ClassNode receiverType, ASTNode call)Checks a call of a method. |
|
public static org.objectweb.asm.MethodVisitor |
checkNamedClasses(WriterController controller, org.objectweb.asm.MethodVisitor delegate)Returns a visitor that reports the instructions of a statically compiled method that name a class the JVM refuses: a class that is not public, with the same package name as the current class, of another run-time package. |
|
public static void |
checkSuperTypes(WriterController controller)Checks the superclass and interfaces of a statically compiled class. |
Checks the constructor of the superclass that the generated constructor of an anonymous class calls. That call is selected at run time, so the arguments of the anonymous class creation tell which constructor it is, if they tell.
controller - the writer of the current classcall - the creation of the anonymous class Checks a call of a constructor. There is no subclass rule for new:
only super(...) can call a protected constructor from a subclass.
A super(...) call without a source position in a generated
constructor, as @InheritConstructors adds for each constructor of
the superclass, is not reported: it fails only if that constructor is called.
Dynamic code calls a super constructor without the meta-class too, so the
report of such a call does not advise @CompileDynamic.
controller - the writer of the current classctor - the constructor that is calledsuperCall - whether the call is super(...)call - where to report itChecks a read or write of a field.
controller - the writer of the current classfield - the field that is accessedreceiverType - the type of the receiver, or null for this or superexpression - where to report itChecks a call of a method.
controller - the writer of the current classmethod - the method that is calledreceiverType - the type of the receiver, or null for this or supercall - where to report itReturns a visitor that reports the instructions of a statically compiled method that name a class the JVM refuses: a class that is not public, with the same package name as the current class, of another run-time package. The JVM checks that wherever an instruction names the class, so a value of such a class can still be stored and passed on as long as none of them does.
controller - the writer of the current classdelegate - the visitor of the method Checks the superclass and interfaces of a statically compiled class. The JVM
refuses to load a class whose superclass or interface it cannot access, in
dynamic code too, so the report does not advise @CompileDynamic.
controller - the writer of the class