Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Oct 18, 2019

It leads to backend crashes if the enum is defined in a class and does
not seem to be needed anyway.

It leads to backend crashes if the enum is defined in a class and does
not seem to be needed anyway.
@sjrd
Copy link
Member

sjrd commented Oct 18, 2019

It's needed for Java interop for enums that extend java.lang.Enum. Java code won't be able to use an enum Foo extends java.lang.Enum if the values are not static fields in the bytecode.

@odersky
Copy link
Contributor Author

odersky commented Oct 18, 2019

It's needed for Java interop for enums that extend java.lang.Enum. Java code won't be able to use an enum Foo extends java.lang.Enum if the values are not static fields in the bytecode.

That's what I assumed. But then I looked at the enum-java test, which runs fine even if JavaStatic is removed. So I am not sure what goes on here.

If an enum value is static (i.e. part of a globally reachable object),
set the JavaStatic flag at erasure.
@anatoliykmetyuk anatoliykmetyuk merged commit 0fb7efc into scala:master Oct 21, 2019
@anatoliykmetyuk anatoliykmetyuk deleted the fix-#7428 branch October 21, 2019 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants