Skip to content
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

Conversation

subyssurendran666
Copy link
Contributor

@subyssurendran666 subyssurendran666 commented Nov 5, 2024

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

@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from e45f07a to 178a88c Compare November 5, 2024 13:39
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from 178a88c to b254639 Compare November 12, 2024 06:25
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch 2 times, most recently from 3120cff to a4905a8 Compare November 14, 2024 04:39
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from a4905a8 to 4c34193 Compare November 27, 2024 08:37
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch 2 times, most recently from 66b4620 to e2e26dd Compare December 6, 2024 06:20
@jarthana
Copy link
Member

@subyssurendran666 The patch looks good, however, I just noticed that we need to handle interface + sealed as well. For e.g, consider the below code:

		    		sealed interface A permits X {}
	    			public final  class X implements A {}

Querying isSealed() on A is going to return false. I think in the getModifiers(), we should do similar fix in isInterface() branch also.
Also, it is better if we just used assertTrue and assertFalse instead of assertEquals in the tests, isn't it?

@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch 2 times, most recently from 42ee04d to 19b51e0 Compare December 12, 2024 09:16
@subyssurendran666
Copy link
Contributor Author

@subyssurendran666 The patch looks good, however, I just noticed that we need to handle interface + sealed as well. For e.g, consider the below code:

		    		sealed interface A permits X {}
	    			public final  class X implements A {}

Querying isSealed() on A is going to return false. I think in the getModifiers(), we should do similar fix in isInterface() branch also. Also, it is better if we just used assertTrue and assertFalse instead of assertEquals in the tests, isn't it?

I have a incorporated the changes. Thanks for the suggestions.

@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from 19b51e0 to 14f867a Compare December 17, 2024 04:19
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from 14f867a to 4b39e64 Compare January 6, 2025 10:15
@subyssurendran666 subyssurendran666 force-pushed the sealed-modifiers-and-permitted-types-not-accessible-through-ITypeBinding-3178 branch from 4b39e64 to f00c9f0 Compare January 6, 2025 10:18
@jarthana jarthana merged commit 8c8f5cd into eclipse-jdt:master Jan 7, 2025
10 checks passed
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.

[dom binding] JEP 409 - sealed modifiers and permitted types not accessible through ITypeBinding
2 participants