AssertionError in Name.compareTo

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 22
    • Affects Version/s: None
    • Component/s: tools
    • b14

      The recent changes to Name and NameTable may cause AssertionError

      Name implements CharSequence, and should be usable in CharSequence.compare(CharSequence, CharSequence)

      Instead, it may throw AssertionError if the names come from different name tables.

      Exception in thread "main" java.lang.AssertionError
              at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
              at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
              at jdk.compiler/com.sun.tools.javac.util.Utf8NameTable$NameImpl.compareTo(Utf8NameTable.java:136)
              at jdk.compiler/com.sun.tools.javac.util.Utf8NameTable$NameImpl.compareTo(Utf8NameTable.java:73)
              at java.base/java.lang.CharSequence.compare(CharSequence.java:291)

      While it maybe reasonable to check if the names are in the same table (perhaps to optimize any comparison), it should not be required.

            Assignee:
            Jonathan Gibbons
            Reporter:
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: