Skip to content

Conversation

@oowekyala
Copy link
Member

Describe the PR

Parsing the class file of an anonymous class was not populating the simple name, causing an NPE. I'm not sure why an anonymous class was parsed at all, but this crash occurred when analysing JDK sources.

Related issues

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)

Sample that would cause the crash is

enum Foo {
  A { }
}

and parsing class Foo$1.class. The simple name was not being populated.
@github-actions
Copy link

github-actions bot commented Mar 11, 2025

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.

Regression Tester Report

@oowekyala oowekyala force-pushed the fix-anon-class-loading branch from 41cac7c to e8e771d Compare March 12, 2025 16:47
@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Mar 13, 2025
@adangel adangel added this to the 7.12.0 milestone Mar 13, 2025
Copy link
Member

@adangel adangel left a comment

Choose a reason for hiding this comment

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

Thanks!

@adangel adangel merged commit 9f54da9 into pmd:main Mar 13, 2025
12 checks passed
@oowekyala oowekyala deleted the fix-anon-class-loading branch March 13, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:bug PMD crashes or fails to analyse a file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants