Skip to content

SONARJAVA-7286 Add PSI dependencies packaging and third-party license notices - #6454

Closed
aurelien-coet-sonarsource wants to merge 1 commit into
ac/java-psi-frontend-4from
ac/java-psi-frontend-5
Closed

aurelien-coet-sonarsource wants to merge 1 commit into
ac/java-psi-frontend-4from
ac/java-psi-frontend-5

Conversation

@aurelien-coet-sonarsource

@aurelien-coet-sonarsource aurelien-coet-sonarsource commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • Dependencies:
    • Added IntelliJ PSI artifacts pinned via intellij.version in pom.xml
    • Added commons-codec and stax2-api dependency management in java-frontend/pom.xml
  • Packaging:
    • Extended maven-shade-plugin filters and ServicesResourceTransformer to bundle PSI dependencies
    • Enabled useChildFirstClassLoader and widened requireFilesSize bounds in sonar-java-plugin/pom.xml
  • Build settings:
    • Set maven.compiler.release to 21 and added surefire JVM args in java-frontend/pom.xml
  • Third-party licenses:
    • Added psi-licenses.xml and Apache, ASM, and ORO license texts under license-resources
    • Added license URL replacements and THIRD_PARTY_LICENSES files for the new dependencies

This will update automatically on new commits.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Add PSI dependencies packaging and third-party license notices SONARJAVA-7286 Add PSI dependencies packaging and third-party license notices Nov 2, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

SONARJAVA-7286

Comment on lines +1 to +15
This copy of StaxMate processing library is licensed under
BSD License ("new BSD").
See http://www.opensource.org/licenses/bsd-license.php
for details.

Full license text is as follows:

--------------------------------------------------------------------------
* Copyright (c) 2007, Tatu Saloranta
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Bug: dk.brics automaton notice ships StaxMate's license and copyright

The new dk.brics.automaton-LICENSE.txt is byte-for-byte the same as license-resources/bsd.txt. That file starts with "This copy of StaxMate processing library is licensed under..." and gives the copyright as "(c) 2007, Tatu Saloranta". It got here through the existing http://www.opensource.org/licenses/bsd-license.php → bsd.txt URL replacement, so any BSD-licensed dependency gets StaxMate's notice. dk.brics automaton is copyright Anders Møller / Aarhus University. Its BSD license says binary redistributions must reproduce its copyright notice, and the bundled notice names the wrong library and the wrong owner. Fix: add a dedicated license text for automaton (for example license-resources/automaton.txt) and either override it in psi-licenses.xml or add a URL replacement that only matches this artifact. Then regenerate the committed file.

Was this helpful? React with 👍 / 👎

<dependency>
<groupId>\Qcom.jetbrains.intellij.java\E</groupId>
<artifactId>\Qjava-frontback-psi\E</artifactId>
<version>\Q262.10968.63\E</version>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: psi-licenses.xml pins IntelliJ version separately from intellij.version

Every IntelliJ override in psi-licenses.xml matches on the literal <version>\Q262.10968.63\E</version>, while the actual dependency version comes from the new ${intellij.version} property in the root pom. When someone bumps intellij.version, none of these overrides match any more. The license plugin then falls back to the artifacts' own POM metadata, which is why the overrides were added in the first place, so licenses go missing or get generated differently and LicenseValidator fails the build. Since the override is keyed on groupId/artifactId, match any version (e.g. <version>.*</version>) or document that this file has to be updated together with intellij.version.

Was this helpful? React with 👍 / 👎

Comment thread sonar-java-plugin/pom.xml
Comment on lines +257 to +271
<filter>
<artifact>com.jetbrains.intellij.platform:bazel-runfiles</artifact>
<includes><include>**</include></includes>
</filter>
<filter>
<artifact>com.jetbrains.intellij.platform:core</artifact>
<includes><include>**</include></includes>
</filter>
<filter>
<artifact>com.jetbrains.intellij.platform:core-impl</artifact>
<includes><include>**</include></includes>
</filter>
<filter>
<artifact>com.jetbrains.intellij.platform:diagnostic</artifact>
<includes><include>**</include></includes>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Bug: 20 newly shaded PSI dependencies ship with no license notice

