Skip to content

Commit

Permalink
Warnings removal
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 10, 2024
1 parent e59fad9 commit b1a1da2
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 31 deletions.
Expand Up @@ -135,7 +135,7 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
Expand Down Expand Up @@ -174,7 +174,7 @@ public final Object deserialize(JsonParser p, DeserializationContext ctxt, Objec
throws IOException
{
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (_injectables != null) {
injectValues(ctxt, bean);
}
Expand All @@ -191,7 +191,7 @@ public final Object deserialize(JsonParser p, DeserializationContext ctxt, Objec
return super.deserialize(p, ctxt, bean);
}
} else if (!p.hasToken(JsonToken.FIELD_NAME)
|| !prop.getName().equals(p.getCurrentName())) {
|| !prop.getName().equals(p.currentName())) {
// no, something funky, use base impl for special cases
return super.deserialize(p, ctxt, bean);
}
Expand Down Expand Up @@ -233,7 +233,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
// Allow Object Id references to come in as JSON Objects as well...
if ((_objectIdReader != null) && _objectIdReader.maySerializeAsObject()) {
if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)
&& _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
&& _objectIdReader.isValidReferencePropertyName(p.currentName(), p)) {
return deserializeFromObjectId(p, ctxt);
}
}
Expand All @@ -252,7 +252,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
Expand All @@ -269,7 +269,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
return super.deserialize(p, ctxt, bean);
}
} else if (!p.hasToken(JsonToken.FIELD_NAME)
|| !prop.getName().equals(p.getCurrentName())) {
|| !prop.getName().equals(p.currentName())) {
return super.deserialize(p, ctxt, bean);
}
// and deserialize
Expand Down
Expand Up @@ -27,6 +27,8 @@ public SampleObject(String field1, Integer field2, Integer field3) {
}

