Skip to content

[java] Fix #6010: Add replacement for ClasspathClassloader - #6859

Merged
adangel merged 46 commits into
pmd:mainfrom
adangel:java/issue-6010-auxclasspathloader
Aug 20, 2026
Merged

adangel merged 46 commits into
pmd:mainfrom
adangel:java/issue-6010-auxclasspathloader

Conversation

@adangel

@adangel adangel commented Jul 9, 2026 •

Copy link
Copy Markdown
Member

Describe the PR

This creates an alternative implementation for the ClasspathClassloader, which is not anymore using URLClassloader in the background. This allows us to control when files are closed ourselves. As it using only ZipFile and not JarFile with verify=true (like URLClassloader), this also solves the OOM reported in #6010.

While this PR works on its own, it is not quite ready yet:

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)

adangel added 6 commits July 9, 2026 14:54
Instead, use new AuxClasspathLoader, which will replace
ClasspathClassLoader (an internal class).

Might fix pmd#6010
This is especially needed for RuleTst.
So that JvmLanguageProperty.AUX_CLASSPATH is wired...
Cache the information whether the entry is a file or directory,
to avoid asking the filesystem over and over again.
@adangel adangel added this to the 7.27.0 milestone Jul 9, 2026
@adangel adangel added the is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them label Jul 9, 2026
@pmd-actions-helper

pmd-actions-helper Bot commented Jul 9, 2026 •

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 5 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-08-20 09:48:10+00:00 for 1bd2fd6)

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can see no obvious issues.

#6010 is definitely fixed, I retried my repro and it doesn't crash anymore. So that's good.

@stokpop stokpop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

proposed some possible concurrency improvements and extra cleanup in LRU construct

@adangel adangel mentioned this pull request Aug 13, 2026
4 tasks
@adangel
adangel merged commit cb6e772 into pmd:main Aug 20, 2026
13 checks passed
@adangel
adangel deleted the java/issue-6010-auxclasspathloader branch August 20, 2026 10:24
adangel added a commit that referenced this pull request Sep 24, 2026
Regression has been introduced with cb6e772 (#6859).
Solution is to first expand the given classpath (in case
it is a file: URL) and only after that add the platform
classpath, if it is needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

is:deprecation The main focus is deprecating public APIs or rules, eg to make them internal, or removing them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] java.lang.OutOfMemoryError: Java heap space when accessing big Jar files with PMD 7

3 participants