Mercurial > hg > release > icedtea-web-1.6
changeset 1271:a27404e97867
fixed build and runtime with jdk9
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Thu, 12 Nov 2015 15:48:22 +0100 |
parents | 6001830b0e1d |
children | 104317f48096 |
files | ChangeLog netx/net/sourceforge/jnlp/NetxPanel.java netx/sun/applet/AppletViewerPanelAccess.java |
diffstat | 3 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Oct 27 14:13:36 2015 +0100 +++ b/ChangeLog Thu Nov 12 15:48:22 2015 +0100 @@ -1,3 +1,11 @@ +2015-11-12 Jiri Vanek <jvanek@redhat.com> + + fixed build and runtime with jdk9 + * netx/net/sourceforge/jnlp/NetxPanel.java: (init) setting doInit to true + replaced by call to setDoInitIfExists + * netx/sun/applet/AppletViewerPanelAccess.java: added new function of + (setDoInitIfExists) which sets doInit if exists + 2015-10-27 Jiri Vanek <jvanek@redhat.com> itweb-settings, debugging panel made aware about legacy log and client apps log
--- a/netx/net/sourceforge/jnlp/NetxPanel.java Tue Oct 27 14:13:36 2015 +0100 +++ b/netx/net/sourceforge/jnlp/NetxPanel.java Thu Nov 12 15:48:22 2015 +0100 @@ -204,7 +204,7 @@ } public void init(PluginBridge bridge) throws LaunchException { - doInit = true; + setDoInitIfExists(true); dispatchAppletEvent(APPLET_LOADING, null); status = APPLET_LOAD;
--- a/netx/sun/applet/AppletViewerPanelAccess.java Tue Oct 27 14:13:36 2015 +0100 +++ b/netx/sun/applet/AppletViewerPanelAccess.java Thu Nov 12 15:48:22 2015 +0100 @@ -41,6 +41,7 @@ import java.util.Hashtable; import java.util.Map; import net.sourceforge.jnlp.NetxPanel; +import net.sourceforge.jnlp.util.logging.OutputController; public abstract class AppletViewerPanelAccess extends AppletViewerPanel { @@ -132,4 +133,36 @@ abstract protected void ourRunLoader(); + /** + * jdk9 removed doInit. + * http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/2b680924a73f This is way how + * to set it in older jdks and still compile on jdk9+ + * + * @param a value to set to doInit if it exists + */ + protected void setDoInitIfExists(boolean a) { + //doInit = a; + try { + Class c = this.getClass(); + Field fs = null; + while (c != null) { + if (AppletPanel.class.equals(c)) { + fs = c.getDeclaredField("doInit"); + break; + } + //known location is NetxPanel->AppeltViwerPannelAccess->AppletViwerPanel->AppletPanel + c = c.getSuperclass(); + } + if (fs == null) { + throw new NoSuchFieldException("AppletPanel not found."); + } + fs.setAccessible(true); + fs.set(this, a); + } catch (IllegalAccessException | IllegalArgumentException | NoSuchFieldException | SecurityException ex) { + OutputController.getLogger().log("Can't get/set doInit. Runing on JDK9 or higher?"); + OutputController.getLogger().log(ex); + } + + } + }