Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea.

Similar presentations


Presentation on theme: "1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea."— Presentation transcript:

1 1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea

2 2 Contents Introduction Motivation Design of exception analysis Experiments and Related Works Conclusions

3 3 INTRODUCTION

4 4 Java overview Object oriented Type soundness –by Eisenbach97 and Nipkow98 Dynamic binding –inheritance and overriding Exception handling Concurrency

5 5 Constraint-based Analysis Constraint-based analysis [N. Heintze 1992] –static analysis framework for any languages –by defining set-constraint construction rules Constraint-based analysis –set-up constraints for programs by the rules –constraint solving algorithm Uncaught exception analysis –based on constraint-based analysis framework

6 6 MOTIVATION

7 7 Exceptions in Java Every exception is declared as –a subclass of “Exception” class Throw exceptions throw e Exception handling try { … } catch (E x) { … } Specify uncaught exceptions in method definition m(...) throws … { … }

8 8 Exceptions in Java Example class Demo { public static void main( ) { try { demoproc( ); } catch (Exception x) { ; } } void demoproc( ) throws Exception { try { throw new IOException("demo"); } catch (Exception x) { ; } }

9 9 Uncaught Exception Analysis in JDK Exception analysis –check whether thrown exceptions are caught or specified in the method definition –intra-procedural analysis based on programmer’s specifications. Not elaborate enough to –suggest for specialized handling nor –remove unnecessary handlers

10 10 Uncaught Exception Analysis We need an interprocedural analysis to –approximate all possible uncaught exceptions more precisely –independently of the programmer's specs. Exception analysis after class analysis –Assume Class(e) represents classes that are ``available'' at an expression e

11 11 Design of Exception Analysis

12 12 Deriving Set Constraints A set variable P e for every expression e –a set of names of uncaught exceptions from e. Construct set constraints of the form : P e  se This analysis assigns class names of possible uncaught exceptions of e to P e

13 13 Deriving Set Constraints Suppose e is each of the following expressions id = e 1 | P e  P e1 if e 0 then e 1 else e 2 | P e  P e0  P e1  P e2 throw e 1 | P e  Class(e 1 )  P e1 try e 0 catch (c x ) e 1 | P e  (P e0 - {c}*)  P e1 e 0.m(e 1 ) | - P e  P e0  P e1 - for each class c in Class(e 0 ) with a method m(x 1 ) = e m c  Class(e 0 )  P e  P e m

14 14 Experiments & Related Works

15 15 Experiments on Exception Analysis 2-pass exception analyzer at method-level implemented using yacc pass1 set-ups constraints pass2 solves the constraints Testbed UltraSparc Enterprise 450 running Solaris

16 16 No.programsDescriptionNum of class Num of method Num of lines Kinds of Exns 1StatisticianList methods statistics for a class 113873 2JavaBinHex BinHex(.hqx) decompressor 133002 3JHLZIP Compress into ZIP file 2114253 4JHLUNZIP Decompress ZIP file 131872 5Com.ice.tarUnix Tar Archive1014140456 6Jess-Rete Reasoning Engine of Java Expert System Shell 19816677 Benchmark Programs (available at http://www.gamelan.com)

17 17 No.Throws spec Catch block Uncaugt Exn Unnecessary throws Unnecessary catch Broader throws Broader catch 112410100 20800001 3483002 (1)1 4131001 (0) 5402131 4 (0) 03 (1)4 (2) 63810336 (0)013 (2) Experimental Results ( ) : JDK results

18 18 Execution Time 0.020.05Jess-Rete 0.030.18Com.ice.tar 0.01 JHLUNZIP 0.010.02JHLZIP 0.010.02JavaBinHex 0.010.02Statistician Solving time (sec) Set-up time (sec) Programs

19 19 Related works Exception analysis for ML – constraint-based [Fahndrich&Aiken96 ], [Yi&Ryu97], – type and effect [Pessaux&Leroy99 ] Exception analysis for Java –designed with class analysis at method-level [Yi and Chang 99] Jex –A tool for a view of the exception flow [Robillard and Murphy 99]

20 20 Conclusions Exception analysis –a kind of program verification tool –can be incorporated in Java IDE Further works –Generalize sparse analysis by rule transformation –side-effect, security, synchronization


Download ppt "1 Exception Analysis for Java Byeong-Mo Chang Sookmyung Women’s Univ., Korea."

Similar presentations


Ads by Google