From 824bd56b602c30652cf1495029bc115880f0353d Mon Sep 17 00:00:00 2001 From: Florian Seligmann Date: Wed, 17 Apr 2024 14:48:53 +0200 Subject: [PATCH 1/3] remove dynamic analysis (for now) --- autograder-agent/pom.xml | 71 ------ .../autograder/agent/AnalysisAgent.java | 11 - .../agent/ClassInstrumentationVisitor.java | 29 --- .../autograder/agent/ClassTransformer.java | 31 --- .../autograder/agent/EventRecorder.java | 150 ------------ .../agent/MethodInstrumentationVisitor.java | 141 ----------- .../firemage/autograder/cmd/Application.java | 11 - autograder-core/pom.xml | 72 ------ .../de/firemage/autograder/core/Linter.java | 17 -- .../autograder/core/LinterStatus.java | 2 - .../firemage/autograder/core/ProblemType.java | 2 - .../core/check/api/AvoidStringConcat.java | 3 +- .../autograder/core/check/api/CharRange.java | 3 +- .../check/api/CheckIterableDuplicates.java | 3 +- .../core/check/api/CollectionAddAll.java | 3 +- .../core/check/api/CollectionsNCopies.java | 3 +- .../api/EqualsHashCodeComparableContract.java | 3 +- .../core/check/api/ImplementComparable.java | 3 +- .../api/IsEmptyReimplementationCheck.java | 3 +- .../core/check/api/MathReimplementation.java | 3 +- .../core/check/api/OldCollectionCheck.java | 3 +- .../core/check/api/OptionalBadPractices.java | 3 +- .../core/check/api/SimplifyArraysFill.java | 3 +- .../core/check/api/StringRepeat.java | 4 +- .../core/check/api/UseArrayCopy.java | 4 +- .../core/check/api/UseArraysFill.java | 4 +- .../core/check/api/UseEntrySet.java | 3 +- .../core/check/api/UseEnumCollection.java | 3 +- .../core/check/api/UseEnumValues.java | 3 +- .../core/check/api/UseFormatString.java | 3 +- .../core/check/api/UseModuloOperator.java | 3 +- .../core/check/api/UseStringFormatted.java | 3 +- .../autograder/core/check/api/UseSubList.java | 4 +- .../check/comment/CommentLanguageCheck.java | 3 +- .../check/comment/CommentedOutCodeCheck.java | 4 +- .../core/check/comment/FieldJavadocCheck.java | 3 +- .../check/comment/JavadocReturnNullCheck.java | 58 ----- .../core/check/comment/JavadocStubCheck.java | 3 +- .../check/comment/MethodJavadocCheck.java | 3 +- .../check/comment/ThrowsJavadocCheck.java | 3 +- .../core/check/comment/TodoComment.java | 3 +- .../core/check/comment/TypeJavadocCheck.java | 3 +- .../check/comment/UnnecessaryComment.java | 3 +- .../core/check/complexity/ChainedIfCheck.java | 3 +- .../check/complexity/ExtendsObjectCheck.java | 3 +- .../core/check/complexity/MultiThreading.java | 3 +- .../complexity/MultipleInlineStatements.java | 3 +- .../check/complexity/RedundantAssignment.java | 3 +- .../complexity/RedundantBooleanEqual.java | 3 +- .../core/check/complexity/RedundantCatch.java | 3 +- .../complexity/RedundantConstructorCheck.java | 3 +- .../core/check/complexity/RedundantElse.java | 3 +- .../RedundantIfForBooleanCheck.java | 3 +- .../check/complexity/RedundantModifier.java | 3 +- .../complexity/RedundantNegationCheck.java | 3 +- .../RedundantUninitializedVariable.java | 3 +- .../check/complexity/RedundantVariable.java | 3 +- .../core/check/complexity/RegexCheck.java | 3 +- .../RepeatedMathOperationCheck.java | 3 +- .../check/complexity/SelfAssignmentCheck.java | 3 +- .../check/complexity/TooManyExceptions.java | 3 +- .../check/complexity/TryCatchComplexity.java | 3 +- .../check/complexity/UnnecessaryBoxing.java | 3 +- .../core/check/complexity/UnusedImport.java | 3 +- .../complexity/UseOperatorAssignment.java | 3 +- .../complexity/WrapperInstantiationCheck.java | 3 +- .../core/check/debug/AssertCheck.java | 3 +- .../check/debug/PrintStackTraceCheck.java | 3 +- .../CustomExceptionInheritanceCheck.java | 3 +- .../exceptions/ExceptionControlFlowCheck.java | 3 +- .../exceptions/ExceptionMessageCheck.java | 4 +- .../NumberFormatExceptionIgnored.java | 3 +- .../RuntimeExceptionCatchCheck.java | 3 +- .../core/check/general/AvoidLabels.java | 3 +- .../check/general/AvoidRecompilingRegex.java | 3 +- .../core/check/general/AvoidShadowing.java | 3 +- .../core/check/general/BinaryOperator.java | 3 +- .../core/check/general/CompareCharValue.java | 3 +- .../CompareObjectsNotStringsCheck.java | 3 +- .../ConstantNamingAndQualifierCheck.java | 4 +- .../core/check/general/DoNotUseRawTypes.java | 3 +- .../check/general/FieldShouldBeFinal.java | 3 +- .../general/FieldShouldBeLocalCheck.java | 57 ----- .../core/check/general/ForToForEachLoop.java | 4 +- .../core/check/general/ImportTypes.java | 3 +- .../core/check/general/MagicString.java | 3 +- .../core/check/general/ObjectDatatype.java | 3 +- .../general/OverrideAnnotationMissing.java | 3 +- .../general/ReassignedParameterCheck.java | 3 +- .../check/general/ScannerClosedCheck.java | 3 +- .../check/general/StringCompareCheck.java | 3 +- .../check/general/SuppressWarningsCheck.java | 3 +- .../general/SystemSpecificLineBreak.java | 3 +- .../core/check/general/UncheckedTypeCast.java | 3 +- .../check/general/UseDifferentVisibility.java | 3 +- .../core/check/general/UseGuardClauses.java | 3 +- .../check/naming/BooleanIdentifierCheck.java | 3 +- .../ConstantsHaveDescriptiveNamesCheck.java | 3 +- .../check/naming/LinguisticNamingCheck.java | 4 +- .../check/naming/PackageNamingConvention.java | 3 +- .../TypesHaveDescriptiveNamesCheck.java | 3 +- .../VariablesHaveDescriptiveNamesCheck.java | 4 +- .../core/check/oop/AvoidInnerClasses.java | 3 +- .../core/check/oop/CheckStaticBlocks.java | 3 +- .../core/check/oop/ClosedSetOfValues.java | 3 +- .../check/oop/ConcreteCollectionCheck.java | 3 +- .../check/oop/DoNotMakeConstantsClasses.java | 3 +- .../core/check/oop/DoNotUseSystemExit.java | 3 +- .../core/check/oop/IOUISeparation.java | 3 +- .../check/oop/InheritanceBadPractices.java | 4 +- .../autograder/core/check/oop/InstanceOf.java | 3 +- .../core/check/oop/InterfaceBadPractices.java | 3 +- .../core/check/oop/ListGetterSetterCheck.java | 3 +- .../oop/MethodShouldBeAbstractCheck.java | 3 +- .../core/check/oop/MutableEnum.java | 3 +- .../core/check/oop/ShouldBeEnumAttribute.java | 3 +- .../oop/StaticFieldShouldBeInstanceCheck.java | 3 +- .../core/check/oop/UtilityClassCheck.java | 3 +- .../check/structure/DefaultPackageCheck.java | 3 +- .../check/structure/TooFewPackagesCheck.java | 3 +- .../check/unnecessary/EmptyBlockCheck.java | 3 +- .../unnecessary/UnusedCodeElementCheck.java | 3 +- .../core/dynamic/ConsoleRunner.java | 116 --------- .../core/dynamic/DockerConsoleRunner.java | 227 ------------------ .../core/dynamic/DockerRunnerException.java | 9 - .../core/dynamic/DynamicAnalysis.java | 69 ------ .../core/dynamic/RunnerException.java | 20 -- .../core/dynamic/TestRunResult.java | 12 - .../autograder/core/dynamic/TestRunner.java | 4 - .../core/integrated/IntegratedAnalysis.java | 26 -- .../core/integrated/IntegratedCheck.java | 7 +- .../autograder/core/dynamic/Dockerfile | 12 - .../src/main/resources/strings.de.ftl | 6 - .../src/main/resources/strings.en.ftl | 6 - .../firemage/autograder/core/CheckTest.java | 13 +- .../autograder/core/TestLocalizedStrings.java | 2 - .../core/framework/TestFramework.java | 5 +- .../autograder/core/framework/TestInput.java | 9 - .../FieldShouldBeLocal/code/Test.java | 34 --- .../check_tests/FieldShouldBeLocal/config.txt | 4 - .../FieldShouldBeLocal/tests/test.protocol | 4 - .../JavadocReturnNull/code/Test.java | 104 -------- .../check_tests/JavadocReturnNull/config.txt | 4 - .../JavadocReturnNull/tests/test.protocol | 4 - autograder-event/pom.xml | 16 -- .../de/firemage/autograder/event/Event.java | 48 ---- .../autograder/event/GetFieldEvent.java | 55 ----- .../autograder/event/MethodEnterEvent.java | 36 --- .../autograder/event/MethodEvent.java | 7 - .../event/MethodExitThrowEvent.java | 43 ---- .../event/PrimitiveReturnEvent.java | 42 ---- .../autograder/event/PutFieldEvent.java | 55 ----- .../event/ReferenceReturnEvent.java | 43 ---- autograder-executor/pom.xml | 69 ------ .../autograder/executor/ConsoleExecutor.java | 171 ------------- .../de/firemage/autograder/executor/Main.java | 16 -- .../de/firemage/autograder/executor/Util.java | 26 -- pom.xml | 21 -- sample_config.yaml | 2 - 159 files changed, 125 insertions(+), 2212 deletions(-) delete mode 100644 autograder-agent/pom.xml delete mode 100644 autograder-agent/src/main/java/de/firemage/autograder/agent/AnalysisAgent.java delete mode 100644 autograder-agent/src/main/java/de/firemage/autograder/agent/ClassInstrumentationVisitor.java delete mode 100644 autograder-agent/src/main/java/de/firemage/autograder/agent/ClassTransformer.java delete mode 100644 autograder-agent/src/main/java/de/firemage/autograder/agent/EventRecorder.java delete mode 100644 autograder-agent/src/main/java/de/firemage/autograder/agent/MethodInstrumentationVisitor.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocReturnNullCheck.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeLocalCheck.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/ConsoleRunner.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerConsoleRunner.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerRunnerException.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DynamicAnalysis.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/RunnerException.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunResult.java delete mode 100644 autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunner.java delete mode 100644 autograder-core/src/main/resources/de/firemage/autograder/core/dynamic/Dockerfile delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/code/Test.java delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/config.txt delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/tests/test.protocol delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/code/Test.java delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/config.txt delete mode 100644 autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/tests/test.protocol delete mode 100644 autograder-event/pom.xml delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/Event.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/GetFieldEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/MethodEnterEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/MethodEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/MethodExitThrowEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/PrimitiveReturnEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/PutFieldEvent.java delete mode 100644 autograder-event/src/main/java/de/firemage/autograder/event/ReferenceReturnEvent.java delete mode 100644 autograder-executor/pom.xml delete mode 100644 autograder-executor/src/main/java/de/firemage/autograder/executor/ConsoleExecutor.java delete mode 100644 autograder-executor/src/main/java/de/firemage/autograder/executor/Main.java delete mode 100644 autograder-executor/src/main/java/de/firemage/autograder/executor/Util.java diff --git a/autograder-agent/pom.xml b/autograder-agent/pom.xml deleted file mode 100644 index 197d02d1..00000000 --- a/autograder-agent/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - autograder-parent - de.firemage.autograder - 0.5.35 - - - 4.0.0 - autograder-agent - autograder-agent - Test runtime of the Autograder - https://github.com/Feuermagier/autograder/autograder-agent - - - - - de.firemage.autograder - autograder-event - - - - - org.ow2.asm - asm - ${asm.version} - - - - org.ow2.asm - asm-commons - ${asm.version} - - - - org.ow2.asm - asm-util - ${asm.version} - - - - - - - maven-assembly-plugin - - - - de.firemage.autograder.agent.AnalysisAgent - - - - jar-with-dependencies - - agent - - - - make-assembly - - single - - compile - - - - - - \ No newline at end of file diff --git a/autograder-agent/src/main/java/de/firemage/autograder/agent/AnalysisAgent.java b/autograder-agent/src/main/java/de/firemage/autograder/agent/AnalysisAgent.java deleted file mode 100644 index a933a9ac..00000000 --- a/autograder-agent/src/main/java/de/firemage/autograder/agent/AnalysisAgent.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.firemage.autograder.agent; - -import java.lang.instrument.Instrumentation; -import java.nio.file.Path; - -public class AnalysisAgent { - public static void premain(String args, Instrumentation instrumentation) { - EventRecorder.setOutPath(Path.of("/home/student/codelinter_events.txt")); - instrumentation.addTransformer(new ClassTransformer()); - } -} diff --git a/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassInstrumentationVisitor.java b/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassInstrumentationVisitor.java deleted file mode 100644 index a46f247f..00000000 --- a/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassInstrumentationVisitor.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.firemage.autograder.agent; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -public class ClassInstrumentationVisitor extends ClassVisitor { - private String name; - - public ClassInstrumentationVisitor(ClassVisitor visitor) { - super(Opcodes.ASM9, visitor); - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - this.name = name; - super.visit(version, access, name, signature, superName, interfaces); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { - MethodVisitor visitor = super.visitMethod(access, name, descriptor, signature, exceptions); - if ((access & Opcodes.ACC_ABSTRACT) != 0 || (access & Opcodes.ACC_SYNTHETIC) != 0) { - return visitor; - } else { - return new MethodInstrumentationVisitor(visitor, access, name, descriptor, this.name); - } - } -} diff --git a/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassTransformer.java b/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassTransformer.java deleted file mode 100644 index 9275902f..00000000 --- a/autograder-agent/src/main/java/de/firemage/autograder/agent/ClassTransformer.java +++ /dev/null @@ -1,31 +0,0 @@ -package de.firemage.autograder.agent; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; - -import java.lang.instrument.ClassFileTransformer; -import java.security.ProtectionDomain; - -public class ClassTransformer implements ClassFileTransformer { - @Override - public byte[] transform(ClassLoader classLoader, String className, Class clazz, ProtectionDomain domain, - byte[] buffer) { - // Don't modify JDK classes - if (className.startsWith("java/") || className.startsWith("sun/") || className.startsWith("jdk/")) { - return buffer; - } - - // Don't modify classes of the Autograder Framework (excluding tests in check_tests) - if (className.startsWith("de/firemage/autograder") && !className.contains("check_tests")) { - return buffer; - } - - System.out.println("AGENT: Modifying class " + className); - - ClassReader reader = new ClassReader(buffer); - ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES); - ClassInstrumentationVisitor classVisitor = new ClassInstrumentationVisitor(writer); - reader.accept(classVisitor, ClassReader.EXPAND_FRAMES); - return writer.toByteArray(); - } -} diff --git a/autograder-agent/src/main/java/de/firemage/autograder/agent/EventRecorder.java b/autograder-agent/src/main/java/de/firemage/autograder/agent/EventRecorder.java deleted file mode 100644 index b3ebe696..00000000 --- a/autograder-agent/src/main/java/de/firemage/autograder/agent/EventRecorder.java +++ /dev/null @@ -1,150 +0,0 @@ -package de.firemage.autograder.agent; - -import de.firemage.autograder.event.Event; -import de.firemage.autograder.event.GetFieldEvent; -import de.firemage.autograder.event.MethodEnterEvent; -import de.firemage.autograder.event.MethodExitThrowEvent; -import de.firemage.autograder.event.PrimitiveReturnEvent; -import de.firemage.autograder.event.PutFieldEvent; -import de.firemage.autograder.event.ReferenceReturnEvent; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -public class EventRecorder { - private static final List events = new ArrayList<>(); - private static Path outPath; - - static { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - Event.write(events, outPath); - } catch (IOException e) { - e.printStackTrace(); - } - System.out.println("AGENT: Writing " + events.size() + " events to " + outPath.toAbsolutePath()); - })); - } - - public static void setOutPath(Path outPath) { - EventRecorder.outPath = outPath; - } - - public static void recordReferenceReturn(String clazz, String methodName, String methodDesc, Object returnedValue) { - if (returnedValue == null) { - events.add(new ReferenceReturnEvent(clazz, methodName, methodDesc, null)); - } else { - events.add(new ReferenceReturnEvent(clazz, methodName, methodDesc, - returnedValue.getClass().getName().replace(".", "/"))); - } - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - Object value) { - String targetType = target != null ? target.getClass().getName().replace(".", "/") : "null"; - String valueType = value != null ? value.getClass().getName().replace(".", "/") : "null"; - events.add(new PutFieldEvent(clazz, methodName, methodDesc, targetType, field, valueType)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - boolean value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Boolean.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - char value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Character.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - byte value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Byte.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - short value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Short.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - int value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Integer.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - long value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Long.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - float value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Float.valueOf(value)); - } - - public static void recordPutField(String clazz, String methodName, String methodDesc, Object target, String field, - double value) { - EventRecorder.recordPutField(clazz, methodName, methodDesc, target, field, Double.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - Object value) { - String targetType = target != null ? target.getClass().getName().replace(".", "/") : "null"; - String valueType = value != null ? value.getClass().getName().replace(".", "/") : "null"; - events.add(new GetFieldEvent(clazz, methodName, methodDesc, targetType, field, valueType)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - boolean value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Boolean.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - char value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Character.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - byte value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Byte.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - short value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Short.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - int value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Integer.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - long value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Long.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - float value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Float.valueOf(value)); - } - - public static void recordGetField(String clazz, String methodName, String methodDesc, Object target, String field, - double value) { - EventRecorder.recordGetField(clazz, methodName, methodDesc, target, field, Double.valueOf(value)); - } - - public static void recordExitThrow(String clazz, String methodName, String methodDesc, Throwable throwable) { - String exceptionType = throwable.getClass().getName().replace(".", "/"); - events.add(new MethodExitThrowEvent(clazz, methodName, methodDesc, exceptionType)); - } - - public static void recordPrimitiveReturn(String clazz, String methodName, String methodDesc, Object value) { - events.add(new PrimitiveReturnEvent(clazz, methodName, methodDesc, value)); - } - - public static void recordMethodEnter(String clazz, String methodName, String methodDesc) { - events.add(new MethodEnterEvent(clazz, methodName, methodDesc)); - } -} diff --git a/autograder-agent/src/main/java/de/firemage/autograder/agent/MethodInstrumentationVisitor.java b/autograder-agent/src/main/java/de/firemage/autograder/agent/MethodInstrumentationVisitor.java deleted file mode 100644 index 72dca836..00000000 --- a/autograder-agent/src/main/java/de/firemage/autograder/agent/MethodInstrumentationVisitor.java +++ /dev/null @@ -1,141 +0,0 @@ -package de.firemage.autograder.agent; - -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; -import org.objectweb.asm.commons.AdviceAdapter; -import org.objectweb.asm.commons.Method; - -public class MethodInstrumentationVisitor extends AdviceAdapter { - private static final Type RECORDER = Type.getType("Lde/firemage/autograder/agent/EventRecorder;"); - private final String className; - private final Label startFinally; - private boolean initialized = false; // Required because the compiler produces a putfield instruction before - // calling the super constructor for storing the reference to the outer class in implicit constructors - // of anonymous inner classes if they are defined in a non-static method - - public MethodInstrumentationVisitor(MethodVisitor visitor, int access, String name, String descriptor, - String className) { - super(Opcodes.ASM9, visitor, access, name, descriptor); - this.className = className; - this.startFinally = new Label(); - } - - @Override - protected void onMethodEnter() { - this.initialized = true; - visitLabel(this.startFinally); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - invokeStatic(RECORDER, - new Method("recordMethodEnter", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")); - } - - @Override - protected void onMethodExit(int opcode) { - if (!this.initialized) { - return; - } - - if (opcode == Opcodes.ARETURN) { - dup(); - int returnValue = newLocal(this.getReturnType()); - storeLocal(returnValue); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - loadLocal(returnValue); - invokeStatic(RECORDER, - new Method("recordReferenceReturn", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V")); - } else if (opcode != Opcodes.ATHROW && opcode != Opcodes.RETURN) { - if (opcode == Opcodes.DRETURN || opcode == Opcodes.LRETURN) { - dup2(); - } else { - dup(); - } - int returnValue = newLocal(this.getReturnType()); - storeLocal(returnValue); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - loadLocal(returnValue); - box(this.getReturnType()); - invokeStatic(RECORDER, - new Method("recordPrimitiveReturn", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V")); - } - } - - @Override - public void visitFieldInsn(int opcode, String owner, String name, String descriptor) { - if (!this.initialized) { - return; - } - - if (opcode == Opcodes.PUTFIELD) { - int value = newLocal(Type.getType(descriptor)); - storeLocal(value); - int target = newLocal(Type.getObjectType(owner)); - storeLocal(target); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - loadLocal(target); - visitLdcInsn(name); - loadLocal(value); - invokeStatic(RECORDER, - new Method("recordPutField", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;" + generifyDescriptor(descriptor) + ")V")); - loadLocal(target); - loadLocal(value); - } else if (opcode == Opcodes.GETFIELD) { - int target = newLocal(Type.getObjectType(owner)); - storeLocal(target); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - loadLocal(target); - visitLdcInsn(name); - loadLocal(target); - getField(Type.getObjectType(owner), name, Type.getType(descriptor)); - invokeStatic(RECORDER, - new Method("recordGetField", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/String;" + generifyDescriptor(descriptor) + ")V")); - loadLocal(target); - } - super.visitFieldInsn(opcode, owner, name, descriptor); - } - - @Override - public void visitMaxs(int maxStack, int maxLocals) { - if (!this.initialized) { - return; - } - - Label endFinally = new Label(); - visitTryCatchBlock(this.startFinally, endFinally, endFinally, "java/lang/Throwable"); - visitLabel(endFinally); - dup(); - int exception = newLocal(Type.getObjectType("Ljava/lang/Throwable;")); - storeLocal(exception); - visitLdcInsn(this.className); - visitLdcInsn(this.getName()); - visitLdcInsn(this.methodDesc); - loadLocal(exception); - invokeStatic(RECORDER, new Method("recordExitThrow", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V")); - throwException(); - super.visitMaxs(maxStack, maxLocals); - } - - private String generifyDescriptor(String descriptor) { - if (descriptor.startsWith("L") || descriptor.startsWith("[")) { - return "Ljava/lang/Object;"; - } else { - return descriptor; - } - } -} diff --git a/autograder-cmd/src/main/java/de/firemage/autograder/cmd/Application.java b/autograder-cmd/src/main/java/de/firemage/autograder/cmd/Application.java index dc5df00c..043ae64b 100644 --- a/autograder-cmd/src/main/java/de/firemage/autograder/cmd/Application.java +++ b/autograder-cmd/src/main/java/de/firemage/autograder/cmd/Application.java @@ -69,10 +69,6 @@ public class Application implements Callable { @Option(names = {"-j", "--java", "--java-version"}, defaultValue = "17", description = "Set the Java version.") private String javaVersion; - @Option(names = {"-s", - "--static-only"}, description = "Only run static analysis, therefore disabling dynamic analysis.") - private boolean staticOnly; - @Option(names = { "--artemis"}, description = "Assume that the given root folder is the workspace root of the grading tool.") private boolean artemisFolders; @@ -244,12 +240,6 @@ public Integer call() { System.out.println("Student source code directory is " + file); } - boolean isDynamicAnalysisEnabled = !this.staticOnly && !this.tests.toString().equals(""); - if (!isDynamicAnalysisEnabled && !outputJson) { - CmdUtil.println("Note: Dynamic analysis is disabled."); - CmdUtil.println(); - } - List checks; try { checks = this.getChecks(); @@ -261,7 +251,6 @@ public Integer call() { Linter linter = Linter.builder(Locale.GERMANY) .threads(0) .tempLocation(this.tempLocation) - .enableDynamicAnalysis(isDynamicAnalysisEnabled) .maxProblemsPerCheck(this.maxProblemsPerCheck) .exclude(problem -> this.exludedClasses.contains(problem.getPosition().file().getName().replace(".java", ""))) .build(); diff --git a/autograder-core/pom.xml b/autograder-core/pom.xml index 8b368b8b..48e25424 100644 --- a/autograder-core/pom.xml +++ b/autograder-core/pom.xml @@ -18,65 +18,17 @@ 11.0.0 7.0.0-rc3 6.45.0 - - 3.3.6 1.5.2 0.70 - - - - maven-antrun-plugin - 3.1.0 - - - generate-sources - - run - - - - - - - - - - - - - - - - - - - de.firemage.autograder - autograder-event - de.firemage.autograder autograder-treeg - - de.firemage.autograder - autograder-agent - - test - - - de.firemage.autograder - autograder-executor - - test - - fr.inria.gforge.spoon @@ -157,30 +109,6 @@ ${jackson.version} - - - com.github.docker-java - docker-java - ${docker.version} - - - org.slf4j - jcl-over-slf4j - - - - - - com.github.docker-java - docker-java-transport-httpclient5 - ${docker.version} - - - org.slf4j - jcl-over-slf4j - - - org.slf4j jcl-over-slf4j diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/Linter.java b/autograder-core/src/main/java/de/firemage/autograder/core/Linter.java index 9db77f6f..0bb9d29a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/Linter.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/Linter.java @@ -43,7 +43,6 @@ public final class Linter { private final int threads; private final TempLocation tempLocation; private final FluentBundle fluentBundle; - private final boolean disableDynamicAnalysis; private final ClassLoader classLoader; private final int maxProblemsPerCheck; private final Predicate isExcluded; @@ -52,7 +51,6 @@ private Linter( Locale locale, TempLocation tempLocation, int threads, - boolean disableDynamicAnalysis, ClassLoader classLoader, int maxProblemsPerCheck, Predicate isExcluded @@ -73,7 +71,6 @@ private Linter( this.tempLocation = tempLocation; this.threads = threads; - this.disableDynamicAnalysis = disableDynamicAnalysis; this.classLoader = classLoader; this.maxProblemsPerCheck = maxProblemsPerCheck; this.isExcluded = isExcluded; @@ -83,7 +80,6 @@ public static class Builder { private final Locale locale; private TempLocation tempLocation; private int threads; - private boolean disableDynamicAnalysis = true; private ClassLoader classLoader; private int maxProblemsPerCheck = -1; private Predicate isExcluded; @@ -108,15 +104,6 @@ public Builder maxProblemsPerCheck(int maxProblemsPerCheck) { return this; } - public Builder enableDynamicAnalysis() { - return this.enableDynamicAnalysis(true); - } - - public Builder enableDynamicAnalysis(boolean shouldEnable) { - this.disableDynamicAnalysis = !shouldEnable; - return this; - } - public Builder classLoader(ClassLoader classLoader) { this.classLoader = classLoader; return this; @@ -138,7 +125,6 @@ public Linter build() { this.locale, tempLocation, this.threads, - this.disableDynamicAnalysis, this.classLoader, this.maxProblemsPerCheck, this.isExcluded @@ -237,9 +223,6 @@ public List checkFile( if (!integratedChecks.isEmpty()) { scheduler.submitTask((s, reporter) -> { IntegratedAnalysis analysis = new IntegratedAnalysis(file, tmpLocation); - if (!this.disableDynamicAnalysis) { - analysis.runDynamicAnalysis(tests, statusConsumer); - } analysis.lint(integratedChecks, statusConsumer, s); }); } diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/LinterStatus.java b/autograder-core/src/main/java/de/firemage/autograder/core/LinterStatus.java index 5207e5e3..f35fd428 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/LinterStatus.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/LinterStatus.java @@ -7,8 +7,6 @@ public enum LinterStatus { RUNNING_CPD(new LocalizedMessage("status-cpd")), RUNNING_ERROR_PRONE(new LocalizedMessage("status-error-prone")), BUILDING_CODE_MODEL(new LocalizedMessage("status-model")), - BUILDING_DOCKER_IMAGE(new LocalizedMessage("status-docker")), - EXECUTING_TESTS(new LocalizedMessage("status-tests")), RUNNING_INTEGRATED_CHECKS(new LocalizedMessage("status-integrated")); private final LocalizedMessage message; diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/ProblemType.java b/autograder-core/src/main/java/de/firemage/autograder/core/ProblemType.java index 864699c9..91b2c283 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/ProblemType.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/ProblemType.java @@ -36,7 +36,6 @@ public enum ProblemType { JAVADOC_MISSING_PARAMETER_TAG, JAVADOC_UNKNOWN_PARAMETER_TAG, PACKAGE_NAMING_CONVENTION, - JAVADOC_INCOMPLETE_RETURN_TAG, JAVADOC_UNDOCUMENTED_THROWS, UNUSED_DIAMOND_OPERATOR, EXPLICITLY_EXTENDS_OBJECT, @@ -77,7 +76,6 @@ public enum ProblemType { REASSIGNED_PARAMETER, DOUBLE_BRACE_INITIALIZATION, - INSTANCE_FIELD_CAN_BE_LOCAL, FOR_CAN_BE_FOREACH, OVERRIDE_ANNOTATION_MISSING, SYSTEM_SPECIFIC_LINE_BREAK, diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/AvoidStringConcat.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/AvoidStringConcat.java index 12f93eaf..187006eb 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/AvoidStringConcat.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/AvoidStringConcat.java @@ -4,7 +4,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.CtRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -25,7 +24,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.AVOID_STRING_CONCAT }) public class AvoidStringConcat extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CharRange.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CharRange.java index debbaf76..3d4c1378 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CharRange.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CharRange.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.CtRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -81,7 +80,7 @@ private static Optional> makeSuggestion(CtExpression>() { @Override @SuppressWarnings("unchecked") diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CheckIterableDuplicates.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CheckIterableDuplicates.java index 7bcc5336..780392e6 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CheckIterableDuplicates.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CheckIterableDuplicates.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -46,7 +45,7 @@ private static String buildSuggestion(CtExpression ctExpression, boolean isNe } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtForEach ctForEach) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionAddAll.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionAddAll.java index c74bc3de..69126920 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionAddAll.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionAddAll.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -222,7 +221,7 @@ private void checkAddAll(CtForEach ctFor) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtBlock(CtBlock ctBlock) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionsNCopies.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionsNCopies.java index 03749299..78c18a05 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionsNCopies.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/CollectionsNCopies.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -22,7 +21,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.COLLECTIONS_N_COPIES }) public class CollectionsNCopies extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtFor ctFor) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/EqualsHashCodeComparableContract.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/EqualsHashCodeComparableContract.java index 40756be8..19831b80 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/EqualsHashCodeComparableContract.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/EqualsHashCodeComparableContract.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -14,7 +13,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.EQUALS_HASHCODE_COMPARABLE_CONTRACT }) public class EqualsHashCodeComparableContract extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtType ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/ImplementComparable.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/ImplementComparable.java index 6a2179bc..f4eb13cf 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/ImplementComparable.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/ImplementComparable.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -27,7 +26,7 @@ private static CtTypeReference getInterface(CtTypeInformation ctType, Class>() { @Override public void process(CtClass ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/IsEmptyReimplementationCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/IsEmptyReimplementationCheck.java index f1561a34..4df46e75 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/IsEmptyReimplementationCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/IsEmptyReimplementationCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -166,7 +165,7 @@ private void checkEqualsCall(CtExpression target, CtInvocation ctInvocatio } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/MathReimplementation.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/MathReimplementation.java index 9f8fc4bf..a26d7a28 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/MathReimplementation.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/MathReimplementation.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -228,7 +227,7 @@ private void checkMaxMin(CtIf ctIf) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override protected void enter(CtElement ctElement) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OldCollectionCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OldCollectionCheck.java index 2f4f5b18..efd89749 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OldCollectionCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OldCollectionCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -23,7 +22,7 @@ private void reportProblem(CtElement ctElement, String original, String suggesti } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtConstructorCall ctConstructorCall) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OptionalBadPractices.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OptionalBadPractices.java index 2e46e073..ec07ef75 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OptionalBadPractices.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/OptionalBadPractices.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -49,7 +48,7 @@ private void checkCtVariable(CtTypedElement ctTypedElement) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtTypedElement ctTypedElement) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/SimplifyArraysFill.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/SimplifyArraysFill.java index ac3f4124..94304e9b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/SimplifyArraysFill.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/SimplifyArraysFill.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -21,7 +20,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.SIMPLIFY_ARRAYS_FILL }) public class SimplifyArraysFill extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/StringRepeat.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/StringRepeat.java index 2df4d2f0..bb103916 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/StringRepeat.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/StringRepeat.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -72,7 +72,7 @@ private void checkStringRepeat(CtFor ctFor) { } } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtFor ctFor) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArrayCopy.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArrayCopy.java index 7397c437..3a1f39aa 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArrayCopy.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArrayCopy.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -61,7 +61,7 @@ private void checkArrayCopy(CtFor ctFor) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtFor ctFor) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArraysFill.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArraysFill.java index 25748246..8677437e 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArraysFill.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseArraysFill.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -85,7 +85,7 @@ private void checkArraysFill(CtFor ctFor) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { if (!staticAnalysis.hasJavaUtilImport()) { return; } diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEntrySet.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEntrySet.java index e615473f..52a37068 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEntrySet.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEntrySet.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -28,7 +27,7 @@ private static boolean hasInvokedKeySet(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtForEach ctForEach) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumCollection.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumCollection.java index 4453f46f..bf4a8022 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumCollection.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumCollection.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -15,7 +14,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.USE_ENUM_COLLECTION }) public class UseEnumCollection extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtConstructorCall ctConstructorCall) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumValues.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumValues.java index cc4d00f3..beb3a2cb 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumValues.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseEnumValues.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -122,7 +121,7 @@ private void checkListingEnumValues( @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField ctField) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseFormatString.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseFormatString.java index 97e77add..e9d9121b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseFormatString.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseFormatString.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -262,7 +261,7 @@ private void checkCtInvocation(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtExpression ctExpression) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseModuloOperator.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseModuloOperator.java index eac09bf1..043b0ca7 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseModuloOperator.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseModuloOperator.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -91,7 +90,7 @@ private void checkModulo(CtIf ctIf) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtIf ctIf) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseStringFormatted.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseStringFormatted.java index f6fe6752..3ab838e2 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseStringFormatted.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseStringFormatted.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -51,7 +50,7 @@ private void checkCtInvocation(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseSubList.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseSubList.java index 8222d48f..e695252c 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseSubList.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/api/UseSubList.java @@ -4,7 +4,7 @@ import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; import de.firemage.autograder.core.check.general.ForToForEachLoop; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -70,7 +70,7 @@ private void checkSubList(CtFor ctFor) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtFor ctFor) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentLanguageCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentLanguageCheck.java index 11580097..21f8ca9f 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentLanguageCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentLanguageCheck.java @@ -7,7 +7,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.IntegratedInCodeProblem; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -43,7 +42,7 @@ public CommentLanguageCheck(double threshold) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { List englishComments = new ArrayList<>(); List germanComments = new ArrayList<>(); diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentedOutCodeCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentedOutCodeCheck.java index 0916d961..8bb70b99 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentedOutCodeCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/CommentedOutCodeCheck.java @@ -5,7 +5,7 @@ import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.Translatable; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.file.SourcePath; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -33,7 +33,7 @@ public class CommentedOutCodeCheck extends IntegratedCheck { ); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { Map> files = new HashMap<>(); staticAnalysis.processWith(new AbstractProcessor() { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/FieldJavadocCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/FieldJavadocCheck.java index 1059569c..9af70eb8 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/FieldJavadocCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/FieldJavadocCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -25,7 +24,7 @@ public class FieldJavadocCheck extends IntegratedCheck { ); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField field) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocReturnNullCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocReturnNullCheck.java deleted file mode 100644 index 1e0c0bb7..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocReturnNullCheck.java +++ /dev/null @@ -1,58 +0,0 @@ -package de.firemage.autograder.core.check.comment; - -import de.firemage.autograder.core.LocalizedMessage; -import de.firemage.autograder.core.ProblemType; -import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; -import de.firemage.autograder.core.integrated.IntegratedCheck; -import de.firemage.autograder.core.integrated.SpoonUtil; -import de.firemage.autograder.core.integrated.StaticAnalysis; -import de.firemage.autograder.event.ReferenceReturnEvent; -import spoon.processing.AbstractProcessor; -import spoon.reflect.code.CtJavaDoc; -import spoon.reflect.code.CtJavaDocTag; -import spoon.reflect.declaration.CtMethod; - -import java.util.Map; -import java.util.Optional; - -@ExecutableCheck(reportedProblems = {ProblemType.JAVADOC_INCOMPLETE_RETURN_TAG}) -public class JavadocReturnNullCheck extends IntegratedCheck { - @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { - staticAnalysis.processWith(new AbstractProcessor>() { - @Override - public void process(CtMethod method) { - if (method.isPrivate() || method.getType().isPrimitive()) { - return; - } - - boolean returnsNull = dynamicAnalysis.findEventsForMethod(method) - .anyMatch(event -> event instanceof ReferenceReturnEvent refRet && refRet.returnedNull()); - - if (returnsNull) { - Optional javaDoc = SpoonUtil.getJavadoc(method); - if (javaDoc.isEmpty()) { - return; - } - Optional returnTag = javaDoc.get() - .getTags() - .stream() - .filter(tag -> tag.getType().equals(CtJavaDocTag.TagType.RETURN)) - .findFirst(); - - if (returnTag.isPresent() && !returnTag.get().getContent() - .contains("null")) { // We don't care if the return tag does not exist - // We sadly cannot use the returnTag itself as the position because it has a "NoSourcePosition" - addLocalProblem(javaDoc.get(), - new LocalizedMessage( - "javadoc-return-null-exp", - Map.of("method", method.getSignature()) - ), - ProblemType.JAVADOC_INCOMPLETE_RETURN_TAG); - } - } - } - }); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocStubCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocStubCheck.java index b10869a2..10c3ddca 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocStubCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/JavadocStubCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -29,7 +28,7 @@ public JavadocStubCheck() { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtJavaDoc javadoc) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/MethodJavadocCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/MethodJavadocCheck.java index 0ab2a05d..5f7a8fd6 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/MethodJavadocCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/MethodJavadocCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -34,7 +33,7 @@ public class MethodJavadocCheck extends IntegratedCheck { ); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtMethod method) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/ThrowsJavadocCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/ThrowsJavadocCheck.java index 470cc29a..de85bc76 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/ThrowsJavadocCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/ThrowsJavadocCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -55,7 +54,7 @@ private void checkCtExecutable(CtExecutable ctExecutable) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtMethod(CtMethod ctMethod) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TodoComment.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TodoComment.java index 290f4097..7162aab4 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TodoComment.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TodoComment.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -12,7 +11,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.TODO_COMMENT }) public class TodoComment extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtComment ctComment) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TypeJavadocCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TypeJavadocCheck.java index 65e82abd..6f6ab3c0 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TypeJavadocCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/TypeJavadocCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -48,7 +47,7 @@ public TypeJavadocCheck(String regex) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtType type) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/UnnecessaryComment.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/UnnecessaryComment.java index 75b0848d..57684278 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/UnnecessaryComment.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/comment/UnnecessaryComment.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -14,7 +13,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.UNNECESSARY_COMMENT }) public class UnnecessaryComment extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtComment ctComment) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ChainedIfCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ChainedIfCheck.java index 47331a3b..679f3514 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ChainedIfCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ChainedIfCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -18,7 +17,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.MERGE_NESTED_IF, ProblemType.UNMERGED_ELSE_IF }) public class ChainedIfCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtIf ctIf) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ExtendsObjectCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ExtendsObjectCheck.java index d15413a6..3365d5fe 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ExtendsObjectCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/ExtendsObjectCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -13,7 +12,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.EXPLICITLY_EXTENDS_OBJECT}) public class ExtendsObjectCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass ctClass) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultiThreading.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultiThreading.java index 58be7561..db0d5de1 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultiThreading.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultiThreading.java @@ -4,7 +4,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.reflect.code.CtSynchronized; @@ -17,7 +16,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.MULTI_THREADING }) public class MultiThreading extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtSynchronized(CtSynchronized ctSynchronized) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultipleInlineStatements.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultipleInlineStatements.java index 9761f6d6..ada14131 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultipleInlineStatements.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/MultipleInlineStatements.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -25,7 +24,7 @@ }) public class MultipleInlineStatements extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { Collection alreadyReported = new HashSet<>(); staticAnalysis.processWith(new AbstractProcessor() { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantAssignment.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantAssignment.java index 7e040280..4cbb0242 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantAssignment.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantAssignment.java @@ -4,7 +4,6 @@ import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; import de.firemage.autograder.core.check.unnecessary.UnusedCodeElementCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -26,7 +25,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.REDUNDANT_ASSIGNMENT }) public class RedundantAssignment extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtAssignment ctAssignment) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantBooleanEqual.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantBooleanEqual.java index 9eefa965..553138ce 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantBooleanEqual.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantBooleanEqual.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -46,7 +45,7 @@ private void reportProblem(CtBinaryOperator ctBinaryOperator, boolean literal } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantCatch.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantCatch.java index 4ff85f7a..ae55a869 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantCatch.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantCatch.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -21,7 +20,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.REDUNDANT_CATCH }) public class RedundantCatch extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtCatch ctCatch) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantConstructorCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantConstructorCheck.java index 061ff8d0..3867002a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantConstructorCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantConstructorCheck.java @@ -4,7 +4,6 @@ import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.Translatable; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import org.slf4j.Logger; @@ -31,7 +30,7 @@ public class RedundantConstructorCheck extends IntegratedCheck { private static final Translatable MESSAGE = new LocalizedMessage("implicit-constructor-exp"); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass element) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantElse.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantElse.java index 5066e5cc..b8911cd3 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantElse.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantElse.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -93,7 +92,7 @@ private void checkCtIf(CtIf ctIf) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtIf ctIf) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantIfForBooleanCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantIfForBooleanCheck.java index 469464cf..a7893c99 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantIfForBooleanCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantIfForBooleanCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -129,7 +128,7 @@ private void checkIfElse(CtExpression condition, CtStatement thenStmt, CtStat } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtBlock block) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantModifier.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantModifier.java index cb079e4c..0a8f18b9 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantModifier.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantModifier.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.reflect.declaration.CtClass; @@ -144,7 +143,7 @@ else if (ctType.isClass() && ctType.getDeclaringType() != null && ctType.getDecl } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtClass(CtClass ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantNegationCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantNegationCheck.java index 23dc41c8..03757f29 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantNegationCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantNegationCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -37,7 +36,7 @@ public CtExpression foldCtUnaryOperator(CtUnaryOperator ctUnaryOperato } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtExpression ctExpression) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantUninitializedVariable.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantUninitializedVariable.java index 2367ceb2..9285809a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantUninitializedVariable.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantUninitializedVariable.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -35,7 +34,7 @@ private static String makeSuggestion(CtLocalVariable ctLocalVariable, CtExpre ); } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtLocalVariable ctLocalVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantVariable.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantVariable.java index 1765b3ae..fab76850 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantVariable.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RedundantVariable.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -78,7 +77,7 @@ private void checkVariableRead(CtStatement ctStatement, CtVariableRead ctVari } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtInvocation(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RegexCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RegexCheck.java index c2f0f0b1..4e320f69 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RegexCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RegexCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -90,7 +89,7 @@ private static boolean isInAllowedContext(CtLiteral ctLiteral) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtLiteral literal) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RepeatedMathOperationCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RepeatedMathOperationCheck.java index 59d4dbfc..ea40503b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RepeatedMathOperationCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/RepeatedMathOperationCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -131,7 +130,7 @@ public static CtExpression joinExpressions(BinaryOperatorKind kind, CtExpress } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtExpression ctExpression) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/SelfAssignmentCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/SelfAssignmentCheck.java index 74920481..257f8288 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/SelfAssignmentCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/SelfAssignmentCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -95,7 +94,7 @@ private static boolean isSelfAssignment(CtVariableWrite lhs, CtVariableRead>() { @Override public void process(CtAssignment assignment) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TooManyExceptions.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TooManyExceptions.java index 3dfc69b8..5817ceb5 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TooManyExceptions.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TooManyExceptions.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -19,7 +18,7 @@ public class TooManyExceptions extends IntegratedCheck { private static final int MAXIMUM_NUMBER_OF_EXCEPTIONS = 5; @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { List> declaredExceptions = new ArrayList<>(); staticAnalysis.processWith(new AbstractProcessor>() { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TryCatchComplexity.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TryCatchComplexity.java index 65b6738f..105e3647 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TryCatchComplexity.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/TryCatchComplexity.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -44,7 +43,7 @@ public class TryCatchComplexity extends IntegratedCheck { public static final String LOCALIZED_MESSAGE_KEY = "try-catch-complexity"; @Override - public void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + public void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtTry(CtTry ctTry) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnnecessaryBoxing.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnnecessaryBoxing.java index 9860428e..4095d888 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnnecessaryBoxing.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnnecessaryBoxing.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -63,7 +62,7 @@ && isLikelyNull(ctAssignment.getAssignment()) } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtVariable ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnusedImport.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnusedImport.java index 8b5bf96c..056f6688 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnusedImport.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UnusedImport.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -191,7 +190,7 @@ private void checkImport(CtImport ctImport, CtCompilationUnit ctCompilationUnit, } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { SpoonUtil.visitCtCompilationUnit(staticAnalysis.getModel(), ctCompilationUnit -> { Collection importedElements = new HashSet<>(); diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UseOperatorAssignment.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UseOperatorAssignment.java index 7699645e..7867ffc1 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UseOperatorAssignment.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/UseOperatorAssignment.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import de.firemage.autograder.core.integrated.evaluator.OperatorHelper; @@ -53,7 +52,7 @@ private boolean isAssignable(BinaryOperatorKind binaryOperatorKind) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtAssignment assignment) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/WrapperInstantiationCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/WrapperInstantiationCheck.java index ded51b35..b7933380 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/WrapperInstantiationCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/complexity/WrapperInstantiationCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -27,7 +26,7 @@ private static boolean isPrimitiveWrapper(CtTypeReference ctTypeReference } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtConstructorCall ctConstructorCall) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/AssertCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/AssertCheck.java index 10ca2481..cceec3e1 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/AssertCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/AssertCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -12,7 +11,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.ASSERT}) public class AssertCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtAssert element) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/PrintStackTraceCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/PrintStackTraceCheck.java index 92c0b297..d9424a00 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/PrintStackTraceCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/debug/PrintStackTraceCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -23,7 +22,7 @@ private static boolean hasInvokedPrintStackTrace(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/CustomExceptionInheritanceCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/CustomExceptionInheritanceCheck.java index 127b1a0c..1b674950 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/CustomExceptionInheritanceCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/CustomExceptionInheritanceCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -18,7 +17,7 @@ }) public class CustomExceptionInheritanceCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass ctClass) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionControlFlowCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionControlFlowCheck.java index af3c9c09..3153478e 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionControlFlowCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionControlFlowCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -20,7 +19,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.EXCEPTION_CAUGHT_IN_SURROUNDING_BLOCK, ProblemType.EXCEPTION_SHOULD_NEVER_BE_CAUGHT}) public class ExceptionControlFlowCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtTry(CtTry ctTry) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionMessageCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionMessageCheck.java index 6fb8e45a..934f59c3 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionMessageCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/ExceptionMessageCheck.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ExceptionUtil; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -59,7 +59,7 @@ private static boolean isInAllowedContext(CtElement ctElement) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtThrow throwStmt) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/NumberFormatExceptionIgnored.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/NumberFormatExceptionIgnored.java index 970476b8..693ead29 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/NumberFormatExceptionIgnored.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/NumberFormatExceptionIgnored.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -25,7 +24,7 @@ private static boolean isNFECaught(CtInvocation ctInvocation) { )) != null; } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/RuntimeExceptionCatchCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/RuntimeExceptionCatchCheck.java index c83dedb3..d869bfa2 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/RuntimeExceptionCatchCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/exceptions/RuntimeExceptionCatchCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -21,7 +20,7 @@ public class RuntimeExceptionCatchCheck extends IntegratedCheck { private static final List ALLOWED_EXCEPTIONS = List.of("java.lang.NumberFormatException"); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtCatch ctCatch) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidLabels.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidLabels.java index 8884239f..6088eed2 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidLabels.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidLabels.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -12,7 +11,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.AVOID_LABELS }) public class AvoidLabels extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtStatement ctStatement) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidRecompilingRegex.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidRecompilingRegex.java index 6443b365..42a971f4 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidRecompilingRegex.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidRecompilingRegex.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -28,7 +27,7 @@ private boolean isPatternInvocation(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField ctField) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidShadowing.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidShadowing.java index f1680c9f..07b868c5 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidShadowing.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/AvoidShadowing.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -62,7 +61,7 @@ private static boolean hasVariableReadIn(CtVariable ctVariable, CtElement } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtVariable ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/BinaryOperator.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/BinaryOperator.java index 0d82f4a5..8b50eb8c 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/BinaryOperator.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/BinaryOperator.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -22,7 +21,7 @@ public class BinaryOperator extends IntegratedCheck { ); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtBinaryOperator ctBinaryOperator) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareCharValue.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareCharValue.java index 5916929e..0ad8875c 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareCharValue.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareCharValue.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -46,7 +45,7 @@ private static Optional getComparedIntegerValue(CtExpression left, C } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtBinaryOperator ctBinaryOperator) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareObjectsNotStringsCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareObjectsNotStringsCheck.java index 407c29e2..b6611bf1 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareObjectsNotStringsCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/CompareObjectsNotStringsCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -22,7 +21,7 @@ private static LocalizedMessage formatExplanation(CtTypeReference type) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation invocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ConstantNamingAndQualifierCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ConstantNamingAndQualifierCheck.java index 4cf253ea..40e6dea3 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ConstantNamingAndQualifierCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ConstantNamingAndQualifierCheck.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.IdentifierNameUtils; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -52,7 +52,7 @@ private static String makeSuggestion(CtVariable ctVariable) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtVariable ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/DoNotUseRawTypes.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/DoNotUseRawTypes.java index b0ae7bbd..37626aaa 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/DoNotUseRawTypes.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/DoNotUseRawTypes.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -30,7 +29,7 @@ private boolean isRawType(CtTypeReference ctTypeReference) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtTypeReference ctTypeReference) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeFinal.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeFinal.java index a76bed84..bc5dc9ab 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeFinal.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeFinal.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -18,7 +17,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.FIELD_SHOULD_BE_FINAL}) public class FieldShouldBeFinal extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField ctField) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeLocalCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeLocalCheck.java deleted file mode 100644 index e7f5bfd6..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/FieldShouldBeLocalCheck.java +++ /dev/null @@ -1,57 +0,0 @@ -package de.firemage.autograder.core.check.general; - -import de.firemage.autograder.core.LocalizedMessage; -import de.firemage.autograder.core.ProblemType; -import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; -import de.firemage.autograder.core.integrated.IntegratedCheck; -import de.firemage.autograder.core.integrated.StaticAnalysis; -import de.firemage.autograder.event.GetFieldEvent; -import de.firemage.autograder.event.MethodEvent; -import de.firemage.autograder.event.PutFieldEvent; -import spoon.processing.AbstractProcessor; -import spoon.reflect.declaration.CtField; -import spoon.reflect.declaration.CtMethod; - -import java.util.Map; - -@ExecutableCheck(reportedProblems = {ProblemType.INSTANCE_FIELD_CAN_BE_LOCAL}) -public class FieldShouldBeLocalCheck extends IntegratedCheck { - private static LocalizedMessage formatExplanation(CtField field) { - return new LocalizedMessage("field-local-exp", Map.of( - "field", field.getSimpleName(), - "class", field.getDeclaringType().getQualifiedName() - )); - } - - @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { - staticAnalysis.processWith(new AbstractProcessor>() { - @Override - public void process(CtField field) { - if (!field.isPrivate() || field.isFinal()) { - return; - } - - boolean readBeforeWriteFound = false; - boolean writeFound = false; - outer: - for (CtMethod method : field.getDeclaringType().getMethods()) { - for (MethodEvent event : (Iterable) dynamicAnalysis.findEventsForMethod( - method)::iterator) { - if (event instanceof GetFieldEvent e && e.getField().equals(field.getSimpleName())) { - readBeforeWriteFound = true; - break outer; - } else if (event instanceof PutFieldEvent e && e.getField().equals(field.getSimpleName())) { - writeFound = true; - break; - } - } - } - if (!readBeforeWriteFound && writeFound) { - addLocalProblem(field, formatExplanation(field), ProblemType.INSTANCE_FIELD_CAN_BE_LOCAL); - } - } - }); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ForToForEachLoop.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ForToForEachLoop.java index 37b11e05..ce7bf674 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ForToForEachLoop.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ForToForEachLoop.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.ForLoopRange; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -151,7 +151,7 @@ public static Optional> findIterable(ForLoopRange forLoopRange) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtFor ctFor) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ImportTypes.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ImportTypes.java index dea3a21d..1cd1b96f 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ImportTypes.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ImportTypes.java @@ -4,7 +4,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.reflect.code.CtLocalVariable; @@ -94,7 +93,7 @@ private void checkCtTypeReference(CtTypeReference ctTypeReference) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtField(CtField ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/MagicString.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/MagicString.java index 99ae092a..c945cd4c 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/MagicString.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/MagicString.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -41,7 +40,7 @@ public class MagicString extends IntegratedCheck { }; @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ObjectDatatype.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ObjectDatatype.java index febc8172..569dceed 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ObjectDatatype.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ObjectDatatype.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -21,7 +20,7 @@ private static boolean hasObjectType(CtTypeReference ctTypeReference) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtVariable ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/OverrideAnnotationMissing.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/OverrideAnnotationMissing.java index 84236a82..d84b5963 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/OverrideAnnotationMissing.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/OverrideAnnotationMissing.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -15,7 +14,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.OVERRIDE_ANNOTATION_MISSING }) public class OverrideAnnotationMissing extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtMethod ctMethod) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ReassignedParameterCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ReassignedParameterCheck.java index cd234d29..10d2dc85 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ReassignedParameterCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ReassignedParameterCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -16,7 +15,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.REASSIGNED_PARAMETER}) public class ReassignedParameterCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtParameter ctParameter) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ScannerClosedCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ScannerClosedCheck.java index a5c746d6..020dbb8e 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ScannerClosedCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/ScannerClosedCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -15,7 +14,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.SCANNER_MUST_BE_CLOSED}) public class ScannerClosedCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtConstructorCall ctConstructorCall) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/StringCompareCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/StringCompareCheck.java index 383fb27b..9797a971 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/StringCompareCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/StringCompareCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -22,7 +21,7 @@ private static boolean isStringComparison(CtExpression lhs, CtExpression r } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtBinaryOperator operator) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SuppressWarningsCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SuppressWarningsCheck.java index 61418bf1..e035bbe1 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SuppressWarningsCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SuppressWarningsCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -12,7 +11,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.SUPPRESS_WARNINGS_USED}) public class SuppressWarningsCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtAnnotation annotation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SystemSpecificLineBreak.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SystemSpecificLineBreak.java index b9723bda..bd3588db 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SystemSpecificLineBreak.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/SystemSpecificLineBreak.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -15,7 +14,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.SYSTEM_SPECIFIC_LINE_BREAK }) public class SystemSpecificLineBreak extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtLiteral literal) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UncheckedTypeCast.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UncheckedTypeCast.java index b81bb900..b2e9fc1b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UncheckedTypeCast.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UncheckedTypeCast.java @@ -5,7 +5,6 @@ import de.firemage.autograder.core.check.ExecutableCheck; import de.firemage.autograder.core.compiler.CompilationDiagnostic; import de.firemage.autograder.core.compiler.CompilationResult; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -19,7 +18,7 @@ public class UncheckedTypeCast extends IntegratedCheck { ); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { CompilationResult result = staticAnalysis.getCompilationResult(); List diagnostics = result.diagnostics() .stream() diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseDifferentVisibility.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseDifferentVisibility.java index 5846dd8b..b0b2acea 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseDifferentVisibility.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseDifferentVisibility.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -92,7 +91,7 @@ private static Visibility getVisibility(CtTypeMember ctTypeMember) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtTypeMember ctTypeMember) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseGuardClauses.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseGuardClauses.java index 65720f08..fad1850a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseGuardClauses.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/UseGuardClauses.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -90,7 +89,7 @@ private void checkCtIf(CtIf ctIf, CtExpression condition) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtIf ctIf) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/BooleanIdentifierCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/BooleanIdentifierCheck.java index 062246be..92b4c97c 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/BooleanIdentifierCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/BooleanIdentifierCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -14,7 +13,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.BOOLEAN_GETTER_NOT_CALLED_IS}) public class BooleanIdentifierCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtMethod ctMethod) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/ConstantsHaveDescriptiveNamesCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/ConstantsHaveDescriptiveNamesCheck.java index 8aa61b32..5e620deb 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/ConstantsHaveDescriptiveNamesCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/ConstantsHaveDescriptiveNamesCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -181,7 +180,7 @@ private static boolean containsValueInName(String name, CtLiteral value) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField field) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/LinguisticNamingCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/LinguisticNamingCheck.java index e66c1275..b7e9cd86 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/LinguisticNamingCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/LinguisticNamingCheck.java @@ -4,7 +4,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.IdentifierNameUtils; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -131,7 +131,7 @@ private static boolean isInvalidSetterReturnType(CtMethod ctMethod) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtNamedElement ctNamedElement) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/PackageNamingConvention.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/PackageNamingConvention.java index 46bc8e97..96afca8a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/PackageNamingConvention.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/PackageNamingConvention.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -51,7 +50,7 @@ private void visitCtPackageDeclaration(StaticAnalysis staticAnalysis, Consumer invalidDeclarations = new LinkedHashSet<>(); Collection markedPackages = new HashSet<>(); diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/TypesHaveDescriptiveNamesCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/TypesHaveDescriptiveNamesCheck.java index 3b0f09d3..2ebca4f5 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/TypesHaveDescriptiveNamesCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/TypesHaveDescriptiveNamesCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -17,7 +16,7 @@ public class TypesHaveDescriptiveNamesCheck extends IntegratedCheck { List.of("object", "class", "record", "interface", "enum"); @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtType ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/VariablesHaveDescriptiveNamesCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/VariablesHaveDescriptiveNamesCheck.java index 7557f523..91bd6d99 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/VariablesHaveDescriptiveNamesCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/naming/VariablesHaveDescriptiveNamesCheck.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.IdentifierNameUtils; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -267,7 +267,7 @@ private void reportProblem(String key, CtNamedElement ctVariable, ProblemType pr } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtVariable ctVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/AvoidInnerClasses.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/AvoidInnerClasses.java index cb73f6c0..5a879859 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/AvoidInnerClasses.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/AvoidInnerClasses.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -24,7 +23,7 @@ private void checkCtType(CtType ctType) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtType ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/CheckStaticBlocks.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/CheckStaticBlocks.java index d8bb6bf6..784c37be 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/CheckStaticBlocks.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/CheckStaticBlocks.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.reflect.code.CtBlock; @@ -15,7 +14,7 @@ public class CheckStaticBlocks extends IntegratedCheck { public static final String LOCALIZED_MESSAGE_KEY = "avoid-static-blocks"; @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().getElements(new TypeFilter<>(CtBlock.class)).forEach(block -> { if (block.getParent() instanceof CtAnonymousExecutable executable && executable.isStatic()) { this.addLocalProblem( diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ClosedSetOfValues.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ClosedSetOfValues.java index ad8e20d8..b062dc53 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ClosedSetOfValues.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ClosedSetOfValues.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -182,7 +181,7 @@ private void checkCtMethod(CtMethod ctMethod) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtSwitch(CtSwitch switchStatement) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ConcreteCollectionCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ConcreteCollectionCheck.java index a3d3dc0e..b77e6aae 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ConcreteCollectionCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ConcreteCollectionCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -202,7 +201,7 @@ private boolean checkCtTypeReference(CtTypeReference ctTypeReference) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { // Checks for fields, parameters and return types staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotMakeConstantsClasses.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotMakeConstantsClasses.java index 1d49678f..1aa3d944 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotMakeConstantsClasses.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotMakeConstantsClasses.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -82,7 +81,7 @@ private boolean isConstantsClass(CtType ctType) { && ((ctType.getMethods().isEmpty() && fieldCount > 1) || fieldCount > FIELD_THRESHOLD); } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtType ctType) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotUseSystemExit.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotUseSystemExit.java index 7f4e67e5..fc012f4b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotUseSystemExit.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/DoNotUseSystemExit.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -34,7 +33,7 @@ private void checkCtInvocation(CtInvocation ctInvocation) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInvocation ctInvocation) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/IOUISeparation.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/IOUISeparation.java index 0c9b2c79..3fc3f849 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/IOUISeparation.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/IOUISeparation.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -119,7 +118,7 @@ private boolean notInMainClass(CtElement ctElement) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { CtModel ctModel = staticAnalysis.getModel(); // Check if all types are in one package. If they are, all io/ui should be in one class, otherwise in one package. diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InheritanceBadPractices.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InheritanceBadPractices.java index 132fb6c9..2fec5c35 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InheritanceBadPractices.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InheritanceBadPractices.java @@ -3,7 +3,7 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; + import de.firemage.autograder.core.integrated.IdentifierNameUtils; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -32,7 +32,7 @@ }) public class InheritanceBadPractices extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass ctClass) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InstanceOf.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InstanceOf.java index 94d9e14d..27006bb0 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InstanceOf.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InstanceOf.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -25,7 +24,7 @@ private static boolean isInAllowedContext(CtElement ctElement) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtTry(CtTry ctTry) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InterfaceBadPractices.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InterfaceBadPractices.java index 07570484..c6994b54 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InterfaceBadPractices.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/InterfaceBadPractices.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.processing.AbstractProcessor; @@ -18,7 +17,7 @@ ProblemType.STATIC_METHOD_IN_INTERFACE, ProblemType.EMPTY_INTERFACE }) public class InterfaceBadPractices extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtInterface ctInterface) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ListGetterSetterCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ListGetterSetterCheck.java index f0103229..28650693 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ListGetterSetterCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ListGetterSetterCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonStreamUtil; import de.firemage.autograder.core.integrated.SpoonUtil; @@ -26,7 +25,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.LIST_NOT_COPIED_IN_GETTER}) public class ListGetterSetterCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtReturn ret) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MethodShouldBeAbstractCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MethodShouldBeAbstractCheck.java index 9c4b4d11..c28aa230 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MethodShouldBeAbstractCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MethodShouldBeAbstractCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -29,7 +28,7 @@ private static LocalizedMessage formatExplanation(CtMethod method) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass clazz) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MutableEnum.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MutableEnum.java index c17f2dcc..4babbb93 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MutableEnum.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/MutableEnum.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -32,7 +31,7 @@ private static boolean isMutable(CtType ctType) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtEnum ctEnum) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ShouldBeEnumAttribute.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ShouldBeEnumAttribute.java index 8fa3692a..5b9ace9f 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ShouldBeEnumAttribute.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/ShouldBeEnumAttribute.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -19,7 +18,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.SHOULD_BE_ENUM_ATTRIBUTE}) public class ShouldBeEnumAttribute extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtAbstractSwitch ctSwitch) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/StaticFieldShouldBeInstanceCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/StaticFieldShouldBeInstanceCheck.java index a3de331d..80a20059 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/StaticFieldShouldBeInstanceCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/StaticFieldShouldBeInstanceCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -16,7 +15,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.STATIC_FIELD_SHOULD_BE_INSTANCE }) public class StaticFieldShouldBeInstanceCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtField ctField) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/UtilityClassCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/UtilityClassCheck.java index eb0efea5..25dddb1d 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/UtilityClassCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/oop/UtilityClassCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -67,7 +66,7 @@ private void checkCtClassConstructor(CtClass ctClass, ProblemType problemType } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor>() { @Override public void process(CtClass ctClass) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/DefaultPackageCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/DefaultPackageCheck.java index f7b235ca..271d632a 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/DefaultPackageCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/DefaultPackageCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -18,7 +17,7 @@ @ExecutableCheck(reportedProblems = {ProblemType.DEFAULT_PACKAGE_USED}) public class DefaultPackageCheck extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { CtPackage defaultPackage = staticAnalysis.getModel().getRootPackage(); if (!defaultPackage.getQualifiedName().isEmpty()) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/TooFewPackagesCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/TooFewPackagesCheck.java index 71280254..85a6b227 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/TooFewPackagesCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/structure/TooFewPackagesCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.StaticAnalysis; import spoon.reflect.declaration.CtPackage; @@ -19,7 +18,7 @@ public class TooFewPackagesCheck extends IntegratedCheck { public static final String LOCALIZED_MESSAGE_KEY = "too-few-packages"; @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { List packages = staticAnalysis.getModel().getAllPackages() .stream() .filter(CtPackage::hasTypes) diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/EmptyBlockCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/EmptyBlockCheck.java index a1163e81..efddc71b 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/EmptyBlockCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/EmptyBlockCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -23,7 +22,7 @@ private static boolean isEmptyBlock(CtBlock ctBlock) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtBlock(CtBlock ctBlock) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/UnusedCodeElementCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/UnusedCodeElementCheck.java index 3f9fabe1..50204afb 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/UnusedCodeElementCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/unnecessary/UnusedCodeElementCheck.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -99,7 +98,7 @@ private void checkUnused(StaticAnalysis staticAnalysis, CtNamedElement ctElement } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.getModel().getRootPackage().accept(new CtScanner() { @Override public void visitCtLocalVariable(CtLocalVariable ctLocalVariable) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/ConsoleRunner.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/ConsoleRunner.java deleted file mode 100644 index 35f7bd96..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/ConsoleRunner.java +++ /dev/null @@ -1,116 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import de.firemage.autograder.core.integrated.StaticAnalysis; -import de.firemage.autograder.event.Event; -import spoon.reflect.declaration.CtClass; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class ConsoleRunner implements TestRunner { - private static final int TIMEOUT_SECONDS = 10; - private final Path tmpDirectory; - private final Path agent; - private final Path tests; - - public ConsoleRunner(Path tmpDirectory, Path agent, Path tests) { - this.tmpDirectory = tmpDirectory; - this.agent = agent; - if (!Files.isDirectory(tests)) { - throw new IllegalArgumentException("tests must point to a folder containing the individual test cases"); - } - this.tests = tests; - } - - public List> runTests(StaticAnalysis analysis, Path jar) throws IOException, InterruptedException { - List testCases; - try (Stream files = Files.list(this.tests)) { - testCases = files.filter(Files::isRegularFile).toList(); - } - String mainClass = analysis.getCodeModel().findMain().getParent(CtClass.class).getQualifiedName().replace(".", "/"); - - List> events = new ArrayList<>(); - for (Path testPath : testCases) { - events.add(executeTestCase(testPath, mainClass, jar)); - } - - return events; - } - - private List executeTestCase(Path testFile, String mainClass, Path jar) - throws IOException, InterruptedException { - Path outPath = this.tmpDirectory.resolve("codelinter_events.txt"); - - List lines = Files.readAllLines(testFile); - Process container = startJVM(mainClass, jar, outPath); - - BufferedReader containerOut = container.inputReader(); - BufferedWriter containerIn = container.outputWriter(); - - List expectedOutput = new ArrayList<>(); - for (String line : lines) { - if (line.startsWith("> ")) { - containerIn.write(line.substring(2)); - containerIn.newLine(); - } else { - expectedOutput.add(line); - } - } - containerIn.flush(); - - if (!container.waitFor(TIMEOUT_SECONDS, TimeUnit.SECONDS)) { - container.destroyForcibly(); - } - - if (container.exitValue() != 0) { - System.out.println(containerOut.lines().collect(Collectors.joining("\n"))); - throw new IllegalStateException("Child JVM exited with nonzero exit code " + container.exitValue()); - } - - int outputLine = 0; - while (containerOut.ready()) { - String actualOutput = containerOut.readLine(); - if (actualOutput.startsWith("AGENT: ")) { - continue; - } - String expected = expectedOutput.get(outputLine); - if (expected.startsWith("Error, ")) { - if (!actualOutput.startsWith("Error, ")) { - throw new IllegalStateException("Expected an error output but got '" + actualOutput + "'"); - } - } else if (!expected.equals(actualOutput)) { - throw new IllegalStateException( - "Expected output '" + expected + "', got output '" + actualOutput + "'"); - } - outputLine++; - } - - if (outputLine < expectedOutput.size()) { - throw new IllegalStateException( - "There are " + (expectedOutput.size() - outputLine) + "lines left in the expected output"); - } - - List events = Event.read(outPath); - Files.deleteIfExists(outPath); - return events; - } - - private Process startJVM(String mainClass, Path jar, Path outPath) throws IOException { - String[] command = new String[] { - "java", - "-cp", - jar.toAbsolutePath().toString(), - "-javaagent:\"" + this.agent.toAbsolutePath() + "\"=\"" + outPath.toAbsolutePath() + "\"", - mainClass.replace("/", ".") - }; - return Runtime.getRuntime().exec(command); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerConsoleRunner.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerConsoleRunner.java deleted file mode 100644 index d3998d20..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerConsoleRunner.java +++ /dev/null @@ -1,227 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import com.github.dockerjava.api.DockerClient; -import com.github.dockerjava.api.async.ResultCallback; -import com.github.dockerjava.api.command.BuildImageResultCallback; -import com.github.dockerjava.api.command.WaitContainerResultCallback; -import com.github.dockerjava.api.exception.DockerClientException; -import com.github.dockerjava.api.exception.NotFoundException; -import com.github.dockerjava.api.model.Frame; -import com.github.dockerjava.api.model.HostConfig; -import com.github.dockerjava.core.DefaultDockerClientConfig; -import com.github.dockerjava.core.DockerClientBuilder; -import com.github.dockerjava.core.DockerClientConfig; -import com.github.dockerjava.httpclient5.ApacheDockerHttpClient; -import com.github.dockerjava.transport.DockerHttpClient; -import de.firemage.autograder.core.LinterStatus; -import de.firemage.autograder.core.integrated.StaticAnalysis; -import de.firemage.autograder.event.Event; -import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; -import spoon.reflect.declaration.CtClass; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.stream.Stream; - -public class DockerConsoleRunner implements TestRunner { - private static final int TIMEOUT_SECONDS = 60; - private final Path executor; - private final Path agent; - private final Path tests; - private final Path tmpPath; - - public DockerConsoleRunner(Path executor, Path agent, Path tests, Path tmpPath) { - this.executor = executor; - this.agent = agent; - if (!Files.isDirectory(tests)) { - throw new IllegalArgumentException("tests must point to a folder containing the individual test cases"); - } - this.tests = tests; - this.tmpPath = tmpPath; - } - - public List runTests(StaticAnalysis analysis, Path jar, Consumer statusConsumer) - throws RunnerException, InterruptedException { - String mainClass = analysis.getCodeModel().findMain().getParent(CtClass.class).getQualifiedName().replace(".", "/"); - - statusConsumer.accept(LinterStatus.BUILDING_DOCKER_IMAGE); - - // Create the docker client - DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().build(); - DockerHttpClient client = - new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost()).sslConfig(config.getSSLConfig()) - .build(); - DockerClient dockerClient = DockerClientBuilder.getInstance(config).withDockerHttpClient(client).build(); - - String imageId; - List testCases; - try { - // Prepare the build directory - Path buildDirectory = Files.createTempDirectory(this.tmpPath, "docker_build"); - Files.copy(Path.of(this.getClass().getResource("Dockerfile").toURI()), - buildDirectory.resolve("Dockerfile")); - Files.copy(this.executor, buildDirectory.resolve("executor.jar")); - Files.copy(this.agent, buildDirectory.resolve("agent.jar")); - Files.copy(jar, buildDirectory.resolve("src.jar")); - - imageId = dockerClient.buildImageCmd() - .withBaseDirectory(buildDirectory.toFile()) - .withDockerfile(buildDirectory.resolve("Dockerfile").toFile()) - .withPull(true) - .withBuildArg("jarfile", "src.jar") - .withBuildArg("executor", "executor.jar") - .withBuildArg("agent", "agent.jar") - .exec(new BuildImageResultCallback()) - .awaitImageId(); - - // Clean up the build directory - try (Stream walk = Files.walk(buildDirectory)) { - walk.sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - - try (Stream files = Files.walk(this.tests)) { - testCases = - files.filter(Files::isRegularFile) - .filter(f -> f.toString().endsWith(".txt") || f.toString().endsWith(".protocol")).toList(); - } - } catch (IOException | URISyntaxException e) { - throw new RunnerException(e); - } - - - statusConsumer.accept(LinterStatus.EXECUTING_TESTS); - try { - ExecutorService service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); - List> futures = new ArrayList<>(); - for (Path testPath : testCases) { - futures.add(service.submit(() -> executeTestCase(dockerClient, imageId, testPath, mainClass))); - } - List results = new ArrayList<>(); - for (var future : futures) { - try { - results.add(future.get()); - } catch (ExecutionException e) { - throw new RunnerException(e.getCause()); - } - } - service.shutdown(); - - System.out.println(System.lineSeparator()); - System.out.println( - results.stream().filter(t -> t.status() == TestRunResult.TestRunStatus.OK).count() + "/" + - results.size() + " tests successful"); - - return results; - } finally { - dockerClient.removeImageCmd(imageId).withForce(true).exec(); - } - } - - private TestRunResult executeTestCase(DockerClient dockerClient, String imageId, Path testFile, String mainClass) - throws IOException, InterruptedException, DockerRunnerException { - - List interactionLines = Files.readAllLines(testFile); - String containerId = dockerClient - .createContainerCmd(imageId) - .withHostConfig( - new HostConfig() - .withCapDrop() - .withNetworkMode("none") - .withPidsLimit(2000L) - .withMemory(200 * (1L << 20)) - ) - .withCmd(mainClass, Base64.getEncoder() - .encodeToString(String.join("\n", interactionLines).getBytes(StandardCharsets.UTF_8)), - String.valueOf(false)) - .exec() - .getId(); - - try { - dockerClient.startContainerCmd(containerId).exec(); - - TestRunResult.TestRunStatus status = TestRunResult.TestRunStatus.OK; - int exitCode; - try { - exitCode = dockerClient - .waitContainerCmd(containerId) - .exec(new WaitContainerResultCallback()) - .awaitStatusCode(TIMEOUT_SECONDS, TimeUnit.SECONDS); - } catch (DockerClientException ex) { - throw new DockerRunnerException("The test container timed out", readLogs(dockerClient, containerId)); - } - - if (exitCode == 1) { - status = TestRunResult.TestRunStatus.ERROR_TEST_FAILURE; - } else if (exitCode == 2) { - throw new DockerRunnerException("The executor failed", readLogs(dockerClient, containerId)); - } - - String logs = readLogs(dockerClient, containerId); - - List events; - try { - InputStream tar = dockerClient - .copyArchiveFromContainerCmd(containerId, "/home/student/codelinter_events.txt") - .exec(); - events = Event.read(extractSingleFileFromTar(tar)); - } catch (NotFoundException ex) { - events = List.of(); - } - - synchronized (this) { - System.out.println(System.lineSeparator()); - System.out.println(logs); - if (events.isEmpty()) { - System.err.println("No events found. Maybe the student's code timed out."); - System.err.flush(); - } - } - - return new TestRunResult(events, status, logs); - } finally { - dockerClient.removeContainerCmd(containerId) - .withForce(true) - .exec(); - } - } - - private InputStream extractSingleFileFromTar(InputStream tar) throws IOException { - TarArchiveInputStream tarStream = new TarArchiveInputStream(tar); - if (tarStream.getNextEntry() == null) { - throw new IllegalArgumentException("No file found inside the tar file"); - } - return tarStream; - } - - private String readLogs(DockerClient client, String containerId) throws InterruptedException { - StringBuilder log = new StringBuilder(); - client.logContainerCmd(containerId) - .withStdOut(true) - .withStdErr(true) - .exec(new ResultCallback.Adapter<>() { - @Override - public void onNext(Frame frame) { - log.append(frame); - log.append(System.lineSeparator()); - } - }).awaitCompletion(); - return log.toString(); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerRunnerException.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerRunnerException.java deleted file mode 100644 index a581ceb6..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DockerRunnerException.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import de.firemage.autograder.core.LinterException; - -public class DockerRunnerException extends LinterException { - public DockerRunnerException(String message, String executorLog) { - super(message + System.lineSeparator() + "=============== Executor Log ===============" + System.lineSeparator() + executorLog); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DynamicAnalysis.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DynamicAnalysis.java deleted file mode 100644 index 97a4242f..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/DynamicAnalysis.java +++ /dev/null @@ -1,69 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import de.firemage.autograder.event.Event; -import de.firemage.autograder.event.MethodEvent; -import spoon.reflect.declaration.CtMethod; -import spoon.reflect.declaration.CtParameter; -import spoon.reflect.reference.CtArrayTypeReference; -import spoon.reflect.reference.CtTypeReference; -import java.util.List; -import java.util.stream.Stream; - -public class DynamicAnalysis { - - private final List results; - - public DynamicAnalysis(List results) { - this.results = results; - } - - public List getResults() { - return results; - } - - public Stream getAllEvents() { - return this.results.stream().flatMap(result -> result.events().stream()); - } - - public Stream getEventsWithType(Class type) { - return this.getAllEvents().filter(e -> e.getClass().equals(type)).map(e -> (E) e); - } - - public Stream findEventsForMethod(CtMethod method) { - String descriptor = createDescriptor(method); - return this.getAllEvents() - .filter(e -> e instanceof MethodEvent) - .map(e -> (MethodEvent) e) - .filter(e -> e.getOwningClass().equals(method.getDeclaringType().getQualifiedName().replace(".", "/"))) - .filter(e -> e.getMethodName().equals(method.getSimpleName())) - .filter(e -> e.getMethodDescriptor().equals(descriptor)); - } - - private String createDescriptor(CtMethod method) { - StringBuilder descriptor = new StringBuilder("("); - for (CtParameter parameter : method.getParameters()) { - descriptor.append(internalizeType(parameter.getType())); - } - descriptor.append(")"); - descriptor.append(internalizeType(method.getType())); - return descriptor.toString(); - } - - private String internalizeType(CtTypeReference type) { - if (type.isArray()) { - return "[" + internalizeType(((CtArrayTypeReference) type).getComponentType()); - } - return switch (type.getQualifiedName()) { - case "byte" -> "B"; - case "char" -> "C"; - case "double" -> "D"; - case "float" -> "F"; - case "int" -> "I"; - case "long" -> "J"; - case "short" -> "S"; - case "boolean" -> "Z"; - case "void" -> "V"; - default -> "L" + type.getQualifiedName().replace(".", "/") + ";"; - }; - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/RunnerException.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/RunnerException.java deleted file mode 100644 index 29c4dca0..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/RunnerException.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import de.firemage.autograder.core.LinterException; - -public class RunnerException extends LinterException { - public RunnerException() { - } - - public RunnerException(String message) { - super(message); - } - - public RunnerException(String message, Throwable cause) { - super(message, cause); - } - - public RunnerException(Throwable cause) { - super(cause); - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunResult.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunResult.java deleted file mode 100644 index 8d2b2d09..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunResult.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -import de.firemage.autograder.event.Event; -import java.util.List; - -public record TestRunResult(List events, TestRunStatus status, String executorOutput) { - - public enum TestRunStatus { - OK, - ERROR_TEST_FAILURE, - } -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunner.java b/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunner.java deleted file mode 100644 index 8fc75895..00000000 --- a/autograder-core/src/main/java/de/firemage/autograder/core/dynamic/TestRunner.java +++ /dev/null @@ -1,4 +0,0 @@ -package de.firemage.autograder.core.dynamic; - -public interface TestRunner { -} diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedAnalysis.java b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedAnalysis.java index 48351c16..acdf9097 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedAnalysis.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedAnalysis.java @@ -2,10 +2,6 @@ import de.firemage.autograder.core.LinterStatus; import de.firemage.autograder.core.check.Check; -import de.firemage.autograder.core.dynamic.DockerConsoleRunner; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; -import de.firemage.autograder.core.dynamic.RunnerException; -import de.firemage.autograder.core.dynamic.TestRunResult; import de.firemage.autograder.core.file.UploadedFile; import de.firemage.autograder.core.integrated.graph.GraphAnalysis; import de.firemage.autograder.core.parallel.AnalysisScheduler; @@ -43,7 +39,6 @@ public class IntegratedAnalysis { private final CtModel originalModel; private final StaticAnalysis staticAnalysis; private final GraphAnalysis graphAnalysis; - private DynamicAnalysis dynamicAnalysis; public IntegratedAnalysis(UploadedFile file, Path tmpPath) { this.file = file; @@ -55,25 +50,9 @@ public IntegratedAnalysis(UploadedFile file, Path tmpPath) { this.staticAnalysis = new StaticAnalysis(file.getModel(), file.getCompilationResult()); //this.graphAnalysis = new GraphAnalysis(this.staticAnalysis.getCodeModel()); this.graphAnalysis = null; //TODO - this.dynamicAnalysis = new DynamicAnalysis(List.of()); } - public void runDynamicAnalysis(Path tests, Consumer statusConsumer) - throws RunnerException, InterruptedException { - try { - DockerConsoleRunner runner = new DockerConsoleRunner(toPath(this.getClass().getResource("/executor.jar")), - toPath(this.getClass().getResource("/agent.jar")), tests, this.tmpPath); - List results = - runner.runTests(this.staticAnalysis, this.file.getCompilationResult().jar(), statusConsumer); - this.dynamicAnalysis = new DynamicAnalysis(results); - } catch (URISyntaxException | IOException e) { - throw new RunnerException(e); - } finally { - closeOpenFileSystems(); - } - } - private Path toPath(URL resource) throws URISyntaxException, IOException { if (resource == null) { throw new IllegalArgumentException("URL is null"); @@ -121,7 +100,6 @@ public void lint(List checks, Consumer statusCons long beforeTime = System.nanoTime(); reporter.reportProblems(check.run( this.staticAnalysis, - this.dynamicAnalysis, this.file.getSource() )); long afterTime = System.nanoTime(); @@ -208,8 +186,4 @@ private static List findOrphans(CtModel ctModel) { public StaticAnalysis getStaticAnalysis() { return staticAnalysis; } - - public DynamicAnalysis getDynamicAnalysis() { - return dynamicAnalysis; - } } diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedCheck.java b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedCheck.java index 0fe04c37..0a38b2e9 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedCheck.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/integrated/IntegratedCheck.java @@ -7,7 +7,6 @@ import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.Translatable; import de.firemage.autograder.core.check.Check; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.file.SourceInfo; import spoon.reflect.declaration.CtElement; @@ -28,14 +27,14 @@ protected void addLocalProblem(CodePosition position, Translatable explanation, this.problems.add(new ProblemImpl(this, position, explanation, problemType) {}); } - public List run(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis, SourceInfo sourceInfo) { + public List run(StaticAnalysis staticAnalysis, SourceInfo sourceInfo) { this.problems.clear(); this.sourceInfo = sourceInfo; - this.check(staticAnalysis, dynamicAnalysis); + this.check(staticAnalysis); return this.problems; } - protected abstract void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis); + protected abstract void check(StaticAnalysis staticAnalysis); @Override public LocalizedMessage getLinter() { diff --git a/autograder-core/src/main/resources/de/firemage/autograder/core/dynamic/Dockerfile b/autograder-core/src/main/resources/de/firemage/autograder/core/dynamic/Dockerfile deleted file mode 100644 index d9833b5b..00000000 --- a/autograder-core/src/main/resources/de/firemage/autograder/core/dynamic/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM openjdk:17-slim - -ARG jarfile -ARG executor -ARG agent - -RUN useradd --uid 10000 -m student -COPY $executor /home/student/Executor.jar -COPY $agent /home/student/Agent.jar -COPY $jarfile /home/student/studentcode.jar -USER student -ENTRYPOINT ["java", "-jar", "/home/student/Executor.jar"] diff --git a/autograder-core/src/main/resources/strings.de.ftl b/autograder-core/src/main/resources/strings.de.ftl index 7b1eafb5..d6df813b 100644 --- a/autograder-core/src/main/resources/strings.de.ftl +++ b/autograder-core/src/main/resources/strings.de.ftl @@ -5,8 +5,6 @@ status-pmd = Running PMD status-cpd = Running Copy/Paste-Detection status-error-prone = Running error-prone status-model = Building the code model -status-docker = Building the Docker image -status-tests = Executing tests status-integrated = Running integrated analysis # Linters @@ -71,8 +69,6 @@ javadoc-unexpected-tag = Der JavaDoc-Kommentar sollte keinen '@{$tag}'-Tag haben javadoc-type-exp-invalid-author = Im @author-Tag sollte dein u-Kürzel stehen: {$authors} -javadoc-return-null-exp = Die Methode {$method} kann null zurückgeben, der @return-Tag erwähnt das aber nicht - javadoc-stub-exp-desc = Die Beschreibung des Javadoc-Kommentars ist leer javadoc-stub-exp-param = Nichtssagende Beschreibung für den Parameter '{$param}' javadoc-stub-exp-return = Nichtssagende Beschreibung für den Rückgabewert @@ -159,8 +155,6 @@ reassigned-parameter = Dem Parameter '{$name}' sollte kein neuer Wert zugewiesen double-brace-init = Die obskure 'Double Brace'-Syntax sollte vermieden werden -field-local-exp = Das Attribut '{$field}' der Klasse {$class} sollte eine lokale Variable sein, da sie in jeder Methode vor dem ersten Lesen überschrieben wird - missing-override = '{$name}' sollte eine '@Override'-Annotation haben, siehe https://stackoverflow.com/a/94411/7766117. system-specific-linebreak = Systemabhängiger Zeilenumbruch (\n) benutzt. Besser ist System.lineSeparator() oder (falls es sich um einen format-String handelt) '%n'. diff --git a/autograder-core/src/main/resources/strings.en.ftl b/autograder-core/src/main/resources/strings.en.ftl index f13e591a..1a898bad 100644 --- a/autograder-core/src/main/resources/strings.en.ftl +++ b/autograder-core/src/main/resources/strings.en.ftl @@ -5,8 +5,6 @@ status-pmd = Running PMD status-cpd = Running Copy/Paste-Detection status-error-prone = Running error-prone status-model = Building the code model -status-docker = Building the Docker image -status-tests = Executing tests status-integrated = Running integrated analysis # Linters @@ -72,8 +70,6 @@ javadoc-unexpected-tag = The JavaDoc comment should not have an '@{$tag}' tag. javadoc-type-exp-invalid-author = The @author tag should contain your u-shorthand: {$authors} -javadoc-return-null-exp = The method {$method} may return null but the @return tag doesn't mention it - javadoc-stub-exp-desc = Javadoc has an empty description javadoc-stub-exp-param = Stub description for parameter {$param} javadoc-stub-exp-return = Stub description for return value @@ -161,8 +157,6 @@ reassigned-parameter = The parameter '{$name}' should not be assigned a new valu double-brace-init = Don't use the obscure 'double brace initialization' syntax -field-local-exp = Field '{$field}' of class {$class} should be converted to a local variable as every method overwrites it before reading it - missing-override = '{$name}' should have an '@Override'-annotation, see https://stackoverflow.com/a/94411/7766117. system-specific-linebreak = Always use system-independent line breaks such as the value obtained from System.lineSeparator() or %n in format strings diff --git a/autograder-core/src/test/java/de/firemage/autograder/core/CheckTest.java b/autograder-core/src/test/java/de/firemage/autograder/core/CheckTest.java index 0258b354..38130dc2 100644 --- a/autograder-core/src/test/java/de/firemage/autograder/core/CheckTest.java +++ b/autograder-core/src/test/java/de/firemage/autograder/core/CheckTest.java @@ -22,7 +22,6 @@ import static org.junit.jupiter.api.Assertions.fail; public class CheckTest { - private static final boolean ENABLE_DYNAMIC = false; // an empty list means that all tests should be executed // this is useful for debugging/executing only relevant tests // @@ -77,15 +76,6 @@ public static TestInput fromPath(Path path) { } } - /** - * Checks if the test is dynamic or static. - * - * @return true if the test is dynamic, false otherwise - */ - public boolean isDynamic() { - return Files.exists(this.path.resolve("tests")); - } - public String testName() { return "Check E2E Test: %s".formatted(this.config.description()); } @@ -104,7 +94,7 @@ Stream createCheckTest() throws URISyntaxException, IOException { TempLocation tempLocation = TempLocation.random(); return DynamicTest.stream( - folders.stream().map(TestInput::fromPath).filter(testInput -> !testInput.isDynamic() || ENABLE_DYNAMIC) + folders.stream().map(TestInput::fromPath) .filter(testInput -> ONLY_TEST.isEmpty() || ONLY_TEST.contains(testInput.config().checkPath())), TestInput::testName, testInput -> { @@ -119,7 +109,6 @@ Stream createCheckTest() throws URISyntaxException, IOException { }, null ); var linter = Linter.builder(Locale.US) - .enableDynamicAnalysis(ENABLE_DYNAMIC && testInput.isDynamic()) .threads(1) // Use a single thread for performance reasons .tempLocation(tmpDirectory) .build(); diff --git a/autograder-core/src/test/java/de/firemage/autograder/core/TestLocalizedStrings.java b/autograder-core/src/test/java/de/firemage/autograder/core/TestLocalizedStrings.java index 89c877bc..5ac08ca8 100644 --- a/autograder-core/src/test/java/de/firemage/autograder/core/TestLocalizedStrings.java +++ b/autograder-core/src/test/java/de/firemage/autograder/core/TestLocalizedStrings.java @@ -65,8 +65,6 @@ class TestLocalizedStrings { "status-pmd", "status-cpd", "status-model", - "status-docker", - "status-tests", "status-integrated", "linter-cpd", "linter-spotbugs", diff --git a/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestFramework.java b/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestFramework.java index 3b95db47..d8cb8f70 100644 --- a/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestFramework.java +++ b/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestFramework.java @@ -34,8 +34,6 @@ public class TestFramework { */ private static final List ONLY_TEST = List.of(); - private static final boolean ENABLE_DYNAMIC = false; - @TestFactory // @Execution(ExecutionMode.CONCURRENT) Stream createCheckTests() throws URISyntaxException, IOException { @@ -48,7 +46,7 @@ Stream createCheckTests() throws URISyntaxException, IOException { try (TempLocation tempLocation = TempLocation.random()) { return DynamicTest.stream( - folders.stream().map(TestInput::new).filter(testInput -> !testInput.isDynamic() || ENABLE_DYNAMIC) + folders.stream().map(TestInput::new) .filter(testInput -> ONLY_TEST.isEmpty() || ONLY_TEST.contains(testInput.config().checkPath())), TestInput::testName, testInput -> { @@ -69,7 +67,6 @@ private static List runAutograder(TestInput testInput, TempLoca }, null ); var linter = Linter.builder(Locale.US) - .enableDynamicAnalysis(ENABLE_DYNAMIC && testInput.isDynamic()) .threads(1) // Use a single thread for performance reasons .tempLocation(tmpDirectory) .build(); diff --git a/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestInput.java b/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestInput.java index 6b7b8c0b..21b5ed16 100644 --- a/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestInput.java +++ b/autograder-core/src/test/java/de/firemage/autograder/core/framework/TestInput.java @@ -42,15 +42,6 @@ public TestInput(Path path) { this.sourceInfo = StringSourceInfo.fromSourceStrings(JavaVersion.JAVA_17, sources); } - /** - * Checks if the test is dynamic or static. - * - * @return true if the test is dynamic, false otherwise - */ - public boolean isDynamic() { - return Files.exists(this.path.resolve("tests")); - } - public String testName() { return "Check E2E Test: %s".formatted(this.path.getFileName()); } diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/code/Test.java b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/code/Test.java deleted file mode 100644 index 2215e96d..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/code/Test.java +++ /dev/null @@ -1,34 +0,0 @@ -package de.firemage.autograder.core.check_tests.FieldShouldBeLocal.code; - -public class Test { - public int a; /*# ok; because public #*/ - private int b; /*# not ok; because always overwritten #*/ - private Object c; /*# not ok; because always overwritten #*/ - private Object d = new Object(); /*# ok; because not always overwritten before being read #*/ - - public static void main(String[] args) { - Test test = new Test(); - test.foo(); - test.bar(); - } - - private void foo() { - this.a = 1; - this.b = 1; - this.c = new Object(); - this.d = new Object(); - if (this.a > 0 && this.b > 0 && this.c != null && this.d != null) { - // ... - } - } - - private void bar() { - this.a = 1; - this.b = 1; - this.c = new Object(); - if (this.a > 0 && this.b > 0 && this.c != null && this.d != null) { - // ... - } - this.d = null; - } -} diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/config.txt b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/config.txt deleted file mode 100644 index 701aa92b..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/config.txt +++ /dev/null @@ -1,4 +0,0 @@ -general.FieldShouldBeLocalCheck -Field should be local -Test.java:5 -Test.java:6 diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/tests/test.protocol b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/tests/test.protocol deleted file mode 100644 index 8a339391..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/FieldShouldBeLocal/tests/test.protocol +++ /dev/null @@ -1,4 +0,0 @@ -name: Test -comment: -args: --- diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/code/Test.java b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/code/Test.java deleted file mode 100644 index d269ef78..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/code/Test.java +++ /dev/null @@ -1,104 +0,0 @@ -package de.firemage.autograder.core.check_tests.JavadocReturnNull.code; - -public class Test { - public static void main(String[] args) { - Test test = new Test(); - test.returnAlwaysNullMentioned(); - test.returnAlwaysNullNotMentioned(); - test.returnNeverNull(); - test.returnSometimesNullMentioned(0); - test.returnSometimesNullMentioned(1); - test.returnSometimesNullNotMentioned(0); - test.returnSometimesNullNotMentioned(1); - test.returnAlwaysNullMissingJavadoc(); - test.returnAlwaysNullMissingReturnTag(); - test.returnInt(); - test.privateReturnAlwaysNullWithJavadoc(); - } - - /** - * ... - * @return the value or null - */ - public Object returnAlwaysNullMentioned() { - if (true) { - return null; - } else { - return false; - } - } - - /** - * ... - * @return the value - */ - public Object returnAlwaysNullNotMentioned() { - if (true) { - return null; - } else { - return false; - } - } - - /** - * ... - * @return the value - */ - public Object returnNeverNull() { - if (false) { - return null; - } else { - return false; - } - } - - /** - * ... - * @return the value or null - */ - public Object returnSometimesNullMentioned(int x) { - if (x > 0) { - return new Object(); - } else { - return null; - } - } - - /** - * ... - * @return the value - */ - public Object returnSometimesNullNotMentioned(int x) { - if (x > 0) { - return new Object(); - } else { - return null; - } - } - - public Object returnAlwaysNullMissingJavadoc() { - return null; - } - - /** - * ... - */ - public Object returnAlwaysNullMissingReturnTag() { - return null; - } - - /** - * ... - */ - public int returnInt() { - return 0; - } - - /** - * ... - * @return the value - */ - private Object privateReturnAlwaysNullWithJavadoc() { - return null; - } -} diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/config.txt b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/config.txt deleted file mode 100644 index be76194a..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/config.txt +++ /dev/null @@ -1,4 +0,0 @@ -comment.JavadocReturnNullCheck -Javadoc doesn't mention possible null return -Test.java:36-39 -Test.java:72-75 diff --git a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/tests/test.protocol b/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/tests/test.protocol deleted file mode 100644 index 8a339391..00000000 --- a/autograder-core/src/test/resources/de/firemage/autograder/core/check_tests/JavadocReturnNull/tests/test.protocol +++ /dev/null @@ -1,4 +0,0 @@ -name: Test -comment: -args: --- diff --git a/autograder-event/pom.xml b/autograder-event/pom.xml deleted file mode 100644 index 8cac26f3..00000000 --- a/autograder-event/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - autograder-parent - de.firemage.autograder - 0.5.35 - - 4.0.0 - - autograder-event - autograder-event - Event tracing for the Autograder - https://github.com/Feuermagier/autograder/autograder-event - diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/Event.java b/autograder-event/src/main/java/de/firemage/autograder/event/Event.java deleted file mode 100644 index b0280d9a..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/Event.java +++ /dev/null @@ -1,48 +0,0 @@ -package de.firemage.autograder.event; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.stream.Collectors; - -public interface Event { - static void write(List events, Path path) throws IOException { - try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) { - for (Event event : events) { - writer.write(event.format()); - writer.newLine(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - static List read(Path path) throws IOException { - return Event.read(Files.newInputStream(path)); - } - - static List read(InputStream inputStream) throws IOException { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { - return reader.lines().map(line -> { - String[] parts = line.split(":"); - return switch(parts[0]) { - case "RefRet" -> new ReferenceReturnEvent(parts[1], parts[2], parts[3], parts[4]); - case "PrimRet" -> new PrimitiveReturnEvent(parts[1], parts[2], parts[3], parts[4]); - case "GetField" -> new GetFieldEvent(parts[1], parts[2], parts[3], parts[4], parts[5], parts[6]); - case "PutField" -> new PutFieldEvent(parts[1], parts[2], parts[3], parts[4], parts[5], parts[6]); - case "Enter" -> new MethodEnterEvent(parts[1], parts[2], parts[3]); - case "Throw" -> new MethodExitThrowEvent(parts[1], parts[2], parts[3], parts[4]); - default -> throw new IllegalStateException("Unknown event type '" + parts[0] + "'"); - }; - }).collect(Collectors.toList()); - } - } - - String format(); -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/GetFieldEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/GetFieldEvent.java deleted file mode 100644 index 959193ef..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/GetFieldEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -package de.firemage.autograder.event; - -import java.util.List; - -public class GetFieldEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - private final String target; - private final String field; - private final String value; - - public GetFieldEvent(String clazz, String methodName, String methodDesc, String target, String field, - String value) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - this.target = target; - this.field = field; - this.value = value; - } - - @Override - public String format() { - return String.join(":", - List.of("GetField", this.clazz, this.methodName, this.methodDesc, this.target, this.field, this.value)); - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } - - public String getTarget() { - return target; - } - - public String getField() { - return field; - } - - public String getValue() { - return value; - } -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/MethodEnterEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/MethodEnterEvent.java deleted file mode 100644 index 7454f579..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/MethodEnterEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package de.firemage.autograder.event; - -import java.util.List; - -public class MethodEnterEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - - public MethodEnterEvent(String clazz, String methodName, String methodDesc) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - } - - @Override - public String format() { - return String.join(":", - List.of("Enter", this.clazz, this.methodName, this.methodDesc)); - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/MethodEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/MethodEvent.java deleted file mode 100644 index 8f2f8e93..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/MethodEvent.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.firemage.autograder.event; - -public interface MethodEvent extends Event { - String getOwningClass(); - String getMethodName(); - String getMethodDescriptor(); -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/MethodExitThrowEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/MethodExitThrowEvent.java deleted file mode 100644 index 6c550f2c..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/MethodExitThrowEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -package de.firemage.autograder.event; - -import java.util.List; - -public class MethodExitThrowEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - private final String exception; - - public MethodExitThrowEvent(String clazz, String methodName, String methodDesc, String exception) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - this.exception = exception; - } - - @Override - public String format() { - return String.join(":", - List.of("Throw", this.clazz, this.methodName, this.methodDesc, this.exception)); - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } - - public String getException() { - return exception; - } -} - diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/PrimitiveReturnEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/PrimitiveReturnEvent.java deleted file mode 100644 index 9fa4bfba..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/PrimitiveReturnEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.firemage.autograder.event; - -import java.util.List; - -public class PrimitiveReturnEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - private final Object value; - - public PrimitiveReturnEvent(String clazz, String methodName, String methodDesc, Object value) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - this.value = value; - } - - public Object getValue() { - return this.value; - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } - - @Override - public String format() { - return String.join(":", - List.of("PrimRet", this.clazz, this.methodName, this.methodDesc, this.value.toString())); - } -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/PutFieldEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/PutFieldEvent.java deleted file mode 100644 index 8bedd62a..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/PutFieldEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -package de.firemage.autograder.event; - -import java.util.List; - -public class PutFieldEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - private final String target; - private final String field; - private final String value; - - public PutFieldEvent(String clazz, String methodName, String methodDesc, String target, String field, - String value) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - this.target = target; - this.field = field; - this.value = value; - } - - @Override - public String format() { - return String.join(":", - List.of("PutField", this.clazz, this.methodName, this.methodDesc, this.target, this.field, this.value)); - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } - - public String getTarget() { - return target; - } - - public String getField() { - return field; - } - - public String getValue() { - return value; - } -} diff --git a/autograder-event/src/main/java/de/firemage/autograder/event/ReferenceReturnEvent.java b/autograder-event/src/main/java/de/firemage/autograder/event/ReferenceReturnEvent.java deleted file mode 100644 index aaa9a154..00000000 --- a/autograder-event/src/main/java/de/firemage/autograder/event/ReferenceReturnEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -package de.firemage.autograder.event; - -public class ReferenceReturnEvent implements MethodEvent { - private final String clazz; - private final String methodName; - private final String methodDesc; - private final String returnedClass; - - public ReferenceReturnEvent(String clazz, String methodName, String methodDesc, String returnedClass) { - this.clazz = clazz; - this.methodName = methodName; - this.methodDesc = methodDesc; - this.returnedClass = returnedClass; - } - - public String getReturnedClass() { - return this.returnedClass; - } - - public boolean returnedNull() { - return this.returnedClass.equals("null"); - } - - @Override - public String getOwningClass() { - return this.clazz; - } - - @Override - public String getMethodName() { - return this.methodName; - } - - @Override - public String getMethodDescriptor() { - return this.methodDesc; - } - - @Override - public String format() { - return "RefRet:" + this.clazz + ":" + this.methodName + ":" + this.methodDesc + ":" + this.returnedClass; - } -} diff --git a/autograder-executor/pom.xml b/autograder-executor/pom.xml deleted file mode 100644 index f5795782..00000000 --- a/autograder-executor/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - autograder-parent - de.firemage.autograder - 0.5.35 - - 4.0.0 - - autograder-executor - autograder-executor - Safe execution of untrusted Java code as part of the Autograder - https://github.com/Feuermagier/autograder/autograder-executor - - - - - de.firemage.autograder - autograder-event - - - - - org.ow2.asm - asm - ${asm.version} - - - org.ow2.asm - asm-commons - ${asm.version} - - - org.ow2.asm - asm-util - ${asm.version} - - - - - - - maven-assembly-plugin - - - - de.firemage.autograder.executor.Main - - - - jar-with-dependencies - - executor - - - - make-assembly - - single - - compile - - - - - - diff --git a/autograder-executor/src/main/java/de/firemage/autograder/executor/ConsoleExecutor.java b/autograder-executor/src/main/java/de/firemage/autograder/executor/ConsoleExecutor.java deleted file mode 100644 index 185b21d1..00000000 --- a/autograder-executor/src/main/java/de/firemage/autograder/executor/ConsoleExecutor.java +++ /dev/null @@ -1,171 +0,0 @@ -package de.firemage.autograder.executor; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Queue; -import java.util.Scanner; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.TimeUnit; - -public class ConsoleExecutor { - public void execute(String mainClass, String test, boolean quitOnFailure) throws IOException, InterruptedException { - Iterator lines = Arrays.stream(test.split("\n")).iterator(); - List args = parseHeader(lines); - if (executeTest(args, mainClass, lines, quitOnFailure)) { - System.err.println("EXEC: Test success"); - } else { - System.err.println("EXEC: Test failure"); - } - } - - private List parseHeader(Iterator lines) { - List args = null; - while (lines.hasNext()) { - String line = lines.next(); - if (line.startsWith("--")) { - return args; - } else if (line.startsWith("name:")) { - System.out.println("EXEC: Running test " + line.substring(6)); - } else if (line.startsWith("comment:")) { - System.out.println("EXEC: " + line.substring(9)); - } else if (line.startsWith("args:")) { - if (line.length() <= 6) { - args = List.of(); - } else { - args = List.of(line.substring(6).split(" ")); - } - } - } - throw new IllegalStateException("Invalid test file: end of header missing"); - } - - private boolean executeTest(List args, String mainClass, Iterator lines, boolean quitOnFailure) - throws IOException, InterruptedException { - - Process process = Util.startJVM(mainClass, args); - - OutputStream containerIn = process.getOutputStream(); - - Queue containerOut = new ConcurrentLinkedQueue<>(); - Thread outThread = new Thread(new ProcessReader(containerOut, process.getInputStream())); - outThread.setDaemon(true); - outThread.start(); - - boolean failed = false; - while (lines.hasNext()) { - String line = lines.next(); - if (line.startsWith("###")) { - // Comment - ignore - } else if (line.startsWith(">")) { - // Input - pollAllOutput(containerOut); - System.out.println("IN: " + line.substring(1)); - containerIn.write(line.substring(1).getBytes()); - containerIn.write("\n".getBytes()); - containerIn.flush(); - } else { - // Expected output - String output = pollOutput(process, containerOut); - if (output == null) { - pollAllOutput(containerOut); - System.err.println("EXEC: The child JVM exited unexpectedly"); - System.exit(1); - } - if (!matchOutput(output, line)) { - failed = true; - if (quitOnFailure) { - killVM(process); - pollAllOutput(containerOut); - return false; - } - - } - } - } - - if (!process.waitFor(5, TimeUnit.SECONDS)) { - System.err.println("EXEC: The child JVM did not exit after 5s"); - killVM(process); - pollAllOutput(containerOut); - return false; - } - - pollAllOutput(containerOut); - - System.out.println("EXEC: Child JVM exited"); - - if (process.exitValue() != 0) { - System.err.println("EXEC: The child JVM did not exit with exit code 0"); - return false; - } - - return !failed; - } - - private boolean matchOutput(String output, String line) { - if (line.equals(output) || - (line.equals("!A!!R!^(E|e)rror.*") && (output.startsWith("Error") || output.startsWith("error")))) { - return true; - } else { - System.err.println("EXEC: Invalid output, got '" + output + "', expected '" + line + "' "); - return false; - } - } - - private String pollOutput(Process process, Queue queue) throws InterruptedException { - long beforeTime = System.currentTimeMillis(); - while (true) { - if (!queue.isEmpty()) { - String result = queue.poll(); - if (result.startsWith("AGENT")) { - System.out.println(result); - continue; - } - System.out.println("OUT: " + result); - return result; - } - if (System.currentTimeMillis() - beforeTime > 5000) { - System.err.println("EXEC: Did not receive any output after 5s"); - System.exit(1); - } - if (!process.isAlive()) { - return null; - } - Thread.sleep(10); - } - } - - private void killVM(Process process) throws InterruptedException { - process.destroy(); - if (!process.waitFor(5, TimeUnit.SECONDS)) { - process.destroyForcibly(); - } - } - - private void pollAllOutput(Queue containerOut) { - while (!containerOut.isEmpty()) { - System.out.println("OUT: " + containerOut.poll()); - } - } - - private static class ProcessReader implements Runnable { - private final Scanner scanner; - private final Queue queue; - - private ProcessReader(Queue queue, InputStream inputStream) { - this.queue = queue; - this.scanner = new Scanner(inputStream); - } - - @Override - public void run() { - while (this.scanner.hasNextLine()) { - this.queue.add(this.scanner.nextLine()); - } - } - } -} diff --git a/autograder-executor/src/main/java/de/firemage/autograder/executor/Main.java b/autograder-executor/src/main/java/de/firemage/autograder/executor/Main.java deleted file mode 100644 index ae1af7f8..00000000 --- a/autograder-executor/src/main/java/de/firemage/autograder/executor/Main.java +++ /dev/null @@ -1,16 +0,0 @@ -package de.firemage.autograder.executor; - -import java.io.IOException; -import java.util.Base64; - -public class Main { - public static void main(String[] args) throws IOException, InterruptedException { - String main = args[0]; - - if (args.length == 3) { - String test = new String(Base64.getDecoder().decode(args[1])); - System.out.println("=============== Running a console test =================="); - new ConsoleExecutor().execute(main, test, Boolean.parseBoolean(args[2])); - } - } -} diff --git a/autograder-executor/src/main/java/de/firemage/autograder/executor/Util.java b/autograder-executor/src/main/java/de/firemage/autograder/executor/Util.java deleted file mode 100644 index 408f3110..00000000 --- a/autograder-executor/src/main/java/de/firemage/autograder/executor/Util.java +++ /dev/null @@ -1,26 +0,0 @@ -package de.firemage.autograder.executor; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -public final class Util { - private Util() { - - } - - public static Process startJVM(String mainClass, List args) throws IOException { - List command = new ArrayList<>(List.of( - "java", - "-Xmx512m", - "-cp", - "/home/student/studentcode.jar", - "-javaagent:/home/student/Agent.jar", - mainClass - )); - command.addAll(args); - ProcessBuilder builder = new ProcessBuilder(command); - builder.redirectErrorStream(true); - return builder.start(); - } -} diff --git a/pom.xml b/pom.xml index d2bc97c1..a08981d1 100644 --- a/pom.xml +++ b/pom.xml @@ -81,21 +81,6 @@ - - de.firemage.autograder - autograder-event - 0.5.35 - - - de.firemage.autograder - autograder-agent - 0.5.35 - - - de.firemage.autograder - autograder-executor - 0.5.35 - de.firemage.autograder autograder-core @@ -246,9 +231,6 @@ autograder-core autograder-cmd - autograder-executor - autograder-event - autograder-agent autograder-treeg autograder-span @@ -262,9 +244,6 @@ autograder-core autograder-cmd - autograder-executor - autograder-event - autograder-agent autograder-treeg autograder-span diff --git a/sample_config.yaml b/sample_config.yaml index c02645a1..623b667a 100644 --- a/sample_config.yaml +++ b/sample_config.yaml @@ -11,7 +11,6 @@ - JAVADOC_STUB_THROWS_TAG - JAVADOC_MISSING_PARAMETER_TAG - JAVADOC_UNKNOWN_PARAMETER_TAG -- JAVADOC_INCOMPLETE_RETURN_TAG - UNUSED_DIAMOND_OPERATOR - EXPLICITLY_EXTENDS_OBJECT - FOR_WITH_MULTIPLE_VARIABLES @@ -36,7 +35,6 @@ - DUPLICATE_CODE - REASSIGNED_PARAMETER - DOUBLE_BRACE_INITIALIZATION -- INSTANCE_FIELD_CAN_BE_LOCAL - FOR_CAN_BE_FOREACH - OVERRIDE_ANNOTATION_MISSING - SYSTEM_SPECIFIC_LINE_BREAK From 9594e8330ef84a11f2b964662b89cbddbdcf9193 Mon Sep 17 00:00:00 2001 From: Florian Seligmann Date: Wed, 17 Apr 2024 14:59:28 +0200 Subject: [PATCH 2/3] fix A1 test --- .../src/test/java/de/firemage/autograder/cmd/A1Test.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autograder-cmd/src/test/java/de/firemage/autograder/cmd/A1Test.java b/autograder-cmd/src/test/java/de/firemage/autograder/cmd/A1Test.java index b9bbef28..cba4f383 100644 --- a/autograder-cmd/src/test/java/de/firemage/autograder/cmd/A1Test.java +++ b/autograder-cmd/src/test/java/de/firemage/autograder/cmd/A1Test.java @@ -8,7 +8,7 @@ class A1Test { @Test void testA1() { // Only checks whether the autograder fails - int returnCode = Application.runApplication("../sample_config.yaml", "../test_submissions/A1/code", "-j", "17", "-s"); + int returnCode = Application.runApplication("../sample_config.yaml", "../test_submissions/A1/code", "-j", "17"); assertEquals(0, returnCode); } } From fb75a1624d1d0ee27f2b9bf375c068e45e58b42b Mon Sep 17 00:00:00 2001 From: Luro02 <24826124+Luro02@users.noreply.github.com> Date: Thu, 18 Apr 2024 08:49:44 +0200 Subject: [PATCH 3/3] fix merge conflicts --- .../autograder/core/check/general/LoopShouldBeDoWhile.java | 3 +-- .../autograder/core/check/general/LoopShouldBeFor.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeDoWhile.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeDoWhile.java index 08f6ba5f..0288a866 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeDoWhile.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeDoWhile.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -19,7 +18,7 @@ @ExecutableCheck(reportedProblems = { ProblemType.LOOP_SHOULD_BE_DO_WHILE }) public class LoopShouldBeDoWhile extends IntegratedCheck { @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtWhile ctWhile) { diff --git a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeFor.java b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeFor.java index 5189984c..df3da60d 100644 --- a/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeFor.java +++ b/autograder-core/src/main/java/de/firemage/autograder/core/check/general/LoopShouldBeFor.java @@ -3,7 +3,6 @@ import de.firemage.autograder.core.LocalizedMessage; import de.firemage.autograder.core.ProblemType; import de.firemage.autograder.core.check.ExecutableCheck; -import de.firemage.autograder.core.dynamic.DynamicAnalysis; import de.firemage.autograder.core.integrated.IntegratedCheck; import de.firemage.autograder.core.integrated.SpoonUtil; import de.firemage.autograder.core.integrated.StaticAnalysis; @@ -192,7 +191,7 @@ private static LoopSuggestion getCounter(CtLoop ctLoop) { } @Override - protected void check(StaticAnalysis staticAnalysis, DynamicAnalysis dynamicAnalysis) { + protected void check(StaticAnalysis staticAnalysis) { staticAnalysis.processWith(new AbstractProcessor() { @Override public void process(CtLoop ctLoop) {