Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8315248

AssertionError in Name.compareTo

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 22
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: