From fdf79f598c8003be158761e2003fb694cbef6dbf Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Tue, 2 Jul 2024 16:51:07 +0200 Subject: [PATCH 1/5] draft: let users chain the acceptors with the given visitor so that they can do stmt.accept(visitor).getResult() --- .../main/java/sootup/core/jimple/common/expr/JCastExpr.java | 3 ++- .../src/main/java/sootup/core/jimple/visitor/Acceptor.java | 2 +- sootup.core/src/main/java/sootup/core/types/ArrayType.java | 3 ++- sootup.core/src/main/java/sootup/core/types/ClassType.java | 3 ++- sootup.core/src/main/java/sootup/core/types/PrimitiveType.java | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCastExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCastExpr.java index 403b33dd039..cdeae97bfef 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCastExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCastExpr.java @@ -83,8 +83,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ExprVisitor v) { + public V accept(@Nonnull V v) { v.caseCastExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/Acceptor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/Acceptor.java index 05a627069fb..a5c4d77c70d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/Acceptor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/Acceptor.java @@ -31,5 +31,5 @@ public interface Acceptor { * * @param v */ - void accept(@Nonnull V v); + V accept(@Nonnull X v); } diff --git a/sootup.core/src/main/java/sootup/core/types/ArrayType.java b/sootup.core/src/main/java/sootup/core/types/ArrayType.java index df57ef7ed62..f4ccbb42679 100644 --- a/sootup.core/src/main/java/sootup/core/types/ArrayType.java +++ b/sootup.core/src/main/java/sootup/core/types/ArrayType.java @@ -96,8 +96,9 @@ public Type getElementType() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public TypeVisitor accept(@Nonnull TypeVisitor v) { v.caseArrayType(); + return v; } public boolean isArrayTypeOfPrimitives() { diff --git a/sootup.core/src/main/java/sootup/core/types/ClassType.java b/sootup.core/src/main/java/sootup/core/types/ClassType.java index e5e598a8d3d..0d82eb791d2 100644 --- a/sootup.core/src/main/java/sootup/core/types/ClassType.java +++ b/sootup.core/src/main/java/sootup/core/types/ClassType.java @@ -45,8 +45,9 @@ public abstract class ClassType extends ReferenceType implements Signature { public abstract PackageName getPackageName(); @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseClassType(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java b/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java index 326daeb1bae..d782ddce509 100644 --- a/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java +++ b/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java @@ -146,8 +146,9 @@ public static IntType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseIntType(); + return v; } } From 1d028a162cf6e7fb846f979ae0bde42f1c93fbf9 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Mon, 5 Aug 2024 13:26:42 +0200 Subject: [PATCH 2/5] refactor the rest of the accept() visitors --- .../java/sootup/core/jimple/basic/Local.java | 3 ++- .../common/constant/BooleanConstant.java | 5 +++-- .../jimple/common/constant/ClassConstant.java | 6 +++--- .../common/constant/DoubleConstant.java | 6 +++--- .../jimple/common/constant/EnumConstant.java | 6 +++--- .../jimple/common/constant/FloatConstant.java | 6 +++--- .../jimple/common/constant/IntConstant.java | 6 +++--- .../jimple/common/constant/LongConstant.java | 6 +++--- .../jimple/common/constant/MethodHandle.java | 5 +++-- .../jimple/common/constant/MethodType.java | 6 +++--- .../jimple/common/constant/NullConstant.java | 6 +++--- .../common/constant/StringConstant.java | 6 +++--- .../core/jimple/common/expr/JAddExpr.java | 4 ++-- .../core/jimple/common/expr/JAndExpr.java | 4 ++-- .../core/jimple/common/expr/JCmpExpr.java | 4 ++-- .../core/jimple/common/expr/JCmpgExpr.java | 4 ++-- .../core/jimple/common/expr/JCmplExpr.java | 4 ++-- .../core/jimple/common/expr/JDivExpr.java | 4 ++-- .../common/expr/JDynamicInvokeExpr.java | 4 ++-- .../core/jimple/common/expr/JEqExpr.java | 4 ++-- .../core/jimple/common/expr/JGeExpr.java | 4 ++-- .../core/jimple/common/expr/JGtExpr.java | 4 ++-- .../jimple/common/expr/JInstanceOfExpr.java | 4 ++-- .../common/expr/JInterfaceInvokeExpr.java | 4 ++-- .../core/jimple/common/expr/JLeExpr.java | 4 ++-- .../core/jimple/common/expr/JLengthExpr.java | 4 ++-- .../core/jimple/common/expr/JLtExpr.java | 4 ++-- .../core/jimple/common/expr/JMulExpr.java | 4 ++-- .../core/jimple/common/expr/JNeExpr.java | 4 ++-- .../core/jimple/common/expr/JNegExpr.java | 4 ++-- .../jimple/common/expr/JNewArrayExpr.java | 4 ++-- .../core/jimple/common/expr/JNewExpr.java | 4 ++-- .../common/expr/JNewMultiArrayExpr.java | 4 ++-- .../core/jimple/common/expr/JOrExpr.java | 4 ++-- .../core/jimple/common/expr/JPhiExpr.java | 4 ++-- .../core/jimple/common/expr/JRemExpr.java | 4 ++-- .../core/jimple/common/expr/JShlExpr.java | 4 ++-- .../core/jimple/common/expr/JShrExpr.java | 4 ++-- .../common/expr/JSpecialInvokeExpr.java | 4 ++-- .../jimple/common/expr/JStaticInvokeExpr.java | 4 ++-- .../core/jimple/common/expr/JSubExpr.java | 4 ++-- .../core/jimple/common/expr/JUshrExpr.java | 4 ++-- .../common/expr/JVirtualInvokeExpr.java | 4 ++-- .../core/jimple/common/expr/JXorExpr.java | 4 ++-- .../core/jimple/common/ref/JArrayRef.java | 4 +++- .../common/ref/JCaughtExceptionRef.java | 4 +++- .../jimple/common/ref/JInstanceFieldRef.java | 5 +++-- .../core/jimple/common/ref/JParameterRef.java | 5 +++-- .../jimple/common/ref/JStaticFieldRef.java | 4 +++- .../core/jimple/common/ref/JThisRef.java | 4 +++- .../core/jimple/common/stmt/JAssignStmt.java | 5 +++-- .../core/jimple/common/stmt/JGotoStmt.java | 6 +++--- .../jimple/common/stmt/JIdentityStmt.java | 5 +++-- .../core/jimple/common/stmt/JIfStmt.java | 6 +++--- .../core/jimple/common/stmt/JInvokeStmt.java | 5 +++-- .../core/jimple/common/stmt/JNopStmt.java | 6 +++--- .../core/jimple/common/stmt/JReturnStmt.java | 6 +++--- .../jimple/common/stmt/JReturnVoidStmt.java | 6 +++--- .../core/jimple/common/stmt/JThrowStmt.java | 6 +++--- .../javabytecode/stmt/JBreakpointStmt.java | 6 +++--- .../javabytecode/stmt/JEnterMonitorStmt.java | 6 +++--- .../javabytecode/stmt/JExitMonitorStmt.java | 6 +++--- .../jimple/javabytecode/stmt/JRetStmt.java | 6 +++--- .../jimple/javabytecode/stmt/JSwitchStmt.java | 6 +++--- .../java/sootup/core/types/ArrayType.java | 2 +- .../main/java/sootup/core/types/NullType.java | 3 ++- .../java/sootup/core/types/PrimitiveType.java | 21 ++++++++++++------- .../java/sootup/core/types/UnknownType.java | 3 ++- .../main/java/sootup/core/types/VoidType.java | 3 ++- .../types/AugmentIntegerTypes.java | 6 +++--- .../typeresolving/types/BottomType.java | 4 ++-- .../typeresolving/types/TopType.java | 7 +++++-- .../typeresolving/types/WeakObjectType.java | 4 ++-- 73 files changed, 192 insertions(+), 163 deletions(-) diff --git a/sootup.core/src/main/java/sootup/core/jimple/basic/Local.java b/sootup.core/src/main/java/sootup/core/jimple/basic/Local.java index 1021711556a..7453ff6eb33 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/basic/Local.java +++ b/sootup.core/src/main/java/sootup/core/jimple/basic/Local.java @@ -154,8 +154,9 @@ public List getDefsForLocalUse(StmtGraph graph, Stmt stmt) { } @Override - public void accept(@Nonnull ImmediateVisitor v) { + public V accept(@Nonnull V v) { v.caseLocal(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java index 09aae956c9e..de247a5fc11 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java @@ -74,8 +74,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseBooleanConstant(this); + public V accept(@Nonnull V v) { + v.caseBooleanConstant(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java index 8cc69a74997..634a5d251d6 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java @@ -178,9 +178,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseClassConstant(this); - } + public V accept(@Nonnull V v) { + v.caseClassConstant(this); + return v;} @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java index e19def5afd6..5249fbb9bfe 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java @@ -177,9 +177,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseDoubleConstant(this); - } + public V accept(@Nonnull V v) { + v.caseDoubleConstant(this); + return v;} /** * Checks if passed argument is instance of expected class. diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java index ca7d1d4fc30..abd31047057 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java @@ -64,9 +64,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseEnumConstant(this); - } + public V accept(@Nonnull V v) { + v.caseEnumConstant(this); + return v;} @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java index 950f7feb112..b7344bc8a90 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java @@ -170,9 +170,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseFloatConstant(this); - } + public V accept(@Nonnull V v) { + v.caseFloatConstant(this); + return v;} public float getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java index b6fdd1acb8a..e348e0de25e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java @@ -171,9 +171,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseIntConstant(this); - } + public V accept(@Nonnull V v) { + v.caseIntConstant(this); + return v;} public int getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java index 3b76e1da677..690fb172702 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java @@ -183,9 +183,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseLongConstant(this); - } + public V accept(@Nonnull V v) { + v.caseLongConstant(this); + return v;} public long getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java index 8c02e3246f8..1367847c3ff 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java @@ -157,8 +157,9 @@ public SootClassMemberSignature getRefere } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseMethodHandle(this); + public V accept(@Nonnull V v) { + v.caseMethodHandle(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java index 49ad88426aa..706152491d7 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java @@ -81,7 +81,7 @@ public boolean equals(Object obj) { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseMethodType(this); - } + public V accept(@Nonnull V v) { + v.caseMethodType(this); + return v;} } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java index a9b5762d698..c89f4296d40 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java @@ -55,9 +55,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseNullConstant(this); - } + public V accept(@Nonnull V v) { + v.caseNullConstant(this); + return v;} @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java index e447464474b..6e530e5e18d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java @@ -56,9 +56,9 @@ public Type getType() { } @Override - public void accept(@Nonnull ConstantVisitor v) { - v.caseStringConstant(this); - } + public V accept(@Nonnull V v) { + v.caseStringConstant(this); + return v;} @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java index d5db75cfd15..05c6973d989 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseAddExpr(this); + public V accept(@Nonnull V v) { v.caseAddExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java index 1de8e46fca6..e9f4d6a9cf7 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseAndExpr(this); + public V accept(@Nonnull V v) { v.caseAndExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java index 4662b226954..43f8fceb40f 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseCmpExpr(this); + public V accept(@Nonnull V v) { v.caseCmpExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java index e95e068305e..6816075325d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseCmpgExpr(this); + public V accept(@Nonnull V v) { v.caseCmpgExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java index 8b9a9d98cc4..c8957ed552e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseCmplExpr(this); + public V accept(@Nonnull V v) { v.caseCmplExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java index 0078831b6cf..580df385965 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseDivExpr(this); + public V accept(@Nonnull V v) { v.caseDivExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java index 5a1f5c73788..c2060328bcb 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java @@ -171,8 +171,8 @@ private String getNamelessSubSig(MethodSubSignature mSubSig) { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseDynamicInvokeExpr(this); + public V accept(@Nonnull V v) { v.caseDynamicInvokeExpr(this); + return v; } /** Returns a list args of type Value. */ diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java index 427eb1d8b7f..201db48bc41 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseEqExpr(this); + public V accept(@Nonnull V v) { v.caseEqExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java index fab195e3bc4..ef915c9a006 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseGeExpr(this); + public V accept(@Nonnull V v) { v.caseGeExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java index 5ef14d09653..347011300ae 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseGtExpr(this); + public V accept(@Nonnull V v) { v.caseGtExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java index 53e323cf25b..286173f01e9 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java @@ -91,8 +91,8 @@ public Type getCheckType() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseInstanceOfExpr(this); + public V accept(@Nonnull V v) { v.caseInstanceOfExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java index 3f9fedf8799..f0e0b458a04 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java @@ -96,8 +96,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseInterfaceInvokeExpr(this); + public V accept(@Nonnull V v) { v.caseInterfaceInvokeExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java index 63533ceb454..ed11d8ef4ee 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseLeExpr(this); + public V accept(@Nonnull V v) { v.caseLeExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java index 643c550abdd..2ac30baf6a2 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java @@ -67,8 +67,8 @@ public PrimitiveType getType() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseLengthExpr(this); + public V accept(@Nonnull V v) { v.caseLengthExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java index 9cdae61edc5..0391244ed76 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseLtExpr(this); + public V accept(@Nonnull V v) { v.caseLtExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java index 6202a191295..d812aaa38d0 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseMulExpr(this); + public V accept(@Nonnull V v) { v.caseMulExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java index 9e3e1cc0ef2..d1465e558c1 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseNeExpr(this); + public V accept(@Nonnull V v) { v.caseNeExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java index 7466b08913c..2d4a957ecb3 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java @@ -87,8 +87,8 @@ public Type getType() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseNegExpr(this); + public V accept(@Nonnull V v) { v.caseNegExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java index 44eef242070..9f77167cd85 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java @@ -119,8 +119,8 @@ public Type getType() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseNewArrayExpr(this); + public V accept(@Nonnull V v) { v.caseNewArrayExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java index 42310d1b06b..f1dc37a19e6 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java @@ -76,8 +76,8 @@ public Stream getUses() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseNewExpr(this); + public V accept(@Nonnull V v) { v.caseNewExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java index 3e834e28f75..f251733d5dc 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java @@ -130,8 +130,8 @@ public Type getType() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseNewMultiArrayExpr(this); + public V accept(@Nonnull V v) { v.caseNewMultiArrayExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java index 8f5f9d31526..10dd8b57b61 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java @@ -40,8 +40,8 @@ public String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseOrExpr(this); + public V accept(@Nonnull V v) { v.caseOrExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java index 59294a1b0f1..47b788e3944 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java @@ -195,7 +195,7 @@ public JPhiExpr withArgToBlockMap(@Nonnull Map> argToBlock) } @Override - public void accept(@Nonnull ExprVisitor v) { - v.casePhiExpr(this); + public V accept(@Nonnull V v) { v.casePhiExpr(this); + return v; } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java index 23998b875d1..901be33e5c7 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java @@ -40,8 +40,8 @@ public String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseRemExpr(this); + public V accept(@Nonnull V v) { v.caseRemExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java index 5d0e526045f..315da3cfbd4 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java @@ -44,8 +44,8 @@ public String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseShlExpr(this); + public V accept(@Nonnull V v) { v.caseShlExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java index 087a3af5233..1c77f79c173 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java @@ -44,8 +44,8 @@ public String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseShrExpr(this); + public V accept(@Nonnull V v) { v.caseShrExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java index 3bd417c76fe..84ad9d056df 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java @@ -75,8 +75,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseSpecialInvokeExpr(this); + public V accept(@Nonnull V v) { v.caseSpecialInvokeExpr(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java index 08e25e168d3..aa63507bf16 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java @@ -71,8 +71,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseStaticInvokeExpr(this); + public V accept(@Nonnull V v) { v.caseStaticInvokeExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java index a9cf646d427..0e5ed1605de 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseSubExpr(this); + public V accept(@Nonnull V v) { v.caseSubExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java index e6cc0fd1637..1f161aebd0d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java @@ -43,8 +43,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseUshrExpr(this); + public V accept(@Nonnull V v) { v.caseUshrExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java index e3ca02a382e..dfe9a807566 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java @@ -74,8 +74,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseVirtualInvokeExpr(this); + public V accept(@Nonnull V v) { v.caseVirtualInvokeExpr(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java index 1eb9cabcdf3..bc85a901625 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java @@ -40,8 +40,8 @@ public final String getSymbol() { } @Override - public void accept(@Nonnull ExprVisitor v) { - v.caseXorExpr(this); + public V accept(@Nonnull V v) { v.caseXorExpr(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java index abf88a1a0ca..9fdcec84b34 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java @@ -88,8 +88,10 @@ public Type getType() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseArrayRef(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java index 451117609b9..977cb11edbe 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java @@ -72,7 +72,9 @@ public Type getType() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseCaughtExceptionRef(this); + return v; } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java index 3baddca3f98..692ff671d46 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java @@ -73,9 +73,10 @@ public Stream getUses() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseInstanceFieldRef(this); - } + return v;} @Override public boolean equivTo(Object o, @Nonnull JimpleComparator comparator) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java index 207eac8fe6c..4ad1e622483 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java @@ -91,9 +91,10 @@ public Type getType() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseParameterRef(this); - } + return v;} @Nonnull public JParameterRef withParamType(@Nonnull Type paramType) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java index 088ad9b9336..92a873ca6c8 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java @@ -64,8 +64,10 @@ public int equivHashCode() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseStaticFieldRef(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java index 0c20ce9ace5..63eee034c3e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java @@ -72,8 +72,10 @@ public Type getType() { } @Override - public void accept(@Nonnull RefVisitor v) { + public V accept(@Nonnull V v) { + v.caseThisRef(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java index fb9f54c19ab..3622b247f9c 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java @@ -225,8 +225,9 @@ public void toString(@Nonnull StmtPrinter up) { * @see de.upb.sootup.jimple.common.stmt.AbstractStmt#accept(de.upb.sootup.jimple.visitor.Visitor) */ @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseAssignStmt(this); + public V accept(@Nonnull V v) { + v.caseAssignStmt(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java index 335e938b732..e40e13d6529 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java @@ -64,9 +64,9 @@ public int getExpectedSuccessorCount() { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseGotoStmt(this); - } + public V accept(@Nonnull V v) { + v.caseGotoStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIdentityStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIdentityStmt.java index 440b2cf27be..b3a7ad13246 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIdentityStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIdentityStmt.java @@ -78,8 +78,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseIdentityStmt(this); + public V accept(@Nonnull V v) { + v.caseIdentityStmt(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java index e86f9b874c3..2a56102231a 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java @@ -92,9 +92,9 @@ public Stream getUses() { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseIfStmt(this); - } + public V accept(@Nonnull V v) { + v.caseIfStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JInvokeStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JInvokeStmt.java index 2d5316701e3..ca6d6bbb3e5 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JInvokeStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JInvokeStmt.java @@ -76,8 +76,9 @@ public Stream getUses() { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseInvokeStmt(this); + public V accept(@Nonnull V v) { + v.caseInvokeStmt(this); + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java index 4b71e27e10c..818e9554de4 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java @@ -47,9 +47,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseNopStmt(this); - } + public V accept(@Nonnull V v) { + v.caseNopStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java index 10993c266c1..11c11930519 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java @@ -55,9 +55,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseReturnStmt(this); - } + public V accept(@Nonnull V v) { + v.caseReturnStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java index 498d73985a6..13385ef2028 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java @@ -47,9 +47,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseReturnVoidStmt(this); - } + public V accept(@Nonnull V v) { + v.caseReturnVoidStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java index eedf3465072..2742461072b 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java @@ -55,9 +55,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseThrowStmt(this); - } + public V accept(@Nonnull V v) { + v.caseThrowStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java index 78b217bda81..c024c8a5b48 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java @@ -48,9 +48,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseBreakpointStmt(this); - } + public V accept(@Nonnull V v) { + v.caseBreakpointStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java index c7650aab4fc..610ba4cd37e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java @@ -57,9 +57,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseEnterMonitorStmt(this); - } + public V accept(@Nonnull V v) { + v.caseEnterMonitorStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java index 23ff98b6fb5..0a3c9309e09 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java @@ -57,9 +57,9 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseExitMonitorStmt(this); - } + public V accept(@Nonnull V v) { + v.caseExitMonitorStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java index 3a70f99745c..be154674b5c 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java @@ -70,9 +70,9 @@ public Stream getUses() { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseRetStmt(this); - } + public V accept(@Nonnull V v) { + v.caseRetStmt(this); + return v;} @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java index 6c1ab8a13d7..0d67cc61169 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java @@ -108,9 +108,9 @@ public boolean branches() { } @Override - public void accept(@Nonnull StmtVisitor sw) { - sw.caseSwitchStmt(this); - } + public V accept(@Nonnull V v) { + v.caseSwitchStmt(this); + return v;} /** Amount of labels +1 for default handler */ public int getValueCount() { diff --git a/sootup.core/src/main/java/sootup/core/types/ArrayType.java b/sootup.core/src/main/java/sootup/core/types/ArrayType.java index f4ccbb42679..e9f382fe10c 100644 --- a/sootup.core/src/main/java/sootup/core/types/ArrayType.java +++ b/sootup.core/src/main/java/sootup/core/types/ArrayType.java @@ -96,7 +96,7 @@ public Type getElementType() { } @Override - public TypeVisitor accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseArrayType(); return v; } diff --git a/sootup.core/src/main/java/sootup/core/types/NullType.java b/sootup.core/src/main/java/sootup/core/types/NullType.java index cb35f43b831..5226ebc05af 100644 --- a/sootup.core/src/main/java/sootup/core/types/NullType.java +++ b/sootup.core/src/main/java/sootup/core/types/NullType.java @@ -44,7 +44,8 @@ public String toString() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseNullType(); + return v; } } diff --git a/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java b/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java index d782ddce509..e52d446dd6c 100644 --- a/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java +++ b/sootup.core/src/main/java/sootup/core/types/PrimitiveType.java @@ -108,8 +108,9 @@ public static ByteType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseByteType(); + return v; } } @@ -125,8 +126,9 @@ public static ShortType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseShortType(); + return v; } } @@ -164,8 +166,9 @@ public static DoubleType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseDoubleType(); + return v; } } @@ -181,8 +184,9 @@ public static LongType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseLongType(); + return v; } } @@ -198,8 +202,9 @@ public static FloatType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseFloatType(); + return v; } } @@ -215,8 +220,9 @@ public static CharType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseCharType(); + return v; } } @@ -236,8 +242,9 @@ public static BooleanType getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseBooleanType(); + return v; } } } diff --git a/sootup.core/src/main/java/sootup/core/types/UnknownType.java b/sootup.core/src/main/java/sootup/core/types/UnknownType.java index d10e7ecc0cf..ad8f62c5bd6 100644 --- a/sootup.core/src/main/java/sootup/core/types/UnknownType.java +++ b/sootup.core/src/main/java/sootup/core/types/UnknownType.java @@ -48,7 +48,8 @@ public String toString() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseUnknownType(); + return v; } } diff --git a/sootup.core/src/main/java/sootup/core/types/VoidType.java b/sootup.core/src/main/java/sootup/core/types/VoidType.java index ac064589a47..8fe72f68e7c 100644 --- a/sootup.core/src/main/java/sootup/core/types/VoidType.java +++ b/sootup.core/src/main/java/sootup/core/types/VoidType.java @@ -44,7 +44,8 @@ public String toString() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { v.caseVoidType(); + return v; } } diff --git a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/AugmentIntegerTypes.java b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/AugmentIntegerTypes.java index 312b31b7ba7..33f8a38a770 100644 --- a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/AugmentIntegerTypes.java +++ b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/AugmentIntegerTypes.java @@ -59,7 +59,7 @@ public static Integer1Type getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { throw new UnsupportedOperationException(); } } @@ -78,7 +78,7 @@ public static Integer127Type getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { throw new UnsupportedOperationException(); } } @@ -97,7 +97,7 @@ public static Integer32767Type getInstance() { } @Override - public void accept(@Nonnull TypeVisitor v) { + public V accept(@Nonnull V v) { throw new UnsupportedOperationException(); } } diff --git a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/BottomType.java b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/BottomType.java index 900ffd760bc..123fae55021 100644 --- a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/BottomType.java +++ b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/BottomType.java @@ -42,8 +42,8 @@ public static BottomType getInstance() { private BottomType() {} @Override - public void accept(@Nonnull TypeVisitor v) { - v.defaultCaseType(); + public V accept(@Nonnull V v) { + throw new UnsupportedOperationException(); } @Override diff --git a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/TopType.java b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/TopType.java index 6232abba809..ebbba740ed2 100644 --- a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/TopType.java +++ b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/TopType.java @@ -49,8 +49,11 @@ public static TopType getInstance() { private TopType() {} @Override - public void accept(@Nonnull TypeVisitor typeVisitor) { - typeVisitor.defaultCaseType(); + public V accept(@Nonnull V typeVisitor) { + /*typeVisitor.defaultCaseType(); + return typeVisitor; + */ + throw new UnsupportedOperationException(); } @Override diff --git a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/WeakObjectType.java b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/WeakObjectType.java index 71502ceb533..2b197152b36 100644 --- a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/WeakObjectType.java +++ b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/types/WeakObjectType.java @@ -48,7 +48,7 @@ public WeakObjectType(String className, PackageName packageName) { } @Override - public void accept(@Nonnull TypeVisitor v) { - // todo: weak objects type case + public V accept(@Nonnull V v) { + throw new UnsupportedOperationException(); } } From 9e23c9d814d3abe7f21c6725354cb0f6577a6a73 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Mon, 5 Aug 2024 13:37:20 +0200 Subject: [PATCH 3/5] cleanup - remove AbstractVisitor which was forcing sometimes unnecessary api/casting/autoboxing for the sake of not having an already existing getter/setter --- .../InstantiateClassValueVisitor.java | 12 +++++- .../core/jimple/basic/LocalGenerator.java | 11 ++++- .../common/constant/BooleanConstant.java | 6 +-- .../jimple/common/constant/ClassConstant.java | 7 ++-- .../common/constant/DoubleConstant.java | 7 ++-- .../jimple/common/constant/EnumConstant.java | 7 ++-- .../jimple/common/constant/FloatConstant.java | 7 ++-- .../jimple/common/constant/IntConstant.java | 7 ++-- .../jimple/common/constant/LongConstant.java | 7 ++-- .../jimple/common/constant/MethodHandle.java | 4 +- .../jimple/common/constant/MethodType.java | 7 ++-- .../jimple/common/constant/NullConstant.java | 7 ++-- .../common/constant/StringConstant.java | 7 ++-- .../core/jimple/common/expr/JAddExpr.java | 3 +- .../core/jimple/common/expr/JAndExpr.java | 3 +- .../core/jimple/common/expr/JCmpExpr.java | 3 +- .../core/jimple/common/expr/JCmpgExpr.java | 3 +- .../core/jimple/common/expr/JCmplExpr.java | 3 +- .../core/jimple/common/expr/JDivExpr.java | 3 +- .../common/expr/JDynamicInvokeExpr.java | 3 +- .../core/jimple/common/expr/JEqExpr.java | 3 +- .../core/jimple/common/expr/JGeExpr.java | 3 +- .../core/jimple/common/expr/JGtExpr.java | 3 +- .../jimple/common/expr/JInstanceOfExpr.java | 3 +- .../common/expr/JInterfaceInvokeExpr.java | 3 +- .../core/jimple/common/expr/JLeExpr.java | 3 +- .../core/jimple/common/expr/JLengthExpr.java | 3 +- .../core/jimple/common/expr/JLtExpr.java | 3 +- .../core/jimple/common/expr/JMulExpr.java | 3 +- .../core/jimple/common/expr/JNeExpr.java | 3 +- .../core/jimple/common/expr/JNegExpr.java | 3 +- .../jimple/common/expr/JNewArrayExpr.java | 3 +- .../core/jimple/common/expr/JNewExpr.java | 3 +- .../common/expr/JNewMultiArrayExpr.java | 3 +- .../core/jimple/common/expr/JOrExpr.java | 3 +- .../core/jimple/common/expr/JPhiExpr.java | 3 +- .../core/jimple/common/expr/JRemExpr.java | 3 +- .../core/jimple/common/expr/JShlExpr.java | 3 +- .../core/jimple/common/expr/JShrExpr.java | 3 +- .../common/expr/JSpecialInvokeExpr.java | 3 +- .../jimple/common/expr/JStaticInvokeExpr.java | 3 +- .../core/jimple/common/expr/JSubExpr.java | 3 +- .../core/jimple/common/expr/JUshrExpr.java | 3 +- .../common/expr/JVirtualInvokeExpr.java | 3 +- .../core/jimple/common/expr/JXorExpr.java | 3 +- .../core/jimple/common/ref/JArrayRef.java | 4 +- .../common/ref/JCaughtExceptionRef.java | 4 +- .../jimple/common/ref/JInstanceFieldRef.java | 5 ++- .../core/jimple/common/ref/JParameterRef.java | 5 ++- .../jimple/common/ref/JStaticFieldRef.java | 2 +- .../core/jimple/common/ref/JThisRef.java | 2 +- .../core/jimple/common/stmt/JAssignStmt.java | 2 +- .../core/jimple/common/stmt/JGotoStmt.java | 3 +- .../core/jimple/common/stmt/JIfStmt.java | 3 +- .../core/jimple/common/stmt/JNopStmt.java | 3 +- .../core/jimple/common/stmt/JReturnStmt.java | 3 +- .../jimple/common/stmt/JReturnVoidStmt.java | 3 +- .../core/jimple/common/stmt/JThrowStmt.java | 3 +- .../javabytecode/stmt/JBreakpointStmt.java | 3 +- .../javabytecode/stmt/JEnterMonitorStmt.java | 3 +- .../javabytecode/stmt/JExitMonitorStmt.java | 3 +- .../jimple/javabytecode/stmt/JRetStmt.java | 3 +- .../jimple/javabytecode/stmt/JSwitchStmt.java | 3 +- .../visitor/AbstractConstantVisitor.java | 2 +- .../jimple/visitor/AbstractExprVisitor.java | 2 +- .../visitor/AbstractImmediateVisitor.java | 3 +- .../jimple/visitor/AbstractRefVisitor.java | 2 +- .../jimple/visitor/AbstractStmtVisitor.java | 2 +- .../jimple/visitor/AbstractTypeVisitor.java | 2 +- .../jimple/visitor/AbstractValueVisitor.java | 2 +- .../core/jimple/visitor/AbstractVisitor.java | 42 ------------------- .../jimple/visitor/ReplaceUseExprVisitor.java | 15 +++++-- .../jimple/visitor/ReplaceUseRefVisitor.java | 15 +++++-- .../jimple/visitor/ReplaceUseStmtVisitor.java | 15 +++++-- .../typeresolving/TypeChecker.java | 11 ++++- .../qilin/core/builder/MethodNodeFactory.java | 12 +++++- 76 files changed, 225 insertions(+), 149 deletions(-) delete mode 100644 sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractVisitor.java diff --git a/sootup.callgraph/src/main/java/sootup/callgraph/InstantiateClassValueVisitor.java b/sootup.callgraph/src/main/java/sootup/callgraph/InstantiateClassValueVisitor.java index fe22740579b..4ea7796b228 100644 --- a/sootup.callgraph/src/main/java/sootup/callgraph/InstantiateClassValueVisitor.java +++ b/sootup.callgraph/src/main/java/sootup/callgraph/InstantiateClassValueVisitor.java @@ -31,7 +31,17 @@ import sootup.core.types.ClassType; import sootup.core.types.Type; -public class InstantiateClassValueVisitor extends AbstractValueVisitor { +public class InstantiateClassValueVisitor extends AbstractValueVisitor { + + protected ClassType result = null; + + public ClassType getResult() { + return result; + } + + protected void setResult(ClassType result) { + this.result = result; + } public void init() { setResult(null); diff --git a/sootup.core/src/main/java/sootup/core/jimple/basic/LocalGenerator.java b/sootup.core/src/main/java/sootup/core/jimple/basic/LocalGenerator.java index e68d13f2027..46ed645d372 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/basic/LocalGenerator.java +++ b/sootup.core/src/main/java/sootup/core/jimple/basic/LocalGenerator.java @@ -83,7 +83,8 @@ public Local generateParameterLocal(@Nonnull Type type, int index) { return this.parameterLocals.get(index); } - private static class NamingSwitch extends AbstractTypeVisitor { + private static class NamingSwitch extends AbstractTypeVisitor { + protected StringBuilder result = null; private int tempInt = 0; private int tempBoolean = 0; private int tempLong = 0; @@ -171,6 +172,14 @@ public void caseUnknownType() { public void defaultCaseType() { throw new IllegalStateException("Unhandled Type of Local variable to Generate!"); } + + public StringBuilder getResult() { + return result; + } + + protected void setResult(StringBuilder result) { + this.result = result; + } } /** Return all locals created for the body referenced in this LocalGenrator. */ diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java index de247a5fc11..5aa35cb4646 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/BooleanConstant.java @@ -74,9 +74,9 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseBooleanConstant(this); - return v; + public V accept(@Nonnull V v) { + v.caseBooleanConstant(this); + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java index 634a5d251d6..d1916df2c95 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/ClassConstant.java @@ -178,9 +178,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseClassConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseClassConstant(this); + return v; + } @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java index 5249fbb9bfe..74ff0a4632b 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/DoubleConstant.java @@ -177,9 +177,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseDoubleConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseDoubleConstant(this); + return v; + } /** * Checks if passed argument is instance of expected class. diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java index abd31047057..d5e17a9696e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/EnumConstant.java @@ -64,9 +64,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseEnumConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseEnumConstant(this); + return v; + } @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java index b7344bc8a90..6eacf1f2691 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/FloatConstant.java @@ -170,9 +170,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseFloatConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseFloatConstant(this); + return v; + } public float getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java index e348e0de25e..30c93e07833 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/IntConstant.java @@ -171,9 +171,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseIntConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseIntConstant(this); + return v; + } public int getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java index 690fb172702..83e289545b2 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/LongConstant.java @@ -183,9 +183,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseLongConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseLongConstant(this); + return v; + } public long getValue() { return value; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java index 1367847c3ff..a0d499a6ced 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodHandle.java @@ -157,8 +157,8 @@ public SootClassMemberSignature getRefere } @Override - public V accept(@Nonnull V v) { - v.caseMethodHandle(this); + public V accept(@Nonnull V v) { + v.caseMethodHandle(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java index 706152491d7..9e6ccd5c7c0 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/MethodType.java @@ -81,7 +81,8 @@ public boolean equals(Object obj) { } @Override - public V accept(@Nonnull V v) { - v.caseMethodType(this); - return v;} + public V accept(@Nonnull V v) { + v.caseMethodType(this); + return v; + } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java index c89f4296d40..88849db200b 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/NullConstant.java @@ -55,9 +55,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseNullConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseNullConstant(this); + return v; + } @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java b/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java index 6e530e5e18d..5faefe516b7 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/constant/StringConstant.java @@ -56,9 +56,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { - v.caseStringConstant(this); - return v;} + public V accept(@Nonnull V v) { + v.caseStringConstant(this); + return v; + } @Override public String toString() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java index 05c6973d989..dfe830d9f12 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAddExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseAddExpr(this); + public V accept(@Nonnull V v) { + v.caseAddExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java index e9f4d6a9cf7..4c45796ae04 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JAndExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseAndExpr(this); + public V accept(@Nonnull V v) { + v.caseAndExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java index 43f8fceb40f..929e99dfbce 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseCmpExpr(this); + public V accept(@Nonnull V v) { + v.caseCmpExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java index 6816075325d..aedfcaab18f 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmpgExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseCmpgExpr(this); + public V accept(@Nonnull V v) { + v.caseCmpgExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java index c8957ed552e..60d8fbf4c59 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JCmplExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseCmplExpr(this); + public V accept(@Nonnull V v) { + v.caseCmplExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java index 580df385965..730400cb22a 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDivExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseDivExpr(this); + public V accept(@Nonnull V v) { + v.caseDivExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java index c2060328bcb..b04e658556b 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JDynamicInvokeExpr.java @@ -171,7 +171,8 @@ private String getNamelessSubSig(MethodSubSignature mSubSig) { } @Override - public V accept(@Nonnull V v) { v.caseDynamicInvokeExpr(this); + public V accept(@Nonnull V v) { + v.caseDynamicInvokeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java index 201db48bc41..fff5621eae3 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JEqExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseEqExpr(this); + public V accept(@Nonnull V v) { + v.caseEqExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java index ef915c9a006..ebf2b327234 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGeExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseGeExpr(this); + public V accept(@Nonnull V v) { + v.caseGeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java index 347011300ae..3561f08c91d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JGtExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseGtExpr(this); + public V accept(@Nonnull V v) { + v.caseGtExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java index 286173f01e9..1363f927611 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInstanceOfExpr.java @@ -91,7 +91,8 @@ public Type getCheckType() { } @Override - public V accept(@Nonnull V v) { v.caseInstanceOfExpr(this); + public V accept(@Nonnull V v) { + v.caseInstanceOfExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java index f0e0b458a04..6af4f206a9b 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JInterfaceInvokeExpr.java @@ -96,7 +96,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public V accept(@Nonnull V v) { v.caseInterfaceInvokeExpr(this); + public V accept(@Nonnull V v) { + v.caseInterfaceInvokeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java index ed11d8ef4ee..57bacb265a3 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLeExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseLeExpr(this); + public V accept(@Nonnull V v) { + v.caseLeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java index 2ac30baf6a2..b88ee261215 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLengthExpr.java @@ -67,7 +67,8 @@ public PrimitiveType getType() { } @Override - public V accept(@Nonnull V v) { v.caseLengthExpr(this); + public V accept(@Nonnull V v) { + v.caseLengthExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java index 0391244ed76..68179029449 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JLtExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseLtExpr(this); + public V accept(@Nonnull V v) { + v.caseLtExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java index d812aaa38d0..c0f6c8cf162 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JMulExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseMulExpr(this); + public V accept(@Nonnull V v) { + v.caseMulExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java index d1465e558c1..83144ecdfdc 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNeExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseNeExpr(this); + public V accept(@Nonnull V v) { + v.caseNeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java index 2d4a957ecb3..0e954348285 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNegExpr.java @@ -87,7 +87,8 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { v.caseNegExpr(this); + public V accept(@Nonnull V v) { + v.caseNegExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java index 9f77167cd85..7156498e265 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewArrayExpr.java @@ -119,7 +119,8 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { v.caseNewArrayExpr(this); + public V accept(@Nonnull V v) { + v.caseNewArrayExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java index f1dc37a19e6..e615ade33c1 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewExpr.java @@ -76,7 +76,8 @@ public Stream getUses() { } @Override - public V accept(@Nonnull V v) { v.caseNewExpr(this); + public V accept(@Nonnull V v) { + v.caseNewExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java index f251733d5dc..b3eb8cc066e 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JNewMultiArrayExpr.java @@ -130,7 +130,8 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { v.caseNewMultiArrayExpr(this); + public V accept(@Nonnull V v) { + v.caseNewMultiArrayExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java index 10dd8b57b61..eff8f6fc1cd 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JOrExpr.java @@ -40,7 +40,8 @@ public String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseOrExpr(this); + public V accept(@Nonnull V v) { + v.caseOrExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java index 47b788e3944..b24a0d89caa 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JPhiExpr.java @@ -195,7 +195,8 @@ public JPhiExpr withArgToBlockMap(@Nonnull Map> argToBlock) } @Override - public V accept(@Nonnull V v) { v.casePhiExpr(this); + public V accept(@Nonnull V v) { + v.casePhiExpr(this); return v; } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java index 901be33e5c7..7256522560d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JRemExpr.java @@ -40,7 +40,8 @@ public String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseRemExpr(this); + public V accept(@Nonnull V v) { + v.caseRemExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java index 315da3cfbd4..b52f453e8a8 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShlExpr.java @@ -44,7 +44,8 @@ public String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseShlExpr(this); + public V accept(@Nonnull V v) { + v.caseShlExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java index 1c77f79c173..27d694982ab 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JShrExpr.java @@ -44,7 +44,8 @@ public String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseShrExpr(this); + public V accept(@Nonnull V v) { + v.caseShrExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java index 84ad9d056df..c56612c86ec 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSpecialInvokeExpr.java @@ -75,7 +75,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public V accept(@Nonnull V v) { v.caseSpecialInvokeExpr(this); + public V accept(@Nonnull V v) { + v.caseSpecialInvokeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java index aa63507bf16..4b1e853471a 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JStaticInvokeExpr.java @@ -71,7 +71,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public V accept(@Nonnull V v) { v.caseStaticInvokeExpr(this); + public V accept(@Nonnull V v) { + v.caseStaticInvokeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java index 0e5ed1605de..4894cd2a0ef 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JSubExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseSubExpr(this); + public V accept(@Nonnull V v) { + v.caseSubExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java index 1f161aebd0d..2da7b1ed993 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JUshrExpr.java @@ -43,7 +43,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseUshrExpr(this); + public V accept(@Nonnull V v) { + v.caseUshrExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java index dfe9a807566..cf583ab7162 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JVirtualInvokeExpr.java @@ -74,7 +74,8 @@ public void toString(@Nonnull StmtPrinter up) { } @Override - public V accept(@Nonnull V v) { v.caseVirtualInvokeExpr(this); + public V accept(@Nonnull V v) { + v.caseVirtualInvokeExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java index bc85a901625..6d1ce97d1d3 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/expr/JXorExpr.java @@ -40,7 +40,8 @@ public final String getSymbol() { } @Override - public V accept(@Nonnull V v) { v.caseXorExpr(this); + public V accept(@Nonnull V v) { + v.caseXorExpr(this); return v; } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java index 9fdcec84b34..6fc6943ba71 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JArrayRef.java @@ -88,10 +88,10 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseArrayRef(this); - return v; + return v; } @Nonnull diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java index 977cb11edbe..56b0d85db6c 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JCaughtExceptionRef.java @@ -72,9 +72,9 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseCaughtExceptionRef(this); - return v; + return v; } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java index 692ff671d46..c05e91dd4bf 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JInstanceFieldRef.java @@ -73,10 +73,11 @@ public Stream getUses() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseInstanceFieldRef(this); - return v;} + return v; + } @Override public boolean equivTo(Object o, @Nonnull JimpleComparator comparator) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java index 4ad1e622483..8cffce0a90c 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JParameterRef.java @@ -91,10 +91,11 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseParameterRef(this); - return v;} + return v; + } @Nonnull public JParameterRef withParamType(@Nonnull Type paramType) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java index 92a873ca6c8..61a9699e5bf 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JStaticFieldRef.java @@ -64,7 +64,7 @@ public int equivHashCode() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseStaticFieldRef(this); return v; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java index 63eee034c3e..4a7aa73c641 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/ref/JThisRef.java @@ -72,7 +72,7 @@ public Type getType() { } @Override - public V accept(@Nonnull V v) { + public V accept(@Nonnull V v) { v.caseThisRef(this); return v; diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java index 3622b247f9c..d36564914b3 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JAssignStmt.java @@ -227,7 +227,7 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseAssignStmt(this); - return v; + return v; } @Override diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java index e40e13d6529..e34d3d56ec8 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JGotoStmt.java @@ -66,7 +66,8 @@ public int getExpectedSuccessorCount() { @Override public V accept(@Nonnull V v) { v.caseGotoStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java index 2a56102231a..acdbe23670c 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JIfStmt.java @@ -94,7 +94,8 @@ public Stream getUses() { @Override public V accept(@Nonnull V v) { v.caseIfStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java index 818e9554de4..ca1b0372c4d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JNopStmt.java @@ -49,7 +49,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseNopStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java index 11c11930519..1df4723bffd 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnStmt.java @@ -57,7 +57,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseReturnStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java index 13385ef2028..c07e51bccdd 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JReturnVoidStmt.java @@ -49,7 +49,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseReturnVoidStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java index 2742461072b..4b39a268d03 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/common/stmt/JThrowStmt.java @@ -57,7 +57,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseThrowStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java index c024c8a5b48..300fa0ad2d6 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JBreakpointStmt.java @@ -50,7 +50,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseBreakpointStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java index 610ba4cd37e..fd4c6f21a48 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JEnterMonitorStmt.java @@ -59,7 +59,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseEnterMonitorStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java index 0a3c9309e09..811a798a832 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JExitMonitorStmt.java @@ -59,7 +59,8 @@ public void toString(@Nonnull StmtPrinter up) { @Override public V accept(@Nonnull V v) { v.caseExitMonitorStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java index be154674b5c..21918558ef7 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JRetStmt.java @@ -72,7 +72,8 @@ public Stream getUses() { @Override public V accept(@Nonnull V v) { v.caseRetStmt(this); - return v;} + return v; + } @Override public boolean fallsThrough() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java index 0d67cc61169..f1e49192221 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java +++ b/sootup.core/src/main/java/sootup/core/jimple/javabytecode/stmt/JSwitchStmt.java @@ -110,7 +110,8 @@ public boolean branches() { @Override public V accept(@Nonnull V v) { v.caseSwitchStmt(this); - return v;} + return v; + } /** Amount of labels +1 for default handler */ public int getValueCount() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractConstantVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractConstantVisitor.java index 04b8b945149..862569246bf 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractConstantVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractConstantVisitor.java @@ -25,7 +25,7 @@ import javax.annotation.Nonnull; import sootup.core.jimple.common.constant.*; -public class AbstractConstantVisitor extends AbstractVisitor implements ConstantVisitor { +public class AbstractConstantVisitor implements ConstantVisitor, Visitor { @Override public void caseBooleanConstant(@Nonnull BooleanConstant constant) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractExprVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractExprVisitor.java index 847b2c3bd2f..5f974583e24 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractExprVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractExprVisitor.java @@ -25,7 +25,7 @@ import javax.annotation.Nonnull; import sootup.core.jimple.common.expr.*; -public abstract class AbstractExprVisitor extends AbstractVisitor implements ExprVisitor { +public abstract class AbstractExprVisitor implements ExprVisitor, Visitor { @Override public void caseAddExpr(@Nonnull JAddExpr expr) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractImmediateVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractImmediateVisitor.java index f9721e13a57..6b3bfef273d 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractImmediateVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractImmediateVisitor.java @@ -27,8 +27,7 @@ import sootup.core.jimple.basic.Local; import sootup.core.jimple.common.constant.Constant; -public class AbstractImmediateVisitor extends AbstractConstantVisitor - implements ImmediateVisitor { +public class AbstractImmediateVisitor extends AbstractConstantVisitor implements ImmediateVisitor { @Override public void caseLocal(@Nonnull Local local) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractRefVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractRefVisitor.java index 2f01eed1701..aff940a4773 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractRefVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractRefVisitor.java @@ -25,7 +25,7 @@ import javax.annotation.Nonnull; import sootup.core.jimple.common.ref.*; -public abstract class AbstractRefVisitor extends AbstractVisitor implements RefVisitor { +public abstract class AbstractRefVisitor implements RefVisitor, Visitor { @Override public void caseStaticFieldRef(@Nonnull JStaticFieldRef ref) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractStmtVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractStmtVisitor.java index 2390bbace15..9ad36166468 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractStmtVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractStmtVisitor.java @@ -26,7 +26,7 @@ import sootup.core.jimple.common.stmt.*; import sootup.core.jimple.javabytecode.stmt.*; -public abstract class AbstractStmtVisitor extends AbstractVisitor implements StmtVisitor { +public abstract class AbstractStmtVisitor implements StmtVisitor, Visitor { @Override public void caseBreakpointStmt(@Nonnull JBreakpointStmt stmt) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractTypeVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractTypeVisitor.java index d646e6d0cc9..e16e37fc181 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractTypeVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractTypeVisitor.java @@ -26,7 +26,7 @@ import sootup.core.types.*; /** @author Markus Schmidt */ -public abstract class AbstractTypeVisitor extends AbstractVisitor implements TypeVisitor { +public abstract class AbstractTypeVisitor implements TypeVisitor, Visitor { @Override public void caseBooleanType() { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractValueVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractValueVisitor.java index bc9fcf6477f..c4f3e7c2f31 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractValueVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractValueVisitor.java @@ -30,7 +30,7 @@ import sootup.core.jimple.common.ref.*; /** @author Markus Schmidt */ -public abstract class AbstractValueVisitor extends AbstractVisitor implements ValueVisitor { +public abstract class AbstractValueVisitor implements ValueVisitor, Visitor { @Override public void caseBooleanConstant(@Nonnull BooleanConstant constant) { diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractVisitor.java deleted file mode 100644 index 12de0b5dda1..00000000000 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/AbstractVisitor.java +++ /dev/null @@ -1,42 +0,0 @@ -package sootup.core.jimple.visitor; - -/*- - * #%L - * SootUp - * %% - * Copyright (C) 1997 - 2024 Raja Vallée-Rai and others - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 2.1 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * #L% - */ - -/** - * Base class for retrieving a calculated result from the implemented Visitor (which is basically a - * switch via OOP) - * - * @author Markus Schmidt - */ -public abstract class AbstractVisitor implements Visitor { - - protected V result = null; - - public V getResult() { - return result; - } - - protected void setResult(V result) { - this.result = result; - } -} diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseExprVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseExprVisitor.java index 175a2b834c8..d0f3a043fc2 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseExprVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseExprVisitor.java @@ -39,10 +39,11 @@ * * @author Zun Wang */ -public class ReplaceUseExprVisitor extends AbstractExprVisitor { +public class ReplaceUseExprVisitor extends AbstractExprVisitor { - private Value oldUse; - private Value newUse; + protected Value oldUse; + protected Value newUse; + protected Expr result = null; // TODO: [ms] is this (phiBlock) really a necessary field? BasicBlock phiBlock = null; @@ -528,4 +529,12 @@ public void defaultCaseExpr(@Nonnull Expr expr) { public void errorHandler(@Nonnull Expr expr) { defaultCaseExpr(expr); } + + public Expr getResult() { + return result; + } + + protected void setResult(Expr result) { + this.result = result; + } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseRefVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseRefVisitor.java index ed1365334a2..7354258b285 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseRefVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseRefVisitor.java @@ -35,10 +35,11 @@ * * @author Zun Wang */ -public class ReplaceUseRefVisitor extends AbstractRefVisitor { +public class ReplaceUseRefVisitor extends AbstractRefVisitor { - private Value oldUse; - private Value newUse; + protected Value oldUse; + protected Value newUse; + protected Ref result = null; public ReplaceUseRefVisitor() {} @@ -71,4 +72,12 @@ public void caseArrayRef(@Nonnull JArrayRef ref) { public void defaultCaseRef(@Nonnull Ref ref) { setResult(ref); } + + public Ref getResult() { + return result; + } + + protected void setResult(Ref result) { + this.result = result; + } } diff --git a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseStmtVisitor.java b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseStmtVisitor.java index c68e5921aef..a3e9ad13d09 100644 --- a/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseStmtVisitor.java +++ b/sootup.core/src/main/java/sootup/core/jimple/visitor/ReplaceUseStmtVisitor.java @@ -38,13 +38,14 @@ * * @author Zun Wang */ -public class ReplaceUseStmtVisitor extends AbstractStmtVisitor { +public class ReplaceUseStmtVisitor extends AbstractStmtVisitor { - @Nonnull private final Value oldUse; - @Nonnull private final Value newUse; + @Nonnull protected final Value oldUse; + @Nonnull protected final Value newUse; final ReplaceUseExprVisitor exprVisitor = new ReplaceUseExprVisitor(); final ReplaceUseRefVisitor refVisitor = new ReplaceUseRefVisitor(); + protected Stmt result = null; public ReplaceUseStmtVisitor(@Nonnull Value oldUse, @Nonnull Value newUse) { this.oldUse = oldUse; @@ -196,4 +197,12 @@ public void caseThrowStmt(@Nonnull JThrowStmt stmt) { public void defaultCaseStmt(@Nonnull Stmt stmt) { setResult(stmt); } + + public Stmt getResult() { + return result; + } + + protected void setResult(Stmt result) { + this.result = result; + } } diff --git a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/TypeChecker.java b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/TypeChecker.java index bde15e23c16..03063c08684 100644 --- a/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/TypeChecker.java +++ b/sootup.java.core/src/main/java/sootup/java/core/interceptors/typeresolving/TypeChecker.java @@ -49,10 +49,11 @@ import sootup.core.types.PrimitiveType; import sootup.core.types.Type; -public abstract class TypeChecker extends AbstractStmtVisitor { +public abstract class TypeChecker extends AbstractStmtVisitor { private final AugEvalFunction evalFunction; private final BytecodeHierarchy hierarchy; + protected Stmt result = null; private Typing typing; protected final Body.BodyBuilder builder; @@ -349,4 +350,12 @@ public Type selectArrayType(@Nullable Type preType, @Nonnull Type newType, @Nonn + sel); return sel; } + + public Stmt getResult() { + return result; + } + + protected void setResult(Stmt result) { + this.result = result; + } } diff --git a/sootup.qilin/src/main/java/qilin/core/builder/MethodNodeFactory.java b/sootup.qilin/src/main/java/qilin/core/builder/MethodNodeFactory.java index 2f4fd470d55..9287f60d5e0 100644 --- a/sootup.qilin/src/main/java/qilin/core/builder/MethodNodeFactory.java +++ b/sootup.qilin/src/main/java/qilin/core/builder/MethodNodeFactory.java @@ -180,7 +180,17 @@ private void resolveClinit(JStaticFieldRef staticFieldRef) { /** Adds the edges required for this statement to the graph. */ private void handleIntraStmt(Stmt s) { s.accept( - new AbstractStmtVisitor() { + new AbstractStmtVisitor() { + protected Object result = null; + + protected void setResult(Object result) { + this.result = result; + } + + public Object getResult() { + return result; + } + @Override public void caseAssignStmt(@Nonnull JAssignStmt stmt) { Value l = stmt.getLeftOp(); From 52755a0fad0d6953755e536efd26950a137bd275 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Mon, 5 Aug 2024 13:42:32 +0200 Subject: [PATCH 4/5] adapt new code as well --- .../main/java/sootup/codepropertygraph/ast/AstExprVisitor.java | 2 +- .../main/java/sootup/codepropertygraph/ast/AstStmtVisitor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstExprVisitor.java b/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstExprVisitor.java index f28061af593..0669fa3c233 100644 --- a/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstExprVisitor.java +++ b/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstExprVisitor.java @@ -31,7 +31,7 @@ import sootup.core.jimple.visitor.AbstractExprVisitor; /** Visitor for expressions in the AST. */ -class AstExprVisitor extends AbstractExprVisitor { +class AstExprVisitor extends AbstractExprVisitor { private final PropertyGraph.Builder graphBuilder; private final PropertyGraphNode parentNode; diff --git a/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstStmtVisitor.java b/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstStmtVisitor.java index 5096e8ea8e8..113e7e7e003 100644 --- a/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstStmtVisitor.java +++ b/sootup.codepropertygraph/src/main/java/sootup/codepropertygraph/ast/AstStmtVisitor.java @@ -39,7 +39,7 @@ import sootup.core.jimple.visitor.AbstractStmtVisitor; /** Visitor for statements in the AST. */ -class AstStmtVisitor extends AbstractStmtVisitor { +class AstStmtVisitor extends AbstractStmtVisitor { private final PropertyGraph.Builder graphBuilder; private final PropertyGraphNode parentNode; From 4420354b36192b05a8b552e0acc96e6383cdf3d9 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Mon, 5 Aug 2024 14:12:53 +0200 Subject: [PATCH 5/5] fix test leftover --- .../sootup/analysis/interprocedural/ifds/CGEdgeUtilTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sootup.analysis/src/test/java/sootup/analysis/interprocedural/ifds/CGEdgeUtilTest.java b/sootup.analysis/src/test/java/sootup/analysis/interprocedural/ifds/CGEdgeUtilTest.java index df115508df5..d475614fa74 100644 --- a/sootup.analysis/src/test/java/sootup/analysis/interprocedural/ifds/CGEdgeUtilTest.java +++ b/sootup.analysis/src/test/java/sootup/analysis/interprocedural/ifds/CGEdgeUtilTest.java @@ -122,7 +122,9 @@ public boolean equivTo(Object o, @Nonnull JimpleComparator comparator) { } @Override - public void accept(@Nonnull ExprVisitor exprVisitor) {} + public ExprVisitor accept(@Nonnull ExprVisitor exprVisitor) { + return exprVisitor; + } }; CGEdgeUtil.findCallGraphEdgeType(jNewInvoke); });