Skip to content

Commit

Permalink
bug fix : duplicate local variable declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauma109 committed Dec 19, 2022
1 parent 4917c4c commit 3a7fa90
Show file tree
Hide file tree
Showing 3 changed files with 1,856 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ private static List<List<Instruction>> getBlocks(Instruction instruction) {
FastTest2Lists fastTest2Lists = (FastTest2Lists) instruction;
return Arrays.asList(fastTest2Lists.getInstructions(), fastTest2Lists.getInstructions2());
}
// /!\ order matters since FastTest2Lists extends FastTestList
if (instruction instanceof FastTestList) { // to convert to jdk16 pattern matching only when spotbugs #1617 and eclipse #577987 are solved
FastTestList fastTestList = (FastTestList) instruction;
return Collections.singletonList(fastTestList.getInstructions());
}
if (instruction instanceof FastTry) { // to convert to jdk16 pattern matching only when spotbugs #1617 and eclipse #577987 are solved
FastTry fastTry = (FastTry) instruction;
List<List<Instruction>> instructions = new ArrayList<>();
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/jd/core/test/NumberUtilsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package jd.core.test;

import org.apache.commons.io.IOUtils;
import org.junit.Test;

import java.nio.charset.StandardCharsets;

import static org.junit.Assert.assertEquals;

/*
* Test for duplicate local variable bug fix.
*/
public class NumberUtilsTest extends AbstractTestCase {
@Test
public void test() throws Exception {
String output = decompile("org/apache/commons/lang3/math/NumberUtils");
assertEquals(IOUtils.toString(getClass().getResource("NumberUtils.txt"), StandardCharsets.UTF_8), output);
}
}
Loading

0 comments on commit 3a7fa90

Please sign in to comment.