You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not before your message, but I tried. Of course it doesn't help.
I also tried "mvn clean install", etc.
But I have since narrowed down the problem. The error only occurs with the latest version of Gson, which is: 2.11.0
The problem only occurs when I use JavaFX. I see that the point is not JavaFX, but the modular program (module-info.java). I'm writing a simple Maven project that works non-modularly on Gson 2.11.0.
Let's stick with the modular JavaFX program:
If I switch back to the previous version of Gson, 2.10.1 or earlier, it works.
I looked into the Gson source code. Earlier versions of Gson are also modular. So it's not a problem. I see they introduced a new thing: proguard. I just suspect that might be causing the problem. I didn't go through it in detail.
I have a line like this in the module-info.java file:
//...
requires com.google.gson;
opens com.example to javafx.fxml, com.google.gson, hu.szit.resclient;
After the word requires, com.google.gson is underlined in red. If I move the mouse towards it, it says:
"com.google.gson cannot be resolved to a module"
(
Gson 2.11.0 also works in NetBeans for Maven-based and modular JavaFX projects.
)
Activity
jdneo commentedon Nov 10, 2024
Have you tried right click on the pom file and select Reload Project?
andteki commentedon Nov 10, 2024
Hello jdneo!
Not before your message, but I tried. Of course it doesn't help.
I also tried "mvn clean install", etc.
But I have since narrowed down the problem. The error only occurs with the latest version of Gson, which is: 2.11.0
The problem only occurs when I use JavaFX. I see that the point is not JavaFX, but the modular program (module-info.java). I'm writing a simple Maven project that works non-modularly on Gson 2.11.0.
Let's stick with the modular JavaFX program:
If I switch back to the previous version of Gson, 2.10.1 or earlier, it works.
I looked into the Gson source code. Earlier versions of Gson are also modular. So it's not a problem. I see they introduced a new thing: proguard. I just suspect that might be causing the problem. I didn't go through it in detail.
The concrete phenomenon:
If you have this in pom.xml:
I have a line like this in the module-info.java file:
After the word requires, com.google.gson is underlined in red. If I move the mouse towards it, it says:
"com.google.gson cannot be resolved to a module"
(
Gson 2.11.0 also works in NetBeans for Maven-based and modular JavaFX projects.
)
jdneo commentedon Nov 11, 2024
Would you mind sharing a sample project for this issue?
andteki commentedon Nov 11, 2024
Here it is:
https://github.com/andteki/samplefx.git
Now, the Gson version is 2.11.0, so not working.
If you write the version 2.10.1, then works.
https://central.sonatype.com/artifact/com.google.code.gson/gson
jdneo commentedon Nov 12, 2024
Looks like it's a bug from upstream:
Related issues:
google/gson#2721
eclipse-jdt/eclipse.jdt.core#2495
For now the workaround is to use gson@2.10.1
Sorry for the inconvenience.
andteki commentedon Nov 13, 2024
Thank you for your work!