groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject void field
Date Tue, 14 Mar 2017 11:26:38 GMT
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.

Mime
View raw message