forked from JavaTX/JavaCompilerCore
Template für FamilyOfGenerics Test
This commit is contained in:
parent
c86fe95da5
commit
b45964ed5f
57
src/test/java/constraintSimplify/FamilyOfGenerics.java
Normal file
57
src/test/java/constraintSimplify/FamilyOfGenerics.java
Normal file
@ -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<ClassOrInterface> classes = new ArrayList<>();
|
||||
ArrayList<Field> fields = new ArrayList<>();
|
||||
ArrayList<Method> 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<FormalParameter> 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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user