Cleanup Jackson logic after code review

This commit is contained in:
Jonathan Leitschuh
2021-05-11 10:48:22 -04:00
parent bacc3ef5b3
commit 5a68ac88ef
5 changed files with 11 additions and 16 deletions

View File

@@ -72,18 +72,6 @@ private class ExplicitlyWrittenJacksonSerializableType extends JacksonSerializab
}
}
/** A type whose values are explicitly deserialized in a call to a Jackson method. */
private class ExplicitlyReadJacksonSerializableType extends JacksonDeserializableType {
ExplicitlyReadJacksonSerializableType() {
exists(MethodAccess ma |
// A call to a Jackson read method...
ma.getMethod() instanceof JacksonReadValueMethod and
// ...where `this` is used in the final argument, indicating that this type will be deserialized.
usesType(ma.getArgument(ma.getNumArgument() - 1).getType(), this)
)
}
}
/** A type used in a `JacksonSerializableField` declaration. */
private class FieldReferencedJacksonSerializableType extends JacksonSerializableType {
FieldReferencedJacksonSerializableType() {
@@ -123,6 +111,13 @@ private class ExplicitlyReadJacksonDeserializableType extends JacksonDeserializa
exists(TypeLiteralToJacksonDatabindFlowConfiguration conf |
usesType(conf.getSourceWithFlowToJacksonDatabind().getTypeName().getType(), this)
)
or
exists(MethodAccess ma |
// A call to a Jackson read method...
ma.getMethod() instanceof JacksonReadValueMethod and
// ...where `this` is used in the final argument, indicating that this type will be deserialized.
usesType(ma.getArgument(ma.getNumArgument() - 1).getType(), this)
)
}
}

View File

@@ -31,4 +31,4 @@ class HasFlowTest extends InlineExpectationsTest {
value = ""
)
}
}
}

View File

@@ -5,4 +5,4 @@ import java.util.*;
public abstract class JsonNode implements Iterable<JsonNode> {
public JsonNode() {
}
}
}

View File

@@ -25,4 +25,4 @@ public class MappingIterator<T> implements Iterator<T>, Closeable {
public void close() throws IOException {
}
}
}

View File

@@ -79,4 +79,4 @@ public class ObjectReader {
return null;
}
}
}