diff --git a/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NBMNativeMWI.java b/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NBMNativeMWI.java index 16b3c8508079..5a7c08bc9b53 100644 --- a/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NBMNativeMWI.java +++ b/apisupport/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NBMNativeMWI.java @@ -24,8 +24,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.Collections; import java.util.List; import java.util.Properties; @@ -49,6 +47,7 @@ import org.netbeans.modules.maven.model.pom.Project; import org.netbeans.modules.maven.model.pom.Repository; import org.netbeans.modules.maven.model.pom.RepositoryPolicy; +import org.netbeans.modules.maven.options.MavenVersionSettings; import org.netbeans.modules.maven.spi.newproject.CreateProjectBuilder; import org.openide.util.Exceptions; @@ -58,12 +57,12 @@ */ final class NBMNativeMWI { - static void instantiate(ProjectInfo vi, File projFile, String version, boolean useOsgi, MavenProject mp) { + static void instantiate(ProjectInfo vi, File projFile, String nbVersion, boolean useOsgi, MavenProject mp) { CreateProjectBuilder builder = new CreateProjectBuilder(projFile, vi.groupId, vi.artifactId, vi.version) .setPackageName(vi.packageName) .setPackaging("nbm") .setAdditionalNonPomWork(new AdditionalFiles()) - .setAdditionalOperations(new AdditionalOperations(version, useOsgi)); + .setAdditionalOperations(new AdditionalOperations(nbVersion, useOsgi)); if (mp != null) { builder = builder.setParentProject(mp); } @@ -237,7 +236,6 @@ public void performOperation(POMModel model) { //nbm-maven-plugin boolean addPlugin = true; String managedPVersion = null; - String pVersion = MavenNbModuleImpl.getLatestNbmPluginVersion(); // boolean useOsgiDepsSet = false; if (parent != null) { //TODO do we want to support the case when the plugin is defined in parent pom with inherited=true? @@ -259,12 +257,13 @@ public void performOperation(POMModel model) { } } } + MavenVersionSettings settings = MavenVersionSettings.getDefault(); if (addPlugin) { Plugin p = model.getFactory().createPlugin(); p.setGroupId(MavenNbModuleImpl.GROUPID_APACHE); p.setArtifactId(MavenNbModuleImpl.NBM_PLUGIN); if (managedPVersion == null) { - p.setVersion(pVersion); + p.setVersion(MavenNbModuleImpl.getLatestNbmPluginVersion()); } p.setExtensions(true); if (useOsgi) { @@ -278,52 +277,44 @@ public void performOperation(POMModel model) { //now comes the compiler plugin addPlugin = true; managedPVersion = null; - String source = null; - String target = null; - pVersion = "3.11.0"; if (parent != null) { //TODO do we want to support the case when the plugin is defined in parent pom with inherited=true? PluginManagement pm = parent.getPluginManagement(); if (pm != null) { - for (org.apache.maven.model.Plugin p : pm.getPlugins()) { - if (Constants.GROUP_APACHE_PLUGINS.equals(p.getGroupId()) && Constants.PLUGIN_COMPILER.equals(p.getArtifactId())) { - managedPVersion = p.getVersion(); - Xpp3Dom conf = (Xpp3Dom) p.getConfiguration(); - if (conf != null) { - Xpp3Dom sourceEl = conf.getChild("source"); - if (sourceEl != null) { - source = sourceEl.getValue(); - } - Xpp3Dom targetEl = conf.getChild("target"); - if (targetEl != null) { - target = targetEl.getValue(); + if (parent.getProperties().getProperty("maven.compiler.release") != null) { + addPlugin = false; + } else { + for (org.apache.maven.model.Plugin p : pm.getPlugins()) { + if (Constants.GROUP_APACHE_PLUGINS.equals(p.getGroupId()) && Constants.PLUGIN_COMPILER.equals(p.getArtifactId())) { + managedPVersion = p.getVersion(); + Xpp3Dom conf = (Xpp3Dom) p.getConfiguration(); + if (conf != null) { + if ( conf.getChild("release") != null + || conf.getChild("source") != null + || conf.getChild("target") != null) { + addPlugin = false; + } } + break; } - break; } } } } - addPlugin = target == null || source == null; if (addPlugin) { Plugin p = model.getFactory().createPlugin(); p.setGroupId(Constants.GROUP_APACHE_PLUGINS); p.setArtifactId(Constants.PLUGIN_COMPILER); if (managedPVersion == null) { - p.setVersion(pVersion); + p.setVersion(settings.getVersion(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER)); } - Configuration c = model.getFactory().createConfiguration(); - c.setSimpleParameter("source", "1.8"); - c.setSimpleParameter("target", "1.8"); - p.setConfiguration(c); getOrCreateBuild(model).addPlugin(p); + model.getProject().getProperties().setProperty("maven.compiler.release", "17"); } //now the jar plugin - addPlugin = true; managedPVersion = null; String useManifest = null; - pVersion = "3.3.0"; if (parent != null) { //TODO do we want to support the case when the plugin is defined in parent pom with inherited=true? PluginManagement pm = parent.getPluginManagement(); @@ -359,6 +350,7 @@ public void performOperation(POMModel model) { p.setGroupId(Constants.GROUP_APACHE_PLUGINS); p.setArtifactId(Constants.PLUGIN_JAR); if (managedPVersion == null) { + String pVersion = settings.getVersion(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_JAR); p.setVersion(pVersion); managedPVersion = pVersion; } diff --git a/apisupport/maven.apisupport/test/unit/src/org/netbeans/modules/maven/apisupport/NBMNativeMWITest.java b/apisupport/maven.apisupport/test/unit/src/org/netbeans/modules/maven/apisupport/NBMNativeMWITest.java index 869fe7a1b20a..2fa9e7aa1c21 100644 --- a/apisupport/maven.apisupport/test/unit/src/org/netbeans/modules/maven/apisupport/NBMNativeMWITest.java +++ b/apisupport/maven.apisupport/test/unit/src/org/netbeans/modules/maven/apisupport/NBMNativeMWITest.java @@ -38,6 +38,8 @@ public class NBMNativeMWITest extends NbTestCase { + private static final String EXPECTED_JAVAC_PLUGIN_VERSION = "3.13.0"; + private FileObject wd; public NBMNativeMWITest(String testName) { @@ -64,7 +66,7 @@ public void testPathNoParent() throws IOException, XmlPullParserException { assertEquals("nbm-maven-plugin", model.getBuild().getPlugins().get(0).getArtifactId()); assertEquals(MavenNbModuleImpl.getLatestNbmPluginVersion(), model.getBuild().getPlugins().get(0).getVersion()); assertEquals("maven-compiler-plugin", model.getBuild().getPlugins().get(1).getArtifactId()); - assertEquals("3.11.0", model.getBuild().getPlugins().get(1).getVersion()); + assertEquals(EXPECTED_JAVAC_PLUGIN_VERSION, model.getBuild().getPlugins().get(1).getVersion()); assertEquals(0, model.getRepositories().size()); } @@ -82,7 +84,7 @@ public void testPathNoParentSnapshot() throws IOException, XmlPullParserExceptio assertEquals("nbm-maven-plugin", model.getBuild().getPlugins().get(0).getArtifactId()); assertEquals(MavenNbModuleImpl.getLatestNbmPluginVersion(), model.getBuild().getPlugins().get(0).getVersion()); assertEquals("maven-compiler-plugin", model.getBuild().getPlugins().get(1).getArtifactId()); - assertEquals("3.11.0", model.getBuild().getPlugins().get(1).getVersion()); + assertEquals(EXPECTED_JAVAC_PLUGIN_VERSION, model.getBuild().getPlugins().get(1).getVersion()); assertEquals(1, model.getRepositories().size()); } @@ -109,7 +111,7 @@ public void testPathParent() throws IOException, XmlPullParserException { assertEquals("nbm-maven-plugin", model.getBuild().getPlugins().get(0).getArtifactId()); assertEquals(MavenNbModuleImpl.getLatestNbmPluginVersion(), model.getBuild().getPlugins().get(0).getVersion()); assertEquals("maven-compiler-plugin", model.getBuild().getPlugins().get(1).getArtifactId()); - assertEquals("3.11.0", model.getBuild().getPlugins().get(1).getVersion()); + assertEquals(EXPECTED_JAVAC_PLUGIN_VERSION, model.getBuild().getPlugins().get(1).getVersion()); assertEquals(0, model.getRepositories().size()); } @@ -135,7 +137,7 @@ public void testPathParentSnapshot() throws IOException, XmlPullParserException assertEquals("nbm-maven-plugin", model.getBuild().getPlugins().get(0).getArtifactId()); assertEquals(MavenNbModuleImpl.getLatestNbmPluginVersion(), model.getBuild().getPlugins().get(0).getVersion()); assertEquals("maven-compiler-plugin", model.getBuild().getPlugins().get(1).getArtifactId()); - assertEquals("3.11.0", model.getBuild().getPlugins().get(1).getVersion()); + assertEquals(EXPECTED_JAVAC_PLUGIN_VERSION, model.getBuild().getPlugins().get(1).getVersion()); assertEquals(1, model.getRepositories().size()); } @@ -190,7 +192,7 @@ public void testPathParentJar() throws IOException, XmlPullParserException { assertEquals("nbm-maven-plugin", modeloutput.getBuild().getPlugins().get(0).getArtifactId()); assertEquals(MavenNbModuleImpl.getLatestNbmPluginVersion(), modeloutput.getBuild().getPlugins().get(0).getVersion()); assertEquals("maven-compiler-plugin", modeloutput.getBuild().getPlugins().get(1).getArtifactId()); - assertEquals("3.11.0", modeloutput.getBuild().getPlugins().get(1).getVersion()); + assertEquals(EXPECTED_JAVAC_PLUGIN_VERSION, modeloutput.getBuild().getPlugins().get(1).getVersion()); assertEquals(0, model.getRepositories().size()); } diff --git a/java/debugger.jpda.truffle/nbproject/project.properties b/java/debugger.jpda.truffle/nbproject/project.properties index 06747ea9f86f..8e7e11308a78 100644 --- a/java/debugger.jpda.truffle/nbproject/project.properties +++ b/java/debugger.jpda.truffle/nbproject/project.properties @@ -16,7 +16,7 @@ # under the License. javac.compilerargs=-Xlint:unchecked -javac.source=1.8 +javac.release=11 javadoc.arch=${basedir}/arch.xml nbm.module.author=Martin Entlicher requires.nb.javac=true diff --git a/java/debugger.jpda.truffle/src/org/netbeans/modules/debugger/jpda/truffle/RemoteServices.java b/java/debugger.jpda.truffle/src/org/netbeans/modules/debugger/jpda/truffle/RemoteServices.java index 7c18aeb95f63..9cfb63cd488f 100644 --- a/java/debugger.jpda.truffle/src/org/netbeans/modules/debugger/jpda/truffle/RemoteServices.java +++ b/java/debugger.jpda.truffle/src/org/netbeans/modules/debugger/jpda/truffle/RemoteServices.java @@ -180,11 +180,7 @@ private static ObjectReference getContextClassLoader(ThreadReference tawt, Virtu private static int getTargetMajorVersion(VirtualMachine vm) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { String version = VirtualMachineWrapper.version(vm); - int dot = version.indexOf("."); - if (dot < 0) { - dot = version.length(); - } - return Integer.parseInt(version.substring(0, dot)); + return Runtime.Version.parse(version).feature(); } public static ClassObjectReference uploadBasicClasses(JPDAThreadImpl t, String basicClassName) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException, IOException, PropertyVetoException, InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper, UnsupportedOperationExceptionWrapper, ClassNotPreparedExceptionWrapper { diff --git a/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/VariableMirrorTranslator.java b/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/VariableMirrorTranslator.java index be74e4d2453d..b544af8ea94b 100644 --- a/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/VariableMirrorTranslator.java +++ b/java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/VariableMirrorTranslator.java @@ -49,7 +49,7 @@ import java.io.InvalidObjectException; import java.lang.reflect.Array; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.InaccessibleObjectException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -250,7 +250,12 @@ private static Object setFieldsValues(Object newInstance, Class clazz, Map { @@ -1545,6 +1545,7 @@ static class FieldItem extends WhiteListJavaCompletionItem { private String typeName; private String leftText; private String rightText; + private CharSequence sortText; private boolean autoImportEnclosingType; private CharSequence enclSortText; private int castEndOffset; @@ -1597,7 +1598,10 @@ public int getSortPriority() { @Override public CharSequence getSortText() { - return simpleName + "#" + enclSortText; //NOI18N + if (sortText == null) { + sortText = LazySortText.link(simpleName, enclSortText); + } + return sortText; } @Override @@ -1827,7 +1831,7 @@ static class MethodItem extends WhiteListJavaCompletionItem { protected List params; private String typeName; private boolean addSemicolon; - private String sortText; + private CharSequence sortText; private String leftText; private String rightText; private boolean autoImportEnclosingType; @@ -1910,7 +1914,7 @@ public CharSequence getSortText() { cnt++; } sortParams.append(')'); - sortText = simpleName + "#" + enclSortText + "#" + ((cnt < 10 ? "0" : "") + cnt) + "#" + sortParams.toString(); //NOI18N + sortText = LazySortText.link(simpleName, enclSortText, ((cnt < 10 ? "0" : "") + cnt) + "#" + sortParams.toString()); //NOI18N } return sortText; } diff --git a/java/java.editor/src/org/netbeans/modules/editor/java/LazySortText.java b/java/java.editor/src/org/netbeans/modules/editor/java/LazySortText.java index 47ed375f9a77..2ef4682971d7 100644 --- a/java/java.editor/src/org/netbeans/modules/editor/java/LazySortText.java +++ b/java/java.editor/src/org/netbeans/modules/editor/java/LazySortText.java @@ -24,15 +24,18 @@ import org.netbeans.api.java.source.support.ReferencesCount; /** + * Characters are lazily computed in charAt(), avoid toString(). + * + * Use link() to combine lazy sequences. * * @author Dusan Balek */ -class LazySortText implements CharSequence { +final class LazySortText implements CharSequence { - private String simpleName; - private String enclName; - private ElementHandle handle; - private ReferencesCount referencesCount; + private final String simpleName; + private final String enclName; + private final ElementHandle handle; + private final ReferencesCount referencesCount; private String importanceLevel = null; LazySortText(String simpleName, String enclName, ElementHandle handle, ReferencesCount referencesCount) { @@ -48,6 +51,7 @@ public int length() { } @Override + @SuppressWarnings("AssignmentToMethodParameter") public char charAt(int index) { if ((index < 0) || (index >= length())) { throw new StringIndexOutOfBoundsException(index); @@ -74,10 +78,61 @@ public CharSequence subSequence(int start, int end) { throw new UnsupportedOperationException("Not supported yet."); //NOI18N } + @Override + public String toString() { + return new StringBuilder(this).toString(); + } + private String getImportanceLevel() { if (importanceLevel == null) { importanceLevel = String.format("%8d", Utilities.getImportanceLevel(referencesCount, handle)); //NOI18N } return importanceLevel; } + + public static CharSequence link(CharSequence first, CharSequence second) { + return new LinkedLazyCharSequence(first, second); + } + + public static CharSequence link(CharSequence first, CharSequence second, CharSequence third) { + return new LinkedLazyCharSequence(first, new LinkedLazyCharSequence(second, third)); + } + + private static final class LinkedLazyCharSequence implements CharSequence { + + private final CharSequence first; + private final CharSequence second; + private final int length; + + private LinkedLazyCharSequence(CharSequence first, CharSequence second) { + this.first = first; + this.second = second; + this.length = first.length() + second.length() + 1; + } + + @Override + @SuppressWarnings("AssignmentToMethodParameter") + public char charAt(int index) { + if (index < first.length()) { + return first.charAt(index); + } + index -= first.length(); + if (index-- == 0) { + return '#'; + } + return second.charAt(index); + } + + @Override + public int length() { + return length; + } + + @Override + public CharSequence subSequence(int start, int end) { + throw new UnsupportedOperationException("Not supported yet."); //NOI18N + } + + } + } diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ConstructorGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ConstructorGenerator.java index 583f90585472..c4602b78e2d6 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ConstructorGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ConstructorGenerator.java @@ -188,7 +188,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat data.put(OFFSET, startOffset); data.put(CONSTRUCTORS, constructors); data.put(FIELDS, fields); - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateConstructor(), isSource ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", GENERATE_CONSTRUCTOR, data)); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateConstructor(), isSource ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_CONSTRUCTOR, client.getNbCodeCapabilities()), data)); } @Override diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/DelegateMethodGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/DelegateMethodGenerator.java index 74c4523b85be..b7eae2e038e4 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/DelegateMethodGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/DelegateMethodGenerator.java @@ -137,7 +137,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat data.put(OFFSET, offset); data.put(TYPE, typeItem); data.put(FIELDS, fields); - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateDelegateMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_DELEGATE_METHOD, data)); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateDelegateMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_DELEGATE_METHOD, client.getNbCodeCapabilities()), data)); } @Override diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/EqualsHashCodeGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/EqualsHashCodeGenerator.java index 4e9b4f747a59..7f2a8084d80f 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/EqualsHashCodeGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/EqualsHashCodeGenerator.java @@ -115,11 +115,11 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat String uri = Utils.toUri(info.getFileObject()); if (equalsHashCode[0] == null) { if (equalsHashCode[1] == null) { - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateEqualsHashCode(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_EQUALS_HASHCODE, data(0, uri, offset, fields))); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateEqualsHashCode(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_EQUALS_HASHCODE, client.getNbCodeCapabilities()), data(0, uri, offset, fields))); } - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateEquals(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_EQUALS_HASHCODE, data(EQUALS_ONLY, uri, offset, fields))); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateEquals(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_EQUALS_HASHCODE, client.getNbCodeCapabilities()), data(EQUALS_ONLY, uri, offset, fields))); } - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateHashCode(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_EQUALS_HASHCODE, data(HASH_CODE_ONLY, uri, offset, fields))); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateHashCode(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_EQUALS_HASHCODE, client.getNbCodeCapabilities()), data(HASH_CODE_ONLY, uri, offset, fields))); } @Override diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/GetterSetterGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/GetterSetterGenerator.java index fb85050e92be..0a96c15dcea8 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/GetterSetterGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/GetterSetterGenerator.java @@ -103,7 +103,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat List result = new ArrayList<>(); if (missingGetters) { String name = pair.first().size() == 1 ? Bundle.DN_GenerateGetterFor(pair.first().iterator().next().getSimpleName().toString()) : Bundle.DN_GenerateGetters(); - result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", GENERATE_GETTER_SETTER, data(GeneratorUtils.GETTERS_ONLY, uri, offset, all, pair.first().stream().map(variableElement -> { + result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_GETTER_SETTER, client.getNbCodeCapabilities()), data(GeneratorUtils.GETTERS_ONLY, uri, offset, all, pair.first().stream().map(variableElement -> { QuickPickItem item = new QuickPickItem(createLabel(info, variableElement)); item.setUserData(new ElementData(variableElement)); return item; @@ -111,7 +111,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat } if (missingSetters) { String name = pair.second().size() == 1 ? Bundle.DN_GenerateSetterFor(pair.second().iterator().next().getSimpleName().toString()) : Bundle.DN_GenerateSetters(); - result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", GENERATE_GETTER_SETTER, data(GeneratorUtils.SETTERS_ONLY, uri, offset, all, pair.second().stream().map(variableElement -> { + result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_GETTER_SETTER, client.getNbCodeCapabilities()), data(GeneratorUtils.SETTERS_ONLY, uri, offset, all, pair.second().stream().map(variableElement -> { QuickPickItem item = new QuickPickItem(createLabel(info, variableElement)); item.setUserData(new ElementData(variableElement)); return item; @@ -120,7 +120,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat if (missingGetters && missingSetters) { pair.first().retainAll(pair.second()); String name = pair.first().size() == 1 ? Bundle.DN_GenerateGetterSetterFor(pair.first().iterator().next().getSimpleName().toString()) : Bundle.DN_GenerateGettersSetters(); - result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", GENERATE_GETTER_SETTER, data(0, uri, offset, all, pair.first().stream().map(variableElement -> { + result.add(createCodeAction(client, name, all ? CODE_GENERATOR_KIND : CodeActionKind.QuickFix, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_GETTER_SETTER, client.getNbCodeCapabilities()), data(0, uri, offset, all, pair.first().stream().map(variableElement -> { QuickPickItem item = new QuickPickItem(createLabel(info, variableElement)); item.setUserData(new ElementData(variableElement)); return item; diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ImplementOverrideMethodGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ImplementOverrideMethodGenerator.java index c839e8e60dde..4aca8de3ca64 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ImplementOverrideMethodGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ImplementOverrideMethodGenerator.java @@ -109,7 +109,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat implementMethods.add(new QuickPickItem(createLabel(info, method), enclosingTypeName, null, mustImplement, new ElementData(method))); } if (!implementMethods.isEmpty()) { - result.add(createCodeAction(client, Bundle.DN_GenerateImplementMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_IMPLEMENT_OVERRIDE, data(uri, offset, true, implementMethods))); + result.add(createCodeAction(client, Bundle.DN_GenerateImplementMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_IMPLEMENT_OVERRIDE, client.getNbCodeCapabilities()), data(uri, offset, true, implementMethods))); } } if (typeElement.getKind().isClass() || typeElement.getKind().isInterface()) { @@ -125,7 +125,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat overrideMethods.add(item); } if (!overrideMethods.isEmpty()) { - result.add(createCodeAction(client, Bundle.DN_GenerateOverrideMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_IMPLEMENT_OVERRIDE, data(uri, offset, false, overrideMethods))); + result.add(createCodeAction(client, Bundle.DN_GenerateOverrideMethod(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_IMPLEMENT_OVERRIDE, client.getNbCodeCapabilities()), data(uri, offset, false, overrideMethods))); } } return result; diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LoggerGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LoggerGenerator.java index 4c92f0975fd2..46afb67b3541 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LoggerGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LoggerGenerator.java @@ -108,7 +108,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat Map data = new HashMap<>(); data.put(URI, uri); data.put(OFFSET, offset); - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateLogger(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_LOGGER, data)); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateLogger(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_LOGGER, client.getNbCodeCapabilities()), data)); } @Override diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ToStringGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ToStringGenerator.java index b88b31213572..9391da00bffa 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ToStringGenerator.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ToStringGenerator.java @@ -116,7 +116,7 @@ public List getCodeActions(NbCodeLanguageClient client, ResultIterat data.put(URI, uri); data.put(OFFSET, offset); data.put(FIELDS, fields); - return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateToString(), CODE_GENERATOR_KIND, null, "nbls.generate.code", GENERATE_TO_STRING, data)); + return Collections.singletonList(createCodeAction(client, Bundle.DN_GenerateToString(), CODE_GENERATOR_KIND, null, "nbls.generate.code", Utils.encodeCommand(GENERATE_TO_STRING, client.getNbCodeCapabilities()), data)); } @Override diff --git a/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java b/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java index 5c72770889b5..db4d16d9d7fb 100644 --- a/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java +++ b/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java @@ -393,6 +393,9 @@ public Tree visitType(TypeElement e, Void p) { List members = new LinkedList(); for (Element m : e.getEnclosedElements()) { + if (m.getKind() == ElementKind.RECORD_COMPONENT) { + continue; // TODO update to 'extend AbstractElementVisitor14'; visiting record components causes UnknownElementException + } Tree member = visit(m); if (member != null) @@ -408,6 +411,10 @@ public Tree visitType(TypeElement e, Void p) { return addDeprecated(e, make.Interface(mods, e.getSimpleName(), constructTypeParams(e.getTypeParameters()), computeSuper(e.getInterfaces()), members)); case ENUM: return addDeprecated(e, make.Enum(mods, e.getSimpleName(), computeSuper(e.getInterfaces()), members)); + case RECORD: + // TODO generates final class atm + return addDeprecated(e, make.Class(mods, e.getSimpleName(), constructTypeParams(e.getTypeParameters()), null, computeSuper(e.getInterfaces()), members)); +// return addDeprecated(e, make.Record(mods, e.getSimpleName(), computeSuper(e.getInterfaces()), members)); case ANNOTATION_TYPE: return addDeprecated(e, make.AnnotationType(mods, e.getSimpleName(), members)); default: @@ -782,6 +789,8 @@ public void writeInstr(Instruction instr) { IMPLICIT_MODIFIERS = new HashMap, Set>(); IMPLICIT_MODIFIERS.put(Arrays.asList(ElementKind.ENUM), EnumSet.of(Modifier.STATIC, Modifier.ABSTRACT, Modifier.FINAL)); + // TODO implement record support +// IMPLICIT_MODIFIERS.put(Arrays.asList(ElementKind.RECORD), EnumSet.of(Modifier.STATIC, Modifier.ABSTRACT, Modifier.FINAL)); IMPLICIT_MODIFIERS.put(Arrays.asList(ElementKind.ANNOTATION_TYPE), EnumSet.of(Modifier.STATIC, Modifier.ABSTRACT)); IMPLICIT_MODIFIERS.put(Arrays.asList(ElementKind.METHOD, ElementKind.ANNOTATION_TYPE), EnumSet.of(Modifier.ABSTRACT)); IMPLICIT_MODIFIERS.put(Arrays.asList(ElementKind.METHOD, ElementKind.INTERFACE), EnumSet.of(Modifier.ABSTRACT)); diff --git a/java/libs.javacapi/external/binaries-list b/java/libs.javacapi/external/binaries-list index bac517586c21..e60394b73b4c 100644 --- a/java/libs.javacapi/external/binaries-list +++ b/java/libs.javacapi/external/binaries-list @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -C251D126090F6362D805B1987372BF4963B3782C com.dukescript.nbjavac:nb-javac:jdk-23+30 -A9105543E5EB96B9705D338A4C42A3A89E25A19A com.dukescript.nbjavac:nb-javac:jdk-23+30:api +1B70EC8A5230901C0EEE6EDF9829B43EAFAE9CC9 com.dukescript.nbjavac:nb-javac:jdk-23+35 +B3CB7A425EC7AAADA60754E6DF2E5E2D990E91AE com.dukescript.nbjavac:nb-javac:jdk-23+35:api diff --git a/java/libs.javacapi/external/nb-javac-jdk-23+30-license.txt b/java/libs.javacapi/external/nb-javac-jdk-23+35-license.txt similarity index 99% rename from java/libs.javacapi/external/nb-javac-jdk-23+30-license.txt rename to java/libs.javacapi/external/nb-javac-jdk-23+35-license.txt index 0995f2175e2e..e1852eaac70c 100644 --- a/java/libs.javacapi/external/nb-javac-jdk-23+30-license.txt +++ b/java/libs.javacapi/external/nb-javac-jdk-23+35-license.txt @@ -1,7 +1,7 @@ Name: Javac Compiler Implementation Description: Javac Compiler Implementation -Version: 23+30 -Files: nb-javac-jdk-23+30-api.jar nb-javac-jdk-23+30.jar +Version: 23+35 +Files: nb-javac-jdk-23+35-api.jar nb-javac-jdk-23+35.jar License: GPL-2-CP Origin: OpenJDK (https://github.com/openjdk/jdk) Source: https://github.com/openjdk/jdk diff --git a/java/libs.javacapi/nbproject/project.xml b/java/libs.javacapi/nbproject/project.xml index bf7b51480dfe..cc24468a24ea 100644 --- a/java/libs.javacapi/nbproject/project.xml +++ b/java/libs.javacapi/nbproject/project.xml @@ -40,11 +40,11 @@ - external/nb-javac-jdk-23+30-api.jar + external/nb-javac-jdk-23+35-api.jar - external/nb-javac-jdk-23+30.jar + external/nb-javac-jdk-23+35.jar diff --git a/java/libs.nbjavacapi/external/binaries-list b/java/libs.nbjavacapi/external/binaries-list index bac517586c21..e60394b73b4c 100644 --- a/java/libs.nbjavacapi/external/binaries-list +++ b/java/libs.nbjavacapi/external/binaries-list @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -C251D126090F6362D805B1987372BF4963B3782C com.dukescript.nbjavac:nb-javac:jdk-23+30 -A9105543E5EB96B9705D338A4C42A3A89E25A19A com.dukescript.nbjavac:nb-javac:jdk-23+30:api +1B70EC8A5230901C0EEE6EDF9829B43EAFAE9CC9 com.dukescript.nbjavac:nb-javac:jdk-23+35 +B3CB7A425EC7AAADA60754E6DF2E5E2D990E91AE com.dukescript.nbjavac:nb-javac:jdk-23+35:api diff --git a/java/libs.nbjavacapi/external/nb-javac-jdk-23+30-license.txt b/java/libs.nbjavacapi/external/nb-javac-jdk-23+35-license.txt similarity index 99% rename from java/libs.nbjavacapi/external/nb-javac-jdk-23+30-license.txt rename to java/libs.nbjavacapi/external/nb-javac-jdk-23+35-license.txt index 0995f2175e2e..e1852eaac70c 100644 --- a/java/libs.nbjavacapi/external/nb-javac-jdk-23+30-license.txt +++ b/java/libs.nbjavacapi/external/nb-javac-jdk-23+35-license.txt @@ -1,7 +1,7 @@ Name: Javac Compiler Implementation Description: Javac Compiler Implementation -Version: 23+30 -Files: nb-javac-jdk-23+30-api.jar nb-javac-jdk-23+30.jar +Version: 23+35 +Files: nb-javac-jdk-23+35-api.jar nb-javac-jdk-23+35.jar License: GPL-2-CP Origin: OpenJDK (https://github.com/openjdk/jdk) Source: https://github.com/openjdk/jdk diff --git a/java/libs.nbjavacapi/nbproject/project.properties b/java/libs.nbjavacapi/nbproject/project.properties index fae028a3b7f2..0f160110e608 100644 --- a/java/libs.nbjavacapi/nbproject/project.properties +++ b/java/libs.nbjavacapi/nbproject/project.properties @@ -18,8 +18,8 @@ javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial license.file.override=${nb_all}/nbbuild/licenses/GPL-2-CP -release.external/nb-javac-jdk-23+30-api.jar=modules/ext/nb-javac-jdk-23-30-api.jar -release.external/nb-javac-jdk-23+30.jar=modules/ext/nb-javac-jdk-23-30.jar +release.external/nb-javac-jdk-23+35-api.jar=modules/ext/nb-javac-jdk-23-30-api.jar +release.external/nb-javac-jdk-23+35.jar=modules/ext/nb-javac-jdk-23-30.jar # for tests requires.nb.javac=true diff --git a/java/libs.nbjavacapi/nbproject/project.xml b/java/libs.nbjavacapi/nbproject/project.xml index 20962f3edbc3..580a3eaf8e5a 100644 --- a/java/libs.nbjavacapi/nbproject/project.xml +++ b/java/libs.nbjavacapi/nbproject/project.xml @@ -46,11 +46,11 @@ ext/nb-javac-jdk-23-30-api.jar - external/nb-javac-jdk-23+30-api.jar + external/nb-javac-jdk-23+35-api.jar ext/nb-javac-jdk-23-30.jar - external/nb-javac-jdk-23+30.jar + external/nb-javac-jdk-23+35.jar diff --git a/java/maven/src/org/netbeans/modules/maven/options/MavenVersionSettings.java b/java/maven/src/org/netbeans/modules/maven/options/MavenVersionSettings.java index 6ca94706a6fe..5f1e41c1752c 100644 --- a/java/maven/src/org/netbeans/modules/maven/options/MavenVersionSettings.java +++ b/java/maven/src/org/netbeans/modules/maven/options/MavenVersionSettings.java @@ -44,11 +44,12 @@ public final class MavenVersionSettings { static { // TODO update periodically - modifications might require unit test adjustments - String nb_version = "RELEASE220"; - String nb_utilities_version = "14.1"; + String nb_version = "RELEASE230"; + String nb_utilities_version = "14.2"; fallback = Map.ofEntries( entry(key("org.netbeans.api", "org-netbeans-modules-editor"), nb_version), // represents all other nb artifacts entry(key(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER), "3.13.0"), + entry(key(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_JAR), "3.4.2"), entry(key(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_RESOURCES), "3.3.1"), entry(key(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_FAILSAFE), "3.3.1"), entry(key(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE), "3.3.1"), @@ -57,8 +58,8 @@ public final class MavenVersionSettings { entry(key("org.apache.netbeans.utilities", "nbm-shared"), nb_utilities_version), entry(key("org.apache.netbeans.utilities", "nbm-repository-plugin"), nb_utilities_version), entry(key("org.apache.netbeans.utilities", "nbm-maven-plugin"), nb_utilities_version), - entry(key("org.apache.netbeans.archetypes", "nbm-archetype"), "1.18"), - entry(key("org.apache.netbeans.archetypes", "netbeans-platform-app-archetype"), "1.23") + entry(key("org.apache.netbeans.archetypes", "nbm-archetype"), "1.19"), + entry(key("org.apache.netbeans.archetypes", "netbeans-platform-app-archetype"), "1.24") ); } diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps index b3e3a5511226..4b559a9e7796 100644 --- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps +++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps @@ -96,8 +96,8 @@ nb/ide.launcher/external/launcher-external-binaries-1-94a19f0.zip platform/o.n.b nb/ide.launcher/external/launcher-external-binaries-1-94a19f0.zip harness/apisupport.harness/external/launcher-external-binaries-1-94a19f0.zip # only one is part of the product: -java/libs.javacapi/external/nb-javac-jdk-23+30-api.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+30-api.jar -java/libs.javacapi/external/nb-javac-jdk-23+30.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+30.jar +java/libs.javacapi/external/nb-javac-jdk-23+35-api.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+35-api.jar +java/libs.javacapi/external/nb-javac-jdk-23+35.jar java/libs.nbjavacapi/external/nb-javac-jdk-23+35.jar # Used only in unittests for mysql db specific tests ide/db.metadata.model/external/mysql-connector-j-8.0.31.jar ide/db.mysql/external/mysql-connector-j-8.0.31.jar diff --git a/platform/libs.flatlaf/external/binaries-list b/platform/libs.flatlaf/external/binaries-list index fe311868638f..e78a70689b45 100644 --- a/platform/libs.flatlaf/external/binaries-list +++ b/platform/libs.flatlaf/external/binaries-list @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -5BA0BA8CA4A1942BFFF4A2771565F125C07A56A6 com.formdev:flatlaf:3.5 +8E4295F9BA5756736FA60A3A567FD9CD8840594F com.formdev:flatlaf:3.5.1 diff --git a/platform/libs.flatlaf/external/flatlaf-3.5-license.txt b/platform/libs.flatlaf/external/flatlaf-3.5.1-license.txt similarity index 99% rename from platform/libs.flatlaf/external/flatlaf-3.5-license.txt rename to platform/libs.flatlaf/external/flatlaf-3.5.1-license.txt index 43207353e959..b9c53aa7332a 100644 --- a/platform/libs.flatlaf/external/flatlaf-3.5-license.txt +++ b/platform/libs.flatlaf/external/flatlaf-3.5.1-license.txt @@ -1,7 +1,7 @@ Name: FlatLaf Look and Feel Description: FlatLaf Look and Feel -Version: 3.5 -Files: flatlaf-3.5.jar +Version: 3.5.1 +Files: flatlaf-3.5.1.jar License: Apache-2.0 Origin: FormDev Software GmbH. URL: https://www.formdev.com/flatlaf/ diff --git a/platform/libs.flatlaf/manifest.mf b/platform/libs.flatlaf/manifest.mf index b70c8444ed72..bcbb248affec 100644 --- a/platform/libs.flatlaf/manifest.mf +++ b/platform/libs.flatlaf/manifest.mf @@ -4,4 +4,4 @@ OpenIDE-Module: org.netbeans.libs.flatlaf/1 OpenIDE-Module-Install: org/netbeans/libs/flatlaf/Installer.class OpenIDE-Module-Specification-Version: 1.19 AutoUpdate-Show-In-Client: false -OpenIDE-Module-Implementation-Version: 3.5 +OpenIDE-Module-Implementation-Version: 3.5.1 diff --git a/platform/libs.flatlaf/nbproject/project.properties b/platform/libs.flatlaf/nbproject/project.properties index 8b5f96e6f7fb..17136f04c6ea 100644 --- a/platform/libs.flatlaf/nbproject/project.properties +++ b/platform/libs.flatlaf/nbproject/project.properties @@ -31,17 +31,17 @@ spec.version.base.fatal.warning=false # # So when FlatLaf is updated, the OpenIDE-Module-Implementation-Version entry # in manifest.mf needs to be updated to match the new FlatLaf version. -release.external/flatlaf-3.5.jar=modules/ext/flatlaf-3.5.jar +release.external/flatlaf-3.5.1.jar=modules/ext/flatlaf-3.5.1.jar # com.formdev.flatlaf.ui intentionally ommitted. # rest is equivalent to the "public" packages for friend dependencies as declared in project.xml sigtest.public.packages=com.formdev.flatlaf,com.formdev.flatlaf.themes,com.formdev.flatlaf.util -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll=modules/lib/flatlaf-windows-x86.dll -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll=modules/lib/flatlaf-windows-x86_64.dll -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll=modules/lib/flatlaf-windows-arm64.dll -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/libflatlaf-macos-arm64.dylib=modules/lib/libflatlaf-macos-arm64.dylib -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/libflatlaf-macos-x86_64.dylib=modules/lib/libflatlaf-macos-x86_64.dylib -release.external/flatlaf-3.5.jar!/com/formdev/flatlaf/natives/libflatlaf-linux-x86_64.so=modules/lib/libflatlaf-linux-x86_64.so +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/flatlaf-windows-x86.dll=modules/lib/flatlaf-windows-x86.dll +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll=modules/lib/flatlaf-windows-x86_64.dll +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll=modules/lib/flatlaf-windows-arm64.dll +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/libflatlaf-macos-arm64.dylib=modules/lib/libflatlaf-macos-arm64.dylib +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/libflatlaf-macos-x86_64.dylib=modules/lib/libflatlaf-macos-x86_64.dylib +release.external/flatlaf-3.5.1.jar!/com/formdev/flatlaf/natives/libflatlaf-linux-x86_64.so=modules/lib/libflatlaf-linux-x86_64.so jnlp.verify.excludes=\ modules/lib/flatlaf-windows-x86.dll,\ modules/lib/flatlaf-windows-x86_64.dll,\ diff --git a/platform/libs.flatlaf/nbproject/project.xml b/platform/libs.flatlaf/nbproject/project.xml index 3052c5578938..545d5ec04edb 100644 --- a/platform/libs.flatlaf/nbproject/project.xml +++ b/platform/libs.flatlaf/nbproject/project.xml @@ -49,8 +49,8 @@ com.formdev.flatlaf.util - ext/flatlaf-3.5.jar - external/flatlaf-3.5.jar + ext/flatlaf-3.5.1.jar + external/flatlaf-3.5.1.jar