Re: Potential to include java.time.* as a default import for Groovy 5

"Alexander Veit via users" <users-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected]> Sun, 1 Jun 2025 14:56:05 +0200
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
Am 31.05.25 um 09:36 schrieb Paul King:
> We have a feature request, and potential PR, to add java.time.* as a
> new default import:
> 
> https://issues.apache.org/jira/browse/GROOVY-11513
> https://github.com/apache/groovy/pull/2156

I would vote against this proposal. Here are some arguments why:

First of all, I'm generally not in favor of adding more default default imports to the language, since I suspect negative impacts on maintainability of scripts and the efficiency of the compilation process.

Apart from Instance, LocalDateTime and ZonedDateTime most of the classes in java.time are probably rarely used. Does this justify to add 16 extra classes?

The classes in java.time are not fully usable without classes from other packages like java.time.format or java.time.temporal which should then also be default imports.

> There are many good points about including such a star import

This argument also holds for other packages like java.nio.* or java.text.


-- 
Cheers, Alex