Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-09-27 13:55:32 +0000
committerThomas Watson2016-10-03 14:07:17 +0000
commitb33172a065817c1db7ed62005d3fa9736e388e19 (patch)
treeabf18b5fc37321b687052735a2c2c6c3d01cbb0d /bundles
parent73b806450e52343d74b96914da7a12775d31a4f1 (diff)
downloadrt.equinox.framework-b33172a065817c1db7ed62005d3fa9736e388e19.tar.gz
rt.equinox.framework-b33172a065817c1db7ed62005d3fa9736e388e19.tar.xz
rt.equinox.framework-b33172a065817c1db7ed62005d3fa9736e388e19.zip
Bug 502204 - Reflection used for parallel capable class loaders will
fail on Java 9 Change-Id: I10ee55af8f1844f314f0a466eaf51c4ce7b99da8 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/EquinoxClassLoader.java18
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java13
2 files changed, 3 insertions, 28 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/EquinoxClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/EquinoxClassLoader.java
index 2f92bdbd4..51f5d710a 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/EquinoxClassLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/EquinoxClassLoader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,27 +11,13 @@
package org.eclipse.osgi.internal.loader;
-import java.lang.reflect.Method;
import org.eclipse.osgi.internal.debug.Debug;
import org.eclipse.osgi.internal.framework.EquinoxConfiguration;
import org.eclipse.osgi.internal.loader.classpath.ClasspathManager;
import org.eclipse.osgi.storage.BundleInfo.Generation;
public class EquinoxClassLoader extends ModuleClassLoader {
- private static final boolean EQUINOX_REGISTERED_AS_PARALLEL;
-
- static {
- boolean registeredAsParallel;
- try {
- Method parallelCapableMetod = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", (Class[]) null); //$NON-NLS-1$
- parallelCapableMetod.setAccessible(true);
- registeredAsParallel = ((Boolean) parallelCapableMetod.invoke(null, (Object[]) null)).booleanValue();
- } catch (Throwable e) {
- // must do everything to avoid failing in clinit
- registeredAsParallel = false;
- }
- EQUINOX_REGISTERED_AS_PARALLEL = registeredAsParallel;
- }
+ private static final boolean EQUINOX_REGISTERED_AS_PARALLEL = ClassLoader.registerAsParallelCapable();
private final EquinoxConfiguration configuration;
private final Debug debug;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
index 20a065bbe..85c0585cc 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
@@ -13,7 +13,6 @@ package org.eclipse.osgi.internal.loader;
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.*;
@@ -50,23 +49,13 @@ public abstract class ModuleClassLoader extends ClassLoader implements BundleRef
* A PermissionCollection for AllPermissions; shared across all ProtectionDomains when security is disabled
*/
protected static final PermissionCollection ALLPERMISSIONS;
- protected static final boolean REGISTERED_AS_PARALLEL;
+ protected static final boolean REGISTERED_AS_PARALLEL = ClassLoader.registerAsParallelCapable();
static {
AllPermission allPerm = new AllPermission();
ALLPERMISSIONS = allPerm.newPermissionCollection();
if (ALLPERMISSIONS != null)
ALLPERMISSIONS.add(allPerm);
- boolean registeredAsParallel;
- try {
- Method parallelCapableMetod = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", (Class[]) null); //$NON-NLS-1$
- parallelCapableMetod.setAccessible(true);
- registeredAsParallel = ((Boolean) parallelCapableMetod.invoke(null, (Object[]) null)).booleanValue();
- } catch (Throwable e) {
- // must do everything to avoid failing in clinit
- registeredAsParallel = false;
- }
- REGISTERED_AS_PARALLEL = registeredAsParallel;
}
/**

Back to the top