-
Bug
-
Resolution: Fixed
-
P3
-
None
-
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.
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.
- relates to
-
JDK-8269957 facilitate alternate impls of NameTable and Name
- Resolved