This PR adds shade filters with <include>**</include> for these artifacts, so they get bundled into the plugin JAR. None of them has a file in src/main/resources/licenses/THIRD_PARTY_LICENSES/:

  • IntelliJ platform modules: bazel-runfiles, diagnostic, diagnostic-telemetry, eel, eel-nio-fs, plugin-system-parser-impl, syntax-extensions, syntax-i18-n, syntax-util, util-class-loader, util-coroutines, util-diff, util-jdom, util-progress, util-rt-java8, util-xml-dom
  • jaxen:jaxen, net.java.dev.jna:jna, net.java.dev.jna:jna-platform (dual LGPL-2.1/Apache-2.0), org.slf4j:log4j-over-slf4j

I checked the published POMs. platform:util and platform:core-impl 262.10968.63 pull in util-jdom, eel, eel-nio-fs, jna-platform, log4j-over-slf4j, diagnostic, diagnostic-telemetry, util-diff, plugin-system-parser-impl and others, mostly with runtime scope, so these are real bundled dependencies. The IntelliJ POMs have no <licenses> block, and psi-licenses.xml only adds overrides for 19 artifacts. That leaves these modules with nothing to generate a notice from, so the build still passes with errorRemedy=xmlOutput and LicenseValidator finds nothing missing. The result is a plugin that redistributes third-party code with no license notice, which is the thing this PR is supposed to fix.

Fix: add psi-licenses.xml entries for the IntelliJ modules that are missing. Make sure the download/validation step also covers the runtime-scoped JNA, jaxen and log4j-over-slf4j artifacts, then commit the license files it produces.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
CI failed: The build fails at the third-party license check: 19 PSI-related dependencies have unknown licenses and two icon API artifacts use an Apache license label that the whitelist does not match; this is tied to this PR's new PSI dependencies.

Overview

One unique failure pattern was found across 1 log in job 125307301458 (commit ab3853a). The Maven build and tests completed, but the root-project license-maven-plugin:aggregate-add-third-party goal failed on forbidden licenses, so the job exited with code 1.

Failures

Third-party license check fails on unknown and non-whitelisted licenses (confidence: high)

  • Type: dependency
  • Affected jobs: 125307301458
  • Related to change: yes
  • Root cause: The license check reports 19 dependencies with Unknown license, including the new IntelliJ PSI artifacts (com.jetbrains.intellij.java:java-psi, java-psi-impl, java-syntax, java-frontback-psi, and related com.jetbrains.intellij.platform artifacts). It also reports icons-api and icons-api-rendering as Apache License 2.0, which does not match the configured apache_v2 whitelist entry. The plugin stops with "There are some forbidden licenses used". The earlier JaCoCo class-file version 70 warning did not stop the tests and is not the cause of this job failure.
  • Suggested fix: Provide license metadata or a mapping the aggregator recognizes for each of the 19 unknown dependencies (the PSI and platform artifacts above, plus asm-all, intellij-deps-fastutil, and oro, which have no URL). Normalize the two Apache declarations to the apache_v2 identifier, or add an explicit accepted alias if policy permits. Rerun license:aggregate-add-third-party on the root project to confirm it passes.

Summary

  • Change-related failures: 1 failure (license check on the new PSI dependencies and their Apache-labelled icon artifacts).
  • Infrastructure/flaky failures: None identified. The JaCoCo instrumentation warning was non-blocking.
  • Recommended action: Fix the license metadata for the new PSI dependencies and align the Apache license identifier, then rerun the license check. Note that the source-analysis and test steps were not the failing step.
Code Review ⚠️ Changes requested 0 closed / 3 findings

🟡 Medium risk · Bundling IntelliJ PSI dependencies and enabling child-first loading could cause classpath conflicts or plugin startup failures in deployed analyzers.

