-
Notifications
You must be signed in to change notification settings - Fork 130
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
Sealed and non-sealed modifiers and permitted types not accessible through ITypeBinding #3252
base: master
Are you sure you want to change the base?
Conversation
for sealed and non-sealed modifiers
e45f07a
to
178a88c
Compare
if (referenceBinding.isAnonymousType()) { | ||
return accessFlags & ~Modifier.FINAL; | ||
} else if (referenceBinding.isSealed()) { | ||
return Modifier.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.
This is wrong. With this, we are discarding every other bit in accessFlags.
} else if (referenceBinding.isSealed()) { | ||
return Modifier.SEALED; | ||
} else if (referenceBinding.isNonSealed()) { | ||
return Modifier.NON_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.
Same as above.
@@ -133,4 +127,64 @@ void main() { | |||
assertEquals("Not a Block", block.getNodeType(), ASTNode.BLOCK); | |||
assertEquals("Block startPosition is not correct", block.getStartPosition(), 21); | |||
} | |||
|
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.
Would help if you can select just the newly added code block and format, to keep it in line with our formatting preferences.
astParser.setBindingsRecovery(true); | ||
|
||
String source =""" | ||
sealed class A permits B, C {} |
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.
You might want to add some more modifiers and test for their presence in the output. For e.g.
public sealed abstract class A permits B, C {}
Added the unit tests and added the modifiers to the resolve bindings for sealed and non-sealed modifiers
What it does
The 'sealed' and 'non-sealed' modifiers are visible and accessible through the AST, but not when trying to get the same information with the associated type binding. Therefore added the modifiers in the TypeBiding for the sealed and non-sealed modifiers.
How to test
This PR closes #3178
Author checklist