From 2a5c7274003182f660b85e4c608b1be3466bcab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Sat, 14 Jul 2018 09:28:13 +0200 Subject: [PATCH] new file: applyLambdaTest.java modified: javFiles/Lambda.jav new file: javFiles/applyLambda.jav An das JavaTXExamples angepasst --- test/bytecode/applyLambdaTest.java | 23 +++++++++++++++++++++++ test/bytecode/javFiles/Lambda.jav | 13 ++++--------- test/bytecode/javFiles/applyLambda.jav | 16 ++++++++++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 test/bytecode/applyLambdaTest.java create mode 100644 test/bytecode/javFiles/applyLambda.jav diff --git a/test/bytecode/applyLambdaTest.java b/test/bytecode/applyLambdaTest.java new file mode 100644 index 00000000..c7dde161 --- /dev/null +++ b/test/bytecode/applyLambdaTest.java @@ -0,0 +1,23 @@ +package bytecode; + +import java.io.File; + +import org.junit.Test; + +import de.dhbwstuttgart.core.JavaTXCompiler; + +public class applyLambdaTest { + private static String path; + private static File fileToTest; + private static JavaTXCompiler compiler; + + @Test + public void generateBC() throws Exception { + path = System.getProperty("user.dir")+"/test/bytecode/javFiles/applyLambda.jav"; + fileToTest = new File(path); + compiler = new JavaTXCompiler(fileToTest); + compiler.generateBytecode(System.getProperty("user.dir")+"/testBytecode/generatedBC/"); + } + + +} diff --git a/test/bytecode/javFiles/Lambda.jav b/test/bytecode/javFiles/Lambda.jav index bc2b8d60..d7809e7e 100644 --- a/test/bytecode/javFiles/Lambda.jav +++ b/test/bytecode/javFiles/Lambda.jav @@ -1,16 +1,11 @@ -import java.util.Vector; -class Apply { } +import java.lang.Integer; public class Lambda { m () { - var lam1 = (x) -> { - return x; + var lam1 = (Integer x) -> { + return x * x; }; - - return lam1.apply(new Apply()); - //return lam1; -// return new Vector(); + return lam1; } } - diff --git a/test/bytecode/javFiles/applyLambda.jav b/test/bytecode/javFiles/applyLambda.jav new file mode 100644 index 00000000..331bfbfe --- /dev/null +++ b/test/bytecode/javFiles/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} +