Adds IntelliJ PSI dependencies, shading, and third-party license packaging, but changes are requested before merge. The bundled dk.brics.automaton notice contains StaxMate's license and copyright instead of its own, so it needs a dedicated license text. Also, 20 newly shaded PSI dependencies (IntelliJ modules, jaxen, JNA, log4j-over-slf4j) have no license notice, and the IntelliJ overrides in psi-licenses.xml are pinned to a literal version that will break when intellij.version is bumped.

⚠️ Bug: dk.brics automaton notice ships StaxMate's license and copyright

📄 sonar-java-plugin/src/main/resources/licenses/THIRD_PARTY_LICENSES/dk.brics.automaton-LICENSE.txt:1-15 📄 sonar-java-plugin/pom.xml:382-384

The new dk.brics.automaton-LICENSE.txt is byte-for-byte the same as license-resources/bsd.txt. That file starts with "This copy of StaxMate processing library is licensed under..." and gives the copyright as "(c) 2007, Tatu Saloranta". It got here through the existing http://www.opensource.org/licenses/bsd-license.php → bsd.txt URL replacement, so any BSD-licensed dependency gets StaxMate's notice. dk.brics automaton is copyright Anders Møller / Aarhus University. Its BSD license says binary redistributions must reproduce its copyright notice, and the bundled notice names the wrong library and the wrong owner. Fix: add a dedicated license text for automaton (for example license-resources/automaton.txt) and either override it in psi-licenses.xml or add a URL replacement that only matches this artifact. Then regenerate the committed file.

⚠️ Bug: 20 newly shaded PSI dependencies ship with no license notice

📄 sonar-java-plugin/pom.xml:257-271 📄 sonar-java-plugin/pom.xml:297-311 📄 sonar-java-plugin/pom.xml:417-428 📄 sonar-java-plugin/pom.xml:481-484 📄 sonar-java-plugin/license-resources/psi-licenses.xml

This PR adds shade filters with <include>**</include> for these artifacts, so they get bundled into the plugin JAR. None of them has a file in src/main/resources/licenses/THIRD_PARTY_LICENSES/:

  • IntelliJ platform modules: bazel-runfiles, diagnostic, diagnostic-telemetry, eel, eel-nio-fs, plugin-system-parser-impl, syntax-extensions, syntax-i18-n, syntax-util, util-class-loader, util-coroutines, util-diff, util-jdom, util-progress, util-rt-java8, util-xml-dom
  • jaxen:jaxen, net.java.dev.jna:jna, net.java.dev.jna:jna-platform (dual LGPL-2.1/Apache-2.0), org.slf4j:log4j-over-slf4j

I checked the published POMs. platform:util and platform:core-impl 262.10968.63 pull in util-jdom, eel, eel-nio-fs, jna-platform, log4j-over-slf4j, diagnostic, diagnostic-telemetry, util-diff, plugin-system-parser-impl and others, mostly with runtime scope, so these are real bundled dependencies. The IntelliJ POMs have no <licenses> block, and psi-licenses.xml only adds overrides for 19 artifacts. That leaves these modules with nothing to generate a notice from, so the build still passes with errorRemedy=xmlOutput and LicenseValidator finds nothing missing. The result is a plugin that redistributes third-party code with no license notice, which is the thing this PR is supposed to fix.

Fix: add psi-licenses.xml entries for the IntelliJ modules that are missing. Make sure the download/validation step also covers the runtime-scoped JNA, jaxen and log4j-over-slf4j artifacts, then commit the license files it produces.

💡 Quality: psi-licenses.xml pins IntelliJ version separately from intellij.version

