groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: About creating instances of non-static inner classes with Java-Like syntax
Date Wed, 11 Apr 2018 23:01:53 GMT
Eric,

Yes this is used. 

For example, picocli has an Ansi enum (ON, OFF, AUTO), with a nested inner class Text. 

A Text instance is created with 
`currentAnsi.new Text(“@|bold hello|@“);`
The outer class determines whether Ansi escape codes are emitted when the text is rendered.


I’m sure it’s possible to design things differently but if you are asking “is this actually
used“, the answer is yes. 

(Shameless plug) Every java main() method deserves http://picocli.info

> On Apr 12, 2018, at 2:36, <eric.milles@thomsonreuters.com> <eric.milles@thomsonreuters.com>
wrote:
> 
> I know it is part of the Java spec, but do you know anyone that actuallky does that?
 I'm just curious as I've never once seen a need for it.
> 
> Array creation is the one item that comes up most often for me when converting a source
file from Java to Groovy.
> 

Mime
View raw message