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

AssertionError in Name.compareTo

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 22
    • None
    • tools
    • b14

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: