Skip to content

Commit

Permalink
Merge pull request #504 from Feuermagier/remove-lombok
Browse files Browse the repository at this point in the history
Remove lombok
  • Loading branch information
Feuermagier authored Apr 19, 2024
2 parents a3d1a74 + ab98ba7 commit 5247452
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import de.firemage.autograder.core.LocalizedMessage;
import de.firemage.autograder.core.check.Check;
import lombok.Getter;

// TODO add executable check annotation and problem type
public class CopyPasteCheck implements Check {
@Getter
private final int tokenCount;

public CopyPasteCheck(int tokenCount) {
Expand All @@ -17,4 +15,8 @@ public CopyPasteCheck(int tokenCount) {
public LocalizedMessage getLinter() {
return new LocalizedMessage("linter-cpd");
}

public int getTokenCount() {
return tokenCount;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package de.firemage.autograder.core.compiler;

import de.firemage.autograder.core.LinterException;
import lombok.Getter;

import java.util.List;

public class CompilationFailureException extends LinterException {
@Getter
private final List<CompilationDiagnostic> diagnostics;

CompilationFailureException(List<CompilationDiagnostic> diagnostics) {
super(CompilationDiagnostic.formatMultiple(diagnostics));
this.diagnostics = diagnostics;
}

public List<CompilationDiagnostic> getDiagnostics() {
return diagnostics;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package de.firemage.autograder.core.integrated.graph;

import lombok.Getter;
import spoon.reflect.reference.CtTypeReference;

import java.util.Objects;

public sealed class Usage permits UsageAccessField, UsageCallMethod, UsageCreateInstance, UsageField {
@Getter

private final CtTypeReference<?> start;
@Getter
private final CtTypeReference<?> end;

public Usage(CtTypeReference<?> start, CtTypeReference<?> end) {
this.start = start;
this.end = end;
}

public CtTypeReference<?> getStart() {
return start;
}

public CtTypeReference<?> getEnd() {
return end;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package de.firemage.autograder.core.integrated.graph;

import lombok.Getter;
import spoon.reflect.declaration.CtField;
import spoon.reflect.reference.CtTypeReference;

import java.util.Objects;

public final class UsageAccessField extends Usage {
@Getter

private final CtField<?> field;

public UsageAccessField(CtTypeReference<?> start, CtTypeReference<?> end, CtField<?> field) {
super(start, end);
this.field = field;
}

public CtField<?> getField() {
return field;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package de.firemage.autograder.core.integrated.graph;

import lombok.Getter;
import spoon.reflect.declaration.CtMethod;
import spoon.reflect.reference.CtTypeReference;

import java.util.Objects;

public final class UsageCallMethod extends Usage {
@Getter

private final CtMethod<?> method;

public UsageCallMethod(CtTypeReference<?> start, CtTypeReference<?> end, CtMethod<?> method) {
super(start, end);
this.method = method;
}

public CtMethod<?> getMethod() {
return method;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package de.firemage.autograder.core.integrated.graph;

import lombok.Getter;
import spoon.reflect.declaration.CtConstructor;
import spoon.reflect.reference.CtTypeReference;

import java.util.Objects;

public final class UsageCreateInstance extends Usage {
@Getter

private final CtConstructor<?> constructor;

public UsageCreateInstance(CtTypeReference<?> start, CtTypeReference<?> end, CtConstructor<?> constructor) {
super(start, end);
this.constructor = constructor;
}

public CtConstructor<?> getConstructor() {
return constructor;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package de.firemage.autograder.core.integrated.graph;

import lombok.Getter;
import spoon.reflect.declaration.CtField;
import spoon.reflect.reference.CtTypeReference;

import java.util.Objects;

public final class UsageField extends Usage {
@Getter

private final CtField<?> field;

@Getter
private final int typeParameterIndex;

public UsageField(CtTypeReference<?> start, CtTypeReference<?> end, CtField<?> field, int typeParameterIndex) {
Expand All @@ -19,6 +16,14 @@ public UsageField(CtTypeReference<?> start, CtTypeReference<?> end, CtField<?> f
this.typeParameterIndex = typeParameterIndex;
}

public CtField<?> getField() {
return field;
}

public int getTypeParameterIndex() {
return typeParameterIndex;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
package de.firemage.autograder.core.pmd;

import de.firemage.autograder.core.Problem;
import de.firemage.autograder.core.file.FileSourceInfo;
import de.firemage.autograder.core.file.SourceInfo;
import lombok.extern.slf4j.Slf4j;
import net.sourceforge.pmd.Report;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.renderers.AbstractIncrementingRenderer;
import org.apache.commons.io.output.NullWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

@Slf4j
public class ProblemRenderer extends AbstractIncrementingRenderer {
private static final Logger LOG = LoggerFactory.getLogger(FileSourceInfo.class);

private final SourceInfo sourceInfo;
private final Map<String, PMDCheck> checks;
private final List<Problem> problems = new ArrayList<>();
Expand Down Expand Up @@ -51,7 +55,7 @@ public void end() {
//TODO Don't ignore processing errors (via Report.ProcessingError)

for (Report.ConfigurationError error : configErrors) {
log.error("PMD config error: " + error.issue());
LOG.error("PMD config error: " + error.issue());
}
}

Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
</properties>

<dependencies>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down

0 comments on commit 5247452

Please sign in to comment.