GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Lombok: support all logger annotations by Pankraz76 · Pull Request #7242 · pmd/pmd

Conversation

@Pankraz76

@Pankraz76 Pankraz76 commented Oct 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Describe the PR

PMD only created the implicit log field for @Slf4j. It now does so for all Lombok logger annotations, with the logger type Lombok uses:

Annotation Type of log
@Slf4j org.slf4j.Logger
@XSlf4j org.slf4j.ext.XLogger
@Log java.util.logging.Logger
@Log4j org.apache.log4j.Logger
@Log4j2 org.apache.logging.log4j.Logger
@CommonsLog org.apache.commons.logging.Log
@JBossLog org.jboss.logging.Logger
@Flogger com.google.common.flogger.FluentLogger

@CustomLog is not supported, as its type is configured in lombok.config.

ImplicitMemberSymbols#lombokSlf4jLoggerField is renamed to lombokLoggerField and takes the logger type (internal API).

Related issues

  • Refs [java] Better Lombok support #3119

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
[java] Lombok: support all logger annotations
ea85b79
Besides @slf4j, also create the log field for @XSlf4j, @log, @log4j,
@log4j2, @CommonsLog, @JBossLog and @flogger. @CustomLog is not
supported, as its type is configured in lombok.config.

Refs pmd#3119

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PPz9uxrZpT8ysmD5A2Fgg5
@Pankraz76
Pankraz76 marked this pull request as ready for review October 26, 2026 07:51
@Pankraz76 Pankraz76 mentioned this pull request Oct 26, 2026
[java] Better Lombok support #3119
Open
@pmd-actions-helper

pmd-actions-helper Bot commented Oct 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-10-26 15:42:46+00:00 for 1fd8524)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

oowekyala
oowekyala reviewed Oct 26, 2026
View reviewed changes
Comment thread pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/ast/AstClassSym.java Outdated
*
* @see <a href="https://projectlombok.org/features/log">Lombok @Log</a>
*/
private static final Map<String, String> LOMBOK_LOGGERS = CollectionUtil.buildMap(m -> {

@oowekyala oowekyala Oct 26, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think these lombok changes are good and sensible. But we cannot keep piling this lombok-specific logic into AstClassSym.

I think we should extract this into a LombokUtil or something and also move there the parts of ImplicitMemberSymbols that are lombok-specific. Maybe we can do that in a followup PR though.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Pankraz76 Pankraz76 Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, good point. I did it right away in this PR instead of a follow-up:

  • New package-private LombokUtil (in symbols.internal.ast) now holds all Lombok-specific logic: the logger map, the logger field, the getter generation and the AccessLevel parsing.
  • AstClassSym#processLombok now only delegates to LombokUtil.addLombokMembers(...).
  • ImplicitMemberSymbols has no Lombok-specific code anymore. lombokLoggerField/lombokGetter are replaced by two generic factories, fakeField(...) and fakeMethod(...), which LombokUtil uses.

No behaviour change, all tests are still green.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
[java] Extract lombok-specific symbol logic into LombokUtil
1fd8524
Move the lombok logger and getter handling out of AstClassSym and
ImplicitMemberSymbols into a new package-private LombokUtil.
ImplicitMemberSymbols now only offers the generic fakeField and
fakeMethod factories. No behaviour change.

Refs pmd#3119

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PPz9uxrZpT8ysmD5A2Fgg5
@Pankraz76
Pankraz76 requested a review from oowekyala October 26, 2026 15:25
@adangel adangel mentioned this pull request Nov 13, 2026
[java] Fix #7214: ClassWithOnlyPrivateConstructorsShouldBeFinal: consider Lombok private constructors #7231
Open
4 tasks done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@oowekyala oowekyala Awaiting requested review from oowekyala

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Pankraz76 @oowekyala @claude
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.