Skip to content

Early Java pickling fails with static self-imports #12743

@szeiger

Description

@szeiger

Early Java pickling (using -Ypickle-java) fails with static self-imports. Given C.java:

import static C.*;
import java.util.*;
public class C {}
$ ~/scala/scala-2.13.10/bin/scalac -Ypickle-java -Ypickle-write c-pickle.jar -d c.jar C.java
C.java:2: error: encountered unrecoverable cycle resolving import.
Note: this is often due in part to a class depending on a definition nested within its companion.
If applicable, you may wish to try moving some members into another object.
import java.util.*;
       ^
C.java:3: error: illegal cyclic reference involving class C
public class C {}
             ^
2 errors

The first error is a follow-on triggered by import java.util.*;. It only occurs together with the original error triggered by import static C.*;. I encountered this originally in 2.12.15 and it is reproducible in 2.13.10. The file compiles correctly without -Ypickle-java.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions