FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 14.04
A DESCRIPTION OF THE PROBLEM :
Hotspot constucts nameless parameter with empty name ("") that leads to verification error in reflection code (MalformedParametersException in Executable.verifyParameters)
hotspot code in reflection.cpp:
oop Reflection::new_parameter(Handle method, int index, Symbol* sym,
int flags, TRAPS) {
Handle name;
// A null symbol here translates to the empty string
if(NULL != sym) {
name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
} else {
name = java_lang_String::create_from_str("", CHECK_NULL);
}
....
}
Verification in Executable.verifyParameters:
...
if (name != null) {
if (name.isEmpty() || name.indexOf('.') != -1 ||
name.indexOf(';') != -1 || name.indexOf('[') != -1 ||
name.indexOf('/') != -1) {
throw new MalformedParametersException("Invalid parameter name \"" + name + "\"");
}
}
...
NB: there is special workaround in Parameter.getName() with special empty name processing case:
public String getName() {
// Note: empty strings as paramete names are now outlawed.
// The .equals("") is for compatibility with current JVM
// behavior. It may be removed at some point.
if(name == null || name.equals(""))
return "arg" + index;
else
return name;
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Generate method parameters metadata with null parameters names and then try to extract them via Method.getParameters()
ACTUAL -
java.lang.reflect.MalformedParametersException: Invalid parameter name ""
REPRODUCIBILITY :
This bug can be reproduced always.