From e0da2a4c4608960aa443095713a84686f0b957ce Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 3 Nov 2023 18:41:17 +0100 Subject: [PATCH 1/4] modified: Cycle.class modified: LambdaRunnable.jav modified: ../../../src/test/java/TestComplete.java --- resources/bytecode/javFiles/Cycle.class | Bin resources/bytecode/javFiles/LambdaRunnable.jav | 6 +++--- src/test/java/TestComplete.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 resources/bytecode/javFiles/Cycle.class diff --git a/resources/bytecode/javFiles/Cycle.class b/resources/bytecode/javFiles/Cycle.class old mode 100644 new mode 100755 diff --git a/resources/bytecode/javFiles/LambdaRunnable.jav b/resources/bytecode/javFiles/LambdaRunnable.jav index dcedb1f5..41ce9d51 100644 --- a/resources/bytecode/javFiles/LambdaRunnable.jav +++ b/resources/bytecode/javFiles/LambdaRunnable.jav @@ -6,9 +6,9 @@ public class LamRunnable{ public LamRunnable(){ - - Runnable lam = () -> {var a;}; - lam.run(); + Runnable lam; + lam = () -> {var a;}; + //lam.run(); } } diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index e7ea2466..d3ca98f4 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -740,7 +740,7 @@ public class TestComplete { @Test public void testLambdaRunnable() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LambdaRunnable.jav"); - var clazz = classFiles.get("LambdaRunnable"); + var clazz = classFiles.get("LamRunnable"); var instance = clazz.getDeclaredConstructor().newInstance(); //var m = clazz.getDeclaredMethod("m", Integer.class); //assertEquals(m.invoke(instance, 10), 60); @@ -751,8 +751,8 @@ public class TestComplete { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FunctionalInterface.jav"); var clazz = classFiles.get("FunctionalInterface"); var instance = clazz.getDeclaredConstructor().newInstance(); - var m = clazz.getDeclaredMethod("m", Integer.class); - assertEquals(m.invoke(instance, 20), 400); + var m = clazz.getDeclaredMethod("m"); + assertEquals(m.invoke(instance), 200); } @Test From 15150fca9e4c25002a4696fd6b244fcb56d9e18a Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 3 Nov 2023 18:56:31 +0100 Subject: [PATCH 2/4] modified: ../../../src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java --- .../de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 17fbcedd..01834a75 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -668,7 +668,7 @@ public class TypeUnifyTask extends RecursiveTask>> { .filter(x -> x.size()==1) .map(y -> y.stream().findFirst().get()) .collect(Collectors.toCollection(HashSet::new))); - + oneElems.forEach(x -> { if (x instanceof Constraint) methodSignatureConstraint.addAll(((Constraint)x).getmethodSignatureConstraint());}); //optNextSet: Eine mehrelementige Menge, wenn vorhanden Optional>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny(); From d1a6dcbbac14df652e6a9e1685c636b11f532c26 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 3 Nov 2023 20:25:17 +0100 Subject: [PATCH 3/4] modified: core/JavaTXCompiler.java modified: typeinference/constraints/ConstraintSet.java modified: typeinference/unify/TypeUnifyTask.java --- .../java/de/dhbwstuttgart/core/JavaTXCompiler.java | 2 +- .../typeinference/constraints/ConstraintSet.java | 11 ++++++----- .../typeinference/unify/TypeUnifyTask.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 91e6e673..c93db4a4 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -71,7 +71,7 @@ public class JavaTXCompiler { Boolean resultmodel = false; public final Map sourceFiles = new HashMap<>(); - Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? + Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? public volatile UnifyTaskModel usedTasks = new UnifyTaskModel(); private final DirectoryClassLoader classLoader; diff --git a/src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java b/src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java index cd3301c1..f52001b3 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java @@ -75,11 +75,12 @@ public class ConstraintSet { Constraint newConst = as.stream() .map(o) - .collect(Collectors.toCollection((as.getExtendConstraint() != null) - ? () -> new Constraint (as.isInherited(), - as.getExtendConstraint().stream().map(o).collect(Collectors.toCollection(Constraint::new)), - as.getmethodSignatureConstraint().stream().map(o).collect(Collectors.toCollection(HashSet::new))) - : () -> new Constraint (as.isInherited()) + .collect(Collectors.toCollection(( + () -> new Constraint (as.isInherited(), + (as.getExtendConstraint() != null) + ? as.getExtendConstraint().stream().map(o).collect(Collectors.toCollection(Constraint::new)) + : null, + as.getmethodSignatureConstraint().stream().map(o).collect(Collectors.toCollection(HashSet::new)))) )); //CSA2CSB.put(as, newConst); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 17fbcedd..01834a75 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -668,7 +668,7 @@ public class TypeUnifyTask extends RecursiveTask>> { .filter(x -> x.size()==1) .map(y -> y.stream().findFirst().get()) .collect(Collectors.toCollection(HashSet::new))); - + oneElems.forEach(x -> { if (x instanceof Constraint) methodSignatureConstraint.addAll(((Constraint)x).getmethodSignatureConstraint());}); //optNextSet: Eine mehrelementige Menge, wenn vorhanden Optional>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny(); From 78a2fddc212d0afb074815cb781170930d168824 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 3 Nov 2023 20:30:22 +0100 Subject: [PATCH 4/4] modified: ../../../../../resources/bytecode/javFiles/Cycle.class --- resources/bytecode/javFiles/Cycle.class | Bin 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 resources/bytecode/javFiles/Cycle.class diff --git a/resources/bytecode/javFiles/Cycle.class b/resources/bytecode/javFiles/Cycle.class old mode 100755 new mode 100644