Update JavaVersionConstraint (#1683)
This commit is contained in:
@@ -120,8 +120,16 @@ public enum JavaVersionConstraint {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean appliesToVersionImpl(VersionNumber gameVersionNumber, @Nullable Version version,
|
protected boolean appliesToVersionImpl(VersionNumber gameVersionNumber, @Nullable Version version,
|
||||||
@Nullable JavaVersion javaVersion) {
|
@Nullable JavaVersion javaVersion) {
|
||||||
return javaVersion != null && !javaVersion.getArchitecture().isX86()
|
if (javaVersion == null || javaVersion.getArchitecture() != Architecture.ARM64)
|
||||||
&& (OperatingSystem.CURRENT_OS != OperatingSystem.OSX || gameVersionNumber.compareTo(VersionNumber.asVersion("1.19")) < 0);
|
return false;
|
||||||
|
|
||||||
|
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS)
|
||||||
|
return gameVersionNumber.compareTo(VersionNumber.asVersion("1.6")) < 0;
|
||||||
|
|
||||||
|
if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX)
|
||||||
|
return gameVersionNumber.compareTo(VersionNumber.asVersion("1.19")) < 0;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,27 +6,19 @@ public final class Platform {
|
|||||||
public static final Platform UNKNOWN = new Platform(OperatingSystem.UNKNOWN, Architecture.UNKNOWN);
|
public static final Platform UNKNOWN = new Platform(OperatingSystem.UNKNOWN, Architecture.UNKNOWN);
|
||||||
|
|
||||||
public static final Platform WINDOWS_X86_64 = new Platform(OperatingSystem.WINDOWS, Architecture.X86_64);
|
public static final Platform WINDOWS_X86_64 = new Platform(OperatingSystem.WINDOWS, Architecture.X86_64);
|
||||||
public static final Platform OSX_X86_64 = new Platform(OperatingSystem.OSX, Architecture.X86_64);
|
public static final Platform WINDOWS_ARM64 = new Platform(OperatingSystem.WINDOWS, Architecture.ARM64);
|
||||||
public static final Platform LINUX_X86_64 = new Platform(OperatingSystem.LINUX, Architecture.X86_64);
|
|
||||||
|
|
||||||
|
public static final Platform LINUX_X86_64 = new Platform(OperatingSystem.LINUX, Architecture.X86_64);
|
||||||
|
public static final Platform LINUX_ARM64 = new Platform(OperatingSystem.LINUX, Architecture.ARM64);
|
||||||
|
|
||||||
|
public static final Platform OSX_X86_64 = new Platform(OperatingSystem.OSX, Architecture.X86_64);
|
||||||
public static final Platform OSX_ARM64 = new Platform(OperatingSystem.OSX, Architecture.ARM64);
|
public static final Platform OSX_ARM64 = new Platform(OperatingSystem.OSX, Architecture.ARM64);
|
||||||
|
|
||||||
public static final Platform CURRENT_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.CURRENT_ARCH);
|
public static final Platform CURRENT_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.CURRENT_ARCH);
|
||||||
public static final Platform SYSTEM_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.SYSTEM_ARCH);
|
public static final Platform SYSTEM_PLATFORM = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.SYSTEM_ARCH);
|
||||||
|
|
||||||
public static boolean isCompatibleWithX86Java() {
|
public static boolean isCompatibleWithX86Java() {
|
||||||
if (Architecture.CURRENT_ARCH.isX86())
|
return Architecture.SYSTEM_ARCH.isX86() || SYSTEM_PLATFORM == OSX_ARM64 || SYSTEM_PLATFORM == WINDOWS_ARM64;
|
||||||
return true;
|
|
||||||
|
|
||||||
// Rosetta 2 is available for Mac computers with Apple silicon
|
|
||||||
if (CURRENT_PLATFORM == OSX_ARM64)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Windows on ARM introduced translation support for x86-64 after 10.0.21277.
|
|
||||||
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS && OperatingSystem.SYSTEM_BUILD_NUMBER >= 21277)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final OperatingSystem os;
|
private final OperatingSystem os;
|
||||||
@@ -55,8 +47,15 @@ public final class Platform {
|
|||||||
case LINUX:
|
case LINUX:
|
||||||
return LINUX_X86_64;
|
return LINUX_X86_64;
|
||||||
}
|
}
|
||||||
} else if (arch == Architecture.ARM64 && OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
|
} else if (arch == Architecture.ARM64) {
|
||||||
return OSX_ARM64;
|
switch (os) {
|
||||||
|
case WINDOWS:
|
||||||
|
return WINDOWS_ARM64;
|
||||||
|
case OSX:
|
||||||
|
return OSX_ARM64;
|
||||||
|
case LINUX:
|
||||||
|
return LINUX_ARM64;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Platform(os, arch);
|
return new Platform(os, arch);
|
||||||
|
|||||||
Reference in New Issue
Block a user