groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mgroovy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8570) Support Warnings in Groovy Compiler
Date Thu, 17 May 2018 22:59:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16479845#comment-16479845
] 

mgroovy commented on GROOVY-8570:
---------------------------------

@[~blackdrag]: When would that converter run ? And who would implement and maintain it right
now ? What added benefit would it have over simply educating people to use idiomatic Groovy
constructs (which is much simpler to implement and has no maintenance effort) ? Would it (optionally
?) also support idiomatic edge cases such as for-loops to each-functional-style-iteration
(What if the construct has or might have different performance characteristics ?) ? What if
the converter has a bug or a conversion does not work e.g. for indy-Groovy only, wouldn't
the reputation of Groovy suffer needlessly (reputation of course is easily lost, hard to regain
- see under "Groovy is slow", "Groovy is a script language", ...) ? Would it be better to
base this e.g. on IntelliJ ? It feels like this would definitely merit its own Jira issue...

> Support Warnings in Groovy Compiler
> -----------------------------------
>
>                 Key: GROOVY-8570
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8570
>             Project: Groovy
>          Issue Type: New Feature
>          Components: Compiler
>    Affects Versions: 3.0.0-alpha-3
>            Reporter: mgroovy
>            Priority: Major
>
> * To warn Java developers using e.g. non-idiomatic Groovy constructs which only exist
to support copy-and-paste Java-to-Groovy code compatibility, The Groovy compiler should support
compiler warnings in addition to compiler errors.
>  * Warnings should by default only be emitted in special circumstances such as the one
described above, and not spam developers with an endless stream of, often subjectve, messages
on "how to use Groovy correctly".
>  * Sample warnings:
> # WARNING: Using curly braces Java style array literals (\{...}) is not idiomatic Groovy.
To avoid confusion with Groovy closures, it is recommended to use the performance-identical
Groovy square bracket list literal syntax ([...]) instead.
> # WARNING: The 'var' keyword is currently only an alias to 'def' (i.e. Object) in Groovy.
To get reassignment type safety use an explicit type instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message