-
Notifications
You must be signed in to change notification settings - Fork 456
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
JavaFX application produce warning #120
Comments
Technically the libraries from extension classpath are not guaranteed to exist on JVMs so they are restricted. I think we need to introduce a setting to suppress these warnings. |
@gorkem is there any specific location in code where I could look to implement this ? I treat any warning as errors and having that warnings don't allow me keep track of other warnings |
You can have a workaround by adding access rules to the .classpath files. This has an example of how to add JavaFX entries and maintaining them. |
@gorkem we should probably provide a quick fix that performs that change in the access rules automagically |
any update on this ?
produces a red underline with the following error message
autocomplete does seem to still work tho. i just would really need a setting to simply ignore this error. |
As the author of e(fx)clipse I had to fix the same problems you see for the Eclipse IDE. There are in fact 2 things to consider for JavaFX
What we do in e(fx)clipse is that we use a JDT-Extension-Point to configure the VMInstall to:
You can see our code at
|
# Access restriction: The type 'Platform' is not API (restriction on required library '/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar') |
Bumping this again to see if a solution has been found. Sure it compiles fine but the errors in the IDE are a little annoying. |
Seeing this too for jdk.nashorn. No idea why it's restricted. Really need a setting on the plugin to suppress these errors. |
As a workaround, to get rid of theses warnings, you can add @joewood see @gorkem's explanation about the restriction. |
Any updates on this thread? I'm working with the workaround but it would be nice to have an official fix. |
+1 |
Any updates the status of this? I am running the latest Oracle Java 8, latest VS Code, and downloaded the CI build of the plugin yet still have this problem. I tried the 'workaround' (org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore) but that didn't work for me either. Here is what I have as far as build is concerned. /.settings/org.eclipse.buildship.core.prefs
/.classpath
/.project
/build.gradle
/.vscode/settings.json
I'm building a basic JavaFX example from Oracle's samples. |
.settings/org.eclipse.jdt.core.prefs
|
@snjeza Oh wow, I totally missed the paths in between. I didn't see that file in .settings, so I created it but I am still seeing the error. Is that file automatically read or do I have to point a var to it? |
@primesoftware try to restart VS Code |
@snjeza Still doing the same thing after restart. This is really puzzling. Are there any cache files that may be prioritized over the files in .settings? |
@primesoftware No, there aren't any files. |
@snjeza That did it!!! No more nasty red underlines! Any thoughts as to why the workspace needed to be cleared? |
@primesoftware |
@ESLHemantSangle I had it working, but I'm having .classpath issues now since I switched to using Gradle's new .kts build scripts. |
Any progress on this issue? Editing Adding access rules to It would be really useful to have official JavaFX support for this in the extension, considering that it's the standard GUI toolkit. |
Starting with Java-11 - It is an ordinary library you add simply as a maven dependency so the problem solves itself |
@tomsontom That's a good solution, but unfortunately there are projects that rely on JDK 8 and won't update anytime soon. Having to re-add <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/">
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
<accessrule kind="accessible" pattern="com/sun/javafx/**"/>
</accessrules>
</classpathentry> every time the project changes structurally is tedious and should be fixed. |
A better solution for using JavaFX with JDK 8, is to integrate the access rule directly into import org.gradle.plugins.ide.eclipse.model.AccessRule
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
file {
whenMerged {
def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
jre.accessRules.add(new AccessRule('0', 'javafx/**'))
jre.accessRules.add(new AccessRule('0', 'com/sun/javafx/**'))
}
}
}
} That way the |
Any update on this issue? I'm still running into @fwcd 's problem: it's very annoying to manually add access rules to the |
So I tried @tomsontom's solution of automatically relaxing the access rules when javafx is detected in the JDK, by copying a bunch of e(fx)clipse classes to JDT.LS. So, what next? Anything else I'd need to do to ensure JavaFX support is acceptable? (I have zero interest in Java FX myself so please enlighten me). |
Well the question is could efxclipse restructure its codebase and deliver an extension one can optionally install into jdt.ls |
Anyone willing to test my changes can manually install this vsix file in vscode: https://dl.bintray.com/fbricon/vscode-extensions/vscode-java/redhat.java-0.66.999.vsix @tomsontom if you can provide an eclipse plugin containing just those files: eclipse-jdtls/eclipse.jdt.ls#1536, then I can remove them from jdt.ls and use it directly. I don't think it's worth having another 3rd party vscode extension just for this basic JavaFX support. |
@fbricon your custom |
@fbricon I guess the problem is that efxclipse dropped from the release train hence adopting would not be so simple for you and given the JDK-8 will be used less and less I guess it is not worth the effort |
Since RedHat is pushing out new updates without adding JavaFX support, I made a quick extension for Java 8 users that automatically adds the https://marketplace.visualstudio.com/items?itemName=shrey150.javafx-support |
Fixed with eclipse-jdtls/eclipse.jdt.ls#1536. Will be released tomorrow. |
Thank you for fixing this! |
I also had this issue for the The gradle fix described by @fwcd worked. I made an example here: |
A lot of warnings about restricted API
Environment
Steps To Reproduce
Current Result
All code has following hints:
Expected Result
No hints provided, or some configuration option needed to override restricted libraries.
The text was updated successfully, but these errors were encountered: