Skip to content

Commit

Permalink
Cherry-picked simplifications from #4076
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 19, 2023
1 parent 9c649cd commit 7f85d4a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ AnnotatedMethodMap collect(TypeFactory typeFactory, TypeResolutionContext tc,
try {
// And with that, we can generate it appropriately
Method m = Object.class.getDeclaredMethod(k.getName());
if (m != null) {
MethodBuilder b = entry.getValue();
b.annotations = collectDefaultAnnotations(b.annotations,
m.getDeclaredAnnotations());
b.method = m;
}
MethodBuilder b = entry.getValue();
b.annotations = collectDefaultAnnotations(b.annotations,
m.getDeclaredAnnotations());
b.method = m;
} catch (Exception e) { }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ public static boolean hasGetterSignature(Method m)
return false;
}
// Must take no args
Class<?>[] pts = m.getParameterTypes();
if (pts != null && pts.length != 0) {
if (m.getParameterTypes().length != 0) {
return false;
}
// Can't be a void method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void setLenient(boolean enabled) {
@Override // since 2.7
public boolean isLenient() {
// default is, I believe, true
return (_lenient == null) || _lenient.booleanValue();
return (_lenient == null) || _lenient;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,11 @@ public void serialize(JsonGenerator gen) throws IOException
{
Object n = segment.get(ptr);
if (n instanceof Double) {
gen.writeNumber(((Double) n).doubleValue());
gen.writeNumber((Double) n);
} else if (n instanceof BigDecimal) {
gen.writeNumber((BigDecimal) n);
} else if (n instanceof Float) {
gen.writeNumber(((Float) n).floatValue());
gen.writeNumber((Float) n);
} else if (n == null) {
gen.writeNull();
} else if (n instanceof String) {
Expand Down Expand Up @@ -745,17 +745,15 @@ public void writeStartObject(Object forValue) throws IOException
{
_writeContext.writeValue();
_appendStartMarker(JsonToken.START_OBJECT);
JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue);
_writeContext = ctxt;
_writeContext = _writeContext.createChildObjectContext(forValue);
}

@Override // since 2.10.1
public void writeStartObject(Object forValue, int size) throws IOException
{
_writeContext.writeValue();
_appendStartMarker(JsonToken.START_OBJECT);
JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue);
_writeContext = ctxt;
_writeContext = _writeContext.createChildObjectContext(forValue);
}

@Override
Expand Down Expand Up @@ -2182,8 +2180,7 @@ public int rawType(int index)
if (index > 0) {
l >>= (index << 2);
}
int ix = ((int) l) & 0xF;
return ix;
return ((int) l) & 0xF;
}

public Object get(int index) {
Expand Down

0 comments on commit 7f85d4a

Please sign in to comment.