You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2017/10/15 03:10:00 UTC
[jira] [Commented] (GROOVY-8354) Star imports allow
partially-qualified types
[ https://issues.apache.org/jira/browse/GROOVY-8354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16205001#comment-16205001 ]
Eric Milles commented on GROOVY-8354:
-------------------------------------
One reason it is confusing is you may have a variable like {{builder}} in one scope and in another scope it is the package {{builder}} that gets referenced if someone forgets a parameter or variable declaration.
> Star imports allow partially-qualified types
> --------------------------------------------
>
> Key: GROOVY-8354
> URL: https://issues.apache.org/jira/browse/GROOVY-8354
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
>
> Star imports like {{import java.lang.*}} allow partially-qualified references like {{reflect.Field}} to work. It appears this only works with explicit star imports in a compilation unit, not default imports.
> Some may call this a feature, but I couldn't find any description of it in the [language documentation|http://docs.groovy-lang.org/latest/html/documentation/#_star_import]. And this bug results in a lot of extra work during type resolution, in addition to the confusion it causes for Java developers.
> I'm expecting an error for this, but it works just fine.
> {code}
> import groovy.transform.*
> @builder.Builder
> class Buildable {
> Number number
> String string
> }
> ​println Buildable.builder().build()
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)