Code in java lang invoke uses strings for explicit class signatures, for example in InvokerBytecodeGenerator.java:
/**
* Generate an invoker method for the passed {@link LambdaForm}.
*/
private byte[] generateCustomizedCodeBytes() {
classFilePrologue();
// Suppress this method in backtraces displayed to the user.
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Mark this method as a compiled LambdaForm
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
if (lambdaForm.forceInline) {
// Force inlining of this invoker method.
mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
} else {
mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
}
It would be better to express as constants, that are possibly derived from the actual class (or at least equality-based assertions performed on the string to that derived from the class).
Any such work should ideally wait until JDK-8144223 is integrated into the appropriate repo, since that updates some class signatures (e.g. some of those in the above code snippet)