Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/openrewrite/java/logging/AddLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static AddLogger addSlf4jLogger(J.ClassDeclaration scope, String loggerNa
.contextSensitive()
.imports("org.slf4j.Logger", "org.slf4j.LoggerFactory")
.javaParser(JavaParser.fromJavaVersion()
.classpathFromResources(ctx, "slf4j-api-2.1.+"))
.classpathFromResources(ctx, "slf4j-api-2"))
.build()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public JavaTemplate getErrorTemplate(String message, ExecutionContext ctx) {
case SLF4J:
return JavaTemplate
.builder("#{any(org.slf4j.Logger)}.error(" + message + ", #{any(java.lang.Throwable)})")
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "slf4j-api-2.1.+"))
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "slf4j-api-2"))
.build();
case Log4J1:
return JavaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public JavaTemplate getErrorTemplateNoException(ExecutionContext ctx) {
case SLF4J:
return JavaTemplate
.builder("#{any(org.slf4j.Logger)}.error(#{any(String)});")
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "slf4j-api-2.1.+"))
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "slf4j-api-2"))
.build();
case Log4J1:
return JavaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private JavaTemplate getInfoTemplate(ExecutionContext ctx) {
return JavaTemplate
.builder("#{any(org.slf4j.Logger)}." + levelOrDefault + "(#{any(String)})")
.javaParser(JavaParser.fromJavaVersion()
.classpathFromResources(ctx, "slf4j-api-2.1.+"))
.classpathFromResources(ctx, "slf4j-api-2"))
.build();
case Log4J1:
return JavaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AddLoggerTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ArgumentArrayToVarargsTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new ArgumentArrayToVarargs())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ChangeLoggersToPrivateTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new ChangeLoggersToPrivate())
.parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "log4j-1", "slf4j-api-2.1.+", "log4j-api-2.+"));
.parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "log4j-1", "slf4j-api-2", "log4j-api-2.+"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ParameterizedLoggingTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+", "log4j-api-2.+", "log4j-core-2.+", "lombok"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2", "log4j-api-2.+", "log4j-core-2.+", "lombok"));
}

@DocumentExample
Expand Down Expand Up @@ -804,7 +804,7 @@ void kotlinStringTemplateSkipped() {
rewriteRun(
spec -> spec
.recipe(new ParameterizedLogging("org.slf4j.Logger info(..)", false))
.parser(KotlinParser.builder().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+")),
.parser(KotlinParser.builder().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2")),
//language=kotlin
kotlin(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void useSlf4j() {
rewriteRun(
spec -> spec.recipe(new PrintStackTraceToLogError(null, "LOGGER", null))
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+", "lombok-1.18.+")),
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2", "lombok-1.18.+")),
//language=java
java(
"""
Expand Down Expand Up @@ -401,7 +401,7 @@ public void close() {
void supportLombokLogAnnotations() {
rewriteRun(
spec -> spec.recipe(new PrintStackTraceToLogError(null, null, null))
.parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+", "lombok-1.18.+"))
.parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2", "lombok-1.18.+"))
.typeValidationOptions(TypeValidation.builder().identifiers(false).build()),
//language=java
java(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SystemErrToLoggingTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new Log4jAppenderToLogback())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "log4j-1.2.+", "slf4j-api-2.1.+", "lombok-1.18.+"));
.classpathFromResources(new InMemoryExecutionContext(), "log4j-1.2.+", "slf4j-api-2", "lombok-1.18.+"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SystemOutToLoggingTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+", "lombok-1.18.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2", "lombok-1.18.+"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Slf4jToLog4jTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipeFromResource("/META-INF/rewrite/log4j.yml", "org.openrewrite.java.logging.log4j.Slf4jToLog4j")
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "log4j-1.2.+", "slf4j-api-2.1.+", "lombok-1.18.+"));
.classpathFromResources(new InMemoryExecutionContext(), "log4j-1.2.+", "slf4j-api-2", "lombok-1.18.+"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ChangeLogLevelTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new ChangeLogLevel(ChangeLogLevel.Level.INFO, ChangeLogLevel.Level.DEBUG, "LaunchDarkly"))
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void defaults(RecipeSpec spec) {
.build()
.activateRecipes("org.openrewrite.java.logging.slf4j.CommonsLogging1ToSlf4j1"))
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "commons-logging-1.3.+", "slf4j-api-2.1.+", "lombok-1.18.+"));
.classpathFromResources(new InMemoryExecutionContext(), "commons-logging-1.3.+", "slf4j-api-2", "lombok-1.18.+"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CompleteExceptionLoggingTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new CompleteExceptionLogging())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LoggersNamedForEnclosingClassTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new LoggersNamedForEnclosingClass())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void defaults(RecipeSpec spec) {
.build()
.activateRecipes("org.openrewrite.java.logging.slf4j.Slf4jBestPractices"))
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Slf4jLogShouldBeConstantTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec.recipe(new Slf4jLogShouldBeConstant())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ record TestCase(String originalArgs, String expectedArgs) {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new StripToStringFromArguments()).parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
spec.recipe(new StripToStringFromArguments()).parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@MethodSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class WrapExpensiveLogStatementsInConditionalsSlf4j2Test implements RewriteTest
public void defaults(RecipeSpec spec) {
spec.recipe(new WrapExpensiveLogStatementsInConditionals())
.parser(JavaParser.fromJavaVersion()
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2.1.+"));
.classpathFromResources(new InMemoryExecutionContext(), "slf4j-api-2"));
}

@DocumentExample
Expand Down
Loading