java.lang.InternalError: CallerSensitive annotation expected at frame 1
Only privileged code can use this annotation. the code is privileged if it is loaded via bootstrap class loader or extension class loader.
excerpt from Open JDK source file classFileParser.cpp
// Privileged code can use all annotations. Other code silently drops some.
const bool privileged = loader_data->is_the_null_class_loader_data() ||
loader_data->is_ext_class_loader_data() ||
loader_data->is_anonymous();
To make java load your classes via bootstrap class loader you can use the -Xbootclasspath/a
option to add your classes to the bootstrap class path when running java
:
java -Xbootclasspath/a:classes_dir_or_jar_file fully.qualified.mainClassName
To have your classes loaded via extension class loader instead, you need to put your jar file in $JAVA_HOME/jre/lib/ext
directory or any other directories set in java.ext.dirs
system property.