forked from JavaTX/JavaCompilerCore
LambdaTest30 anfügen
This commit is contained in:
parent
a5c34896ba
commit
73e6e5c45f
@ -196,11 +196,11 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I
|
||||
{
|
||||
this.name = name;
|
||||
if(name.equals("java.lang.Object")){
|
||||
superclassid=null;
|
||||
superclassid=null;
|
||||
}
|
||||
this.offset = offset;
|
||||
if(!name.equals("Object") && !name.equals("java.lang.Object"))//Alle Klassen auÃer Object erben von Object:
|
||||
this.superClass = new Class("java.lang.Object", -1).getType();
|
||||
this.superClass = new ObjectClass().getType();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -235,7 +235,7 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I
|
||||
|
||||
public Class(String name, RefType superClass, Modifiers mod, int offset){
|
||||
this(name,mod,offset);
|
||||
if(superClass == null)this.superClass = new Class("java.lang.Object",-1).getType();
|
||||
if(superClass == null)this.superClass = new ObjectClass().getType();
|
||||
else this.superClass = superClass;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import de.dhbwstuttgart.bytecode.ClassGenerator;
|
||||
import de.dhbwstuttgart.syntaxtree.Class;
|
||||
import de.dhbwstuttgart.syntaxtree.Constructor;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
import de.dhbwstuttgart.syntaxtree.ObjectClass;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
@ -67,7 +68,7 @@ public class ASTFactory {
|
||||
}
|
||||
|
||||
public static Class createObjectClass() {
|
||||
Class generatedClass = new Class("java.lang.Object", 0);
|
||||
Class generatedClass = new ObjectClass();
|
||||
|
||||
return generatedClass;
|
||||
}
|
||||
|
7
test/bytecode/main/Id.jav
Normal file
7
test/bytecode/main/Id.jav
Normal file
@ -0,0 +1,7 @@
|
||||
class Id{
|
||||
|
||||
public static void main(String[] args){}
|
||||
|
||||
op = (x)->x;
|
||||
|
||||
}
|
44
test/bytecode/main/LambdaExprTest.java
Normal file
44
test/bytecode/main/LambdaExprTest.java
Normal file
@ -0,0 +1,44 @@
|
||||
package bytecode.main;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import bytecode.SourceFileBytecodeTest;
|
||||
import plugindevelopment.TypeInsertTester;
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.core.MyCompilerAPI;
|
||||
import de.dhbwstuttgart.logger.LoggerConfiguration;
|
||||
import de.dhbwstuttgart.logger.Section;
|
||||
import de.dhbwstuttgart.parser.JavaParser.yyException;
|
||||
import de.dhbwstuttgart.typeinference.ByteCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
|
||||
|
||||
public class LambdaExprTest extends SourceFileBytecodeTest{
|
||||
@Override
|
||||
protected void init() {
|
||||
testName = "Id";
|
||||
rootDirectory = System.getProperty("user.dir")+"/test/bytecode/main/";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstruct() throws Exception{
|
||||
ClassLoader classLoader = getClassLoader();
|
||||
|
||||
Class cls = classLoader.loadClass(testName);
|
||||
|
||||
//Invoke main method:
|
||||
cls.getMethod("main", String[].class).invoke(this, new String[0]);
|
||||
|
||||
//Object obj = cls.newInstance();
|
||||
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
13
test/plugindevelopment/TypeInsertTests/LambdaTest30.jav
Normal file
13
test/plugindevelopment/TypeInsertTests/LambdaTest30.jav
Normal file
@ -0,0 +1,13 @@
|
||||
class LambdaTest30{
|
||||
|
||||
java.lang.String methode(x){
|
||||
return x;
|
||||
}
|
||||
|
||||
lambdaGen(){
|
||||
Fun0<java.lang.String> op;
|
||||
op = () -> this.methode("Hallo Welt");
|
||||
return op;
|
||||
}
|
||||
|
||||
}
|
18
test/plugindevelopment/TypeInsertTests/LambdaTest30.java
Normal file
18
test/plugindevelopment/TypeInsertTests/LambdaTest30.java
Normal file
@ -0,0 +1,18 @@
|
||||
package plugindevelopment.TypeInsertTests;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class LambdaTest30 {
|
||||
|
||||
private static final String TEST_FILE = "LambdaTest30.jav";
|
||||
|
||||
@Test
|
||||
public void run(){
|
||||
Menge<String> mustContain = new Menge<String>();
|
||||
//mustContain.add("A a");
|
||||
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user