From d5163136845fb5a3dd96e0506e5dde389ec07ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Fuch=C3=9F?= Date: Thu, 5 Dec 2024 15:04:09 +0100 Subject: [PATCH] Add push script --- .../LegacyModelExtractionStateByArCoTL.java | 12 +- .../arcotl/code/CodeCompilationUnit.java | 2 +- .../api/stage/textextraction/MappingKind.java | 13 +- .../MultiHopTransitiveTraceLink.java | 7 +- .../core/api/tracelink/SamCodeTraceLink.java | 5 - .../ardoco/core/common/RepositoryHandler.java | 4 +- .../wordsim/measures/glove/GloveMeasure.java | 2 +- .../measures/sewordsim/SEWordSimMeasure.java | 2 +- .../wordsim/vector/VectorUtils.java | 10 +- .../mcse/ardoco/core/data/AbstractState.java | 2 + .../core/pipeline/AbstractExecutionStage.java | 4 +- .../core/pipeline/agent/PipelineAgent.java | 2 +- .../converter/DtoToObjectConverter.java | 2 +- .../converter/ObjectToDtoConverter.java | 14 +- .../textproviderjson/textobject/WordImpl.java | 4 +- .../converter/TreeParserTest.java | 4 +- .../ardoco/core/api/output/ArDoCoResult.java | 1 - .../ardoco/core/common/util/FilePrinter.java | 412 ------------------ .../core/execution/runner/ArDoCoRunner.java | 17 +- pom.xml | 2 +- .../tests/architecture/ArchitectureTest.java | 22 +- .../architecture/DeterministicArDoCoTest.java | 6 +- .../ardoco/core/tests/eval/CodeProject.java | 2 +- .../core/tests/eval/GoldStandardProject.java | 2 +- 24 files changed, 51 insertions(+), 502 deletions(-) diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/legacy/LegacyModelExtractionStateByArCoTL.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/legacy/LegacyModelExtractionStateByArCoTL.java index c5e5da60a..ece4e4d72 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/legacy/LegacyModelExtractionStateByArCoTL.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/legacy/LegacyModelExtractionStateByArCoTL.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy; import java.util.ArrayList; @@ -83,16 +83,16 @@ private static ImmutableList initCodeInstances(CodeModel codeMode } private static void fillPackages(Collection packages, List instances) { - for (var modelElement : packages) { - String path = modelElement.getName(); + for (var modelElement : packages) { + StringBuilder path = new StringBuilder(modelElement.getName()); CodeModule parent = modelElement.getParent(); while (parent != null) { - path = parent.getName() + "/" + path; + path.insert(0, parent.getName() + "/"); parent = parent.getParent(); } // Ensure that package is handled as directory - path += "/"; - instances.add(new ModelInstanceImpl(modelElement.getName(), "Package", path)); + path.append("/"); + instances.add(new ModelInstanceImpl(modelElement.getName(), "Package", path.toString())); } } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java index ec5440cb2..48f1bf04f 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/code/CodeCompilationUnit.java @@ -63,7 +63,7 @@ public List getParentPackageNames() { while (parent.hasParent()) { parent = parent.getParent(); if (parent instanceof CodePackage) { - parents.add(0, parent.getName()); + parents.addFirst(parent.getName()); } } return parents; diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/MappingKind.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/MappingKind.java index f63081865..4a049b795 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/MappingKind.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/stage/textextraction/MappingKind.java @@ -1,18 +1,9 @@ -/* Licensed under MIT 2021-2023. */ +/* Licensed under MIT 2021-2024. */ package edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction; /** * The mapping type of a mapping state defines whether the mapping is a name or a type. */ public enum MappingKind { - - /** - * A noun mapping can be identified as an identifier {@link #NAME}, a potential type {@link #TYPE} - */ - NAME, - /** - * A noun mapping can be identified as an identifier {@link #NAME}, a potential type {@link #TYPE} - */ - TYPE - + NAME, TYPE } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/MultiHopTransitiveTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/MultiHopTransitiveTraceLink.java index abfc536a7..bbf3b87bf 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/MultiHopTransitiveTraceLink.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/MultiHopTransitiveTraceLink.java @@ -1,3 +1,4 @@ +/* Licensed under MIT 2024. */ package edu.kit.kastel.mcse.ardoco.core.api.tracelink; import java.util.ArrayList; @@ -80,10 +81,4 @@ public boolean equals(Object obj) { } return Objects.equals(this.allLinks, other.allLinks); } - - @Override - public String toString() { - return this.asPair().toString(); - } - } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/SamCodeTraceLink.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/SamCodeTraceLink.java index 945f5f7c0..893e1a5f2 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/SamCodeTraceLink.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/tracelink/SamCodeTraceLink.java @@ -42,9 +42,4 @@ public boolean equals(Object obj) { } return Objects.equals(this.asPair(), other.asPair()); } - - @Override - public String toString() { - return this.asPair().toString(); - } } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/RepositoryHandler.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/RepositoryHandler.java index 1ee5ea6a6..5ae3326a2 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/RepositoryHandler.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/RepositoryHandler.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.core.common; import java.io.File; @@ -35,7 +35,7 @@ public static boolean shallowCloneRepository(String repositoryLink, String desir List commits = new ArrayList<>(); git.log().setMaxCount(1).call().forEach(commits::add); assert commits.size() == 1; - if (commits.get(0).getId().startsWith(AbbreviatedObjectId.fromString(desiredHash))) { + if (commits.getFirst().getId().startsWith(AbbreviatedObjectId.fromString(desiredHash))) { return true; } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/glove/GloveMeasure.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/glove/GloveMeasure.java index 88e7d744c..b96dc9b73 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/glove/GloveMeasure.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/glove/GloveMeasure.java @@ -55,7 +55,7 @@ public double getSimilarity(ComparisonContext ctx) { try { return this.compareVectors(ctx.firstTerm(), ctx.secondTerm()); } catch (RetrieveVectorException e) { - LOGGER.error("Failed to compare glove vectors: " + ctx, e); + LOGGER.error("Failed to compare glove vectors: {}", ctx, e); return Double.NaN; } } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/sewordsim/SEWordSimMeasure.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/sewordsim/SEWordSimMeasure.java index d08809ab3..c9199e020 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/sewordsim/SEWordSimMeasure.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/measures/sewordsim/SEWordSimMeasure.java @@ -54,7 +54,7 @@ public double getSimilarity(ComparisonContext ctx) { try { similarity = this.getDataSource().getSimilarity(ctx.firstTerm(), ctx.secondTerm()).orElse(Double.NaN); } catch (SQLException e) { - LOGGER.error("Failed to query the SEWordSim database for word comparison: " + ctx, e); + LOGGER.error("Failed to query the SEWordSim database for word comparison: {}", ctx, e); } return similarity; // words are probably missing from the database } diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/vector/VectorUtils.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/vector/VectorUtils.java index e8ceb8a26..f78330f5a 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/vector/VectorUtils.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/similarity/wordsim/vector/VectorUtils.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2022-2023. */ +/* Licensed under MIT 2022-2024. */ package edu.kit.kastel.mcse.ardoco.core.common.similarity.wordsim.vector; import java.util.Objects; @@ -76,10 +76,6 @@ public static double cosineSimilarity(float[] firstVec, float[] secondVec) { public static boolean isZero(double[] vector) { Objects.requireNonNull(vector); - if (vector.length == 0) { - return true; - } - for (double entry : vector) { if (entry != 0.0) { return false; @@ -98,10 +94,6 @@ public static boolean isZero(double[] vector) { public static boolean isZero(float[] vector) { Objects.requireNonNull(vector); - if (vector.length <= 0) { - return true; - } - for (float entry : vector) { if (entry != 0.0f) { return false; diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/data/AbstractState.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/data/AbstractState.java index 75fa45140..fe75d3291 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/data/AbstractState.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/data/AbstractState.java @@ -1,6 +1,7 @@ /* Licensed under MIT 2022-2024. */ package edu.kit.kastel.mcse.ardoco.core.data; +import java.io.Serial; import java.util.SortedMap; import edu.kit.kastel.mcse.ardoco.core.configuration.AbstractConfigurable; @@ -10,6 +11,7 @@ */ public abstract class AbstractState extends AbstractConfigurable implements PipelineStepData { + @Serial private static final long serialVersionUID = -3318799425973820663L; @Override diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/AbstractExecutionStage.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/AbstractExecutionStage.java index b75659b07..ad4485251 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/AbstractExecutionStage.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/AbstractExecutionStage.java @@ -60,7 +60,7 @@ protected final void preparePipelineSteps() { */ @Override protected void before() { - //Nothing by default + // Nothing by default } /** @@ -68,7 +68,7 @@ protected void before() { */ @Override protected void after() { - //Nothing by default + // Nothing by default } /** diff --git a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/agent/PipelineAgent.java b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/agent/PipelineAgent.java index b4f13215e..174c9766b 100644 --- a/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/agent/PipelineAgent.java +++ b/framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/pipeline/agent/PipelineAgent.java @@ -13,7 +13,7 @@ /** * This class represents a pipeline agent that calculates some results for an {@link AbstractExecutionStage} execution stage}. - * + *

* Implementing classes need to override. Additionally, sub-classes are free to override {@link #initializeState()} to execute code at the beginning of the * initialization before the main processing. */ diff --git a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/DtoToObjectConverter.java b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/DtoToObjectConverter.java index 1f5c0afa3..f1f34953f 100644 --- a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/DtoToObjectConverter.java +++ b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/DtoToObjectConverter.java @@ -89,7 +89,7 @@ public Phrase parseConstituencyTree(String constituencyTree, List wordsOfS if (wordsOfSentence.isEmpty()) { throw new NotConvertableException("Constituency tree does not match words of sentence"); } - words.add(wordsOfSentence.remove(0)); + words.add(wordsOfSentence.removeFirst()); } else { subPhrases.add(parseConstituencyTree(subtree, wordsOfSentence)); } diff --git a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/ObjectToDtoConverter.java b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/ObjectToDtoConverter.java index 6bf8b7ed2..e037c2d71 100644 --- a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/ObjectToDtoConverter.java +++ b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/ObjectToDtoConverter.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.core.textproviderjson.converter; import java.io.IOException; @@ -116,22 +116,22 @@ private String convertToSubtree(Phrase phrase) { while (!words.isEmpty() || !subphrases.isEmpty()) { if (subphrases.isEmpty()) { // word next - Word word = words.remove(0); + Word word = words.removeFirst(); constituencyTree.append(TREE_SEPARATOR).append(convertWordToTree(word)); } else if (words.isEmpty()) { // phrase next - Phrase subphrase = subphrases.remove(0); + Phrase subphrase = subphrases.removeFirst(); constituencyTree.append(TREE_SEPARATOR).append(convertToSubtree(subphrase)); } else { - int wordIndex = words.get(0).getPosition(); - List phraseWordIndices = subphrases.get(0).getContainedWords().toList().stream().map(Word::getPosition).toList(); + int wordIndex = words.getFirst().getPosition(); + List phraseWordIndices = subphrases.getFirst().getContainedWords().toList().stream().map(Word::getPosition).toList(); if (wordIndex < Collections.min(phraseWordIndices)) { // word next - Word word = words.remove(0); + Word word = words.removeFirst(); constituencyTree.append(TREE_SEPARATOR).append(convertWordToTree(word)); } else { // phrase next - Phrase subphrase = subphrases.remove(0); + Phrase subphrase = subphrases.removeFirst(); constituencyTree.append(TREE_SEPARATOR).append(convertToSubtree(subphrase)); } } diff --git a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/textobject/WordImpl.java b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/textobject/WordImpl.java index 3c048c0e5..78f6e3eab 100644 --- a/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/textobject/WordImpl.java +++ b/framework/text-provider-json/src/main/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/textobject/WordImpl.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2022-2023. */ +/* Licensed under MIT 2022-2024. */ package edu.kit.kastel.mcse.ardoco.core.textproviderjson.textobject; import java.util.List; @@ -118,7 +118,7 @@ private Phrase loadPhrase() { var currentPhrase = getSentence().getPhrases().toList().stream().filter(p -> p.getContainedWords().contains(this)).findFirst().orElseThrow(); var subPhrases = List.of(currentPhrase); while (!subPhrases.isEmpty()) { - currentPhrase = subPhrases.get(0); + currentPhrase = subPhrases.getFirst(); subPhrases = currentPhrase.getSubPhrases().toList().stream().filter(p -> p.getContainedWords().contains(this)).toList(); } return currentPhrase; diff --git a/framework/text-provider-json/src/test/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/TreeParserTest.java b/framework/text-provider-json/src/test/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/TreeParserTest.java index feda1c537..f9d738597 100644 --- a/framework/text-provider-json/src/test/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/TreeParserTest.java +++ b/framework/text-provider-json/src/test/java/edu/kit/kastel/mcse/ardoco/core/textproviderjson/converter/TreeParserTest.java @@ -1,4 +1,4 @@ -/* Licensed under MIT 2023. */ +/* Licensed under MIT 2023-2024. */ package edu.kit.kastel.mcse.ardoco.core.textproviderjson.converter; import java.util.ArrayList; @@ -24,7 +24,7 @@ class TreeParserTest { POSTag.VERB_SINGULAR_PRESENT_THIRD_PERSON, null, null, null), new WordImpl(null, 2, 0, "me", POSTag.PRONOUN_PERSONAL, null, null, null), new WordImpl(null, 3, 0, ".", POSTag.CLOSER, null, null, null))); Phrase subsubphrase = new PhraseImpl(Lists.immutable.of(words.get(2)), PhraseType.NP, new ArrayList<>()); - List subphrases = List.of(new PhraseImpl(Lists.immutable.of(words.get(0)), PhraseType.NP, new ArrayList<>()), new PhraseImpl(Lists.immutable.of( + List subphrases = List.of(new PhraseImpl(Lists.immutable.of(words.getFirst()), PhraseType.NP, new ArrayList<>()), new PhraseImpl(Lists.immutable.of( words.get(1)), PhraseType.VP, List.of(subsubphrase))); Phrase phrase = new PhraseImpl(Lists.immutable.of(words.get(3)), PhraseType.S, subphrases); Phrase expectedPhrase = new PhraseImpl(Lists.immutable.empty(), PhraseType.ROOT, List.of(phrase)); diff --git a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/output/ArDoCoResult.java b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/output/ArDoCoResult.java index b6140dfbc..da54073d5 100644 --- a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/output/ArDoCoResult.java +++ b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/output/ArDoCoResult.java @@ -20,7 +20,6 @@ import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity; import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; import edu.kit.kastel.mcse.ardoco.core.api.models.ModelStates; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.Model; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.code.CodeCompilationUnit; diff --git a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/util/FilePrinter.java b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/util/FilePrinter.java index 0c3e0294e..41ed95332 100644 --- a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/util/FilePrinter.java +++ b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/common/util/FilePrinter.java @@ -1,30 +1,17 @@ /* Licensed under MIT 2021-2024. */ package edu.kit.kastel.mcse.ardoco.core.common.util; -import static edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper.getConnectionStates; -import static edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper.getInconsistencyStates; -import static edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper.getModelStatesData; -import static edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper.getRecommendationStates; -import static edu.kit.kastel.mcse.ardoco.core.common.util.DataRepositoryHelper.getTextState; import static java.nio.charset.StandardCharsets.UTF_8; import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; import java.io.IOException; -import java.io.Writer; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; -import java.util.Comparator; -import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.ImmutableList; @@ -32,26 +19,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.kit.kastel.mcse.ardoco.core.api.entity.ArchitectureEntity; -import edu.kit.kastel.mcse.ardoco.core.api.models.Metamodel; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.LegacyModelExtractionState; -import edu.kit.kastel.mcse.ardoco.core.api.models.arcotl.architecture.legacy.ModelInstance; import edu.kit.kastel.mcse.ardoco.core.api.output.ArDoCoResult; -import edu.kit.kastel.mcse.ardoco.core.api.stage.connectiongenerator.ConnectionState; -import edu.kit.kastel.mcse.ardoco.core.api.stage.connectiongenerator.InstanceLink; -import edu.kit.kastel.mcse.ardoco.core.api.stage.inconsistency.Inconsistency; -import edu.kit.kastel.mcse.ardoco.core.api.stage.inconsistency.InconsistencyState; import edu.kit.kastel.mcse.ardoco.core.api.stage.inconsistency.InconsistentSentence; import edu.kit.kastel.mcse.ardoco.core.api.stage.inconsistency.ModelInconsistency; -import edu.kit.kastel.mcse.ardoco.core.api.stage.recommendationgenerator.RecommendationState; -import edu.kit.kastel.mcse.ardoco.core.api.stage.recommendationgenerator.RecommendedInstance; -import edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction.MappingKind; -import edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction.NounMapping; -import edu.kit.kastel.mcse.ardoco.core.api.stage.textextraction.TextState; -import edu.kit.kastel.mcse.ardoco.core.api.text.SentenceEntity; -import edu.kit.kastel.mcse.ardoco.core.api.text.Text; -import edu.kit.kastel.mcse.ardoco.core.api.text.Word; -import edu.kit.kastel.mcse.ardoco.core.api.tracelink.TraceLink; import edu.kit.kastel.mcse.ardoco.core.architecture.Deterministic; /** @@ -59,323 +29,15 @@ */ @Deterministic public final class FilePrinter { - private static final String DELIMITER = ","; private static final Logger logger = LoggerFactory.getLogger(FilePrinter.class); - private static final String GENERIC_ERROR = "An error occurred."; - private static final String SUCCESS_WRITE = "Successfully wrote to the file."; - - private static final String HORIZONTAL_RULE = "---------------------------------------------------------------------------------------------------------------------------------------------"; private static final String LINE_SEPARATOR = System.lineSeparator(); private FilePrinter() { throw new IllegalAccessError(); } - /** - * Prints details of the {@link ArDoCoResult results} of a run into files within the given directory (path). Writes out detailed info about model instances, - * noun mappings, trace links, all states, and inconsistencies. Uses the provided (project) name as part of the file names. - * - * @param path the directory where the files should be written - * @param name name of the project - * @param arDoCoResult the results that should be written - */ - public static void printResultsInFiles(Path path, String name, ArDoCoResult arDoCoResult) { - var outputDir = path.toFile(); - var data = arDoCoResult.dataRepository(); - var textState = getTextState(data); - - InconsistencyState inconsistencyState = null; - if (DataRepositoryHelper.hasInconsistencyStates(data)) { - var inconsistencyStates = getInconsistencyStates(data); - inconsistencyState = inconsistencyStates.getInconsistencyState(Metamodel.ARCHITECTURE); - } - - for (var model : getModelStatesData(data).modelIds()) { - var modelState = getModelStatesData(data).getModelExtractionState(model); - var metaModel = modelState.getMetamodel(); - var recommendationState = getRecommendationStates(data).getRecommendationState(metaModel); - var connectionState = getConnectionStates(data).getConnectionState(metaModel); - String metaModelTypeName = metaModel.toString().toLowerCase(); - - FilePrinter.writeModelInstancesInCsvFile(Path.of(outputDir.getAbsolutePath(), name + "-instances-" + metaModelTypeName + model + ".csv").toFile(), - modelState, name); - FilePrinter.writeNounMappingsInCsvFile(Path.of(outputDir.getAbsolutePath(), name + "_noun_mappings" + model + ".csv").toFile(), // - textState); - FilePrinter.writeTraceLinksInCsvFile(Path.of(outputDir.getAbsolutePath(), name + "_trace_links" + model + ".csv").toFile(), // - connectionState); - FilePrinter.writeStatesToFile(Path.of(outputDir.getAbsolutePath(), name + "_states" + model + ".csv").toFile(), // - modelState, textState, recommendationState, connectionState); - - if (inconsistencyState != null) { - FilePrinter.writeInconsistenciesToFile(Path.of(outputDir.getAbsolutePath(), name + "_inconsistencies" + model + ".csv").toFile(), - inconsistencyState); - } - } - } - - /** - * Writes the sentences as they are stored in the PARSE graph into a file. - * - * @param target the target file - * @param text the text to use. - */ - public static void writeSentencesInFile(File target, Text text) { - var fileCreated = createFileIfNonExistent(target); - if (!fileCreated) { - return; - } - - try (var myWriter = new FileWriter(target, StandardCharsets.UTF_8)) { - var minSentenceNumber = 0; - for (Word node : text.words()) { - var sentenceNumber = Integer.parseInt(String.valueOf(node.getSentenceNo())); - if (sentenceNumber + 1 > minSentenceNumber) { - myWriter.append(LINE_SEPARATOR).append(String.valueOf(sentenceNumber)).append(": "); - minSentenceNumber++; - } - myWriter.append(" ").append(node.getText()); - } - - logger.info(SUCCESS_WRITE); - } catch (IOException | NumberFormatException e) { - logger.error("An error occurred while writing sentences to file."); - logger.debug(e.getMessage(), e.getCause()); - } - } - - private static boolean createFileIfNonExistent(File file) { - try { - if (file.createNewFile()) { - logger.info("File created: {}", file.getAbsolutePath()); - } else { - logger.info("File already exists."); - } - } catch (IOException e) { - logger.error("An error occured creating a file."); - logger.debug(e.getMessage(), e.getCause()); - return false; - } - return true; - } - - private static void writeStates(Writer myWriter, LegacyModelExtractionState extractionState, TextState ntrState, // - RecommendationState recommendationState, ConnectionState connectionState) throws IOException { - myWriter.write("Results of ModelConnector: "); - myWriter.append(LINE_SEPARATOR); - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("ExtractorState: "); - myWriter.append(LINE_SEPARATOR); - myWriter.write(extractionState.toString()); - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("FoundNames as Set: "); - myWriter.append(LINE_SEPARATOR); - var nameList = ntrState.getListOfReferences(MappingKind.NAME).toSortedList().toImmutable(); - myWriter.write(nameList.toString() + LINE_SEPARATOR); - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("FoundTypes as Set: "); - myWriter.append(LINE_SEPARATOR); - var typeList = ntrState.getListOfReferences(MappingKind.TYPE).toSortedList().toImmutable(); - myWriter.write(typeList.toString() + LINE_SEPARATOR); - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("Instances of the Recommendation State: "); - myWriter.append(LINE_SEPARATOR); - - var comRecommendedInstanceByName = getRecommendedInstancesComparator(); - var recommendedInstances = recommendationState.getRecommendedInstances().toSortedList(comRecommendedInstanceByName).toImmutable(); - - for (RecommendedInstance ri : recommendedInstances) { - myWriter.write(ri.toString() + LINE_SEPARATOR); - } - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("Instances of the Connection State: "); - myWriter.append(LINE_SEPARATOR); - - var compInstByUID = getInstanceLinkComparator(); - var instanceMappings = Lists.immutable.withAll(connectionState.getInstanceLinks()).toSortedList(compInstByUID).toImmutable(); - - for (InstanceLink imap : instanceMappings) { - - myWriter.write(imap.toString() + LINE_SEPARATOR); - } - - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("Relations of the Recommendation State: "); - myWriter.append(LINE_SEPARATOR); - - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - myWriter.write("Relations of the Connection State: "); - myWriter.append(LINE_SEPARATOR); - - myWriter.write(HORIZONTAL_RULE); - myWriter.append(LINE_SEPARATOR).append(LINE_SEPARATOR); - - logger.info(SUCCESS_WRITE); - } - - /** - * * Writes the states into a file. - * - * @param resultFile the result file - * @param extractionState the extraction state, containing the extracted elements of the model - * @param ntrState the name type relation state, containing the mappings found in the text, sorted in name, type or name_or_type - * @param recommendationState the supposing state, containing the supposing mappings for instances, as well as relations - * @param connectionState containing all instances and relations, matched by supposed mappings - */ - public static void writeStatesToFile(File resultFile, LegacyModelExtractionState extractionState, TextState ntrState, // - RecommendationState recommendationState, ConnectionState connectionState) { - var fileCreated = createFileIfNonExistent(resultFile); - if (!fileCreated) { - return; - } - - try (var myWriter = new FileWriter(resultFile, StandardCharsets.UTF_8)) { - writeStates(myWriter, extractionState, ntrState, recommendationState, connectionState); - - } catch (IOException e) { - logger.error(GENERIC_ERROR); - logger.debug(e.getMessage(), e.getCause()); - } - - } - - /** - * Write model instances in csv file. - * - * @param destination the destination - * @param modelState the model state - * @param name the name - */ - private static void writeModelInstancesInCsvFile(File destination, LegacyModelExtractionState modelState, String name) { - var dataLines = getInstancesFromModelState(modelState, name); - writeDataLinesInFile(destination, dataLines); - } - - private static ImmutableList getInstancesFromModelState(LegacyModelExtractionState modelState, String name) { - MutableList dataLines = Lists.mutable.empty(); - - dataLines.add(new String[] { "Found Model Elements in " + name + ":", "", "" }); - dataLines.add(new String[] { "" }); - dataLines.add(new String[] { "UID", "Name", "Type" }); - - for (ModelInstance instance : modelState.getInstances()) { - dataLines.add(new String[] { instance.getUid(), instance.getFullName(), instance.getFullType() }); - } - - return dataLines.toImmutable(); - } - - /** - * Write trace links in csv file. - * - * @param resultFile the result file - * @param connectionState the connection state - */ - private static void writeTraceLinksInCsvFile(File resultFile, ConnectionState connectionState) { - var dataLines = getLinksAsDataLinesOfConnectionState(connectionState); - writeDataLinesInFile(resultFile, dataLines); - } - - /** - * Write noun mappings in csv file. - * - * @param resultFile the result file - * @param textState the text state - */ - private static void writeNounMappingsInCsvFile(File resultFile, TextState textState) { - var dataLines = getMappingsAsDataLinesOfTextState(textState); - writeDataLinesInFile(resultFile, dataLines); - } - - private static ImmutableList getMappingsAsDataLinesOfTextState(TextState textState) { - MutableList dataLines = Lists.mutable.empty(); - - dataLines.add(new String[] { "Found NounMappings: ", "", "", "" }); - dataLines.add(new String[] { "" }); - dataLines.add(new String[] { "Reference", "Name", "Type" }); - - if (textState.getNounMappings().isEmpty()) { - for (NounMapping mapping : textState.getNounMappings()) { - - var kind = mapping.getKind(); - - var nameProb = Double.toString(kind == MappingKind.NAME ? mapping.getProbability() : 0); - var typeProb = Double.toString(kind == MappingKind.TYPE ? mapping.getProbability() : 0); - - dataLines.add(new String[] { mapping.getReference(), nameProb, typeProb }); - - } - return dataLines.toImmutable(); - } - - for (NounMapping mapping : textState.getNounMappings()) { - - var distribution = mapping.getDistribution(); - var nameProb = Double.toString(distribution.get(MappingKind.NAME).getConfidence()); - var typeProb = Double.toString(distribution.get(MappingKind.TYPE).getConfidence()); - - dataLines.add(new String[] { mapping.getReference(), nameProb, typeProb }); - - } - return dataLines.toImmutable(); - } - - private static ImmutableList getLinksAsDataLinesOfConnectionState(ConnectionState connectionState) { - MutableList dataLines = Lists.mutable.empty(); - - dataLines.add(new String[] { "#Found TraceLinks: ", "" }); - dataLines.add(new String[] { "" }); - dataLines.add(new String[] { "modelElementID", "sentence" }); - - Set> tracelinks = new LinkedHashSet<>(connectionState.getTraceLinks().castToCollection()); - for (var tracelink : tracelinks) { - var modelElementUid = tracelink.getSecondEndpoint().getId(); - // sentence offset is 1 because real sentences are 1-indexed - var sentenceNumber = Integer.toString(tracelink.getFirstEndpoint().getSentence().getSentenceNumber() + 1); - dataLines.add(new String[] { modelElementUid, sentenceNumber }); - } - - return dataLines.toImmutable(); - } - - /** - * Write data lines in file. - * - * @param file the file - * @param dataLines the data lines - */ - public static void writeDataLinesInFile(File file, ImmutableList dataLines) { - - try (var pw = new FileWriter(file, StandardCharsets.UTF_8)) { - dataLines.collect(FilePrinter::convertToCSV).forEach(s -> { - try { - pw.append(s).append("\n"); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - }); - } catch (IOException e) { - logger.error(GENERIC_ERROR); - logger.debug(e.getMessage(), e); - } - - } - /** * Writes the given text to the file with the given name/path. Truncates existing files, creates the file if not existent and writes in UTF-8. * @@ -402,80 +64,6 @@ public static void writeToFile(Path file, String text) { } } - private static void writeInconsistenciesToFile(File file, InconsistencyState inconsistencyState) { - var inconsistencies = inconsistencyState.getInconsistencies(); - - try (var pw = new FileWriter(file, StandardCharsets.UTF_8)) { - inconsistencies.flatCollect(Inconsistency::toFileOutput) - .asLazy() - .collect(FilePrinter::convertToCSV) - .distinct() - .toSortedList(getInconsistencyStringComparator()) - .forEach(s -> { - try { - pw.append(s).append("\n"); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - }); - } catch (IOException e) { - logger.error(GENERIC_ERROR); - logger.debug(e.getMessage(), e); - } - } - - private static Comparator getInconsistencyStringComparator() { - return (i, j) -> { - var values1 = i.split(DELIMITER, -1); - var values2 = j.split(DELIMITER, -1); - var name1 = values1[2]; - var name2 = values2[2]; - var wordComparisonResult = name1.compareTo(name2); - if (wordComparisonResult != 0) { - return wordComparisonResult; - } - var word1SentenceNo = -2; - var word2SentenceNo = -1; - try { - word1SentenceNo = Integer.parseInt(values1[1]); - word2SentenceNo = Integer.parseInt(values2[1]); - } catch (NumberFormatException e) { - // when there is no sentence number, it is intended that the Inconsistency is sorted at the beginning - logger.trace("Could not parse sentence number for one of the following: {}, {}", values1[1], values2[1]); - } - - var compareValue = word1SentenceNo - word2SentenceNo; - if (compareValue == 0) { - var word1 = values1[3]; - var word2 = values2[3]; - compareValue = word1.compareTo(word2); - } - return compareValue; - }; - } - - private static String convertToCSV(String[] data) { - return Stream.of(data).map(FilePrinter::escapeSpecialCharacters).collect(Collectors.joining(DELIMITER)); - } - - private static String escapeSpecialCharacters(String in) { - var data = in; - var escapedData = data.replaceAll("\\R", " "); - if (data.contains(DELIMITER) || data.contains("\"") || data.contains("'")) { - data = data.replace("\"", "\"\""); - escapedData = "\"" + data + "\""; - } - return escapedData; - } - - private static Comparator getRecommendedInstancesComparator() { - return Comparator.comparing(RecommendedInstance::getName); - } - - private static Comparator getInstanceLinkComparator() { - return Comparator.comparing(i -> i.getModelInstance().getUid()); - } - public static void writeInconsistencyOutput(File file, ArDoCoResult arDoCoResult) { MutableList allInconsistencies = Lists.mutable.empty(); allInconsistencies.addAll(arDoCoResult.getInconsistentSentences().collect(InconsistentSentence::getInfoString).toList()); diff --git a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/execution/runner/ArDoCoRunner.java b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/execution/runner/ArDoCoRunner.java index f92813312..d78930e46 100644 --- a/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/execution/runner/ArDoCoRunner.java +++ b/pipeline-core/src/main/java/edu/kit/kastel/mcse/ardoco/core/execution/runner/ArDoCoRunner.java @@ -2,9 +2,6 @@ package edu.kit.kastel.mcse.ardoco.core.execution.runner; import java.io.File; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.Serial; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,7 +13,7 @@ public abstract class ArDoCoRunner { private static final Logger logger = LoggerFactory.getLogger(ArDoCoRunner.class); - private final transient ArDoCo arDoCo; + private final ArDoCo arDoCo; private File outputDirectory; protected boolean isSetUp = false; @@ -34,7 +31,7 @@ public final ArDoCoResult run() { if (this.isSetUp() && this.outputDirectory != null) { return this.getArDoCo().runAndSave(this.outputDirectory); } else { - ArDoCoRunner.logger.error("Cannot run ArDoCo because the runner is not properly set up."); + logger.error("Cannot run ArDoCo because the runner is not properly set up."); return null; } } @@ -47,7 +44,7 @@ public final DataRepository runWithoutSaving() { this.getArDoCo().run(); return this.getArDoCo().getDataRepository(); } else { - ArDoCoRunner.logger.error("Cannot run ArDoCo because the runner is not properly set up."); + logger.error("Cannot run ArDoCo because the runner is not properly set up."); return null; } } @@ -59,12 +56,4 @@ public ArDoCo getArDoCo() { protected void setOutputDirectory(File outputDirectory) { this.outputDirectory = outputDirectory; } - - @Serial - private void writeObject(ObjectOutputStream out) throws IOException { - if (!this.getArDoCo().wasExecuted()) { - this.runWithoutSaving(); - } - out.defaultWriteObject(); - } } diff --git a/pom.xml b/pom.xml index 7884536da..dce7dbced 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ scm:git:git://github.com/ArDoCo/Core.git scm:git:ssh://github.com:ArDoCo/Core.git HEAD - http://github.com/ArDoCo/Core/tree/main + https://github.com/ArDoCo/Core/tree/main GitHub Issues diff --git a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/ArchitectureTest.java b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/ArchitectureTest.java index e5680c6e9..e09a59ca8 100644 --- a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/ArchitectureTest.java +++ b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/ArchitectureTest.java @@ -169,11 +169,12 @@ public void check(JavaClass javaClass, ConditionEvents conditionEvents) { continue; var erasure = field.getType().toErasure(); if (isContainer.test(erasure)) { - getAllInvolvedRawTypesExceptSelf(field).stream().filter(erasureIsSerializableShallow.negate()).forEach(parameter -> { - violated(conditionEvents, javaClass, "Non-transient field " + field.getFullName() + " of serializable class " + javaClass - .getFullName() + " needs to be serializable or the class must have custom serialization, but has non-serializable parameter " + parameter - .getName()); - }); + getAllInvolvedRawTypesExceptSelf(field).stream() + .filter(erasureIsSerializableShallow.negate()) + .forEach(parameter -> violated(conditionEvents, javaClass, "Non-transient field " + field + .getFullName() + " of serializable class " + javaClass + .getFullName() + " needs to be serializable or the class must have custom serialization, but has non-serializable parameter " + parameter + .getName())); } else { if (erasureIsSerializableShallow.negate().test(erasure)) { //Class has non-transient field that is not serializable @@ -186,14 +187,11 @@ public void check(JavaClass javaClass, ConditionEvents conditionEvents) { } }); - private static final Predicate isContainer = (JavaClass javaClass) -> { - return javaClass.isArray() || javaClass.isAssignableTo(Collection.class) || javaClass.isAssignableTo(Map.class) || javaClass.isAssignableTo( - Iterable.class); - }; + private static final Predicate isContainer = (JavaClass javaClass) -> javaClass.isArray() || javaClass.isAssignableTo( + Collection.class) || javaClass.isAssignableTo(Map.class) || javaClass.isAssignableTo(Iterable.class); - private static final Predicate erasureIsSerializableShallow = (JavaClass javaClass) -> { - return javaClass.isPrimitive() || javaClass.isAssignableTo(Serializable.class) || isContainer.test(javaClass); - }; + private static final Predicate erasureIsSerializableShallow = (JavaClass javaClass) -> javaClass.isPrimitive() || javaClass + .isAssignableTo(Serializable.class) || isContainer.test(javaClass); /** * Returns all types of a field, except the (outer) type of the field itself. Generic type variables are not considered. diff --git a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/DeterministicArDoCoTest.java b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/DeterministicArDoCoTest.java index 6dfab302e..6dd0536b2 100644 --- a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/DeterministicArDoCoTest.java +++ b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/architecture/DeterministicArDoCoTest.java @@ -212,7 +212,7 @@ private static ArchCondition haveComparableGenericType() { public void check(JavaField javaField, ConditionEvents conditionEvents) { var type = javaField.getType(); if (type instanceof JavaParameterizedType parameterizedType) { - var typeParameter = parameterizedType.getActualTypeArguments().get(0); + var typeParameter = parameterizedType.getActualTypeArguments().getFirst(); if ((typeParameter instanceof JavaClass typeParameterClass) && typeParameterClass.getAllRawInterfaces() .stream() .anyMatch(i -> i.getFullName().equals(Comparable.class.getName()))) { @@ -241,14 +241,14 @@ public void check(JavaMethod javaMethod, ConditionEvents conditionEvents) { return; } - var typeParameter = parameterizedType.getActualTypeArguments().get(0); + var typeParameter = parameterizedType.getActualTypeArguments().getFirst(); if ((typeParameter instanceof JavaClass typeParameterClass) && typeParameterClass.getAllRawInterfaces() .stream() .anyMatch(i -> i.getFullName().equals(Comparable.class.getName()))) { satisfied(conditionEvents, javaMethod, "Method " + javaMethod.getFullName() + " has a Comparable generic type"); } else if ((typeParameter instanceof JavaWildcardType typeParameterWildCard)) { - var upperBound = typeParameterWildCard.getUpperBounds().get(0); + var upperBound = typeParameterWildCard.getUpperBounds().getFirst(); if (!(upperBound instanceof JavaClass upperBoundClass) || upperBoundClass.getAllRawInterfaces() .stream() diff --git a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/CodeProject.java b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/CodeProject.java index 30fe50968..316b243ec 100644 --- a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/CodeProject.java +++ b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/CodeProject.java @@ -89,7 +89,7 @@ public enum CodeProject implements GoldStandardProject { new ExpectedResults(.885, .999, .935, .960, .915, .935) // ); - private static final Logger logger = LoggerFactory.getLogger(Project.class); + private static final Logger logger = LoggerFactory.getLogger(CodeProject.class); private final String codeRepository; private final String commitHash; diff --git a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandardProject.java b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandardProject.java index 47e889f03..569a2bb68 100644 --- a/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandardProject.java +++ b/tests-base/src/main/java/edu/kit/kastel/mcse/ardoco/core/tests/eval/GoldStandardProject.java @@ -65,7 +65,7 @@ private boolean validateResourceChecksum(String resourceName) { logger.info("Checksum for source file {} matches", resourceName); return true; } catch (IOException e) { - logger.error("Couldn't calculate checksum for resource at " + resourceName, e); + logger.error("Couldn't calculate checksum for resource at {}", resourceName, e); return false; } }