Merge branch 'bytecodeGenerics' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecodeGenerics

This commit is contained in:
AluAli 2020-10-30 10:52:39 +01:00
commit ab9e9e16bd

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