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

Support for Java/Scala mixed compilation with --server=false #3196

Open
Gedochao opened this issue Sep 23, 2024 · 0 comments
Open

Support for Java/Scala mixed compilation with --server=false #3196

Gedochao opened this issue Sep 23, 2024 · 0 comments
Labels
java Issues tied to compiling & running of Java code missing feature Something should have been implemented, but wasn't.

Comments

@Gedochao
Copy link
Contributor

Gedochao commented Sep 23, 2024

Is your feature request related to a problem? Please describe.
Mixed compilation of both .scala and .java files currently requires the usage of Bloop.
Under --server=false .java files are ignored completely.

// Message.java
public class Message {
    private String message = "Hello, World!";
    Message(String message) {
        this.message = message;
    }
    public String getMessage() {
        return message;
    }
}
// Main.scala
@main def main() = println(new Message("Hello, mixed compilation").getMessage)
scala-cli . --server=false
# Exception in thread "main" java.lang.NoClassDefFoundError: Message
#         at Main$package$.main(Main.scala:1)
#         at main.main(Main.scala:1)
# Caused by: java.lang.ClassNotFoundException: Message
#         at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
#         at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
#         at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
#         ... 2 more

Note that this works fine when Bloop is used.

scala-cli .               
# Compiling project (Scala 3.5.0, JVM (17))
# Compiled project (Scala 3.5.0, JVM (17))
# Hello, mixed compilation

Describe the solution you'd like
Optimally, we'd like to support mixed compilation without using Bloop.

Describe alternatives you've considered
If we can't support it, a good error message would be helpful.

Additional context

@Gedochao Gedochao added java Issues tied to compiling & running of Java code missing feature Something should have been implemented, but wasn't. labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java Issues tied to compiling & running of Java code missing feature Something should have been implemented, but wasn't.
Projects
None yet
Development

No branches or pull requests

1 participant