Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Cache invalidation - auxClasspath or classpath? #1025

Closed
fflatorre opened this issue Apr 5, 2018 · 2 comments
Closed

[java] Cache invalidation - auxClasspath or classpath? #1025

fflatorre opened this issue Apr 5, 2018 · 2 comments
Labels
a:question Request for information that doesn't necessarily entail changes to the code base

Comments

@fflatorre
Copy link

fflatorre commented Apr 5, 2018

Please tag this issue as a question.

Hi,

I'm trying to gt my head around on when the cache gets invalidated.

In the official documentation, among the other reasons, it's mentioned teh cache is invalidated for a change in the auxclasspath :
https://pmd.github.io/pmd-6.0.0/pmd_release_notes_old.html#22-april-2017---560

We are not setting the "auxclasspath" as mentioned in the guide here :
https://pmd.github.io/pmd-6.2.0/pmd_userdocs_tools_ant.html

However, looking at the code :
https://github.com/pmd/pmd/blob/71df067a0dbd27ef78e4c82ca7cc58fd138f65c3/pmd-core/src/main/java/net/sourceforge/pmd/cache/FileAnalysisCache.java

it looks like that is the classpath instead that gets check-summed and then persisted/retrieved from the cache file.

Can anyone please clarify this aspect ?

Cheers,
Francesco

Affects PMD Version:
6.2.0
Rule:
NA
Description:
NA
Code Sample demonstrating the issue:

NA

Running PMD through: [Ant]

@jsotuyod jsotuyod added the a:question Request for information that doesn't necessarily entail changes to the code base label Apr 5, 2018
@jsotuyod
Copy link
Member

jsotuyod commented Apr 5, 2018

@fflatorre over the last few releases the feature has matured a lot. Currently the cache is completely invalidated if

  1. The ruleset changed
    LOG.info("Analysis cache invalidated, rulesets changed.");
  2. The auxclasspath changed
    LOG.info("Analysis cache invalidated, auxclasspath changed.");
  3. The execution classpath chamged
    LOG.info("Analysis cache invalidated, execution classpath changed.");

So, under current releases, both the auxclasspath AND the java classpath invalidates the cache. Moreover, the old code just checked the value of the auxclasspath (file1.jar:file2.jar), but current releases actually check both the order and the contents.

Let me know if you have any questions

@jsotuyod jsotuyod closed this as completed Apr 5, 2018
@fflatorre
Copy link
Author

Cheers @jsotuyod I got lost between releases.
So pull request #687 resolves issue #603 released on 6.1.0 which is the bit I was missing.

Great job !
Francesco

@adangel adangel changed the title [java] (a:question) Cache invalidation - auxClasspath or classpath ? [java] Cache invalidation - auxClasspath or classpath? Jan 7, 2021
@pmd pmd locked and limited conversation to collaborators Jan 15, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
a:question Request for information that doesn't necessarily entail changes to the code base
Projects
None yet
Development

No branches or pull requests

2 participants