Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException in UnusedDataItemBlocksShouldBeRemovedFeatureGenerator #8

Open
RTxin opened this issue Dec 11, 2024 · 0 comments
Open

Comments

@RTxin
Copy link

RTxin commented Dec 11, 2024

java.lang.ClassCastException: class io.proleap.cobol.asg.metamodel.data.datadescription.impl.DataDescriptionEntryConditionImpl cannot be cast to class io.proleap.cobol.asg.metamodel.data.datadescription.DataDescriptionEntryGroup (io.proleap.cobol.asg.metamodel.data.datadescription.impl.DataDescriptionEntryConditionImpl and io.proleap.cobol.asg.metamodel.data.datadescription.DataDescriptionEntryGroup are in unnamed module of loader 'app')
at io.proleap.issues.rules.data.UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.isRelevantDataDescriptionEntry(UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.java:121)
at io.proleap.issues.rules.data.UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.isRelevantDataDescriptionEntry(UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.java:135)
	at io.proleap.issues.rules.data.UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.filterUnusedDataItemsFromCalledDataItems(UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.java:44)
	at io.proleap.issues.rules.data.UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.getAll(UnusedDataItemBlocksShouldBeRemovedFeatureGenerator.java:69)
	at io.proleap.issues.rules.data.UnusedDataItemBlocksShouldBeRemovedRule.apply(UnusedDataItemBlocksShouldBeRemovedRule.java:34)
	at io.proleap.issues.impl.CobolIssuesRunnerImpl.applyRules(CobolIssuesRunnerImpl.java:54)
@MicronautTest
public class UnusedDataItemBlocksShouldBeRemovedTest extends TestBase {

	@Inject
	private UnusedDataItemBlocksShouldBeRemovedFeatureGenerator feature;

	@Test
	public void test() throws Exception {
		final File inputFile = new File(
				"src/test/resources/io/proleap/cobol/analysis/issues/data/InitWithCorrectType.cbl");
		final Program program = new CobolParserRunnerImpl().analyzeFile(inputFile, CobolSourceFormatEnum.TANDEM);
		final CompilationUnit compilationUnit = program.getCompilationUnit("InitWithCorrectType");
		final List<DataDescriptionEntry> dataDescriptionEntries = feature.getAll(compilationUnit)
				.collect(Collectors.toList());

		assertEquals("DATA-BLOCK-2", dataDescriptionEntries.get(0).getName());
		assertEquals(1, dataDescriptionEntries.size());
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant