Skip to content
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

[Java 21] Support ballerina lang to build with Java 21 #43087

Merged
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b6a4117
Upgrade spotbugs version
warunalakshitha Jul 12, 2024
bf1bc0b
Support Java gradle script for Java 21
warunalakshitha Jul 12, 2024
32035c9
Fix spotbugs issues with 6.0.18 upgrade
warunalakshitha Jul 12, 2024
f3a5ea6
Support Java 21 source version
warunalakshitha Jul 12, 2024
d777375
Add java21 branch to PR build workflows
warunalakshitha Jul 12, 2024
8fc9a43
Migrate github workflows to Java 21
warunalakshitha Jul 12, 2024
27231d0
Migrate Project API code to Java 21
warunalakshitha Jul 12, 2024
459d91c
Fix build issue with Java 21 target
warunalakshitha Jul 12, 2024
c808224
Fix bindgen test
warunalakshitha Jul 12, 2024
6da11bb
Fix cli tests
warunalakshitha Jul 19, 2024
80eda58
Fix lang server tests
warunalakshitha Jul 19, 2024
a8b37fd
Upgrade Java ClassFile version to 21
warunalakshitha Jul 19, 2024
37934c8
Merge with master branch
warunalakshitha Jul 19, 2024
6a04784
Fix cli tests after sync with master
warunalakshitha Jul 19, 2024
55d6aca
Fix central client tests for Java 21
warunalakshitha Jul 19, 2024
64e129e
Disable diagram util tests temporary
warunalakshitha Jul 20, 2024
758f1c9
Fix configurable test using auth module
warunalakshitha Jul 20, 2024
c628934
Merge master branch to Java 21 branch
warunalakshitha Jul 21, 2024
6317763
Merge with java21 branch
warunalakshitha Jul 21, 2024
465f6d9
Disable debugger tests until support Java 21
warunalakshitha Jul 21, 2024
c8c9b1e
Fix lang server tests replacing expected responses
warunalakshitha Jul 22, 2024
2247356
Address review suggestions
warunalakshitha Jul 24, 2024
fa3ee3d
Merge with master branch
warunalakshitha Jul 24, 2024
b911b96
Merge with java21 branch
warunalakshitha Jul 24, 2024
1a40ea2
Fix debugger integration tests
HindujaB Aug 16, 2024
79c3846
Fix merge conflicts
HindujaB Aug 16, 2024
996e2c3
Fix spotBugs failure
HindujaB Aug 16, 2024
76cd88f
Fix CLI test failures
HindujaB Aug 19, 2024
c965c08
Enable SyntaxTreeGenTest tests
HindujaB Aug 20, 2024
1b24be0
Disable diagram-util tests with central pull
HindujaB Aug 21, 2024
c8b7e1e
Enable diagram-util tests
HindujaB Aug 21, 2024
8f6d65d
Delete ../.DS_Store file
HindujaB Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/daily_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -69,11 +69,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily_spec_conformance_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
ref: spec-conformance-test-runner

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly_publish_timestamped_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
with:
ref: ${{ matrix.branch }}

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize Sub Modules
run: git submodule update --init
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/observe_package_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
fetch-depth: 0
- name: Checkout Tag
run: git checkout ${{ github.event.inputs.repoTag }}
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Build with Gradle
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'
- name: Set version env variable
run: |
echo "VERSION=$(./gradlew properties | grep ^version: | cut -d\ -f2 | sed 's@-SNAPSHOT@@')" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_timestamped_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Checkout To Lang Branch
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pull_request_full_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Checkout To Lang Branch
run: |
Expand Down Expand Up @@ -64,11 +64,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Setup NodeJs
uses: actions/setup-node@v4
Expand All @@ -94,7 +94,7 @@ jobs:
# - name: Checkout non-default branch
# run: |
# for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do \
# cd $module_name && git fetch origin && git checkout -t origin/java_17_migration && cd ..; \
# cd $module_name && git fetch origin && git checkout -t origin/java_21_migration && cd ..; \
# done

