Skip to content

Commit 59bd6b3

Browse files
cushonppkarwasz
authored andcommitted
Avoid referring to PluginBuilderAttribute.class in PluginProcessor (#4041)
This makes it easier to build `PluginProcessor` by itself separately from the rest of `log4j-core`, and then include that processor when building the rest of core, instead of having to compile all of core twice.
1 parent 79568db commit 59bd6b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/processor/PluginProcessor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import javax.tools.StandardLocation;
5454
import org.apache.logging.log4j.core.config.plugins.Plugin;
5555
import org.apache.logging.log4j.core.config.plugins.PluginAliases;
56-
import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute;
5756
import org.apache.logging.log4j.util.Strings;
5857

5958
/**
@@ -84,9 +83,13 @@ public SourceVersion getSupportedSourceVersion() {
8483
return SourceVersion.latest();
8584
}
8685

86+
private static final String PLUGIN_BUILDER_ATTRIBUTE_ANNOTATION =
87+
"org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute";
88+
8789
@Override
8890
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
8991
final Messager messager = processingEnv.getMessager();
92+
final Elements elementUtils = processingEnv.getElementUtils();
9093
// Process the elements for this round
9194
if (!annotations.isEmpty()) {
9295
final Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(Plugin.class);
@@ -95,7 +98,7 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round
9598

9699
// process plugin builder Attributes
97100
final Set<? extends Element> pluginAttributeBuilderElements =
98-
roundEnv.getElementsAnnotatedWith(PluginBuilderAttribute.class);
101+
roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(PLUGIN_BUILDER_ATTRIBUTE_ANNOTATION));
99102
processBuilderAttribute(pluginAttributeBuilderElements);
100103
processedElements.addAll(pluginAttributeBuilderElements);
101104
}

0 commit comments

Comments
 (0)