Buggy code:
public class FixedChatSerializer implements JsonDeserializer < IChatBaseComponent > , JsonSerializer < IChatBaseComponent > { public static final Gson gson = new GsonBuilder ( ) . registerTypeHierarchyAdapter ( IChatBaseComponent . class , new FixedChatSerializer ( ) ) . registerTypeHierarchyAdapter ( ChatModifier . class , new ChatModifier . ChatModifierSerializer ( ) ) . registerTypeAdapterFactory ( new ChatTypeAdapterFactory ( ) ) . create ( ) ; @ Override public IChatBaseComponent deserialize ( JsonElement element , Type type , JsonDeserializationContext ctx ) throws JsonParseException { if ( element . isJsonPrimitive ( ) ) { return new ChatComponentText ( element . getAsString ( ) ) ; } else if ( ! ( element . isJsonObject ( ) ) ) { if ( element . isJsonArray ( ) ) { JsonArray jsonArray = element . getAsJsonArray ( ) ; IChatBaseComponent chatcomp = null ; for ( JsonElement jsonElement : jsonArray ) { IChatBaseComponent innerchatcomp = deserialize ( jsonElement , jsonElement . getClass ( ) , ctx ) ; if ( chatcomp == null ) { chatcomp = innerchatcomp ; } else { chatcomp . addSibling ( innerchatcomp ) ; } } return chatcomp ; } else { throw new JsonParseException ( ( ( "Don\'t<seq2seq4repair_space>know<seq2seq4repair_space>how<seq2seq4repair_space>to<seq2seq4repair_space>turn<seq2seq4repair_space>" + ( element . toString ( ) ) ) + "<seq2seq4repair_space>into<seq2seq4repair_space>a<seq2seq4repair_space>Component" ) ) ; } } else { JsonObject jsonobject = element . getAsJsonObject ( ) ; IChatBaseComponent resultComp ; if ( jsonobject . has ( "text" ) ) { resultComp = new ChatComponentText ( jsonobject . get ( "text" ) . getAsString ( ) ) ; } else if ( jsonobject . has ( "translate" ) ) { String translate = jsonobject . get ( "translate" ) . getAsString ( ) ; if ( jsonobject . has ( "with" ) ) { JsonArray withJsonArray = jsonobject . getAsJsonArray ( "with" ) ; Object [ ] array = new Object [ withJsonArray . size ( ) ] ; for ( int i = 0 ; i < ( array . length ) ; ++ i ) { array [ i ] = deserialize ( withJsonArray . get ( i ) , type , ctx ) ; if ( ( array [ i ] ) instanceof ChatComponentText ) { ChatComponentText compText = ( ( ChatComponentText ) ( array [ i ] ) ) ; if ( ( compText . getChatModifier ( ) . g ( ) ) && ( compText . a ( ) . isEmpty ( ) ) ) { array [ i ] = compText . g ( ) ; } } } resultComp = new ChatMessage ( translate , array ) ; } else { resultComp = new ChatMessage ( translate ) ; } } else if ( jsonobject . has ( "score" ) ) { JsonObject scoreJsonObject = jsonobject . getAsJsonObject ( "score" ) ; if ( ( ! ( scoreJsonObject . has ( "name" ) ) ) || ( ! ( scoreJsonObject . has ( "objective" ) ) ) ) { throw new JsonParseException ( "A<seq2seq4repair_space>score<seq2seq4repair_space>component<seq2seq4repair_space>needs<seq2seq4repair_space>a<seq2seq4repair_space>least<seq2seq4repair_space>a<seq2seq4repair_space>name<seq2seq4repair_space>and<seq2seq4repair_space>an<seq2seq4repair_space>objective" ) ; } resultComp = new ChatComponentScore ( FixedChatSerializer . JsonHelper . getString ( scoreJsonObject , "name" ) , FixedChatSerializer . JsonHelper . getString ( scoreJsonObject , "objective" ) ) ; if ( scoreJsonObject . has ( "value" ) ) { ( ( ChatComponentScore ) ( resultComp ) ) . b ( FixedChatSerializer . JsonHelper . getString ( scoreJsonObject , "value" ) ) ; } } else { if ( ! ( jsonobject . has ( "selector" ) ) ) { throw new JsonParseException ( ( ( "Don\'t<seq2seq4repair_space>know<seq2seq4repair_space>how<seq2seq4repair_space>to<seq2seq4repair_space>turn<seq2seq4repair_space>" + ( element . toString ( ) ) ) + "<seq2seq4repair_space>into<seq2seq4repair_space>a<seq2seq4repair_space>Component" ) ) ; } resultComp = new ChatComponentSelector ( FixedChatSerializer . JsonHelper . getString ( jsonobject , "selector" ) ) ; } if ( jsonobject . has ( "extra" ) ) { JsonArray entryJsonArray = jsonobject . getAsJsonArray ( "extra" ) ; if ( ( entryJsonArray . size ( ) ) <= 0 ) { throw new JsonParseException ( "Unexpected<seq2seq4repair_space>empty<seq2seq4repair_space>array<seq2seq4repair_space>of<seq2seq4repair_space>components" ) ; } for ( int i = 0 ; i < ( entryJsonArray . size ( ) ) ; ++ i ) { resultComp . addSibling ( deserialize ( entryJsonArray . get ( i ) , type , ctx ) ) ; } } <START_BUG> resultComp . setChatModifier ( ctx . deserialize ( element , ChatModifier . class ) ) ; <END_BUG> return resultComp ; } } private void a ( ChatModifier chatmodifier , JsonObject jsonobject , JsonSerializationContext ctx ) { } @ Override public JsonElement serialize ( IChatBaseComponent base , Type type , JsonSerializationContext ctx ) { } private static class JsonHelper { public static String asString ( JsonElement jsonElement , String key ) { } public static String getString ( JsonObject jsonObject , String key ) { } public static String toString ( JsonElement jsonElement ) { } } No newline ; at end ; of file ; }

Fix:
resultComp . setChatModifier ( ( ( ChatModifier ) ( ctx . deserialize ( element , ChatModifier . class ) ) ) ) ;