forked from TuxCoding/FastLogin
Use reflection for test to fix compiling core to older Java versions
This commit is contained in:
@ -46,6 +46,7 @@ You can download them from here: https://ci.codemc.org/job/Games647/job/FastLogi
|
|||||||
|
|
||||||
fastlogin.bukkit.command.premium
|
fastlogin.bukkit.command.premium
|
||||||
fastlogin.bukkit.command.cracked
|
fastlogin.bukkit.command.cracked
|
||||||
|
|
||||||
fastlogin.command.premium.other
|
fastlogin.command.premium.other
|
||||||
fastlogin.command.cracked.other
|
fastlogin.command.cracked.other
|
||||||
|
|
||||||
|
@ -40,10 +40,8 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<!-- Still force Java 8 for the remaining project -->
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.release>8</maven.compiler.release>
|
||||||
<!-- Make Java 21 test method available in this multi-release project: Caution of breaking older systems -->
|
|
||||||
<maven.compiler.release>21</maven.compiler.release>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<name>FastLoginCore</name>
|
<name>FastLoginCore</name>
|
||||||
|
@ -33,6 +33,7 @@ import org.junit.jupiter.api.condition.JRE;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@ -63,8 +64,14 @@ class AsyncSchedulerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void setVirtual(AtomicBoolean virtual) {
|
private static void setVirtual(AtomicBoolean virtual) {
|
||||||
if (Thread.currentThread().isVirtual()) {
|
boolean isVirtual;
|
||||||
virtual.set(true);
|
try {
|
||||||
|
isVirtual = (boolean) Thread.class.getDeclaredMethod("isVirtual").invoke(Thread.currentThread());
|
||||||
|
if (isVirtual) {
|
||||||
|
virtual.set(true);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user