You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (Jira)" <ji...@apache.org> on 2022/07/27 15:34:00 UTC
[jira] [Commented] (GROOVY-10706) Consider tightening of star import rules for type checked code
[ https://issues.apache.org/jira/browse/GROOVY-10706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572002#comment-17572002 ]
Jochen Theodorou commented on GROOVY-10706:
-------------------------------------------
This is strange... Is this error really in the static compilation code, not in ResolveVisitor? But I checked and true... I was also sure there is code in ResolveVisitor for the ambiguity check. If true, then this code should be removed, it will speed up compilation
> Consider tightening of star import rules for type checked code
> --------------------------------------------------------------
>
> Key: GROOVY-10706
> URL: https://issues.apache.org/jira/browse/GROOVY-10706
> Project: Groovy
> Issue Type: Improvement
> Components: Static Type Checker
> Reporter: Paul King
> Priority: Major
>
> When faced we multiple star imports, dynamic Groovy has a rule whereby first seen match wins. With type checking, we might want to consider tightening up the rules and giving an error if duplicates are found, e.g.:
> {code}
> import java.awt.*;
> import java.util.*;
> @groovy.transform.CompileStatic
> static void main(args) {
> println List
> }
> {code}
> The Java equivalent would complain with something like:
> {noformat}
> error: reference to List is ambiguous
> System.out.println(List.class);
> ^
> both interface java.util.List in java.util and class java.awt.List in java.awt match
> 1 error
> {noformat}
> This might have performance impacts though, so we'd need to investigate that as part of the analysis.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)