Software developers are increasingly dependent on question and answer portals and blogs for coding solutions. While such interfaces provide useful information, there are concerns that code hosted here is often incorrect, insecure or incomplete. Previous work indeed detected a range of faults in code provided on Stack Overflow through the use of static analysis. Static analysis may go a far way towards quickly establishing the health of software code available online. In addition, mechanisms that enable rapid automated program improvement may then enhance such code. Accordingly, we present this proof of concept. We use the PMD static analysis tool to detect performance faults for a sample of Stack Overflow Java code snippets, before performing mutations on these snippets using GIN. We then re-analyse the performance faults in these snippets after the GIN mutations. GIN's RandomSampler was used to perform 17,986 unique line and statement patches on 3,034 snippets where PMD violations were removed from 770 patched versions. Our outcomes indicate that static analysis techniques may be combined with automated program improvement methods to enhance publicly available code with very little resource requirements. We discuss our planned research agenda in this regard.
翻译:软件开发者越来越依赖问答门户和博客来编码解决方案。 虽然这些界面提供了有用的信息, 但有人担心这里托管的代码往往不正确、不安全或不完整。 先前的工作确实通过静态分析发现了Stack Overflow 提供的代码中的一系列错误。 静态分析可能大大有利于快速建立在线软件代码的健康。 此外, 能够快速自动改进程序的机制可以增强这种代码。 因此, 我们展示了这个概念的证明。 我们使用 PMD 静态分析工具来检测 Stack overflow Java 代码片段的性能缺陷, 在使用 GIN 对这些片段进行突变之前, 我们随后通过GIN 突变来重新分析这些片段的性能缺陷。 GIN 的 RandomandSampler 被用于执行17, 986 独特的线和语句, 在3, 034 片段上, PMD 违规被删除了 770 个补装版本。 我们的结果表明, 静态分析技术可以与自动程序改进方法相结合, 以便用很少的资源要求加强公开提供的代码。