() {
+ @Override
+ protected String defaultAction(final Element e, @Nullable final Void unused) {
+ return e.getSimpleName().toString();
+ }
+
+ @Override
+ public String visitExecutable(final ExecutableElement e, final Void unused) {
+ final Name name = e.getSimpleName();
+ if (StringUtils.startsWithAny(name, GETTER_SETTER_PREFIXES)) {
+ final int prefixLen = StringUtils.startsWith(name, "is") ? 2 : 3;
+ if (name.length() > prefixLen) {
+ return Character.toLowerCase(name.charAt(prefixLen))
+ + name.toString().substring(prefixLen + 1);
+ }
+ }
+ return super.visitExecutable(e, unused);
+ }
+ },
+ null);
+ }
+
+ /**
+ * Returns the appropriate type element for the return type of this method.
+ *
+ * If the return type is a type variable, returns its upper bound.
+ *
+ *
+ * If the return type is {@code void} or primitive, {@code null} is returned.
+ *
+ */
+ private @Nullable TypeElement getReturnType(final ExecutableElement method) {
+ return method.getReturnType()
+ .accept(
+ new SimpleTypeVisitor8<@Nullable TypeElement, @Nullable Void>() {
+ @Override
+ public TypeElement visitDeclared(final DeclaredType t, final Void unused) {
+ return asTypeElement(t);
+ }
+
+ @Override
+ public @Nullable TypeElement visitTypeVariable(final TypeVariable t, final Void unused) {
+ // If the return type is a variable, try the upper bound
+ return t.getUpperBound().accept(this, unused);
+ }
+ },
+ null);
+ }
+
+ /**
+ * Returns all the members of this type or its ancestors.
+ */
+ private Collection extends Element> getAllMembers(final TypeElement element) {
+ final Collection members = new HashSet<>();
+ TypeElement currentElement = element;
+ while (currentElement != null) {
+ members.addAll(currentElement.getEnclosedElements());
+ currentElement = getSuperclass(currentElement);
+ }
+ return members;
+ }
+
+ private @Nullable TypeElement getSuperclass(final TypeElement element) {
+ final TypeMirror superclass = element.getSuperclass();
+ return superclass instanceof DeclaredType ? asTypeElement((DeclaredType) superclass) : null;
+ }
+
+ // TODO: Can the element associated to a declared type be anything else than a type element?
+ private TypeElement asTypeElement(final DeclaredType type) {
+ return (TypeElement) type.asElement();
+ }
+
+ /**
+ * Gets the class name of the erasure of this type.
+ *
+ * If this is an array type, {@code null} is returned.
+ *
+ */
+ private @Nullable String getClassName(final @Nullable TypeMirror type) {
+ return type != null
+ ? types.erasure(type)
+ .accept(
+ new SimpleTypeVisitor8() {
+
+ @Override
+ public String visitDeclared(final DeclaredType t, final Void unused) {
+ return asTypeElement(t)
+ .getQualifiedName()
+ .toString();
+ }
+
+ @Override
+ public String visitPrimitive(final PrimitiveType t, final Void unused) {
+ switch (t.getKind()) {
+ case BOOLEAN:
+ return "boolean";
+ case BYTE:
+ return "byte";
+ case SHORT:
+ return "short";
+ case INT:
+ return "int";
+ case LONG:
+ return "long";
+ case CHAR:
+ return "char";
+ case FLOAT:
+ return "float";
+ case DOUBLE:
+ return "double";
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
+ @Override
+ public String visitNoType(final NoType t, final Void unused) {
+ return "void";
+ }
+ },
+ null)
+ : null;
+ }
+
+ /**
+ * If this is an array or collection type, returns the class name of its component.
+ *
+ * If this is not an array or collection type, {@link #getClassName(TypeMirror)} is returned.
+ *
+ */
+ private @Nullable String getComponentClassName(final TypeMirror type) {
+ return type.accept(
+ new SimpleTypeVisitor8<@Nullable String, @Nullable Void>() {
+ @Override
+ protected @Nullable String defaultAction(final TypeMirror e, final Void unused) {
+ return getClassName(e);
+ }
+
+ @Override
+ public @Nullable String visitArray(final ArrayType t, final Void unused) {
+ return getClassName(t.getComponentType());
+ }
+
+ @Override
+ public @Nullable String visitDeclared(final DeclaredType t, final Void unused) {
+ if (types.isAssignable(t, collectionType)) {
+ // Bind T in Collection
+ final DeclaredType asCollection = findCollectionSupertype(t);
+ if (asCollection != null) {
+ final List extends TypeMirror> typeArguments = asCollection.getTypeArguments();
+ if (!typeArguments.isEmpty()) {
+ return getClassName(typeArguments.get(0));
+ }
+ }
+ }
+ return super.visitDeclared(t, unused);
+ }
+
+ private @Nullable DeclaredType findCollectionSupertype(final TypeMirror type) {
+ if (types.isSameType(types.erasure(type), collectionType)) {
+ return (DeclaredType) type;
+ }
+ for (final TypeMirror supertype : types.directSupertypes(type)) {
+ final DeclaredType result = findCollectionSupertype(supertype);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+ },
+ null);
+ }
+
+ private @Nullable String getMultiplicity(final TypeMirror type) {
+ return type.accept(
+ new SimpleTypeVisitor8<@Nullable String, @Nullable Void>() {
+ @Override
+ public String visitArray(final ArrayType t, final Void unused) {
+ return MULTIPLICITY_UNBOUNDED;
+ }
+
+ @Override
+ public @Nullable String visitDeclared(final DeclaredType t, final Void unused) {
+ return types.isAssignable(t, collectionType) ? MULTIPLICITY_UNBOUNDED : null;
+ }
+ },
+ null);
+ }
+}
diff --git a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/SectionImpl.java b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/SectionImpl.java
index 33cfee6f..58a7442c 100644
--- a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/SectionImpl.java
+++ b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/SectionImpl.java
@@ -31,10 +31,10 @@ public SectionImpl(final ContentNode parent) {
public void formatTo(final StringBuilder buffer) {
final String title = getTitle();
if (title != null) {
- buffer.append("=".repeat(computeSectionLevel(this)))
- .append(' ')
- .append(title)
- .append("\n\n");
+ for (int i = 0; i < computeSectionLevel(this); i++) {
+ buffer.append('=');
+ }
+ buffer.append(' ').append(title).append("\n\n");
}
formatNodeCollection(getBlocks(), "\n", buffer);
}
diff --git a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/StructuralNodeImpl.java b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/StructuralNodeImpl.java
index 65f3e660..58b0152e 100644
--- a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/StructuralNodeImpl.java
+++ b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/internal/StructuralNodeImpl.java
@@ -75,8 +75,8 @@ public final String convert() {
protected abstract void formatTo(final StringBuilder buffer);
protected static void formatNode(final StructuralNode node, final StringBuilder buffer) {
- if (node instanceof final StructuralNodeImpl impl) {
- impl.formatTo(buffer);
+ if (node instanceof StructuralNodeImpl) {
+ ((StructuralNodeImpl) node).formatTo(buffer);
} else {
buffer.append(node.convert());
}
diff --git a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/util/TypeLookup.java b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/util/TypeLookup.java
index 15774fa7..10986a4c 100644
--- a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/util/TypeLookup.java
+++ b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/util/TypeLookup.java
@@ -16,7 +16,6 @@
*/
package org.apache.logging.log4j.docgen.util;
-import java.io.Serial;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeMap;
@@ -28,7 +27,6 @@
public final class TypeLookup extends TreeMap {
- @Serial
private static final long serialVersionUID = 1L;
public static TypeLookup of(final Iterable extends PluginSet> sets) {
diff --git a/log4j-docgen/src/main/mdo/plugins-model.xml b/log4j-docgen/src/main/mdo/plugins-model.xml
index 815eeb37..d556f147 100644
--- a/log4j-docgen/src/main/mdo/plugins-model.xml
+++ b/log4j-docgen/src/main/mdo/plugins-model.xml
@@ -30,6 +30,10 @@
package
org.apache.logging.log4j.docgen
+
+ java.util.Set
+ new java.util.TreeSet<?>()
+
@@ -67,6 +71,7 @@
scalars
+ Set
ScalarType
*
@@ -75,6 +80,7 @@
plugins
+ Set
PluginType
*
@@ -83,6 +89,7 @@
abstractTypes
+ Set
AbstractType
*
@@ -111,6 +118,9 @@
Type
Any Java type used in a Log4j configuration.
Documented
+
+ java.lang.Comparable<Type>
+
className
@@ -119,6 +129,16 @@
Fully qualified name of the class implementing the plugin.
+
+
+
+
+
@@ -128,6 +148,7 @@
implementations
+ Set
String
*
@@ -166,6 +187,7 @@ This element is filled in automatically.
aliases
true
+ Set
String
*
@@ -177,6 +199,7 @@ This element is filled in automatically.
supertypes
+ Set
String
*
@@ -209,6 +232,9 @@ This element is filled in automatically.
PluginAttribute
A scalar configuration value for the plugin.
+
+ java.lang.Comparable<PluginAttribute>
+
name
@@ -247,6 +273,16 @@ The type must be an enum or must have a type converter.
A description of the property.
+
+
+
+
+
@@ -309,6 +345,9 @@ The type must be an enum or must have a type converter.
PluginElement
Describes a nested configuration component.
+
+ java.lang.Comparable<PluginElement>
+
multiplicity
@@ -337,6 +376,16 @@ If the type is an array or collection, this returns the type of the element.An HTML description of this element.
+
+
+
+
+
diff --git a/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java
index 7ca4f0c8..5dc18880 100644
--- a/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java
+++ b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java
@@ -28,6 +28,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Set;
+import java.util.stream.Collectors;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.tools.Diagnostic;
@@ -66,8 +67,10 @@ void convertToAsciidoc() throws Exception {
final StandardJavaFileManager fileManager = tool.getStandardFileManager(null, Locale.ROOT, UTF_8);
final Path basePath = Paths.get(System.getProperty("basedir", "."));
- final Path sourcePath = basePath.resolve("src/test/it/example/JavadocExample.java");
- final Iterable extends JavaFileObject> sources = fileManager.getJavaFileObjectsFromPaths(List.of(sourcePath));
+ final Path sourcePath = Paths.get(AsciidocConverterTest.class
+ .getResource("/processor/asciidoc/example/JavadocExample.java")
+ .toURI());
+ final Iterable extends JavaFileObject> sources = fileManager.getJavaFileObjects(sourcePath);
final Path destPath = basePath.resolve("target/test-site");
Files.createDirectories(destPath);
@@ -79,7 +82,7 @@ void convertToAsciidoc() throws Exception {
final List warnings = ds.getDiagnostics().stream()
.filter(d -> d.getKind() != Diagnostic.Kind.NOTE)
.map(d -> d.getMessage(Locale.ROOT))
- .toList();
+ .collect(Collectors.toList());
assertThat(warnings).isEmpty();
final Path expectedPath = Paths.get(AsciidocConverterTest.class
.getResource("/expected/processor/JavadocExample.adoc")
@@ -104,7 +107,7 @@ public Set extends Option> getSupportedOptions() {
@Override
public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.RELEASE_17;
+ return SourceVersion.latestSupported();
}
@Override
diff --git a/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/DocGenProcessorTest.java b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/DocGenProcessorTest.java
new file mode 100644
index 00000000..98bde56f
--- /dev/null
+++ b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/DocGenProcessorTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.docgen.processor;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import org.apache.logging.log4j.docgen.xsd.SchemaGenerator;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.xmlunit.assertj3.XmlAssert;
+
+public class DocGenProcessorTest {
+
+ static Stream descriptorGenerationSucceeds() {
+ return Stream.of("v2", "v3");
+ }
+
+ @ParameterizedTest
+ @MethodSource
+ void descriptorGenerationSucceeds(final String version) {
+ final Path basePath = Paths.get(System.getProperty("basedir", "."));
+ final Path schema = basePath.resolve("target/generated-site/resources/xsd/plugins-0.1.0.xsd");
+ final URL expected = SchemaGenerator.class.getResource("/expected/processor/META-INF/log4j/plugins.xml");
+ final Path actual = assertDoesNotThrow(() -> generateDescriptor(version));
+ XmlAssert.assertThat(actual)
+ .isValidAgainst(schema)
+ .and(expected)
+ .ignoreComments()
+ .ignoreWhitespace()
+ .areIdentical();
+ }
+
+ private static Path generateDescriptor(final String version) throws Exception {
+ final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ final DiagnosticCollector ds = new DiagnosticCollector<>();
+ final StandardJavaFileManager fileManager =
+ compiler.getStandardFileManager(null, Locale.ROOT, StandardCharsets.UTF_8);
+
+ final Path basePath = Paths.get(System.getProperty("basedir", "."));
+ final Path sourcePath = Paths.get(
+ DocGenProcessorTest.class.getResource("/processor/" + version).toURI());
+ final Iterable extends JavaFileObject> sources;
+ try (final Stream files = Files.walk(sourcePath)) {
+ sources = fileManager.getJavaFileObjects(
+ files.filter(Files::isRegularFile).toArray(Path[]::new));
+ }
+
+ final Path destPath = basePath.resolve("target/test-site/processor/" + version);
+ Files.createDirectories(destPath);
+ fileManager.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Set.of(destPath));
+
+ final CompilationTask task = compiler.getTask(
+ null,
+ fileManager,
+ ds,
+ Arrays.asList("-proc:only", "-processor", DocGenProcessor.class.getName()),
+ null,
+ sources);
+ task.call();
+
+ final List warnings = ds.getDiagnostics().stream()
+ .filter(d -> d.getKind() != Diagnostic.Kind.NOTE)
+ .map(d -> d.getMessage(Locale.ROOT))
+ .collect(Collectors.toList());
+ assertThat(warnings).isEmpty();
+
+ final Path descriptor = destPath.resolve("META-INF/log4j/plugins.xml");
+ assertThat(descriptor).isNotEmptyFile();
+ return descriptor;
+ }
+}
diff --git a/log4j-docgen/src/test/resources/expected/processor/META-INF/log4j/plugins.xml b/log4j-docgen/src/test/resources/expected/processor/META-INF/log4j/plugins.xml
new file mode 100644
index 00000000..274d7431
--- /dev/null
+++ b/log4j-docgen/src/test/resources/expected/processor/META-INF/log4j/plugins.xml
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+ Makes things go boom!
+
+
+ A second choice.
+
+
+ Value C.
+
+
+ Value D.
+
+
+ A very important enum.
+
+
+
+
+
+ example.AbstractAppender
+ example.Appender
+ example.BaseAppender
+ java.lang.Object
+
+
+
+ An attribute of type `double`.
+
+
+ An attribute whose name differs from the field name.
+
+
+ A `boolean` attribute with annotated type.
+
+
+ A `byte` attribute with annotated parameter.
+
+
+ A `char` attribute.
+
+
+ An attribute that is an enumeration annotated on type.
+
+
+ An attribute of type `float`.
+
+
+ An `int` attribute.
+
+
+ A `long` attribute annotated on type.
+
+
+ A `short` attribute annotated on type.
+
+
+ A `String` attribute.
+
+
+
+
+ An element that is not an interface with annotated parameter.
+
+
+ An element with an annotated type.
+
+
+ An element with multiplicity n with annotated setter.
+
+
+ An element with multiplicity 1.
+
+
+ A collection element.
+
+
+ A set of layouts
+
+
+ A setter with a varargs type.
+
+
+ Example plugin
+
+This is an example plugin.
+It has the following characteristics:
+
+. Plugin name: `MyPlugin`,
+. Namespace: default (i.e. `Core`).
+
+It also implements:
+
+* xref:Appender.adoc[],
+* xref:BaseAppender.adoc[]
+
+
+
+ example.Layout
+ java.lang.Object
+
+
+
+ A `boolean` attribute.
+
+
+ A `byte` attribute.
+
+
+ A `char` attribute.
+
+
+ A `double` attribute.
+
+
+ An `enum` attribute.
+
+
+ A `float` attribute.
+
+
+ An `int` attribute.
+
+
+ A `long` attribute.
+
+
+ An attribute with overwritten name.
+
+
+ A `short` attribute.
+
+
+ A xref:String.adoc[] attribute.
+
+
+
+
+ An element with multiplicity `n`.
+
+
+ An element with multiplicity `1`.
+
+
+ Example plugin without a builder.
+
+
+
+
+ An example of base abstract class.
+
+
+ Extended interface that also allows to do `baz`.
+
+
+ Base interface for appenders.
+
+
+ Formats messages.
+
+
+
diff --git a/log4j-docgen/src/test/it/example/JavadocExample.java b/log4j-docgen/src/test/resources/processor/asciidoc/example/JavadocExample.java
similarity index 100%
rename from log4j-docgen/src/test/it/example/JavadocExample.java
rename to log4j-docgen/src/test/resources/processor/asciidoc/example/JavadocExample.java
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/AbstractAppender.java b/log4j-docgen/src/test/resources/processor/v2/example/AbstractAppender.java
new file mode 100644
index 00000000..61f1122e
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/AbstractAppender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * An example of base abstract class.
+ */
+public abstract class AbstractAppender implements BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/Appender.java b/log4j-docgen/src/test/resources/processor/v2/example/Appender.java
new file mode 100644
index 00000000..a2045ae7
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/Appender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Extended interface that also allows to do {@code baz}.
+ */
+public interface Appender extends BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/BaseAppender.java b/log4j-docgen/src/test/resources/processor/v2/example/BaseAppender.java
new file mode 100644
index 00000000..e405fec8
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/BaseAppender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Base interface for appenders.
+ */
+public interface BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/Filter.java b/log4j-docgen/src/test/resources/processor/v2/example/Filter.java
new file mode 100644
index 00000000..6250ce21
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/Filter.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Filters messages.
+ */
+public interface Filter {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/Layout.java b/log4j-docgen/src/test/resources/processor/v2/example/Layout.java
new file mode 100644
index 00000000..5884c6da
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/Layout.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Formats messages.
+ */
+public interface Layout {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/MyAppender.java b/log4j-docgen/src/test/resources/processor/v2/example/MyAppender.java
new file mode 100644
index 00000000..f99d07fb
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/MyAppender.java
@@ -0,0 +1,188 @@
+/*
+ * 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 example;
+
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.element.TypeElement;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required;
+
+/**
+ * Example plugin
+ *
+ * This is an example plugin. It has the following characteristics:
+ *
+ *
+ * - Plugin name: {@code MyPlugin},
+ * - Namespace: default (i.e. {@code Core}).
+ *
+ *
+ * It also implements:
+ *
+ *
+ * - {@link Appender},
+ * - {@link BaseAppender}
+ *
+ */
+@Plugin(name = "MyAppender", category = "namespace")
+public final class MyAppender extends AbstractAppender implements Appender {
+
+ /**
+ * Parent builder with some private fields that are not returned by
+ * {@link javax.lang.model.util.Elements#getAllMembers(TypeElement)}.
+ */
+ public static class ParentBuilder {
+
+ /**
+ * A {@code char} attribute.
+ */
+ @PluginBuilderAttribute
+ private char charAtt = 'L';
+
+ /**
+ * An {@code int} attribute.
+ */
+ @PluginBuilderAttribute
+ private int intAtt = 4242;
+
+ /**
+ * An element with multiplicity 1.
+ */
+ @PluginElement("layout")
+ private Layout layout;
+ }
+
+ public static final class Builder extends ParentBuilder
+ implements org.apache.logging.log4j.plugins.util.Builder {
+
+ /**
+ * A {@code short} attribute annotated on type.
+ */
+ private @PluginBuilderAttribute short shortAtt = 42;
+
+ /**
+ * A {@code long} attribute annotated on type.
+ */
+ private @PluginBuilderAttribute long longAtt = 424242L;
+
+ /**
+ * A {@code String} attribute.
+ */
+ @PluginBuilderAttribute
+ @Required
+ private String stringAtt;
+
+ /**
+ * An attribute whose name differs from the field name.
+ */
+ @PluginBuilderAttribute("anotherName")
+ private String origName;
+
+ /**
+ * An attribute that is an enumeration annotated on type.
+ */
+ private @PluginBuilderAttribute MyEnum enumAtt;
+
+ /**
+ * An attribute of type {@code float}.
+ */
+ private @PluginBuilderAttribute float floatAtt;
+
+ /**
+ * An attribute of type {@code double}.
+ */
+ private @PluginBuilderAttribute double aDouble;
+
+ private Object notAnAttribute;
+
+ /**
+ * A collection element.
+ */
+ @PluginElement("appenderList")
+ private List appenderList;
+
+ /**
+ * A set of layouts
+ */
+ @PluginElement("layoutSet")
+ private LayoutSet layoutSet;
+
+ /**
+ * A {@code boolean} attribute with annotated type.
+ */
+ public Builder setBooleanAtt(final @PluginBuilderAttribute boolean booleanAtt) {
+ return this;
+ }
+
+ /**
+ * A {@code byte} attribute with annotated parameter.
+ */
+ public Builder setByteAtt(@PluginBuilderAttribute final byte byteAtt) {
+ return this;
+ }
+
+ /**
+ * An element with multiplicity n with annotated setter.
+ */
+ public Builder setFilters(final @PluginElement("filters") Filter[] filters) {
+ return this;
+ }
+
+ /**
+ * An element that is not an interface with annotated parameter.
+ */
+ public Builder setAbstractElement(@PluginElement("abstractAppender") final AbstractAppender abstractAppender) {
+ return this;
+ }
+
+ /**
+ * An element with an annotated type.
+ */
+ public Builder setNestedAppender(final @PluginElement("nestedAppender") Appender nestedAppender) {
+ return this;
+ }
+
+ /**
+ * A setter with a varargs type.
+ */
+ public Builder setVarargs(@PluginElement("layouts") final Layout3... layouts) {
+ return this;
+ }
+
+ @Override
+ public MyAppender build() {
+ return null;
+ }
+ }
+
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ public static interface Appender2 {}
+
+ public static interface Layout2 {}
+
+ public static interface Layout3 {}
+
+ public abstract static class LayoutSet implements Set {}
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/MyEnum.java b/log4j-docgen/src/test/resources/processor/v2/example/MyEnum.java
new file mode 100644
index 00000000..4d7afa81
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/MyEnum.java
@@ -0,0 +1,39 @@
+/*
+ * 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 example;
+
+/**
+ * A very important enum.
+ */
+public enum MyEnum {
+ /**
+ * Makes things go boom!
+ */
+ A,
+ /**
+ * A second choice.
+ */
+ B,
+ /**
+ * Value C.
+ */
+ C,
+ /**
+ * Value D.
+ */
+ D;
+}
diff --git a/log4j-docgen/src/test/resources/processor/v2/example/MyOldLayout.java b/log4j-docgen/src/test/resources/processor/v2/example/MyOldLayout.java
new file mode 100644
index 00000000..670b7faa
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v2/example/MyOldLayout.java
@@ -0,0 +1,63 @@
+/*
+ * 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 example;
+
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required;
+
+/**
+ * Example plugin without a builder.
+ */
+@Plugin(name = "MyLayout", category = "Core")
+public final class MyOldLayout implements Layout {
+
+ /**
+ * @param boolAttr A {@code boolean} attribute.
+ * @param byteAttr A {@code byte} attribute.
+ * @param charAttr A {@code char} attribute.
+ * @param doubleAttr A {@code double} attribute.
+ * @param floatAttr A {@code float} attribute.
+ * @param intAttr An {@code int} attribute.
+ * @param longAttr A {@code long} attribute.
+ * @param shortAttr A {@code short} attribute.
+ * @param stringAttr A {@link String} attribute.
+ * @param origName An attribute with overwritten name.
+ * @param enumAttr An {@code enum} attribute.
+ * @param nestedLayout An element with multiplicity {@code 1}.
+ * @param filters An element with multiplicity {@code n}.
+ */
+ @PluginFactory
+ public static MyOldLayout newLayout(
+ final @PluginAttribute(value = "boolAttr", defaultBoolean = false) boolean boolAttr,
+ final @PluginAttribute(value = "byteAttr", defaultByte = 'L') byte byteAttr,
+ final @PluginAttribute(value = "charAttr", defaultChar = 'L') char charAttr,
+ final @PluginAttribute(value = "doubleAttr", defaultDouble = 42.0) double doubleAttr,
+ final @PluginAttribute(value = "floatAttr", defaultFloat = 42.0f) float floatAttr,
+ final @PluginAttribute(value = "intAttr", defaultInt = 424242) int intAttr,
+ final @PluginAttribute(value = "longAttr", defaultLong = 42424242L) long longAttr,
+ final @PluginAttribute(value = "shortAttr", defaultShort = 4242) short shortAttr,
+ final @PluginAttribute("stringAttr") @Required String stringAttr,
+ final @PluginAttribute("otherName") String origName,
+ final @PluginAttribute("enumAttr") MyEnum enumAttr,
+ final @PluginElement("nestedLayout") Layout nestedLayout,
+ final @PluginElement("filters") Filter[] filters) {
+ return null;
+ }
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/AbstractAppender.java b/log4j-docgen/src/test/resources/processor/v3/example/AbstractAppender.java
new file mode 100644
index 00000000..61f1122e
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/AbstractAppender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * An example of base abstract class.
+ */
+public abstract class AbstractAppender implements BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/Appender.java b/log4j-docgen/src/test/resources/processor/v3/example/Appender.java
new file mode 100644
index 00000000..a2045ae7
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/Appender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Extended interface that also allows to do {@code baz}.
+ */
+public interface Appender extends BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/BaseAppender.java b/log4j-docgen/src/test/resources/processor/v3/example/BaseAppender.java
new file mode 100644
index 00000000..e405fec8
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/BaseAppender.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Base interface for appenders.
+ */
+public interface BaseAppender {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/Filter.java b/log4j-docgen/src/test/resources/processor/v3/example/Filter.java
new file mode 100644
index 00000000..6250ce21
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/Filter.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Filters messages.
+ */
+public interface Filter {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/Layout.java b/log4j-docgen/src/test/resources/processor/v3/example/Layout.java
new file mode 100644
index 00000000..5884c6da
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/Layout.java
@@ -0,0 +1,23 @@
+/*
+ * 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 example;
+
+/**
+ * Formats messages.
+ */
+public interface Layout {
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/MyAppender.java b/log4j-docgen/src/test/resources/processor/v3/example/MyAppender.java
new file mode 100644
index 00000000..e6a36c2e
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/MyAppender.java
@@ -0,0 +1,191 @@
+/*
+ * 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 example;
+
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.element.TypeElement;
+import org.apache.logging.log4j.plugins.Namespace;
+import org.apache.logging.log4j.plugins.Plugin;
+import org.apache.logging.log4j.plugins.PluginBuilderAttribute;
+import org.apache.logging.log4j.plugins.PluginElement;
+import org.apache.logging.log4j.plugins.PluginFactory;
+import org.apache.logging.log4j.plugins.validation.constraints.Required;
+
+/**
+ * Example plugin
+ *
+ * This is an example plugin. It has the following characteristics:
+ *
+ *
+ * - Plugin name: {@code MyPlugin},
+ * - Namespace: default (i.e. {@code Core}).
+ *
+ *
+ * It also implements:
+ *
+ *
+ * - {@link Appender},
+ * - {@link BaseAppender}
+ *
+ */
+@Plugin
+@Namespace("namespace")
+public final class MyAppender extends AbstractAppender implements Appender {
+
+ /**
+ * Parent builder with some private fields that are not returned by
+ * {@link javax.lang.model.util.Elements#getAllMembers(TypeElement)}.
+ */
+ public static class ParentBuilder {
+
+ /**
+ * A {@code char} attribute.
+ */
+ @PluginBuilderAttribute
+ private char charAtt = 'L';
+
+ /**
+ * An {@code int} attribute.
+ */
+ @PluginBuilderAttribute
+ private int intAtt = 4242;
+
+ /**
+ * An element with multiplicity 1.
+ */
+ @PluginElement
+ private Layout layout;
+ }
+
+ public static final class Builder extends ParentBuilder
+ implements org.apache.logging.log4j.plugins.util.Builder {
+
+ /**
+ * A {@code short} attribute annotated on type.
+ */
+ private @PluginBuilderAttribute short shortAtt = 42;
+
+ /**
+ * A {@code long} attribute annotated on type.
+ */
+ private @PluginBuilderAttribute long longAtt = 424242L;
+
+ /**
+ * A {@code String} attribute.
+ */
+ @PluginBuilderAttribute
+ @Required
+ private String stringAtt;
+
+ /**
+ * An attribute whose name differs from the field name.
+ */
+ @PluginBuilderAttribute("anotherName")
+ private String origName;
+
+ /**
+ * An attribute that is an enumeration annotated on type.
+ */
+ private @PluginBuilderAttribute MyEnum enumAtt;
+
+ /**
+ * An attribute of type {@code float}.
+ */
+ private @PluginBuilderAttribute float floatAtt;
+
+ /**
+ * An attribute of type {@code double}.
+ */
+ private @PluginBuilderAttribute double aDouble;
+
+ private Object notAnAttribute;
+
+ /**
+ * A collection element.
+ */
+ @PluginElement
+ private List appenderList;
+
+ /**
+ * A set of layouts
+ */
+ @PluginElement
+ private LayoutSet layoutSet;
+
+ /**
+ * A {@code boolean} attribute with annotated type.
+ */
+ public Builder setBooleanAtt(final @PluginBuilderAttribute boolean booleanAtt) {
+ return this;
+ }
+
+ /**
+ * A {@code byte} attribute with annotated parameter.
+ */
+ public Builder setByteAtt(@PluginBuilderAttribute final byte byteAtt) {
+ return this;
+ }
+
+ /**
+ * An element with multiplicity n with annotated setter.
+ */
+ @PluginElement
+ public Builder setFilters(final Filter[] filters) {
+ return this;
+ }
+
+ /**
+ * An element that is not an interface with annotated parameter.
+ */
+ public Builder setAbstractElement(@PluginElement final AbstractAppender abstractAppender) {
+ return this;
+ }
+
+ /**
+ * An element with an annotated type.
+ */
+ public Builder setNestedAppender(final @PluginElement Appender nestedAppender) {
+ return this;
+ }
+
+ /**
+ * A setter with a varargs type.
+ */
+ public Builder setVarargs(@PluginElement final Layout3... layouts) {
+ return this;
+ }
+
+ @Override
+ public MyAppender build() {
+ return null;
+ }
+ }
+
+ @PluginFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ public static interface Appender2 {}
+
+ public static interface Layout2 {}
+
+ public static interface Layout3 {}
+
+ public abstract static class LayoutSet implements Set {}
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/MyEnum.java b/log4j-docgen/src/test/resources/processor/v3/example/MyEnum.java
new file mode 100644
index 00000000..4d7afa81
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/MyEnum.java
@@ -0,0 +1,39 @@
+/*
+ * 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 example;
+
+/**
+ * A very important enum.
+ */
+public enum MyEnum {
+ /**
+ * Makes things go boom!
+ */
+ A,
+ /**
+ * A second choice.
+ */
+ B,
+ /**
+ * Value C.
+ */
+ C,
+ /**
+ * Value D.
+ */
+ D;
+}
diff --git a/log4j-docgen/src/test/resources/processor/v3/example/MyOldLayout.java b/log4j-docgen/src/test/resources/processor/v3/example/MyOldLayout.java
new file mode 100644
index 00000000..41b08c73
--- /dev/null
+++ b/log4j-docgen/src/test/resources/processor/v3/example/MyOldLayout.java
@@ -0,0 +1,63 @@
+/*
+ * 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 example;
+
+import org.apache.logging.log4j.plugins.Factory;
+import org.apache.logging.log4j.plugins.Plugin;
+import org.apache.logging.log4j.plugins.PluginAttribute;
+import org.apache.logging.log4j.plugins.PluginElement;
+import org.apache.logging.log4j.plugins.validation.constraints.Required;
+
+/**
+ * Example plugin without a builder.
+ */
+@Plugin("MyLayout")
+public final class MyOldLayout implements Layout {
+
+ /**
+ * @param boolAttr A {@code boolean} attribute.
+ * @param byteAttr A {@code byte} attribute.
+ * @param charAttr A {@code char} attribute.
+ * @param doubleAttr A {@code double} attribute.
+ * @param floatAttr A {@code float} attribute.
+ * @param intAttr An {@code int} attribute.
+ * @param longAttr A {@code long} attribute.
+ * @param shortAttr A {@code short} attribute.
+ * @param stringAttr A {@link String} attribute.
+ * @param origName An attribute with overwritten name.
+ * @param enumAttr An {@code enum} attribute.
+ * @param nestedLayout An element with multiplicity {@code 1}.
+ * @param filters An element with multiplicity {@code n}.
+ */
+ @Factory
+ public static MyOldLayout newLayout(
+ final @PluginAttribute(defaultBoolean = false) boolean boolAttr,
+ final @PluginAttribute(defaultByte = 'L') byte byteAttr,
+ final @PluginAttribute(defaultChar = 'L') char charAttr,
+ final @PluginAttribute(defaultDouble = 42.0) double doubleAttr,
+ final @PluginAttribute(defaultFloat = 42.0f) float floatAttr,
+ final @PluginAttribute(defaultInt = 424242) int intAttr,
+ final @PluginAttribute(defaultLong = 42424242L) long longAttr,
+ final @PluginAttribute(defaultShort = 4242) short shortAttr,
+ final @PluginAttribute @Required String stringAttr,
+ final @PluginAttribute("otherName") String origName,
+ final @PluginAttribute MyEnum enumAttr,
+ final @PluginElement Layout nestedLayout,
+ final @PluginElement Filter[] filters) {
+ return null;
+ }
+}
diff --git a/log4j-tools-parent/pom.xml b/log4j-tools-parent/pom.xml
index dff618b3..4e0ecf33 100644
--- a/log4j-tools-parent/pom.xml
+++ b/log4j-tools-parent/pom.xml
@@ -38,7 +38,6 @@
2.3.32
1.0.5
5.10.2
- 3.0.0-beta1
2.1.2
2.9.1
@@ -53,14 +52,6 @@
-
- org.apache.logging.log4j
- log4j-bom
- ${log4j-bom.version}
- pom
- import
-
-
org.junit
junit-bom