diff --git a/sdk/CHANGELOG.md b/sdk/CHANGELOG.md index 5a7504deb2f4..722557df282e 100644 --- a/sdk/CHANGELOG.md +++ b/sdk/CHANGELOG.md @@ -11,6 +11,7 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f * Added automatic copying of language resources for embedding Truffle languages in native image. Documentation available [here](https://www.graalvm.org/reference-manual/embed-languages/#build-native-executables-from-polyglot-applications). * (GR-41716) Added `HostAccess.Builder.allowMutableTargetMappings(HostAccess.MutableTargetMapping[])` to explicitly enable type coercion from guest objects to mutable Java host objects such as `java.util.Map` or `java.util.List`. * (GR-42876) Added [FileSystem#newFileSystem](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/io/FileSystem.html#newFileSystem-java.nio.file.FileSystem-) creating a polyglot FileSystem for given Java NIO FileSystem. +* (GR-43820) Deprecated `org.graalvm.nativeimage.RuntimeOptions#getOptions` methods and `org.graalvm.nativeimage.RuntimeOptions.OptionClass` enum. These elements were mistakenly made API and will be removed in a future version. If your codebase depends on any of these please let us know. ## Version 22.3.0 * (GR-39852) Native Image API: Added FieldValueTransformer API diff --git a/sdk/src/org.graalvm.nativeimage/snapshot.sigtest b/sdk/src/org.graalvm.nativeimage/snapshot.sigtest index dffd346fcb74..e612ff3293ec 100644 --- a/sdk/src/org.graalvm.nativeimage/snapshot.sigtest +++ b/sdk/src/org.graalvm.nativeimage/snapshot.sigtest @@ -9,6 +9,14 @@ meth public abstract void close() throws java.lang.Exception CLSS public abstract interface java.lang.Comparable<%0 extends java.lang.Object> meth public abstract int compareTo({java.lang.Comparable%0}) +CLSS public abstract interface !annotation java.lang.Deprecated + anno 0 java.lang.annotation.Documented() + anno 0 java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy value=RUNTIME) + anno 0 java.lang.annotation.Target(java.lang.annotation.ElementType[] value=[CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, MODULE, PARAMETER, TYPE]) +intf java.lang.annotation.Annotation +meth public abstract !hasdefault boolean forRemoval() +meth public abstract !hasdefault java.lang.String since() + CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>> cons protected init(java.lang.String,int) innr public final static EnumDesc @@ -434,12 +442,15 @@ CLSS public final org.graalvm.nativeimage.RuntimeOptions innr public final static !enum OptionClass meth public static <%0 extends java.lang.Object> {%%0} get(java.lang.String) meth public static org.graalvm.options.OptionDescriptors getOptions() + anno 0 java.lang.Deprecated(boolean forRemoval=true, java.lang.String since="23.0") meth public static org.graalvm.options.OptionDescriptors getOptions(java.util.EnumSet) + anno 0 java.lang.Deprecated(boolean forRemoval=true, java.lang.String since="23.0") meth public static void set(java.lang.String,java.lang.Object) supr java.lang.Object CLSS public final static !enum org.graalvm.nativeimage.RuntimeOptions$OptionClass outer org.graalvm.nativeimage.RuntimeOptions + anno 0 java.lang.Deprecated(boolean forRemoval=true, java.lang.String since="23.0") fld public final static org.graalvm.nativeimage.RuntimeOptions$OptionClass Compiler fld public final static org.graalvm.nativeimage.RuntimeOptions$OptionClass VM meth public static org.graalvm.nativeimage.RuntimeOptions$OptionClass valueOf(java.lang.String) diff --git a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/RuntimeOptions.java b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/RuntimeOptions.java index 796918f1f9c9..4b20f6926c70 100644 --- a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/RuntimeOptions.java +++ b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/RuntimeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -74,10 +74,14 @@ public static T get(String optionName) { } /** - * Classes of options that can be queried through {@link #getOptions(EnumSet)}. + * Classes of options that can be queried through {@code getOptions(EnumSet)}. + * + * @deprecated This class was mistakenly made API and will be removed in a future version. If + * your codebase depends on it, let us know by creating an issue on GitHub. * * @since 19.0 */ + @Deprecated(since = "23.0", forRemoval = true) public enum OptionClass { VM, Compiler @@ -86,8 +90,13 @@ public enum OptionClass { /** * Returns available run time options for the selected {@linkplain OptionClass option classes}. * + * @deprecated This method was mistakenly made an API method and will be removed in a future + * version. If your codebase depends on it, let us know by creating an issue on + * GitHub. + * * @since 19.0 */ + @Deprecated(since = "23.0", forRemoval = true) public static OptionDescriptors getOptions(EnumSet classes) { return ImageSingletons.lookup(RuntimeOptionsSupport.class).getOptions(classes); } @@ -95,8 +104,13 @@ public static OptionDescriptors getOptions(EnumSet classes) { /** * Returns all available run time options. * + * @deprecated This method was mistakenly made an API method and will be removed in a future + * version. If your codebase depends on it, let us know by creating an issue on + * GitHub. + * * @since 19.0 */ + @Deprecated(since = "23.0", forRemoval = true) public static OptionDescriptors getOptions() { return getOptions(EnumSet.allOf(OptionClass.class)); } diff --git a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/hosted/RuntimeSystemProperties.java b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/hosted/RuntimeSystemProperties.java index 04857a315e52..c646be2fcd6f 100644 --- a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/hosted/RuntimeSystemProperties.java +++ b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/hosted/RuntimeSystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -45,6 +45,12 @@ import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.impl.RuntimeSystemPropertiesSupport; +/** + * This class provides methods that can be called during native image generation to define system + * property setting for image runtime. + * + * @since 23.0 + */ public final class RuntimeSystemProperties { /** diff --git a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/RuntimeOptionsSupport.java b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/RuntimeOptionsSupport.java index 0ca16f8aa795..0a14bf955173 100644 --- a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/RuntimeOptionsSupport.java +++ b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/RuntimeOptionsSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -50,5 +50,6 @@ public interface RuntimeOptionsSupport { T get(String optionName); + @SuppressWarnings("deprecation") OptionDescriptors getOptions(EnumSet classes); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java index 7e25876a244c..6647f941dad9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SystemPropertiesSupport.java @@ -202,8 +202,12 @@ public void setProperties(Properties props) { */ @Override public void initializeProperty(String key, String value) { + initializeProperty(key, value, true); + } + + public void initializeProperty(String key, String value, boolean strict) { String prevValue = savedProperties.put(key, value); - if (prevValue != null && !prevValue.equals(value)) { + if (strict && prevValue != null && !prevValue.equals(value)) { VMError.shouldNotReachHere("System property " + key + " is initialized to " + value + " but was previously initialized to " + prevValue + "."); } properties.setProperty(key, value); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionValues.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionValues.java index ca058b6c7231..fd52c18cba7f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionValues.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionValues.java @@ -113,6 +113,7 @@ public T get(String optionName) { return optionKey.getValue(RuntimeOptionValues.singleton()); } + @SuppressWarnings({"unchecked", "deprecation"}) @Override public OptionDescriptors getOptions(EnumSet classes) { Iterable descriptors = RuntimeOptionParser.singleton().getDescriptors(); @@ -134,6 +135,7 @@ public OptionDescriptors getOptions(EnumSet classes) { return OptionDescriptors.create(graalvmDescriptors); } + @SuppressWarnings("deprecation") private static OptionClass getOptionClass(OptionDescriptor descriptor) { if (descriptor.getOptionKey() instanceof RuntimeOptionKey) { return OptionClass.VM; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/properties/RuntimePropertyParser.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/properties/RuntimePropertyParser.java index 4ed029d743fe..ab1ea72ca143 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/properties/RuntimePropertyParser.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/properties/RuntimePropertyParser.java @@ -56,7 +56,7 @@ public static String[] parse(String[] args) { } MapCursor cursor = properties.getEntries(); while (cursor.advance()) { - SystemPropertiesSupport.singleton().initializeProperty(cursor.getKey(), cursor.getValue()); + SystemPropertiesSupport.singleton().initializeProperty(cursor.getKey(), cursor.getValue(), false); } if (newIdx == args.length) { /* We can be allocation free and just return the original arguments. */