Skip to content

Commit

Permalink
Fix compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
leinardi committed Oct 16, 2023
1 parent 70d13de commit 52c30f8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 56 deletions.
85 changes: 41 additions & 44 deletions src/main/java/com/leinardi/pycharm/pylint/checker/Problem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import com.intellij.psi.PsiElement;
import com.leinardi.pycharm.pylint.PylintBundle;
import com.leinardi.pycharm.pylint.plapi.SeverityLevel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class Problem {
private final PsiElement target;
private final SeverityLevel severityLevel;
Expand Down Expand Up @@ -103,53 +102,51 @@ public boolean isSuppressErrors() {

@Override
public String toString() {
return new ToStringBuilder(this)
.append("target", target)
.append("message", message)
.append("messageId", messageId)
.append("severityLevel", severityLevel)
.append("line", line)
.append("column", column)
.append("symbol", symbol)
.append("afterEndOfLine", afterEndOfLine)
.append("suppressErrors", suppressErrors)
.toString();
}

@Override
public int hashCode() {
return new HashCodeBuilder()
.append(target)
.append(message)
.append(messageId)
.append(severityLevel)
.append(line)
.append(column)
.append(symbol)
.append(afterEndOfLine)
.append(suppressErrors)
.toHashCode();
return "Problem{" +
"target=" + target +
", severityLevel=" + severityLevel +
", line=" + line +
", column=" + column +
", symbol='" + symbol + '\'' +
", message='" + message + '\'' +
", messageId='" + messageId + '\'' +
", afterEndOfLine=" + afterEndOfLine +
", suppressErrors=" + suppressErrors +
'}';
}

@Override
public boolean equals(Object other) {
if (other == this) {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(other instanceof Problem)) {
if (!(o instanceof Problem)) {
return false;
}
Problem rhs = ((Problem) other);
return new EqualsBuilder()
.append(target, rhs.target)
.append(message, rhs.message)
.append(messageId, rhs.messageId)
.append(severityLevel, rhs.severityLevel)
.append(line, rhs.line)
.append(column, rhs.column)
.append(symbol, rhs.symbol)
.append(afterEndOfLine, rhs.afterEndOfLine)
.append(suppressErrors, rhs.suppressErrors)
.isEquals();
Problem problem = (Problem) o;
return line == problem.line &&
column == problem.column &&
afterEndOfLine == problem.afterEndOfLine &&
suppressErrors == problem.suppressErrors &&
Objects.equals(target, problem.target) &&
severityLevel == problem.severityLevel &&
Objects.equals(symbol, problem.symbol) &&
Objects.equals(message, problem.message) &&
Objects.equals(messageId, problem.messageId);
}

@Override
public int hashCode() {
return Objects.hash(
target,
severityLevel,
line,
column,
symbol,
message,
messageId,
afterEndOfLine,
suppressErrors
);
}
}
13 changes: 1 addition & 12 deletions src/main/java/com/leinardi/pycharm/pylint/plapi/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.leinardi.pycharm.pylint.plapi;

import com.squareup.moshi.Json;
import org.apache.commons.lang.builder.HashCodeBuilder;

import java.util.Objects;

Expand Down Expand Up @@ -134,17 +133,7 @@ public String toString() {

@Override
public int hashCode() {
return new HashCodeBuilder()
.append(message)
.append(module)
.append(symbol)
.append(path)
.append(column)
.append(line)
.append(obj)
.append(messageId)
.append(severityLevel)
.toHashCode();
return Objects.hash(severityLevel, module, obj, line, column, path, symbol, message, messageId);
}

@Override
Expand Down

0 comments on commit 52c30f8

Please sign in to comment.