minor cleanup wrt caching
diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java
index 59d3499..d8c7f0a 100644
--- a/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java
+++ b/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java
@@ -67,6 +67,10 @@
*/
@Override
public boolean isAnnotationBundle(Annotation ann) {
+ // 22-Sep-2015, tatu: Caching here has modest effect on JavaSE, and only
+ // mostly in degenerate cases where introspection used more often than
+ // it should (like recreating ObjectMapper once per read/write).
+ // But it may be more beneficial on platforms like Android (should verify)
Class<?> type = ann.annotationType();
Boolean b = _annotationsInside.get(type);
if (b == null) {
diff --git a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java
index b49f5ed..f7f5fdf 100644
--- a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java
+++ b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java
@@ -179,7 +179,7 @@
* Getters
*/
public ClassLoader getClassLoader() {
- return _classLoader;
+ return _classLoader;
}
/*
diff --git a/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java b/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java
index b552c82..5fcaa8d 100644
--- a/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java
+++ b/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java
@@ -224,22 +224,27 @@
if (end == offset) { // empty name, nope
return null;
}
- // otherwise, lower case initial chars
- StringBuilder sb = null;
- for (int i = offset; i < end; ++i) {
- char upper = basename.charAt(i);
- char lower = Character.toLowerCase(upper);
- if (upper == lower) {
+ // next check: is the first character upper case? If not, return as is
+ char c = basename.charAt(offset);
+ char d = Character.toLowerCase(c);
+
+ if (c == d) {
+ return basename.substring(offset);
+ }
+ // otherwise, lower case initial chars. Common case first, just one char
+ StringBuilder sb = new StringBuilder(end - offset);
+ sb.append(d);
+ int i = offset+1;
+ for (; i < end; ++i) {
+ c = basename.charAt(i);
+ d = Character.toLowerCase(c);
+ if (c == d) {
+ sb.append(basename, i, end);
break;
}
- if (sb == null) {
- int l = end-offset;
- sb = new StringBuilder(l);
- sb.append(basename, offset, end);
- }
- sb.setCharAt(i-offset, lower);
+ sb.append(d);
}
- return (sb == null) ? basename.substring(offset) : sb.toString();
+ return sb.toString();
}
/**
diff --git a/src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java b/src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
index 7e5add3..8164fb6 100644
--- a/src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
+++ b/src/main/java/com/fasterxml/jackson/databind/util/ClassUtil.java
@@ -820,8 +820,6 @@
*/
private final static class ClassMetadata
{
- private final static Class<?> CLS_OBJECT = Object.class;
-
private final static Annotation[] NO_ANNOTATIONS = new Annotation[0];
private final static Ctor[] NO_CTORS = new Ctor[0];