GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [kotlin] Fix #6677: Add auxClasspath language property by stokpop · Pull Request #6678 · pmd/pmd

Conversation

@stokpop

@stokpop stokpop commented May 14, 2026 •
edited by adangel
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Changes

  • KotlinLanguageModule now uses JvmLanguagePropertyBundle so --aux-classpath is accepted for Kotlin analysis
  • New KotlinLanguageProcessor + KotlinAuxClasspathResolver: resolves classpath entries via the language property auxClasspath

Related issues/PRs

  • Fixes [kotlin] Add auxClasspath language property #6677
  • Related to [kotlin] Kotlin types support #6645

Follow-up

  • KotlinNode DataMap keys (TYPE_NAME_KEY, RETURN_TYPE_KEY, ANNOTATION_NAMES_KEY) + accessors — API contract for the kotlin-type-mapper to populate
  • KotlinHandler refactored to XPathHandlerHolder pattern (deferred init); XPath functions registered in follow-up PRs
  • XPath functions (hasAnnotation, hasImport) and full kotlin-type-mapper integration are in separate PRs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jborgers reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@stokpop
Add auxclasspath support and type-mapper infrastructure for Kotlin
f1edf89
Wire JvmLanguagePropertyBundle so --aux-classpath is accepted for Kotlin analysis.
Introduce KotlinLanguageProcessor and KotlinAuxClasspathResolver (3-tier resolution:
string property, URLClassLoader hierarchy, java.class.path system property).
Note pmd#4953 TODO on getAnalysisClassLoader() tier for future deprecation.

Add DataMap keys to KotlinNode ready for type-mapper population:
- TYPE_NAME_KEY: resolved type FQN for PropertyDeclaration / UnescapedAnnotation
- RETURN_TYPE_KEY: resolved return type FQN for FunctionDeclaration
- ANNOTATION_NAMES_KEY: comma-separated FQN annotation names on declaration nodes

Refactor KotlinHandler to use XPathHandlerHolder pattern (deferred init).
XPath functions (hasAnnotation, hasImport, etc.) registered in a follow-up PR.
@stokpop
stokpop force-pushed the feature/kotlin-auxclasspath-standalone branch from 40df60d to f1edf89 Compare May 14, 2026 12:50
@pmd-actions-helper

pmd-actions-helper Bot commented May 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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 0 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-06-18 13:25:05+00:00 for d9c36f4)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stokpop added 2 commits May 30, 2026 06:55
@stokpop
Merge branch 'main' into feature/kotlin-auxclasspath-standalone
b70c2ee
@stokpop
[kotlin] filter null XPath attributes to support unset DataKey methods
2258919
getTypeName() and getReturnTypeName() on KotlinNode return null before type
analysis runs. Filter them out so they do not appear as null XPath attributes.
Update Simple.txt reference dump accordingly.
@stokpop
stokpop marked this pull request as draft May 30, 2026 07:41
stokpop added 6 commits May 30, 2026 07:47
@stokpop
[kotlin] introduce KotlinTypeMapper as contract for type-mapper data …
22b051e
…keys
@stokpop
[kotlin] move KotlinTypeMapper to types package
6d9007a
@stokpop
Merge remote-tracking branch 'origin/main' into feature/kotlin-auxcla…
bffdeb3
…sspath-standalone
@stokpop
[kotlin] rename KotlinTypeMapper to KotlinNodeTypeData
d75d80b
@stokpop
Merge branch 'main' into feature/kotlin-auxclasspath-standalone
289c5e2
@stokpop
[kotlin] add tests for KotlinAuxClasspathResolver
78bff77
@stokpop
stokpop marked this pull request as ready for review June 8, 2026 10:00
@stokpop
[kotlin] remove unused import in KotlinAuxClasspathResolverTest
c19dbce
@stokpop

stokpop commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Hi @adangel, this PR is reworked to move as much as possible the code from KotlinNode, in line with previous related merged PRs. Can you please have a look? I think this is the next step to get to type awareness in Kotlin rules.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adangel
adangel requested changes Jun 12, 2026
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the PR.

