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

Include adding javafx dependencies with JDK17 upgrade recipe #472

Open
Kushank24 opened this issue May 3, 2024 · 5 comments
Open

Include adding javafx dependencies with JDK17 upgrade recipe #472

Kushank24 opened this issue May 3, 2024 · 5 comments
Labels
enhancement New feature or request recipe Recipe requested

Comments

@Kushank24
Copy link

Kushank24 commented May 3, 2024

What problem are you trying to solve?

I am running the JDK17 update recipe. But once the recipe is run and I am trying to test it out I am getting the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project topology: Compilation failure: Compilation failure:
[ERROR] package javafx.util does not exist
[ERROR] package javafx.util does not exist
[ERROR] cannot find symbol
[ERROR] symbol: class Pair
[ERROR] location: class 

Describe the solution you'd like

The solution should be incorporated in the JDK17 upgrade recipe only so that the solution automatically gets remdified.

Have you considered any alternatives or workarounds?

Tried using java.util.Map.Entry but also some in that sense i needed to change the user code

@Kushank24 Kushank24 added the enhancement New feature or request label May 3, 2024
@timtebeek timtebeek changed the title javafx class integration in JDK17 upgrade recipe Include adding javafx dependencies with JDK17 upgrade recipe May 3, 2024
@timtebeek
Copy link
Contributor

Thanks for logging an issue! As discussed on Slack there's likely a couple changes we'd need to make for JavaFX projects adopting Java 17; would you mind breaking down those changes a bit in this issue? Things like adding a dependency, changing packages or classes, or switching to a different runtime. That way we're better able to start codifying such changes as recipes.

@timtebeek timtebeek added the recipe Recipe requested label May 3, 2024
@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite May 3, 2024
@Kushank24
Copy link
Author

Thanks for your prompt reply Tim. These are the following changes which I observed which needs to be incorporated to used javafx with Java 17:

  1. The platform no longer contains as part of the specification, and most JDK builds have removed it, thus an alternate way of using it is to add the dependencies to the project.
  2. Another workaround is to use java.util.Map.Entry or org.apache.commons.lang3.tuple but in that case also complete functionality is not available
  3. Liberica Full with LibericaFX, an open-source implementation of JavaFX can also be used for solving this.
    But all these requires specifc changes that needs to be done based on the scenario being decided.

@timtebeek
Copy link
Contributor

I think adding the required dependencies is the most straightforward way we can keep supporting JavaFX if that's used.

If folks only use one or two classes (such as Pair here), then it might make sense to use ChangeType instead to an alternative.

@Kushank24
Copy link
Author

Kushank24 commented May 6, 2024

Yeah correct Tim. I resolved the issue by adding the following dependencies in the parent pom:

<dependency>
 <groupId>org.openjfx</groupId>
 <artifactId>javafx-base</artifactId>
 <version>17.0.7</version>
</dependency>
<dependency>
 <groupId>org.openjfx</groupId>
 <artifactId>javafx-controls</artifactId>
 <version>17.0.7</version>
</dependency>
<dependency>
 <groupId>org.openjfx</groupId>
 <artifactId>javafx-fxml</artifactId>
 <version>17.0.7</version>
</dependency>

And it worked.

@timtebeek
Copy link
Contributor

Looks like those could be added with a declarative recipe if needed. That would then close out this issue for folks similarly migrating. Is that something you'd want to contribute?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request recipe Recipe requested
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants