You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var status = service.waitForResult(taskId, Duration.ofMinutes(1));
switch (status) {
case COMPLETED -> result.setStatus(StatusEnum.COMPLETED);
case FAILED -> result.setStatus(StatusEnum.FAILED);
default -> result.setStatus(StatusEnum.PENDING);
}
causes a violation like
Field <com.controller.Controller.$SWITCH_TABLE$...$StatusEnum> is not final in (Controller.java:0)
with a test
@ArchTest
public static final ArchRule rule = ArchRuleDefinition.classes()
.that()
.areAnnotatedWith(Controller.class)
.should().haveOnlyFinalFields();
Maybe this is the fault of the compiler used (Eclipse), but I wonder if ArchUnit can ignore these switch tables when checking the rule?
The text was updated successfully, but these errors were encountered:
I guess this can be handled by skipping fields with JavaModifier.SYNTHETIC. Even if we don't want to do that in the default haveOnlyFinalFields method, maybe it would be good to show/document this workaround somehow.
I suppose one way is to check this using ArchRuleDefinition::fields, filtering with MembersThatInternal::doNotHaveModifier(JavaModifier.SYNTHETIC) and then check for the final modifier.
Example code:
having some method with a call inside it like:
causes a violation like
Field <com.controller.Controller.$SWITCH_TABLE$...$StatusEnum> is not final in (Controller.java:0)
with a test
Maybe this is the fault of the compiler used (Eclipse), but I wonder if ArchUnit can ignore these switch tables when checking the rule?
The text was updated successfully, but these errors were encountered: