Skip to content

Commit

Permalink
Removed checkstyle warnings from drools-codebase (#5566)
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza authored Oct 31, 2023
1 parent 827a21f commit 388598a
Show file tree
Hide file tree
Showing 56 changed files with 444 additions and 254 deletions.
36 changes: 27 additions & 9 deletions drools-base/src/main/java/org/drools/base/base/AccessorKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,40 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if ( this == obj ) return true;
if ( obj == null ) return false;
if ( getClass() != obj.getClass() ) return false;
if ( this == obj ) {
return true;
}
if ( obj == null ) {
return false;
}
if ( getClass() != obj.getClass() ) {
return false;
}
AccessorKey other = (AccessorKey) obj;

if ( className == null ) {
if ( other.className != null ) return false;
} else if ( !className.equals( other.className ) ) return false;
if ( other.className != null ) {
return false;
}
} else if ( !className.equals( other.className ) ) {
return false;
}

if ( fieldName == null ) {
if ( other.fieldName != null ) return false;
} else if ( !fieldName.equals( other.fieldName ) ) return false;
if ( other.fieldName != null ) {
return false;
}
} else if ( !fieldName.equals( other.fieldName ) ) {
return false;
}

if ( type == null ) {
if ( other.type != null ) return false;
} else if ( !type.equals( other.type ) ) return false;
if ( other.type != null ) {
return false;
}
} else if ( !type.equals( other.type ) ) {
return false;
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
*/
package org.drools.base.base;

import org.drools.base.common.DroolsObjectInput;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.util.ClassUtils;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import org.drools.base.common.DroolsObjectInput;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.util.ClassUtils;

/**
* This is the supertype for the ASM generated classes for accessing a field.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.reteoo.BaseTuple;
import org.drools.base.rule.accessor.Enabled;
import org.drools.base.rule.Declaration;
import org.drools.base.rule.accessor.Enabled;

public class EnabledBoolean
implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import java.io.ObjectOutput;
import java.lang.reflect.Method;

import org.drools.base.base.ClassWireable;
import org.drools.base.base.ValueResolver;
import org.drools.base.base.ValueType;
import org.drools.base.rule.accessor.AcceptsReadAccessor;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.base.base.ValueType;
import org.drools.base.base.ClassWireable;
import org.drools.util.ClassUtils;
import org.drools.util.StringUtils;

Expand Down Expand Up @@ -192,14 +192,26 @@ public int hashCode() {
}

public boolean equals(Object obj) {
if ( this == obj ) return true;
if ( obj == null ) return false;
if ( getClass() != obj.getClass() ) return false;
if ( this == obj ) {
return true;
}
if ( obj == null ) {
return false;
}
if ( getClass() != obj.getClass() ) {
return false;
}
final ArrayElementReader other = (ArrayElementReader) obj;
if ( arrayReadAccessor == null ) {
if ( other.arrayReadAccessor != null ) return false;
} else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) return false;
if ( index != other.index ) return false;
if ( other.arrayReadAccessor != null ) {
return false;
}
} else if ( !arrayReadAccessor.equals( other.arrayReadAccessor ) ) {
return false;
}
if ( index != other.index ) {
return false;
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.lang.reflect.Method;
import java.util.Date;

import org.drools.base.base.ValueResolver;
import org.drools.base.base.BaseClassFieldReader;
import org.drools.base.base.ValueResolver;
import org.drools.base.base.ValueType;

public abstract class BaseObjectClassFieldReader extends BaseClassFieldReader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
package org.drools.base.common;

import org.drools.base.RuleBase;

import java.io.ObjectInput;

import org.drools.base.RuleBase;

public interface DroolsObjectInput extends ObjectInput {
ClassLoader getParentClassLoader();
ClassLoader getClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
import java.util.Map;
import java.util.function.Consumer;

import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.base.RuleBase;
import org.drools.base.base.AccessorKey;
import org.drools.base.base.ReadAccessorSupplier;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.util.ClassUtils;
import org.drools.base.RuleBase;

public class DroolsObjectInputStream extends ObjectInputStream
implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/
package org.drools.base.common;

import org.drools.util.ObjectPool;
import org.kie.internal.concurrent.ExecutorProviderFactory;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;

import org.drools.util.ObjectPool;
import org.kie.internal.concurrent.ExecutorProviderFactory;

public class PartitionsManager {

public static final int MIN_PARALLEL_THRESHOLD = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
import java.util.Map;
import java.util.Set;

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.facttemplates.FactTemplate;
import org.drools.base.rule.ImportDeclaration;
import org.drools.base.rule.TypeDeclaration;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.base.ruleunit.RuleUnitDescriptionLoader;
import org.drools.base.RuleBase;
import org.drools.base.base.AcceptsClassObjectType;
import org.drools.base.base.ObjectType;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.facttemplates.FactTemplate;
import org.drools.base.rule.DialectRuntimeRegistry;
import org.drools.base.rule.Function;
import org.drools.base.rule.ImportDeclaration;
import org.drools.base.rule.TypeDeclaration;
import org.drools.base.rule.WindowDeclaration;
import org.drools.base.rule.accessor.AcceptsReadAccessor;
import org.drools.base.rule.accessor.ReadAccessor;
import org.drools.base.ruleunit.RuleUnitDescriptionLoader;
import org.drools.util.TypeResolver;
import org.kie.api.definition.KiePackage;
import org.kie.api.definition.process.Process;
import org.drools.base.RuleBase;
import org.kie.api.definition.type.FactType;
import org.kie.api.io.Resource;
import org.kie.api.runtime.rule.AccumulateFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;

import org.drools.base.rule.DialectRuntimeData;
import org.drools.base.rule.DuplicateRuleNameException;
import org.drools.base.rule.ImportDeclaration;
import org.drools.base.rule.InvalidRuleException;
import org.drools.base.rule.InvalidRulePackage;
import org.drools.base.rule.TypeDeclaration;
import org.drools.base.util.CloneUtil;
import org.drools.base.RuleBase;
import org.drools.base.common.DroolsObjectInputStream;
import org.drools.base.common.DroolsObjectOutputStream;
import org.drools.base.definitions.InternalKnowledgePackage;
Expand All @@ -52,10 +46,17 @@
import org.drools.base.definitions.rule.impl.GlobalImpl;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.facttemplates.FactTemplate;
import org.drools.base.rule.DialectRuntimeData;
import org.drools.base.rule.DialectRuntimeRegistry;
import org.drools.base.rule.DuplicateRuleNameException;
import org.drools.base.rule.Function;
import org.drools.base.rule.ImportDeclaration;
import org.drools.base.rule.InvalidRuleException;
import org.drools.base.rule.InvalidRulePackage;
import org.drools.base.rule.TypeDeclaration;
import org.drools.base.rule.WindowDeclaration;
import org.drools.base.ruleunit.RuleUnitDescriptionLoader;
import org.drools.base.util.CloneUtil;
import org.drools.util.ClassTypeResolver;
import org.drools.util.ClassUtils;
import org.drools.util.TypeResolver;
Expand All @@ -64,7 +65,6 @@
import org.kie.api.definition.rule.Global;
import org.kie.api.definition.rule.Query;
import org.kie.api.definition.rule.Rule;
import org.drools.base.RuleBase;
import org.kie.api.definition.type.FactType;
import org.kie.api.io.Resource;
import org.kie.api.io.ResourceType;
Expand Down Expand Up @@ -766,7 +766,9 @@ public List<Process> removeProcessesGeneratedFromResource(Resource resource) {

private void removeProcess(Process process) {
ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2);
if (rtp != null) rtp.remove(process.getId());
if (rtp != null) {
rtp.remove(process.getId());
}
}

private List<Process> getProcessesGeneratedFromResource(Resource resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/
package org.drools.base.definitions.rule.impl;

import org.kie.api.definition.rule.Global;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import org.kie.api.definition.rule.Global;

public class GlobalImpl implements Global, Externalizable {

private String name;
Expand Down Expand Up @@ -64,13 +64,21 @@ public void setType(String type) {
}

public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

GlobalImpl global = (GlobalImpl) o;

if (name != null ? !name.equals(global.name) : global.name != null) return false;
if (type != null ? !type.equals(global.type) : global.type != null) return false;
if (name != null ? !name.equals(global.name) : global.name != null) {
return false;
}
if (type != null ? !type.equals(global.type) : global.type != null) {
return false;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import java.util.function.Function;

import org.drools.base.base.DroolsQuery;
import org.drools.base.base.ObjectType;
import org.drools.base.base.ValueResolver;
import org.drools.base.rule.Declaration;
import org.drools.base.base.ObjectType;
import org.kie.api.definition.rule.Query;
import org.kie.api.runtime.rule.Match;

Expand Down
Loading

0 comments on commit 388598a

Please sign in to comment.