Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7.3
-
Fix Version/s: None
-
Component/s: Stub generator / Joint compiler
-
Labels:None
-
Environment:Windows XP, Sun JDK 1.6.0_19
-
Patch Submitted:Yes
-
Number of attachments :
Description
NOTE: Below is fixed, this issue is for tracking additional impots added at end of other imports, e.g. import java.io.*;
Single-type import declarations in Groovy files are collected/converted into type-on-demand import declarations by the stub compiler – in other words,
import my.package.Type1 import my.package.Type2
becomes
import my.package.*;
This breaks the type shadowing mechanisms described in Section 7.5.1 of the Java Language Specification (3rd edition) and leads to Java compiler errors like "cannot decide which of the classes to use".
Moreover, current implementations is based on an unordered set, thus destroying the order of import declarations.
Attached patch solves these issues by preserving both the form and the order of original import declarations.
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
Single-type import declarations in Groovy files are collected/converted into type-on-demand import declarations by the stub compiler -- in other words,
{quote} {{import my.package.Type1}} {{import my.package.Type2}} {quote} becomes {quote} {{import my.package.*;}} {quote} This breaks the type shadowing mechanisms described in Section 7.5.1 of the Java Language Specification (3rd edition) and leads to Java compiler errors like "cannot decide which of the classes to use". Moreover, current implementations is based on an unordered set, thus destroying the order of import declarations. Attached patch solves these issues by preserving both the form and the order of original import declarations. |
NOTE: Below is fixed, this issue is for tracking additional impots added at end of other imports, e.g. {{import java.io.*;}}
---- Single-type import declarations in Groovy files are collected/converted into type-on-demand import declarations by the stub compiler -- in other words, {code} import my.package.Type1 import my.package.Type2 {code} becomes {code} import my.package.*; {code} This breaks the type shadowing mechanisms described in Section 7.5.1 of the Java Language Specification (3rd edition) and leads to Java compiler errors like "cannot decide which of the classes to use". Moreover, current implementations is based on an unordered set, thus destroying the order of import declarations. Attached patch solves these issues by preserving both the form and the order of original import declarations. |
| Fix Version/s | 1.7.4 [ 16563 ] | |
| Fix Version/s | 1.7.3 [ 16356 ] | |
| Affects Version/s | 1.7.3 [ 16356 ] | |
| Affects Version/s | 1.7.2 [ 16237 ] |
Guillaume Laforge
made changes -
| Fix Version/s | 1.7.5 [ 16639 ] | |
| Fix Version/s | 1.8-beta-2 [ 16629 ] | |
| Fix Version/s | 1.8-beta-1 [ 16013 ] | |
| Fix Version/s | 1.7.4 [ 16563 ] |
Guillaume Laforge
made changes -
| Fix Version/s | 1.7.6 [ 16749 ] | |
| Fix Version/s | 1.8-beta-3 [ 16750 ] | |
| Fix Version/s | 1.8-beta-2 [ 16629 ] | |
| Fix Version/s | 1.7.5 [ 16639 ] |
blackdrag blackdrag
made changes -
| Fix Version/s | 1.7.6 [ 16749 ] | |
| Fix Version/s | 1.8-beta-3 [ 16750 ] |
Paul King
made changes -
| Assignee | Paul King [ paulk ] |
Guillaume Laforge
made changes -
| Component/s | Stub generator / Joint compiler [ 14523 ] | |
| Component/s | Compiler [ 13529 ] |
I found an example (GroovyServ project) where removing the default imports means their project no longer compiles using the joint compiler. I am keeping the patch from
GROOVY-4225in place so extra "*" imports aren't added but will temporarily add back in the default imports (java.io, java.net, etc.) - though at the end not at the start where they were before. This will allow them to compile their project using a SNAPSHOT.This issue is a placeholder. We need to work out why the classes aren't being fully resolved, fix it and then remove the default import code.