groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <>
Subject About supporting `var` of Java10+
Date Wed, 07 Mar 2018 23:53:57 GMT
Hi all,

    As GROOVY-8498[1] describes as follows, in order to compatibility with
Java 10+, Groovy should support `var` the reserved type name. The reference
implementation has been pushed to master and 2.6.0 branch, you can find it
via the link[2]. 

   Any thoughts?

This is to provide compatibility with: (Java 10) (targeted for Java 11)

Java 10 provides var to allow reduced ceremony by avoiding manifest
declaration of types for local variables for cases where type inferencing
can be supported. Groovy already does this with "def" and has it's own
approach for type inferencing within type-checked/compile static code. With
this in mind, it seems to make most sense for Groovy to have "var" as an
alias for "def" rather than closely mimic only the use cases allowed by



Sent from:

View raw message