- name: Update Lang Version in Module
Expand Down Expand Up @@ -131,11 +131,11 @@ jobs:
with:
repository: 'ballerina-platform/ballerina-distribution'

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Download Ballerina Lang Artifacts
uses: actions/download-artifact@v4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull_request_ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -88,11 +88,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: configure Pagefile
uses: al-cheb/[email protected]
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/push_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -63,11 +63,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: configure Pagefile
uses: al-cheb/[email protected]
Expand All @@ -89,7 +89,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -113,11 +113,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
6 changes: 5 additions & 1 deletion ballerina-shell/modules/shell-cli/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
</Match>
<Match>
<Class name="io.ballerina.shell.cli.handlers.help.BbeTopicsProvider"/>
<Bug pattern="MS_EXPOSE_REP"/>
<Bug pattern="MS_EXPOSE_REP,CT_CONSTRUCTOR_THROW"/>
</Match>
<Match>
<Class name="io.ballerina.shell.cli.PropertiesLoader"/>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private boolean containsModuleNotFoundError(PackageCompilation compilation) {
protected void executeProject(ClassLoadContext context, String templateName) throws InvokerException {
Project project = getProject(context, templateName);
PackageCompilation compilation = compile(project);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_21);
executeProject(jBallerinaBackend);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void initialize() throws InvokerException {
anyTypeSymbol = runFunctionType.returnTypeDescriptor().orElseThrow();
}
}
JBallerinaBackend.from(compilation, JvmTarget.JAVA_17);
JBallerinaBackend.from(compilation, JvmTarget.JAVA_21);
this.initialized.set(true);
addDebugDiagnostic("Added initial identifiers: " + initialIdentifiers);
}
Expand Down
4 changes: 4 additions & 0 deletions bvm/ballerina-profiler/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
<Class name="io.ballerina.runtime.profiler.ui.JsonParser$Data"/>
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>
<Match>
<Class name="io.ballerina.runtime.profiler.runtime.Data"/>
<Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE"/>
</Match>
</FindBugsFilter>
4 changes: 4 additions & 0 deletions cli/ballerina-cli/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@
<Match>
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="io.ballerina.cli.cmd.CommandUtil" />
<Bug pattern="UUF_UNUSED_FIELD" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@
return true;
}
if (!hasProvidedPlatformDeps(balaProject.currentPackage())) {
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);

Check warning on line 1190 in cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/CommandUtil.java

View check run for this annotation

Codecov / codecov/patch

cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/CommandUtil.java#L1190

Added line #L1190 was not covered by tests
Collection<Diagnostic> backendDiagnostics = jBallerinaBackend.diagnosticResult().diagnostics(false);
if (!backendDiagnostics.isEmpty()) {
printDiagnostics(backendDiagnostics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void deprecateInCentral(String packageInfo) {
settings.getCentral().getReadTimeout(), settings.getCentral().getWriteTimeout(),
settings.getCentral().getCallTimeout(), settings.getCentral().getMaxRetries());
client.deprecatePackage(packageValue, deprecationMsg,
JvmTarget.JAVA_17.code(),
JvmTarget.JAVA_21.code(),
RepoUtils.getBallerinaVersion(), this.undoFlag);
} catch (CentralClientException e) {
String errorMessage = e.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@
}

try {
client.pushPackage(balaPath, org, name, version, JvmTarget.JAVA_17.code(),
client.pushPackage(balaPath, org, name, version, JvmTarget.JAVA_21.code(),

Check warning on line 495 in cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java

View check run for this annotation

Codecov / codecov/patch

cli/ballerina-cli/src/main/java/io/ballerina/cli/cmd/PushCommand.java#L495

Added line #L495 was not covered by tests
RepoUtils.getBallerinaVersion());
} catch (CentralClientException e) {
String errorMessage = e.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void execute(Project project) {
BuildTime.getInstance().packageCompilationDuration = System.currentTimeMillis() - start;
start = System.currentTimeMillis();
}
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
if (project.buildOptions().dumpBuildTime()) {
BuildTime.getInstance().codeGenDuration = System.currentTimeMillis() - start;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void execute(Project project) {

try {
PackageCompilation packageCompilation = project.currentPackage().getCompilation();
jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
long start = 0;
if (project.buildOptions().dumpBuildTime()) {
start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void execute(Project project) {
Path executablePath = getExecutablePath(project, target);
try {
PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_21);
long start = 0;
if (project.buildOptions().dumpBuildTime()) {
start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void execute(Project project) {
Target target = getTarget(project);
try {
PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_21);
List<Diagnostic> emitDiagnostics = new ArrayList<>();
Path testCachePath = target.getTestsCachePath();
long start = 0;
Expand Down
Loading
Loading