Repository navigation
SONARJAVA-7279 Resolve the JDK API of the target release through the new jdt-package option - #6459
leonardo-pilastri-sonarsource wants to merge 12 commits into
Conversation
…new jdt-package option
…ollectorsToListCheck The main sample runs at Java 16, where addFirst, addLast, removeFirst and removeLast no longer resolve, so it uses the older List methods instead. A dedicated sample checked at Java 21 keeps one compliant case for each of the four methods, and a noncompliant case as a control. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
⚖️ Ruling update ready for review: #6461 |
Guava is analyzed with sonar.java.source=17, so the API of Java 17 is now seen instead of the one of the JDK running the analysis: - ThreadDeath (deprecated for removal in 20) and Object.finalize() (in 18) are no longer reported by S5738, - the unsynchronized mark() and reset() overrides in HashingInputStream are now reported by S3551, as FilterInputStream declares them synchronized in 17. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The analysis now sees the API of the Java release it targets instead of the one of the JDK running it, so two sets of expected issues disappear: - eclipse-jetty S5738: Jetty targets Java 11, where SecurityManager and AccessController are not yet deprecated for removal (Java 17), - guava S2387: the shadowed fields (Reference.next, AbstractMap.keySet) are not public API, and are not part of the API of the release anymore. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…similar-to-main Same reason as for eclipse-jetty: Jetty targets Java 11, where SecurityManager is not deprecated for removal yet, so the issues of ContextHandler are gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…sDebugEnabled Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
/pvf |
|
Projects with unexpected PVF results:
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>jdt-package</artifactId> | ||
| <version>1.10.0.12296</version> | ||
| <version>1.9.0.12280</version> |
There was a problem hiding this comment.
⚠️ Cross-PR: Merge downgrades jdt-package and drops master's Java 27 JDT update · SonarSource/sonar-java-jdt #169
Breaks when this PR merges into master while java-frontend/pom.xml still pins jdt-package 1.9.0.12280 and no jdt-package release yet contains both sonar-java-jdt PR SonarSource/sonar-java-jdt#169 and the Java 27 JDT update.
How
- Commit 7509a6b bumped
jdt-packageto1.9.0.12280(java-frontend/pom.xml:24) so thatorg.eclipse.jdt.core.dom.SystemReleaseClasspathis available. That class comes from SonarSource/sonar-java-jdt#169 (src/main/java/org/eclipse/jdt/core/dom/SystemReleaseClasspath.java). - Master moved to
1.10.0.12296in SONARJAVA-7303 Update Sonar JDT #6489 (SONARJAVA-7303, Java 27 support). The merge commit kept1.9.0.12280, so merging this PR would roll master's JDT back to the version without Java 27 support. JParserConfig.java:25,145-146,189-191needsSystemReleaseClasspath.OPTION_RELEASE,OPTION_JAVA_HOMEandisApplicable, and nothing shows that1.10.0.12296contains them. So neither pinned version gives you both features.
Fix
- This PR: Depend on a jdt-package build that has both SonarSource/sonar-java-jdt#169 and master's 1.10 (Java 27) JDT update, instead of keeping 1.9.0.12280.
- SonarSource/sonar-java-jdt#169: Rebase onto the JDT version shipped as 1.10.0.12296 and publish a release that includes
SystemReleaseClasspathand the patchedASTParser.getClasspath().
Compared 555a24a with SonarSource/sonar-java-jdt#169 at fed37d2
Was this helpful? React with 👍 / 👎
The release API of the analyzed Java version is now used by default. The property stays as the way out for a project whose analysis regressed: setting it to false makes the whole API of the JDK visible again. The parser already falls back to that when the JDK cannot serve the release. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…elease API being enabled by default RunFinalizersCheckTest: for Java 10, the APIs of that release are visible, so the issues are raised on the sample. Ruling: with the API of the analyzed release, guava and eclipse-jetty no longer raise the issues of S5738 and S2387 that depended on APIs of later JDKs, and guava gets two new S3551 issues. The expectations are those of the ruling run of the PR. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ns (RunFinalizers, guava S5738 and S3551) The previous commit only contained the deletion of the two ruling expectation files. This one adds the rest: - RunFinalizersCheckTest: for Java 10, the APIs of that release are visible, so the issues are raised on the sample; - guava: S5738 no longer raises 4 issues that depended on APIs of later JDKs, and S3551 has 2 new issues. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ruling Diff SummaryDetected changes in 5 rule files: 30 issues removed, 2 issues added. S5738 (
|
…similar-to-main With the API of the analyzed release, the 5 issues of ContextHandler.java are no longer raised, as for eclipse-jetty. Checked by running JavaRulingTest#eclipse_jetty_incremental locally: it passes without this file. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Code Review
|
| Auto-apply | Compact | Unblock |
|
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|








Summary by Gitar
SystemReleaseClasspathinJParserConfigsonar.java.useJdkReleaseOptionproperty, enabled by default and registered inJavaPluginjdt-packageto1.9.0.12280injava-frontend/pom.xmlRunFinalizersCheckTestexpectations for Java 10 API visibilitySequencedCollectionmutator calls withListequivalents inCollectorsToListCheckSampleCollectorsToListCheckSequencedSamplecoveringSequencedCollectionmutators on Java 21S5738andS2387expectations and theguavaS3551expectation fileThis will update automatically on new commits.