Skip to content
Draft
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
9 changes: 1 addition & 8 deletions src/main/java/cam72cam/mod/serialization/TagSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,7 @@ private static void init(Class<?> cls) throws SerializationException {
String fieldName = tag.value().isEmpty() ? field.getName() : tag.value();

if (Modifier.isFinal(field.getModifiers())) {
ModCore.warn("A mod is trying to deserialize a tag into a final field %s. This should never have been implemented and will be removed in future versions. You have been warned.", fieldName);
try {
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new SerializationException(String.format("Unable to access field %s in class %s", fieldName, cls), e);
}
throw new SerializationException(String.format("A mod is trying to deserialize a tag into a final field %s. This should never have been implemented.", fieldName));
}

TagMapped mapped = field.getType().getAnnotation(TagMapped.class);
Expand Down