Skip to content

Commit

Permalink
refactor: Enum values should be compared with "=="
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Dec 24, 2024
1 parent 3425b85 commit ea8167f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public Xml.Document visitDocument(Xml.Document document, ExecutionContext ctx) {
for (ResolvedDependency dependency : entry.getValue()) {
if (groupId.equals(dependency.getGroupId()) && artifactId.equals(dependency.getArtifactId())) {
maxScope = Scope.maxPrecedence(maxScope, entry.getKey());
if (Scope.Compile.equals(maxScope)) {
if (Scope.Compile == maxScope) {
return maxScope;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static boolean isSingleVariableDefinition(J.VariableDeclarations vd) {
TypeTree typeExpression = vd.getTypeExpression();

boolean definesSingleVariable = vd.getVariables().size() == 1;
boolean isPureAssigment = JavaType.Primitive.Null.equals(vd.getType());
boolean isPureAssigment = JavaType.Primitive.Null == vd.getType();
if (!definesSingleVariable || isPureAssigment) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ private Expression expandWithPrimitivTypeHint(J.VariableDeclarations vd, Express
return initializer;
}

boolean isLongLiteral = JavaType.Primitive.Long.equals(vd.getType());
boolean isLongLiteral = JavaType.Primitive.Long == vd.getType();
boolean inferredAsLong = valueSource.endsWith("l") || valueSource.endsWith("L");
boolean isFloatLiteral = JavaType.Primitive.Float.equals(vd.getType());
boolean isFloatLiteral = JavaType.Primitive.Float == vd.getType();
boolean inferredAsFloat = valueSource.endsWith("f") || valueSource.endsWith("F");
boolean isDoubleLiteral = JavaType.Primitive.Double.equals(vd.getType());
boolean isDoubleLiteral = JavaType.Primitive.Double == vd.getType();
boolean inferredAsDouble = valueSource.endsWith("d") || valueSource.endsWith("D") || valueSource.contains(".");

String typNotation = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex
private boolean isRelevantClass(J.ClassDeclaration classDeclaration) {
List<J.Annotation> allAnnotations = classDeclaration.getAllAnnotations();
return classDeclaration.getType() != null &&
!J.ClassDeclaration.Kind.Type.Record.equals(classDeclaration.getKind()) &&
J.ClassDeclaration.Kind.Type.Record != classDeclaration.getKind() &&
hasMatchingAnnotations(classDeclaration) &&
!hasGenericTypeParameter(classDeclaration) &&
classDeclaration.getBody().getStatements().stream().allMatch(this::isRecordCompatibleField) &&
Expand Down

0 comments on commit ea8167f

Please sign in to comment.