Summary: | Injecting exception into while loop with break statement causes catch block to be ignored | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Nigel Charman <nigel.charman> |
Component: | Compiler | Assignee: | Adrian Colyer <adrian.colyer> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | P3 | ||
Version: | 1.2.1 M1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Nigel Charman
2004-11-06 13:47:16 EST
This is related to bug 79554 - they are both to do with us creating an incorrect exception table for a woven method. The exception table for the unwoven code is: Exception table: from to target type 9 38 38 Class java/lang/Throwable 9 29 64 any 32 61 64 any 81 84 64 any Once woven, this changes to: Exception table: from to target type 87 90 70 any 32 67 70 any 9 44 44 Class java/lang/Throwable 9 29 70 any The inclusion of 'any' with a range that overlaps the 'Throwable' range is causing the problem. When the exception occurs, it is right in the overlap range and so in the woven code we skip the catch block, do the finally stuff and rethrow the exception. When unpacking, we associate a priority with entries in the exception table. This priority can be used when writing the class out to ensure we don't break the ordering carefully constructed by the compiler. We currently ignore the priority - leading to situations where sometimes entries for finally blocks obscure entries for real catch blocks. The implementation of the priority for newly created exception handlers (created during weaving) doesn't seem quite right as they are given either super high priority (Integer.MAX) or super low priority (-1). There are comments in the code (around LazyMethodGen.insertHandler()) which suggest what the right long term implementation would be but having spent the last day in the code, it is not trivial and the simpler immediate fix of using the priorities fixes this bug and the related 79954. We can do the full implementation of the priority work when (if?) someone finds a situation that the current algorithm doesn't cope with. Fix checked in - waiting for build. Fix available: BUILD COMPLETE - build.429 Date of build: 01/11/2005 11:52:16 Time to build: 103 minutes 38 seconds Last changed: 01/11/2005 11:22:16 Last log entry: Fixes for 78021, 79554 - both to do with us breaking the exception table for a method on weaving *if* finally blocks are involved. Latest good AspectJ jar available at: download.eclipse.org/technology/ajdt/dev/aspectj-DEVELOPMENT.jar |