mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - suppress warnings, simplify if
This commit is contained in:
@@ -67,9 +67,7 @@ class ModifyListIterator<E> implements ListIterator<E> {
|
||||
}
|
||||
|
||||
public void set(E o) {
|
||||
if (last == null) {
|
||||
// in theory this is not allowed
|
||||
} else {
|
||||
if (last != null) {
|
||||
owner.modifyRemoval(last);
|
||||
owner.modifyAddition(o);
|
||||
}
|
||||
|
||||
@@ -251,10 +251,7 @@ public class StringHelper {
|
||||
if (endPos == -1) {
|
||||
if (startPos <= str.length()) {
|
||||
String lastValue = str.substring(startPos, str.length());
|
||||
// dp("lastValue="+lastValue);
|
||||
if (!keepEmpties && lastValue.length() == 0) {
|
||||
// dp("not keeping...");
|
||||
} else {
|
||||
if (keepEmpties || lastValue.length() != 0) {
|
||||
list.add(lastValue);
|
||||
}
|
||||
}
|
||||
@@ -263,10 +260,7 @@ public class StringHelper {
|
||||
} else {
|
||||
// get the delimited value... add it..
|
||||
String value = str.substring(startPos, endPos);
|
||||
// dp(startPos+","+endPos+" value="+value);
|
||||
if (!keepEmpties && value.length() == 0) {
|
||||
// dp("not keeping...");
|
||||
} else {
|
||||
if (keepEmpties || value.length() != 0) {
|
||||
list.add(value);
|
||||
}
|
||||
// recursively search as we are not at the end yet...
|
||||
|
||||
@@ -386,14 +386,12 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
|
||||
try {
|
||||
Class<?> beanClass = ClassUtil.forName(beanType, this.getClass());
|
||||
BeanDescriptor<?> beanDescriptor = server.getBeanDescriptor(beanClass);
|
||||
if (beanDescriptor == null){
|
||||
// previously was an entity but not longer
|
||||
|
||||
} else {
|
||||
if (beanDescriptor != null){
|
||||
|
||||
// Determine the fetch plan from the latest statistics.
|
||||
// Use this to compare with current "tuned fetch plan".
|
||||
OrmQueryDetail newFetchDetail = statistics.buildTunedFetch(beanDescriptor);
|
||||
|
||||
|
||||
// get the current tuned fetch info...
|
||||
TunedQueryInfo currentFetch = tunedQueryInfoMap.get(queryPoint.getKey());
|
||||
|
||||
@@ -408,7 +406,7 @@ public class DefaultAutoFetchManager implements AutoFetchManager, Serializable {
|
||||
} else if (!currentFetch.isSame(newFetchDetail)) {
|
||||
// the fetch plan has changed, update it.
|
||||
counters.incrementModified();
|
||||
|
||||
|
||||
logging.logChanged(currentFetch, newFetchDetail);
|
||||
currentFetch.setTunedDetail(newFetchDetail);
|
||||
|
||||
|
||||
@@ -123,15 +123,13 @@ public class Statistics implements Serializable {
|
||||
*/
|
||||
public void collectUsageInfo(NodeUsageCollector profile) {
|
||||
|
||||
if (profile.isEmpty()){
|
||||
// no usage was collected
|
||||
} else {
|
||||
ObjectGraphNode node = profile.getNode();
|
||||
|
||||
StatisticsNodeUsage nodeStats = getNodeStats(node.getPath());
|
||||
nodeStats.publish(profile);
|
||||
}
|
||||
}
|
||||
if (!profile.isEmpty()) {
|
||||
ObjectGraphNode node = profile.getNode();
|
||||
|
||||
StatisticsNodeUsage nodeStats = getNodeStats(node.getPath());
|
||||
nodeStats.publish(profile);
|
||||
}
|
||||
}
|
||||
|
||||
private StatisticsNodeUsage getNodeStats(String path) {
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ public class StatisticsNodeUsage implements Serializable {
|
||||
String manyPath = SplitName.add(path, assocProp.getName());
|
||||
pathProps.addToPath(manyPath, targetIdProp);
|
||||
} else {
|
||||
if (beanProp.isLob() && !beanProp.isFetchEager()) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (beanProp.isLob() && !beanProp.isFetchEager()) {
|
||||
// AutoFetch will not include Lob's marked FetchLazy
|
||||
// (which is the default for Lob's so typical).
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CachedBeanDataToBean {
|
||||
|
||||
int propertyIndex = prop.getPropertyIndex();
|
||||
if (cacheBeanData.isLoaded(propertyIndex)) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
// already loaded (lazy load on partially loaded bean)
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CreateTableColumnVisitor extends BaseTablePropertyVisitor {
|
||||
@Override
|
||||
public void visitMany(BeanPropertyAssocMany<?> p) {
|
||||
if (p.isManyToMany()) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (p.getMappedBy() != null) {
|
||||
// only create on other 'owning' side
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BeanDescriptorJsonHelp<T> {
|
||||
public T jsonRead(ReadJson jsonRead, String path) throws IOException {
|
||||
|
||||
JsonParser parser = jsonRead.getParser();
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (parser.getCurrentToken() == JsonToken.START_OBJECT) {
|
||||
// start object token read by Jackson already
|
||||
} else {
|
||||
|
||||
@@ -94,6 +94,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
public void initialise() {
|
||||
super.initialise();
|
||||
if (!isTransient) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (embedded) {
|
||||
// no imported or exported information
|
||||
} else if (!oneToOneExported) {
|
||||
@@ -832,6 +833,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
writeJson.writeNullField(name);
|
||||
|
||||
} else {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (writeJson.isParentBean(value)) {
|
||||
// bi-directional and already rendered parent
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ public class AnnotationAssocOnes extends AnnotationParser {
|
||||
|
||||
if (!prop.getTableJoin().hasJoinColumns() && beanTable != null) {
|
||||
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (prop.getMappedBy() != null) {
|
||||
// the join is derived by reversing the join information
|
||||
// from the mapped by property.
|
||||
|
||||
@@ -110,8 +110,6 @@ public class DeployInherit {
|
||||
Class<?> parent = findParent(cls);
|
||||
if (parent != null) {
|
||||
info.setParent(parent);
|
||||
} else {
|
||||
// its the root of inheritance tree...
|
||||
}
|
||||
|
||||
Inheritance ia = cls.getAnnotation(Inheritance.class);
|
||||
|
||||
@@ -124,7 +124,8 @@ class BusyConnectionBuffer {
|
||||
if (slots[i] != null){
|
||||
//tmp.add(slots[i]);
|
||||
PooledConnection pc = slots[i];
|
||||
if (pc.isLongRunning() || pc.getLastUsedTime() > olderThanTime) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (pc.isLongRunning() || pc.getLastUsedTime() > olderThanTime) {
|
||||
// PooledConnection has been used recently or
|
||||
// expected to be longRunning so not closing...
|
||||
} else {
|
||||
|
||||
@@ -441,6 +441,7 @@ public class SqlTreeBuilder {
|
||||
|
||||
BeanPropertyAssocOne<?>[] propertiesOne = desc.propertiesOne();
|
||||
for (int i = 0; i < propertiesOne.length; i++) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (queryProps != null && queryProps.isIncludedBeanJoin(propertiesOne[i].getName())) {
|
||||
// if it is a joined bean... then don't add the property
|
||||
// as it will have its own entire Node in the SqlTree
|
||||
|
||||
@@ -91,18 +91,16 @@ public class CheckImmutable {
|
||||
// Check all fields defined in the class for type and if they are final
|
||||
Field[] objFields = cls.getDeclaredFields();
|
||||
for (int i = 0; i < objFields.length; i++) {
|
||||
if (Modifier.isStatic(objFields[i].getModifiers())) {
|
||||
// ignore static fields
|
||||
} else {
|
||||
if (!Modifier.isFinal(objFields[i].getModifiers())) {
|
||||
res.setReasonNotImmutable("Non final field " + cls + "." + objFields[i].getName());
|
||||
return false;
|
||||
}
|
||||
if (!isImmutable(objFields[i].getType(), res)) {
|
||||
res.setReasonNotImmutable("Non Immutable field type " + objFields[i].getType());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Modifier.isStatic(objFields[i].getModifiers())) {
|
||||
if (!Modifier.isFinal(objFields[i].getModifiers())) {
|
||||
res.setReasonNotImmutable("Non final field " + cls + "." + objFields[i].getName());
|
||||
return false;
|
||||
}
|
||||
if (!isImmutable(objFields[i].getType(), res)) {
|
||||
res.setReasonNotImmutable("Non Immutable field type " + objFields[i].getType());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+16
-18
@@ -162,24 +162,22 @@ public class ImmutableMetaFactory {
|
||||
private Method findGetter(Class<?> paramType, Method[] methods) {
|
||||
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (Modifier.isStatic(methods[i].getModifiers())) {
|
||||
|
||||
} else {
|
||||
if (methods[i].getParameterTypes().length == 0) {
|
||||
// could be a getter
|
||||
String methName = methods[i].getName();
|
||||
if (methName.equals("hashCode")){
|
||||
|
||||
} else if (methName.equals("toString")) {
|
||||
|
||||
} else {
|
||||
Class<?> returnType = methods[i].getReturnType();
|
||||
if (paramType.equals(returnType)){
|
||||
return methods[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Modifier.isStatic(methods[i].getModifiers())) {
|
||||
if (methods[i].getParameterTypes().length == 0) {
|
||||
// could be a getter
|
||||
String methName = methods[i].getName();
|
||||
if (methName.equals("hashCode")){
|
||||
|
||||
} else if (methName.equals("toString")) {
|
||||
|
||||
} else {
|
||||
Class<?> returnType = methods[i].getReturnType();
|
||||
if (paramType.equals(returnType)){
|
||||
return methods[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user