Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java type name resolution with wildcard imports is incorrect #18529

Open
andrew-boyarshin opened this issue Sep 8, 2023 · 0 comments · May be fixed by #21888
Open

Java type name resolution with wildcard imports is incorrect #18529

andrew-boyarshin opened this issue Sep 8, 2023 · 0 comments · May be fixed by #21888

Comments

@andrew-boyarshin
Copy link

andrew-boyarshin commented Sep 8, 2023

Compiler version

3.3.1

Minimized code

Repo (branch 1)

TLDR:

package bug.code;

import bug.util.List;
import bug.util.*;
import java.util.*;

public class Code {
    public List<Long> work(List<Integer> list) {
        return null;
    }
}

Output

-- [E049] Reference Error: .\src\code\Code.java:8:27 ---------------------------
8 |    public List<Long> work(List<Integer> list) {
  |                           ^^^^
  |                           Reference to List is ambiguous.
  |                           It is both imported by import bug.util._
  |                           and imported subsequently by import java.util._
  |
  | longer explanation available when compiling with `-explain`
-- [E049] Reference Error: .\src\code\Code.java:8:11 ---------------------------
8 |    public List<Long> work(List<Integer> list) {
  |           ^^^^
  |           Reference to List is ambiguous.
  |           It is both imported by import bug.util._
  |           and imported subsequently by import java.util._
  |
  | longer explanation available when compiling with `-explain`

Expectation

Scala code compiles successfully in mixed mode, like in Scala 2.13.11.

@andrew-boyarshin andrew-boyarshin added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 8, 2023
@WojciechMazur WojciechMazur added compat:java area:parser and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 8, 2023
@dwijnand dwijnand changed the title Java parser handling of wildcard (on-demand) imports is incorrect Java type name resolution with wildcard imports is incorrect Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants