Update LogAdapter to allow build-time code removal

Allow for example to remove those classes and 90 related methods when Logback is used:
- org.apache.commons.logging.LogAdapter$JavaUtilAdapter
- org.apache.commons.logging.LogAdapter$JavaUtilLog
- org.apache.commons.logging.LogAdapter$LocationResolvingLogRecord
- org.apache.commons.logging.LogAdapter$Log4jAdapter
- org.apache.commons.logging.LogAdapter$Log4jLog
- org.apache.commons.logging.LogAdapter$LogApi
- org.apache.logging.log4j.message.ObjectMessage
- org.apache.logging.log4j.message.ReusableObjectMessage
- org.apache.logging.log4j.simple.SimpleLoggerContext
- org.apache.logging.log4j.simple.SimpleLoggerContextFactory

Closes gh-29506
This commit is contained in:
Sébastien Deleuze
2022-11-17 09:47:46 +01:00
parent 2a2c679f66
commit 04366f4129
2 changed files with 25 additions and 31 deletions

View File

@@ -36,7 +36,8 @@ class PreComputeFieldFeature implements Feature {
Pattern.compile(Pattern.quote("org.springframework.core.NativeDetector#imageCode")),
Pattern.compile(Pattern.quote("org.springframework.") + ".*#.*Present"),
Pattern.compile(Pattern.quote("org.springframework.") + ".*#.*PRESENT"),
Pattern.compile(Pattern.quote("reactor.") + ".*#.*Available")
Pattern.compile(Pattern.quote("reactor.") + ".*#.*Available"),
Pattern.compile(Pattern.quote("org.apache.commons.logging.LogAdapter") + "#.*Present")
};
private final ThrowawayClassLoader throwawayClassLoader = new ThrowawayClassLoader(PreComputeFieldFeature.class.getClassLoader());