📄 sonar-java-plugin/license-resources/psi-licenses.xml:7 📄 sonar-java-plugin/license-resources/psi-licenses.xml:19 📄 sonar-java-plugin/license-resources/psi-licenses.xml:31 📄 sonar-java-plugin/license-resources/psi-licenses.xml:43 📄 sonar-java-plugin/license-resources/psi-licenses.xml:55 📄 sonar-java-plugin/license-resources/psi-licenses.xml:67 📄 sonar-java-plugin/license-resources/psi-licenses.xml:79 📄 sonar-java-plugin/license-resources/psi-licenses.xml:91 📄 sonar-java-plugin/license-resources/psi-licenses.xml:103 📄 sonar-java-plugin/license-resources/psi-licenses.xml:115 📄 sonar-java-plugin/license-resources/psi-licenses.xml:127 📄 sonar-java-plugin/license-resources/psi-licenses.xml:139 📄 sonar-java-plugin/license-resources/psi-licenses.xml:151 📄 sonar-java-plugin/license-resources/psi-licenses.xml:163 📄 sonar-java-plugin/license-resources/psi-licenses.xml:175 📄 sonar-java-plugin/license-resources/psi-licenses.xml:187 📄 pom.xml:86

Every IntelliJ override in psi-licenses.xml matches on the literal <version>\Q262.10968.63\E</version>, while the actual dependency version comes from the new ${intellij.version} property in the root pom. When someone bumps intellij.version, none of these overrides match any more. The license plugin then falls back to the artifacts' own POM metadata, which is why the overrides were added in the first place, so licenses go missing or get generated differently and LicenseValidator fails the build. Since the override is keyed on groupId/artifactId, match any version (e.g. <version>.*</version>) or document that this file has to be updated together with intellij.version.

🤖 Prompt for agents
Code Review: Adds IntelliJ PSI dependencies, shading, and third-party license packaging, but changes are requested before merge. The bundled dk.brics.automaton notice contains StaxMate's license and copyright instead of its own, so it needs a dedicated license text. Also, 20 newly shaded PSI dependencies (IntelliJ modules, jaxen, JNA, log4j-over-slf4j) have no license notice, and the IntelliJ overrides in psi-licenses.xml are pinned to a literal version that will break when intellij.version is bumped.

1. ⚠️ Bug: dk.brics automaton notice ships StaxMate's license and copyright
   Files: sonar-java-plugin/src/main/resources/licenses/THIRD_PARTY_LICENSES/dk.brics.automaton-LICENSE.txt:1-15, sonar-java-plugin/pom.xml:382-384

   The new `dk.brics.automaton-LICENSE.txt` is byte-for-byte the same as `license-resources/bsd.txt`. That file starts with "This copy of StaxMate processing library is licensed under..." and gives the copyright as "(c) 2007, Tatu Saloranta". It got here through the existing `http://www.opensource.org/licenses/bsd-license.php` → `bsd.txt` URL replacement, so any BSD-licensed dependency gets StaxMate's notice. dk.brics automaton is copyright Anders Møller / Aarhus University. Its BSD license says binary redistributions must reproduce *its* copyright notice, and the bundled notice names the wrong library and the wrong owner. Fix: add a dedicated license text for automaton (for example `license-resources/automaton.txt`) and either override it in `psi-licenses.xml` or add a URL replacement that only matches this artifact. Then regenerate the committed file.

2. 💡 Quality: psi-licenses.xml pins IntelliJ version separately from intellij.version
   Files: sonar-java-plugin/license-resources/psi-licenses.xml:7, sonar-java-plugin/license-resources/psi-licenses.xml:19, sonar-java-plugin/license-resources/psi-licenses.xml:31, sonar-java-plugin/license-resources/psi-licenses.xml:43, sonar-java-plugin/license-resources/psi-licenses.xml:55, sonar-java-plugin/license-resources/psi-licenses.xml:67, sonar-java-plugin/license-resources/psi-licenses.xml:79, sonar-java-plugin/license-resources/psi-licenses.xml:91, sonar-java-plugin/license-resources/psi-licenses.xml:103, sonar-java-plugin/license-resources/psi-licenses.xml:115, sonar-java-plugin/license-resources/psi-licenses.xml:127, sonar-java-plugin/license-resources/psi-licenses.xml:139, sonar-java-plugin/license-resources/psi-licenses.xml:151, sonar-java-plugin/license-resources/psi-licenses.xml:163, sonar-java-plugin/license-resources/psi-licenses.xml:175, sonar-java-plugin/license-resources/psi-licenses.xml:187, pom.xml:86

   Every IntelliJ override in `psi-licenses.xml` matches on the literal `<version>\Q262.10968.63\E</version>`, while the actual dependency version comes from the new `${intellij.version}` property in the root pom. When someone bumps `intellij.version`, none of these overrides match any more. The license plugin then falls back to the artifacts' own POM metadata, which is why the overrides were added in the first place, so licenses go missing or get generated differently and `LicenseValidator` fails the build. Since the override is keyed on groupId/artifactId, match any version (e.g. `<version>.*</version>`) or document that this file has to be updated together with `intellij.version`.

