Skip to content

Conversation

jvz
Copy link
Member

@jvz jvz commented Aug 11, 2025

This fixes #3870

@jvz jvz added this to the 3.0.0-beta4 milestone Aug 11, 2025
@jvz jvz requested a review from ppkarwasz August 11, 2025 16:18
@jvz jvz added plugins Affects the plugin system minor API change labels Aug 11, 2025
@jvz jvz closed this Aug 11, 2025
@jvz jvz reopened this Aug 11, 2025
@jvz jvz closed this Aug 13, 2025
@jvz jvz reopened this Aug 13, 2025
@ppkarwasz
Copy link
Contributor

Hi @jvz,

Don't worry, I have seen your PR, but until the end of the week I don't really have the time to review it.

@jvz
Copy link
Member Author

jvz commented Aug 13, 2025

I'm trying to get the build to work 😆

@ppkarwasz
Copy link
Contributor

The MacOS failure is due to a problem in the Maven Wrapper script.
It was fixed in #3676 for 2.x, but never ported.

@jvz
Copy link
Member Author

jvz commented Aug 18, 2025

Now it seems there's a Windows-specific build issue related to TLS settings.

Copy link
Member

@vy vy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvz, +93/-615 LoC is impressive! 💯 I've some questions that I will appreciate it if you can help with.

Comment on lines +25 to +29
/**
* Marks another annotation as one providing a name for an object. The name is obtained from
* the annotation element named {@code value}. This element can be a {@code String} or {@code String[]}.
* When specified as an array, the first element is used.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marks another annotation as one providing a name for an object.

Oookay... PluginElement, PluginValue, etc. are NameProviders. Got it.

The name is obtained from the annotation element named value.
This element can be a String or String[].
When specified as an array, the first element is used.

I am totally lost here. Would you mind elaborating on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try. The idea here is that an annotation like @Named(String[] value) can specify both the name (the first element of the array) and additional aliases (the rest of the array). However, some annotations like @PluginAliases(String[] value) use the whole array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Got it!

Suggested change
/**
* Marks another annotation as one providing a name for an object. The name is obtained from
* the annotation element named {@code value}. This element can be a {@code String} or {@code String[]}.
* When specified as an array, the first element is used.
*/
/**
* Marks another annotation as one providing a name for an object.
* The name is obtained from the annotation element named {@code value}.
* This element can be a {@code String} or {@code String[]}.
* When specified as an array, the first element is used.
* <h2>Examples:</h2>
* <ul>
* <li>{@code @NameProvider @Named(String value)} - {@code value} will be used as the name
* <li>{@code @NameProvider @PluginAliases(String[] value)} - {@code value[0]} will be used as the name
* </ul>
*/

@NameProvider(NamedQualifierNameProvider.class)
@AliasesProvider(NamedQualifierNameProvider.class)
@NameProvider
@AliasesProvider(offset = 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by offset and its function. (Yes, I've read its Javadoc.) Would you mind explaining it a little bit more, please?

@@ -23,7 +23,7 @@
import java.lang.annotation.Target;

/**
* Annotations to separate {@link org.apache.logging.log4j.plugins.name.NameProvider} names into namespaces.
* Annotations to separate {@link NameProvider} names into namespaces.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "NameProvider names" mean? "Names provided by NameProviders"?

Comment on lines 27 to 28
* For example, the {@linkplain Configurable Core namespace} is used with the {@link Node} API, while the TypeConverter
* namespace is used with the {@link org.apache.logging.log4j.plugins.convert.TypeConverter} API.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this example needs to be explained more.

@@ -53,7 +53,7 @@ Injection points are injectable fields or parameters where a dependency should b
_Injectable fields_ are fields annotated with `@Inject` or a qualifier annotation.
_Injectable methods_ are methods annotated with `@Inject` or are not annotated with a factory annotation and have at least one parameter annotated with a qualifier annotation.
_Injectable constructors_ are constructors annotated with `@Inject`; only one such constructor should exist per class.
When a field or parameter is annotated with a name-providing annotation (i.e., an annotation annotated with `@org.apache.logging.log4j.plugins.name.NameProvider`), then the provided name or name of the field or parameter are included in the `Key<T>` for the injection point.
When a field or parameter is annotated with a name-providing annotation (i.e., an annotation annotated with `@org.apache.logging.log4j.plugins.NameProvider`), then the provided name or name of the field or parameter are included in the `Key<T>` for the injection point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When a field or parameter is annotated with a name-providing annotation (i.e., an annotation annotated with `@org.apache.logging.log4j.plugins.NameProvider`), then the provided name or name of the field or parameter are included in the `Key<T>` for the injection point.
When a field or parameter is annotated with `@NameProvider`, then the provided name or name of the field or parameter are included in the `Key<T>` for the injection point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as bundles which are instances or injectable Class<T> instances that contain one or more annotated factory methods.

"Bundle" is a very convoluted term in the Java ecosystem. Above statement literally describes a "factory collection/set", which we can consider replacing bundle with as a more self-explanatory term.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called it "module" before as the concept is borrowed from Guice, but that gets confusing with Java modules. They're similar to spring @Configuration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave the decision to you. You can resolve this conversation as you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor API change plugins Affects the plugin system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants