From b45964ed5ff41454a2e14a2db2accae16c5c73de Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 30 Oct 2020 10:52:03 +0100 Subject: [PATCH] =?UTF-8?q?Template=20f=C3=BCr=20FamilyOfGenerics=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constraintSimplify/FamilyOfGenerics.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/test/java/constraintSimplify/FamilyOfGenerics.java diff --git a/src/test/java/constraintSimplify/FamilyOfGenerics.java b/src/test/java/constraintSimplify/FamilyOfGenerics.java new file mode 100644 index 00000000..f13efa53 --- /dev/null +++ b/src/test/java/constraintSimplify/FamilyOfGenerics.java @@ -0,0 +1,57 @@ +package constraintSimplify; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.Block; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.antlr.v4.runtime.Token; +import org.junit.Test; + +import java.io.File; +import java.lang.reflect.Modifier; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.NotLinkException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; + +public class FamilyOfGenerics { + + @Test + public void generateBC() throws Exception { + + } + + public static SourceFile generateAST(){ + ArrayList classes = new ArrayList<>(); + ArrayList fields = new ArrayList<>(); + ArrayList methods = new ArrayList<>(); + + methods.add(generateMethod()); + + classes.add(new ClassOrInterface(Modifier.PUBLIC, new JavaClassName("Test"), fields, Optional.empty(), methods, + new ArrayList<>(), generateEmptyGenericDeclList(), + new RefType(new JavaClassName("java.lang.Object"), new NullToken()), + false, new ArrayList<>(), new NullToken())); + + return new SourceFile("Test.jav", classes, new HashSet<>()); + } + + public static Method generateMethod(){ + ArrayList parameters = new ArrayList<>(); + FormalParameter fp = new FormalParameter("param1", TypePlaceholder.fresh(new NullToken()), new NullToken()); + parameters.add(fp); + ParameterList parameterList = new ParameterList(parameters, new NullToken()); + return new Method(Modifier.PUBLIC, "testMethode", TypePlaceholder.fresh(new NullToken()), parameterList, + new Block(new ArrayList<>(), new NullToken()), generateEmptyGenericDeclList(), new NullToken()); + } + + public static GenericDeclarationList generateEmptyGenericDeclList(){ + return new GenericDeclarationList(new ArrayList<>(), new NullToken()); + } +}