Skip to content

refactor: Remove custom JavaProject cache#432

Merged
adangel merged 2 commits into
pmd:mainfrom
adangel:refactor-remove-jproject-cache
Jul 2, 2026
Merged

refactor: Remove custom JavaProject cache#432
adangel merged 2 commits into
pmd:mainfrom
adangel:refactor-remove-jproject-cache

Conversation

@adangel

@adangel adangel commented Jul 2, 2026

Copy link
Copy Markdown
Member

I've seen some test failure with the error message:

net.sourceforge.pmd.eclipse.ui.dialogs.ViolationDetailsDialogTest.openDialogViaProblemView -- Time elapsed: 0.094 s <<< ERROR!
java.lang.IllegalArgumentException: Path must include project and resource name: /ViolationDetailsDialogTest
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:68)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2274)
	at org.eclipse.core.internal.resources.Container.getFolder(Container.java:216)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesImpl.determineBuildPathIncludesExcludes(ProjectPropertiesImpl.java:93)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesImpl.<init>(ProjectPropertiesImpl.java:83)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.PropertiesFactoryImpl.newProjectProperties(PropertiesFactoryImpl.java:32)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadProjectProperties(ProjectPropertiesManagerImpl.java:87)
	at net.sourceforge.pmd.eclipse.ui.dialogs.ViolationDetailsDialogTest.setUp(ViolationDetailsDialogTest.java:59)

I don't think, caching these instances is the correct way. If JavaCore.create() is slow, then the caching should happen in eclipse framework, and not in the PMD plugin itself.

The difference is: The cache might contain a project, whose dependent projects are closed, which could result in wrong analysis. JavaCore.create() opens all dependent projects as a side-effect.

The test failure happens only sporadically. So - if with this change all other tests work find, I'll just merge this PR.

@adangel adangel force-pushed the refactor-remove-jproject-cache branch from d29b9dc to 1c6d996 Compare July 2, 2026 14:21
@adangel adangel added this to the 7.27.0 milestone Jul 2, 2026
@adangel adangel merged commit ab39a41 into pmd:main Jul 2, 2026
6 checks passed
@adangel adangel deleted the refactor-remove-jproject-cache branch July 2, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant