From b46415e45a28f42c042a13c8cea1eefdf8588a45 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Thu, 1 Apr 2021 19:16:57 +0200 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java reset Typevars-Namen wieder rausgenommen modified: src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java modified: src/test/java/insertGenerics/TestAny.java modified: src/test/java/insertGenerics/TestClassField.java modified: src/test/java/insertGenerics/TestContraVariant.java modified: src/test/java/insertGenerics/TestGGFinder.java modified: src/test/java/insertGenerics/TestLocalVarLambda.java modified: src/test/java/insertGenerics/TestMutualRecursion.java modified: src/test/java/insertGenerics/TestReturnVar.java modified: src/test/java/insertGenerics/TestSecondLineOfClassConstraints.java modified: src/test/java/insertGenerics/TestTPHsAndGenerics.java modified: src/test/java/insertGenerics/TestTPHsAndGenerics2.java modified: src/test/java/insertGenerics/TestThreeArgs.java modified: src/test/java/insertGenerics/TestTwoArgs.java modified: src/test/java/insertGenerics/TestTwoArgs2.java modified: src/test/java/insertGenerics/TestTwoCalls.java modified: src/test/java/insertGenerics/TestVector.java modified: src/test/java/insertGenerics/TestVoidMeth.java Reset Typevar-Namen in @BeforeClass eingefuegt --- .../java/de/dhbwstuttgart/core/JavaTXCompiler.java | 1 - .../syntaxtree/factory/NameGenerator.java | 2 +- src/test/java/insertGenerics/TestAny.java | 7 +++++++ src/test/java/insertGenerics/TestClassField.java | 7 +++++++ src/test/java/insertGenerics/TestContraVariant.java | 7 +++++++ src/test/java/insertGenerics/TestGGFinder.java | 9 ++++++++- src/test/java/insertGenerics/TestLocalVarLambda.java | 9 ++++++++- src/test/java/insertGenerics/TestMutualRecursion.java | 9 ++++++++- src/test/java/insertGenerics/TestReturnVar.java | 7 +++++++ .../TestSecondLineOfClassConstraints.java | 7 +++++++ src/test/java/insertGenerics/TestTPHsAndGenerics.java | 11 +++++++++-- .../java/insertGenerics/TestTPHsAndGenerics2.java | 7 +++++++ src/test/java/insertGenerics/TestThreeArgs.java | 9 ++++++++- src/test/java/insertGenerics/TestTwoArgs.java | 9 ++++++++- src/test/java/insertGenerics/TestTwoArgs2.java | 9 ++++++++- src/test/java/insertGenerics/TestTwoCalls.java | 9 ++++++++- src/test/java/insertGenerics/TestVector.java | 9 ++++++++- src/test/java/insertGenerics/TestVoidMeth.java | 7 +++++++ 18 files changed, 123 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 1b3e67c4b..eb220f4ff 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -102,7 +102,6 @@ public class JavaTXCompiler { } classLoader = new DirectoryClassLoader(contextPath, ClassLoader.getSystemClassLoader()); environment = new CompilationEnvironment(sources); - de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); for (File s : sources) { sourceFiles.put(s, parse(s)); } diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java index 1c8dee420..06414b98f 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java @@ -6,7 +6,7 @@ public class NameGenerator { /** * Setzt den zu Beginn der Typinferenz auf "A" zurueck. - * Dies ist beio den JUnit-Test noetig + * Dies ist bei JUnit-Test noetig * TypePlaceholder.
Author: Martin Pluemicke * @return void */ diff --git a/src/test/java/insertGenerics/TestAny.java b/src/test/java/insertGenerics/TestAny.java index 9ef6d9017..e56145152 100644 --- a/src/test/java/insertGenerics/TestAny.java +++ b/src/test/java/insertGenerics/TestAny.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -32,6 +34,11 @@ public class TestAny { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestAny.jav")); diff --git a/src/test/java/insertGenerics/TestClassField.java b/src/test/java/insertGenerics/TestClassField.java index 814801231..a8070976d 100644 --- a/src/test/java/insertGenerics/TestClassField.java +++ b/src/test/java/insertGenerics/TestClassField.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -24,6 +26,11 @@ public class TestClassField { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestClassField.jav")); diff --git a/src/test/java/insertGenerics/TestContraVariant.java b/src/test/java/insertGenerics/TestContraVariant.java index 328044fac..744f18f5d 100644 --- a/src/test/java/insertGenerics/TestContraVariant.java +++ b/src/test/java/insertGenerics/TestContraVariant.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -32,6 +34,11 @@ public class TestContraVariant { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestContraVariant.jav")); diff --git a/src/test/java/insertGenerics/TestGGFinder.java b/src/test/java/insertGenerics/TestGGFinder.java index e861e6e4a..49ca4297f 100644 --- a/src/test/java/insertGenerics/TestGGFinder.java +++ b/src/test/java/insertGenerics/TestGGFinder.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestGGFinder { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestGGFinder"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestLocalVarLambda.java b/src/test/java/insertGenerics/TestLocalVarLambda.java index 93ff3415a..73a316a41 100644 --- a/src/test/java/insertGenerics/TestLocalVarLambda.java +++ b/src/test/java/insertGenerics/TestLocalVarLambda.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestLocalVarLambda { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestLocalVarLambda"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestMutualRecursion.java b/src/test/java/insertGenerics/TestMutualRecursion.java index fac445eda..823850606 100644 --- a/src/test/java/insertGenerics/TestMutualRecursion.java +++ b/src/test/java/insertGenerics/TestMutualRecursion.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestMutualRecursion { private static Class classToTest; private static Object instanceOfClass; private static String className; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void TestMutualRecursion1() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { className = "TestMutualRecursion"; diff --git a/src/test/java/insertGenerics/TestReturnVar.java b/src/test/java/insertGenerics/TestReturnVar.java index 026c03cd1..d4b984745 100644 --- a/src/test/java/insertGenerics/TestReturnVar.java +++ b/src/test/java/insertGenerics/TestReturnVar.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -24,6 +26,11 @@ public class TestReturnVar { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestReturnVar.jav")); diff --git a/src/test/java/insertGenerics/TestSecondLineOfClassConstraints.java b/src/test/java/insertGenerics/TestSecondLineOfClassConstraints.java index 0d8093fda..97cd468f7 100644 --- a/src/test/java/insertGenerics/TestSecondLineOfClassConstraints.java +++ b/src/test/java/insertGenerics/TestSecondLineOfClassConstraints.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -24,6 +26,11 @@ public class TestSecondLineOfClassConstraints { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestSecondLineOfClassConstraints.jav")); diff --git a/src/test/java/insertGenerics/TestTPHsAndGenerics.java b/src/test/java/insertGenerics/TestTPHsAndGenerics.java index 870d8c962..d065151b7 100644 --- a/src/test/java/insertGenerics/TestTPHsAndGenerics.java +++ b/src/test/java/insertGenerics/TestTPHsAndGenerics.java @@ -12,7 +12,9 @@ import de.dhbwstuttgart.core.JavaTXCompiler; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; - import org.junit.Test; + +import org.junit.BeforeClass; +import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -40,7 +42,12 @@ public class TestTPHsAndGenerics { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestTPHsAndGenerics"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestTPHsAndGenerics2.java b/src/test/java/insertGenerics/TestTPHsAndGenerics2.java index fc5a90e64..ebf0d9dff 100644 --- a/src/test/java/insertGenerics/TestTPHsAndGenerics2.java +++ b/src/test/java/insertGenerics/TestTPHsAndGenerics2.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -24,6 +26,11 @@ public class TestTPHsAndGenerics2 { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestTPHSAndGenerics2.jav")); diff --git a/src/test/java/insertGenerics/TestThreeArgs.java b/src/test/java/insertGenerics/TestThreeArgs.java index dd93724f6..ff7951f6d 100644 --- a/src/test/java/insertGenerics/TestThreeArgs.java +++ b/src/test/java/insertGenerics/TestThreeArgs.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestThreeArgs { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestThreeArgs"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestTwoArgs.java b/src/test/java/insertGenerics/TestTwoArgs.java index 95d1876ca..16fbd062c 100644 --- a/src/test/java/insertGenerics/TestTwoArgs.java +++ b/src/test/java/insertGenerics/TestTwoArgs.java @@ -15,6 +15,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -40,7 +42,12 @@ public class TestTwoArgs { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestTwoArgs"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestTwoArgs2.java b/src/test/java/insertGenerics/TestTwoArgs2.java index 780a44011..467cac404 100644 --- a/src/test/java/insertGenerics/TestTwoArgs2.java +++ b/src/test/java/insertGenerics/TestTwoArgs2.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestTwoArgs2 { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestTwoArgs2"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestTwoCalls.java b/src/test/java/insertGenerics/TestTwoCalls.java index 035e9fb2f..adc3bbac7 100644 --- a/src/test/java/insertGenerics/TestTwoCalls.java +++ b/src/test/java/insertGenerics/TestTwoCalls.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestTwoCalls { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestTwoCalls"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestVector.java b/src/test/java/insertGenerics/TestVector.java index 8245ff9db..6a30a4561 100644 --- a/src/test/java/insertGenerics/TestVector.java +++ b/src/test/java/insertGenerics/TestVector.java @@ -12,6 +12,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -39,7 +41,12 @@ public class TestVector { private static Class classToTest; private static Object instanceOfClass; private static String className = "TestVector"; - + + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { execute(new File(rootDirectory+className+".jav")); diff --git a/src/test/java/insertGenerics/TestVoidMeth.java b/src/test/java/insertGenerics/TestVoidMeth.java index 3f325a6ef..9dc8f99b5 100644 --- a/src/test/java/insertGenerics/TestVoidMeth.java +++ b/src/test/java/insertGenerics/TestVoidMeth.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; import de.dhbwstuttgart.typedeployment.TypeInsert; import de.dhbwstuttgart.typedeployment.TypeInsertFactory; import de.dhbwstuttgart.typeinference.result.ResultSet; + +import org.junit.BeforeClass; import org.junit.Test; import java.io.File; @@ -24,6 +26,11 @@ public class TestVoidMeth { public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/insertGenericsJav/"; + @BeforeClass + public static void resetNamesOfTypePlaceholder() { + de.dhbwstuttgart.syntaxtree.factory.NameGenerator.reset(); + } + @Test public void ggFinder() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"TestVoidMeth.jav"));