You can try.
After compilation, change the test class to a specific class on the interface. but stay the Test3 link to a specific class test. Then, if the permission is false, the JVM will not find this error. Very interesting. In fact, Class someClass1= Class.forName("Test3",false,cls) will not allow Test3, either. This means that the error will not be selected.
12.3 Binding classes and interfaces Binding is the process of accepting the binary form of a class or interface type and merging it into the execution state of the Java virtual machine so that it can run. A class or type of interface is always loaded before it is bound. There are three different actions involved in linking: checking, preparing, and resolving symbolic links . The exact semantics of references are given in Chapter 5, Java Virtual Machine Specifications, Second Edition. Here we provide an overview of the process in terms of the Java programming language.
12.3.3 Resolving symbolic links The binary representation of a class or interface symbolically refers to other classes and interfaces and their fields, methods and constructors using the binary names (§13.1) of other classes and interfaces (§13.1). For fields and methods, these symbolic links include the name of the class or type of interface that declares the field or method, as well as the name of the field or method itself, along with the corresponding type information. Before using a symbolic link, it must go through a resolution in which the symbolic link is checked for correctness and is usually replaced by a direct link, which can be more efficiently processed if the link is reused.
If an error occurs during resolution, then an error occurs. Typically, this will be an instance of one of the following subclasses of the IncompatibleClassChangeError class, but it can also be an instance of some other IncompatibleClassChangeError subclass, or even an instance of the IncompatibleClassChangeError class. This error can be selected at any point in the program that directly or indirectly uses a symbolic link to the type:
IllegalAccessError : there is a symbolic link that indicates the use or assignment of a field or method call or instantiation of a class to which the code containing the link does not have access, because the field or method was declared private, protected or available by default (not public) or therefore that the class has not been declared public. This can happen, for example, if a field that was originally declared public is changed to private after another class that refers to this field has been compiled (§13.4.6).
InstantiationError : there is a symbolic link that is used in the instantiation expression of the class, but the instance cannot be created because the link is a reference to an interface or abstract class. This can happen, for example, if a class that is not originally abstract is changed to abstract after another class belonging to the class in question has been compiled (§13.4.1).
NoSuchFieldError : there is a symbolic link that refers to a specific field of a particular class or interface, but the class or interface does not contain a field for that name. This can happen, for example, if a field declaration has been removed from a class after another class that references this field has been compiled (§13.4.7).
NoSuchMethodError : there is a symbolic link that refers to a specific method of a particular class or interface, but the class or interface does not contain a method for this signature. This can happen, for example, if a method declaration has been removed from a class after another class that references the method has been compiled (§13.4.11). In addition, an UnsatisfiedLinkError (a subclass of LinkageError ) can be selected if the class declares its own method for which an implementation cannot be found. An error will occur if the method is used or earlier, depending on which resolution strategy the virtual machine uses (§12.3).