[lworld] RFR: 8261019: valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine; " in class file $Proxy5"

Yang Yi github.com+5010047+kelthuzadx at openjdk.java.net
Thu Feb 4 16:02:06 UTC 2021

Hi all,

QTypeDescriptorTest.java[0] also fails on my machine, this is occurred after merging JDK[1], I did some investigation. The root cause of the problem is that after the JDK was merged[1], the value of the constant CONSTANT_CLASS_DESCRIPTORS was changed from 61 to 62, but the major version of the class bytes generated dynamically by java.lang.reflect.ProxyGenerator was not updated simultaneously, it remained at the value 60:
private byte[] generateClassFile() {
  // V16 == 60
  visit(V16, accessFlags, dotToSlash(className), null,
          JLR_PROXY, typeNames(interfaces));
ClassFileParser::verify_legal_class_name would go to an unexpected branch, which causes ClassFormatError.
void ClassFileParser::verify_legal_class_name(...) const {
  if (length > 0) {
    // read _major_version(60) from dynamically generated class bytes,
    // compare with updated CONSTANT_CLASS_DESCRIPTORS(61)
    else if (_major_version >= CONSTANT_CLASS_DESCRIPTORS && bytes[length - 1] == ';' ) {
      legal = verify_unqualified_name(bytes + 1, length - 2, LegalClass);
    } else {
      // GO TO HERE
      legal = verify_unqualified_name(bytes, length, LegalClass);
  if (!legal) {
    ResourceMark rm(THREAD);
    assert(_class_name != NULL, "invariant");
      "Illegal class name "%.*s" in class file %s", length, bytes,
JDK-826101 suspects that JDK-8261021[2]  has the same problem since their exception messages are relatively similar. But according to their stack traces, they might be caused by different but related problems.

[0] https://bugs.openjdk.java.net/browse/JDK-8261019
[1] https://github.com/openjdk/valhalla/pull/316
[2] https://bugs.openjdk.java.net/browse/JDK-8261021


Commit messages:
 - [lworld] valhalla/valuetypes/QTypeDescriptorTest.java "Illegal class name "QLine;" in class file $Proxy5

Changes: https://git.openjdk.java.net/valhalla/pull/320/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=320&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8261019
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/320.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/320/head:pull/320

PR: https://git.openjdk.java.net/valhalla/pull/320

More information about the valhalla-dev mailing list