From ea74635d6f54177c5c786ca8d14ce1555d0a6314 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Sun, 1 Dec 2024 18:42:38 +0100 Subject: [PATCH] Fix NestedEnumsAreNotStatic using Preconditions.and instead of check Fixes #400 --- .../openrewrite/staticanalysis/NestedEnumsAreNotStatic.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/openrewrite/staticanalysis/NestedEnumsAreNotStatic.java b/src/main/java/org/openrewrite/staticanalysis/NestedEnumsAreNotStatic.java index 082cb236a..67f315a67 100644 --- a/src/main/java/org/openrewrite/staticanalysis/NestedEnumsAreNotStatic.java +++ b/src/main/java/org/openrewrite/staticanalysis/NestedEnumsAreNotStatic.java @@ -52,7 +52,8 @@ public Duration getEstimatedEffortPerOccurrence() { @Override public TreeVisitor getVisitor() { - return Preconditions.and(new HasNestedEnum(), Preconditions.not(new CSharpFileChecker<>()), new JavaIsoVisitor() { + TreeVisitor preconditions = Preconditions.and(new HasNestedEnum(), Preconditions.not(new CSharpFileChecker<>())); + return Preconditions.check(preconditions, new JavaIsoVisitor() { @Override public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, ExecutionContext ctx) { J.ClassDeclaration cd = super.visitClassDeclaration(classDecl, ctx);