diff --git a/src/com/goldencode/p2j/util/BlockManager.java b/src/com/goldencode/p2j/util/BlockManager.java index c573855..5b2aaff 100644 --- a/src/com/goldencode/p2j/util/BlockManager.java +++ b/src/com/goldencode/p2j/util/BlockManager.java @@ -9413,32 +9413,30 @@ else if (rtype == ReturnType.NORMAL && wa.tm.getBlockType() == BlockType.FUNCTION) { // otherwise, check if this return can skip the exception throw - - Object thisProc = wa.pm._thisProcedure(); - String clsName = null; - if (thisProc instanceof _BaseObject_) + CalleeInfo calinfo = wa.pm.peekCalleeInfo(); + Class cls = calinfo != null ? calinfo.getExecuting() : null; + + if (cls == null) { - clsName = thisProc.getClass().getName(); - } - else if (thisProc.getClass() == Object.class) - { - // this case handles static OO method calls - for this, FWD uses a surrogate java.lang.Object - // instance to be used as THIS-PROCEDURE; THIS-PROCEDURE is how FWD internally identifies the - // context of the current call (and for static calls there is no 'instance', thus the - // java.lang.Object surrogate). - Class cls = ObjectOps.getStaticClass(thisProc); - clsName = cls.getName(); + Object thisProc = wa.pm._thisProcedure(); + + if (thisProc instanceof _BaseObject_) + { + cls = thisProc.getClass(); + } + else if (thisProc.getClass() == Object.class) + { + // this case handles static OO method calls - for this, FWD uses a surrogate java.lang.Object + // instance to be used as THIS-PROCEDURE; THIS-PROCEDURE is how FWD internally identifies the + // context of the current call (and for static calls there is no 'instance', thus the + // java.lang.Object surrogate). + cls = ObjectOps.getStaticClass(thisProc); + } } - // TODO: replace this test with cls.isAnnotation(LegacyResource.class) ? - if (clsName != null && clsName.startsWith("com.goldencode.p2j.oo")) + if (!cls.isAnnotationPresent(LegacyResource.class)) { - // WARNING: the p2o.oo code is not refactored to use 'storeReturnValue' or Java return statements - // instead, this code uses and expects for the returnNormal call to exit the block. - } - else - { - return; + return; } }