aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/elytrium/limboauth/config')
-rw-r--r--src/main/java/net/elytrium/limboauth/config/Config.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/net/elytrium/limboauth/config/Config.java b/src/main/java/net/elytrium/limboauth/config/Config.java
index ed5b007..1cb9803 100644
--- a/src/main/java/net/elytrium/limboauth/config/Config.java
+++ b/src/main/java/net/elytrium/limboauth/config/Config.java
@@ -208,7 +208,7 @@ public class Config {
}
}
- private void save(PrintWriter writer, Class<?> clazz, final Object instance, int indent) {
+ private void save(PrintWriter writer, Class<?> clazz, Object instance, int indent) {
try {
String lineSeparator = System.lineSeparator();
String spacing = this.repeat(" ", indent);
@@ -356,9 +356,14 @@ public class Config {
private void setAccessible(Field field) throws NoSuchFieldException, IllegalAccessException {
field.setAccessible(true);
if (Modifier.isFinal(field.getModifiers())) {
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ if (Runtime.version().feature() < 12) {
+ Field modifiersField = Field.class.getDeclaredField("modifiers");
+ modifiersField.setAccessible(true);
+ modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ } else {
+ // TODO: Maybe use sun.misc.Unsafe?...
+ throw new UnsupportedOperationException();
+ }
}
}
@@ -377,7 +382,7 @@ public class Config {
return array[0].toString();
}
default: {
- final StringBuilder result = new StringBuilder();
+ StringBuilder result = new StringBuilder();
for (int i = 0, j = array.length; i < j; ++i) {
if (i > 0) {
result.append(delimiter);