Merge pull request #3483 from apache/delivery

Sync delivery to release130 for 13-rc2
diff --git a/.gitignore b/.gitignore
index fea0457..60e508b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@
 /nbbuild/user.build.properties
 /nbbuild/gitinfo.properties
 /nbbuild/netbeansrelease.properties
+/nbbuild/netbeansrelease.json
 /nbi/engine/native/*/*/dist/
 /nb-javac/
 /java.source.nbjavac/test/test-nb-javac/nbproject/private/
diff --git a/README.md b/README.md
index 244ff51..f3e9ea9 100644
--- a/README.md
+++ b/README.md
@@ -38,13 +38,12 @@
 
   * Git
   * Ant 1.9.9 or above
-  * JDK 8 or 11 (to build NetBeans)
-  * JDK 9 or above (to run NetBeans)
+  * JDK 11 (to build NetBeans)
+  * JDK 11 or above (to run NetBeans)
   * MinGW (optional), to build Windows Launchers
 
 #### Notes:
 
-* NetBeans also runs with JDK 8, although then it will not include tools for the JDK 9 Shell.
 * NetBeans license violation checks are managed via the [rat-exclusions.txt](https://github.com/apache/netbeans/blob/master/nbbuild/rat-exclusions.txt) file.
 * Set JAVA_HOME and ANT_HOME appropriately or leave them undefined.
 
diff --git a/ergonomics/ide.ergonomics/javafx.properties b/ergonomics/ide.ergonomics/javafx.properties
index a96b3ab..1e7695c 100644
--- a/ergonomics/ide.ergonomics/javafx.properties
+++ b/ergonomics/ide.ergonomics/javafx.properties
@@ -22,6 +22,3 @@
 
 extra.modules=org\\.netbeans\\.libs\\.javafx\\.(linux|win|macosx)
 extra.modules.recommended.max.jdk=11
-
-extra.modules.1=org.netbeans.modules.nbjavac.*
-extra.modules.1.recommended.min.jdk=9
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/ActionProviderImpl.java b/extide/gradle/src/org/netbeans/modules/gradle/ActionProviderImpl.java
index d11d1ed..9e5fc21 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/ActionProviderImpl.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/ActionProviderImpl.java
@@ -549,7 +549,8 @@
                             acts.add(act);
                         }
                     }
