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()); + } +}