-
Notifications
You must be signed in to change notification settings - Fork 1.1k
String#split(Char)
extension method stopped working on JDK 14
#8838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Very weird. I can reproduce the compilation error in the dotty build, but once I fix it, I don't actually see any error when I attempt to compile a file that uses this extension method, but I get a println: Caught: dotty.tools.dotc.core.CyclicReference: while parsing annotations in /modules/java.base/java/lang/annotation/ElementType.class In what repo exactly did you run sbt console? Can you reproduce this in github.com/lampepfl/dotty-example-project ? |
The cycle in question does involve completing val stripIndent
completing type PreviewFeature
completing val annotation
completing type annotation
completed annotation in package java.lang
completed annotation in package java.lang
completing type ElementType
completing type Enum
completing val <init>
completing type E
completing type E
completed E in class Enum
completed <init> in class Enum
completed Enum in package java.lang
completing val <init>
completed <init> in class ElementType
completing val TYPE
completed TYPE in object ElementType
completing val FIELD
completed FIELD in object ElementType
completing val METHOD
completed METHOD in object ElementType
completing val PARAMETER
completed PARAMETER in object ElementType
completing val CONSTRUCTOR
completed CONSTRUCTOR in object ElementType
completing val LOCAL_VARIABLE
completed LOCAL_VARIABLE in object ElementType
completing val ANNOTATION_TYPE
completed ANNOTATION_TYPE in object ElementType
completing val PACKAGE
completed PACKAGE in object ElementType
completing val TYPE_PARAMETER
completed TYPE_PARAMETER in object ElementType
completing val TYPE_USE
completed TYPE_USE in object ElementType
completing val MODULE
completed MODULE in object ElementType
completing val RECORD_COMPONENT
completing type PreviewFeature
So we need to be lazier when parsing annotations in some way, it'd be interesting to figure out what scalac ClassfileParser is doing differently here. |
The part which seems different from scalac is that when loading the Java enum class ElementType, we currently force completion of all its members: |
yes, but only if I add I guess this is related to #8688? (or is it a red herring that they both involve |
The CyclicReference in that issue is the same thing yeah, it's just that I hadn't been able to reproduce it so far. |
@smarter I just noticed. It's for checking exhaustivity of java enums. If it's lazy, an enum may never register, thus the exhaustivity check may not be able to know all enums. However, it might be possible to move the logic to exhaustivity check. Can you push your fix, remove the two lines, and I can fix the failed tests? |
I don't have a specific fix except removing these lines, do you want me to open a PR that just removes these lines? |
Then I'll have a look at the issue and propose a PR. |
It only happens in JDK 14.
It only happens in JDK 14.
It only happens in JDK 14.
Fix #8838: load Java enum members lazily to avoid cycles
it's fine on 8, 11, and 13
this can also be seen when Dotty tries to build itself on 14:
the problem also exists in 0.23.0-RC1; I didn't try testing farther back than that
The text was updated successfully, but these errors were encountered: