Reputation: 6856
I am switching to Java 9 (for the HTTP/2 client, among other benefits), but do not plan on using Java 9 modularization.
I'm getting tons of compiler errors about inaccessible packages. Each one requires me to add an additional --add-exports modulename/packagename=ALL-UNNAMED
compiler flag.
Is there some compiler flag that I can specify, one time, to add all exports and not get any more compiler errors?
Here is example code showing the problem:
package com.prosc.fx;
import com.sun.javafx.stage.WindowHelper;
public class CompilerFlagTest {
public static void main(String[] args) {
WindowHelper.getWindowAccessor();
}
}
The error message is:
Error:(3, 22) java: package com.sun.javafx.stage is not visible (package com.sun.javafx.stage is declared in module javafx.graphics, which does not export it to the unnamed module)
Upvotes: 1
Views: 357
Reputation: 35457
The classes and packages you mention are in private packages, a new visibility level in the ladder. Meaning that you may not access them, because the whole modularisation is mandatory, not optional. Even when you don't use modularisation, you're using it.
So do yourself a favour and use the public API.
Upvotes: 5