[ https://issues.apache.org/jira/browse/GROOVY-10140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10140: --------------------------------- Description: Consider the following: {code:groovy} class C { transient void m() { println 'should not compile' } } new C().m() {code} Groovy happily compiles and executes this code. It should emit and error for the invalid modifier "transient" on the method declaration. Similar code in Java produces the following error: {code} Illegal modifier for the method m; only public, protected, private, abstract, static, final, synchronized, native & strictfp are permitted {code} transient overlaps the modifier bit for varargs so this can cause difficulties in joint compilation scenarios. Also the modifier printing code leveraged from {{MethodNode#getText}} does not consider the method context and prints "transient" for "def foo(... args) {}". was: Consider the following: {code:groovy} class C { transient void m() { println 'should not compile' } } new C().m() {code} Groovy happily compiles and executes this code. It should emit and error for the invalid modifier "transient" on the method declaration. Similar code in Java produces the following error: {code} Illegal modifier for the method m; only public, protected, private, abstract, static, final, synchronized, native & strictfp are permitted {code} transient overlaps the modifier but for varargs so this can cause difficulties in joint compilation scenarios. Also the modifier printing code leveraged from {{MethodNode#getText}} does not consider the method context and prints "transient" for "def foo(... args) {}". > No compiler error for invalid method modifiers > ---------------------------------------------- > > Key: GROOVY-10140 > URL: https://issues.apache.org/jira/browse/GROOVY-10140 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3 > Reporter: Eric Milles > Priority: Major > > Consider the following: > {code:groovy} > class C { > transient void m() { > println 'should not compile' > } > } > new C().m() > {code} > Groovy happily compiles and executes this code. It should emit and error for > the invalid modifier "transient" on the method declaration. Similar code in > Java produces the following error: > {code} > Illegal modifier for the method m; only public, protected, private, abstract, > static, final, synchronized, native & strictfp are permitted > {code} > transient overlaps the modifier bit for varargs so this can cause > difficulties in joint compilation scenarios. Also the modifier printing code > leveraged from {{MethodNode#getText}} does not consider the method context > and prints "transient" for "def foo(... args) {}". -- This message was sent by Atlassian Jira (v8.3.4#803005)