Skip to content

Can't compile JavaFX projects (regression?) #767

@s-bernard

Description

@s-bernard

More precisely, since commit a124774, a simple JavaFX project cannot compile and log the following errors:

[info] Compiling 1 Java source to ./out/javafx/compile/dest/classes ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by sbt.internal.inc.javac.DiagnosticsReporter$PositionImpl$ (file:/~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/zinc-compile-core_2.12/1.2.5/zinc-compile-core_2.12-1.2.5.jar) to field com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.d
WARNING: Please consider reporting this to the maintainers of sbt.internal.inc.javac.DiagnosticsReporter$PositionImpl$
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[error] ./javafx/src/ButtonApp.java:1:1: package javafx.application does not exist
[error] import javafx.application.Application;
[error] ./javafx/src/ButtonApp.java:2:1: package javafx.stage does not exist
[error] import javafx.stage.Stage;
…

Basically it cannot find the JavaFX packages.

Latest commit tested: 80eb7e0
Tested with java-11-graalvm and java-11-openjdk.
Was working as expected before a124774.

Sample code

cat build.sc

import mill._, scalalib._

val javaFXVersion = "13.0.2"

object javafx extends JavaModule {
  def mainClass = Some("Main")
  def ivyDeps = Agg(ivy"org.openjfx:javafx-controls:$javaFXVersion")
}

cat javafx/src/ButtonApp.java

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.control.Button;

public class ButtonApp extends Application {
  public static void main(String[] args) {
    launch(args);
  }

  @Override public void start(Stage stage) {
    var button = new Button("Please Click Me!");
    button.setOnAction(e -> stage.close());
    var box = new VBox();
    box.getChildren().add(button);
    var scene = new Scene(box);
    stage.setScene(scene);
    stage.setTitle("Just a button");
    stage.show();
  }
}

cat javafx/src/Main.java

public class Main {

  public static void main(String[] args) {
    ButtonApp.main(args);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions