From d1f22a62b4a8f9031a4f338896c557eb516e2b18 Mon Sep 17 00:00:00 2001 From: hoenicke Date: Tue, 11 Jun 2002 08:40:31 +0000 Subject: [PATCH] Fix the exception handlers that Javac 1.4 produces. git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1369 379699f6-c40d-0410-875b-85095c16579e --- jode/ChangeLog | 9 ++++++++- jode/jode/bytecode/BytecodeInfo.java.in | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/jode/ChangeLog b/jode/ChangeLog index 0193368..14555d3 100644 --- a/jode/ChangeLog +++ b/jode/ChangeLog @@ -1,4 +1,11 @@ -2002-02-25 Jochen Hoenicke +2002-06-11 Jochen Hoenicke + + * jode/bytecode/BytecodeInfo.java.in (readAttribute): Fix the + exception handlers that javac 1.4 produces: I simply shorten + the start/end interval, so that the catcher is not in the end + interval. + +2002-02-25 Jochen Hoenicke * jode/bytecode/ClassInfo.java.in (read): Don't check for a maximum version anymore. Sun changes it with every release without diff --git a/jode/jode/bytecode/BytecodeInfo.java.in b/jode/jode/bytecode/BytecodeInfo.java.in index 6f37864..71c28ff 100644 --- a/jode/jode/bytecode/BytecodeInfo.java.in +++ b/jode/jode/bytecode/BytecodeInfo.java.in @@ -856,6 +856,26 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes { handlersLength--; i--; } + + if (exceptionHandlers[i].start.getAddr() + <= exceptionHandlers[i].catcher.getAddr() + && exceptionHandlers[i].end.getAddr() + >= exceptionHandlers[i].catcher.getAddr()) + { + /* Javac 1.4 is a bit paranoid with finally and + * synchronize blocks and even breaks the JLS. + * We fix it here. Hopefully this won't produce + * any other problems. + */ + if (exceptionHandlers[i].start + == exceptionHandlers[i].catcher) { + handlersLength--; + i--; + } else { + exceptionHandlers[i].end = + exceptionHandlers[i].catcher.getPrevByAddr(); + } + } } if (handlersLength < exceptionHandlers.length) { Handler[] newHandlers = new Handler[handlersLength];