@@ -773,28 +773,31 @@ private void invokeImplMethod(
773
773
JimpleBody jb , PatchingChain <Unit > us , LocalGenerator lc , List <Local > args ) {
774
774
Value value = _invokeImplMethod (jb , us , lc , args );
775
775
776
- if (soot .VoidType .v ().equals (implMethod . getMethodRef () .getReturnType ())) {
776
+ if (soot .VoidType .v ().equals (implMethodType .getReturnType ())) {
777
777
// dispatch method is void
778
778
if (value instanceof InvokeExpr ) {
779
779
us .add (Jimple .v ().newInvokeStmt (value ));
780
780
}
781
781
782
+ us .add (Jimple .v ().newReturnVoidStmt ());
783
+
784
+ } else {
785
+
782
786
// Handle special case of a constructor method-ref. The dispatch method is void <init>(),
783
787
// but the created object should still be returned.
784
788
// See (src/systemTest/targets/soot/lambdaMetaFactory/Issue1367.java)
785
- if (! soot .VoidType .v ().equals (implMethodType .getReturnType ())) {
789
+ if (soot .VoidType .v ().equals (implMethod . getMethodRef () .getReturnType ())) {
786
790
us .add (Jimple .v ().newReturnStmt (value ));
787
791
} else {
788
- us .add (Jimple .v ().newReturnVoidStmt ());
789
- }
790
- } else {
791
- // neither is void, must pass through return value
792
- Local ret = lc .generateLocal (value .getType ());
793
- us .add (Jimple .v ().newAssignStmt (ret , value ));
794
792
795
- // adapt return value
796
- Local retAdapted = adapt (ret , implMethodType .getReturnType (), jb , us , lc );
797
- us .add (Jimple .v ().newReturnStmt (retAdapted ));
793
+ // neither is void, must pass through return value
794
+ Local ret = lc .generateLocal (value .getType ());
795
+ us .add (Jimple .v ().newAssignStmt (ret , value ));
796
+
797
+ // adapt return value
798
+ Local retAdapted = adapt (ret , implMethodType .getReturnType (), jb , us , lc );
799
+ us .add (Jimple .v ().newReturnStmt (retAdapted ));
800
+ }
798
801
}
799
802
}
800
803
0 commit comments