Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static com.oracle.svm.core.posix.headers.darwin.DarwinTime.NoTransitions.mach_timebase_info;

import java.util.Objects;
import java.util.function.BooleanSupplier;

import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Platform;
Expand Down Expand Up @@ -122,7 +123,7 @@ long nanoTime() {
* Native functions don't exist on Darwin because this whole class is used, and should exist, only
* on Linux. See <code>java.util.prefs.Preferences#factory</code>.
*/
@TargetClass(className = "java.util.prefs.FileSystemPreferences")
@TargetClass(className = "java.util.prefs.FileSystemPreferences", onlyWith = IsJavaUtilPrefsPresent.class)
final class Target_java_util_prefs_FileSystemPreferences {
@Delete
private static native int[] lockFile0(String fileName, int permission, boolean shared);
Expand All @@ -134,6 +135,14 @@ final class Target_java_util_prefs_FileSystemPreferences {
private static native int chmod(String fileName, int permission);
}

final class IsJavaUtilPrefsPresent implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
var prefsMod = ModuleLayer.boot().findModule("java.prefs");
return prefsMod.isPresent();
}
}

/**
* Not used in native image and has linker errors with XCode 13. Can be removed in the future when
* XCode 14 becomes omnipresent.
Expand Down