You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Paul King <pa...@asert.com.au> on 2017/03/14 11:26:38 UTC
void field
Hi,
I am wondering if anyone has thoughts wrt
https://issues.apache.org/jira/browse/GROOVY-8046?
The example given is:
class MyClass {
void field
static void main(String[] args) {}
}
Compiling gives:
Exception in thread "main" java.lang.ClassFormatError: Field "field"
in class MyClass has illegal signature "V"
There are two ways to "fix" this.
(1) Detect this case during class generation and give a friendlier error message
(2) Convert to type "Void" like we "auto-coerce" primitives to their
wrapper equivalents. This also hushes the ClassFormatError.
I can't see any useful meaning that (2) could provide so I am inclined
to just do (1). Any objections/other thoughts?
Cheers, Paul.
Re: void field
Posted by Paul King <pa...@asert.com.au>.
Correct, not ACG but in ClassCompletionVerifier which runs in the
classgen phase.
Cheers, Paul.
On Tue, Mar 14, 2017 at 10:48 PM, Jochen Theodorou <bl...@gmx.org> wrote:
>
>
> On 14.03.2017 12:26, Paul King wrote:
> [...]
>>
>> There are two ways to "fix" this.
>> (1) Detect this case during class generation and give a friendlier error
>> message
>
>
> not in ACG and friends, but during compilation, yes. I think we already have
> somewhere something checking for invalid modifiers
>
> bye Jochen
Re: void field
Posted by Jochen Theodorou <bl...@gmx.org>.
On 14.03.2017 12:26, Paul King wrote:
[...]
> There are two ways to "fix" this.
> (1) Detect this case during class generation and give a friendlier error message
not in ACG and friends, but during compilation, yes. I think we already
have somewhere something checking for invalid modifiers
bye Jochen