The Community for Technology Leaders
2017 24th Asia-Pacific Software Engineering Conference (APSEC) (2017)
Nanjing, Jiangsu, China
Dec. 4, 2017 to Dec. 8, 2017
ISBN: 978-1-5386-3681-7
pp: 368-377
API specifications play an important role in software development. However, API specifications are often not well documented, especially for JavaScript. Many JavaScript API specifications lack of precise type information for API parameters and return values. In this paper, we propose a static approach for mining JavaScript type specifications automatically. We gather the usage information of return values and parameters statically, and infer types of return values based their usages, by identifying a known type which they are used most likely to be, and infer parameters by identifying the most used parameters. We evaluate the approach on the homepages of Alexa top 1000 websites, the experimental results show that our approach can gain high precision. Our case study on jQuery shows that our approach gains high precision and reasonable recall on jQuery, and we can use our inferred API type specifications to detect 2 jQuery misusage errors in real-world web sites, and 1 missing type error in jQuery documentations.
application program interfaces, authoring languages, data mining, formal specification, Web sites

S. Wang, W. Dou, C. Gao, J. Wei and T. Huang, "Mining API Type Specifications for JavaScript," 2017 24th Asia-Pacific Software Engineering Conference (APSEC), Nanjing, Jiangsu, China, 2018, pp. 368-377.
182 ms
(Ver 3.3 (11022016))