Download presentation
Presentation is loading. Please wait.
Published byRebecca Johanna Dale Modified over 5 years ago
1
ModiChecker : Accessibility Excessiveness Analysis Tool for Java Program
Dotri Quoc†, Kazuo Kobori†, Norihiro Yoshida*, Yoshiki Higo† , Katsuro Inoue† † : Osaka University, Japan * : Nara Institute of Science and Technology , Japan
2
AE Analysis Tool : ModiChecker Experiment and Discussion
Outline Introduction AE Analysis Tool : ModiChecker Experiment and Discussion Conclusion and future work Delete the symbol of MASU…. JSSST11 2019/5/19
3
Encapsulation in Java Programming
One characteristic of object oriented programming Object’s code and data is hidden from other objects Interface encapsulates objects’ code and data Good Encapsulation : choosing appropriate access modifier for fields/methods Bad habit of Access Modifier setting : public or default(no explicit declaration) JSSST11 2019/5/19
4
Example of Bad Access Modifier Declaration- Binary Search
int[] A ; ….. public void sort(){ … } public int binarySearch(int value){ //Find index of value in array public void process(){ int x; // set value of x from some where …. this.sort() ; int index = this.binarySearch(x) ; // other operation with index ; CLASS1 Set value for array object.A Sorting Array A in an order public void process{ CLASS1 object = new CLASS1() ; … //searching a value in array without sorting int index = object.binarySearch(10) ; } CLASS2 Searching Private Initialization sort binarySearch Calling Order JSSST11 2019/5/19
5
AE : Accessibility Excessiveness(1/2)
AE : Discrepancy between declared access modifier and actual usage An AE could caused unwilling access to method/field AE could be used as an indicator of immaturity of developer Properties of AE JSSST11 2019/5/19
6
AE : Accessibility Excessiveness(2/2)
Acquirement of AE for each field/method AE causes bug in latter development and maintenance phase AE analysis tool : ModiChecker JSSST11 2019/5/19
7
AE Analysis Tool : ModiChecker Experiment and Discussion
Outline Introduction AE Analysis Tool : ModiChecker Experiment and Discussion Conclusion and future work JSSST11 2019/5/19
8
AE Analysis Tool : ModiChecker
AE analysis for Java Program Report excessiveness for each field/method Requirement for implementation : Access Modifiers declaration and actual usage of field/method from other objects AE Map : define all cases of AE JSSST11 2019/5/19
9
Approach to AE Analysis Static Source Code Analysis
Requirement Information of each field/method’s access modifier declaration Actual Usage of each field/method MASU : Platform for Metrics measurement but is useful as a Java program analysis framework Static source code Analysis is required Employing MASU MASU - JSSST11 2019/5/19
10
Approach to AE Analysis-AE Map (1/2)
Java Access Modifier Public : can be accessed by all classes Protected: can be only accessed by classes in the same package and subclasses Default :can be only accessed by classes in the same package. No explicit Access Modifier is declared Private: can be only accessed from inside of owner class JSSST11 2019/5/19
11
Approach to AE Analysis-AE Map (2/2)
Accessibility Excessive Map AE Id AE Id of Excessive fields/methods Actual Usage Declaration Public Protected Default Private ok-pub0 pub1 pub2 pub3 - ok-pro0 pro1 pro2 ok-def0 def1 ok-pri0 Syntax Error No Discrepancy Explain access range of java access modifier Change x to – Change default to package without None JSSST11 2019/5/19
12
Architecture of ModiChecker
Extraction of access modifier declaration Extraction of method/field usage ModiChecker Source Code Analyzer AST Database MASU Detection of declaration excessiveness Source Code Required Library(.jar files) Input Report of AE Id for each method/field JSSST11 2019/5/19
13
Special Cases for ModiChecker
No report for methods of Abstract classes and Interfaces Method overriding an other method case overriding method must have an access modifier equal or more permissive level to the access modifier of the overridden method JSSST11 2019/5/19
14
Example of Method Overriding Method Case
public method C() Class A Class B Access modifier of C must be public Even if method B.C was only accessed from inside class B, ModiChecker still reported method B.C the AE Id of pub0 JSSST11 2019/5/19
15
AE Analysis Tool : ModiChecker Experiment and Discussion Conclusion
Outline Introduction AE Analysis Tool : ModiChecker Experiment and Discussion Conclusion JSSST11 2019/5/19
16
Overview of Experiment(1/2)
Objectives of experiment Validation of our approach Quantitative analysis of AE Id in open source code Reasons for excessiveness Reason 1 : Set for future use Reason 2 : Created by other program(automatic code generators or refactoring tools…) Reason 3 : Carelessness and immaturity Change number in latter pages State the experiment process Object of experiment : validation of our approach, Quantitative analyses of AE ID in open source 2019/5/19
17
Overview of Experiment(2/2)
Target Software Ant (1141 files, LOC) jEdit 4.4.1(546 files, LOC) MASU(519 files, LOC) JSSST11 2019/5/19
18
Result of Ant(1/2) Ratio of each AE Id
18.9% 35.5% JSSST11 2019/5/19
19
Result of Ant(2/2) Excessive fields Excessive methods
Total number : 611(18.9%) Set for future use : unknown Created by other program : 0 Carelessness and immaturity : unknown Excessive methods Total number : 1520(35.5%) Ratio of excessive methods > ratio of excessive fields Encapsulation : Make fields private and provide public getter/setter to access fields JSSST11 2019/5/19
20
Result of jEdit(1/2) Ratio of each AE Id
24.1% 30.4% JSSST11 2019/5/19
21
Result of jEdit(2/2) Excessive fields Total number : 604(24.1%)
Set for future use : unknown Created by other program : 0 Carelessness and immaturity : unknown Excessive methods Total number : 981(30.4%) Ratio of excessive methods > ratio of excessive fields JSSST11 2019/5/19
22
Result of MASU(1/2) Ratio of each AE Id
35.7% 14.3% JSSST11 2019/5/19
23
Result of MASU(2/2) Excessive fields Total number : 280(35.7%)
Set for future use : 20 Created by other program(automatic code generator) : 255 Carelessness and immaturity : 5 Excessive methods Total number : 253(14.3%) Set for future use : 181 Created by other program(automatic code generator) : 6 Carelessness and immaturity : 66 Ratio of excessive fields > ratio of excessive methods Caused by fields created by automatic code generator JSSST11 2019/5/19
24
Discussion(1/3) Validation of ModiChecker output
Change all of the excessive access modifier by hand Modified programs were compiled and executed without any error Conclusion for excessiveness Number for reason State the reason first , then give the solution English grammar JSSST11 2019/5/19
25
Discussion(2/3) Solution for excessiveness
Reason 1 : Excessiveness set for future use requirement of tool which let developer select fields/methods to change access modifier Reason 2 : Excessiveness created by other programs Using ModiChecker after using refactoring tools or automatic code generating tools JSSST11 2019/5/19
26
Discussion(3/3) Proposal of new quality metrics
AE index for each AE id and metrics value is total of AE index of all methods/fields Set value for each field/method based on the number of potential unexpected access. Metrics value is total of those values. JSSST11 2019/5/19
27
AE Analysis Tool : ModiChecker Experiment and Discussion
Outline Introduction AE Analysis Tool : ModiChecker Experiment and Discussion Conclusion and future work JSSST11 2019/5/19
28
Conclusion Analysis method named AE for each field/method
ModiChecker : find excessiveness and report AE of each field/method Experiment on some open softwares JSSST11 2019/5/19
29
Future works Apply ModiChecker for other Java systems and other programming language system(C# , C++…) AE analysis result and other program quality indicators such as bug frequency Number of AE index Number of Bug C# : public internal protected private C++ : Private, Protected and Public. JSSST11 2019/5/19
30
THANK YOU FOR YOUR ATTENTION
JSSST11 2019/5/19
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.