Description
Consider the following:
class C { transient void m() { println 'should not compile' } } new C().m()
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:
Illegal modifier for the method m; only public, protected, private, abstract, static, final, synchronized, native & strictfp are permitted
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) {}".
Attachments
Issue Links
- causes
-
GROOVY-10513 Incorrect bytecode generated for default interface methods with array parameter
- Closed
- is cloned by
-
GROOVY-10262 MethodNode#getText can output incorrect modifiers
- Closed
- relates to
-
GROOVY-10467 Compilation fails with method detected as transient
- Closed