System and method for exception handling in dynamically linked programs
First Claim
1. A computer implemented method of managing exceptions throwable by a specified method, said specified method including a declaration of throwable exceptions, said throwable exceptions in said declaration including exceptions throwable during execution of said specified method that may not be handled by enclosing exception handlers, comprising the steps of:
- determining a set of exceptions that are (A) throwable by the specified method and by methods that can be invoked by the specified method, (B) not members of a predefined set of excluded exceptions, and (C) not handled by enclosing exception handlers; and
comparing said determined set with said throwable exceptions in said declaration to determine whether any of said throwable exceptions in said set are not included declaration; and
preventing compilation of said specified method when said comparing step determines that at least one throwable exceptions in said set is not included declaration.
4 Assignments
0 Petitions
Accused Products
Abstract
A compiler requires normal exceptions that are throwable by a method to be either explicitly declared or else "caught" by appropriate exception handlers in the method to be compiled. This ensures that all normal exceptions thrown will be handled by a programmer specified exception handler. The compiler inspects all instructions in a specified method that throw exceptions and all instructions that invoke other methods, and determines whether each type of exception throwable by those instructions and invocable methods is (A) a serious exception (i.e., not a normal exception), (B) is caught by an enclosing exception handler, or (C) is explicitly declared in the method header of the specified method. If any throwable exception cannot be so categorized, that means the throwable exception is a normal exception that is not caught by an enclosing exception and is not explicitly declared in the method header, which means that the method to be compiled is not well formed. As a result, the compiler rejects the specified method, aborting compilation and generating an appropriate error message. The compiler determines the set of throwable exceptions in part by inspecting the methods that are invocable by the specified method for declarations of throwable exceptions. When initiating execution of the specified method, the program execution system inspects the method'"'"'s declaration of throwable exceptions and blocks execution of the specified method unless exception handlers have been established for handling all the exceptions, if any, included in the declaration.
100 Citations
15 Claims
-
1. A computer implemented method of managing exceptions throwable by a specified method, said specified method including a declaration of throwable exceptions, said throwable exceptions in said declaration including exceptions throwable during execution of said specified method that may not be handled by enclosing exception handlers, comprising the steps of:
-
determining a set of exceptions that are (A) throwable by the specified method and by methods that can be invoked by the specified method, (B) not members of a predefined set of excluded exceptions, and (C) not handled by enclosing exception handlers; and comparing said determined set with said throwable exceptions in said declaration to determine whether any of said throwable exceptions in said set are not included declaration; and preventing compilation of said specified method when said comparing step determines that at least one throwable exceptions in said set is not included declaration. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A computer program product for use in conjunction with a computer system, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism configured to direct the operation of the computer system to manage exceptions throwable by a specified method, said specified method including a declaration of throwable exceptions, said throwable exceptions in said declaration including exceptions throwable during execution of said specified method that may not be handled by enclosing exception handlers, comprising:
-
a first set of instructions for determining a set of exceptions that are (A) throwable by the specified method and by methods that can be invoked by the specified method, (B) not members of a predefined set of excluded exceptions, and (C) not handled by enclosing exception handlers; and a second set of instructions for comparing said determined set with said throwable exceptions in said declaration to determine whether any of said throwable exceptions in said set are not included declaration; and a third set of instructions for preventing compilation of said specified method when said comparing step determines that at least one throwable exceptions in said set is not included declaration. - View Dependent Claims (7, 8, 9, 10)
-
-
11. In a distributed computer system, a set of computer-readable modules suitable for transmission over communications links to data processing systems, said set of modules comprising:
-
a first set of instructions for determining a set of exceptions that are (A) throwable by the specified method and by methods that can be invoked by the specified method, (B) not members of a predefined set of excluded exceptions, and (C) not handled by enclosing exception handlers; and a second set of instructions for comparing said determined set with said throwable exceptions in said declaration to determine whether any of said throwable exceptions in said set are not included declaration; and a third set of instructions for preventing compilation of said specified method when said comparing step determines that at least one throwable exceptions in said set is not included declaration. - View Dependent Claims (12, 13, 14, 15)
-
Specification