Paul King created GROOVY-10706:
----------------------------------
Summary: 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
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)