Skip to content
Merged
1 change: 1 addition & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions sdk/src/org.graalvm.nativeimage/snapshot.sigtest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<org.graalvm.nativeimage.RuntimeOptions$OptionClass>)
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -74,10 +74,14 @@ public static <T> 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
Expand All @@ -86,17 +90,27 @@ 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<OptionClass> classes) {
return ImageSingletons.lookup(RuntimeOptionsSupport.class).getOptions(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));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -50,5 +50,6 @@ public interface RuntimeOptionsSupport {

<T> T get(String optionName);

@SuppressWarnings("deprecation")
OptionDescriptors getOptions(EnumSet<OptionClass> classes);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public <T> T get(String optionName) {
return optionKey.getValue(RuntimeOptionValues.singleton());
}

@SuppressWarnings({"unchecked", "deprecation"})
@Override
public OptionDescriptors getOptions(EnumSet<OptionClass> classes) {
Iterable<OptionDescriptor> descriptors = RuntimeOptionParser.singleton().getDescriptors();
Expand All @@ -134,6 +135,7 @@ public OptionDescriptors getOptions(EnumSet<OptionClass> classes) {
return OptionDescriptors.create(graalvmDescriptors);
}

@SuppressWarnings("deprecation")
private static OptionClass getOptionClass(OptionDescriptor descriptor) {
if (descriptor.getOptionKey() instanceof RuntimeOptionKey) {
return OptionClass.VM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static String[] parse(String[] args) {
}
MapCursor<String, String> 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. */
Expand Down