Skip to content

Sync testing branch with main #240

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
merged 19 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e118d8f
upgrade jsonc-parser lib
Achal1607 Jul 23, 2024
51b0597
[JAVAVSCODE #196] Run Configuration section is unavailable in the Exp…
sid-srini Jul 25, 2024
30067b2
Merge pull request #200 from Achal1607/upgrade-jsonc
Achal1607 Jul 25, 2024
9f958e4
pre-commit hook to check urls in package-lock.json (#192)
Achal1607 Jul 31, 2024
22c2526
Update BUILD.md (#225)
anthonyvdotbe Aug 5, 2024
865bca3
Merge pull request #210 from sid-srini/vsc196-show-runConfig-workspace
Achal1607 Aug 7, 2024
78ba888
Upgrade Gradle tooling to support JDK-22 (#220)
Achal1607 Aug 7, 2024
884f798
[JAVAVSCODE #199] Quick Fix actions are unable to edit runConfig opti…
sid-srini Aug 7, 2024
d6e58e1
Backporting NetBeans 23 patches (#227)
Achal1607 Aug 7, 2024
e3b3877
adding back some modules which caused issue in formatting xml files (…
Achal1607 Aug 7, 2024
87423da
Ant build script reorganization for patches and clean-netbeans
sid-srini Aug 13, 2024
69846a9
Merge pull request #234 from sid-srini/ant-build-script-patches-cleanup
Achal1607 Aug 13, 2024
93d3802
Bump up axios to 1.7.3
Achal1607 Aug 13, 2024
0739831
Merge pull request #235 from Achal1607/update-axios-1.7.3
Achal1607 Aug 13, 2024
34c8629
NB-23 patches compitable with Java source version 1.8 (#232)
Achal1607 Aug 13, 2024
beef5c1
Updated README (#228)
shivam71 Aug 14, 2024
60a20d0
[JVSC #199] Backport NetBeans 24 patch 7610 (#236)
sid-srini Aug 14, 2024
e5b6243
[JAVAVSCODE #194] applying netbeans patch(pr-7641) - Formatter doesn'…
naren2605 Aug 14, 2024
8693aa0
Patch for PR #7654 (#238)
subhash-arabhi Aug 14, 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 BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!--

Copyright (c) 2023, Oracle and/or its affiliates.
Copyright (c) 2023, 2024, Oracle and/or its affiliates.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -30,20 +30,20 @@
- JDK, version 11 or later upto JDK 22
- Ant, latest version
- Maven, latest version
- node.js, latest LTS (to build VSIX)
- Node.js, latest LTS (to build VSIX)


## Fetching and building netbeans code
## Fetching and building the code

```bash
$ git clone https://github.com/oracle/javavscode.git
$ cd javavscode/
$ git clone https://github.com/apache/netbeans.git
$ cd netbeans/
$ git checkout 22
$ cd ..
# the following target requires git executable to be on PATH:
$ ant apply-patches
$ ant build-netbeans

```

## Building VS Code extension
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ If the system does not detect any JDK, the extension will offer a downloader and
Alternatively, you can manually specify the path to JDK binaries by utilizing the JDK downloader.
You can also access the JDK downloader through the "Download, install, and Use JDK" option in the command palette.
![JDK Downloader](vscode/images/jdk_downloader.png)
## Enabling Java Preview Features
When using preview features use the quick fix action option to easily enable them.

![Enable Preview](vscode/images/enable_preview.gif)
## Supported Refactorings

Class level refactorings as well as variable refactorings are supported in VSCode via Oracle Java Platform extension. See following screenshots:
Expand Down
43 changes: 40 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,39 @@
<property name="nbplatform.default.harness.dir" location="${nbplatform.default.netbeans.dest.dir}/harness" />
<property name="nbantext.jar" location="netbeans/nbbuild/build/nbantext.jar" />
<property name="nb_all" location="netbeans" />
<property name="patches" value="patches/6330.diff patches/7001.diff patches/7271.diff patches/7353.diff patches/7368.diff patches/7370.diff patches/7382.diff patches/7491-preliminary.diff patches/mvn-sh.diff patches/generate-dependencies.diff patches/rename-debugger.diff patches/remove-db.diff patches/nbjavac-not-required.diff" />
<loadresource property="patch-files">
<string>
patches/6330.diff
patches/7001.diff
patches/7271.diff
patches/7353.diff
patches/7368.diff
patches/7370.diff
patches/7382.diff
patches/7491-preliminary.diff
patches/7548_source-1.8.diff
patches/7583_source-1.8.diff
patches/7610.diff
patches/7621.diff
patches/7641.diff
patches/7654.diff
patches/mvn-sh.diff
patches/generate-dependencies.diff
patches/rename-debugger.diff
patches/remove-db.diff
patches/nbjavac-not-required.diff
</string>
<filterchain>
<tokenfilter delimoutput=" ">
<replaceregex pattern="\s+" replace=""/>
</tokenfilter>
</filterchain>
</loadresource>
<property name="patches" value="${patch-files}"/>
<condition property="has-patches">
<length string="${patches}" trim="true" when="greater" length="0"/>
</condition>

<condition property="cmd.suffix" value=".cmd" else="">
<os family="windows"/>
</condition>
Expand Down Expand Up @@ -175,7 +207,8 @@
</exec>
</target>

<target name="apply-patches">
<target name="apply-patches" if="has-patches">
<echo>${patches}</echo>
<exec executable="git">
<arg value="apply"/>
<arg value="--directory=netbeans"/>
Expand All @@ -184,7 +217,7 @@
</exec>
</target>

<target name="unapply-patches">
<target name="unapply-patches" if="has-patches">
<!--in the reverse order:-->
<echo file="${build.dir}/Reverse.java">
import java.util.Arrays;
Expand Down Expand Up @@ -218,6 +251,10 @@
<ant dir="netbeans" inheritAll="false" inheritRefs="false" useNativeBasedir="true"/>
</target>

<target name="clean-netbeans">
<ant dir="netbeans" target="clean" inheritAll="false" inheritRefs="false" useNativeBasedir="true"/>
</target>

<target name="generate-netbeans-license-summary" depends="-set-use-jdk-javac,proxy-setup" description="Generate license summary">
<delete dir="${build.dir}/nblic" />
<mkdir dir="${build.dir}/nblic/nbcode" />
Expand Down
2 changes: 0 additions & 2 deletions nbcode/nbproject/platform.properties
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,13 @@ disabled.modules=\
org.netbeans.modules.docker.ui,\
org.netbeans.modules.editor.autosave,\
org.netbeans.modules.editor.bookmarks,\
org.netbeans.modules.editor.deprecated.pre65formatting,\
org.netbeans.modules.editor.global.format,\
org.netbeans.modules.editor.htmlui,\
org.netbeans.modules.editor.kit,\
org.netbeans.modules.editor.macros,\
org.netbeans.modules.editor.plain,\
org.netbeans.modules.editor.plain.lib,\
org.netbeans.modules.editor.search,\
org.netbeans.modules.editor.structure,\
org.netbeans.modules.extbrowser,\
org.netbeans.modules.extbrowser.chrome,\
org.netbeans.modules.extexecution.impl,\
Expand Down
73 changes: 73 additions & 0 deletions patches/7548_source-1.8.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Unused.java b/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Unused.java
index e681ed7b97..0d0c3c4c77 100644
--- a/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Unused.java
+++ b/java/java.hints/src/org/netbeans/modules/java/hints/bugs/Unused.java
@@ -20,6 +20,7 @@ package org.netbeans.modules.java.hints.bugs;

import com.sun.source.tree.Tree.Kind;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javax.lang.model.element.ElementKind;
import org.netbeans.modules.java.editor.base.semantic.UnusedDetector;
@@ -34,6 +35,7 @@ import org.netbeans.spi.java.hints.JavaFixUtilities;
import org.netbeans.spi.java.hints.TriggerTreeKind;
import org.openide.util.NbBundle.Messages;

+import static org.netbeans.api.java.source.CompilationInfo.CacheClearPolicy.ON_TASK_END;
/**
*
* @author lahvac
@@ -52,25 +54,47 @@ public class Unused {
@BooleanOption(displayName="#LBL_UnusedPackagePrivate", tooltip="#TP_UnusedPackagePrivate", defaultValue=DETECT_UNUSED_PACKAGE_PRIVATE_DEFAULT)
public static final String DETECT_UNUSED_PACKAGE_PRIVATE = "detect.unused.package.private";

- @TriggerTreeKind(Kind.COMPILATION_UNIT)
+ @TriggerTreeKind({
+ //class-like kinds:
+ Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE, Kind.RECORD,
+ Kind.VARIABLE,
+ Kind.METHOD
+ })
public static List<ErrorDescription> unused(HintContext ctx) {
List<UnusedDescription> unused = UnusedDetector.findUnused(ctx.getInfo(), () -> ctx.isCanceled());
- List<ErrorDescription> result = new ArrayList<>(unused.size());
- boolean detectUnusedPackagePrivate = ctx.getPreferences().getBoolean(DETECT_UNUSED_PACKAGE_PRIVATE, DETECT_UNUSED_PACKAGE_PRIVATE_DEFAULT);
+ if (unused.isEmpty()) {
+ return null;
+ }
+ boolean detectUnusedPackagePrivate = getTaskCachedBoolean(ctx, DETECT_UNUSED_PACKAGE_PRIVATE, DETECT_UNUSED_PACKAGE_PRIVATE_DEFAULT);
for (UnusedDescription ud : unused) {
if (ctx.isCanceled()) {
break;
}
+ if (ud.unusedElementPath.getLeaf() != ctx.getPath().getLeaf()) {
+ continue;
+ }
if (!detectUnusedPackagePrivate && ud.packagePrivate) {
continue;
}
ErrorDescription err = convertUnused(ctx, ud);
if (err != null) {
- result.add(err);
+ return Arrays.asList(err);
}
+ break;
}
- return result;
+ return null;
}
+
+ // reading from AuxiliaryConfigBasedPreferences in inner loops is not cheap since it needs a mutex
+ private static boolean getTaskCachedBoolean(HintContext ctx, String key, boolean defaultVal) {
+ Object cached = ctx.getInfo().getCachedValue(key);
+ if (cached instanceof Boolean) {
+ return (Boolean)cached;
+ }
+ boolean fromPrefs = ctx.getPreferences().getBoolean(key, defaultVal);
+ ctx.getInfo().putCachedValue(key, fromPrefs, ON_TASK_END);
+ return fromPrefs;
+ }

@Messages({
"# {0} - variable name",
80 changes: 80 additions & 0 deletions patches/7583_source-1.8.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
index 024f95a670..0a106ffbb6 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
@@ -101,9 +101,10 @@ public final class GradleDistributionManager {
GradleVersion.version("7.6"), // JDK-19
GradleVersion.version("8.3"), // JDK-20
GradleVersion.version("8.5"), // JDK-21
+ GradleVersion.version("8.8"), // JDK-22
};

- private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("8.7"); //NOI18N
+ private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("8.9"); //NOI18N

final File gradleUserHome;

diff --git a/extide/libs.gradle/external/binaries-list b/extide/libs.gradle/external/binaries-list
index 2e58f89b85fd..dff2c2265b37 100644
--- a/extide/libs.gradle/external/binaries-list
+++ b/extide/libs.gradle/external/binaries-list
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

-5F48B9BB9099B900FC33864A3794F31C439D9F73 https://repo.gradle.org/artifactory/libs-releases/org/gradle/gradle-tooling-api/8.7/gradle-tooling-api-8.7.jar gradle-tooling-api-8.7.jar
+7BCC4423C529A42ECA9D0CE5B5275369EF4DF55A https://repo.gradle.org/artifactory/libs-releases/org/gradle/gradle-tooling-api/8.9/gradle-tooling-api-8.9.jar gradle-tooling-api-8.9.jar
diff --git a/extide/libs.gradle/external/gradle-tooling-api-8.7-license.txt b/extide/libs.gradle/external/gradle-tooling-api-8.9-license.txt
similarity index 99%
rename from extide/libs.gradle/external/gradle-tooling-api-8.7-license.txt
rename to extide/libs.gradle/external/gradle-tooling-api-8.9-license.txt
index 84a9de902f75..74cb1addb8d6 100644
--- a/extide/libs.gradle/external/gradle-tooling-api-8.7-license.txt
+++ b/extide/libs.gradle/external/gradle-tooling-api-8.9-license.txt
@@ -1,7 +1,7 @@
Name: Gradle Tooling API
Description: Gradle Tooling API
-Version: 8.7
-Files: gradle-tooling-api-8.7.jar
+Version: 8.9
+Files: gradle-tooling-api-8.9.jar
License: Apache-2.0
Origin: Gradle Inc.
URL: https://gradle.org/
diff --git a/extide/libs.gradle/external/gradle-tooling-api-8.7-notice.txt b/extide/libs.gradle/external/gradle-tooling-api-8.9-notice.txt
similarity index 100%
rename from extide/libs.gradle/external/gradle-tooling-api-8.7-notice.txt
rename to extide/libs.gradle/external/gradle-tooling-api-8.9-notice.txt
diff --git a/extide/libs.gradle/manifest.mf b/extide/libs.gradle/manifest.mf
index 64b5cf508e40..a489976e11ed 100644
--- a/extide/libs.gradle/manifest.mf
+++ b/extide/libs.gradle/manifest.mf
@@ -2,4 +2,4 @@ Manifest-Version: 1.0
AutoUpdate-Show-In-Client: false
OpenIDE-Module: org.netbeans.modules.libs.gradle/8
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/libs/gradle/Bundle.properties
-OpenIDE-Module-Specification-Version: 8.7
+OpenIDE-Module-Specification-Version: 8.9
diff --git a/extide/libs.gradle/nbproject/project.properties b/extide/libs.gradle/nbproject/project.properties
index 6cd0e22d8315..6e4605fe4922 100644
--- a/extide/libs.gradle/nbproject/project.properties
+++ b/extide/libs.gradle/nbproject/project.properties
@@ -22,4 +22,4 @@ javac.compilerargs=-Xlint -Xlint:-serial
# Sigtest fails to read the classes in the gradle-tooling-api
sigtest.skip.gen=true

-release.external/gradle-tooling-api-8.7.jar=modules/gradle/gradle-tooling-api.jar
+release.external/gradle-tooling-api-8.9.jar=modules/gradle/gradle-tooling-api.jar
diff --git a/extide/libs.gradle/nbproject/project.xml b/extide/libs.gradle/nbproject/project.xml
index dc58e80a4500..d82027b5e615 100644
--- a/extide/libs.gradle/nbproject/project.xml
+++ b/extide/libs.gradle/nbproject/project.xml
@@ -39,7 +39,7 @@
</public-packages>
<class-path-extension>
<runtime-relative-path>gradle/gradle-tooling-api.jar</runtime-relative-path>
- <binary-origin>external/gradle-tooling-api-8.7.jar</binary-origin>
+ <binary-origin>external/gradle-tooling-api-8.9.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
Loading