The bytecode verifier is an internal component of the JVM and is responsible for detecting non-confirming Java code. It ensures that the class file is in the proper format, that illegal type casts are not performed, and it prevents operand stack overflows or underflows. Users sometimes, assume safe runtime environments and forgo bytecode verification by disabling itsometime assume that their code is safe and disable bytecode verification. This practice is extremely dangerous.
...
Bytecode verification happens by default in most implementations. If it doesn'tdoes not, the -Xverify:all
flag can be specified on the java
command line.
On Java 2 systems, classes loaded by the primordial class loader (that loads classes from the boot class path) are not required to perform bytecode verification. The verification is automatically performed when a classloader class loader loads a class dynamically.
...