{"title":"ReSwitcher:自动重构Java程序的开关表达式","authors":"Yang Zhang, Chaoshuai Li, Shuai Shao","doi":"10.1109/ISSREW53611.2021.00108","DOIUrl":null,"url":null,"abstract":"A switch statement is frequently used with the advantage of handling multi-way branches and with the disadvantage of fall-through semantics that makes programs error-prone. Since JDK 12, the switch expression has been proposed as an alternative to make the code cleaner and safer. However, none of existing works focuses on fall-through semantics and refactoring for switch expressions in Java programs. To this end, this paper presents a refactoring tool ReSwitcher that can automatically (i) remove the fall-through semantics from a switch statement; and (ii) convert a switch statement into a switch expression. ReSwitcher is evaluated on 5 real-world applications. The results show it can refactor 2,984 switch statements in an average of 2.71 seconds, which improves robustness for these projects.","PeriodicalId":385392,"journal":{"name":"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)","volume":"44 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":"{\"title\":\"ReSwitcher: Automatically Refactoring Java Programs for Switch Expression\",\"authors\":\"Yang Zhang, Chaoshuai Li, Shuai Shao\",\"doi\":\"10.1109/ISSREW53611.2021.00108\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"A switch statement is frequently used with the advantage of handling multi-way branches and with the disadvantage of fall-through semantics that makes programs error-prone. Since JDK 12, the switch expression has been proposed as an alternative to make the code cleaner and safer. However, none of existing works focuses on fall-through semantics and refactoring for switch expressions in Java programs. To this end, this paper presents a refactoring tool ReSwitcher that can automatically (i) remove the fall-through semantics from a switch statement; and (ii) convert a switch statement into a switch expression. ReSwitcher is evaluated on 5 real-world applications. The results show it can refactor 2,984 switch statements in an average of 2.71 seconds, which improves robustness for these projects.\",\"PeriodicalId\":385392,\"journal\":{\"name\":\"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)\",\"volume\":\"44 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2021-10-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"3\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/ISSREW53611.2021.00108\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2021 IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ISSREW53611.2021.00108","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
ReSwitcher: Automatically Refactoring Java Programs for Switch Expression
A switch statement is frequently used with the advantage of handling multi-way branches and with the disadvantage of fall-through semantics that makes programs error-prone. Since JDK 12, the switch expression has been proposed as an alternative to make the code cleaner and safer. However, none of existing works focuses on fall-through semantics and refactoring for switch expressions in Java programs. To this end, this paper presents a refactoring tool ReSwitcher that can automatically (i) remove the fall-through semantics from a switch statement; and (ii) convert a switch statement into a switch expression. ReSwitcher is evaluated on 5 real-world applications. The results show it can refactor 2,984 switch statements in an average of 2.71 seconds, which improves robustness for these projects.