-
Notifications
You must be signed in to change notification settings - Fork 91
Remind users to upgrade old (<21) Java and EOL Spring Boot/Framework versions #901
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
Merged
FluoriteCafe-work
merged 73 commits into
microsoft:main
from
FluoriteCafe-work:feat/java-upgrade-tool-notification
Sep 18, 2025
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
3872005
feat(jdtls): add `PomPath` to metadata
FluoriteCafe-work 5574787
feat: MetadataManager
FluoriteCafe-work 3988de5
feat: add command `triggerJavaUpgradeTool`
FluoriteCafe-work bf7eb04
feat: NotificationManager
FluoriteCafe-work 18be55e
feat: IssueManager
FluoriteCafe-work 560048c
feat(upgradeManager): collect issues on load and workspace folder update
FluoriteCafe-work 0503046
feat: integrate the flow
FluoriteCafe-work b2406d9
feat: add context menu to open modernization tool
FluoriteCafe-work fa488ef
fix: only show modernization menu when related extension is installed
FluoriteCafe-work 9fbc1c2
fix: typo
FluoriteCafe-work c3ee610
chore: fmt
FluoriteCafe-work 0e998ba
feat: control reminder display by settings
FluoriteCafe-work 3b62771
feat: don't scan when upgrade extension does not exist
FluoriteCafe-work 9043db4
chore: make class methods static as there are no states here
FluoriteCafe-work 06c14d9
fix: typo
FluoriteCafe-work 1fac1f0
chore: add copyright headers
FluoriteCafe-work 97a044a
chore: skip package dependency check when JRE version issue is found
FluoriteCafe-work a554cca
chore: check Settings first as it's cheaper (?)
FluoriteCafe-work 67fba26
chore: revise fix prompts
FluoriteCafe-work c667fa2
chore: call `javaupgrade.gotoAgentMode` to trigger prompts
FluoriteCafe-work cda24ca
feat: revise notification message
FluoriteCafe-work 5817721
fix: only trigger notification on the first issue found
FluoriteCafe-work f6db20c
feat: allow "Not Now" or "Don't Show Again" for notifications
FluoriteCafe-work 4bc2e93
fix(upgradeManager): command calling
FluoriteCafe-work b93017d
chore: Java uses the word `runtime` instead of `engine`
FluoriteCafe-work 2da82b0
chore: remove debug strings
FluoriteCafe-work 802f9de
feat: support deprecated dependencies (and add Java EE as an example)
FluoriteCafe-work 82aaf05
fix: use 21 when showing latest version
FluoriteCafe-work 887261c
chore: string polishment
FluoriteCafe-work 535e190
fix: fix prompt version insertion issues
FluoriteCafe-work 6655cd8
chore: centralize JRE metadata together
FluoriteCafe-work cabb469
chore: rename settings `java.dependency.showUpgradeReminder` -> `java…
FluoriteCafe-work 7c606cb
fix: only show Modernize Java Project under Java project environment
FluoriteCafe-work 4bdc6d6
chore: `java.view.modernizeJavaProject` -> `_java.view.modernizeJavaP…
FluoriteCafe-work 81b9905
chore: `java.view.triggerJavaUpgradeTool` -> `_java.upgrade.triggerUp…
FluoriteCafe-work 76a8261
chore: change JRE package ID to `java:*`
FluoriteCafe-work 56084e6
chore: centralize `LATEST_JAVA_LTS_VESRION` and `SESSION_COUNT_BEFORE…
FluoriteCafe-work 28d2ee4
chore: `_java.upgrade.triggerUpgrade` -> `_java.upgradeWithCopilot`
FluoriteCafe-work 2789537
chore: no need for `PomPath`
FluoriteCafe-work 1f0a36f
fix(notificationManager): use settings to control whether to send not…
FluoriteCafe-work fbe2d5f
chore: split assessment part to `assessmentManager`
FluoriteCafe-work 790a5ea
feat: use `DisplayInterface` to organize user faced presentations
FluoriteCafe-work 1872705
chore: string improvements
FluoriteCafe-work e9b6917
chore: get all issues for notification
FluoriteCafe-work e25d0b6
feat: add telemetry
FluoriteCafe-work 46f78a8
fix: add current version to telemetry
FluoriteCafe-work c2c4cf6
chore: restore formatting
FluoriteCafe-work 1c1fef6
fix: pass `suggestedVersion` to `UpgradeIssue`
FluoriteCafe-work a370292
feat: update dependency data definition
FluoriteCafe-work 03c85fb
chore: update event names
FluoriteCafe-work daf65c5
chore(assessmentManager): refactor
FluoriteCafe-work 12f8a9b
chore(notificationManager): merge code to send choice
FluoriteCafe-work 4bec023
chore: refactor method names
FluoriteCafe-work f7f2d29
chore: rename
FluoriteCafe-work 6af3122
chore: rename the interface
FluoriteCafe-work a64a3c8
fix: stringify the telemetry
FluoriteCafe-work 1386bfb
chore(upgradeManager): no need to check command
FluoriteCafe-work fa0fe9e
chore: split `getWorkspaceIssues`
FluoriteCafe-work 5e0f4b0
chore: telemetry operation name
FluoriteCafe-work 9fa24f9
chore: rename `java.dependency.enableDependencyDiagnostics`
FluoriteCafe-work 1456262
chore: add `operationName` in telemetry
FluoriteCafe-work efdff83
chore: don't collect `failureReason`
FluoriteCafe-work 2578194
chore: rename
FluoriteCafe-work 731d86a
chore: don't show the commands in CP
FluoriteCafe-work 803be9b
chore: fix lint
FluoriteCafe-work aea445f
feat: show reasons for the versions we choose
FluoriteCafe-work 430f7e8
feat: update notification display UX
FluoriteCafe-work 440e92e
chore: merge `getNowTs()`
FluoriteCafe-work 478d871
chore(notificationManager): tweak order of `shouldShow` and `hasShown`
FluoriteCafe-work 4397ccc
chore: `workspaceUri` -> `workspaceFolderUri`
FluoriteCafe-work a0abeb9
chore: lint
FluoriteCafe-work 4d271c1
feat: add EOL date to notification
FluoriteCafe-work 3b09680
chore: lint
FluoriteCafe-work File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. | ||
|
|
||
| import * as semver from 'semver'; | ||
| import { Jdtls } from "../java/jdtls"; | ||
| import { NodeKind, type INodeData } from "../java/nodeData"; | ||
| import { type DependencyCheckItem, UpgradeReason, type UpgradeIssue } from "./type"; | ||
| import { DEPENDENCY_JAVA_RUNTIME } from "./dependency.metadata"; | ||
| import { Upgrade } from '../constants'; | ||
| import { buildPackageId } from './utility'; | ||
| import metadataManager from './metadataManager'; | ||
| import { sendInfo } from 'vscode-extension-telemetry-wrapper'; | ||
|
|
||
| function getJavaIssues(data: INodeData): UpgradeIssue[] { | ||
| const javaVersion = data.metaData?.MaxSourceVersion as number | undefined; | ||
| const { name, supportedVersion } = DEPENDENCY_JAVA_RUNTIME; | ||
| if (!javaVersion) { | ||
| return []; | ||
| } | ||
| const currentSemVer = semver.coerce(javaVersion); | ||
| if (currentSemVer && !semver.satisfies(currentSemVer, supportedVersion)) { | ||
| return [{ | ||
| ...DEPENDENCY_JAVA_RUNTIME, | ||
| packageId: Upgrade.PACKAGE_ID_FOR_JAVA_RUNTIME, | ||
| packageDisplayName: name, | ||
| currentVersion: String(javaVersion), | ||
| }]; | ||
| } | ||
|
|
||
| return []; | ||
| } | ||
|
|
||
| function getUpgradeForDependency(versionString: string, supportedVersionDefinition: DependencyCheckItem, packageId: string): UpgradeIssue | null { | ||
| const { reason } = supportedVersionDefinition; | ||
| switch (reason) { | ||
| case UpgradeReason.DEPRECATED: { | ||
| return { | ||
| ...supportedVersionDefinition, | ||
| packageDisplayName: supportedVersionDefinition.name, | ||
| reason, | ||
| currentVersion: versionString, | ||
| packageId, | ||
| }; | ||
| } | ||
| case UpgradeReason.END_OF_LIFE: { | ||
| const currentSemVer = semver.coerce(versionString); | ||
| if (currentSemVer && !semver.satisfies(currentSemVer, supportedVersionDefinition.supportedVersion)) { | ||
| return { | ||
| ...supportedVersionDefinition, | ||
| packageDisplayName: supportedVersionDefinition.name, | ||
| reason, | ||
| currentVersion: versionString, | ||
| packageId, | ||
| }; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| function getDependencyIssue(data: INodeData): UpgradeIssue | null { | ||
| const versionString = data.metaData?.["maven.version"]; | ||
| const groupId = data.metaData?.["maven.groupId"]; | ||
| const artifactId = data.metaData?.["maven.artifactId"]; | ||
| const packageId = buildPackageId(groupId, artifactId); | ||
| const supportedVersionDefinition = metadataManager.getMetadataById(packageId); | ||
| if (!versionString || !groupId || !supportedVersionDefinition) { | ||
| return null; | ||
| } | ||
|
|
||
| return getUpgradeForDependency(versionString, supportedVersionDefinition, packageId); | ||
| } | ||
|
|
||
| async function getDependencyIssues(projectNode: INodeData): Promise<UpgradeIssue[]> { | ||
| const projectStructureData = await Jdtls.getPackageData({ kind: NodeKind.Project, projectUri: projectNode.uri }); | ||
| const packageContainerIssues = await Promise.allSettled( | ||
| projectStructureData | ||
| .filter(x => x.kind === NodeKind.Container) | ||
| .map(async (packageContainer) => { | ||
| const packages = await Jdtls.getPackageData({ | ||
| kind: NodeKind.Container, | ||
| projectUri: projectNode.uri, | ||
| path: packageContainer.path, | ||
| }); | ||
|
|
||
| return packages.map(getDependencyIssue).filter((x): x is UpgradeIssue => Boolean(x)); | ||
| }) | ||
| ); | ||
|
|
||
| return packageContainerIssues | ||
| .map(x => { | ||
| if (x.status === "fulfilled") { | ||
| return x.value; | ||
| } | ||
|
|
||
| sendInfo("", { | ||
| operationName: "java.dependency.assessmentManager.getDependencyIssues", | ||
| }); | ||
| return []; | ||
| }) | ||
| .reduce((a, b) => [...a, ...b]); | ||
| } | ||
|
|
||
| async function getProjectIssues(projectNode: INodeData): Promise<UpgradeIssue[]> { | ||
| const issues: UpgradeIssue[] = []; | ||
| issues.push(...getJavaIssues(projectNode)); | ||
| issues.push(...(await getDependencyIssues(projectNode))); | ||
| return issues; | ||
| } | ||
|
|
||
| async function getWorkspaceIssues(workspaceFolderUri: string): Promise<UpgradeIssue[]> { | ||
| const projects = await Jdtls.getProjects(workspaceFolderUri); | ||
| const projectsIssues = await Promise.allSettled(projects.map(async (projectNode) => { | ||
| const issues = await getProjectIssues(projectNode); | ||
| sendInfo("", { | ||
| operationName: "java.dependency.assessmentManager.getWorkspaceIssues", | ||
| issuesFoundForPackageId: JSON.stringify(issues.map(x => `${x.packageId}:${x.currentVersion}`)), | ||
| }); | ||
| return issues; | ||
| })); | ||
|
|
||
| const workspaceIssues = projectsIssues.map(x => { | ||
| if (x.status === "fulfilled") { | ||
| return x.value; | ||
| } | ||
|
|
||
| sendInfo("", { | ||
| operationName: "java.dependency.assessmentManager.getWorkspaceIssues", | ||
| }); | ||
| return []; | ||
| }).reduce((a, b) => [...a, ...b]); | ||
|
|
||
| return workspaceIssues; | ||
| } | ||
|
|
||
| export default { | ||
| getWorkspaceIssues, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Please only make necessary changes to reduce the size of of the PR. In this file, the only change is the inserted line of:
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.
Formatting are restored in c2c4cf6.