-
Notifications
You must be signed in to change notification settings - Fork 3.1k
read JEP 360 PermittedSubclasses_attribute #9228
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
Conversation
@@ -129,6 +129,7 @@ class ModifierFlags { | |||
final val JAVA_DEFAULTMETHOD = 1L << 47 // symbol is a java default method | |||
final val JAVA_ENUM = 1L << 48 // symbol is a java enum | |||
final val JAVA_ANNOTATION = 1L << 49 // symbol is a java annotation | |||
final val JAVA_SEALED = 1L << 50 // symbol is a java sealed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final val SYNTHESIZE_IMPL_IN_SUBCLASS = 1L << 50 // used in fields phase to indicate this accessor should receive an implementation in a subclass |
duplicate? 🤔
@@ -1182,6 +1182,12 @@ trait Namers extends MethodSynthesis { | |||
psym addChild context.owner | |||
else | |||
pending += ParentSealedInheritanceError(tpt, psym) | |||
|
|||
if (psym.isJavaSealed) { | |||
// TODO Don't report error if this is a permitted subclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
@@ -129,6 +129,7 @@ class ModifierFlags { | |||
final val JAVA_DEFAULTMETHOD = 1L << 47 // symbol is a java default method | |||
final val JAVA_ENUM = 1L << 48 // symbol is a java enum | |||
final val JAVA_ANNOTATION = 1L << 49 // symbol is a java annotation | |||
final val JAVA_SEALED = 1L << 50 // symbol is a java sealed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any difference in behavior between Java sealed and Scala sealed? If not, can we reuse the existing Sealed flag instead of adding another one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to reusing SEALED
. If there is some logic that only applies to Scala sealed
, we can implement this with sym.isSealed && !sym.isJava
.
We can test without needed a hard dependency on JDK15 by building using ASM to write out the same classes that javac 15 would write. See |
@xuwei-k interested in continuing work on this...? |
This needs a lot more work, and it is something that we ultimately want supported in our Java parser. But we'll close this PR for now, for inactivity. We can reopen if interest returns, or someone can resubmit change. |
(partially?) fix 12171 🤔
scala/bug#12171
How to add tests? 🤔
I have tested manually