The Community for Technology Leaders
RSS Icon
Subscribe
Issue No.08 - Aug. (2013 vol.39)
pp: 1127-1143
Michael Pradel , ETH Zurich, Zurich
Thomas R. Gross , ETH Zurich, Zurich
ABSTRACT
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
REFERENCES
[1] https://issues.apache.org/jira/browseHADOOP-4732 , 2013.
[2] http://issues.liferay.com/browseLPS-3890 , 2013.
[3] JBoss SVN repository, revisions 58536, 58764, and 60357.
[4] JikesRVM SVN repository, revisions 10263 and 13935.
[5] G. Ammons, R. Bodík, and J.R. Larus, "Mining Specifications," Proc. Symp. Principles of Programming Languages, pp. 4-16, 2002.
[6] S.M. Blackburn, R. Garner, C. Hoffmann, A.M. Khan, K.S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S.Z. Guyer, M. Hirzel, A.L. Hosking, M. Jump, H.B. Lee, J.E.B. Moss, A. Phansalkar, D. Stefanovic, T. VanDrunen, D. von Dincklage, and B. Wiedermann, "The DaCapo Benchmarks: Java Benchmarking Development and Analysis," Proc. 21st Ann. Conf. Object-Oriented Programming, Systems, Languages, and Applications, pp. 169-190, 2006.
[7] S. Butler, M. Wermelinger, Y. Yu, and H. Sharp, "Exploring the Influence of Identifier Names on Code Quality: An Empirical Study," Proc. 14th European Conf. Software Maintenance and Reeng., pp. 156-165, 2010.
[8] S. Butler, M. Wermelinger, Y. Yu, and H. Sharp, "Improving the Tokenisation of Identifier Names," Proc. European Conf. Object-Oriented Programming, pp. 130-154, 2011.
[9] R.-Y. Chang, A. Podgurski, and J. Yang, "Finding What's Not There: A New Approach to Revealing Neglected Conditions in Software," Proc. Int'l Symp. Software Testing and Analysis, pp. 163-173, 2007.
[10] W.W. Cohen, P.D. Ravikumar, and S.E. Fienberg, "A Comparison of String Distance Metrics for Name-Matching Tasks," Proc. Workshop Information Integration on the Web, pp. 73-78, 2003.
[11] D. Engler, D.Y. Chen, S. Hallem, A. Chou, and B. Chelf, "Bugs as Deviant Behavior: A General Approach to Inferring Errors in Systems Code," Proc. 18th ACM Symp. Operating Systems Principles, pp. 57-72, 2001.
[12] M.D. Ernst, J. Cockrell, W.G. Griswold, and D. Notkin, "Dynamically Discovering Likely Program Invariants to Support Program Evolution," IEEE Trans. Software Eng., vol. 27, no. 2, pp. 213-224, Feb. 2001.
[13] M. Erwig and M.M. Burnett, "Adding Apples and Oranges," Proc. Fourth Int'l Symp. Practical Aspects of Declarative Languages, pp. 173-191, 2002.
[14] M. Gabel and Z. Su, "Javert: Fully Automatic Mining of General Temporal Properties from Dynamic Traces," Proc. 16th ACM SIGSOFT Symp. Foundations of Software Eng., pp. 339-349, 2008.
[15] D. Greenfieldboyce and J.S. Foster, "Type Qualifier Inference for Java," Proc. 22nd Ann. ACM SIGPLAN Conf. Object-Oriented Programming, Systems, Languages, and Applications, pp. 321-336, 2007.
[16] P.J. Guo, J.H. Perkins, S. McCamant, and M.D. Ernst, "Dynamic Inference of Abstract Types," Proc. Int'l Symp. Software Testing and Analysis, pp. 255-265, 2006.
[17] S. Hangal and M.S. Lam, "Tracking Down Software Bugs Using Automatic Anomaly Detection," Proc. 24th Int'l Conf. Software Eng., pp. 291-301, 2002.
[18] S. Hangal and M.S. Lam, "Automatic Dimension Inference and Checking for Object-Oriented Programs," Proc. 31st IEEE Int'l Conf. Software Eng., pp. 155-165, 2009.
[19] J. Henkel, C. Reichenbach, and A. Diwan, "Discovering Documentation for Java Container Classes," IEEE Trans. Software Eng., vol. 33, no. 8, pp. 526-543, Aug. 2007.
[20] J.L. Henning, "SPEC CPU2006 Benchmark Descriptions," SIGARCH Computer Architecture News, vol. 34, no. 4, pp. 1-17, 2006.
[21] E.W. Høst and B.M. Østvold, "Debugging Method Names," Proc. 23rd European Conf. Object-Oriented Programming, pp. 294-317, 2009.
[22] D. Hovemeyer and W. Pugh, "Finding Bugs Is Easy," Proc. Conf. Object-Oriented Programming, Systems, Languages, and Applications, pp. 132-136, 2004.
[23] J.L. Lawall and D. Lo, "An Automated Approach for Finding Variable-Constant Pairing Bugs," Proc. IEEE/ACM Int'l Conf. Automated Software Eng., pp. 103-112, 2010.
[24] D. Lawrie, C. Morrell, H. Feild, and D. Binkley, "What's in a Name? A Study of Identifiers," Proc. 14th IEEE Int'l Conf. Program Comprehension, pp. 3-12, 2006.
[25] Z. Li and Y. Zhou, "PR-Miner: Automatically Extracting Implicit Programming Rules and Detecting Violations in Large Software Code," Proc. 10th European Software Eng. Conf./13th ACM SIGSOFT Int'l Symp. Foundations of Software Eng., pp. 306-315, 2005.
[26] D. Lo and S.-C. Khoo, "SMArTIC: Towards Building an Accurate, Robust and Scalable Specification Miner," Proc. 14th ACM SIGSOFT Int'l Symp. Foundations of Software Eng., pp. 265-275, 2006.
[27] S. Lu, S. Park, C. Hu, X. Ma, W. Jiang, Z. Li, R.A. Popa, and Y. Zhou, "MUVI: Automatically Inferring Multi-Variable Access Correlations and Detecting Related Semantic and Concurrency Bugs," Proc. 21st ACM SIGOPS Symp. Operating Systems Principles, pp. 103-116, 2007.
[28] M. Monperrus, M. Bruch, and M. Mezini, "Detecting Missing Method Calls in Object-Oriented Software," Proc. European Conf. Object-Oriented Programming, pp. 2-25, 2010.
[29] T.T. Nguyen, H.A. Nguyen, N.H. Pham, J.M. Al-Kofahi, and T.N. Nguyen, "Graph-Based Mining of Multiple Object Usage Patterns," Proc. European Software Eng. Conf. and ACM SIGSOFT Symp. the Foundations of Software Eng., pp. 383-392, 2009.
[30] M. Pradel, P. Bichsel, and T.R. Gross, "A Framework for the Evaluation of Specification Miners Based on Finite State Machines," Proc. IEEE Int'l Conf. Software Maintenance, pp. 1-10, 2010.
[31] M. Pradel and T.R. Gross, "Automatic Generation of Object Usage Specifications from Large Method Traces," Proc. IEEE/ACM Int'l Conf. Automated Software Eng., pp. 371-382, 2009.
[32] M. Pradel and T.R. Gross, "Detecting Anomalies in the Order of Equally-Typed Method Arguments," Proc. Int'l Symp. Software Testing and Analysis, pp. 232-242, 2011.
[33] S. Shoham, E. Yahav, S. Fink, and M. Pistoia, "Static Specification Mining Using Automata-Based Abstractions," Proc. Int'l Symp. Software Testing and Analysis, pp. 174-184, 2007.
[34] K. Taneja, D. Dig, and T. Xie, "Automated Detection of API Refactorings in Libraries," Proc. 22nd IEEE/ACM Conf. Automated Software Eng., pp. 377-380, 2007.
[35] S. Thummalapenta and T. Xie, "Alattin: Mining Alternative Patterns for Detecting Neglected Conditions," Proc. IEEE/ACM Int'l Conf. Automated Software Eng., pp. 283-294, 2009.
[36] S. Thummalapenta and T. Xie, "Mining Exception-Handling Rules as Sequence Association Rules," Proc. 31st Int'l Conf. Software Eng., pp. 496-506, 2009.
[37] A. Wasylkowski and A. Zeller, "Mining Temporal Specifications from Object Usage," Proc. IEEE Int'l Conf. Automated Software Eng., pp. 295-306, 2009.
[38] A. Wasylkowski, A. Zeller, and C. Lindig, "Detecting Object Usage Anomalies," Proc. European Software Eng. Conf. and Symp. Foundations of Software Eng., pp. 35-44, 2007.
[39] J. Whaley, M.C. Martin, and M.S. Lam, "Automatic Extraction of Object-Oriented Component Interfaces," Proc. ACM SIGSOFT Int'l Symp. Software Testing and Analysis, pp. 218-228, 2002.
[40] C. Zhang, J. Yang, Y. Zhang, J. Fan, X. Zhang, J. Zhao, and P. Ou, "Automatic Parameter Recommendation for Practical API Usage," Proc. Int'l Conf. Software Eng., pp. 826-836, 2012.
29 ms
(Ver 2.0)

Marketing Automation Platform Marketing Automation Tool