static class Only2BeanSerializerModifier extends BeanSerializerModifier {
private static final long serialVersionUID = 1L;

@Override
public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyWriter> props)
{
Expand Down
6 changes: 3 additions & 3 deletions afterburner/src/test/java/perftest/MediaItem.java
Expand Up @@ -41,7 +41,7 @@ public static MediaItem deserialize(JsonParser jp) throws IOException
}
MediaItem item = new MediaItem();
while (jp.nextToken() == JsonToken.FIELD_NAME) {
String name = jp.getCurrentName();
String name = jp.currentName();
if (name == "images") {
item._photos = deserializeImages(jp);
} else if (name == "content") {
Expand Down Expand Up @@ -163,7 +163,7 @@ public static Photo deserialize(JsonParser jp) throws IOException
{
Photo photo = new Photo();
while (jp.nextToken() == JsonToken.FIELD_NAME) {
String name = jp.getCurrentName();
String name = jp.currentName();
jp.nextToken();
Integer I = sFields.get(name);
if (I != null) {
Expand Down Expand Up @@ -301,7 +301,7 @@ public static Content deserialize(JsonParser jp) throws IOException
Content content = new Content();

while (jp.nextToken() == JsonToken.FIELD_NAME) {
String name = jp.getCurrentName();
String name = jp.currentName();
jp.nextToken();
Integer I = sFields.get(name);
if (I != null) {
Expand Down
Expand Up @@ -58,6 +58,8 @@
* @author Eran Leshem
**/
public class AndroidRecordModule extends SimpleModule {
private static final long serialVersionUID = 1L;

private static final class AndroidRecordNaming
extends DefaultAccessorNamingStrategy
{
Expand All @@ -66,7 +68,7 @@ private static final class AndroidRecordNaming
*/
private final Set<String> _componentNames;

private AndroidRecordNaming(MapperConfig<?> config, AnnotatedClass forClass) {
AndroidRecordNaming(MapperConfig<?> config, AnnotatedClass forClass) {
super(config, forClass,
// no setters for (immutable) Records:
null,
Expand All @@ -89,7 +91,9 @@ public String findNameForRegularGetter(AnnotatedMethod am, String name)
}
}

private static class AndroidRecordClassIntrospector extends BasicClassIntrospector {
static class AndroidRecordClassIntrospector extends BasicClassIntrospector {
private static final long serialVersionUID = 1L;

@Override
protected POJOPropertiesCollector collectProperties(MapperConfig<?> config, JavaType type, MixInResolver r,
boolean forSerialization) {
Expand Down Expand Up @@ -159,7 +163,7 @@ && isDesugaredRecordClass(raw)) {
return defaultInstantiator;
}

private static Stream<Field> getDesugaredRecordComponents(Class<?> raw) {
static Stream<Field> getDesugaredRecordComponents(Class<?> raw) {
return Arrays.stream(raw.getDeclaredFields()).filter(field -> ! Modifier.isStatic(field.getModifiers()));
}
}
Expand Up @@ -22,15 +22,15 @@
* @author Eran Leshem
**/
public class AndroidRecordTest extends TestCase {
private static final class Simple extends RecordTag {
static final class Simple extends RecordTag {
static int si = 7;
private final int i;
private final int j;
private final String s;
private final List<String> l;
private final AtomicInteger ai;

private Simple(int i, int j, String s, List<String> l, AtomicInteger ai) {
Simple(int i, int j, String s, List<String> l, AtomicInteger ai) {
this.i = i;
this.j = j;
this.s = s;
Expand Down Expand Up @@ -72,26 +72,26 @@ public boolean equals(Object o) {
}
}

private static final class MultipleConstructors extends RecordTag {
static final class MultipleConstructors extends RecordTag {
private final int i;
private final List<String> l;

private MultipleConstructors(int i, List<String> l) {
MultipleConstructors(int i, List<String> l) {
this.i = i;
this.l = l;
}

private MultipleConstructors(String s, List<String> l) {
MultipleConstructors(String s, List<String> l) {
i = Integer.parseInt(s);
this.l = l;
}

private MultipleConstructors(int i, String s, List<String> l) {
MultipleConstructors(int i, String s, List<String> l) {
this.i = i;
this.l = l;
}

private MultipleConstructors(List<Integer> l, int i) {
MultipleConstructors(List<Integer> l, int i) {
this.i = i;
this.l = null;
}
Expand All @@ -106,16 +106,16 @@ List<String> l() {
}


private static final class ConflictingConstructors extends RecordTag {
static final class ConflictingConstructors extends RecordTag {
private final int i;
private final String s;

private ConflictingConstructors(int i, String s) {
ConflictingConstructors(int i, String s) {
this.i = i;
this.s = s;
}

private ConflictingConstructors(String s, int i) {
ConflictingConstructors(String s, int i) {
this.i = i;
this.s = s;
}
Expand Down
Expand Up @@ -27,6 +27,8 @@

public class BBDeserializerModifier extends BeanDeserializerModifier
{
private static final long serialVersionUID = 1L;

private static final MethodHandle TRAMPOLINE, BOOLEAN_TRAMPOLINE, LONG_TRAMPOLINE, INT_TRAMPOLINE;

static {
Expand Down
Expand Up @@ -135,7 +135,7 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
Expand Down Expand Up @@ -174,7 +174,7 @@ public final Object deserialize(JsonParser p, DeserializationContext ctxt, Objec
throws IOException
{
// [databind#631]: Assign current value, to be accessible by custom deserializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (_injectables != null) {
injectValues(ctxt, bean);
}
Expand All @@ -191,7 +191,7 @@ public final Object deserialize(JsonParser p, DeserializationContext ctxt, Objec
return super.deserialize(p, ctxt, bean);
}
} else if (!p.hasToken(JsonToken.FIELD_NAME)
|| !prop.getName().equals(p.getCurrentName())) {
|| !prop.getName().equals(p.currentName())) {
// no, something funky, use base impl for special cases
return super.deserialize(p, ctxt, bean);
}
Expand Down Expand Up @@ -233,7 +233,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
// Allow Object Id references to come in as JSON Objects as well...
if ((_objectIdReader != null) && _objectIdReader.maySerializeAsObject()) {
if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)
&& _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
&& _objectIdReader.isValidReferencePropertyName(p.currentName(), p)) {
return deserializeFromObjectId(p, ctxt);
}
}
Expand All @@ -252,7 +252,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
p.assignCurrentValue(bean);
if (p.canReadObjectId()) {
Object id = p.getObjectId();
if (id != null) {
Expand All @@ -269,7 +269,7 @@ public final Object deserializeFromObject(JsonParser p, DeserializationContext c
return super.deserialize(p, ctxt, bean);
}
} else if (!p.hasToken(JsonToken.FIELD_NAME)
|| !prop.getName().equals(p.getCurrentName())) {
|| !prop.getName().equals(p.currentName())) {
return super.deserialize(p, ctxt, bean);
}
// and deserialize
Expand Down
Expand Up @@ -26,6 +26,8 @@

public class BBSerializerModifier extends BeanSerializerModifier
{
private static final long serialVersionUID = 1L;

private final Function<Class<?>, Lookup> _lookups;
private final UnaryOperator<Lookup> _accessGrant;

Expand Down
Expand Up @@ -251,7 +251,7 @@ protected void verifyFieldName(JsonParser jp, String expName)
throws IOException
{
assertEquals(expName, jp.getText());
assertEquals(expName, jp.getCurrentName());
assertEquals(expName, jp.currentName());
}

protected void verifyIntValue(JsonParser jp, long expValue)
Expand Down
Expand Up @@ -27,6 +27,8 @@ public SampleObject(String field1, Integer field2, Integer field3) {
}

static class Only2BeanSerializerModifier extends BeanSerializerModifier {
private static final long serialVersionUID = 1L;

@Override
public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BeanDescription beanDesc, List<BeanPropertyWriter> props)
{
Expand Down
Expand Up @@ -5,8 +5,6 @@

import com.fasterxml.jackson.databind.type.TypeFactory;

import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector;

public class TestVersions extends ModuleTestBase
{
public void testVersions()
Expand Down
Expand Up @@ -52,6 +52,8 @@ static class MyType {

static class MyBeanDeserializerModifier extends BeanDeserializerModifier
{
private static final long serialVersionUID = 1L;

static int count = 0;

@Override
Expand Down
Expand Up @@ -33,6 +33,7 @@ protected Bean() { }
/**********************************************************
*/

@SuppressWarnings("synthetic-access")
public void testSimpleInteface() throws Exception
{
ObjectMapper mapper = newMrBeanMapper();
Expand Down
Expand Up @@ -85,6 +85,7 @@ public void testOverrides() throws Exception
verifyBean(bean2);
}

@SuppressWarnings("synthetic-access")
public void testReAbstractedMethods() throws Exception
{
AbstractTypeMaterializer mat = new AbstractTypeMaterializer();
Expand Down Expand Up @@ -161,6 +162,7 @@ public void testEagerFailureOnReAbstractedMethods() throws Exception
}
}

@SuppressWarnings("synthetic-access")
private void verifyBean(Bean bean) {
assertNotNull(bean);
assertEquals("abc", bean.getX());
Expand Down
Expand Up @@ -59,6 +59,7 @@ public interface OtherInterface {
}

public interface BeanWithDefaultForOtherInterface extends Bean, OtherInterface {
@Override
public default boolean anyValuePresent() {
return getX() > 0 || getA() != null;
}
Expand Down

0 comments on commit b1a1da2

Please sign in to comment.