-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev teamspec-customerIssues from customersIssues from customers
Milestone
Description
Description
Some of tests for Enum generated by Symbolic execution are instantiating with unnecessary reflection.
To Reproduce
- Run the
lrs
project in IntelliJ Idea - Install one of the latest plugin builds from main, used 2022.11.546
- Use default settings
- Use plugin to generate tests for
ThreeState
enum - Open the generated test
Expected behavior
Enums are supposed to be instantiated without reflection.
Actual behavior
There are several (not all) tests generated by Symbolic execution that use unneeded reflection.
Visual proofs (screenshots, logs, images)
Example:
///region OTHER: ERROR SUITE for method mostPositive(java.lang.Iterable)
@Test
public void testMostPositive9() throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException {
ThreeState prevNO = ThreeState.NO;
try {
ThreeState no = ThreeState.NO;
Class threeStateClazz = Class.forName("com.intellij.util.ThreeState");
setStaticField(threeStateClazz, "NO", no);
HashSet states = new HashSet();
ThreeState threeState = ThreeState.YES;
states.add(threeState);
states.add(null);
/* This test fails because method [com.intellij.util.ThreeState.mostPositive] produces [java.lang.NullPointerException]
com.intellij.util.ThreeState.mostPositive(ThreeState.java:40) */
ThreeState.mostPositive(states);
} finally {
setStaticField(ThreeState.class, "NO", prevNO);
}
}
///endregion
Environment
Windows 10 Pro
IntelliJ IDEA 2022.2.3
IntelliJ project, JDK 11
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev teamspec-customerIssues from customersIssues from customers
Type
Projects
Status
Done