11diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
2- index 891bfa328d..ed80b903a5 100644
2+ index 891bfa328d..91172fda4b 100644
33--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
44+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
55@@ -27,6 +27,7 @@ import java.net.MalformedURLException;
@@ -103,7 +103,7 @@ index 891bfa328d..ed80b903a5 100644
103103 });
104104 }
105105
106- @@ -229,9 +253,21 @@ final class LspTemplateUI {
106+ @@ -229,9 +253,23 @@ final class LspTemplateUI {
107107 FileObject template = desc.getTemplate();
108108 Object handler = template.getAttribute(FileBuilder.ATTR_TEMPLATE_HANDLER);
109109 if (handler == null) {
@@ -114,8 +114,10 @@ index 891bfa328d..ed80b903a5 100644
114114+
115115+ @Override
116116+ public CompletionStage<String> apply(String name) {
117- + if (!SourceVersion.isName(name)) {
118- + client.showMessage(new MessageParams(MessageType.Error, Bundle.ERR_InvalidObjectName(name)));
117+ + if (!name.equals("package-info") && !name.equals("module-info")
118+ + && (SourceVersion.isKeyword(name) || !SourceVersion.isIdentifier(name)))
119+ + {
120+ + client.showMessage(new MessageParams(MessageType.Error,Bundle.ERR_InvalidObjectName(name)));
119121+ return client.showInputBox(new ShowInputBoxParams(Bundle.CTL_TemplateUI_SelectName(), desc.getProposedName())).thenCompose(this);
120122+ }
121123+ return CompletableFuture.completedFuture(name);
@@ -128,7 +130,7 @@ index 891bfa328d..ed80b903a5 100644
128130 }
129131 return CompletableFuture.completedFuture(builder);
130132 }
131- @@ -242,7 +278 ,7 @@ final class LspTemplateUI {
133+ @@ -242,7 +280 ,7 @@ final class LspTemplateUI {
132134 suggestion = Utilities.toFile(new URI(folders.get(0).getUri())).getParent();
133135 } catch (URISyntaxException ex) {
134136 }
0 commit comments