diff --git a/gradle-plugin/src/main/kotlin/xyz/wagyourtail/jvmdg/gradle/flags/DowngradeFlags.kt b/gradle-plugin/src/main/kotlin/xyz/wagyourtail/jvmdg/gradle/flags/DowngradeFlags.kt index 7fb0f09a..a97017e2 100644 --- a/gradle-plugin/src/main/kotlin/xyz/wagyourtail/jvmdg/gradle/flags/DowngradeFlags.kt +++ b/gradle-plugin/src/main/kotlin/xyz/wagyourtail/jvmdg/gradle/flags/DowngradeFlags.kt @@ -2,6 +2,7 @@ package xyz.wagyourtail.jvmdg.gradle.flags import org.gradle.api.JavaVersion import org.gradle.api.artifacts.transform.TransformParameters +import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property import org.gradle.api.provider.SetProperty import org.gradle.api.tasks.Input @@ -63,7 +64,7 @@ interface DowngradeFlags : TransformParameters { */ @get:Input @get:Optional - val ignoreWarningsIn: SetProperty + val ignoreWarningsIn: ListProperty /** * sets if the logger should print debug messages @@ -101,8 +102,8 @@ fun DowngradeFlags.toFlags(): Flags { flags.logLevel = Logger.Level.valueOf(logLevel.getOrElse("INFO").uppercase()) flags.printDebug = debug.getOrElse(false) flags.classVersion = downgradeTo.getOrElse(JavaVersion.VERSION_1_8).toOpcode() - flags.debugSkipStubs = debugSkipStubs.getOrElse(emptySet()).map { it.toOpcode() }.toSet() - ignoreWarningsIn.getOrElse(emptySet()).forEach { flags.addIgnore(it) } + flags.debugSkipStubs = debugSkipStubs.getOrElse(emptyList()).map { it.toOpcode() }.toSet() + ignoreWarningsIn.getOrElse(emptyList()).forEach { flags.addIgnore(it) } flags.debugDumpClasses = debugDumpClasses.getOrElse(false) return flags } diff --git a/src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java b/src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java index 0084355f..fc428325 100644 --- a/src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java +++ b/src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java @@ -331,6 +331,7 @@ public void stub(Class clazz) { logger.warn("failed to create stub(s) for " + clazz.getName(), e); } if (!warnings.isEmpty() && logger.is(Logger.Level.WARN)) { + if (downgrader.flags.checkInIgnoreWarnings(clazz.getName())) return; StringBuilder sb = new StringBuilder(); for (String warning : warnings) { sb.append(" ").append(warning).append("\n"); @@ -420,11 +421,13 @@ public ClassNode stubMethods(ClassNode owner, Set extra, boolean enab owner.methods.set(owner.methods.indexOf(method), newMethod); } if (!warnings.isEmpty() && logger.is(Logger.Level.WARN)) { - StringBuilder sb = new StringBuilder(); - for (String warning : warnings) { - sb.append(" ").append(warning).append("\n"); + if (!downgrader.flags.checkInIgnoreWarnings(owner.name + "." + method.name)) { + StringBuilder sb = new StringBuilder(); + for (String warning : warnings) { + sb.append(" ").append(warning).append("\n"); + } + logger.warn("Warnings for " + owner.name + "." + method.name + method.desc + " (" + warnings.size() + ") : \n" + sb); } - logger.warn("Warnings for " + owner.name + "." + method.name + method.desc + " (" + warnings.size() + ") : \n" + sb); } } return owner;