[ 
https://issues.apache.org/jira/browse/GROOVY-10433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17466853#comment-17466853
 ] 

Paul King commented on GROOVY-10433:
------------------------------------

Adding "sealed" into the list of identifiers in the grammar makes the compiler 
behave in the same was as the other restricted identifiers:
{code}
def sealed() { false }
this.sealed()
{code}
So, you can define the method but still need the qualifier when calling it.

For your other example, "non-sealed" is then still flagged as a keyword but 
adding some whitespace is a workaround:
{code}
def clos = { non, sealed -> return non - sealed }
assert 6 == clos(10, 4)
{code}


> "sealed" not usable as a restricted identifier
> ----------------------------------------------
>
>                 Key: GROOVY-10433
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10433
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr4
>    Affects Versions: 4.0.0-rc-2
>            Reporter: Eric Milles
>            Priority: Major
>
> The restricted identifier "sealed" is not usable for a variable or member 
> name any longer.
> {code:groovy}
> def sealed = false // fails to parse
> def record = false // okay
> def permits = false // okay
> class C {
>   def sealed = false // fails to parse
>   def record = false // okay
>   def permits = false // okay
> }
> {code}
> And this should still work as minus: "\{ non, sealed -> return non-sealed \}"



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to