The @security directive is used to modify class link-time access check behavior and stack crawl behavior for J/Direct method calls.
@security([checkClassLinking=on | off | auto], [checkDllCalls=on | off])
checkClassLinking=on | off | auto | Specifies whether the VM should allow only trusted classes to use this class (on), or whether all Java class can use this class (off).
Default is auto, which specifies normal Java access checks (for example, only trusted classes may use other trusted classes). |
checkDllCalls=on | off | If on is specified, the Microsoft VM performs a security stack crawl when a J/Direct method is invoked. If the classes on the stack are untrusted and permissions have not been asserted, the J/Direct call fails with a SecurityException.
off disables the requirement that all callers in the stack chain be fully trusted. Default is on. |
LinkSafe | Class scope. |
LinkUnsafe | Class scope. |
NAT_L_DCTS | Class scope. |
The following code disables the requirement that all callers in the stack chain be fully trusted.
/** @security(checkDllCalls=off) */ public class SomeStruct { }
The following code will mark the class as accessible to only trusted classes.
/** @security(checkClassLinking=on) */ public class SomeStruct { }