Abstract
A null object in Java is occurred when an object is not initialized properly, but a property or a method in the object is called; resulting in the null pointer exception problem and low software quality. To solve this problem, developers usually create a number of null checking conditions in their codes. Duplicated null checking conditions affect the code quality. The duplicated code makes a computer program repeatedly and exhaustively checks for null value, therefore, it reduces the performance of the program. This research involves automatically detecting the code smells caused by null checking conditions in Java by using regular expression. The research specifically focuses on detecting (i) introduce null object, (ii) duplicated code, and (iii) null checking in a string comparison problem. Thirteen Java open-source projects were employed to verify and validate our approach. The detection results were significantly improved when using regular expression comparing to using Abstract Syntax Tree (AST) for detecting code smells caused by null checking conditions in Java programs.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.