3. ⚠️ Bug: 20 newly shaded PSI dependencies ship with no license notice
   Files: sonar-java-plugin/pom.xml:257-271, sonar-java-plugin/pom.xml:297-311, sonar-java-plugin/pom.xml:417-428, sonar-java-plugin/pom.xml:481-484, sonar-java-plugin/license-resources/psi-licenses.xml

   This PR adds shade filters with `<include>**</include>` for these artifacts, so they get bundled into the plugin JAR. None of them has a file in `src/main/resources/licenses/THIRD_PARTY_LICENSES/`:
   - IntelliJ platform modules: `bazel-runfiles`, `diagnostic`, `diagnostic-telemetry`, `eel`, `eel-nio-fs`, `plugin-system-parser-impl`, `syntax-extensions`, `syntax-i18-n`, `syntax-util`, `util-class-loader`, `util-coroutines`, `util-diff`, `util-jdom`, `util-progress`, `util-rt-java8`, `util-xml-dom`
   - `jaxen:jaxen`, `net.java.dev.jna:jna`, `net.java.dev.jna:jna-platform` (dual LGPL-2.1/Apache-2.0), `org.slf4j:log4j-over-slf4j`
   
   I checked the published POMs. `platform:util` and `platform:core-impl` 262.10968.63 pull in `util-jdom`, `eel`, `eel-nio-fs`, `jna-platform`, `log4j-over-slf4j`, `diagnostic`, `diagnostic-telemetry`, `util-diff`, `plugin-system-parser-impl` and others, mostly with `runtime` scope, so these are real bundled dependencies. The IntelliJ POMs have no `<licenses>` block, and `psi-licenses.xml` only adds overrides for 19 artifacts. That leaves these modules with nothing to generate a notice from, so the build still passes with `errorRemedy=xmlOutput` and `LicenseValidator` finds nothing missing. The result is a plugin that redistributes third-party code with no license notice, which is the thing this PR is supposed to fix.
   
   Fix: add `psi-licenses.xml` entries for the IntelliJ modules that are missing. Make sure the download/validation step also covers the runtime-scoped JNA, jaxen and log4j-over-slf4j artifacts, then commit the license files it produces.

Verification Rules 2/2 met Repos 5 inspected · PRs 2 inspected

Functional validation No results

Rules 2 passed 1 not applicable

✅ Internal artifact registries
✅ Repository license compliance

Broader impact Repos 5 inspected PRs 2 inspected
Cross-repo 5 repositories inspected 0 open impacts

SonarSource/sonarqube Inspected
SonarSource/sonar-java-symbolic-execution Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonarlint-vscode Inspected
SonarSource/sonar-update-center Inspected

Cross-PR 2 PRs inspected 0 open impacts

PR 6455: SONARJAVA-7287 Prepare the integration of PSI into the Java frontend Inspected
PR 6456: SONARJAVA-7288 Replace Eclipse JDT core with PSI in the Java frontend Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

sonarqube-next Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Quality Gate failed Quality Gate failed

Failed conditions
2 New issues
Vulnerability dependency risks too severe (required < 'medium' severity)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

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