Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import org.objectweb.asm.TypePath;
Expand All @@ -43,7 +44,8 @@ public TypeAnnotationNode deserialize(JsonElement json, Type typeOfT, JsonDeseri
AnnotationNode annotation = context.deserialize(json, AnnotationNode.class);
JsonObject jsonObject = json.getAsJsonObject();
int typeRef = jsonObject.getAsJsonPrimitive("type_ref").getAsInt();
String typePath = jsonObject.getAsJsonPrimitive("type_path").getAsString();
JsonPrimitive typePathPrimitive = jsonObject.getAsJsonPrimitive("type_path");
String typePath = typePathPrimitive == null ? "" : typePathPrimitive.getAsString();
TypeAnnotationNode typeAnnotation = new TypeAnnotationNode(typeRef, TypePath.fromString(typePath), annotation.desc);
annotation.accept(typeAnnotation);
return typeAnnotation;
Expand All @@ -53,7 +55,11 @@ public TypeAnnotationNode deserialize(JsonElement json, Type typeOfT, JsonDeseri
public JsonElement serialize(TypeAnnotationNode src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject json = context.serialize(src, AnnotationNode.class).getAsJsonObject();
json.addProperty("type_ref", src.typeRef);
json.addProperty("type_path", src.typePath.toString());

if (src.typePath != null) {
json.addProperty("type_path", src.typePath.toString());
}

return json;
}
}
Loading