Search code examples
jvm.class-file

Is the empty string a legal field/method name?


According to the class file format used by the JVM, may a field or method legally have the empty string as its "unqualified name"? The only real restriction I can find in the relevant section is:

An unqualified name must not contain any of the ASCII characters . ; [ / (that is, period or semicolon or left square bracket or forward slash).

But I'm still having trouble believing this wouldn't cause issues somewhere else. Is the empty string really valid as a field/method name?


Solution

  • NO. JVMS SE 8 §4.2.2:

    An unqualified name must contain at least one Unicode code point

    JVMS SE 7 did not have this note.