diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/JNIRuntimeAccess.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/JNIRuntimeAccess.java deleted file mode 100644 index 5b56ec916b8d..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/JNIRuntimeAccess.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.jni; - -import java.lang.reflect.Executable; -import java.lang.reflect.Field; - -import org.graalvm.nativeimage.ImageSingletons; -import org.graalvm.nativeimage.Platform; -import org.graalvm.nativeimage.Platforms; -import org.graalvm.nativeimage.dynamicaccess.AccessCondition; -import org.graalvm.nativeimage.hosted.RuntimeJNIAccess; -import org.graalvm.nativeimage.impl.RuntimeJNIAccessSupport; - -/** - * Support for registering classes, methods and fields before and during the analysis so they are - * accessible via JNI at image runtime. - */ -@Platforms(Platform.HOSTED_ONLY.class) -public final class JNIRuntimeAccess { - private JNIRuntimeAccess() { - } - - public static void register(Class... classes) { - RuntimeJNIAccess.register(classes); - } - - public static void register(Executable... methods) { - RuntimeJNIAccess.register(methods); - } - - public static void register(Field... fields) { - RuntimeJNIAccess.register(fields); - } - - public static void register(boolean finalIsWritable, Field... fields) { - ImageSingletons.lookup(RuntimeJNIAccessSupport.class).register(AccessCondition.unconditional(), finalIsWritable, false, fields); - } -} diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxClientFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxClientFeature.java index 585a9ff10ea2..ffb96409d6ca 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxClientFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxClientFeature.java @@ -25,13 +25,13 @@ */ package com.oracle.svm.hosted.jdk; +import org.graalvm.nativeimage.hosted.RuntimeJNIAccess; import org.graalvm.nativeimage.hosted.RuntimeReflection; import com.oracle.svm.core.VMInspectionOptions; import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.core.jdk.JNIRegistrationUtil; -import com.oracle.svm.core.jni.JNIRuntimeAccess; import com.oracle.svm.core.util.VMError; import com.oracle.svm.util.ReflectionUtil; @@ -53,8 +53,8 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { } private static void configureJNI() { - JNIRuntimeAccess.register(Boolean.class); - JNIRuntimeAccess.register(ReflectionUtil.lookupMethod(Boolean.class, "getBoolean", String.class)); + RuntimeJNIAccess.register(Boolean.class); + RuntimeJNIAccess.register(ReflectionUtil.lookupMethod(Boolean.class, "getBoolean", String.class)); } /** diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxCommonFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxCommonFeature.java index b82c01cec3b7..9ce2e3505e37 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxCommonFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JmxCommonFeature.java @@ -30,6 +30,7 @@ import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.dynamicaccess.AccessCondition; +import org.graalvm.nativeimage.hosted.RuntimeJNIAccess; import org.graalvm.nativeimage.hosted.RuntimeReflection; import org.graalvm.nativeimage.hosted.RuntimeSerialization; @@ -37,7 +38,6 @@ import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.feature.InternalFeature; import com.oracle.svm.hosted.reflect.proxy.ProxyRegistry; -import com.oracle.svm.core.jni.JNIRuntimeAccess; import com.oracle.svm.util.ReflectionUtil; @AutomaticallyRegisteredFeature @@ -183,8 +183,8 @@ private static void configureProxy(BeforeAnalysisAccess access) { } private static void configureJNI() { - JNIRuntimeAccess.register(Arrays.class); - JNIRuntimeAccess.register(ReflectionUtil.lookupMethod(Arrays.class, "asList", Object[].class)); + RuntimeJNIAccess.register(Arrays.class); + RuntimeJNIAccess.register(ReflectionUtil.lookupMethod(Arrays.class, "asList", Object[].class)); } /** diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jni/JNICallWrapperFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jni/JNICallWrapperFeature.java index d5c928b40fa8..49bdc2ce9709 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jni/JNICallWrapperFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jni/JNICallWrapperFeature.java @@ -28,8 +28,8 @@ import java.util.List; import org.graalvm.nativeimage.hosted.Feature; +import org.graalvm.nativeimage.hosted.RuntimeJNIAccess; -import com.oracle.svm.core.jni.JNIRuntimeAccess; import com.oracle.svm.core.jni.access.JNIAccessibleMethod; import com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl; @@ -39,7 +39,7 @@ *

* Java-to-native call wrappers are created by {@link JNINativeCallWrapperSubstitutionProcessor}. It * creates a {@link JNINativeCallWrapperMethod} for each Java method that is declared with the - * {@code native} keyword and that was registered via {@link JNIRuntimeAccess} to be accessible via + * {@code native} keyword and that was registered via {@link RuntimeJNIAccess} to be accessible via * JNI at runtime. The method provides a graph that performs the native code invocation. This graph * is visible to the analysis. *