Let's scope this PR down to just "[kotlin] Add auxclasspath language property" and add the KotlinNodeTypeData with the PR, that actually uses it.

So in short:

  1. Please remove KotlinNodeTypeData from this PR
  2. Make KotlinAuxClasspathResolver simpler to only support one way of configuring aux classpath.
  3. Refactor KotlinAuxClasspathResolver#resolve to return List<Path> instead of List<File>
  4. Add documentation about the new auxclasspath language property for Kotlin

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stokpop reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinNodeTypeData.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinNodeTypeData.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinNodeTypeData.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinNodeTypeData.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/test/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolverTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/types/KotlinNodeTypeData.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adangel

adangel commented Jun 12, 2026

Copy link
Copy Markdown
Member

XPath functions (hasAnnotation, hasImport) and full kotlin-type-mapper integration are in separate PRs.

The XPath functions can only be added, when you have types... So, I guess, the next PR should then focus on integrating kotlin-type-mapper, adding the additional AST processing phase and put the types into the nodes.

Also note: The types you have designed now are simple Strings... is this what you want? At some point, rules probably want to query something like "what are the methods of this type", or "is this type a subtype of this other type". Depending on the use cases, Strings are maybe too simple... (Note: I didn't look at all into #6645 - so not sure what use cases you already implemented).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stokpop

stokpop commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review! I will go through each of the points.

The three "tiers" of classpath handling were there for three usages:

  • via pmd check,
  • in the PMD Designer,
  • for running test cases

If both Designer and tests can use the same approach we can indeed consolidate on one way.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stokpop added 4 commits June 16, 2026 14:33
@stokpop
refactor(kotlin): remove KotlinNodeTypeData from auxclasspath PR
d813147
Scope this PR down to auxclasspath language property only.
KotlinNodeTypeData will be added with the PR that actually uses it
(kotlin-type-mapper integration).
@stokpop
refactor(kotlin): simplify KotlinAuxClasspathResolver to single auxCl…
d345750
…asspath property

Only support the auxClasspath language property; remove URLClassLoader
hierarchy and java.class.path fallbacks. Returns List<Path> instead of
List<File>. Update tests accordingly.
@stokpop
fix(kotlin): warn when auxClasspath not configured; use tempDir in tests
ac35e54
- Log warning when auxClasspath is empty so users know type resolution
  will not work
- Use tempDir.resolve() for non-existent paths in tests for determinism

docs(kotlin): add auxclasspath section and language property entry

Add "Providing the auxiliary classpath" section to kotlin.md and add
auxClasspath entry to language_properties.md. Since 7.26.0.
@stokpop
refactor(kotlin): revert XPathHandler holder-class — not needed in th…
86e14d7
…is PR

Holder-class pattern belongs with the PR that adds XPath functions.
@adangel adangel changed the title [kotlin] Add auxclasspath support and type-mapper infrastructure (#6677) [kotlin] Add auxclasspath language property (#6677) Jun 18, 2026
@adangel adangel changed the title [kotlin] Add auxclasspath language property (#6677) [kotlin] Fix #6677: Add auxclasspath language property Jun 18, 2026
@adangel
Use File.pathSeparator
861ba3e
@adangel adangel changed the title [kotlin] Fix #6677: Add auxclasspath language property [kotlin] Fix #6677: Add auxClasspath language property Jun 18, 2026
adangel added 2 commits June 18, 2026 15:07
@adangel
[doc] Update release notes (pmd#6677, pmd#6678)
5c8d088
@adangel
Merge branch 'main' into pr-6678
d9c36f4
@adangel adangel added this to the 7.26.0 milestone Jun 18, 2026
adangel
adangel approved these changes Jun 18, 2026
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, looks good!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pmd-kotlin/src/main/java/net/sourceforge/pmd/lang/kotlin/KotlinAuxClasspathResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adangel
adangel merged commit 2c11a15 into pmd:main Jun 18, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@stokpop stokpop mentioned this pull request Jun 20, 2026
[kotlin] Add kotlin-type-mapper infrastructure #6795
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

7.26.0

Development

Successfully merging this pull request may close these issues.

[kotlin] Add auxClasspath language property

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@stokpop @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.