Skip to content

Lots of Sonar and Java 6 plus Pretty Readme #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Sep 22, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not create new object and immediately return
Just return objects directly rather than creating another one.
  • Loading branch information
hazendaz committed Sep 22, 2014
commit 2e043d90639c6fddb14bef52c7fad71ff8ed8909
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ private Node findSqlFragment(String refid) {
refid = builderAssistant.applyCurrentNamespace(refid, true);
try {
XNode nodeToInclude = configuration.getSqlFragments().get(refid);
Node result = nodeToInclude.getNode().cloneNode(true);
return result;
return nodeToInclude.getNode().cloneNode(true);
} catch (IllegalArgumentException e) {
throw new IncompleteElementException("Could not find SQL statement to include with refid '" + refid + "'", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public TypeHandler<?> getTypeHandler(Class<?> propertyType, String columnName) {

private Class<?> resolveClass(String className) {
try {
final Class<?> clazz = Resources.classForName(className);
return clazz;
return Resources.classForName(className);
} catch (ClassNotFoundException e) {
return null;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/mapping/MappedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ private static String[] delimitedStringtoArray(String in) {
if (in == null || in.trim().length() == 0) {
return null;
} else {
String[] answer = in.split(",");
return answer;
return in.split(",");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ public <T> T create(Class<T> type) {
return create(type, null, null);
}

@SuppressWarnings("unchecked")
@Override
public <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs) {
Class<?> classToCreate = resolveInterface(type);
@SuppressWarnings("unchecked")
// we know types are assignable
T created = (T) instantiateClass(classToCreate, constructorArgTypes, constructorArgs);
return created;
return (T) instantiateClass(classToCreate, constructorArgTypes, constructorArgs);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ public Object get(Object key) {
}

if (parameterMetaObject != null) {
Object object = parameterMetaObject.getValue(strKey);
// issue #61 do not modify the context when reading
// if (object != null) {
// super.put(strKey, object);
// }

return object;
return parameterMetaObject.getValue(strKey);
}

return null;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/ibatis/session/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,7 @@ public V get(Object key) {

private String getShortName(String key) {
final String[] keyparts = key.split("\\.");
final String shortKey = keyparts[keyparts.length - 1];
return shortKey;
return keyparts[keyparts.length - 1];
}

protected static class Ambiguity {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/apache/ibatis/type/TypeHandlerRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public <T> TypeHandler<T> getTypeHandler(TypeReference<T> javaTypeReference, Jdb
return getTypeHandler(javaTypeReference.getRawType(), jdbcType);
}

@SuppressWarnings("unchecked")
private <T> TypeHandler<T> getTypeHandler(Type type, JdbcType jdbcType) {
Map<JdbcType, TypeHandler<?>> jdbcHandlerMap = TYPE_HANDLER_MAP.get(type);
TypeHandler<?> handler = null;
Expand All @@ -177,10 +178,8 @@ private <T> TypeHandler<T> getTypeHandler(Type type, JdbcType jdbcType) {
if (handler == null && type != null && type instanceof Class && Enum.class.isAssignableFrom((Class<?>) type)) {
handler = new EnumTypeHandler((Class<?>) type);
}
@SuppressWarnings("unchecked")
// type drives generics here
TypeHandler<T> returned = (TypeHandler<T>) handler;
return returned;
return (TypeHandler<T>) handler;
}

public TypeHandler<Object> getUnknownTypeHandler() {
Expand Down