From 69bdb4aa5b0b438cd5514b164b2afd02caed7d2d Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Mon, 23 Jan 2023 13:56:21 +0100 Subject: [PATCH] Consider environment of type variables in method call --- resources/bytecode/javFiles/VectorAdd.jav | 12 +++++++++++- .../target/generate/ASTToTargetAST.java | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/bytecode/javFiles/VectorAdd.jav b/resources/bytecode/javFiles/VectorAdd.jav index d5e50157..2ad73aa9 100644 --- a/resources/bytecode/javFiles/VectorAdd.jav +++ b/resources/bytecode/javFiles/VectorAdd.jav @@ -1,6 +1,6 @@ import java.util.Vector; import java.lang.Integer; - +import java.lang.String; public class VectorAdd { vectorAdd(v1, v2) { @@ -13,4 +13,14 @@ public class VectorAdd { } return erg; } + + m(x, y, z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.addAll(x); + } } diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index a6eca776..790a9084 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -244,6 +244,7 @@ public class ASTToTargetAST { if (!(pair2.right.equals(tph2) && pair2.left.equals(type))) continue; if (tph.equals(tph2)) continue; + if (!T1s.contains(tph) || !tph2.equals(T2)) continue; var newPair = new PairTPHsmallerTPH(tph, tph2); newPairs.add(newPair);