groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject void field
Date Tue, 14 Mar 2017 11:26:38 GMT

I am wondering if anyone has thoughts wrt

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.

View raw message