Skip to content

Commit

Permalink
test: reproduce the reported issue
Browse files Browse the repository at this point in the history
refs #2019
  • Loading branch information
KengoTODA committed Apr 20, 2022
1 parent d894f53 commit 2c4a94d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
@@ -0,0 +1,17 @@
package edu.umd.cs.findbugs.detect;

import edu.umd.cs.findbugs.AbstractIntegrationTest;
import org.junit.Test;


public class Issue2019Test extends AbstractIntegrationTest {
@Test
public void test() {
performAnalysis("ghIssues/Issue2019$ATNSimulator.class",
"ghIssues/Issue2019$BaseParser.class",
"ghIssues/Issue2019$Parser.class",
"ghIssues/Issue2019$ParserATNSimulator.class",
"ghIssues/Issue2019$Recognizer.class",
"ghIssues/Issue2019.class");
}
}
44 changes: 44 additions & 0 deletions spotbugsTestCases/src/java/ghIssues/Issue2019.java
@@ -0,0 +1,44 @@
package ghIssues;

/**
* @see <a href="https://github.com/spotbugs/spotbugs/issues/2019">GitHub Issue</a>
*/
public class Issue2019 {

static class ATNSimulator {
public int adaptivePredict() {
return 0;
}
}

static class ParserATNSimulator extends ATNSimulator {
}

static class Recognizer<ATNInterpreter extends ATNSimulator> {
public ATNInterpreter getInterpreter() {
return null;
}
}

static class BaseParser extends Recognizer<ParserATNSimulator> {
}

public static class Parser extends BaseParser {

public void text() {
int _alt = 1;
do {
switch (_alt) {
case 1:
if (_alt == 1) {
continue;
}
break;
default:
throw new RuntimeException();
}
_alt = getInterpreter().adaptivePredict();
} while (_alt != 2);
}

}}

0 comments on commit 2c4a94d

Please sign in to comment.