GeezerVison is showing github.com — [core] PMDConfiguration - "Can't mix setClasspath with getAuxClasspath!" · Issue #7013 · pmd/pmd
[core] PMDConfiguration - "Can't mix setClasspath with getAuxClasspath!" #7013
Labels
a:bugPMD crashes or fails to analyse a file. Description
Affects PMD Version:
7.27.0
Description:
Call PMDConfiguration#setClassLoader and do an analysis PmdAnalysis.create(pmdConfig) → Crashes
Exception Stacktrace:
2026-08-31 09:20:49,922 [ 94383] SEVERE - #software.xdev.pmd.annotator.PMDExternalLanguageAnnotator - Failed to annotate
java.lang.IllegalStateException: Can't mix setClasspath with getAuxClasspath!
at net.sourceforge.pmd.PMDConfiguration.getAuxClasspath(PMDConfiguration.java:353)
at net.sourceforge.pmd.PmdAnalysis.create(PmdAnalysis.java:221)
at software.xdev.pmd.analysis.PMDAnalyzer.analyzeInternal(PMDAnalyzer.java:203)
...
Code Sample demonstrating the issue:
See above
Steps to reproduce:
See above
Running PMD through: Other
Activity
UncleOwen commented on Aug 31, 2026
Can't reproduce. The following test is green.
@Test
void testCreateConfigWithCustomClasspath() {
PMDConfiguration config = new PMDConfiguration();
config.setClassLoader(this.getClass().getClassLoader());
assertDoesNotThrow(() -> PmdAnalysis.create(config));
}AB-xdev commented on Aug 31, 2026
@UncleOwen Is this test executed using a JvmLanguagePropertyBundle? You probably need to configure a language like Java because otherwise the condition might not be triggered - at least as far as I have seen in the code...
UncleOwen commented on Aug 31, 2026
Ah, I took your problem description a bit too literal. Now I can reproduce.
@Test
void testCreateConfigWithCustomClasspath() {
LanguageRegistry registry = new LanguageRegistry(setOf(new FakeJvmLanguageModule()));
PMDConfiguration config = new PMDConfiguration(registry);
config.setClassLoader(this.getClass().getClassLoader());
assertDoesNotThrow(() -> PmdAnalysis.create(config));
}
private static class FakeJvmLanguageModule extends DummyLanguageModule {
@Override
public LanguagePropertyBundle newPropertyBundle() {
return new JvmLanguagePropertyBundle(this);
}
}changed the title
[-]"Can't mix setClasspath with getAuxClasspath!"[/-] [+][core] PMDConfiguration - "Can't mix setClasspath with getAuxClasspath!"[/+] on Aug 31, 2026added a commit that references this issue
on Sep 3, 2026This issue will close once commit 65dca5e is merged into the 'main' branch.65dca5e
Metadata
Metadata
a:bugPMD crashes or fails to analyse a file. Development
No branches or pull requestsIssue actions