Skip to content

Commit 7f85d4a

Browse files
committed
Cherry-picked simplifications from #4076
1 parent 9c649cd commit 7f85d4a

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethodCollector.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,10 @@ AnnotatedMethodMap collect(TypeFactory typeFactory, TypeResolutionContext tc,
7979
try {
8080
// And with that, we can generate it appropriately
8181
Method m = Object.class.getDeclaredMethod(k.getName());
82-
if (m != null) {
83-
MethodBuilder b = entry.getValue();
84-
b.annotations = collectDefaultAnnotations(b.annotations,
85-
m.getDeclaredAnnotations());
86-
b.method = m;
87-
}
82+
MethodBuilder b = entry.getValue();
83+
b.annotations = collectDefaultAnnotations(b.annotations,
84+
m.getDeclaredAnnotations());
85+
b.method = m;
8886
} catch (Exception e) { }
8987
}
9088
}

src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ public static boolean hasGetterSignature(Method m)
339339
return false;
340340
}
341341
// Must take no args
342-
Class<?>[] pts = m.getParameterTypes();
343-
if (pts != null && pts.length != 0) {
342+
if (m.getParameterTypes().length != 0) {
344343
return false;
345344
}
346345
// Can't be a void method

src/main/java/com/fasterxml/jackson/databind/util/StdDateFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public void setLenient(boolean enabled) {
342342
@Override // since 2.7
343343
public boolean isLenient() {
344344
// default is, I believe, true
345-
return (_lenient == null) || _lenient.booleanValue();
345+
return (_lenient == null) || _lenient;
346346
}
347347

348348
/**

src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ public void serialize(JsonGenerator gen) throws IOException
451451
{
452452
Object n = segment.get(ptr);
453453
if (n instanceof Double) {
454-
gen.writeNumber(((Double) n).doubleValue());
454+
gen.writeNumber((Double) n);
455455
} else if (n instanceof BigDecimal) {
456456
gen.writeNumber((BigDecimal) n);
457457
} else if (n instanceof Float) {
458-
gen.writeNumber(((Float) n).floatValue());
458+
gen.writeNumber((Float) n);
459459
} else if (n == null) {
460460
gen.writeNull();
461461
} else if (n instanceof String) {
@@ -745,17 +745,15 @@ public void writeStartObject(Object forValue) throws IOException
745745
{
746746
_writeContext.writeValue();
747747
_appendStartMarker(JsonToken.START_OBJECT);
748-
JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue);
749-
_writeContext = ctxt;
748+
_writeContext = _writeContext.createChildObjectContext(forValue);
750749
}
751750

752751
@Override // since 2.10.1
753752
public void writeStartObject(Object forValue, int size) throws IOException
754753
{
755754
_writeContext.writeValue();
756755
_appendStartMarker(JsonToken.START_OBJECT);
757-
JsonWriteContext ctxt = _writeContext.createChildObjectContext(forValue);
758-
_writeContext = ctxt;
756+
_writeContext = _writeContext.createChildObjectContext(forValue);
759757
}
760758

761759
@Override
@@ -2182,8 +2180,7 @@ public int rawType(int index)
21822180
if (index > 0) {
21832181
l >>= (index << 2);
21842182
}
2185-
int ix = ((int) l) & 0xF;
2186-
return ix;
2183+
return ((int) l) & 0xF;
21872184
}
21882185

21892186
public Object get(int index) {

0 commit comments

Comments
 (0)