mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-30 08:12:48 +00:00
Static code analysis. (#1017)
This commit is contained in:
committed by
Rob Bygrave
parent
a120c2aaee
commit
335c4de109
@@ -6,7 +6,6 @@ import io.ebeaninternal.server.autotune.model.ProfileDiff;
|
||||
import io.ebeaninternal.server.autotune.model.ProfileEmpty;
|
||||
import io.ebeaninternal.server.autotune.model.ProfileNew;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -62,8 +62,7 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
if (list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPersistController> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPersistController> newList = new ArrayList<>(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanPersistController(newList);
|
||||
@@ -77,8 +76,7 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
if (!list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPersistController> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPersistController> newList = new ArrayList<>(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanPersistController(newList);
|
||||
|
||||
@@ -60,8 +60,7 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
if (list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
List<BeanPersistListener> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPersistListener> newList = new ArrayList<>(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanPersistListener(newList);
|
||||
@@ -75,8 +74,7 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
if (!list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPersistListener> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPersistListener> newList = new ArrayList<>(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanPersistListener(newList);
|
||||
|
||||
@@ -29,8 +29,7 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
if (list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
List<BeanPostLoad> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPostLoad> newList = new ArrayList<>(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanPostLoad(newList);
|
||||
@@ -44,8 +43,7 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
if (!list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanPostLoad> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanPostLoad> newList = new ArrayList<>(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanPostLoad(newList);
|
||||
|
||||
@@ -36,8 +36,7 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
if (list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
List<BeanQueryAdapter> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanQueryAdapter> newList = new ArrayList<>(list);
|
||||
newList.add(c);
|
||||
|
||||
return new ChainedBeanQueryAdapter(newList);
|
||||
@@ -51,8 +50,7 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
if (!list.contains(c)) {
|
||||
return this;
|
||||
} else {
|
||||
ArrayList<BeanQueryAdapter> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
List<BeanQueryAdapter> newList = new ArrayList<>(list);
|
||||
newList.remove(c);
|
||||
|
||||
return new ChainedBeanQueryAdapter(newList);
|
||||
|
||||
@@ -36,7 +36,6 @@ import javax.persistence.MappedSuperclass;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -347,7 +347,7 @@ class DefaultDbSqlContext implements DbSqlContext {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefaultDbSqlContext: " + sb.toString();
|
||||
return "DefaultDbSqlContext: " + sb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.ebeaninternal.api.ManyWhereJoins;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,10 +40,7 @@ public class SqlTreeProperties {
|
||||
}
|
||||
|
||||
public void add(BeanProperty[] props) {
|
||||
//noinspection ManualArrayToCollectionCopy
|
||||
for (BeanProperty prop : props) {
|
||||
propsList.add(prop);
|
||||
}
|
||||
propsList.addAll(Arrays.asList(props));
|
||||
}
|
||||
|
||||
public void add(BeanProperty prop) {
|
||||
|
||||
@@ -134,12 +134,7 @@ public final class DefaultPersistenceContext implements PersistenceContext {
|
||||
|
||||
private ClassContext getClassContext(Class<?> rootType) {
|
||||
|
||||
ClassContext classMap = typeCache.get(rootType);
|
||||
if (classMap == null) {
|
||||
classMap = new ClassContext();
|
||||
typeCache.put(rootType, classMap);
|
||||
}
|
||||
return classMap;
|
||||
return typeCache.computeIfAbsent(rootType, k -> new ClassContext());
|
||||
}
|
||||
|
||||
private static class ClassContext {
|
||||
|
||||
@@ -178,8 +178,6 @@ public class ModifyAwareList<E> implements List<E>, ModifyAwareOwner {
|
||||
*/
|
||||
public ModifyAwareSet<E> asSet() {
|
||||
|
||||
LinkedHashSet<E> set = new LinkedHashSet<>();
|
||||
set.addAll(list);
|
||||
return new ModifyAwareSet<>(owner, set);
|
||||
return new ModifyAwareSet<>(owner, new LinkedHashSet<>(list));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user