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 — RM-37163: CPD 7.21.0 upgrade by wener-tiobe · Pull Request #8 · tiobe/CPD

Conversation

@wener-tiobe

@wener-tiobe wener-tiobe commented Feb 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Describe the PR

Related issues

  • Fixes #

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)

Sorry, something went wrong.

Uh oh!

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

All reactions
oowekyala and others added 30 commits December 17, 2025 15:09
@oowekyala
Fix pmd#6330 - cannot access Chars attribute from XPath
26c632b
@dependabot
chore(deps): bump actions/upload-artifact from 5.0.0 to 6.0.0 (pmd#6331)
27284fb
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@330a01c...b7c566a)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump org.mockito:mockito-core from 5.20.0 to 5.21.0 (pmd…
709956f
…#6332)

Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.20.0 to 5.21.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.20.0...v5.21.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-version: 5.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump actions/download-artifact from 6.0.0 to 7.0.0 (pmd#…
5f9a321
…6333)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@018cc2c...37930b1)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump ruby/setup-ruby from 1.269.0 to 1.270.0 (pmd#6334)
0085eed
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.269.0 to 1.270.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](ruby/setup-ruby@d697be2...ac793fd)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-version: 1.270.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump com.puppycrawl.tools:checkstyle from 12.2.0 to 12.3…
0e3bbfd
….0 (pmd#6335)

Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.2.0 to 12.3.0.
- [Release notes](https://github.com/checkstyle/checkstyle/releases)
- [Commits](checkstyle/checkstyle@checkstyle-12.2.0...checkstyle-12.3.0)

---
updated-dependencies:
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-version: 12.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump actions/cache from 4.3.0 to 5.0.1 (pmd#6336)
4d601c2
Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@0057852...9255dc7)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump bigdecimal from 3.3.1 to 4.0.0 in /docs (pmd#6337)
7147ccd
Bumps [bigdecimal](https://github.com/ruby/bigdecimal) from 3.3.1 to 4.0.0.
- [Release notes](https://github.com/ruby/bigdecimal/releases)
- [Changelog](https://github.com/ruby/bigdecimal/blob/master/CHANGES.md)
- [Commits](ruby/bigdecimal@v3.3.1...v4.0.0)

---
updated-dependencies:
- dependency-name: bigdecimal
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump org.apache.maven.plugins:maven-release-plugin from …
08c48d5
…3.2.0 to 3.3.1 (pmd#6339)

chore(deps): bump org.apache.maven.plugins:maven-release-plugin

Bumps [org.apache.maven.plugins:maven-release-plugin](https://github.com/apache/maven-release) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-release/releases)
- [Commits](apache/maven-release@maven-release-3.2.0...maven-release-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-release-plugin
  dependency-version: 3.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dependabot
chore(deps): bump org.apache.maven.plugins:maven-source-plugin from 3…
4d0382c
….3.1 to 3.4.0 (pmd#6341)

chore(deps): bump org.apache.maven.plugins:maven-source-plugin

Bumps [org.apache.maven.plugins:maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/apache/maven-source-plugin/releases)
- [Commits](apache/maven-source-plugin@maven-source-plugin-3.3.1...maven-source-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-source-plugin
  dependency-version: 3.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@adangel
[doc] Update release notes (pmd#5043, pmd#6285)
8a200d9
@adangel
[java] Fix pmd#5043: FP in LambdaCanBeMethodReference when method ref…
cf4bfff
… would be ambiguous (pmd#6285)
@adangel
[doc] Update release notes
f5964a4
@adangel
[doc] Update release notes (pmd#6230, pmd#6287)
2dcab60
@adangel
[doc] Explain how to build or pull snapshot dependencies for single m…
51d3a14
…odule builds (pmd#6287)
@adangel
[doc] Update release notes (pmd#6279, pmd#6288)
f66b2a6
@adangel
[java] Fix pmd#6279: EmptyMethodInAbstractClassShouldBeAbstract shoul…
48c8038
…d ignore final methods (pmd#6288)
@adangel
[java] MissingStaticMethodInNonInstantiatableClass: Test for pmd#6343
5b61ebd
@adangel
[java] Add suppression for MissingStaticMethodInNonInstantiatableClass
0234ad3
@adangel
[java] NullAssignment: remove unnecessary check for ctor
9e59c20
@adangel
[doc] Update release notes (pmd#6276, pmd#6293)
be9f2fd
@adangel
[java] Fix pmd#6276: NullAssignment should not report assigning null …
f2b2f7f
…to a final field in a constructor (pmd#6293)
@adangel
[java] EnumComparison - update test description
2f49d6d
@adangel
[doc] Update release notes (pmd#6291, pmd#6343, pmd#6292)
d348ab7
@adangel
[java] Fix pmd#6291: EnumComparison FP when comparing with null (pmd#…
1044d78
…6292)
@adangel
[doc] Update release notes (pmd#6028, pmd#6294)
36d255b
@adangel
[java] Fix pmd#6028: UnusedPrivateMethod FP (pmd#6294)
e9579d7
@adangel
Update javadoc apinote
2c49680
@adangel
[doc] Update release notes (pmd#6330, pmd#6342)
bbb7438
@adangel
[core] Fix pmd#6330: Cannot access Chars attribute from XPath (pmd#6342)
e50ac05
adangel and others added 21 commits January 29, 2026 12:57
@adangel
[java] Fix pmd#6364: Parse error with yield lambda (pmd#6430)
569068a
@adangel
[java] PublicMembersInNonPublicType: Update rule description
2e36c29
@adangel
[doc] Update release notes (pmd#6231)
21d6ee5
@adangel
[java] New Rule: PublicMemberInNonPublicType (pmd#6231)
dea1a98
@adangel
[java] New Rule: UnsupportedJdkApiUsage (pmd#6232)
237f5cf
@adangel
chore: update javadoc internal API tags
0408eb6
Add an apiNote
@adangel
chore: update internal API notes
a0751c0
@adangel
chore: @APinote -> @internalapi
6751d43
@adangel
[doc] ADR 3: Clarify javadoc tags
c90cd52
Add details on how to use javadoc tags for deprecated, experimental
and internal APIs.
@adangel
chore: add full description to internalApi javadoc
7dcfeea
@adangel
chore: update javadoc experimental tags
8fb286a
Add the since version separately.
@adangel
chore: update javadoc deprecated tags
e7d9729
All deprecated infos should contain the version, since the
element has been deprecated.
@adangel
chore: update javadoc deprecated tags (pmd#6389)
c4c1edb
@adangel
chore: update javadoc experimental tags (pmd#6390)
75fb5eb
@adangel
chore: update javadoc internal API tags (pmd#6391)
840a29f
@adangel
[doc] ADR 3: Clarify javadoc tags (pmd#6392)
ed0838b
@adangel
[doc] chore: add keywords for auxclasspath in Java documentation (pmd…
e91caec
…#6429)

Refs pmd#5064
@adangel
Prepare pmd release 7.21.0
8fcf973
@adangel
[release] prepare release pmd_releases/7.21.0
4558030
@wener-tiobe
Merge tag 'pmd_releases/7.21.0' into tiobe_pmd7
1bcb449
[release] copy for tag pmd_releases/7.21.0
@wener-tiobe
37163: Upgraded CPD to 7.21.0.
9b0dc2b
@wener-tiobe wener-tiobe changed the title 37163 cpd 7.21.0 upgrade RM-37163: cpd 7.21.0 upgrade Feb 4, 2026
@wener-tiobe wener-tiobe changed the title RM-37163: cpd 7.21.0 upgrade RM-37163: CPD 7.21.0 upgrade Feb 4, 2026
@wener-tiobe
wener-tiobe requested a review from brouwers-tiobe February 4, 2026 14:45
brouwers-tiobe
brouwers-tiobe reviewed Feb 4, 2026
View reviewed changes

@brouwers-tiobe brouwers-tiobe 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.

Changes after merge (in 9b0dc2b) make sense, updating the version for modules exclusive to TIOBE and fixing remaining code issues.

LGTM!

Sorry, something went wrong.

Uh oh!

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

All reactions
@brouwers-tiobe
brouwers-tiobe self-requested a review February 4, 2026 14:58
brouwers-tiobe
brouwers-tiobe approved these changes Feb 4, 2026
View reviewed changes
@wener-tiobe
wener-tiobe merged commit 6a1959a into tiobe_pmd7 Feb 10, 2026
16 of 17 checks passed

Uh oh!

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

@wener-tiobe
wener-tiobe deleted the 37163-CPD-7.21.0-upgrade branch February 10, 2026 08:12
wener-tiobe pushed a commit that referenced this pull request Oct 16, 2026
@stokpop @adangel
[kotlin] Add kotlin-type-mapper infrastructure (pmd#6795)
ca57d1e
* feat(kotlin): add KotlinNodeTypeData with package-private setters and InternalApiBridge

KotlinNodeTypeData stores type-mapper results on AST nodes via DataMap.
Setters are package-private; InternalApiBridge exposes them to callers
outside the types package (e.g. KotlinLanguageProcessor).

* feat(kotlin): add KotlinTypeAnalysisContext and holder with kotlin-type-mapper deps

Add KotlinTypeAnalysisContext (indexes call sites, declarations, type
hierarchy from TypedAst) and KotlinTypeAnalysisContextHolder (global +
thread-local slots). Add kotlin-type-mapper-model and -analyzer deps.

* feat(kotlin): integrate kotlin-type-mapper AST annotation phase

Add KotlinTypeAnnotationVisitor, AnnotationAttributeAnnotator, and
DelegationSpecifierAnnotator to walk parsed ASTs and set @typename /
@ReturnTypeName attributes on declaration nodes. KotlinLanguageProcessor
now runs kotlin-type-mapper before parsing and annotates each file via
InternalApiBridge; falls back gracefully when no auxClasspath is set.

* test(kotlin): expand KotlinTypeAnnotationVisitorTest to full visitor coverage

9 tests covering all node types with specific type assertions:
PropertyDeclaration, FunctionDeclaration, CatchBlock, ForStatement (loop var
+ collection param), ClassParameter, ClassDeclaration (simple name without
package; FQN with package declaration), annotation FQN. Uses
KotlinParsingHelper for production-like parsing.

* fix(kotlin): upgrade ktm to 0.5.1, fix NPE, add missing tests

- Upgrade kotlin-type-mapper deps from 0.5.1-SNAPSHOT to 0.5.1
- Add delegation specifier tests (superclass + interface) to KotlinTypeAnnotationVisitorTest
- Add KotlinAuxClasspathIntegrationTest: end-to-end auxClasspath flow
- Remove KotlinNodeTypeDataTest.typeInfoAvailableFalseWhenNotSet (always failed)
- Add KotlinTypeAnalysisContextHolder.clear() to test teardown
- Add kotlin-type-mapper attribution to kotlin.md docs
- Fix NPE in KotlinAuxClasspathResolver when path has no filename component

* refactor(kotlin): move KotlinTypeAnalysisContext to rule.internal package

Was in rule.xpath.internal, implying XPath-only use. Both classes are
general infrastructure usable by Java-based rules too. Move to rule.internal,
add @experimental @SInCE 7.27.0, add japicmp exclusion for new package.

* refactor(kotlin): extract analyzeAndBuildVisitor to remove duplication

runTypeAnalysis() and runSingleFileAnalysis() shared identical core logic:
fromSources, context creation, setGlobal/clearGlobal. Extract to private
analyzeAndBuildVisitor(); callers add context-specific debug logging.

* feat(kotlin): upgrade ktm to 0.6.0-SNAPSHOT, use resolveAbsolutePath (#7)

Use TypedAstAccessorsKt.hasSourceRoot(ast) to explicitly distinguish
disk-based analysis (real abs path available) from in-memory analysis
(fromSources, sourceRoot is ""). For in-memory analysis, only the
basename is indexed — no bogus "/" + relativePath key is created.
For disk analysis, TypedAstAccessorsKt.resolveAbsolutePath(ast, file)
provides the canonical abs path.

Document that the basename index is an intentional fallback for cases
where PMD paths differ from ktm paths, and that it is inherently
ambiguous when multiple files share the same filename across packages.

* refactor(kotlin): store TypedAst in context, delegate isSubtypeOf to ktm (#8)

Store TypedAst in KotlinTypeAnalysisContext and delegate isSubtypeOf() to
TypedAstHierarchyQueriesKt.isSubtypeOf(). Removes the separate typeHierarchy
field; getTypeHierarchy() now delegates to typedAst.getTypeHierarchy().
The empty context (null typedAst) falls back to name-equivalence only.

Note: ktm#20 filed to add a cached upward-BFS variant for better per-node
rule evaluation performance.

* docs+test(kotlin): document endLine/endColumn span semantics from ktm 0.6.0 (#9)

- Document ktm 0.6.0 line semantics in callSitesAt/callSitesInRange javadoc:
  CallSiteAst.line = callee-name token; endLine/endColumn now available.
- Add compilation-check test asserting getEndLine() >= 0 is readable.
- Add 5 line-number-sensitive tests to KotlinTypeAnnotationVisitorTest covering
  multiline functions, multiple annotations on separate lines, leading blank lines,
  lambdas, and chained calls; each asserts the exact PMD beginLine.
- Document the +/-1 fallback in both lookupByLine and lookupWithFallback: needed
  when ktm reports the annotation line but PMD reports the keyword line.

* feat(kotlin): expose callsOnReceiver/callsReturning delegation from ktm 0.6.0 (#10)

Add callsOnReceiver, callsOnReceiverSubtype, callsReturning, callsReturningSubtype
to KotlinTypeAnalysisContext, delegating to TypedAstCallQueriesKt. These methods use
the dispatchReceiverType and extensionReceiverType fields introduced in CallSiteAst 0.6.0.
Add note to class Javadoc that ktm records concrete expanded types (not alias names).
Tests verify dispatchReceiverType is non-null for method calls and that both
callsOnReceiver and callsReturning find expected call sites.

* perf(kotlin): use isSubtypeOfUpward for O(ancestors) hierarchy check (ktm pmd#20)

Switch isSubtypeOf delegation from isSubtypeOf (downward BFS over all subtypes)
to isSubtypeOfUpward (upward walk of actual's supertypes, O(ancestors ~3-10)).
Also gains Object/Any short-circuit added in the same ktm PR pmd#21.

* refactor(kotlin): defer call-site queries, use TypedAst direct API (ktm pmd#22/pmd#23)

- Remove callsOnReceiver/callsOnReceiverSubtype/callsReturning/callsReturningSubtype
  from KotlinTypeAnalysisContext; deferred to add-kotlin-typealias-support branch
  alongside constructorCallsOf support (ktm pmd#22)
- Use TypedAst.hasSourceRoot() and TypedAst.resolveAbsolutePath(FileAst) directly
  instead of TypedAstAccessorsKt static dispatch (ktm pmd#23)
- Add missing @experimental + @experimental javadoc on KotlinTypeAnnotationVisitor
- Add missing @experimental javadoc on KotlinTypeAnalysisContext/Holder

* chore(kotlin): upgrade kotlin-type-mapper to 0.6.0 release

* refactor(kotlin): simplify KotlinParser usage in annotators

* Refactor Kotlin type-awareness flow and tighten Kotlin checks

* Warn once for missing Kotlin aux classpath

* docs(kotlin): note XPath/designer type attr exposure deferred to follow-up

* fix(kotlin): address trivial review comments from adangel

- pom.xml: extract kotlin.type.mapper.version property
- release_notes.md: simplify XPath/Designer limitation note
- KotlinLanguageProcessor: fix @SInCE to 7.25.0; use direct KtKotlinFile
  cast in parser lambda instead of instanceof check + debug log
- KotlinTypeAwarenessSupport: tighten annotateIfPossible to KtKotlinFile;
  remove try-catch in analyzeAndBuildVisitor (fail fast)
- KotlinTypeAnnotationVisitor: tighten annotate() to KtKotlinFile
- KotlinNodeTypeData + InternalApiBridge: tighten isTypeInfoAvailable /
  setTypeInfoAvailable to KtKotlinFile
- AnnotationAttributeAnnotator: use .children().first() for params node;
  throw on param count mismatch; rethrow IndexOutOfBoundsException with
  AssertionUtil.contexted(); remove unused LOG
- DelegationSpecifierAnnotator: rethrow IndexOutOfBoundsException with
  AssertionUtil.contexted(); remove unused LOG

* refactor(kotlin): remove KotlinTypeAnalysisContextHolder static state

Replace static GLOBAL_CONTEXT/THREAD_CONTEXT fields with per-file root-node
storage. KotlinTypeAnalysisContext is now stored on each KtKotlinFile via
KotlinNodeTypeData (new ANALYSIS_CONTEXT_KEY), stamped by
KotlinTypeAwarenessSupport.annotateIfPossible() after annotation completes.

- KotlinNodeTypeData: add getAnalysisContext/setAnalysisContext(KtKotlinFile)
- InternalApiBridge: expose setAnalysisContext bridge method
- KotlinTypeAwarenessSupport: hold KotlinTypeAnalysisContext as instance
  AtomicReference; set on root node per file; remove ContextHolder calls
- Delete KotlinTypeAnalysisContextHolder (static state gone)
- Delete KotlinTypeXPathTestHelper (only existed to inject into holder)
- KotlinTypeAnalysisContextTest: build context directly in @beforeeach;
  remove two holder-specific tests (holder no longer exists)

XPath functions (future): retrieve context via
KotlinNodeTypeData.getAnalysisContext(root) instead of the static holder.

* refactor(kotlin): split AnnotationAttributeAnnotator into two classes

Extract function-parameter type annotation into a dedicated class,
separating the two unrelated responsibilities.

- New FunctionParameterAnnotator: setFunctionParameterTypes +
  annotateParameterNodes (moved verbatim from AnnotationAttributeAnnotator)
- AnnotationAttributeAnnotator: annotation FQN logic only; remove
  KtFunctionDeclaration, KtFunctionValueParameters, ParameterAst imports;
  update javadoc
- KotlinTypeAnnotationVisitor: call FunctionParameterAnnotator instead of
  AnnotationAttributeAnnotator for parameter types; update javadoc

* refactor(kotlin): rename AnnotationAttributeAnnotator -> AnnotationFqnAnnotator

Avoids double use of "annotation" (Kotlin @annotation concept vs. "annotates
the AST"). Also rename setAnnotationAttributes -> setAnnotationFqns for
consistency with the class name.

* refactor(kotlin): KotlinTypeAnnotationVisitor: use KotlinTypeAnalysisContext instead of TypedAst

Eliminate the duplicate declaration index built inside the visitor.
KotlinTypeAnalysisContext already indexes by abs path, basename, .kt
extension fallback, and +/-1 line tolerance via declarationsAt().

- Constructor: TypedAst -> KotlinTypeAnalysisContext; drop byFilename field
- annotate(): remove filename extraction + byFilename lookup; delegate
  directly to AnnotatingVisitor(ctx, absPath)
- AnnotatingVisitor: take (ctx, absPath); call ctx.declarationsAt(absPath, line)
  instead of lookupWithFallback(byLine, line)
- Remove lookupWithFallback static method (superseded by ctx.declarationsAt)
- Remove now-unused imports: File, ArrayList, Collections, HashMap, Map,
  FileAst, TypedAst
- KotlinTypeAwarenessSupport: pass ctx (not ast) to visitor constructor

* fix(kotlin): use ktm fromPaths for disk files; fix AtomicRef race (items 5+6)

Item 5 — memory: KotlinTypeAwarenessSupport.prepare() now passes List<Path> to
KotlinTypeMapper.fromPaths() when all source files are on disk. KTM reads the
files itself, so source strings are not duplicated between PMD's TextFile cache
and the analyser — halves peak memory for disk-backed analysis runs. Designer /
in-memory files fall back to the existing fromSources(Map<String,String>) path.

Item 6 — race: annotateIfPossible() single-file branch previously read back
analysisContext.get() after runSingleFileAnalysis() set it. A concurrent
Designer parse could race between the set and the re-read, stamping the wrong
context on the root node. Fixed by exposing getContext() on
KotlinTypeAnnotationVisitor and using the visitor's own ctx directly.

Also bumps kotlin-type-mapper dependency to 0.6.1-SNAPSHOT (adds fromPaths).

* chore(kotlin): bump kotlin-type-mapper to 0.6.1 (released)

* refactor(kotlin): remove basename fallback from analysis context index

Index by canonical abs path (disk) or relativePath (in-memory) only.
Basename fallback was never needed: disk paths always match (PMD passes
the same paths it got from FS), and in-memory uses the fromSources key
directly. Add fail-fast clash detection so two files mapping to the same
index key throw immediately instead of silently corrupting results.

* refactor(kotlin): store annotation FQNs as List<String> instead of comma-joined String

Addresses adangel review suggestion. SimpleDataKey<List<String>> stores
the list directly; no join on set, no split on get. Remove stale
InternalApiBridge.setAnnotationFqNames bridge method (unused).

* refactor(kotlin): remove sanitizeKtFilename workaround; use absPath directly

sanitizeKtFilename silently masked two bugs:
- buildSourceMap keyed by getFileName() (basename) while annotate()
  looked up by getAbsolutePath() — only worked via now-removed basename fallback
- single-file path used a sanitized name inconsistently

Fix: buildSourceMap keys by getAbsolutePath(), single-file path uses
absPath as-is on both sides. Keys always match without fallback.
Add validateKotlinPath() with fail-fast throw for null/empty absPath.

* docs(kotlin): update comments — Designer fixed in pmd-designer#376, in-memory fallback is for test framework only

* [test] use snippet.<ext> filename in RuleTst instead of bare "file"

Gives the virtual in-memory file a proper language extension so that
kotlin-type-mapper (and other language processors) can identify the
language from the filename during the pre-analysis prepare() step.

Suggested by adangel in PR pmd#6795 review.

* [kotlin] remove AtomicReference and single-file fallback from KotlinTypeAwarenessSupport

Replace AtomicReference fields with volatile fields — lifecycle guarantees
happen-before between prepare() and annotateIfPossible(), volatile ensures
visibility across threads.

Remove the 'if (visitor == null)' single-file workaround from annotateIfPossible().
Fix the last bypass caller instead: KotlinParsingHelper now overrides doParse()
to call prepareForSingleDocument() before parsing, so KotlinTypeAnnotationVisitorTest
tests go through a proper prepare() step without needing a full PmdAnalysis run.

RuleTst.java was fixed in the previous commit. Designer bypass is addressed
by adangel's pmd-designer#376.

Suggested by adangel in PR pmd#6795 review.

* [kotlin] use plain fields instead of volatile in KotlinTypeAwarenessSupport

Plain fields are sufficient: prepare() completes before launchAnalysis()
submits file-processing tasks to threads, so JMM executor task submission
guarantees visibility. Avoids AvoidUsingVolatile PMD dogfood violation.

* [kotlin] Simplifications and fixes from review

- moving KotlinTypeAnnotationVisitor into internal package
- simplifying implementations of AnnotationFqnAnnotator, DelegationSpecifierAnnotator and FunctionParameterAnnotator
- Correcting `@since` javadoc tags
- add all internal packages to japicmp

* [doc] Release notes (pmd#6795)

---------

Co-authored-by: Andreas Dangel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brouwers-tiobe brouwers-tiobe brouwers-tiobe 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

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

11 participants

@wener-tiobe @brouwers-tiobe @oowekyala @adangel @mdhamed238 @gianmarcoschifone @lukasgraef @zbynek @metalshark @thomasleplus @goto-dev-null
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.