forked from JavaTX/JavaCompilerCore
Merge branch 'bytecode2' into unify-test
This commit is contained in:
commit
4490de575c
46
pom.xml
46
pom.xml
@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.dhbwstuttgart</groupId>
|
||||
<artifactId>JavaTXcompiler</artifactId>
|
||||
@ -11,6 +11,12 @@
|
||||
<name>JavaTXcompiler</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4</artifactId>
|
||||
@ -37,12 +43,6 @@
|
||||
<artifactId>asm</artifactId>
|
||||
<version>7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.0</version>
|
||||
<!-- <scope>test</scope> -->
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm-all</artifactId>
|
||||
<version>[4.0.0,)</version> </dependency> -->
|
||||
<!-- <dependency> <groupId>org.bitbucket.mstrobel</groupId> <artifactId>procyon-reflection</artifactId>
|
||||
@ -54,8 +54,6 @@
|
||||
<outputDirectory>target/classes</outputDirectory>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<testOutputDirectory>target/test-classes</testOutputDirectory>
|
||||
<sourceDirectory>src/</sourceDirectory>
|
||||
<testSourceDirectory>test/</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
@ -83,7 +81,7 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>src/main/antlr4/sat</sourceDirectory>
|
||||
<outputDirectory>${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/sat/asp/parser/antlr/</outputDirectory>
|
||||
<outputDirectory>${project.basedir}/target/generated-sources/antlr4/de/dhbwstuttgart/sat/asp/parser/antlr</outputDirectory>
|
||||
<arguments>
|
||||
<argument>-package</argument>
|
||||
<argument>de.dhbwstuttgart.sat.asp.parser.antlr</argument>
|
||||
@ -140,28 +138,10 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-p2-repository-plugin</artifactId>
|
||||
<version>${tycho.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>archive-repository</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>${project.basedir}/src/test/resources/testBytecode/generatedBC/*.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-repository-plugin</artifactId>
|
||||
<version>${tycho.version}</version> <executions> <execution> <phase>package</phase>
|
||||
<goals> <goal>archive-repository</goal> </goals> </execution> </executions>
|
||||
</plugin -->
|
||||
</plugins>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
@ -189,3 +169,5 @@
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# A basic script to compile the necessary packages and their subpackages to work with the parser.
|
||||
# Messages are logged to stderr.
|
||||
>&2 echo "Building de.dhbwstuttgart.typecheck..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/typecheck/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree.factory..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/factory/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree.operator..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/operator/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree.statement..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/statement/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree.statement.literal..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/statement/literal/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.syntaxtree.type..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/syntaxtree/type/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.parser..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/parser/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.parser.SyntaxTreeGenerator..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/parser/SyntaxTreeGenerator/*.java
|
||||
>&2 echo "Building de.dhbwstuttgart.parser.antlr..."
|
||||
javac -d ../bin ./de/dhbwstuttgart/parser/antlr/*.java
|
||||
echo "Done. Now its your turn to debug:)."
|
BIN
src/main/java/de/dhbwstuttgart/.DS_Store
vendored
BIN
src/main/java/de/dhbwstuttgart/.DS_Store
vendored
Binary file not shown.
@ -70,6 +70,7 @@ public class BytecodeGen implements ASTVisitor {
|
||||
// stores generics and their bounds of class
|
||||
HashMap<String, String> genericsAndBounds = new HashMap<>();
|
||||
|
||||
private int constructorPos = 0;
|
||||
|
||||
private final TPHExtractor tphExtractor = new TPHExtractor();
|
||||
private final ArrayList<GenericInsertPair> commonPairs = new ArrayList<>();
|
||||
@ -272,7 +273,8 @@ public class BytecodeGen implements ASTVisitor {
|
||||
|
||||
for(String paramName : methodParamsAndTypes.keySet()) {
|
||||
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
|
||||
if(genericsAndBounds.containsKey(typeOfParam) ||typeOfParam.substring(0, 4).equals("TPH ")
|
||||
System.out.println(typeOfParam);
|
||||
if(genericsAndBounds.containsKey(typeOfParam) ||typeOfParam.contains("$")
|
||||
|| typeOfParam.contains("<")) {
|
||||
hasGen = true;
|
||||
break;
|
||||
@ -291,10 +293,14 @@ public class BytecodeGen implements ASTVisitor {
|
||||
desc = constructor.accept(new DescriptorToString(resultSet));
|
||||
System.out.println("Constructor: " + field.getName() + " Sig: "+ sig + " Desc: " + desc);
|
||||
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", desc, sig, null);
|
||||
mv.visitCode();
|
||||
mv.visitCode();
|
||||
|
||||
Block block = fieldInitializations.get().block;
|
||||
|
||||
constructorPos += 1;
|
||||
|
||||
BytecodeGenMethod gen = new BytecodeGenMethod(className,superClass,resultSet,field, mv,paramsAndLocals,cw,
|
||||
genericsAndBoundsMethod,genericsAndBounds,isInterface,classFiles, sf,path, block);
|
||||
genericsAndBoundsMethod,genericsAndBounds,isInterface,classFiles, sf,path, block, constructorPos);
|
||||
if(!field.getParameterList().iterator().hasNext() && !(field.block.statements.get(field.block.statements.size()-1) instanceof ReturnVoid)) {
|
||||
mv.visitInsn(Opcodes.RETURN);
|
||||
}
|
||||
|
@ -85,13 +85,15 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
private boolean isRightSideALambda = false;
|
||||
private KindOfLambda kindOfLambda;
|
||||
private HashMap<String, byte[]> classFiles;
|
||||
|
||||
private int constructorPos = 0;
|
||||
|
||||
private ArrayList<RefTypeOrTPHOrWildcardOrGeneric> varsFunInterface = new ArrayList<>();;
|
||||
// generate bytecode for constructor
|
||||
public BytecodeGenMethod(String className, String superClass,ResultSet resultSet, Method m, MethodVisitor mv,
|
||||
HashMap<String, Integer> paramsAndLocals, ClassWriter cw, HashMap<String, String> genericsAndBoundsMethod,
|
||||
HashMap<String, String> genericsAndBounds, boolean isInterface, HashMap<String, byte[]> classFiles,
|
||||
SourceFile sf,String path, Block block) {
|
||||
SourceFile sf,String path, Block block, int constructorPos) {
|
||||
|
||||
this.className = className;
|
||||
this.superClass = superClass;
|
||||
@ -106,6 +108,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
this.classFiles = classFiles;
|
||||
this.sf = sf;
|
||||
this.path = path;
|
||||
this.constructorPos = constructorPos;
|
||||
if(block != null)
|
||||
this.blockFieldInit = block;
|
||||
this.m.block.accept(this);
|
||||
@ -634,20 +637,20 @@ public class BytecodeGenMethod implements StatementVisitor {
|
||||
// Desc: (this/nothing)TargetType
|
||||
String fiMethodDesc = samMethod.accept(new DescriptorToString(resultSet));
|
||||
mv.visitInvokeDynamicInsn("apply", fiMethodDesc, bootstrap, arg1, arg2, arg3);
|
||||
|
||||
MethodVisitor mvLambdaBody = cw.visitMethod(Opcodes.ACC_PRIVATE + staticOrInstance + Opcodes.ACC_SYNTHETIC,
|
||||
methodName, newDesc, null, null);
|
||||
|
||||
ArrayList<String> usedVars = kindOfLambda.getUsedVars();
|
||||
|
||||
new BytecodeGenMethod(lambdaExpression, usedVars,this.resultSet, mvLambdaBody, indexOfFirstParamLam, isInterface,
|
||||
classFiles,this.path, lamCounter, sf);
|
||||
|
||||
mvLambdaBody.visitMaxs(0, 0);
|
||||
mvLambdaBody.visitEnd();
|
||||
cw.visitInnerClass("java/lang/invoke/MethodHandles$Lookup", "java/lang/invoke/MethodHandles", "Lookup",
|
||||
Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL);
|
||||
|
||||
if(constructorPos<2) {
|
||||
MethodVisitor mvLambdaBody = cw.visitMethod(Opcodes.ACC_PRIVATE + staticOrInstance + Opcodes.ACC_SYNTHETIC,
|
||||
methodName, newDesc, null, null);
|
||||
|
||||
ArrayList<String> usedVars = kindOfLambda.getUsedVars();
|
||||
|
||||
new BytecodeGenMethod(lambdaExpression, usedVars,this.resultSet, mvLambdaBody, indexOfFirstParamLam, isInterface,
|
||||
classFiles,this.path, lamCounter, sf);
|
||||
|
||||
mvLambdaBody.visitMaxs(0, 0);
|
||||
mvLambdaBody.visitEnd();
|
||||
cw.visitInnerClass("java/lang/invoke/MethodHandles$Lookup", "java/lang/invoke/MethodHandles", "Lookup",
|
||||
Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL);
|
||||
}
|
||||
// generateBCForFunN(lambdaExpression, typeErasure);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,14 @@ public class DescriptorToString implements DescriptorVisitor{
|
||||
if(constructor.getGenericsAndBounds().containsKey(fpDesc)){
|
||||
desc += "L"+constructor.getGenericsAndBounds().get(fpDesc)+ ";";
|
||||
}else {
|
||||
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
|
||||
// desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
|
||||
String resType = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
||||
if(resType.subSequence(0, 4).equals("TPH ")) {
|
||||
// Bound ist immer Object
|
||||
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
||||
} else {
|
||||
desc += "L"+resType+ ";";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
// System.out.println("Cons has NO Gens");
|
||||
|
@ -162,7 +162,7 @@ public class KindOfLambda implements StatementVisitor{
|
||||
|
||||
@Override
|
||||
public void visit(UnaryExpr unaryExpr) {
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,7 +202,8 @@ public class KindOfLambda implements StatementVisitor{
|
||||
|
||||
@Override
|
||||
public void visit(WhileStmt whileStmt) {
|
||||
// TODO Auto-generated method stub
|
||||
whileStmt.expr.accept(this);
|
||||
whileStmt.loopBlock.accept(this);
|
||||
|
||||
}
|
||||
|
||||
|
@ -174,9 +174,11 @@ public class Simplify {
|
||||
allCons.addAll(result.keySet());
|
||||
|
||||
if(!allCons.isEmpty() && allCons.size()<2) {
|
||||
|
||||
if(!result.containsKey(allCons.get(0)))
|
||||
result.put(allCons.get(0), null);
|
||||
TPHConstraint cons = allCons.get(0);
|
||||
if(!result.containsKey(cons)) {
|
||||
result.put(cons, null);
|
||||
result.put(new ExtendsConstraint(cons.getRight(), Type.getInternalName(Object.class), Relation.EXTENDS), null);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -122,7 +122,9 @@ public class JavaTXCompiler {
|
||||
TypeUnify unify = new TypeUnify();
|
||||
Set<Set<UnifyPair>> results = new HashSet<>();
|
||||
try {
|
||||
FileWriter logFile = new FileWriter(new File(System.getProperty("user.dir")+"/test/logFiles/"+"log"));
|
||||
File logPath = new File(System.getProperty("user.dir")+"/target/logFiles/");
|
||||
logPath.mkdirs();
|
||||
FileWriter logFile = new FileWriter(new File(logPath, "log"));
|
||||
logFile.write("FC:\\" + finiteClosure.toString()+"\n");
|
||||
for(SourceFile sf : this.sourceFiles.values()) {
|
||||
logFile.write(ASTTypePrinter.print(sf));
|
||||
@ -223,7 +225,9 @@ public class JavaTXCompiler {
|
||||
logFile.write("PLACEHOLDERS: " + PlaceholderType.EXISTING_PLACEHOLDERS);
|
||||
logFile.flush();
|
||||
}
|
||||
catch (IOException e) { }
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return results.stream().map((unifyPairs ->
|
||||
new ResultSet(UnifyTypeFactory.convert(unifyPairs, generateTPHMap(cons))))).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import java.util.Set;
|
||||
|
||||
public class ASPTest {
|
||||
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/javFiles/";
|
||||
private static final List<File> filesToTest = new ArrayList<>();
|
||||
protected File fileToTest = null;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class FacultyTest {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/Faculty.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"//src/test/resources/testBytecode/generatedBC/");
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/");
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("Faculty");
|
||||
|
49
src/test/java/bytecode/FieldTphConsMethTest.java
Normal file
49
src/test/java/bytecode/FieldTphConsMethTest.java
Normal file
@ -0,0 +1,49 @@
|
||||
package bytecode;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class FieldTphConsMethTest {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/FieldTphConsMeth.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/");
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("FieldTphConsMeth");
|
||||
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Field a = classToTest.getDeclaredField("a");
|
||||
a.setAccessible(true);
|
||||
|
||||
Method m = classToTest.getDeclaredMethod("m", Object.class);
|
||||
Object result = m.invoke(instanceOfClass, 42);
|
||||
|
||||
assertEquals(42,result);
|
||||
}
|
||||
|
||||
}
|
38
src/test/java/bytecode/IdTest.java
Normal file
38
src/test/java/bytecode/IdTest.java
Normal file
@ -0,0 +1,38 @@
|
||||
package bytecode;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class IdTest {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/Id.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
compiler.generateBytecode(System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/");
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("Id");
|
||||
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
}
|
45
src/test/java/bytecode/Tph6Test.java
Normal file
45
src/test/java/bytecode/Tph6Test.java
Normal file
@ -0,0 +1,45 @@
|
||||
package bytecode;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class Tph6Test {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/Tph6.jav";
|
||||
fileToTest = new File(path);
|
||||
compiler = new JavaTXCompiler(fileToTest);
|
||||
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
|
||||
compiler.generateBytecode(pathToClassFile);
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass("Tph6");
|
||||
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
// Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class, Object.class);
|
||||
Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class);
|
||||
// Object result = m.invoke(instanceOfClass, "xx",2,3);
|
||||
|
||||
//assertEquals(2,result);
|
||||
}
|
||||
}
|
9
src/test/java/javFiles/AddLong.jav
Normal file
9
src/test/java/javFiles/AddLong.jav
Normal file
@ -0,0 +1,9 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Long;
|
||||
|
||||
public class AddLong{
|
||||
Long add(Integer a, Long b) {
|
||||
Long c = a+b;
|
||||
return c;
|
||||
}
|
||||
}
|
3
src/test/java/javFiles/EmptyClass.jav
Normal file
3
src/test/java/javFiles/EmptyClass.jav
Normal file
@ -0,0 +1,3 @@
|
||||
public class EmptyClass{
|
||||
|
||||
}
|
37
src/test/java/javFiles/EmptyMethod.jav
Normal file
37
src/test/java/javFiles/EmptyMethod.jav
Normal file
@ -0,0 +1,37 @@
|
||||
public class EmptyMethod{
|
||||
static String s1 ="";
|
||||
String s2;
|
||||
public void m1(){
|
||||
//String s = "";
|
||||
System.out.println("test");
|
||||
//Integer ab = Math.abs(1);
|
||||
//Math.abs(1);
|
||||
//String lV = "local";
|
||||
//s1 = "1";
|
||||
//s1.concat("2");
|
||||
s2 = s1;
|
||||
//m2();
|
||||
Clazz i = new Clazz();
|
||||
Integer i = new Integer(1);
|
||||
}
|
||||
|
||||
public void m2(){}
|
||||
}
|
||||
|
||||
class Clazz{}
|
||||
/*
|
||||
public class EmptyMethod2{
|
||||
public static test = "5";
|
||||
public void m1(Integer i, String j, Boolean b){
|
||||
//String s = "";
|
||||
EmptyMethod em = new EmptyMethod();
|
||||
em.m1();
|
||||
em.s1 = "";
|
||||
//Integer ab = Math.abs(1);
|
||||
//Math.abs(1);
|
||||
//String lV = "local";
|
||||
//s1 = "1";
|
||||
//s1.concat("2");
|
||||
//s2 = s1;
|
||||
}
|
||||
}*/
|
8
src/test/java/javFiles/Expressions.jav
Normal file
8
src/test/java/javFiles/Expressions.jav
Normal file
@ -0,0 +1,8 @@
|
||||
class Expressions{
|
||||
|
||||
void test(){
|
||||
var x = 2;
|
||||
x = x + 2;
|
||||
}
|
||||
|
||||
}
|
10
src/test/java/javFiles/FC_Matrix.jav
Normal file
10
src/test/java/javFiles/FC_Matrix.jav
Normal file
@ -0,0 +1,10 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
methode(m) {
|
||||
m.add(1);
|
||||
Matrix i;
|
||||
methode(i);
|
||||
}
|
||||
}
|
15
src/test/java/javFiles/Faculty.jav
Normal file
15
src/test/java/javFiles/Faculty.jav
Normal file
@ -0,0 +1,15 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
class Faculty {
|
||||
|
||||
Integer mul(Integer x, Integer y) {
|
||||
return x;
|
||||
}
|
||||
|
||||
m () {
|
||||
var fact = (Integer x) -> {
|
||||
return mul(x, fact.apply(x));
|
||||
};
|
||||
return fact;
|
||||
}
|
||||
}
|
17
src/test/java/javFiles/FacultyIf.jav
Normal file
17
src/test/java/javFiles/FacultyIf.jav
Normal file
@ -0,0 +1,17 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
class Faculty {
|
||||
|
||||
m () {
|
||||
|
||||
var fact = (Integer x) -> {
|
||||
if (x == 1) {
|
||||
return x;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
return fact;
|
||||
}
|
||||
}
|
19
src/test/java/javFiles/FacultyTyped.jav
Normal file
19
src/test/java/javFiles/FacultyTyped.jav
Normal file
@ -0,0 +1,19 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
class Faculty {
|
||||
|
||||
Integer mul(Integer x, Integer y) {
|
||||
return x;
|
||||
}
|
||||
|
||||
Fun1<java.lang.Integer,java.lang.Integer> m () {
|
||||
var fact = (Integer x) -> {
|
||||
return mul(x, fact.apply(x));
|
||||
};
|
||||
return fact;
|
||||
}
|
||||
}
|
||||
|
||||
interface Fun1<A,B>{
|
||||
B apply(A a);
|
||||
}
|
11
src/test/java/javFiles/Fields.jav
Normal file
11
src/test/java/javFiles/Fields.jav
Normal file
@ -0,0 +1,11 @@
|
||||
import java.lang.String;
|
||||
|
||||
class Fields{
|
||||
test2 = "test";
|
||||
test;
|
||||
m(){
|
||||
var test3;
|
||||
return test;
|
||||
}
|
||||
|
||||
}
|
22
src/test/java/javFiles/Generics.jav
Normal file
22
src/test/java/javFiles/Generics.jav
Normal file
@ -0,0 +1,22 @@
|
||||
import java.lang.String;
|
||||
|
||||
class Generics<B> {
|
||||
//<A extends B> A mt1(A a, B b){
|
||||
B mt1(B a, B b){
|
||||
return mt1(a, a);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
methode(String s){
|
||||
return new Generics<String>().mt1(s,s);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Problem:
|
||||
auto test = new List<String>();
|
||||
auto test2 = new List<Integer>();
|
||||
... //code, welcher möglicherweise test und test2 vertauscht
|
||||
test.add("hallo");
|
||||
*/
|
14
src/test/java/javFiles/IfTest.jav
Normal file
14
src/test/java/javFiles/IfTest.jav
Normal file
@ -0,0 +1,14 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Object;
|
||||
|
||||
public class IfTest{
|
||||
Object m1(b) {
|
||||
Integer i;
|
||||
if(b) {
|
||||
return i;
|
||||
}else{
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
8
src/test/java/javFiles/Import.jav
Normal file
8
src/test/java/javFiles/Import.jav
Normal file
@ -0,0 +1,8 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Import {
|
||||
void methode(){
|
||||
Vector v;
|
||||
v.add(v);
|
||||
}
|
||||
}
|
13
src/test/java/javFiles/Lambda.jav
Normal file
13
src/test/java/javFiles/Lambda.jav
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
class Apply { }
|
||||
|
||||
public class Lambda {
|
||||
|
||||
m () {
|
||||
var lam1 = (x) -> {
|
||||
return x;
|
||||
};
|
||||
return lam1.apply(new Apply());
|
||||
}
|
||||
}
|
||||
|
33
src/test/java/javFiles/Lambda2.jav
Normal file
33
src/test/java/javFiles/Lambda2.jav
Normal file
@ -0,0 +1,33 @@
|
||||
import java.lang.String;
|
||||
|
||||
public class Lambda2
|
||||
{
|
||||
public static void main(List<String> args){
|
||||
var listOfStrings = new List<String>();
|
||||
var listOfObjects;
|
||||
listOfObjects = map(listOfStrings, (a) -> a);
|
||||
}
|
||||
|
||||
public map(a , b){
|
||||
b.apply(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
public static <I,O> List<O> map(List<I> input, Function<I,O> func) {
|
||||
List<O> output;
|
||||
output = new List<O>();
|
||||
output.add(func.apply(input.get()));
|
||||
return output;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
class List<A>{
|
||||
A get();
|
||||
void add(A);
|
||||
}
|
||||
|
||||
class Function<A,B>{
|
||||
B apply(A a);
|
||||
}
|
24
src/test/java/javFiles/Lambda3.jav
Normal file
24
src/test/java/javFiles/Lambda3.jav
Normal file
@ -0,0 +1,24 @@
|
||||
import java.lang.String;
|
||||
|
||||
public class Lambda2
|
||||
{
|
||||
/*
|
||||
public static <A> List<A> map(List<? extends A> input,
|
||||
Function<? super A, ? extends A> func){
|
||||
input.add(func.apply(input.get()));
|
||||
}
|
||||
*/
|
||||
public map(input,func){
|
||||
input.add(func.apply(input.get()));
|
||||
return map(new List<String>(), func);
|
||||
}
|
||||
}
|
||||
|
||||
class List<A>{
|
||||
A get();
|
||||
void add(A);
|
||||
}
|
||||
|
||||
class Function<A,B>{
|
||||
B apply(A a);
|
||||
}
|
6
src/test/java/javFiles/LambdaField.jav
Normal file
6
src/test/java/javFiles/LambdaField.jav
Normal file
@ -0,0 +1,6 @@
|
||||
public class LambdaField {
|
||||
|
||||
f = x -> x;
|
||||
|
||||
}
|
||||
|
14
src/test/java/javFiles/LambdaRunnable.jav
Normal file
14
src/test/java/javFiles/LambdaRunnable.jav
Normal file
@ -0,0 +1,14 @@
|
||||
import java.lang.Runnable;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
|
||||
public class LamRunnable{
|
||||
|
||||
public LamRunnable(){
|
||||
|
||||
|
||||
Runnable lam = () -> {System.out.println("lambda");};
|
||||
lam.run();
|
||||
}
|
||||
}
|
||||
|
20
src/test/java/javFiles/ListenerOverload.jav
Normal file
20
src/test/java/javFiles/ListenerOverload.jav
Normal file
@ -0,0 +1,20 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.String;
|
||||
|
||||
class ListenerOverload{
|
||||
|
||||
call(p){
|
||||
call(p.left);
|
||||
call(p.right);
|
||||
}
|
||||
|
||||
call(Integer i){}
|
||||
|
||||
call(String s){}
|
||||
|
||||
}
|
||||
|
||||
class Pair<A,B>{
|
||||
A left;
|
||||
B right;
|
||||
}
|
28
src/test/java/javFiles/Matrix.jav
Normal file
28
src/test/java/javFiles/Matrix.jav
Normal file
@ -0,0 +1,28 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
|
||||
class Matrix extends Vector<Vector<Integer>> {
|
||||
Integer mul1(Integer x, Integer y) { return x;}
|
||||
Integer add1(Integer x, Integer y) { return x;}
|
||||
mul(m) {
|
||||
var ret = new Matrix();
|
||||
var i = 0;
|
||||
while(i < size()) {
|
||||
var v1 = this.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
|
||||
//erg = add1(erg, mul1(v1.elementAt(k),
|
||||
// m.elementAt(k).elementAt(j)));
|
||||
k++; }
|
||||
v2.addElement(new Integer(erg));
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++; }
|
||||
return ret;
|
||||
}
|
||||
}
|
11
src/test/java/javFiles/Meth_Gen.jav
Normal file
11
src/test/java/javFiles/Meth_Gen.jav
Normal file
@ -0,0 +1,11 @@
|
||||
class Meth_Gen {
|
||||
|
||||
m1(x, y) {
|
||||
m2(x);
|
||||
x = y;
|
||||
}
|
||||
|
||||
m2(y) {
|
||||
m1(y, y);
|
||||
}
|
||||
}
|
14
src/test/java/javFiles/MethodCallGenerics.jav
Normal file
14
src/test/java/javFiles/MethodCallGenerics.jav
Normal file
@ -0,0 +1,14 @@
|
||||
import java.lang.String;
|
||||
|
||||
class Generics<B> {
|
||||
//<A extends B> A mt1(A a, B b){
|
||||
B mt1(B a, B b){
|
||||
return mt1(a, a);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
methode(String s){
|
||||
return new Generics<String>().mt1(s,s);
|
||||
}
|
||||
}
|
17
src/test/java/javFiles/Methods.jav
Normal file
17
src/test/java/javFiles/Methods.jav
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
class Methods {
|
||||
mt4(a,b,c) { return a.add(b).sub(c) ; }
|
||||
|
||||
mt1(a) {return a;}
|
||||
|
||||
mt2(a) {return a.f; }
|
||||
|
||||
mt3(a) {return a.add(); }
|
||||
}
|
||||
|
||||
class Test {
|
||||
java.lang.Object f;
|
||||
add(){}
|
||||
add(b){return b;}
|
||||
sub(b){}
|
||||
}
|
7
src/test/java/javFiles/MethodsEasy.jav
Normal file
7
src/test/java/javFiles/MethodsEasy.jav
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
class Methods {
|
||||
mt4(a,b,c) { return a.mt3(b).mt3(c) ; }
|
||||
|
||||
mt3(a) {return a.mt3(a); }
|
||||
}
|
||||
|
11
src/test/java/javFiles/Op1.jav
Normal file
11
src/test/java/javFiles/Op1.jav
Normal file
@ -0,0 +1,11 @@
|
||||
public class Op1{
|
||||
public Op1() {
|
||||
|
||||
Runnable lam = () -> {
|
||||
String test = "";
|
||||
String b = "b";
|
||||
test = b;
|
||||
System.out.println(test);};
|
||||
//lam.run();
|
||||
}
|
||||
}
|
5
src/test/java/javFiles/Package.jav
Normal file
5
src/test/java/javFiles/Package.jav
Normal file
@ -0,0 +1,5 @@
|
||||
package strucType.input;
|
||||
|
||||
class Neu
|
||||
{
|
||||
}
|
8
src/test/java/javFiles/Sorting.jav
Normal file
8
src/test/java/javFiles/Sorting.jav
Normal file
@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
class Sorting{
|
||||
void merge(a, b){
|
||||
a.addAll(b);
|
||||
}
|
||||
}
|
6
src/test/java/javFiles/Subclass.jav
Normal file
6
src/test/java/javFiles/Subclass.jav
Normal file
@ -0,0 +1,6 @@
|
||||
public class Subclass extends Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
super.printMethod();
|
||||
}
|
||||
}
|
6
src/test/java/javFiles/Superclass.jav
Normal file
6
src/test/java/javFiles/Superclass.jav
Normal file
@ -0,0 +1,6 @@
|
||||
public class Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
System.out.println("Printed in Superclass.");
|
||||
}
|
||||
}
|
23
src/test/java/javFiles/Vector.jav
Normal file
23
src/test/java/javFiles/Vector.jav
Normal file
@ -0,0 +1,23 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
import java.lang.Object;
|
||||
|
||||
class MyVector{
|
||||
|
||||
id(x){
|
||||
Object i;
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
x.add(i);
|
||||
return x;
|
||||
}
|
||||
}
|
18
src/test/java/javFiles/fc.jav
Normal file
18
src/test/java/javFiles/fc.jav
Normal file
@ -0,0 +1,18 @@
|
||||
import java.util.List;
|
||||
|
||||
class Test{
|
||||
methode(param1, param2, param3) {
|
||||
param2.add(param3);
|
||||
return param1.meth(param2);
|
||||
}
|
||||
}
|
||||
|
||||
interface Klasse1{
|
||||
Klasse1 meth(List p);
|
||||
Klasse1 meth(Klasse2 p);
|
||||
}
|
||||
|
||||
interface Klasse2{
|
||||
Klasse1 meth(Klasse1 p);
|
||||
Klasse2 meth(Klasse2 p);
|
||||
}
|
13
src/test/java/javFiles/mathStruc.jav
Normal file
13
src/test/java/javFiles/mathStruc.jav
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
class mathStruc<A> {
|
||||
|
||||
mathStruc(A a) { }
|
||||
|
||||
A model(){ A a; return a; }
|
||||
|
||||
methode(){
|
||||
var innerOp = o -> ms ->
|
||||
new mathStruc<A>(o.apply(this.model(),ms.model()));
|
||||
return innerOp;
|
||||
}
|
||||
}
|
15
src/test/java/javFiles/test.jav
Normal file
15
src/test/java/javFiles/test.jav
Normal file
@ -0,0 +1,15 @@
|
||||
class Test{
|
||||
methode(param1, param2, param3) {
|
||||
return param1.meth(param2.meth(param3));
|
||||
}
|
||||
}
|
||||
|
||||
interface Klasse1{
|
||||
Klasse1 meth(Klasse1 p);
|
||||
Klasse1 meth(Klasse2 p);
|
||||
}
|
||||
|
||||
interface Klasse2{
|
||||
Klasse1 meth(Klasse1 p);
|
||||
Klasse2 meth(Klasse2 p);
|
||||
}
|
7
src/test/java/javFiles/test1.jav
Normal file
7
src/test/java/javFiles/test1.jav
Normal file
@ -0,0 +1,7 @@
|
||||
class Faculty {
|
||||
|
||||
int a;
|
||||
m (int x) {
|
||||
return a+x;
|
||||
}
|
||||
}
|
24
src/test/java/log4jTesting.xml
Executable file
24
src/test/java/log4jTesting.xml
Executable file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
|
||||
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
|
||||
<layout class="de.dhbwstuttgart.logger.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<logger name="trtest">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="funcTest">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
</log4j:configuration>
|
@ -22,7 +22,7 @@ import java.util.Set;
|
||||
|
||||
public class JavaTXCompilerTest {
|
||||
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/javFiles/";
|
||||
@Test
|
||||
public void finiteClosure() throws IOException, ClassNotFoundException {
|
||||
execute(new File(rootDirectory+"fc.jav"));
|
||||
|
@ -22,7 +22,7 @@ import java.util.Set;
|
||||
|
||||
public class Meth_GenTest {
|
||||
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/javFiles/";
|
||||
/*
|
||||
@Test
|
||||
public void finiteClosure() throws IOException, ClassNotFoundException {
|
||||
|
@ -22,7 +22,7 @@ import java.util.Set;
|
||||
|
||||
public class UnifyTest {
|
||||
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/javFiles/";
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/javFiles/";
|
||||
/*
|
||||
@Test
|
||||
public void finiteClosure() throws IOException, ClassNotFoundException {
|
||||
|
11
src/test/resources/bytecode/javFiles/FieldTphConsMeth.jav
Normal file
11
src/test/resources/bytecode/javFiles/FieldTphConsMeth.jav
Normal file
@ -0,0 +1,11 @@
|
||||
public class FieldTphConsMeth {
|
||||
|
||||
a;
|
||||
public FieldTphConsMeth(c) {
|
||||
a = m(c);
|
||||
}
|
||||
|
||||
m(b) {
|
||||
return b;
|
||||
}
|
||||
}
|
6
src/test/resources/bytecode/javFiles/Id.jav
Normal file
6
src/test/resources/bytecode/javFiles/Id.jav
Normal file
@ -0,0 +1,6 @@
|
||||
public class Id {
|
||||
|
||||
id(b){
|
||||
return b;
|
||||
}
|
||||
}
|
14
src/test/resources/bytecode/javFiles/Tph6.jav
Normal file
14
src/test/resources/bytecode/javFiles/Tph6.jav
Normal file
@ -0,0 +1,14 @@
|
||||
public class Tph6 {
|
||||
// m(a,b,c){
|
||||
// a = c;
|
||||
// b = c;
|
||||
// return a;
|
||||
// }
|
||||
|
||||
m(x,y){
|
||||
var c = m2(y);
|
||||
c = m2(x);
|
||||
}
|
||||
|
||||
m2(y) { return y; }
|
||||
}
|
6
src/test/resources/testBytecode/Field.java
Normal file
6
src/test/resources/testBytecode/Field.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Field{
|
||||
public void m(){
|
||||
MethFieldVar mF = new MethFieldVar();
|
||||
mF.s1 = "Field S1";
|
||||
}
|
||||
}
|
8
src/test/resources/testBytecode/Import.java
Normal file
8
src/test/resources/testBytecode/Import.java
Normal file
@ -0,0 +1,8 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class Import {
|
||||
void methode(){
|
||||
Vector v = new Vector();
|
||||
v.add(v);
|
||||
}
|
||||
}
|
10
src/test/resources/testBytecode/Lam1.java
Normal file
10
src/test/resources/testBytecode/Lam1.java
Normal file
@ -0,0 +1,10 @@
|
||||
import java.util.function.Function;
|
||||
public class Lam1{
|
||||
public Lam1() {
|
||||
Function<String,String> fun = (x) -> x+"1";
|
||||
fun.apply("2");
|
||||
|
||||
Runnable lam = () -> System.out.println("lambda");
|
||||
lam.run();
|
||||
}
|
||||
}
|
8
src/test/resources/testBytecode/LamRun.java
Normal file
8
src/test/resources/testBytecode/LamRun.java
Normal file
@ -0,0 +1,8 @@
|
||||
public class LamRun{
|
||||
|
||||
public void mRun(){
|
||||
|
||||
Runnable lam = () -> System.out.println("lambda");
|
||||
lam.run();
|
||||
}
|
||||
}
|
38
src/test/resources/testBytecode/MethFieldVar.java
Normal file
38
src/test/resources/testBytecode/MethFieldVar.java
Normal file
@ -0,0 +1,38 @@
|
||||
public class MethFieldVar{
|
||||
String s1;// = "";
|
||||
String s2;
|
||||
|
||||
/* public void meth(Integer i, String j, Boolean b){
|
||||
//String local = "a";
|
||||
//int localL = local.length();
|
||||
//int l = s.length();
|
||||
String s = null;
|
||||
//s = "";
|
||||
//return s.length();//l+localL;
|
||||
}
|
||||
*/
|
||||
public void mm(){
|
||||
// return "mm";
|
||||
}
|
||||
public void m2(){
|
||||
System.out.println("");
|
||||
// Math.abs(1);
|
||||
// String lV = "local";
|
||||
// s1 = "1";
|
||||
// s1.concat("2");
|
||||
s2 = s1;
|
||||
|
||||
mm();
|
||||
|
||||
Clazz i = new Clazz();
|
||||
|
||||
Runnable lam = ()->{
|
||||
String test = "";
|
||||
String b = "b";
|
||||
test = b;
|
||||
System.out.println(test);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Clazz{}
|
6
src/test/resources/testBytecode/Subclass.java
Normal file
6
src/test/resources/testBytecode/Subclass.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Subclass extends Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
super.printMethod();
|
||||
}
|
||||
}
|
14
src/test/resources/testBytecode/SuperTest.java
Normal file
14
src/test/resources/testBytecode/SuperTest.java
Normal file
@ -0,0 +1,14 @@
|
||||
public class Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
System.out.println("Printed in Superclass.");
|
||||
}
|
||||
}
|
||||
|
||||
public class Subclass extends Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
super.printMethod();
|
||||
|
||||
}
|
||||
}
|
6
src/test/resources/testBytecode/Superclass.java
Normal file
6
src/test/resources/testBytecode/Superclass.java
Normal file
@ -0,0 +1,6 @@
|
||||
public class Superclass {
|
||||
|
||||
public void printMethod() {
|
||||
System.out.println("Printed in Superclass.");
|
||||
}
|
||||
}
|
11
src/test/resources/testBytecode/TestMyTest.java
Normal file
11
src/test/resources/testBytecode/TestMyTest.java
Normal file
@ -0,0 +1,11 @@
|
||||
class TestMyTest{
|
||||
public static void main(String[] a){
|
||||
//test1
|
||||
//new TestClass();
|
||||
//test if statement
|
||||
//new TestIf(new Boolean(true));
|
||||
// test lambda
|
||||
//new TestClass();
|
||||
new LamRun();
|
||||
}
|
||||
}
|
1
src/test/resources/testBytecode/public
Normal file
1
src/test/resources/testBytecode/public
Normal file
@ -0,0 +1 @@
|
||||
|
5
src/test/resources/testBytecode/testF.java
Normal file
5
src/test/resources/testBytecode/testF.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class testTets(){
|
||||
public static void main(String[] args){
|
||||
new tetsF();
|
||||
}
|
||||
}
|
5
src/test/resources/testBytecode/testTets.java
Normal file
5
src/test/resources/testBytecode/testTets.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class testTets{
|
||||
public static void main(String[] args){
|
||||
new TetsF();
|
||||
}
|
||||
}
|
5
src/test/resources/testBytecode/testTetsF.java
Normal file
5
src/test/resources/testBytecode/testTetsF.java
Normal file
@ -0,0 +1,5 @@
|
||||
public class testTets(){
|
||||
public static void main(String[] args){
|
||||
new tetsF();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user