This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Name-Based Analysis of Equally Typed Method Arguments
Aug. 2013 (vol. 39 no. 8)
pp. 1127-1143
Michael Pradel, ETH Zurich, Zurich
Thomas R. Gross, ETH Zurich, Zurich
When calling a method that requires multiple arguments, programmers must pass the arguments in the expected order. For statically typed languages, the compiler helps programmers by checking that the type of each argument matches the type of the formal parameter. Unfortunately, types are futile for methods with multiple parameters of the same type. How can a programmer check that equally typed arguments are passed in the correct order? This paper presents two simple, yet effective, static program analyses that detect problems related to the order of equally typed arguments. The key idea is to leverage identifier names to infer the semantics of arguments and their intended positions. The analyses reveal problems that affect the correctness, understandability, and maintainability of a program, such as accidentally reversed arguments and misleading parameter names. Most parts of the analyses are language-agnostic. We evaluate the approach with 24 real-world programs written in Java and C. Our results show the analyses to be effective and efficient. One analysis reveals anomalies in the order of equally typed arguments; it finds 54 relevant problems with a precision of 82 percent. The other analysis warns about misleading parameter names and finds 31 naming bugs with a precision of 39 percent.
Index Terms:
Java,Access control,Engines,Feature extraction,Context,Robustness,Program processors,method arguments,Testing and debugging,maintenance,documentation,static program analysis,anomaly detection
Citation:
Michael Pradel, Thomas R. Gross, "Name-Based Analysis of Equally Typed Method Arguments," IEEE Transactions on Software Engineering, vol. 39, no. 8, pp. 1127-1143, Aug. 2013, doi:10.1109/TSE.2013.7
Usage of this product signifies your acceptance of the Terms of Use.