-                    acts.add(createCustomGradleAction(project, LBL_Custom_run_tasks(), new CustomActionMapping("name"), lookup, true));
+                    acts.add(createCustomGradleAction(project, LBL_Custom_run_tasks(),
+                            new CustomActionMapping(ActionMapping.CUSTOM_PREFIX), lookup, true));
                     SwingUtilities.invokeLater(() -> {
                         boolean selected = menu.isSelected();
                         menu.remove(loading);
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/loaders/AbstractProjectLoader.java b/extide/gradle/src/org/netbeans/modules/gradle/loaders/AbstractProjectLoader.java
index a6ccb78..153bbac 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/loaders/AbstractProjectLoader.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/loaders/AbstractProjectLoader.java
@@ -71,7 +71,7 @@
 
         public ReloadContext(NbGradleProjectImpl project, NbGradleProject.Quality aim, GradleCommandLine cmd, String description) {
             this.project = project;
-            this.previous = project.isGradleProjectLoaded() ? project.getGradleProject() : FallbackProjectLoader.createFallbackProject(project.getGradleFiles());
+            this.previous = project.isGradleProjectLoaded() ? project.projectWithQuality(null, FALLBACK, false, false) : FallbackProjectLoader.createFallbackProject(project.getGradleFiles());
             this.aim = aim;
             this.cmd = cmd;
             this.description = description;
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.java b/extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.java
index 0af2084..c47db99 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.java
@@ -50,6 +50,8 @@
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.netbeans.api.project.Project;
 import org.netbeans.api.project.ProjectManager;
 import org.netbeans.modules.gradle.GradleProjectLoader;
@@ -65,6 +67,8 @@
  * @author Laszlo Kishalmi
  */
 public final class TemplateOperation implements Runnable {
+    private static final Logger LOG = Logger.getLogger(TemplateOperation.class.getName());
+    
     public interface ProjectConfigurator {
         void configure(Project project);
     }
@@ -108,6 +112,7 @@
                 if (handle != null) {
                     handle.progress(step.getMessage(), work++);
                 }
+                LOG.log(Level.FINE, "Executing Gradle Project Template Operation {0}", step);
                 Set<FileObject> filesToOpen = step.execute();
                 if (filesToOpen != null) {
                     importantFiles.addAll(filesToOpen);
@@ -260,8 +265,7 @@
         public Set<FileObject> execute() {
             GradleConnector gconn = GradleConnector.newConnector();
             target.mkdirs();
-            ProjectConnection pconn = gconn.forProjectDirectory(target).connect();
-            try {
+            try (ProjectConnection pconn = gconn.forProjectDirectory(target).connect()) {
                 List<String> args = new ArrayList<>();
                 args.add("init");
                 // gradle init --type java-application --test-framework junit-jupiter --dsl groovy --package com.example --project-name example
@@ -293,8 +297,6 @@
             } catch (GradleConnectionException | IllegalStateException ex) {
                 // Well for some reason we were  not able to load Gradle.
                 // Ignoring that for now
-            } finally {
-                pconn.close();
             }
             return Collections.singleton(FileUtil.toFileObject(target));
         }
@@ -320,7 +322,14 @@
         steps.add(new PreloadProject(projectDir));
     }
 
-    private static class CreateDirStep implements OperationStep {
+    private static abstract class BaseOperationStep implements OperationStep {
+        @Override
+        public final String toString() {
+            return "Step: " + getMessage();
+        }
+    }
+    
+    private static final class CreateDirStep extends BaseOperationStep {
 
         final String message;
         final File dir;
@@ -344,9 +353,10 @@
             }
             return null;
         }
+        
     }
 
-    private static class ConfigureProjectStep implements OperationStep {
+    private static final class ConfigureProjectStep extends BaseOperationStep {
         final File dir;
         final ProjectConfigurator configurator;
 
@@ -367,9 +377,10 @@
                 try {
                     FileObject projectDir = FileUtil.toFileObject(dir);
                     Project project = ProjectManager.getDefault().findProject(projectDir);
+                    ProjectTrust.getDefault().trustProject(project);
                     NbGradleProjectImpl impl = project != null ? project.getLookup().lookup(NbGradleProjectImpl.class): null;
                     if (impl != null) {
-                        impl.fireProjectReload(true);
+                        impl.projectWithQuality(null, Quality.FULL, false, false);
                         configurator.configure(project);
                     }
 
@@ -380,7 +391,7 @@
         }
 
     }
-    private static class PreloadProject implements OperationStep {
+    private static final class PreloadProject extends BaseOperationStep {
 
         final File dir;
 
@@ -410,7 +421,7 @@
                     }
                     project = ProjectManager.getDefault().findProject(projectDir);
                     if (project != null) {
-                        //Let's trust the generate project
+                        //Let's trust the generated project
                         ProjectTrust.getDefault().trustProject(project);
                         NbGradleProjectImpl nbProject = project.getLookup().lookup(NbGradleProjectImpl.class);
                         if (nbProject != null) {
@@ -430,7 +441,7 @@
 
     }
 
-    private static class InitGradleWrapper implements OperationStep {
+    private static final class InitGradleWrapper extends BaseOperationStep {
 
         final File projectDir;
 
@@ -447,21 +458,18 @@
         @Override
         public Set<FileObject> execute() {
             GradleConnector gconn = GradleConnector.newConnector();
-            ProjectConnection pconn = gconn.forProjectDirectory(projectDir).connect();
-            try {
+            try (ProjectConnection pconn = gconn.forProjectDirectory(projectDir).connect()) {
                 pconn.newBuild().withArguments("--offline").forTasks("wrapper").run(); //NOI18N
             } catch (GradleConnectionException | IllegalStateException ex) {
                 // Well for some reason we were  not able to load Gradle.
                 // Ignoring that for now
-            } finally {
-                pconn.close();
             }
             return null;
         }
 
     }
 
-    private static class CopyFromFileTemplate implements OperationStep {
+    private static final class CopyFromFileTemplate extends BaseOperationStep {
         final File target;
         final Map<String, ? extends Object> tokens;
         final boolean important;
@@ -524,7 +532,7 @@
 
     }
 
-    private static class CopyFromTemplate implements OperationStep {
+    private static final class CopyFromTemplate extends BaseOperationStep {
         final File target;
         final Map<String, ? extends Object> tokens;
         final boolean important;
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/LSPBindings.java b/ide/lsp.client/src/org/netbeans/modules/lsp/client/LSPBindings.java
index b2f180d..2fcb1cd 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/LSPBindings.java
+++ b/ide/lsp.client/src/org/netbeans/modules/lsp/client/LSPBindings.java
@@ -37,6 +37,7 @@
 import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -56,6 +57,8 @@
 import org.eclipse.lsp4j.InitializeResult;
 import org.eclipse.lsp4j.ResourceOperationKind;
 import org.eclipse.lsp4j.SemanticTokens;
+import org.eclipse.lsp4j.SemanticTokensCapabilities;
+import org.eclipse.lsp4j.SemanticTokensClientCapabilitiesRequests;
 import org.eclipse.lsp4j.SemanticTokensLegend;
 import org.eclipse.lsp4j.ServerCapabilities;
 import org.eclipse.lsp4j.SymbolCapabilities;
@@ -367,6 +370,7 @@
        dsc.setHierarchicalDocumentSymbolSupport(true);
        dsc.setSymbolKind(new SymbolKindCapabilities(Arrays.asList(SymbolKind.values())));
        tdcc.setDocumentSymbol(dsc);
+       tdcc.setSemanticTokens(new SemanticTokensCapabilities(new SemanticTokensClientCapabilitiesRequests(true), KNOWN_TOKEN_TYPES, KNOWN_TOKEN_MODIFIERS, Arrays.asList()));
        WorkspaceClientCapabilities wcc = new WorkspaceClientCapabilities();
        wcc.setWorkspaceEdit(new WorkspaceEditCapabilities());
        wcc.getWorkspaceEdit().setDocumentChanges(true);
@@ -387,6 +391,15 @@
            }
        }
     }
+    private static final List<String> KNOWN_TOKEN_TYPES = Collections.unmodifiableList(Arrays.asList(
+            "namespace", "package", "function", "method", "macro", "parameter",
+            "variable", "struct", "enum", "class", "typeAlias", "typeParameter",
+            "field", "enumMember", "keyword"
+    ));
+
+    private static final List<String> KNOWN_TOKEN_MODIFIERS = Collections.unmodifiableList(Arrays.asList(
+            "static", "definition", "declaration"
+    ));
 
     public static synchronized Set<LSPBindings> getAllBindings() {
         Set<LSPBindings> allBindings = Collections.newSetFromMap(new IdentityHashMap<>());
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CompletionProviderImpl.java b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CompletionProviderImpl.java
index 0fba1fc..0869a66 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CompletionProviderImpl.java
+++ b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/CompletionProviderImpl.java
@@ -42,6 +42,7 @@
 import org.eclipse.lsp4j.CompletionOptions;
 import org.eclipse.lsp4j.CompletionParams;
 import org.eclipse.lsp4j.InitializeResult;
+import org.eclipse.lsp4j.InsertReplaceEdit;
 import org.eclipse.lsp4j.MarkupContent;
 import org.eclipse.lsp4j.ParameterInformation;
 import org.eclipse.lsp4j.ServerCapabilities;
@@ -189,13 +190,14 @@
                                 commit("");
                             }
                             private void commit(String appendText) {
-                                if (i.getTextEdit().isRight()) {
+                                Either<TextEdit, InsertReplaceEdit> edit = i.getTextEdit();
+                                if (edit != null && edit.isRight()) {
                                     //TODO: the NetBeans client does not current support InsertReplaceEdits, should not happen
                                     Completion.get().hideDocumentation();
                                     Completion.get().hideCompletion();
                                     return ;
                                 }
-                                TextEdit te = i.getTextEdit().getLeft();
+                                TextEdit te = edit != null ? edit.getLeft() : null;
                                 NbDocument.runAtomic((StyledDocument) doc, () -> {
                                     try {
                                         int endPos;
diff --git a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/SemanticHighlight.java b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/SemanticHighlight.java
index e40323a..d63113f 100644
--- a/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/SemanticHighlight.java
+++ b/ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/SemanticHighlight.java
@@ -18,12 +18,12 @@
  */
 package org.netbeans.modules.lsp.client.bindings;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
+import java.util.Collection;
+import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import javax.swing.text.AttributeSet;
 import javax.swing.text.Document;
@@ -32,11 +32,9 @@
 import org.eclipse.lsp4j.SemanticTokens;
 import org.eclipse.lsp4j.SemanticTokensLegend;
 import org.eclipse.lsp4j.SemanticTokensParams;
+import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions;
 import org.eclipse.lsp4j.TextDocumentIdentifier;
-import org.eclipse.lsp4j.generator.JsonRpcData;
-import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
 import org.netbeans.api.editor.mimelookup.MimeLookup;
-import org.netbeans.api.editor.mimelookup.MimePath;
 import org.netbeans.api.editor.mimelookup.MimeRegistration;
 import org.netbeans.api.editor.settings.AttributesUtilities;
 import org.netbeans.api.editor.settings.FontColorSettings;
@@ -65,6 +63,10 @@
     @Override
     public void run(LSPBindings bindings, FileObject file) {
         try {
+            SemanticTokensWithRegistrationOptions options = bindings.getInitResult().getCapabilities().getSemanticTokensProvider();
+            if (options == null) {
+                return ;
+            }
             OffsetsBag target = new OffsetsBag(doc);
             SemanticTokensParams params = new SemanticTokensParams(new TextDocumentIdentifier(Utils.toURI(file)));
             SemanticTokens tokens = bindings.getTextDocumentService().semanticTokensFull(params).get();
@@ -130,7 +132,7 @@
             AttributeSet statik = isStatic ? fcs.getTokenFontColors("mod-static") : null;
 
             if (colors != null && statik != null) {
-                return AttributesUtilities.createComposite(colors, statik);
+                return AttributesUtilities.createComposite(adjustAttributes(colors), adjustAttributes(statik));
             } else if (colors != null) {
                 return colors;
             } else if (statik != null) {
@@ -153,6 +155,22 @@
         return bag;
     }
 
+    private static AttributeSet adjustAttributes(AttributeSet as) {
+        Collection<Object> attrs = new LinkedList<Object>();
+
+        for (Enumeration<?> e = as.getAttributeNames(); e.hasMoreElements(); ) {
+            Object key = e.nextElement();
+            Object value = as.getAttribute(key);
+
+            if (value != Boolean.FALSE) {
+                attrs.add(key);
+                attrs.add(value);
+            }
+        }
+
+        return AttributesUtilities.createImmutable(attrs.toArray());
+    }
+
     @MimeRegistration(mimeType="", service=HighlightsLayerFactory.class)
     public static final class HighlightsLayerFactoryImpl implements HighlightsLayerFactory {
 
@@ -164,44 +182,5 @@
         }
         
     }
-    
-//    @JsonRpcData
-//    public static class SemanticTokensParams {
-//
-//        private TextDocumentIdentifier textDocument;
-//
-//        public SemanticTokensParams() {
-//        }
-//
-//        public SemanticTokensParams(TextDocumentIdentifier textDocument) {
-//            this.textDocument = textDocument;
-//        }
-//
-//        public TextDocumentIdentifier getTextDocument() {
-//            return textDocument;
-//        }
-//
-//        public void setTextDocument(TextDocumentIdentifier textDocument) {
-//            this.textDocument = textDocument;
-//        }
-// 
-//    }
-//
-//    @JsonRpcData
-//    public static class SemanticTokens {
-//        private List<Number> data;
-//
-//        public List<Number> getData() {
-//            return data;
-//        }
-//
-//        public void setData(List<Number> data) {
-//            this.data = data;
-//        }
-//
-//    }
-//    public interface SemanticService {
-//        @JsonRequest("textDocument/semanticTokens/full")
-//        public CompletableFuture<SemanticTokens> semanticTokensFull(SemanticTokensParams params);
-//    }
+
 }
diff --git a/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/resources/fontsColors.xml b/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/resources/fontsColors.xml
index 27acc9b..2c1fcbb 100644
--- a/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/resources/fontsColors.xml
+++ b/ide/textmate.lexer/src/org/netbeans/modules/textmate/lexer/resources/fontsColors.xml
@@ -67,6 +67,7 @@
     <fontcolor name="mod-typeParameter" default="identifier"/>
     <fontcolor name="mod-field" default="field"/>
     <fontcolor name="mod-enumMember" default="field"/>
+    <fontcolor name="mod-keyword" default="keyword"/>
 
     <fontcolor name="mod-namespace-declaration" default="identifier"/>
     <fontcolor name="mod-package-declaration" default="identifier"/>
@@ -82,6 +83,7 @@
     <fontcolor name="mod-typeParameter-declaration" default="identifier"/>
     <fontcolor name="mod-field-declaration" default="field"/>
     <fontcolor name="mod-enumMember-declaration" default="field"/>
+    <fontcolor name="mod-keyword-declaration" default="keyword"/>
 
     <fontcolor name="mod-static" >
         <font style="italic" />
diff --git a/java/java.hints/src/org/netbeans/modules/java/hints/OrganizeImports.java b/java/java.hints/src/org/netbeans/modules/java/hints/OrganizeImports.java
index 17e17ca..9bbc56f 100644
--- a/java/java.hints/src/org/netbeans/modules/java/hints/OrganizeImports.java
+++ b/java/java.hints/src/org/netbeans/modules/java/hints/OrganizeImports.java
@@ -281,6 +281,7 @@
                             break;
                         case ANNOTATION_TYPE:
                         case CLASS:
+                        case RECORD:
                         case ENUM:
                         case INTERFACE:
                             Element glob = global(element, starImports);
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java
index 46ec105..3bb6bcb 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java
@@ -68,12 +68,14 @@
             case ENUM:
                 return SymbolKind.Enum;
             case CLASS:
+            case RECORD:
                 return SymbolKind.Class;
             case ANNOTATION_TYPE:
                 return SymbolKind.Interface;
             case INTERFACE:
                 return SymbolKind.Interface;
             case ENUM_CONSTANT:
+            case RECORD_COMPONENT:
                 return SymbolKind.EnumMember;
             case FIELD:
                 return SymbolKind.Field; //TODO: constant
@@ -110,6 +112,7 @@
             case INTERFACE:
             case ENUM:
             case ANNOTATION_TYPE:
+            case RECORD:
                 TypeElement te = (TypeElement) e;
                 StringBuilder sb = new StringBuilder();
                 sb.append(fqn ? te.getQualifiedName() : te.getSimpleName());
@@ -140,6 +143,7 @@
                 return sb.toString();
             case FIELD:
             case ENUM_CONSTANT:
+            case RECORD_COMPONENT:
                 return e.getSimpleName().toString();
             case CONSTRUCTOR:
             case METHOD:
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
index 8a52631..0f62d46 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
@@ -1947,8 +1947,8 @@
     static BiConsumer<String, Object> HOOK_NOTIFICATION = null;
 
     private static final Map<ColoringAttributes, List<String>> COLORING_TO_TOKEN_TYPE_CANDIDATES = new HashMap<ColoringAttributes, List<String>>() {{
-        put(ColoringAttributes.FIELD, Arrays.asList("member"));
-        put(ColoringAttributes.RECORD_COMPONENT, Arrays.asList("member"));
+        put(ColoringAttributes.FIELD, Arrays.asList("field", "member"));
+        put(ColoringAttributes.RECORD_COMPONENT, Arrays.asList("field", "member"));
         put(ColoringAttributes.LOCAL_VARIABLE, Arrays.asList("variable"));
         put(ColoringAttributes.PARAMETER, Arrays.asList("parameter"));
         put(ColoringAttributes.METHOD, Arrays.asList("method", "function"));
@@ -1959,6 +1959,7 @@
         put(ColoringAttributes.ANNOTATION_TYPE, Arrays.asList("interface"));
         put(ColoringAttributes.ENUM, Arrays.asList("enum"));
         put(ColoringAttributes.TYPE_PARAMETER_DECLARATION, Arrays.asList("typeParameter"));
+        put(ColoringAttributes.KEYWORD, Arrays.asList("keyword"));
     }};
 
     private static final Map<ColoringAttributes, List<String>> COLORING_TO_TOKEN_MODIFIERS_CANDIDATES = new HashMap<ColoringAttributes, List<String>>() {{
@@ -2011,7 +2012,7 @@
                                                 modifiers |= mod;
                                             }
                                         }
-                                        if (tokenType.isPresent()) {
+                                        if (tokenType.isPresent() && tokenType.get() >= 0) {
                                             result.add(line - lastLine);
                                             result.add((int) (currentOffset - currentLineStart - column));
                                             result.add(e.getKey().length());
diff --git a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
index ad652e7..49c5fb9 100644
--- a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
+++ b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
@@ -159,11 +159,13 @@
 import org.netbeans.modules.java.lsp.server.refactoring.ParameterUI;
 import org.netbeans.modules.java.lsp.server.ui.MockHtmlViewer;
 import org.netbeans.modules.java.source.BootClassPathUtil;
+import org.netbeans.modules.java.source.parsing.JavacParser;
 import org.netbeans.modules.parsing.api.ResultIterator;
 import org.netbeans.modules.parsing.impl.indexing.implspi.CacheFolderProvider;
 import org.netbeans.spi.java.classpath.ClassPathProvider;
 import org.netbeans.spi.java.classpath.support.ClassPathSupport;
 import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
+import org.netbeans.spi.java.queries.SourceLevelQueryImplementation;
 import org.netbeans.spi.lsp.ErrorProvider;
 import org.netbeans.spi.project.ProjectFactory;
 import org.netbeans.spi.project.ProjectState;
@@ -710,10 +712,12 @@
                       "        public void innerMethod() {\n" +
                       "        }\n" +
                       "    }\n" +
+                      "    record R(int i) {}\n" +
                       "}\n";
         try (Writer w = new FileWriter(src)) {
             w.write(code);
         }
+        file2SourceLevel.put(FileUtil.toFileObject(src.getParentFile()), "17");
         FileUtil.refreshFor(getWorkDir());
         Launcher<LanguageServer> serverLauncher = LSPLauncher.createClientLauncher(new LspClient() {
             @Override
@@ -758,7 +762,7 @@
                           "    character = 0\n" +
                           "  ]\n" +
                           "  end = Position [\n" +
-                          "    line = 8\n" +
+                          "    line = 9\n" +
                           "    character = 1\n" +
                           "  ]\n" +
                           "]:(Class:Inner:Range [\n" +
@@ -779,6 +783,24 @@
                           "    line = 6\n" +
                           "    character = 9\n" +
                           "  ]\n" +
+                          "]:()), Class:R:Range [\n" +
+                          "  start = Position [\n" +
+                          "    line = 8\n" +
+                          "    character = 4\n" +
+                          "  ]\n" +
+                          "  end = Position [\n" +
+                          "    line = 8\n" +
+                          "    character = 22\n" +
+                          "  ]\n" +
+                          "]:(Field:i:Range [\n" +
+                          "  start = Position [\n" +
+                          "    line = 8\n" +
+                          "    character = 13\n" +
+                          "  ]\n" +
+                          "  end = Position [\n" +
+                          "    line = 8\n" +
+                          "    character = 18\n" +
+                          "  ]\n" +
                           "]:()), Field:field:Range [\n" +
                           "  start = Position [\n" +
                           "    line = 1\n" +
@@ -4713,6 +4735,66 @@
                        "3:20-26:method:[]");
     }
 
+    public void testSemanticHighlighting2() throws Exception {
+        File src = new File(getWorkDir(), "Test.java");
+        src.getParentFile().mkdirs();
+        String code = "public class Test {\n" +
+                      "    private static final int C = 0;\n" +
+                      "    public int method(int p) {\n" +
+                      "        int l = p + method(0);\n" +
+                      "    }\n" +
+                      "}\n";
+        try (Writer w = new FileWriter(src)) {
+            w.write(code);
+        }
+        FileUtil.refreshFor(getWorkDir());
+        Launcher<LanguageServer> serverLauncher = LSPLauncher.createClientLauncher(new LanguageClient() {
+            @Override
+            public void telemetryEvent(Object arg0) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            @Override
+            public void publishDiagnostics(PublishDiagnosticsParams params) {
+            }
+
+            @Override
+            public void showMessage(MessageParams arg0) {
+            }
+
+            @Override
+            public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams arg0) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            @Override
+            public void logMessage(MessageParams arg0) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        }, client.getInputStream(), client.getOutputStream());
+        serverLauncher.startListening();
+        LanguageServer server = serverLauncher.getRemoteProxy();
+        ClientCapabilities clientCaps = new ClientCapabilities();
+        TextDocumentClientCapabilities textCaps = new TextDocumentClientCapabilities();
+        clientCaps.setTextDocument(textCaps);
+        SemanticTokensCapabilities sematicTokensCapabilities = new SemanticTokensCapabilities(true);
+        sematicTokensCapabilities.setTokenTypes(Arrays.asList("field", "method", "function", "class", "interface", "enum", "typeParameter"));
+        sematicTokensCapabilities.setTokenModifiers(Arrays.asList("declaration", "static"));
+        textCaps.setSemanticTokens(sematicTokensCapabilities);
+        InitializeParams initParams = new InitializeParams();
+        initParams.setCapabilities(clientCaps);
+        InitializeResult result = server.initialize(initParams).get();
+        assertNotNull(result.getCapabilities().getSemanticTokensProvider());
+        SemanticTokensLegend legend = result.getCapabilities().getSemanticTokensProvider().getLegend();
+        server.getTextDocumentService().didOpen(new DidOpenTextDocumentParams(new TextDocumentItem(toURI(src), "java", 0, code)));
+        assertColoring(legend,
+                       server.getTextDocumentService().semanticTokensFull(new SemanticTokensParams(new TextDocumentIdentifier(toURI(src)))).get(),
+                       "0:13-17:class:[declaration]",
+                       "1:29-30:field:[declaration, static]",
+                       "2:15-21:method:[declaration]",
+                       "3:20-26:method:[]");
+    }
+
     private void assertColoring(SemanticTokensLegend legend, SemanticTokens tokens, String... expected) {
         List<String> coloring = new ArrayList<>();
         int line = 0;
@@ -4943,7 +5025,19 @@
         public void saveProject(Project project) throws IOException, ClassCastException {
         }
     }
-    
+
+    private static final Map<FileObject, String> file2SourceLevel = new HashMap<>();
+
+    @ServiceProvider(service=SourceLevelQueryImplementation.class)
+    public static final class SourceLevelImpl implements SourceLevelQueryImplementation {
+
+        @Override
+        public String getSourceLevel(FileObject javaFile) {
+            return file2SourceLevel.getOrDefault(javaFile, "1.8");
+        }
+
+    }
+
     private static volatile ProgressCommand progressCommandInstance;
     
     @ServiceProvider(service = CodeActionsProvider.class)
@@ -5183,5 +5277,6 @@
 
     static {
         System.setProperty("SourcePath.no.source.filter", "true");
+        JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
     }
 }
diff --git a/java/maven.embedder/external/binariesembedded-list b/java/maven.embedder/external/binariesembedded-list
index 054ff74..b51bd76 100644
--- a/java/maven.embedder/external/binariesembedded-list
+++ b/java/maven.embedder/external/binariesembedded-list
@@ -46,11 +46,11 @@
 5B4DBD3CF0B14038766A6E915D75646C6D396E5B;org.apache.maven:maven-slf4j-provider:3.8.4
 D4265DD4F0F1D7A06D80DF5A5F475D5FF9C17140;org.eclipse.sisu:org.eclipse.sisu.inject:0.3.5
 D71996BB2E536F966B3B70E647067FFF3B73D32F;org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.5
-425EA8E534716B4BFF1EA90F39BD76BE951D651B;org.sonatype.plexus:plexus-cipher:2.0
+425EA8E534716B4BFF1EA90F39BD76BE951D651B;org.codehaus.plexus:plexus-cipher:2.0
 8587E80FCB38E70B70FAE8D5914B6376BFAD6259;org.codehaus.plexus:plexus-classworlds:2.6.0
 2F2147A6CC6A119A1B51A96F31D45C557F6244B9;org.codehaus.plexus:plexus-component-annotations:2.1.0
 25B919C664B79795CCDE0EDE5CEE0FD68B544197;org.codehaus.plexus:plexus-interpolation:1.26
-F89C5080614FFD0764E49861895DBEDDE1B47237;org.sonatype.plexus:plexus-sec-dispatcher:2.0
+F89C5080614FFD0764E49861895DBEDDE1B47237;org.codehaus.plexus:plexus-sec-dispatcher:2.0
 CF43B5391DE623B36FE066A21127BAEF82C64022;org.codehaus.plexus:plexus-utils:3.3.0
 CDCFF33940D9F2DE763BC41EA05A0BE5941176C3;org.slf4j:slf4j-api:1.7.32
 85876A5672B78AA2E817EEE495239CDDD7B598E7;org.apache.maven.wagon:wagon-file:3.4.3
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
index ace6c4f..3a0bd09 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
@@ -134,7 +134,7 @@
         }
 
         if (requiredbranchinfo == null) {
-            throw new BuildException("No Release Information found for branch '" + branch + "', update json file section");
+            throw new BuildException("No Release Information found for branch '" + branch + "', update json file section with ant -Dneedjsondownload=true");
         }
         List<String> updateValues = new ArrayList<>();
         for (ReleaseInfo releaseInfo : ri) {
diff --git a/nbbuild/build.xml b/nbbuild/build.xml
index 887f735..401a0c1 100644
--- a/nbbuild/build.xml
+++ b/nbbuild/build.xml
@@ -109,30 +109,8 @@
       <zipfileset dir="${nb_all}/nbbuild" includes="notice-stub.txt" fullpath="META-INF/NOTICE"/>
     </jar>
     <taskdef name="createlicensesummary" classname="org.netbeans.nbbuild.extlibs.CreateLicenseSummary" classpath="${nbantext.jar}"/>
-    <!-- get all json info we have on apache gitbox  -->
-    <property name="metabuild.releasejson" value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
-    <condition property="metabuild.jsonurl" value="https://gitbox.apache.org/repos/asf?p=netbeans-jenkins-lib.git;a=blob_plain;f=meta/netbeansrelease.json">
-        <not>
-            <isset property="metabuild.jsonurl"/>
-        </not>
-    </condition>
-    <configureproxy connectTo="${metabuild.jsonurl}" hostProperty="proxyHost" portProperty="proxyPort"/>
-    <setproxy proxyhost="${proxyHost}" proxyPort="${proxyPort}"/>
-    <get dest="${metabuild.releasejson}" skipexisting="false" src="${metabuild.jsonurl}" />
-    <!-- read info from gitinfo.properties , if present in source bundle copy gitinfo-->
-    <copy file="${nb_all}/nbbuild/gitinfo.properties" tofile="${nb_all}/nbbuild/build/gitinfo.properties" failonerror="false"/>
-    <copy file="${nb_all}/nbbuild/netbeansrelease.properties" tofile="${nb_all}/nbbuild/build/netbeansrelease.properties" failonerror="false"/>
-    <!-- get branches and git information as previous not overrided this will take new-->
-    <antcall target="getgitinformation" />
-    <!-- javadoc content filtering -->
-    <taskdef name="setjavadoc" classname="org.netbeans.nbbuild.SetApidocClustersConfig" classpath="${nbantext.jar}"/>
-    <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
-    <property file="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
-    <setjavadoc branch="${metabuild.branch}"/>
-    <echo message="Building branch: ${metabuild.branch}"/>
-    <property name="releasejson" value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
-    <property name="xmlrelease" value="${nb_all}/nbbuild/build/netbeansrelease.xml"/>
-    <property name="propertiesrelease" value="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
+
+    <!-- prepare task to create properties files-->
     <taskdef name="releasejson" classname="org.netbeans.nbbuild.ReleaseJsonProperties" >
         <classpath>
             <pathelement location="${nbantext.jar}"/>
@@ -141,11 +119,64 @@
             </fileset>
         </classpath>
     </taskdef>
+    <!-- task to alter cluster definition for javadoc -->
+    <taskdef name="setjavadoc" classname="org.netbeans.nbbuild.SetApidocClustersConfig" classpath="${nbantext.jar}"/>
+
+    <antcall target="getjsonfile" />
+    <!-- get branches and git information as previous not overrided this will take new-->
+    <antcall target="getgitinformation" />
+
+    <echo message="Building branch: ${metabuild.branch}"/>
+    <property name="releasejson" value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
+    <property name="xmlrelease" value="${nb_all}/nbbuild/build/netbeansrelease.xml"/>
+    <property name="propertiesrelease" value="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
+    <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
     <releasejson file="${releasejson}" xmloutput="${xmlrelease}" propertiesoutput="${propertiesrelease}" branch="${metabuild.branch}" hash="${metabuild.hash}"/>
+    <property file="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
+    <!-- javadoc content filtering -->
+    <setjavadoc branch="${metabuild.branch}"/>
   </target>
+
+  <target name="getjsonfile">
+    <!-- copy all related release properties -->
+    <copy file="${nb_all}/nbbuild/netbeansrelease.json" tofile="${nb_all}/nbbuild/build/netbeansrelease.json" failonerror="false"/>
+    <!-- read info from gitinfo.properties , if present in source bundle copy gitinfo-->
+    <copy file="${nb_all}/nbbuild/gitinfo.properties" tofile="${nb_all}/nbbuild/build/gitinfo.properties" failonerror="false"/>
+
+    <property name="metabuild.releasejson" value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
+    <!-- get all json info we have on apache gitbox  -->
+    <condition property="metabuild.jsonurl" value="https://gitbox.apache.org/repos/asf?p=netbeans-jenkins-lib.git;a=blob_plain;f=meta/netbeansrelease.json">
+        <not>
+            <isset property="metabuild.jsonurl"/>
+        </not>
+    </condition>
+    <condition property="needjsondownload" value="true" else="false">
+        <not>
+            <available file="${nb_all}/nbbuild/build/netbeansrelease.json" />
+        </not>
+    </condition>
+    <sequential if:true="${needjsondownload}" >
+        <configureproxy connectTo="${metabuild.jsonurl}" hostProperty="proxyHost" portProperty="proxyPort"/>
+        <setproxy proxyhost="${proxyHost}" proxyPort="${proxyPort}"/>
+        <get dest="${metabuild.releasejson}" skipexisting="false" src="${metabuild.jsonurl}" />
+    </sequential>
+  </target>
+
+  <target name="cache-release-json">
+      <property name="needjsondownload" value="true" />
+      <antcall target="getjsonfile" />
+      <copy file="${metabuild.releasejson}" tofile="${nb_all}/nbbuild/netbeansrelease.json" />
+  </target>
+
+  <target name="clear-release-json">
+      <delete file="${nb_all}/nbbuild/netbeansrelease.json" />
+      <delete file="${nb_all}/nbbuild/build/netbeansrelease.json" />
+  </target>
+
   <target name="-gitinfo.ispresent">
       <available file="${nb_all}/nbbuild/build/gitinfo.properties" property="gitinfo.present" />      
   </target>
+
   <target name="-git.down" unless="${gitinfo.present}" depends="-gitinfo.ispresent">
       <!-- try to get information from jenkins apache multi branch build or travis -->
       <taskdef name="gitbranchhash" classname="org.netbeans.nbbuild.GitBranchHash" classpath="${nbantext.jar}" />
@@ -190,11 +221,14 @@
       <echo if:set="metabuild.hash" file="${nb_all}/nbbuild/build/gitinfo.properties" >metabuild.branch=${metabuild.branch}
 metabuild.hash=${metabuild.hash}</echo>
   </target>
+
   <target name="-git.up" if="${gitinfo.present}" depends="-gitinfo.ispresent">
       <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
       <echo message="Processing build with branch ${metabuild.branch} and hash ${metabuild.hash}" />
   </target>
+
   <target name="getgitinformation" depends="-git.up,-git.down" />
+
   <target name="download-all-extbins" unless="ext.binaries.downloaded" depends="bootstrap">
     <echo>Downloading external binaries (*/external/ directories)...</echo>
     <!-- optionnal reporttofile used to speed resolving artefacts resolution for maven artefacts -->
@@ -205,6 +239,7 @@
     </downloadbinaries>
     <property name="ext.binaries.downloaded" value="true"/>
   </target>
+
   <!-- create list of all maven coordinate -->
   <target name="getallmavencoordinates">
       <concat destfile="${nb_all}/nbbuild/build/external.info">
@@ -1690,8 +1725,8 @@
       <zipfileset file="${nb.build.dir}/LICENSE" />
       <zipfileset dir="${nb.build.dir}/licenses" includes="**" prefix="licenses" /> 
       <zipfileset file="${source.zip.readme}" fullpath="README.md" erroronmissingarchive="false" />
-      <zipfileset file="${nb_all}/nbbuild/build/netbeansrelease.properties" fullpath="nbbuild/netbeansrelease.properties" erroronmissingarchive="false"/>
       <zipfileset file="${nb_all}/nbbuild/build/gitinfo.properties" fullpath="nbbuild/gitinfo.properties" erroronmissingarchive="false" />
+      <zipfileset file="${nb_all}/nbbuild/build/netbeansrelease.json" fullpath="nbbuild/netbeansrelease.json" erroronmissingarchive="false" />
     </zip>
   </target>
 
diff --git a/nbbuild/rat-exclusions.txt b/nbbuild/rat-exclusions.txt
index 1a11e12..693571e 100644
--- a/nbbuild/rat-exclusions.txt
+++ b/nbbuild/rat-exclusions.txt
@@ -26,6 +26,7 @@
 ###### generated build artifacts
 nbbuild/gitinfo.properties
 nbbuild/netbeansrelease.properties
+nbbuild/netbeansrelease.json
 enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/application/model_1_4/*
 enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/application/model_5/*
 enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/application/model_6/*
diff --git a/platform/api.search/src/org/netbeans/modules/search/BasicSearchForm.java b/platform/api.search/src/org/netbeans/modules/search/BasicSearchForm.java
index 585f734..6071120 100644
--- a/platform/api.search/src/org/netbeans/modules/search/BasicSearchForm.java
+++ b/platform/api.search/src/org/netbeans/modules/search/BasicSearchForm.java
@@ -39,6 +39,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.swing.*;
+import javax.swing.border.Border;
 import javax.swing.border.EmptyBorder;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -216,7 +217,7 @@
 
         lblTextToFind = new JLabel();
         JComboBox<String> box = new JComboBox<>();
-        box.setEditor(new MultiLineComboBoxEditor());
+        box.setEditor(new MultiLineComboBoxEditor(box));
         cboxTextToFind = ComponentUtils.adjustComboForSearchPattern(box);
         lblTextToFind.setLabelFor(cboxTextToFind.getComponent());
         btnTestTextToFind = new JButton();
@@ -227,7 +228,7 @@
         if (searchAndReplace) {
             lblReplacement = new JLabel();
             cboxReplacement = new JComboBox<>();
-            cboxReplacement.setEditor(new MultiLineComboBoxEditor());
+            cboxReplacement.setEditor(new MultiLineComboBoxEditor(cboxReplacement));
             cboxReplacement.setEditable(true);
             cboxReplacement.setRenderer(new ShorteningCellRenderer());
             lblReplacement.setLabelFor(cboxReplacement);
@@ -1116,11 +1117,23 @@
 
         private final JTextArea area = new JTextArea();
 
-        public MultiLineComboBoxEditor() {
+        public MultiLineComboBoxEditor(JComboBox reference) {
             area.setWrapStyleWord(false);
             area.setLineWrap(false);
+
+            Border border = ((JComponent)reference.getEditor().getEditorComponent()).getBorder();
+            if (border == null) {
+                border = reference.getBorder();
+            }
+            area.setBorder(border);
+
+            // retain standard focus traversal behavior
             area.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERS‌​AL_KEYS, null);
             area.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERS‌​AL_KEYS, null);
+
+            // dispatch enter to parent; set line breaks on shift+enter
+            area.getInputMap().put(KeyStroke.getKeyStroke("shift ENTER"), "insert-break");
+            area.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "text-submit");
         }
 
         @Override
diff --git a/platform/api.search/src/org/netbeans/modules/search/BasicSearchProvider.java b/platform/api.search/src/org/netbeans/modules/search/BasicSearchProvider.java
index f46f7dd..b064acc 100644
--- a/platform/api.search/src/org/netbeans/modules/search/BasicSearchProvider.java
+++ b/platform/api.search/src/org/netbeans/modules/search/BasicSearchProvider.java
@@ -226,7 +226,8 @@
                     notifySupport.setInformationMessage(UiUtils.getText(
                             "BasicSearchForm.txtInfoNoWildcards"));     //NOI18N
                 } else {
-                    notifySupport.clearMessages();
+                    notifySupport.setInformationMessage(UiUtils.getText(
+                            "BasicSearchForm.txtInfoMultiline"));     //NOI18N
                 }
             }
             return usable;
diff --git a/platform/api.search/src/org/netbeans/modules/search/Bundle.properties b/platform/api.search/src/org/netbeans/modules/search/Bundle.properties
index 014597c..bb81352 100644
--- a/platform/api.search/src/org/netbeans/modules/search/Bundle.properties
+++ b/platform/api.search/src/org/netbeans/modules/search/Bundle.properties
@@ -248,6 +248,7 @@
 BasicSearchForm.txtErrorReplacePattern=Replace With field contains invalid expression
 BasicSearchForm.txtErrorFileName=File Name Patterns field contains invalid regular expression
 BasicSearchForm.txtInfoNoWildcards=File Name Pattern contains no wildcards. It may be a mistake.
+BasicSearchForm.txtInfoMultiline=Resize Window for multi-line search (SHIFT+ENTER for line breaks).
 
 LBL_OptionsPanelTitle=Options
 
diff --git a/platform/api.search/src/org/netbeans/modules/search/PatternSandbox.java b/platform/api.search/src/org/netbeans/modules/search/PatternSandbox.java
index a56cfec..7a25f55 100644
--- a/platform/api.search/src/org/netbeans/modules/search/PatternSandbox.java
+++ b/platform/api.search/src/org/netbeans/modules/search/PatternSandbox.java
@@ -82,7 +82,7 @@
     protected void initComponents() {
 
         cboxPattern = new JComboBox<String>();
-        cboxPattern.setEditor(new BasicSearchForm.MultiLineComboBoxEditor());
+        cboxPattern.setEditor(new BasicSearchForm.MultiLineComboBoxEditor(cboxPattern));
         cboxPattern.setEditable(true);
         cboxPattern.setRenderer(new ShorteningCellRenderer());
         lblPattern = new JLabel();
diff --git a/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java b/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java
index af4417d..b819579 100644
--- a/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java
+++ b/platform/api.search/src/org/netbeans/modules/search/matcher/BufferedCharSequence.java
@@ -559,7 +559,7 @@
             try {
                 istream = fo.getInputStream();
                 try {
-                    bstream = new BufferedInputStream(istream, bufferSize);
+                    bstream = new BufferedInputStream(istream, Math.max(1, bufferSize));
                 } catch (Throwable t) {
                     if (istream != null) {
                         istream.close();
diff --git a/platform/api.search/src/org/netbeans/modules/search/ui/ShorteningCellRenderer.java b/platform/api.search/src/org/netbeans/modules/search/ui/ShorteningCellRenderer.java
index be25b8d..fd1d9fd 100644
--- a/platform/api.search/src/org/netbeans/modules/search/ui/ShorteningCellRenderer.java
+++ b/platform/api.search/src/org/netbeans/modules/search/ui/ShorteningCellRenderer.java
@@ -37,7 +37,7 @@
     @Override
     public Component getListCellRendererComponent(JList<?> list, Object value,
             int index, boolean isSelected, boolean cellHasFocus) {
-        String s = value == null ? null : value.toString();
+        String s = value == null ? null : value.toString().replaceAll("[\r\n]+", " ");
         Component component = super.getListCellRendererComponent(list,
                 s, index, isSelected, cellHasFocus);
         if (s != null && s.length() > COMBO_TEXT_LENGHT_LIMIT