ramanathan1504 commented on code in PR #4156:
URL: https://github.com/apache/logging-log4j2/pull/4156#discussion_r3831366892


##########
log4j-plugin-processor/src/main/java/org/apache/logging/log4j/plugin/processor/PluginProcessor.java:
##########
@@ -164,6 +177,76 @@ private void 
processPluginAnnotatedClasses(Set<TypeElement> pluginClasses) {
         }
     }
 
+    private void processBuilderAttributeFields(final RoundEnvironment 
roundEnv) {
+        final Elements elements = processingEnv.getElementUtils();
+        for (final String annotationFqn : BUILDER_ATTRIBUTE_ANNOTATIONS) {
+            final TypeElement annotationType = 
elements.getTypeElement(annotationFqn);
+            if (annotationType == null) {
+                continue;
+            }
+            for (final Element element : 
roundEnv.getElementsAnnotatedWith(annotationType)) {
+                if (element instanceof VariableElement) {
+                    processBuilderAttributeField((VariableElement) element);
+                }
+            }
+        }
+    }
+
+    private void processBuilderAttributeField(final VariableElement element) {
+        final String fieldName = element.getSimpleName().toString();
+        // Check for @SuppressWarnings("log4j.public.setter")

Review Comment:
   ```suggestion
   ```
   remove this its not any special case to add inline comments



##########
log4j-plugin-processor/src/main/java/org/apache/logging/log4j/plugin/processor/PluginProcessor.java:
##########
@@ -124,6 +135,8 @@ public boolean process(final Set<? extends TypeElement> 
annotations, final Round
         if (!annotations.isEmpty()) {
             
processPluginAnnotatedClasses(ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Plugin.class)));
         }
+        // Validate @PluginBuilderAttribute fields in builder classes

Review Comment:
   ```suggestion
   ```
   remove this its not any special case to add inline comments



##########
log4j-plugin-processor/src/test/java/org/apache/logging/log4j/plugin/processor/PluginProcessorPublicSetterTest.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.plugin.processor;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+class PluginProcessorPublicSetterTest {
+
+    private static final String FAKE_PLUGIN_SOURCE = 
"/setter-test/FakePluginPublicSetter.java";
+
+    private DiagnosticCollector<JavaFileObject> diagnosticCollector;
+    private List<Diagnostic<? extends JavaFileObject>> errorDiagnostics;
+
+    @TempDir
+    private Path outputDir;
+
+    @BeforeEach
+    void setup() throws Exception {
+        final URL fakePluginUrl = 
PluginProcessorTest.class.getResource(FAKE_PLUGIN_SOURCE);
+        assertThat(fakePluginUrl).isNotNull();
+        final Path fakePluginPath = Paths.get(fakePluginUrl.toURI());
+        diagnosticCollector = new DiagnosticCollector<>();
+        try {
+            final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+            final StandardJavaFileManager fileManager =
+                    compiler.getStandardFileManager(diagnosticCollector, 
Locale.ROOT, UTF_8);
+            try {
+                // Route generated files (Log4jPlugins.java, 
META-INF/services/...) to a temp directory

Review Comment:
   ```suggestion
   ```
   here too



##########
log4j-core/src/main/java/org/apache/logging/log4j/core/filter/StringMatchFilter.java:
##########
@@ -237,6 +237,8 @@ public static StringMatchFilter.Builder newBuilder() {
     public static class Builder extends 
AbstractFilterBuilder<StringMatchFilter.Builder>
             implements 
org.apache.logging.log4j.core.util.Builder<StringMatchFilter> {
         @PluginBuilderAttribute
+        // Remove once #4153 renames the setter to match the field name

Review Comment:
   ```suggestion
   ```
   
   Before give in pr Please check these comments are not need



##########
log4j-plugin-processor/src/main/java/org/apache/logging/log4j/plugin/processor/PluginProcessor.java:
##########


Review Comment:
   clean all inline comments



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to