Skip to content

Commit

Permalink
[kie-issues #658] Remove checkstyle warnings from drools core module (#…
Browse files Browse the repository at this point in the history
…5569)

* Fixed order of imports

* Fixed more checkstyle issues
  • Loading branch information
pibizza authored Oct 31, 2023
1 parent 388598a commit 512cd5c
Show file tree
Hide file tree
Showing 254 changed files with 1,280 additions and 967 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package org.drools.core;

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.rule.GroupElement;
import org.drools.core.reteoo.LeftTupleSource;
import org.drools.core.reteoo.TerminalNode;
import org.drools.core.reteoo.builder.BuildContext;
import org.drools.base.rule.GroupElement;

public interface ActivationListenerFactory {
TerminalNode createActivationListener(int id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,12 @@ public final String getInternalProperty(String name) {

@Override
public final 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;
}

FlowSessionConfiguration that = (FlowSessionConfiguration) o;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
package org.drools.core;

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.rule.GroupElement;
import org.drools.core.reteoo.CoreComponentFactory;
import org.drools.core.reteoo.LeftTupleSource;
import org.drools.core.reteoo.TerminalNode;
import org.drools.core.reteoo.builder.BuildContext;
import org.drools.base.rule.GroupElement;

public class QueryActivationListenerFactory implements ActivationListenerFactory {
public static final QueryActivationListenerFactory INSTANCE = new QueryActivationListenerFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.util.NoSuchElementException;
import java.util.Set;

import org.drools.base.rule.Declaration;
import org.drools.core.base.QueryRowWithSubruleIndex;
import org.drools.core.common.ReteEvaluator;
import org.drools.base.rule.Declaration;
import org.kie.api.runtime.rule.QueryResults;
import org.kie.api.runtime.rule.QueryResultsRow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import java.util.Map;

import org.drools.base.rule.Declaration;
import org.drools.core.base.QueryRowWithSubruleIndex;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.ReteEvaluator;
import org.drools.base.rule.Declaration;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.api.runtime.rule.QueryResultsRow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
package org.drools.core;

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.rule.GroupElement;
import org.drools.core.reteoo.CoreComponentFactory;
import org.drools.core.reteoo.LeftTupleSource;
import org.drools.core.reteoo.TerminalNode;
import org.drools.core.reteoo.builder.BuildContext;
import org.drools.base.rule.GroupElement;

public class RuleActivationListenerFactory implements ActivationListenerFactory {

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

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.Map;

import org.drools.base.rule.consequence.ConflictResolver;
import org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler;
import org.drools.util.StringUtils;
Expand Down Expand Up @@ -52,13 +59,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.Map;

/**
* RuleBaseConfiguration
*
Expand Down Expand Up @@ -878,7 +878,9 @@ private AssertBehaviour(final int value) {
}

public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == this) {
return true;
}
else if (obj instanceof AssertBehaviour) {
AssertBehaviour that = (AssertBehaviour) obj;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,12 @@ public String getInternalProperty(String name) {

@Override
public final 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;
}

RuleSessionConfiguration that = (RuleSessionConfiguration) o;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,12 @@ public TimerService createTimerService() {

@Override
public final 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;
}

SessionConfiguration that = (SessionConfiguration) o;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ public TimerJobFactoryManager createInstance() {
private static final Map<String, TimerJobFactoryType> registry = new HashMap<>();

static {
register(DEFAULT);
register(TRACKABLE);
register(THREAD_SAFE_TRACKABLE);
register(JPA);
register(DEFAULT);
register(TRACKABLE);
register(THREAD_SAFE_TRACKABLE);
register(JPA);
}

public static void register(TimerJobFactoryType type) {
if (type != null && type.getId() != null) {
registry.put(type.getId(), type);
}
if (type != null && type.getId() != null) {
registry.put(type.getId(), type);
}
}

public abstract TimerJobFactoryManager createInstance();
Expand All @@ -95,7 +95,7 @@ public String getId() {
public static TimerJobFactoryType resolveTimerJobFactoryType( String id ) {
TimerJobFactoryType type = registry.get(id);
if (type != null) {
return type;
return type;
}
throw new IllegalArgumentException( "Illegal enum value '" + id + "' for TimerJobFactoryType" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import java.util.Iterator;
import java.util.Map;

import org.drools.base.rule.accessor.GlobalResolver;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.ReteEvaluator;
import org.drools.base.rule.accessor.GlobalResolver;
import org.kie.api.runtime.Environment;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkItemManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@
*/
package org.drools.core;


import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.rule.EntryPointId;
import org.drools.core.common.ObjectStore;
import org.drools.core.common.ObjectTypeConfigurationRegistry;
import org.drools.core.common.ReteEvaluator;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.core.impl.InternalRuleBase;
import org.drools.core.reteoo.EntryPointNode;
import org.drools.core.reteoo.TerminalNode;
import org.drools.base.rule.EntryPointId;
import org.drools.core.rule.consequence.InternalMatch;
import org.drools.core.rule.accessor.FactHandleFactory;
import org.drools.core.rule.consequence.InternalMatch;
import org.drools.util.bitmask.BitMask;
import org.kie.api.runtime.rule.EntryPoint;
import org.kie.api.runtime.rule.FactHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.ArrayList;
import java.util.List;

import org.drools.core.common.ReteEvaluator;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.core.common.ReteEvaluator;
import org.drools.core.reteoo.LeftTuple;
import org.drools.core.reteoo.LeftTupleNode;
import org.drools.core.reteoo.QueryTerminalNode;
Expand Down
17 changes: 13 additions & 4 deletions drools-core/src/main/java/org/drools/core/base/ArrayElements.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.drools.core.base;

import java.util.Arrays;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
Expand Down Expand Up @@ -59,12 +60,20 @@ 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;
}
ArrayElements other = (ArrayElements) obj;
if ( !Arrays.equals( elements,
other.elements ) ) return false;
other.elements ) ) {
return false;
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,23 @@ public int hashCode() {
}

public boolean equals(Object obj) {
if ( this == obj ) return true;
if ( obj == null ) return false;
if ( !(obj instanceof ClassObjectTypeKey) ) return false;
if ( this == obj ) {
return true;
}
if ( obj == null ) {
return false;
}
if ( !(obj instanceof ClassObjectTypeKey) ) {
return false;
}
ClassObjectTypeKey other = (ClassObjectTypeKey) obj;
if ( cls == null ) {
if ( other.cls != null ) return false;
} else if ( !cls.equals( other.cls ) ) return false;
if ( other.cls != null ) {
return false;
}
} else if ( !cls.equals( other.cls ) ) {
return false;
}
return event == other.event;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import java.util.List;

import org.drools.base.base.DroolsQuery;
import org.drools.base.definitions.rule.impl.QueryImpl;
import org.drools.core.common.TupleSets;
import org.drools.core.common.WorkingMemoryAction;
import org.drools.core.phreak.StackEntry;
import org.drools.core.reteoo.LeftTuple;
import org.drools.core.reteoo.LeftTupleSink;
import org.drools.core.reteoo.PathMemory;
import org.drools.core.reteoo.QueryElementNode.QueryElementNodeMemory;
import org.drools.base.definitions.rule.impl.QueryImpl;
import org.drools.core.util.index.TupleList;
import org.kie.api.runtime.rule.Variable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import java.util.List;

import org.drools.core.common.ReteEvaluator;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.core.common.ReteEvaluator;
import org.drools.core.reteoo.LeftTuple;

public interface InternalViewChangedEventListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.drools.core.base;

import org.drools.core.common.InternalFactHandle;
import org.kie.api.runtime.rule.FactHandle;

public class NonCloningQueryViewListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.drools.core.base;

import org.drools.core.common.InternalFactHandle;
import org.kie.api.runtime.rule.FactHandle;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

import java.util.Collection;

import org.drools.core.common.InternalFactHandle;
import org.drools.base.beliefsystem.Mode;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.base.factmodel.traits.Thing;
import org.drools.base.factmodel.traits.TraitableBean;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.reteoo.TerminalNode;
import org.drools.core.rule.consequence.InternalMatch;
import org.drools.util.bitmask.BitMask;
import org.drools.base.beliefsystem.Mode;

public interface TraitHelper {

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

import org.drools.core.reteoo.LeftTuple;
import org.drools.base.rule.Collect;
import org.drools.base.rule.Declaration;
import org.drools.base.rule.accessor.Accumulator;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
Expand All @@ -32,6 +27,10 @@

import org.drools.base.base.ValueResolver;
import org.drools.base.reteoo.BaseTuple;
import org.drools.base.rule.Collect;
import org.drools.base.rule.Declaration;
import org.drools.base.rule.accessor.Accumulator;
import org.drools.core.reteoo.LeftTuple;
import org.kie.api.runtime.rule.FactHandle;

/**
Expand Down
Loading

0 comments on commit 512cd5c

Please sign in to comment.