changeset 75:fc5234735b4b

visitTryCatch() must be called before visiting instructions in order to detect if a label is the start of an exception handler or not. Reviewed-by: Michael Starzinger
author forax
date Thu, 24 Mar 2011 18:54:03 +0100
parents 4ccee27bea05
children f25015b8ff8b
files src/main/java/org/icedrobot/daneel/dex/Code.java
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/icedrobot/daneel/dex/Code.java	Thu Mar 24 18:30:09 2011 +0100
+++ b/src/main/java/org/icedrobot/daneel/dex/Code.java	Thu Mar 24 18:54:03 2011 +0100
@@ -168,6 +168,13 @@
      */
     public void accept(DexMethodVisitor visitor) {
         visitor.visitCode(registersSize, insSize, outsSize);
+        
+        // Visit try-catch block information if available.
+        for (TryCatchInfo tryCatch : tryCatchInfos)
+            visitor.visitTryCatch(tryCatch.startLabel, tryCatch.endLabel,
+                    tryCatch.handlerLabel, tryCatch.type);
+        
+        // visit instructions
         acceptInsns(visitor);
 
         // Visit local variable information if available.
@@ -180,11 +187,6 @@
                 visitor.visitLocalVariable(name, desc, local.startLabel,
                         local.endLabel, local.regNum);
             }
-
-        // Visit try-catch block information if available.
-        for (TryCatchInfo tryCatch : tryCatchInfos)
-            visitor.visitTryCatch(tryCatch.startLabel, tryCatch.endLabel,
-                    tryCatch.handlerLabel, tryCatch.type);
     }
 
     /**