Template for a good bug report, formatted with Markdown:
- versions used: SonarLint plugin (4.11.0.20867) with Intellij
(IntelliJ IDEA 2020.2.2 (Ultimate Edition)
Build #IU-202.7319.50, built on September 15, 2020
Runtime version: 11.0.8+10-b944.31 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7)
- error observed (wrap logs/code around triple quote ``` for proper formatting)
Remove this unused import 'com.cartrust.comregistraiton.organiozation.model.DocumentState.UPLOADED'
- steps to reproduce
It seem related to the enum value “UPLOADED” if I refactor the value to “UPLOADED_YEAH” the error disappears. Of course it was used after the refactoring too.
Other enum values from the same enum are not shown as errors:
import static com.cartrust.registration.organization.model.DocumentState.MISSING;
import static com.cartrust.registration.organization.model.DocumentState.UPLOADED;
import static com.cartrust.registration.organization.model.DocumentState.WAITING_FOR_NOTIFICATION;
import static com.cartrust.registration.organization.model.DocumentState.WAITING_FOR_UPLOAD;
Here’s the usage in the same file:
@EventHandler
public void on(DocumentAddedEvent event) {
val aggregateId = event.getOwnerOrganizationId();
organizationViewRepository.findById(aggregateId).ifPresent(
organizationView -> {
organizationViewRepository.save(organizationView.toBuilder()
.businessRegistrationDocumentId(event.getDocumentId())
.businessRegistrationState(UPLOADED)
.build());
}
);
}
- potential workaround
Rename enum values “UPLOADED” to something else.
P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour