InternalAPIsUnavailableInJava9
Anebuzelsky (Talk | contribs) m (→com.sun.* packages) |
Mentlicher (Talk | contribs) (→com.sun.* packages) |
||
(36 intermediate revisions not shown) | |||
Line 9: | Line 9: | ||
APIs under sun.* will be Java private one and will not be accessible from within NetBeans sources. Here is the list of NetBeans modules and what sun.* packages were found. | APIs under sun.* will be Java private one and will not be accessible from within NetBeans sources. Here is the list of NetBeans modules and what sun.* packages were found. | ||
{|- border="1" | {|- border="1" | ||
- | ! Owner | + | ! Owner (@netbeans.org) |
- | ! Resolved | + | ! Resolved or Comment |
! NetBeans module | ! NetBeans module | ||
! Internal Java API being used | ! Internal Java API being used | ||
|- | |- | ||
- | | mromashova | + | | mromashova |
| | | | ||
| dlight.remote | | dlight.remote | ||
| sun.awt.shell.ShellFolder, sun.swing.FilePane, un.swing.WindowsPlacesBar | | sun.awt.shell.ShellFolder, sun.swing.FilePane, un.swing.WindowsPlacesBar | ||
|- | |- | ||
- | | phejl | + | | phejl |
- | | | + | | 531fa1e769e4 & bbee05e260e5 |
|glassfish.common | |glassfish.common | ||
|sun.misc.BASE64Encoder, sun.net.NetProperties | |sun.misc.BASE64Encoder, sun.net.NetProperties | ||
|- | |- | ||
- | | | + | | phejl |
+ | | 3ffa0f3e9bc1 | ||
+ | | web.jspparser | ||
+ | | sun.misc.SharedSecrets, sun.misc.ClassLoaderUtil | ||
+ | |- | ||
+ | | thurka | ||
| | | | ||
|jconsole | |jconsole | ||
|sun.jvmstat.monitor.*, sun.management.ConnectorAddressLink, sun.tools.jconsole.JConsole | |sun.jvmstat.monitor.*, sun.management.ConnectorAddressLink, sun.tools.jconsole.JConsole | ||
|- | |- | ||
- | + | | thurka | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | | thurka | + | |
| | | | ||
| lib.profiler | | lib.profiler | ||
|sun.jvmstat.monitor.* | |sun.jvmstat.monitor.* | ||
|- | |- | ||
- | + | | thurka | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | | thurka | + | |
| | | | ||
|profiler.heapwalker | |profiler.heapwalker | ||
|sun.misc.VM | |sun.misc.VM | ||
|- | |- | ||
- | | thurka | + | | thurka |
| | | | ||
|profiler.snaptracer | |profiler.snaptracer | ||
|sun.swing.plaf.synth.SynthIcon | |sun.swing.plaf.synth.SynthIcon | ||
|- | |- | ||
- | | | + | | thurka |
| | | | ||
- | | | + | |lib.profiler.charts |
- | |sun. | + | |sun.swing.SwingUtilities2 |
|- | |- | ||
- | | | + | | thurka |
+ | | false positive | ||
+ | |profiler.oql | ||
+ | | sun.misc.Ref | ||
+ | |- | ||
+ | | thurka | ||
| | | | ||
- | | | + | |sampler |
- | |sun. | + | | sun.management.ThreadInfoCompositeData |
|- | |- | ||
- | | | + | | thurka |
| | | | ||
+ | | traceio | ||
+ | | sun.misc.IoTrace | ||
+ | |- | ||
+ | | mentlicher | ||
+ | | Removed usage of sun.reflect.DelegatingClassLoader and sun.font.* | ||
+ | sun.awt.X11.* is accessed by reflection only. | ||
|debugger.jpda | |debugger.jpda | ||
| sun.reflect.DelegatingClassLoader, sun.font.AttributeMap, sun.reflect.ReflectionFactory, sun.awt.X11.XAwtState, sun.awt.X11.XBaseWindow, sun.awt.X11.XToolkit, sun.awt.X11.XAtom | | sun.reflect.DelegatingClassLoader, sun.font.AttributeMap, sun.reflect.ReflectionFactory, sun.awt.X11.XAwtState, sun.awt.X11.XBaseWindow, sun.awt.X11.XToolkit, sun.awt.X11.XAtom | ||
|- | |- | ||
- | | mentlicher | + | | mentlicher |
- | | | + | | Used as a String only, no action required. |
|debugger.jpda.visual | |debugger.jpda.visual | ||
| sun.misc.Launcher$AppClassLoader | | sun.misc.Launcher$AppClassLoader | ||
|- | |- | ||
- | | | + | | tstupka |
+ | | 64a2aa2f744c | ||
+ | |kenai | ||
+ | |sun.misc.BASE64Encoder | ||
+ | |- | ||
+ | | tmysik | ||
+ | | b98e9b6e607c | ||
+ | |php.dbgp | ||
+ | |sun.misc.BASE64Encoder | ||
+ | |- | ||
+ | | mentlicher (ovrabec) | ||
+ | | https://bugs.openjdk.java.net/browse/JDK-8081722 | ||
+ | |o.n.swing.dirchooser | ||
+ | |sun.awt.shell.ShellFolder | ||
+ | |- | ||
+ | | mentlicher (ovrabec) | ||
+ | | https://bugs.openjdk.java.net/browse/JDK-4973846 | ||
+ | |o.n.swing.dirchooser | ||
+ | | sun.swing.WindowsPlacesBar | ||
+ | |- | ||
+ | | mentlicher (ovrabec) | ||
| | | | ||
- | | | + | | openide.util |
| sun.awt.AppContext | | sun.awt.AppContext | ||
+ | |- | ||
+ | | mentlicher (jpeska) | ||
+ | | Used as a String only, no action required. | ||
+ | | openide.explorer | ||
+ | | sun.beans.editors.EnumEditor | ||
|- | |- | ||
- | | | + | | mentlicher (jhavlin) |
- | | | + | | Tests only |
- | | | + | |openide.filesystems |
- | |sun. | + | |sun.security.tools.KeyTool, sun.security.tools.JarSigner |
+ | |- | ||
+ | | lfischmeistr | ||
+ | | DefaultProxySelector - OK, NetProperties - core-main/635cc7828e1e | ||
+ | |core.network | ||
+ | |sun.net.spi.DefaultProxySelector, sun.net.NetProperties | ||
|- | |- | ||
- | | lfischmeistr | + | | lfischmeistr |
| | | | ||
|o.n.bootstrap | |o.n.bootstrap | ||
| sun.awt.AppContext | | sun.awt.AppContext | ||
|- | |- | ||
- | | | + | | mentlicher (saubrecht) |
- | | | + | | Need https://bugs.openjdk.java.net/browse/JDK-6528430 and https://bugs.openjdk.java.net/browse/JDK-7106505 |
- | + | Removed usage of sun.swing.plaf.synth.SynthIcon | |
- | | sun. | + | |core.windows |
+ | |sun.awt.X11.XToolkit, sun.awt.X11.XWM, sun.swing.plaf.synth.SynthIcon | ||
|- | |- | ||
- | | saubrecht | + | | mentlicher (saubrecht) |
- | | | + | | 8a9c81481e91 |
|o.n.swing.plaf | |o.n.swing.plaf | ||
|sun.swing.plaf.synth.SynthUI | |sun.swing.plaf.synth.SynthUI | ||
- | |- | + | |- |
- | | | + | | mmetelka |
| | | | ||
- | | | + | |editor |
- | | sun. | + | | sun.awt.AppContext |
|- | |- | ||
- | | mmetelka | + | | mmetelka |
| | | | ||
|openide.text | |openide.text | ||
| sun.awt.im.InputContext, sun.awt.im.InputMethodContext | | sun.awt.im.InputContext, sun.awt.im.InputMethodContext | ||
|- | |- | ||
- | | | + | | mkristofic |
- | | | + | | https://bugs.openjdk.java.net/browse/JDK-8081411 |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
| spi.editor.hints | | spi.editor.hints | ||
|sun.swing.plaf.synth.SynthIcon | |sun.swing.plaf.synth.SynthIcon | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
|} | |} | ||
Line 159: | Line 161: | ||
Following table lists NetBeans modules which utilizes com.sun.* internal APIs which will be internal in Java 9. com.sun.source usage and com.sun.jdi usage were removed from this list. | Following table lists NetBeans modules which utilizes com.sun.* internal APIs which will be internal in Java 9. com.sun.source usage and com.sun.jdi usage were removed from this list. | ||
{|- border="1" | {|- border="1" | ||
- | ! Owner | + | ! Owner (@netbeans.org) |
! Resolved/Comment | ! Resolved/Comment | ||
! NetBeans module | ! NetBeans module | ||
! Internal Java API being used | ! Internal Java API being used | ||
|- | |- | ||
- | | | + | | petrk |
| | | | ||
- | | | + | | cnd.modelimpl |
- | |com.sun. | + | | com.sun.org.apache.xerces.*, com.sun.org.apache.xml.* |
|- | |- | ||
- | | | + | | phejl |
- | | | + | | These are not JDK classes. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
|web.el | |web.el | ||
|com.sun.el.parser.* | |com.sun.el.parser.* | ||
|- | |- | ||
- | | phejl | + | | phejl |
- | | | + | | These are not JDK classes. |
|web.jsf.editor | |web.jsf.editor | ||
|com.sun.faces.* | |com.sun.faces.* | ||
|- | |- | ||
- | | | + | | thurka |
| | | | ||
- | | | + | |jconsole |
- | |com.sun. | + | |com.sun.jmx.* |
|- | |- | ||
- | | | + | | mentlicher |
| | | | ||
- | | | + | |debugger.jpda.visual |
- | | com.sun. | + | |com.sun.media.jfxmedia.* |
|- | |- | ||
- | | mentlicher | + | | mentlicher |
| | | | ||
|debugger.jpda.visual | |debugger.jpda.visual | ||
- | |com.sun. | + | |com.sun.javafx.runtime.* |
|- | |- | ||
- | | | + | | mentlicher |
| | | | ||
- | | | + | | debugger.jpda.visual |
- | |com.sun. | + | | com.sun.javafx.tk.* |
|- | |- | ||
- | | | + | | jstola |
- | | | + | | These are not JDK classes. |
- | | | + | |websvc.* |
- | |com.sun. | + | |com.sun.tools.ws.*, com.sun.xml.ws.*, com.sun.xml.rpc.* |
|- | |- | ||
- | | jstola | + | | jstola |
| | | | ||
|core.browser.webview | |core.browser.webview | ||
|com.sun.javafx.scene.web.Debugger | |com.sun.javafx.scene.web.Debugger | ||
|- | |- | ||
- | | mentlicher | + | | mentlicher (mkozeny) |
- | | | + | | These are not JDK classes. |
- | | | + | |apisupport.feedreader |
- | | com.sun. | + | |com.sun.syndication.* |
|- | |- | ||
- | | saubrecht | + | | mentlicher (saubrecht) |
- | | | + | | should be OK |
|o.n.swing.plaf | |o.n.swing.plaf | ||
|com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel | |com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel | ||
|- | |- | ||
- | | lfischmeistr | + | | lfischmeistr |
- | | | + | | should be OK |
|o.n.bootstrap | |o.n.bootstrap | ||
| com.sun.jnlp.JNLPClassLoader | | com.sun.jnlp.JNLPClassLoader | ||
|- | |- | ||
- | | lfischmeistr | + | | lfischmeistr |
- | | | + | | should be OK |
|core.startup | |core.startup | ||
| com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel | | com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel | ||
+ | |- | ||
+ | | sdedic | ||
+ | | | ||
+ | |java.source | ||
+ | | com.sun.tools.javac.* - Listed for completness, nbjavac contains this. (only this package exported, subpackages are not) | ||
+ | |- | ||
+ | | rsvitanic | ||
+ | | old ME 3.x support - on UC for old releases only | ||
+ | | deployment.deviceanywhere | ||
+ | |com.sun.xml.stream.ZephyrParserFactory | ||
|- | |- | ||
+ | | ? | ||
| | | | ||
+ | | form | ||
+ | | com.sun.java.swing.plaf.windows.XPStyle | ||
+ | |- | ||
+ | | ? | ||
| | | | ||
- | | | + | |javacard.* |
- | | com.sun. | + | |com.sun.javacard.* |
|- | |- | ||
- | | | + | | N/A? |
| | | | ||
- | | | + | |identity.profile.api |
- | | com.sun. | + | | com.sun.identity.* |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
|} | |} | ||
==Reflection== | ==Reflection== | ||
It should be be possible to use reflection to call Java internal APIs even after module boundaries will be in place. It will be likely necessary to call '''setAccessible(true)''' for elements which needs to be called via reflection. At this moment it is not 100% confirmed it will work this way or setAccessible(true) will be needed. | It should be be possible to use reflection to call Java internal APIs even after module boundaries will be in place. It will be likely necessary to call '''setAccessible(true)''' for elements which needs to be called via reflection. At this moment it is not 100% confirmed it will work this way or setAccessible(true) will be needed. |
Current revision as of 09:51, 30 October 2015
Contents |
Internal JDK APIs Unavailable In Java 9
With Java 9 coming we have to prepare for several big changes which will affect NetBeans and might break the code. One such change is that bunch of internal APIs from JDK 8 and older will become really JDK internal and will not be accessible from NetBeans. Internal APIs will not be accessible when JDK 9 module boundaries will be in place. We have to therefore replace these APIs with new one. This document serves for tracking NetBeans packages which are affected, list some already published replacement/workarounds. We will use this doc to make sure NetBeans version supposed to be running on Java 9 will be ready on time re internal API usage.
jdeps tool
We used jdeps tool to search for what Java internal APIs we are using. It lists also some examples how to replace obsolete internal APIs with new public ones. It is recommended that every NetBeans module developer runs jdeps on his modules and does not depend solely on this table.
sun.* packages
APIs under sun.* will be Java private one and will not be accessible from within NetBeans sources. Here is the list of NetBeans modules and what sun.* packages were found.
Owner (@netbeans.org) | Resolved or Comment | NetBeans module | Internal Java API being used |
---|---|---|---|
mromashova | dlight.remote | sun.awt.shell.ShellFolder, sun.swing.FilePane, un.swing.WindowsPlacesBar | |
phejl | 531fa1e769e4 & bbee05e260e5 | glassfish.common | sun.misc.BASE64Encoder, sun.net.NetProperties |
phejl | 3ffa0f3e9bc1 | web.jspparser | sun.misc.SharedSecrets, sun.misc.ClassLoaderUtil |
thurka | jconsole | sun.jvmstat.monitor.*, sun.management.ConnectorAddressLink, sun.tools.jconsole.JConsole | |
thurka | lib.profiler | sun.jvmstat.monitor.* | |
thurka | profiler.heapwalker | sun.misc.VM | |
thurka | profiler.snaptracer | sun.swing.plaf.synth.SynthIcon | |
thurka | lib.profiler.charts | sun.swing.SwingUtilities2 | |
thurka | false positive | profiler.oql | sun.misc.Ref |
thurka | sampler | sun.management.ThreadInfoCompositeData | |
thurka | traceio | sun.misc.IoTrace | |
mentlicher | Removed usage of sun.reflect.DelegatingClassLoader and sun.font.*
sun.awt.X11.* is accessed by reflection only. | debugger.jpda | sun.reflect.DelegatingClassLoader, sun.font.AttributeMap, sun.reflect.ReflectionFactory, sun.awt.X11.XAwtState, sun.awt.X11.XBaseWindow, sun.awt.X11.XToolkit, sun.awt.X11.XAtom |
mentlicher | Used as a String only, no action required. | debugger.jpda.visual | sun.misc.Launcher$AppClassLoader |
tstupka | 64a2aa2f744c | kenai | sun.misc.BASE64Encoder |
tmysik | b98e9b6e607c | php.dbgp | sun.misc.BASE64Encoder |
mentlicher (ovrabec) | https://bugs.openjdk.java.net/browse/JDK-8081722 | o.n.swing.dirchooser | sun.awt.shell.ShellFolder |
mentlicher (ovrabec) | https://bugs.openjdk.java.net/browse/JDK-4973846 | o.n.swing.dirchooser | sun.swing.WindowsPlacesBar |
mentlicher (ovrabec) | openide.util | sun.awt.AppContext | |
mentlicher (jpeska) | Used as a String only, no action required. | openide.explorer | sun.beans.editors.EnumEditor |
mentlicher (jhavlin) | Tests only | openide.filesystems | sun.security.tools.KeyTool, sun.security.tools.JarSigner |
lfischmeistr | DefaultProxySelector - OK, NetProperties - core-main/635cc7828e1e | core.network | sun.net.spi.DefaultProxySelector, sun.net.NetProperties |
lfischmeistr | o.n.bootstrap | sun.awt.AppContext | |
mentlicher (saubrecht) | Need https://bugs.openjdk.java.net/browse/JDK-6528430 and https://bugs.openjdk.java.net/browse/JDK-7106505
Removed usage of sun.swing.plaf.synth.SynthIcon | core.windows | sun.awt.X11.XToolkit, sun.awt.X11.XWM, sun.swing.plaf.synth.SynthIcon |
mentlicher (saubrecht) | 8a9c81481e91 | o.n.swing.plaf | sun.swing.plaf.synth.SynthUI |
mmetelka | editor | sun.awt.AppContext | |
mmetelka | openide.text | sun.awt.im.InputContext, sun.awt.im.InputMethodContext | |
mkristofic | https://bugs.openjdk.java.net/browse/JDK-8081411 | spi.editor.hints | sun.swing.plaf.synth.SynthIcon |
com.sun.* packages
Some packages from com.sun will become public API in Java 9. These are:
- com.sun.source.*
- com.sun.jdi
- com.sun.tools.javac.* is exported, subpackages will be internal
As the source of intermediate info about what packages will be exported from Java 9 you can refer to modules.xml for Java 9 modules being API. This info/mechanism can change (modules.xml can be replaced by something different) once Java 9 implementation proceeds further to Feature complete and release. Following table lists NetBeans modules which utilizes com.sun.* internal APIs which will be internal in Java 9. com.sun.source usage and com.sun.jdi usage were removed from this list.
Owner (@netbeans.org) | Resolved/Comment | NetBeans module | Internal Java API being used |
---|---|---|---|
petrk | cnd.modelimpl | com.sun.org.apache.xerces.*, com.sun.org.apache.xml.* | |
phejl | These are not JDK classes. | web.el | com.sun.el.parser.* |
phejl | These are not JDK classes. | web.jsf.editor | com.sun.faces.* |
thurka | jconsole | com.sun.jmx.* | |
mentlicher | debugger.jpda.visual | com.sun.media.jfxmedia.* | |
mentlicher | debugger.jpda.visual | com.sun.javafx.runtime.* | |
mentlicher | debugger.jpda.visual | com.sun.javafx.tk.* | |
jstola | These are not JDK classes. | websvc.* | com.sun.tools.ws.*, com.sun.xml.ws.*, com.sun.xml.rpc.* |
jstola | core.browser.webview | com.sun.javafx.scene.web.Debugger | |
mentlicher (mkozeny) | These are not JDK classes. | apisupport.feedreader | com.sun.syndication.* |
mentlicher (saubrecht) | should be OK | o.n.swing.plaf | com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel |
lfischmeistr | should be OK | o.n.bootstrap | com.sun.jnlp.JNLPClassLoader |
lfischmeistr | should be OK | core.startup | com.sun.java.swing.plaf.gtk.GTKLookAndFeel, com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel, com.sun.java.swing.plaf.windows.WindowsLookAndFeel |
sdedic | java.source | com.sun.tools.javac.* - Listed for completness, nbjavac contains this. (only this package exported, subpackages are not) | |
rsvitanic | old ME 3.x support - on UC for old releases only | deployment.deviceanywhere | com.sun.xml.stream.ZephyrParserFactory |
? | form | com.sun.java.swing.plaf.windows.XPStyle | |
? | javacard.* | com.sun.javacard.* | |
N/A? | identity.profile.api | com.sun.identity.* |
Reflection
It should be be possible to use reflection to call Java internal APIs even after module boundaries will be in place. It will be likely necessary to call setAccessible(true) for elements which needs to be called via reflection. At this moment it is not 100% confirmed it will work this way or setAccessible(true) will be needed.