From bbf45b323f9896b6c5d4b7ae7a88be01182d0b0e Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 15 Oct 2022 20:43:51 +0200 Subject: [PATCH 01/33] return on cancel. --- .../modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java index 16919be2c0a3..9036adfbfe8f 100644 --- a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java +++ b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/pm/NFABasedBulkSearch.java @@ -448,7 +448,9 @@ public void encode(Tree tree, final EncodingContext ctx, AtomicBoolean cancel) { throw new IllegalStateException(ex); } } - if (cancel.get()); + if (cancel.get()) { + return; + } new CollectIdentifiers(new HashSet<>(), cancel) { private boolean encode = true; @Override @@ -511,7 +513,6 @@ public Void scan(Iterable nodes, Void p) { ctx.setIdentifiers(identifiers); ctx.setContent(content); - if (cancel.get()); } @Override From 874337e83bcc52a7720af188800f6b0d2729c217 Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Mon, 17 Oct 2022 14:15:49 -0700 Subject: [PATCH 02/33] More precise code-completion for ANTLRv4 --- .../languages/antlr/AntlrParserResult.java | 20 +++- .../antlr/v3/Antlr3ParserResult.java | 13 ++- .../antlr/v4/Antlr4CompletionProvider.java | 108 +++++++++++++++--- .../antlr/v4/Antlr4ParserResult.java | 24 ++-- 4 files changed, 135 insertions(+), 30 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java index 009e288dd6d0..3b76ca94d5bf 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java @@ -44,6 +44,12 @@ */ public abstract class AntlrParserResult extends ParserResult { + public enum GrammarType { + UNKNOWN, LEXER, PARSER, MIXED, TREE; + } + + protected GrammarType grammarType = GrammarType.UNKNOWN; + public final List errors = new ArrayList<>(); public final Map references = new TreeMap<>(); public final Map> occurrences = new HashMap<>(); @@ -53,7 +59,7 @@ public abstract class AntlrParserResult extends ParserResult { volatile boolean finished = false; - public static final Reference EOF = new Reference("EOF", OffsetRange.NONE); //NOI18N + public static final Reference EOF = new Reference(ReferenceType.TOKEN, "EOF", OffsetRange.NONE); //NOI18N public AntlrParserResult(Snapshot snapshot) { super(snapshot); @@ -97,11 +103,21 @@ protected boolean processingFinished() { return finished; } + public final GrammarType getGrammarType() { + return grammarType; + } + + public enum ReferenceType { + FRAGMENT, TOKEN, RULE, CHANNEL, MODE + } + public static class Reference { + public final ReferenceType type; public final String name; public final OffsetRange defOffset; - public Reference(String name, OffsetRange defOffset) { + public Reference(ReferenceType type, String name, OffsetRange defOffset) { + this.type = type; this.name = name; this.defOffset = defOffset; } diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java index 81e01bbc2851..4b471d06ad8c 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java @@ -64,12 +64,23 @@ protected void evaluateParser(ANTLRv3Parser parser) { @Override protected ParseTreeListener createReferenceListener() { return new ANTLRv3ParserBaseListener() { + @Override + public void exitGrammarDef(ANTLRv3Parser.GrammarDefContext ctx) { + grammarType = GrammarType.MIXED; + if (ctx.LEXER() != null) grammarType = GrammarType.LEXER; + if (ctx.PARSER() != null) grammarType = GrammarType.PARSER; + if (ctx.TREE() != null) grammarType = GrammarType.TREE; + } + @Override public void exitRule_(ANTLRv3Parser.Rule_Context ctx) { Token token = ctx.id_().getStart(); OffsetRange range = new OffsetRange(token.getStartIndex(), token.getStopIndex() + 1); String name = token.getText(); - Reference ref = new Reference(name, range); + ReferenceType rtype = Character.isUpperCase(name.charAt(0)) ? ReferenceType.TOKEN : ReferenceType.RULE; + rtype = ((rtype == ReferenceType.TOKEN) && (ctx.FRAGMENT() != null)) ? ReferenceType.FRAGMENT : rtype; + + Reference ref = new Reference(rtype, name, range); references.put(ref.name, ref); } }; diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java index a2a3a985ea3a..d69de2dd42fb 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java @@ -18,6 +18,7 @@ */ package org.netbeans.modules.languages.antlr.v4; +import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import org.netbeans.modules.languages.antlr.*; @@ -49,6 +50,7 @@ import org.netbeans.api.annotations.common.StaticResource; import static org.antlr.parser.antlr4.ANTLRv4Lexer.*; +import org.netbeans.modules.languages.antlr.AntlrParserResult.ReferenceType; import static org.netbeans.modules.languages.antlr.AntlrTokenSequence.DEFAULT_CHANNEL; /** @@ -139,6 +141,8 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse } private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { + AntlrParserResult result = AntlrParser.getParserResult(fo); + AntlrParserResult.GrammarType grammarType = result != null ? result.getGrammarType(): AntlrParserResult.GrammarType.UNKNOWN; Optional opt = tokens.previous(DEFAULT_CHANNEL); if (!opt.isPresent()) { //At the start of the file; @@ -165,6 +169,7 @@ private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffse return; } else { pt = opt.get(); + // chack our previous token switch (pt.getType()) { case PARSER: case LEXER: @@ -182,6 +187,24 @@ private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffse //Command: offer 'channel', 'skip', etc... addTokens(prefix, caretOffset, resultSet, "skip", "more", "type", "channel", "mode", "pushMode", "popMode"); return; + case LPAREN: + Optional lexerCommand = tokens.previous(DEFAULT_CHANNEL); + // We are not necessary in a lexerCommand here, just taking chances + if (lexerCommand.isPresent()) { + switch (lexerCommand.get().getText()) { + case "channel": + addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.CHANNEL)); + return; + case "mode": + case "pushMode": + addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.MODE)); + return; + case "type": + addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.TOKEN)); + return; + } + } + // the fall through is intentional, as of betting on lexerCommand did not come through default: tokens.seekTo(caretOffset); Optional semi = tokens.previous(SEMI); @@ -189,22 +212,32 @@ private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffse Optional colon = tokens.previous(COLON); if (semi.isPresent() && colon.isPresent() && semi.get().getStartIndex() < colon.get().getStartIndex()) { - // we are in lexer/parser ruledef - Set scanned = new HashSet<>(); - Map matchingRefs = new HashMap<>(); - addReferencesForFile(fo, prefix, matchingRefs, scanned); + EnumSet rtypes = EnumSet.noneOf(ReferenceType.class); - int startOffset = caretOffset - prefix.length(); - for (AntlrParserResult.Reference ref : matchingRefs.values()) { - CompletionItem item = CompletionUtilities.newCompletionItemBuilder(ref.name) - .startOffset(startOffset) - .leftHtmlText(ref.name) - .sortText(ref.name) - .build(); - resultSet.addItem(item); - + // we are in lexer/parser ruledef + Optional ref = tokens.previous(DEFAULT_CHANNEL); + if (ref.isPresent() && (ref.get().getType() == RULE_REF || ref.get().getType() == TOKEN_REF)) { + if (ref.get().getType() == TOKEN_REF) { + rtypes.add(ReferenceType.FRAGMENT); + } else { + rtypes.add(ReferenceType.TOKEN); + rtypes.add(ReferenceType.RULE); + if (grammarType == AntlrParserResult.GrammarType.MIXED) { + rtypes.add(ReferenceType.FRAGMENT); + } + } + } else { + // A bit odd definition, let's rely on the grammarType + if ((grammarType == AntlrParserResult.GrammarType.LEXER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { + rtypes.add(ReferenceType.FRAGMENT); + } + if ((grammarType == AntlrParserResult.GrammarType.PARSER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { + rtypes.add(ReferenceType.TOKEN); + rtypes.add(ReferenceType.RULE); + } } + addReferences(fo, prefix, caretOffset, resultSet, rtypes); } } @@ -229,21 +262,40 @@ public void addTokens(String prefix, int caretOffset, CompletionResultSet result } } - public void addReferencesForFile(FileObject fo, String prefix, Map matching, Set scannedFiles) { + public void addReferences(FileObject fo, String prefix, int caretOffset, CompletionResultSet resultSet, Set rtypes) { + Set scanned = new HashSet<>(); + Map matchingRefs = new HashMap<>(); + addReferencesForFile(fo, prefix, matchingRefs, scanned, rtypes); + + int startOffset = caretOffset - prefix.length(); + for (AntlrParserResult.Reference ref : matchingRefs.values()) { + CompletionItem item = CompletionUtilities.newCompletionItemBuilder(ref.name) + .iconResource(getReferenceIcon(ref.type)) + .startOffset(startOffset) + .leftHtmlText(ref.name) + .sortText(caseSensitive ? ref.name : ref.name.toUpperCase()) + .build(); + resultSet.addItem(item); + + } + } + + public void addReferencesForFile(FileObject fo, String prefix, Map matching, Set scannedFiles, Set rtypes) { if (scannedFiles.contains(fo)) { return; } scannedFiles.add(fo); + String mprefix = caseSensitive ? prefix : prefix.toUpperCase(); AntlrParserResult result = AntlrParser.getParserResult(fo); Map refs = result.references; - for (String ref : refs.keySet()) { - String mref = caseSensitive ? ref : ref.toUpperCase(); + for (AntlrParserResult.Reference ref : refs.values()) { + String mref = caseSensitive ? ref.name : ref.name.toUpperCase(); boolean match = mref.startsWith(mprefix); - if (match && !matching.containsKey(ref)) { - matching.put(ref, refs.get(ref)); + if (match && !matching.containsKey(ref) && rtypes.contains(ref.type)) { + matching.put(ref.name, ref); } } @@ -251,11 +303,29 @@ public void addReferencesForFile(FileObject fo, String prefix, Map { private final List imports = new ArrayList<>(); private static final Logger LOG = Logger.getLogger(Antlr4ParserResult.class.getName()); - public static final Reference HIDDEN = new Reference("HIDDEN", OffsetRange.NONE); + public static final Reference HIDDEN = new Reference(ReferenceType.CHANNEL, "HIDDEN", OffsetRange.NONE); public Antlr4ParserResult(Snapshot snapshot) { super(snapshot); @@ -83,19 +83,27 @@ private static Token getIdentifierToken(ANTLRv4Parser.IdentifierContext ctx) { @Override protected ParseTreeListener createReferenceListener() { return new ANTLRv4ParserBaseListener() { + @Override + public void exitGrammarType(ANTLRv4Parser.GrammarTypeContext ctx) { + grammarType = GrammarType.MIXED; + if (ctx.LEXER() != null) grammarType = GrammarType.LEXER; + if (ctx.PARSER() != null) grammarType = GrammarType.PARSER; + } + @Override public void exitParserRuleSpec(ANTLRv4Parser.ParserRuleSpecContext ctx) { if (ctx.RULE_REF() != null) { Token token = ctx.RULE_REF().getSymbol(); - addReference(token); + addReference(ReferenceType.RULE, token); } } @Override public void exitLexerRuleSpec(ANTLRv4Parser.LexerRuleSpecContext ctx) { if (ctx.TOKEN_REF() != null) { + ReferenceType type = ctx.FRAGMENT() != null ? ReferenceType.FRAGMENT : ReferenceType.TOKEN; Token token = ctx.TOKEN_REF().getSymbol(); - addReference(token); + addReference(type, token); } } @@ -104,7 +112,7 @@ public void exitTokensSpec(ANTLRv4Parser.TokensSpecContext ctx) { List ids = ctx.idList().identifier(); for (ANTLRv4Parser.IdentifierContext id : ids) { if (id.TOKEN_REF() != null) { - addReference(id.TOKEN_REF().getSymbol()); + addReference(ReferenceType.TOKEN, id.TOKEN_REF().getSymbol()); } } } @@ -113,21 +121,21 @@ public void exitTokensSpec(ANTLRv4Parser.TokensSpecContext ctx) { public void exitChannelsSpec(ANTLRv4Parser.ChannelsSpecContext ctx) { List ids = ctx.idList().identifier(); for (ANTLRv4Parser.IdentifierContext id : ids) { - addReference(getIdentifierToken(id)); + addReference(ReferenceType.CHANNEL, getIdentifierToken(id)); } } @Override public void exitModeSpec(ANTLRv4Parser.ModeSpecContext ctx) { if (ctx.identifier() != null) { - addReference(getIdentifierToken(ctx.identifier())); + addReference(ReferenceType.MODE, getIdentifierToken(ctx.identifier())); } } - public void addReference(Token token) { + public void addReference(ReferenceType type, Token token) { OffsetRange range = new OffsetRange(token.getStartIndex(), token.getStopIndex() + 1); String name = token.getText(); - Reference ref = new Reference(name, range); + Reference ref = new Reference(type, name, range); references.put(ref.name, ref); } From c89411e2cba0bf223b9bb3bb309b53df7c4cd9aa Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Mon, 17 Oct 2022 23:31:34 -0700 Subject: [PATCH 03/33] Fixed recursive import references --- .../antlr/v4/Antlr4ParserResult.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java index 36355c2cf283..0e16bb90b407 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java @@ -21,8 +21,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.Consumer; import java.util.logging.Logger; import org.antlr.parser.antlr4.ANTLRv4Lexer; @@ -143,16 +145,30 @@ public void addReference(ReferenceType type, Token token) { } + private void collectReferences(FileObject fo, Map refs, Set visited) { + if (!visited.contains(fo.getName())) { + refs.putAll(references); + visited.add(fo.getName()); + for (String im : imports) { + FileObject ifo = getFileObject().getParent().getFileObject(im + ".g4"); + if (ifo != null) { + Antlr4ParserResult pr = (Antlr4ParserResult) AntlrParser.getParserResult(ifo); + if (pr != null) { + pr.collectReferences(ifo, refs, visited); + } + } + visited.add(im); + } + } + } + @Override protected ParseTreeListener createCheckReferences() { final Map allRefs = new HashMap<>(references); - for (String im : imports) { - FileObject fo = getFileObject().getParent().getFileObject(im + ".g4"); - if (fo != null) { - AntlrParserResult pr = AntlrParser.getParserResult(fo); - allRefs.putAll(pr.references); - } - } + Set visitedImports = new HashSet<>(); + + collectReferences(getFileObject(), allRefs, visitedImports); + return new ANTLRv4OccuranceListener((token) -> { String name = token.getText(); if(!allRefs.containsKey(name)) { From 3951a6d5252a6fb12382a81277deb1c0f00cec1c Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Mon, 17 Oct 2022 23:32:25 -0700 Subject: [PATCH 04/33] Added support for imported grammar references --- .../languages/antlr/AntlrDeclarationFinder.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrDeclarationFinder.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrDeclarationFinder.java index f03c81fb9ac0..0035a4d0b2c1 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrDeclarationFinder.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrDeclarationFinder.java @@ -19,7 +19,6 @@ package org.netbeans.modules.languages.antlr; import java.util.HashSet; -import java.util.Map; import java.util.Set; import javax.swing.text.AbstractDocument; import javax.swing.text.Document; @@ -49,8 +48,17 @@ public DeclarationLocation findDeclaration(ParserResult info, int caretOffset) { ts.moveNext(); Token token = ts.token(); String ref = String.valueOf(token.text()); + FileObject fo = info.getSnapshot().getSource().getFileObject(); Set scannedFiles = new HashSet<>(); - return getDeclarationLocation(info.getSnapshot().getSource().getFileObject(), ref, DeclarationLocation.NONE, scannedFiles); + + DeclarationLocation ret = getDeclarationLocation(fo, ref, DeclarationLocation.NONE, scannedFiles); + if (ret == DeclarationLocation.NONE) { + FileObject rfo = fo.getParent().getFileObject(ref, "g4"); + if (rfo != null) { + ret = new DeclarationFinder.DeclarationLocation(rfo, 0); + } + } + return ret; } @Override From b068b4af1fdab63be658933e9cb425a7fb5bc00a Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 21 Oct 2022 14:40:03 +0200 Subject: [PATCH 05/33] Maven UseReleaseOptionHint fixes - NPE fix when build tag is empty - don't show hint if there is no compiler plugin in the pom - simplified code, added more tests --- .../maven/hints/pom/UseReleaseOptionHint.java | 43 ++++++++------- .../hints/pom/UseReleaseOptionHintTest.java | 54 +++++++++---------- 2 files changed, 50 insertions(+), 47 deletions(-) diff --git a/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHint.java b/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHint.java index f99f82f9b684..737b5bb39bab 100644 --- a/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHint.java +++ b/java/maven.hints/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHint.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.prefs.Preferences; import javax.swing.JComponent; import javax.xml.namespace.QName; @@ -66,32 +67,36 @@ public class UseReleaseOptionHint implements POMErrorFixProvider { @Override public List getErrorsForDocument(POMModel model, Project prj) { - List hints = new ArrayList<>(); - Build build = model.getProject().getBuild(); - if (build != null) { - for (Plugin plugin : build.getPlugins()) { - if ("maven-compiler-plugin".equals(plugin.getArtifactId())) { - if (!isPluginCompatible(plugin)) { - return Collections.emptyList(); - } - hints.addAll(createHintsForParent("", plugin.getConfiguration())); - if (plugin.getExecutions() != null) { - for (PluginExecution exec : plugin.getExecutions()) { - hints.addAll(createHintsForParent("", exec.getConfiguration())); - } + + if (build != null && build.getPlugins() != null) { + + List hints = new ArrayList<>(); + Optional compilerPlugin = build.getPlugins().stream() + .filter((p) -> "maven-compiler-plugin".equals(p.getArtifactId())) + .filter(this::isPluginCompatible) + .findFirst(); + + if (compilerPlugin.isPresent()) { + hints.addAll(createHintsForParent("", compilerPlugin.get().getConfiguration())); + if (compilerPlugin.get().getExecutions() != null) { + for (PluginExecution exec : compilerPlugin.get().getExecutions()) { + hints.addAll(createHintsForParent("", exec.getConfiguration())); } - break; } + } else { + return Collections.emptyList(); } - } - Properties properties = model.getProject().getProperties(); - if (properties != null) { - hints.addAll(createHintsForParent("maven.compiler.", properties)); + Properties properties = model.getProject().getProperties(); + if (properties != null) { + hints.addAll(createHintsForParent("maven.compiler.", properties)); + } + + return hints; } - return hints; + return Collections.emptyList(); } private List createHintsForParent(String prefix, POMComponent parent) { diff --git a/java/maven.hints/test/unit/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHintTest.java b/java/maven.hints/test/unit/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHintTest.java index 58aefb06cc95..40ac0316480b 100644 --- a/java/maven.hints/test/unit/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHintTest.java +++ b/java/maven.hints/test/unit/src/org/netbeans/modules/maven/hints/pom/UseReleaseOptionHintTest.java @@ -50,7 +50,7 @@ protected void setUp() throws Exception { work = FileUtil.toFileObject(getWorkDir()); } - public void testProperties() throws Exception { + public void testNoPluginNegative() throws Exception { FileObject pom = TestFileUtils.writeFile(work, "pom.xml", "\n" + "\n" + @@ -70,36 +70,11 @@ public void testProperties() throws Exception { POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pom)); Project project = ProjectManager.getDefault().findProject(pom.getParent()); - List hints = new UseReleaseOptionHint().getErrorsForDocument(model, project); - assertEquals(2, hints.size()); - } - - public void testPropertiesNegative() throws Exception { - FileObject pom = TestFileUtils.writeFile(work, "pom.xml", - "\n" + - "\n" + - " 4.0.0\n" + - " test\n" + - " mavenproject1\n" + - " 1.0-SNAPSHOT\n" + - " jar\n" + - " \n" + - " UTF-8\n" + - " test.mavenproject1.Mavenproject1\n" + - " 8\n" + - " 8\n" + - " \n" + - ""); - - POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pom)); - Project project = ProjectManager.getDefault().findProject(pom.getParent()); - List hints = new UseReleaseOptionHint().getErrorsForDocument(model, project); assertEquals(0, hints.size()); } - public void testCompilerPlugin() throws Exception { - FileObject pom = TestFileUtils.writeFile(work, "pom.xml", + private static final String COMPILER_POM = "\n" + "\n" + " 4.0.0\n" + @@ -141,7 +116,10 @@ public void testCompilerPlugin() throws Exception { " \n" + " \n" + " \n" + - ""); + ""; + + public void testCompilerPlugin() throws Exception { + FileObject pom = TestFileUtils.writeFile(work, "pom.xml", COMPILER_POM); POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pom)); Project project = ProjectManager.getDefault().findProject(pom.getParent()); @@ -150,4 +128,24 @@ public void testCompilerPlugin() throws Exception { assertEquals(6, hints.size()); } + public void testOldCompilerPluginNegative() throws Exception { + FileObject pom = TestFileUtils.writeFile(work, "pom.xml", COMPILER_POM.replaceFirst("3.10.1", "3.5")); + + POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pom)); + Project project = ProjectManager.getDefault().findProject(pom.getParent()); + + List hints = new UseReleaseOptionHint().getErrorsForDocument(model, project); + assertEquals(0, hints.size()); + } + + public void testCompilerPluginButOldTargetNegative() throws Exception { + FileObject pom = TestFileUtils.writeFile(work, "pom.xml", COMPILER_POM.replace("11", "5").replace("17", "1.4")); + + POMModel model = POMModelFactory.getDefault().getModel(Utilities.createModelSource(pom)); + Project project = ProjectManager.getDefault().findProject(pom.getParent()); + + List hints = new UseReleaseOptionHint().getErrorsForDocument(model, project); + assertEquals(0, hints.size()); + } + } From 31a5d69a977b76194ebcf9a903304fa007cb5549 Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Fri, 21 Oct 2022 16:26:06 +0100 Subject: [PATCH 06/33] Update JDK 19 Javadoc link from EA to GA. --- .../platformdefinition/J2SEPlatformDefaultJavadocImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java index f04f8168c132..bfe47b4f3b35 100644 --- a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java +++ b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java @@ -67,7 +67,7 @@ public final class J2SEPlatformDefaultJavadocImpl implements J2SEPlatformDefault OFFICIAL_JAVADOC.put("16", "https://docs.oracle.com/en/java/javase/16/docs/api/"); // NOI18N OFFICIAL_JAVADOC.put("17", "https://docs.oracle.com/en/java/javase/17/docs/api/"); // NOI18N OFFICIAL_JAVADOC.put("18", "https://docs.oracle.com/en/java/javase/18/docs/api/"); // NOI18N - OFFICIAL_JAVADOC.put("19", "https://download.java.net/java/early_access/jdk19/docs/api/"); // NOI18N Early access + OFFICIAL_JAVADOC.put("19", "https://docs.oracle.com/en/java/javase/19/docs/api/"); // NOI18N OFFICIAL_JAVADOC.put("20", "https://download.java.net/java/early_access/jdk20/docs/api/"); // NOI18N Early access } From 2017b189ca72ea51b9a6d80c343e6958a8c3dd51 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 21 Oct 2022 21:30:37 +0200 Subject: [PATCH 07/33] put nb-javac modules on the plugin import block list. Users which import nb-javac plugins from old NB versions complain about not being able to start NB anymore. This puts all nbjavac modules which were in NB 12.1 on the block list. --- .../autoupdate/pluginimporter/Bundle.properties | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties index ca02a85eb101..8369750784d7 100644 --- a/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties +++ b/nb/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Bundle.properties @@ -39,5 +39,13 @@ ImportManager.Progress.Name=Importing plugins... PluginImporter.Importing.Plugin=Importing {0}... PluginImporter.Importing.RestartNeeded=Restart needed to import plugins. Do you want to restart NetBeans IDE now? #Blacklist codeNameBase of dangerous plugins which cannot be imported like: org.dangerous.plugin,com.nextdangerous.module,... etc. -plugin.import.blacklist=org.netbeans.shortcuts,org.jmarsault.shortcuts +plugin.import.blacklist=\ +org.netbeans.shortcuts,\ +org.jmarsault.shortcuts,\ +org.netbeans.lib.nbjavac,\ +org.netbeans.modules.nbjavac,\ +org.netbeans.modules.nbjavac.api,\ +org.netbeans.modules.nbjavac.impl,\ +org.netbeans.modules.java.source.nbjavac + apachenetbeanspreviousversion=@@metabuild.apachepreviousversion@@ From cbce7e7add36ac99ea628d8f5591efe5516642cf Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Sun, 23 Oct 2022 22:56:40 -0700 Subject: [PATCH 08/33] No double parsing, avoid closed loops in imported grammars --- .../languages/antlr/AntlrParserResult.java | 8 +- .../antlr/v3/Antlr3ParserResult.java | 12 --- .../antlr/v4/Antlr4CompletionProvider.java | 72 +++++++--------- .../antlr/v4/Antlr4ParserResult.java | 84 +++++++++++-------- 4 files changed, 78 insertions(+), 98 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java index 3b76ca94d5bf..dd2797d3fce7 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrParserResult.java @@ -75,14 +75,10 @@ public AntlrParserResult get() { parser.addParseListener(createFoldListener()); parser.addParseListener(createReferenceListener()); parser.addParseListener(createImportListener()); - evaluateParser(parser); - - // Start a second parsing phase for checking; - parser = createParser(getSnapshot()); parser.addParseListener(createStructureListener()); parser.addParseListener(createOccurancesListener()); - parser.addParseListener(createCheckReferences()); evaluateParser(parser); + finished = true; } return this; @@ -151,8 +147,6 @@ protected final void markOccurrence(String refName, OffsetRange or) { protected abstract ParseTreeListener createStructureListener(); protected abstract ParseTreeListener createOccurancesListener(); - protected abstract ParseTreeListener createCheckReferences(); - protected ANTLRErrorListener createErrorListener() { return new BaseErrorListener() { @Override diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java index 4b471d06ad8c..bcdf435f1060 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3ParserResult.java @@ -86,18 +86,6 @@ public void exitRule_(ANTLRv3Parser.Rule_Context ctx) { }; } - @Override - protected ParseTreeListener createCheckReferences() { - return new ANTLRv3OccuranceListener((token) -> { - String name = token.getText(); - if (!references.containsKey(name)) { - //TODO: It seems the ANTLRv3 Grammar Occurance finder could be a bit smarter - //Adding the following line could produce false positives. - //errors.add(new DefaultError(null, "Unknown Reference: " + name, null, source, token.getStartIndex(), token.getStopIndex() + 1, Severity.ERROR)); - } - }); - } - @Override protected ParseTreeListener createImportListener() { return new ANTLRv3ParserBaseListener(); diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java index d69de2dd42fb..66e31866c201 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java @@ -20,7 +20,6 @@ import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import org.netbeans.modules.languages.antlr.*; import java.util.Map; import java.util.Optional; @@ -94,6 +93,11 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse if (fo == null) { return; } + AntlrParserResult r = AntlrParser.getParserResult(fo); + if (!(r instanceof Antlr4ParserResult)) { + return; + } + Antlr4ParserResult result = (Antlr4ParserResult) r; String prefix = ""; adoc.readLock(); @@ -129,7 +133,7 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse return; } tokens.previous(); - lookAround(fo, tokens, caretOffset, prefix, resultSet); + lookAround(result, tokens, caretOffset, prefix, resultSet); } else { //Empty grammar so far offer lexer, parser and grammar addTokens("", caretOffset, resultSet, "lexer", "parser", "grammar"); @@ -140,8 +144,7 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse } } - private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { - AntlrParserResult result = AntlrParser.getParserResult(fo); + private void lookAround(Antlr4ParserResult result, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { AntlrParserResult.GrammarType grammarType = result != null ? result.getGrammarType(): AntlrParserResult.GrammarType.UNKNOWN; Optional opt = tokens.previous(DEFAULT_CHANNEL); if (!opt.isPresent()) { @@ -193,14 +196,14 @@ private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffse if (lexerCommand.isPresent()) { switch (lexerCommand.get().getText()) { case "channel": - addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.CHANNEL)); + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.CHANNEL)); return; case "mode": case "pushMode": - addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.MODE)); + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.MODE)); return; case "type": - addReferences(fo, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.TOKEN)); + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.TOKEN)); return; } } @@ -237,7 +240,7 @@ private void lookAround(FileObject fo, AntlrTokenSequence tokens, int caretOffse rtypes.add(ReferenceType.RULE); } } - addReferences(fo, prefix, caretOffset, resultSet, rtypes); + addReferences(result, prefix, caretOffset, resultSet, rtypes); } } @@ -262,13 +265,24 @@ public void addTokens(String prefix, int caretOffset, CompletionResultSet result } } - public void addReferences(FileObject fo, String prefix, int caretOffset, CompletionResultSet resultSet, Set rtypes) { - Set scanned = new HashSet<>(); - Map matchingRefs = new HashMap<>(); - addReferencesForFile(fo, prefix, matchingRefs, scanned, rtypes); - + public void addReferences(Antlr4ParserResult result, String prefix, int caretOffset, CompletionResultSet resultSet, Set rtypes) { + + Map matching = new HashMap<>(); + String mprefix = caseSensitive ? prefix : prefix.toUpperCase(); + + result.allImports().values().forEach((r) ->{ + Map refs = r.references; + for (AntlrParserResult.Reference ref : refs.values()) { + String mref = caseSensitive ? ref.name : ref.name.toUpperCase(); + boolean match = mref.startsWith(mprefix); + if (match && !matching.containsKey(ref.name) && rtypes.contains(ref.type)) { + matching.put(ref.name, ref); + } + } + }); + int startOffset = caretOffset - prefix.length(); - for (AntlrParserResult.Reference ref : matchingRefs.values()) { + for (AntlrParserResult.Reference ref : matching.values()) { CompletionItem item = CompletionUtilities.newCompletionItemBuilder(ref.name) .iconResource(getReferenceIcon(ref.type)) .startOffset(startOffset) @@ -279,36 +293,6 @@ public void addReferences(FileObject fo, String prefix, int caretOffset, Complet } } - - public void addReferencesForFile(FileObject fo, String prefix, Map matching, Set scannedFiles, Set rtypes) { - if (scannedFiles.contains(fo)) { - return; - } - scannedFiles.add(fo); - - - String mprefix = caseSensitive ? prefix : prefix.toUpperCase(); - - AntlrParserResult result = AntlrParser.getParserResult(fo); - Map refs = result.references; - for (AntlrParserResult.Reference ref : refs.values()) { - String mref = caseSensitive ? ref.name : ref.name.toUpperCase(); - boolean match = mref.startsWith(mprefix); - if (match && !matching.containsKey(ref) && rtypes.contains(ref.type)) { - matching.put(ref.name, ref); - } - } - - if (result instanceof Antlr4ParserResult) { - for (String s : ((Antlr4ParserResult) result).getImports()) { - FileObject importedFo = fo.getParent().getFileObject(s, "g4"); - if (importedFo != null) { - addReferencesForFile(importedFo, prefix, matching, scannedFiles, rtypes); - } - } - } - } - } //The folowing is an excrept of org.netbeans.modules.csl.navigation.Icons diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java index 0e16bb90b407..40e20d3da2d6 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java @@ -24,6 +24,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.logging.Logger; @@ -75,6 +76,25 @@ protected ANTLRv4Parser createParser(Snapshot snapshot) { @Override protected void evaluateParser(ANTLRv4Parser parser) { parser.grammarSpec(); + checkReferences(); + } + + private void checkReferences() { + Map allRefs = new HashMap<>(references.size() * 2); + for (Antlr4ParserResult pr : allImports().values()) { + allRefs.putAll(pr.references); + } + occurrences.forEach((refName, offsets) -> { + if (!allRefs.containsKey(refName)) { + for (OffsetRange offset : offsets) { + errors.add(new DefaultError(null, "Unknown Reference: " + refName, null, getFileObject(), offset.getStart(), offset.getEnd(), Severity.ERROR)); + } + } + }); + } + + public List getImports() { + return Collections.unmodifiableList(imports); } private static Token getIdentifierToken(ANTLRv4Parser.IdentifierContext ctx) { @@ -144,39 +164,6 @@ public void addReference(ReferenceType type, Token token) { }; } - - private void collectReferences(FileObject fo, Map refs, Set visited) { - if (!visited.contains(fo.getName())) { - refs.putAll(references); - visited.add(fo.getName()); - for (String im : imports) { - FileObject ifo = getFileObject().getParent().getFileObject(im + ".g4"); - if (ifo != null) { - Antlr4ParserResult pr = (Antlr4ParserResult) AntlrParser.getParserResult(ifo); - if (pr != null) { - pr.collectReferences(ifo, refs, visited); - } - } - visited.add(im); - } - } - } - - @Override - protected ParseTreeListener createCheckReferences() { - final Map allRefs = new HashMap<>(references); - Set visitedImports = new HashSet<>(); - - collectReferences(getFileObject(), allRefs, visitedImports); - - return new ANTLRv4OccuranceListener((token) -> { - String name = token.getText(); - if(!allRefs.containsKey(name)) { - errors.add(new DefaultError(null, "Unknown Reference: " + name, null, getFileObject(), token.getStartIndex(), token.getStopIndex() + 1, Severity.ERROR)); - } - }); - } - @Override protected ParseTreeListener createImportListener() { return new ANTLRv4ParserBaseListener() { @@ -316,11 +303,38 @@ private void addOccurance(Token token) { protected ParseTreeListener createOccurancesListener() { return new ANTLRv4OccuranceListener(this::addOccurance); } + + private Optional getParserResult(String grammarName) { + Optional ret = Optional.empty(); + FileObject fo = getFileObject().getParent().getFileObject(grammarName + ".g4"); + + if (fo != null) { + ret = Optional.of(fo.equals(getFileObject()) ? this : (Antlr4ParserResult) AntlrParser.getParserResult(fo)); + } + return ret; + } - public List getImports() { - return Collections.unmodifiableList(imports); + private void addImports(Set visited, String importedGrammar) { + if (visited.add(importedGrammar)) { + getParserResult(importedGrammar).ifPresent((result) -> { + for (String im : result.getImports()) { + addImports(visited, im); + } + }); + } } + + public Map allImports() { + Set visited = new HashSet<>(); + addImports(visited, getFileObject().getName()); + Map ret = new HashMap<>(); + for (String im : visited) { + getParserResult(im).ifPresent((result) -> ret.put(im, result)); + } + return ret; + } + private static class ANTLRv4OccuranceListener extends ANTLRv4ParserBaseListener { private final Consumer onOccurance; From b1455cfa46cdd1d3905a0d5216d4be2ec22af994 Mon Sep 17 00:00:00 2001 From: Svata Dedic Date: Fri, 21 Oct 2022 13:25:01 +0200 Subject: [PATCH 09/33] Vulnerability scan now takes options structure. --- .../cloud/oracle/adm/AuditOptions.java | 60 ++++++++++++++ .../oracle/adm/ProjectVulnerability.java | 6 +- .../cloud/oracle/adm/RunFileADMAction.java | 2 +- .../cloud/oracle/adm/VulnerabilityWorker.java | 82 ++++++++++--------- 4 files changed, 108 insertions(+), 42 deletions(-) create mode 100644 enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/AuditOptions.java diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/AuditOptions.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/AuditOptions.java new file mode 100644 index 000000000000..d941504ec8a9 --- /dev/null +++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/AuditOptions.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.cloud.oracle.adm; + +/** + * + * @author sdedic + */ +public class AuditOptions { + private boolean forceAuditExecution; + private boolean runIfNotExists; + private String auditName; + + public static AuditOptions makeNewAudit() { + return new AuditOptions().setForceAuditExecution(true).setRunIfNotExists(true); + } + + public boolean isForceAuditExecution() { + return forceAuditExecution; + } + + public AuditOptions setForceAuditExecution(boolean forceAuditExecution) { + this.forceAuditExecution = forceAuditExecution; + return this; + } + + public boolean isRunIfNotExists() { + return runIfNotExists; + } + + public AuditOptions setRunIfNotExists(boolean runIfNotExists) { + this.runIfNotExists = runIfNotExists; + return this; + } + + public String getAuditName() { + return auditName; + } + + public AuditOptions setAuditName(String auditName) { + this.auditName = auditName; + return this; + } +} diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/ProjectVulnerability.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/ProjectVulnerability.java index 3b9829b5d219..225bf791d2d7 100644 --- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/ProjectVulnerability.java +++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/ProjectVulnerability.java @@ -69,14 +69,14 @@ public KnowledgeBaseItem getProjectKnowledgeBase() { "# {0} - project name", "MSG_CreatingAuditFailed=Creating Vulnerablity audit for project {0} failed.", }) - public CompletableFuture runProjectAudit(KnowledgeBaseItem item, boolean force, boolean runIfNoReport) { + public CompletableFuture runProjectAudit(KnowledgeBaseItem item, AuditOptions options) { if (item != null) { setProjectKnowledgeBase(item); } CompletableFuture result = new CompletableFuture<>(); AUDIT_PROCESSOR.post(() -> { try { - result.complete(VulnerabilityWorker.getInstance().findVulnerability(project, force, runIfNoReport)); + result.complete(VulnerabilityWorker.getInstance().findVulnerability(project, options)); } catch (ThreadDeath x) { throw x; } catch (AuditException ex) { @@ -91,7 +91,7 @@ public CompletableFuture runProjectAudit(KnowledgeBaseItem item, boolean return result; } - public CompletableFuture findKnowledgeBase(String compartmentId, String knowledgeBaseId) { + public CompletableFuture findKnowledgeBase(String knowledgeBaseId) { CompletableFuture result = new CompletableFuture<>(); CALL_PROCESSOR.post(() -> { try ( ApplicationDependencyManagementClient client diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/RunFileADMAction.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/RunFileADMAction.java index 742425cb05b6..441ff58a9d81 100644 --- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/RunFileADMAction.java +++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/RunFileADMAction.java @@ -77,7 +77,7 @@ public void actionPerformed(ActionEvent e) { final String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName(); if (kbItem != null) { try { - VulnerabilityWorker.getInstance().findVulnerability(project, true, true); + VulnerabilityWorker.getInstance().findVulnerability(project, AuditOptions.makeNewAudit()); } catch (AuditException exc) { ErrorUtils.processError(exc, Bundle.MSG_CreatingAuditFailed(projectDisplayName)); } diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java index 8d862596ad5b..cdf0113711c4 100644 --- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java +++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java @@ -371,8 +371,11 @@ public static VulnerabilityWorker getInstance() { * @param forceAudit * @return Returns the audit ID, or {@code null} if no audit is present. */ - public String findVulnerability(Project project, boolean forceAudit, boolean runIfNoReport) throws AuditException { - LOG.log(Level.FINER, "Trying to obtain audit for project {0}, force:{1}", new Object[] { project, forceAudit }); + public String findVulnerability(Project project, AuditOptions auditOptions) throws AuditException { + if (auditOptions == null) { + auditOptions = new AuditOptions(); + } + LOG.log(Level.FINER, "Trying to obtain audit for project {0}, force:{1}", new Object[] { project, auditOptions.isForceAuditExecution() }); final String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName(); KnowledgeBaseItem kbItem = getKnowledgeBaseForProject(project); if (kbItem == null) { @@ -382,9 +385,12 @@ public String findVulnerability(Project project, boolean forceAudit, boolean run // remove from the cache old values ProgressHandle progressHandle = ProgressHandle.createHandle(Bundle.MSG_AuditIsRunning(projectDisplayName)); AtomicBoolean remoteCall = new AtomicBoolean(false); + if (auditOptions.getAuditName() == null) { + auditOptions.setAuditName(projectDisplayName); + } try { return doFindVulnerability(project, kbItem.compartmentId, kbItem.getKey().getValue(), - projectDisplayName, progressHandle, forceAudit, runIfNoReport, remoteCall); + projectDisplayName, auditOptions, progressHandle, remoteCall); } finally { if (remoteCall.get()) { progressHandle.close(); @@ -393,55 +399,55 @@ public String findVulnerability(Project project, boolean forceAudit, boolean run } } - private String doFindVulnerability(Project project, String compartmentId, String knowledgeBaseId, String projectDisplayName, - ProgressHandle progressHandle, boolean forceAudit, boolean runIfNoReport, AtomicBoolean remoteCall) throws AuditException { + private String doFindVulnerability(Project project, String compartmentId, String knowledgeBaseId, String projectDisplayName, AuditOptions auditOptions, + ProgressHandle progressHandle, AtomicBoolean remoteCall) throws AuditException { DependencyResult dr = null; List result = new ArrayList(); CacheItem cacheItem = null; VulnerabilityReport savedAudit = null; - if (!forceAudit) { + boolean auditDone = false; + + if (!auditOptions.isForceAuditExecution()) { try { savedAudit = AuditCache.getInstance().loadAudit(knowledgeBaseId); } catch (IOException ex) { LOG.log(Level.WARNING, "Could not load cached audit data", ex); } - } - - boolean auditDone = false; - - if (!forceAudit && savedAudit == null) { - // attempt to find an active most recent audit: - remoteCall.set(true); - progressHandle.start(); - progressHandle.progress(Bundle.MSG_SearchingAuditReport()); - try (ApplicationDependencyManagementClient admClient - = new ApplicationDependencyManagementClient(OCIManager.getDefault().getConfigProvider())) { - ListVulnerabilityAuditsRequest request = ListVulnerabilityAuditsRequest - .builder() - .compartmentId(compartmentId) - .knowledgeBaseId(knowledgeBaseId) - .lifecycleState(LifecycleState.Active) - .sortBy(ListVulnerabilityAuditsRequest.SortBy.TimeCreated) - .sortOrder(SortOrder.Desc).build(); - ListVulnerabilityAuditsResponse response = admClient.listVulnerabilityAudits(request); - if (!response.getVulnerabilityAuditCollection().getItems().isEmpty()) { - VulnerabilityAuditSummary summary = response.getVulnerabilityAuditCollection().getItems().get(0); - progressHandle.progress(Bundle.MSG_AuditCollectDependencies()); - dr = ProjectDependencies.findDependencies(project, ProjectDependencies.newQuery(Scopes.RUNTIME)); - convert(dr.getRoot(), new HashMap<>(), result); - cacheItem = fetchVulnerabilityItems(project, admClient, dr, summary, projectDisplayName); - savedAudit = new VulnerabilityReport(cacheItem.getAudit(), cacheItem.getVulnerabilities()); + + if (savedAudit == null) { + // attempt to find an active most recent audit: + remoteCall.set(true); + progressHandle.start(); + progressHandle.progress(Bundle.MSG_SearchingAuditReport()); + try (ApplicationDependencyManagementClient admClient + = new ApplicationDependencyManagementClient(OCIManager.getDefault().getConfigProvider())) { + ListVulnerabilityAuditsRequest request = ListVulnerabilityAuditsRequest + .builder() + .compartmentId(compartmentId) + .knowledgeBaseId(knowledgeBaseId) + .lifecycleState(LifecycleState.Active) + .sortBy(ListVulnerabilityAuditsRequest.SortBy.TimeCreated) + .sortOrder(SortOrder.Desc).build(); + ListVulnerabilityAuditsResponse response = admClient.listVulnerabilityAudits(request); + if (!response.getVulnerabilityAuditCollection().getItems().isEmpty()) { + VulnerabilityAuditSummary summary = response.getVulnerabilityAuditCollection().getItems().get(0); + progressHandle.progress(Bundle.MSG_AuditCollectDependencies()); + dr = ProjectDependencies.findDependencies(project, ProjectDependencies.newQuery(Scopes.RUNTIME)); + convert(dr.getRoot(), new HashMap<>(), result); + cacheItem = fetchVulnerabilityItems(project, admClient, dr, summary, projectDisplayName); + savedAudit = new VulnerabilityReport(cacheItem.getAudit(), cacheItem.getVulnerabilities()); + } + } catch (BmcException ex) { + LOG.log(Level.FINE, "Unable to list newest audit for knowledgebase {0}, compartment {1}", new Object[] { + knowledgeBaseId, compartmentId + }); } - } catch (BmcException ex) { - LOG.log(Level.FINE, "Unable to list newest audit for knowledgebase {0}, compartment {1}", new Object[] { - knowledgeBaseId, compartmentId - }); } } - if (savedAudit == null && (runIfNoReport || forceAudit)) { + if (savedAudit == null && (auditOptions.isRunIfNotExists() || auditOptions.isForceAuditExecution())) { if (remoteCall.compareAndSet(false, true)) { progressHandle.start(); } @@ -462,7 +468,7 @@ private String doFindVulnerability(Project project, String compartmentId, String .builder() .compartmentId(compartmentId) .knowledgeBaseId(knowledgeBaseId) - .displayName(projectDisplayName.replaceAll("[^A-Za-z0-9-_]", "_")) // remove offending characters + .displayName(auditOptions.getAuditName().replaceAll("[^A-Za-z0-9-_]", "_")) // remove offending characters .buildType(VulnerabilityAudit.BuildType.Maven) .configuration(auditConfiguration) .applicationDependencies(result) From 83325a09e36376fb3d05fc757c673d9701c373b2 Mon Sep 17 00:00:00 2001 From: Svata Dedic Date: Fri, 21 Oct 2022 13:25:35 +0200 Subject: [PATCH 10/33] Cleanup of parameters, optionals passed as options structure. --- .../commands/ProjectAuditCommand.java | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java index 7398d075dfd5..f50739ff5ff2 100644 --- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java +++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java @@ -21,10 +21,6 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; @@ -37,17 +33,14 @@ import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectInformation; import org.netbeans.api.project.ProjectUtils; -import org.netbeans.modules.cloud.oracle.adm.AuditException; +import org.netbeans.modules.cloud.oracle.adm.AuditOptions; import org.netbeans.modules.cloud.oracle.adm.ProjectVulnerability; import org.netbeans.modules.java.lsp.server.protocol.CodeActionsProvider; import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient; import org.netbeans.modules.parsing.api.ResultIterator; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; -import org.openide.awt.StatusDisplayer; import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileUtil; -import org.openide.filesystems.URLMapper; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; @@ -104,22 +97,25 @@ public CompletableFuture processCommand(NbCodeLanguageClient client, Str if (n == null) { n = p.getProjectDirectory().getName(); } + final String fn = n; if (v == null) { throw new IllegalArgumentException("Project " + n + " does not support vulnerability audits"); } - if (arguments.size() < 3) { - throw new IllegalArgumentException("Expected 3 parameters: resource, compartment, knowledgebase"); + if (arguments.size() < 3 || !(arguments.get(1) instanceof JsonPrimitive)) { + throw new IllegalArgumentException("Expected 3 parameters: resource, knowledgebase, options"); } - String compartment = ((JsonPrimitive) arguments.get(2)).getAsString(); + String knowledgeBase = ((JsonPrimitive) arguments.get(1)).getAsString(); - boolean forceAudit; - if (arguments.size() > 4) { - forceAudit = ((JsonPrimitive)arguments.get(4)).getAsBoolean(); - } else { - forceAudit = false; + Object o = arguments.get(2); + if (!(o instanceof JsonObject)) { + throw new IllegalArgumentException("Expected structure, got " + o); } - final String fn = n; - return v.findKnowledgeBase(compartment, knowledgeBase). + JsonObject options = (JsonObject)o; + + boolean forceAudit = options.has("force") && options.get("force").getAsBoolean(); + String preferredName = options.has("auditName") ? options.get("auditName").getAsString() : null; + + return v.findKnowledgeBase(knowledgeBase). exceptionally(th -> { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ERR_KnowledgeBaseSearchFailed(fn, th.getMessage()), NotifyDescriptor.ERROR_MESSAGE)); @@ -132,10 +128,10 @@ public CompletableFuture processCommand(NbCodeLanguageClient client, Str switch (command) { case COMMAND_EXECUTE_AUDIT: - exec = v.runProjectAudit(kb, true, true); + exec = v.runProjectAudit(kb, AuditOptions.makeNewAudit().setAuditName(preferredName)); break; case COMMAND_LOAD_AUDIT: { - exec = v.runProjectAudit(kb, false, forceAudit); + exec = v.runProjectAudit(kb, new AuditOptions().setRunIfNotExists(forceAudit).setAuditName(preferredName)); } default: return CompletableFuture.completedFuture(null); From 26532bf88e3168daf75949f9504fb166925528cd Mon Sep 17 00:00:00 2001 From: Svata Dedic Date: Mon, 24 Oct 2022 19:39:23 +0200 Subject: [PATCH 11/33] #4847: do not use newer classes in older distributions. --- .../gradle/tooling/NbProjectInfoBuilder.java | 20 ++++- .../gradle/GradleBaseProjectInternal.java | 86 +++++++++++++++++++ .../projects/oldgradle/basic/build.gradle | 23 +++++ .../projects/oldgradle/basic/settings.gradle | 21 +++++ .../basic/src/main/java/test/App.java | 19 ++++ .../gradle/api/GradleBaseProjectTest.java | 59 ++++++++++++- 6 files changed, 224 insertions(+), 4 deletions(-) create mode 100644 extide/gradle/src/org/netbeans/modules/gradle/GradleBaseProjectInternal.java create mode 100644 extide/gradle/test/unit/data/projects/oldgradle/basic/build.gradle create mode 100644 extide/gradle/test/unit/data/projects/oldgradle/basic/settings.gradle create mode 100644 extide/gradle/test/unit/data/projects/oldgradle/basic/src/main/java/test/App.java diff --git a/extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java b/extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java index 39fb1180149b..63fd8dbf86b6 100644 --- a/extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java +++ b/extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java @@ -200,9 +200,18 @@ public NbProjectInfo buildAll() { runAndRegisterPerf(model, "dependencies", this::detectDependencies); runAndRegisterPerf(model, "artifacts", this::detectArtifacts); detectDistributions(model); - runAndRegisterPerf(model, "detectExtensions", this::detectExtensions); - runAndRegisterPerf(model, "detectPlugins2", this::detectAdditionalPlugins); - runAndRegisterPerf(model, "taskDependencies", this::detectTaskDependencies); + + // introspection is only allowed for gradle 7.4 and above. + // TODO: investigate if some of the instrospection could be done for earlier Gradles. + sinceGradle("7.0", () -> { + runAndRegisterPerf(model, "detectExtensions", this::detectExtensions); + }); + sinceGradle("7.0", () -> { + runAndRegisterPerf(model, "detectPlugins2", this::detectAdditionalPlugins); + }); + sinceGradle("7.0", () -> { + runAndRegisterPerf(model, "taskDependencies", this::detectTaskDependencies); + }); runAndRegisterPerf(model, "taskProperties", this::detectTaskProperties); runAndRegisterPerf(model, "artifacts", this::detectConfigurationArtifacts); storeGlobalTypes(model); @@ -351,6 +360,10 @@ private void detectConfigurationArtifacts(NbProjectInfoModel model) { model.getInfo().put("configurationArtifacts", data); // NOI18N } + /** + * Relies on PluginManagerInternal.findPluginIdForClass (gradle 7.1) and PluginRegistry.findPluginForClass (gradle 7.0) + * @param model + */ private void detectAdditionalPlugins(NbProjectInfoModel model) { final PluginManagerInternal pmi; PluginRegistry reg; @@ -854,6 +867,7 @@ private void detectProjectMetadata(NbProjectInfoModel model) { model.getInfo().put("project_rootDir", project.getRootDir()); model.getInfo().put("gradle_user_home", project.getGradle().getGradleUserHomeDir()); model.getInfo().put("gradle_home", project.getGradle().getGradleHomeDir()); + model.getInfo().put("gradle_version", project.getGradle().getGradleVersion()); Set visibleConfigurations = configurationsToSave(); model.getInfo().put("configurations", visibleConfigurations.stream().map(conf->conf.getName()).collect(Collectors.toCollection(HashSet::new ))); diff --git a/extide/gradle/src/org/netbeans/modules/gradle/GradleBaseProjectInternal.java b/extide/gradle/src/org/netbeans/modules/gradle/GradleBaseProjectInternal.java new file mode 100644 index 000000000000..ff97e6ddcde2 --- /dev/null +++ b/extide/gradle/src/org/netbeans/modules/gradle/GradleBaseProjectInternal.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.gradle; + +import java.io.File; +import java.util.Collections; +import java.util.Map; +import org.netbeans.modules.gradle.spi.GradleFiles; +import org.netbeans.modules.gradle.spi.ProjectInfoExtractor; +import org.openide.util.lookup.ServiceProvider; + +/** + * Values that could be eventually exposed through GradleBaseProject or other APIs, + * but are currently not, but they are useful for e.g. tests. + * @author sdedic + */ +public class GradleBaseProjectInternal { + /** + * Gradle version for fallback info, or when the version info was not reported (assuming some error). + * The version should be old enough to fail all reasonable later-than checks. + */ + public static final String VERSION_UNKNOWN = "1.0"; // NOI18N + + /** + * Gradle version that actually loaded the project. + */ + private final String gradleVersion; + + /** + * Gradle home directory + */ + private final File gradleHome; + + /** + * Returns version of Gradle that has loaded the project information. Returns + * @return + */ + public String getGradleVersion() { + return gradleVersion; + } + + /** + * Returns the gradle home directory. May return {@code null}. + * @return gradle home directory, or {@code null}. + */ + public File getGradleHome() { + return gradleHome; + } + + GradleBaseProjectInternal(String gradleVersion, File gradleHome) { + this.gradleVersion = gradleVersion; + this.gradleHome = gradleHome; + } + + @ServiceProvider(service = ProjectInfoExtractor.class) + public static class Extractor implements ProjectInfoExtractor { + + @Override + public Result fallback(GradleFiles files) { + return new DefaultResult(new GradleBaseProjectInternal(VERSION_UNKNOWN, null), Collections.emptySet()); + } + + @Override + public Result extract(Map props, Map otherInfo) { + String ver = (String)props.getOrDefault("gradle_version", VERSION_UNKNOWN); + File home = (File)props.get("gradle_home"); + return new DefaultResult(new GradleBaseProjectInternal(ver, home), Collections.emptySet()); + } + } +} diff --git a/extide/gradle/test/unit/data/projects/oldgradle/basic/build.gradle b/extide/gradle/test/unit/data/projects/oldgradle/basic/build.gradle new file mode 100644 index 000000000000..6301ee767764 --- /dev/null +++ b/extide/gradle/test/unit/data/projects/oldgradle/basic/build.gradle @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +apply plugin: 'java' +apply plugin: 'application' + +mainClassName = 'test.App' diff --git a/extide/gradle/test/unit/data/projects/oldgradle/basic/settings.gradle b/extide/gradle/test/unit/data/projects/oldgradle/basic/settings.gradle new file mode 100644 index 000000000000..877a63d3aed3 --- /dev/null +++ b/extide/gradle/test/unit/data/projects/oldgradle/basic/settings.gradle @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +rootProject.name="simple" + diff --git a/extide/gradle/test/unit/data/projects/oldgradle/basic/src/main/java/test/App.java b/extide/gradle/test/unit/data/projects/oldgradle/basic/src/main/java/test/App.java new file mode 100644 index 000000000000..917e9b088408 --- /dev/null +++ b/extide/gradle/test/unit/data/projects/oldgradle/basic/src/main/java/test/App.java @@ -0,0 +1,19 @@ +package test; + +import java.util.Collections; + +public class App { + private static final String PREFIX = "org.netbeans.gradle.javaexec.test."; + public static void main(String[] args) { + for (int i = 0; i < args.length; i++) { + System.err.println("args." + i + "=" + args[i]); + } + String[] props = Collections.list(System.getProperties().propertyNames()).stream(). + filter(n -> n.toString().startsWith(PREFIX)). + map(Object::toString).sorted().toArray(i -> new String[i]); + + for (int i = 0; i < props.length; i++) { + System.err.println("prop." + i + "=" + props[i].substring(PREFIX.length()) + "=" + System.getProperty(props[i])); + } + } +} diff --git a/extide/gradle/test/unit/src/org/netbeans/modules/gradle/api/GradleBaseProjectTest.java b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/api/GradleBaseProjectTest.java index 82aca6aa886f..2fe874a4b11d 100644 --- a/extide/gradle/test/unit/src/org/netbeans/modules/gradle/api/GradleBaseProjectTest.java +++ b/extide/gradle/test/unit/src/org/netbeans/modules/gradle/api/GradleBaseProjectTest.java @@ -20,13 +20,17 @@ import java.io.File; import java.util.List; -import java.util.Optional; import static junit.framework.TestCase.assertNotNull; +import org.gradle.tooling.GradleConnector; +import org.gradle.tooling.ProjectConnection; import org.netbeans.api.project.Project; import org.netbeans.api.project.ProjectManager; import org.netbeans.api.project.ui.OpenProjects; import org.netbeans.modules.gradle.AbstractGradleProjectTestCase; +import org.netbeans.modules.gradle.GradleBaseProjectInternal; import org.netbeans.modules.gradle.ProjectTrust; +import org.netbeans.modules.gradle.api.execute.GradleDistributionManager; +import org.netbeans.modules.gradle.api.execute.GradleDistributionManager.GradleDistribution; import org.netbeans.modules.gradle.options.GradleExperimentalSettings; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; @@ -205,4 +209,57 @@ public void testExternalDependnecies() throws Exception { assertEquals(":p1:jar", external.getPath()); assertEquals(":p1", external.getProjectPath()); } + + private void assertProjectLoadedWithNoProblems(Project p, String expectedVersion) { + GradleBaseProject gbp = GradleBaseProject.get(p); + assertNotNull(gbp); + assertTrue(NbGradleProject.get(p).getQuality().atLeast(NbGradleProject.Quality.FULL)); + assertEquals(0, gbp.getProblems().size()); + GradleBaseProjectInternal baseInternal = NbGradleProject.get(p).projectLookup(GradleBaseProjectInternal.class); + assertNotNull(baseInternal); + assertEquals(expectedVersion, baseInternal.getGradleVersion()); + } + + private Project makeProjectWithWrapper(String subdir, String gradleVersion) throws Exception { + FileObject src = FileUtil.toFileObject(getDataDir()).getFileObject(subdir); + projectDir = FileUtil.copyFile(src, FileUtil.toFileObject(getWorkDir()), src.getNameExt()); + + GradleDistribution dist = GradleDistributionManager.get().defaultDistribution(); + GradleConnector gconn = GradleConnector.newConnector(); + gconn = gconn.useGradleUserHomeDir(dist.getGradleUserHome()); + if (dist.isAvailable()) { + gconn = gconn.useInstallation(dist.getDistributionDir()); + } else { + gconn = gconn.useDistribution(dist.getDistributionURI()); + } + try (ProjectConnection c = gconn.forProjectDirectory(FileUtil.toFile(projectDir)).connect()) { + c.newBuild().forTasks("wrapper").addArguments("wrapper", "--gradle-version", gradleVersion).run(); + } + + Project p = ProjectManager.getDefault().findProject(projectDir); + assertNotNull(p); + ProjectTrust.getDefault().trustProject(p); + + OpenProjects.getDefault().open(new Project[] { p }, true); + OpenProjects.getDefault().openProjects().get(); + + NbGradleProject.get(p).toQuality("Load data", NbGradleProject.Quality.FULL, false).toCompletableFuture().get(); + return p; + } + + public void testOldGradle683ProjectLoads() throws Exception { + Project p = makeProjectWithWrapper("projects/oldgradle/basic", "6.8.3"); + assertProjectLoadedWithNoProblems(p, "6.8.3"); + } + + public void testOldGradle700ProjectLoads() throws Exception { + Project p = makeProjectWithWrapper("projects/oldgradle/basic", "7.0"); + assertProjectLoadedWithNoProblems(p, "7.0"); + } + + public void testOldGradle710ProjectLoads() throws Exception { + Project p = makeProjectWithWrapper("projects/oldgradle/basic", "7.1"); + assertProjectLoadedWithNoProblems(p, "7.1"); + } } + From c0d4090c0c3ffefef14e61307930fc8961758878 Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Tue, 25 Oct 2022 12:53:24 +0100 Subject: [PATCH 12/33] Never mark overriding methods as unused, fixes GH4276. --- .../modules/java/editor/base/semantic/UnusedDetector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java index f2c8ca0686f1..d5a7cadce40c 100644 --- a/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java +++ b/java/java.editor.base/src/org/netbeans/modules/java/editor/base/semantic/UnusedDetector.java @@ -141,7 +141,8 @@ public static List findUnused(CompilationInfo info, Callable< } } } else if ((el.getKind() == ElementKind.CONSTRUCTOR || el.getKind() == ElementKind.METHOD) && (isPrivate || isPkgPrivate)) { - if (!isSerializationMethod(info, (ExecutableElement)el) && !uses.contains(UseTypes.USED)) { + if (!isSerializationMethod(info, (ExecutableElement)el) && !uses.contains(UseTypes.USED) + && !info.getElementUtilities().overridesMethod((ExecutableElement)el)) { if (isPrivate || isUnusedInPkg(info, el, cancel)) { result.add(new UnusedDescription(el, declaration, UnusedReason.NOT_USED)); } From 6e74d227fe8114dba2907b1cf5d86385015c3c11 Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Wed, 26 Oct 2022 15:16:30 +0100 Subject: [PATCH 13/33] Move to phase RESOLVED before accessing elements in MoveMemberPanel and MoveClassPanel - fix GH4708. --- .../org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java | 1 + .../netbeans/modules/refactoring/java/ui/MoveMembersPanel.java | 1 + 2 files changed, 2 insertions(+) diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java index 445166885970..69559598a932 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveClassPanel.java @@ -515,6 +515,7 @@ public void cancel() { @Override public void run(CompilationController parameter) throws Exception { + parameter.toPhase(JavaSource.Phase.RESOLVED); for (ElementHandle elementHandle : result) { TypeElement element = elementHandle.resolve(parameter); if (element != null) { diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveMembersPanel.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveMembersPanel.java index b0055a949320..e7ad8e453a47 100644 --- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveMembersPanel.java +++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/MoveMembersPanel.java @@ -312,6 +312,7 @@ public void cancel() { @Override public void run(CompilationController parameter) throws Exception { + parameter.toPhase(JavaSource.Phase.RESOLVED); for (ElementHandle elementHandle : result) { TypeElement element = elementHandle.resolve(parameter); if (element != null) { From 8c82a4cb7995c1c9881410bc6533aeb26b9c3bff Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Thu, 27 Oct 2022 19:20:42 +0200 Subject: [PATCH 14/33] wrap unreliable micronaut tests in retry script. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3c1737efae4..7342b8b9184e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1651,8 +1651,8 @@ jobs: - name: Extract run: tar --zstd -xf build.tar.zst - - name: micronaut - run: ant $OPTS -f enterprise/micronaut test + - name: enterprise/micronaut + run: .github/retry.sh ant $OPTS -f enterprise/micronaut test - name: spring.webmvc run: ant $OPTS -f enterprise/spring.webmvc test From e9b8b8e55fb9a1f55bbaaa640d07bfed266f7160 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 28 Oct 2022 04:17:48 +0200 Subject: [PATCH 15/33] about panel needs a vertical scrollbar if the async plugin update notification appears. we can't add it right away, otherwise the window can't layout itself. --- .../src/org/netbeans/core/ui/ProductInformationPanel.form | 2 -- .../src/org/netbeans/core/ui/ProductInformationPanel.java | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.form b/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.form index 0bef3f729a18..94d89c57e9ad 100644 --- a/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.form +++ b/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.form @@ -141,8 +141,6 @@ - - diff --git a/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java b/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java index 78097f741b51..a6d3b7f1f814 100644 --- a/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java +++ b/platform/o.n.core/src/org/netbeans/core/ui/ProductInformationPanel.java @@ -36,6 +36,7 @@ import javax.swing.Icon; import javax.swing.JEditorPane; import javax.swing.JPanel; +import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.event.HyperlinkEvent; @@ -102,6 +103,7 @@ public ProductInformationPanel() { final String updates = getUpdates(); SwingUtilities.invokeLater(() -> { description.setText(LBL_description(getProductVersionValue(), getJavaValue(), getVMValue(), getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), Places.getCacheDirectory().getAbsolutePath(), updates, FONT_SIZE, getJavaRuntime())); + descriptionScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); // will need a scrollbar now description.setCursor(null); description.revalidate(); description.setCaretPosition(0); @@ -156,7 +158,7 @@ private void initComponents() { javax.swing.JButton closeButton = new javax.swing.JButton(); javax.swing.JScrollPane copyrightScrollPane = new javax.swing.JScrollPane(); copyright = new javax.swing.JTextPane(); - javax.swing.JScrollPane descriptionScrollPane = new javax.swing.JScrollPane(); + descriptionScrollPane = new javax.swing.JScrollPane(); description = new javax.swing.JTextPane(); javax.swing.JPanel imagePanel = new javax.swing.JPanel(); imageLabel = new javax.swing.JLabel(); @@ -242,6 +244,7 @@ private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextPane copyright; private javax.swing.JTextPane description; + private javax.swing.JScrollPane descriptionScrollPane; private javax.swing.JLabel imageLabel; // End of variables declaration//GEN-END:variables From 9427c02af24fe0b64bf48e3de0a4253764002c0f Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Fri, 28 Oct 2022 17:28:52 -0700 Subject: [PATCH 16/33] Fixed end of file indenting and code completion for ANTLR v4 --- .../languages/antlr/AntlrTokenSequence.java | 2 +- .../antlr/v4/Antlr4CompletionProvider.java | 218 ++++++++++++------ .../languages/antlr/v4/Antlr4Formatter.java | 5 + .../antlr/v4/Antlr4ParserResult.java | 5 +- 4 files changed, 152 insertions(+), 78 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrTokenSequence.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrTokenSequence.java index 785f1ea6ff09..60db9b31f377 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrTokenSequence.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AntlrTokenSequence.java @@ -85,7 +85,7 @@ public void seekTo(int offset) { } } else { - previous((t) -> t.getStartIndex() > offset); + previous((t) -> t.getStartIndex() < offset); } } diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java index 66e31866c201..85fecab22e1e 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4CompletionProvider.java @@ -51,6 +51,7 @@ import static org.antlr.parser.antlr4.ANTLRv4Lexer.*; import org.netbeans.modules.languages.antlr.AntlrParserResult.ReferenceType; import static org.netbeans.modules.languages.antlr.AntlrTokenSequence.DEFAULT_CHANNEL; +import org.openide.util.NbBundle; /** * @@ -113,6 +114,20 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse if (!tokens.isEmpty()) { + boolean inRule = false; + + while (tokens.hasNext() && (tokens.getOffset() < caretOffset)) { + Optional next = tokens.next(); + switch (next.get().getType()) { + case COLON: + inRule = true; + break; + case SEMI: + inRule = false; + break; + } + } + tokens.seekTo(caretOffset); // Check if we are in a comment (that is filtered out from the token stream) @@ -133,10 +148,11 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse return; } tokens.previous(); - lookAround(result, tokens, caretOffset, prefix, resultSet); - } else { - //Empty grammar so far offer lexer, parser and grammar - addTokens("", caretOffset, resultSet, "lexer", "parser", "grammar"); + if (inRule) { + lookInRule(result, tokens, caretOffset, prefix, resultSet); + } else { + lookNonRule(result, tokens, caretOffset, prefix, resultSet); + } } } } finally { @@ -144,18 +160,86 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse } } - private void lookAround(Antlr4ParserResult result, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { - AntlrParserResult.GrammarType grammarType = result != null ? result.getGrammarType(): AntlrParserResult.GrammarType.UNKNOWN; + private void lookInRule(Antlr4ParserResult result, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { + AntlrParserResult.GrammarType grammarType = result != null ? result.getGrammarType() : AntlrParserResult.GrammarType.UNKNOWN; + Optional opt = tokens.previous(DEFAULT_CHANNEL); + Token pt = opt.get(); + if (((pt.getType() == RULE_REF) || (pt.getType() == TOKEN_REF)) && (caretOffset == pt.getStopIndex() + 1)) { + // Could be start of some keywords + prefix = pt.getText(); + opt = tokens.previous(DEFAULT_CHANNEL); + } + pt = opt.get(); + // check our previous token + switch (pt.getType()) { + case RARROW: + //Command: offer 'channel', 'skip', etc... + addTokens(prefix, caretOffset, resultSet, "skip", "more", "type", "channel", "mode", "pushMode", "popMode"); + return; + case LPAREN: + Optional lexerCommand = tokens.previous(DEFAULT_CHANNEL); + // We are not necessary in a lexerCommand here, just taking chances + if (lexerCommand.isPresent()) { + switch (lexerCommand.get().getText()) { + case "channel": + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.CHANNEL)); + return; + case "mode": + case "pushMode": + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.MODE)); + return; + case "type": + addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.TOKEN)); + return; + } + } + // the fall through is intentional, as of betting on lexerCommand did not come through + default: + + EnumSet rtypes = EnumSet.noneOf(ReferenceType.class); + + //Seek to the rule definition we are in + tokens.seekTo(caretOffset); + tokens.previous(COLON); + + // check the rule definition type: lexer/parser + Optional ref = tokens.previous(DEFAULT_CHANNEL); + if (ref.isPresent() && (ref.get().getType() == RULE_REF || ref.get().getType() == TOKEN_REF)) { + if (ref.get().getType() == TOKEN_REF) { + rtypes.add(ReferenceType.FRAGMENT); + } else { + rtypes.add(ReferenceType.TOKEN); + rtypes.add(ReferenceType.RULE); + if (grammarType == AntlrParserResult.GrammarType.MIXED) { + rtypes.add(ReferenceType.FRAGMENT); + } + } + } else { + // A bit odd definition, let's rely on the grammarType + if ((grammarType == AntlrParserResult.GrammarType.LEXER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { + rtypes.add(ReferenceType.FRAGMENT); + } + if ((grammarType == AntlrParserResult.GrammarType.PARSER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { + rtypes.add(ReferenceType.TOKEN); + rtypes.add(ReferenceType.RULE); + } + } + addReferences(result, prefix, caretOffset, resultSet, rtypes); + } + } + + private void lookNonRule(Antlr4ParserResult result, AntlrTokenSequence tokens, int caretOffset, String prefix, CompletionResultSet resultSet) { + AntlrParserResult.GrammarType grammarType = result != null ? result.getGrammarType() : AntlrParserResult.GrammarType.UNKNOWN; Optional opt = tokens.previous(DEFAULT_CHANNEL); if (!opt.isPresent()) { //At the start of the file; Optional t = tokens.next(DEFAULT_CHANNEL); if (t.isPresent() && t.get().getType() != LEXER) { addTokens(prefix, caretOffset, resultSet, "lexer"); - } + } if (t.isPresent() && t.get().getType() != PARSER) { addTokens(prefix, caretOffset, resultSet, "parser"); - } + } if (t.isPresent() && (t.get().getType() != LEXER) && (t.get().getType() != GRAMMAR)) { addTokens(prefix, caretOffset, resultSet, "grammar"); } @@ -182,67 +266,14 @@ private void lookAround(Antlr4ParserResult result, AntlrTokenSequence tokens, in } return; + case FRAGMENT: case SEMI: //Could be the begining of a new rule def. - addTokens(prefix, caretOffset, resultSet, "mode", "fragment"); - return; - case RARROW: - //Command: offer 'channel', 'skip', etc... - addTokens(prefix, caretOffset, resultSet, "skip", "more", "type", "channel", "mode", "pushMode", "popMode"); - return; - case LPAREN: - Optional lexerCommand = tokens.previous(DEFAULT_CHANNEL); - // We are not necessary in a lexerCommand here, just taking chances - if (lexerCommand.isPresent()) { - switch (lexerCommand.get().getText()) { - case "channel": - addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.CHANNEL)); - return; - case "mode": - case "pushMode": - addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.MODE)); - return; - case "type": - addReferences(result, prefix, caretOffset, resultSet, EnumSet.of(ReferenceType.TOKEN)); - return; - } + if (grammarType != AntlrParserResult.GrammarType.PARSER) { + addTokens(prefix, caretOffset, resultSet, "mode", "fragment"); } - // the fall through is intentional, as of betting on lexerCommand did not come through - default: - tokens.seekTo(caretOffset); - Optional semi = tokens.previous(SEMI); - tokens.seekTo(caretOffset); - Optional colon = tokens.previous(COLON); - if (semi.isPresent() && colon.isPresent() - && semi.get().getStartIndex() < colon.get().getStartIndex()) { - - EnumSet rtypes = EnumSet.noneOf(ReferenceType.class); - - // we are in lexer/parser ruledef - Optional ref = tokens.previous(DEFAULT_CHANNEL); - if (ref.isPresent() && (ref.get().getType() == RULE_REF || ref.get().getType() == TOKEN_REF)) { - if (ref.get().getType() == TOKEN_REF) { - rtypes.add(ReferenceType.FRAGMENT); - } else { - rtypes.add(ReferenceType.TOKEN); - rtypes.add(ReferenceType.RULE); - if (grammarType == AntlrParserResult.GrammarType.MIXED) { - rtypes.add(ReferenceType.FRAGMENT); - } - } - } else { - // A bit odd definition, let's rely on the grammarType - if ((grammarType == AntlrParserResult.GrammarType.LEXER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { - rtypes.add(ReferenceType.FRAGMENT); - } - if ((grammarType == AntlrParserResult.GrammarType.PARSER) || (grammarType == AntlrParserResult.GrammarType.MIXED)) { - rtypes.add(ReferenceType.TOKEN); - rtypes.add(ReferenceType.RULE); - } - } - addReferences(result, prefix, caretOffset, resultSet, rtypes); - } - + addUnknownReferences(result, prefix, caretOffset, resultSet); + return; } } @@ -265,12 +296,46 @@ public void addTokens(String prefix, int caretOffset, CompletionResultSet result } } - public void addReferences(Antlr4ParserResult result, String prefix, int caretOffset, CompletionResultSet resultSet, Set rtypes) { - - Map matching = new HashMap<>(); + @NbBundle.Messages("newRule=new") + public void addUnknownReferences(Antlr4ParserResult result, String prefix, int caretOffset, CompletionResultSet resultSet) { + int startOffset = caretOffset - prefix.length(); + String mprefix = caseSensitive ? prefix : prefix.toUpperCase(); + for (String unknownReference : result.unknownReferences) { + String mref = caseSensitive ? unknownReference : unknownReference.toUpperCase(); + if (mref.startsWith(mprefix)) { + boolean ruleRef = Character.isLowerCase(unknownReference.codePointAt(0)); + CompletionItem item = null; + if (ruleRef && ((result.getGrammarType() == AntlrParserResult.GrammarType.PARSER) || (result.getGrammarType() == AntlrParserResult.GrammarType.MIXED))) { + item = CompletionUtilities.newCompletionItemBuilder(unknownReference) + .iconResource(getReferenceIcon(ReferenceType.RULE)) + .startOffset(startOffset) + .leftHtmlText(unknownReference) + .rightHtmlText(Bundle.newRule()) + .sortText(mref) + .build(); + } + if (!ruleRef && ((result.getGrammarType() == AntlrParserResult.GrammarType.LEXER) || (result.getGrammarType() == AntlrParserResult.GrammarType.MIXED))) { + item = CompletionUtilities.newCompletionItemBuilder(unknownReference) + .iconResource(getReferenceIcon(ReferenceType.TOKEN)) + .startOffset(startOffset) + .leftHtmlText(unknownReference) + .rightHtmlText(Bundle.newRule()) + .sortText(mref) + .build(); + } + if (item != null) { + resultSet.addItem(item); + } + } + } + } + + private void addReferences(Antlr4ParserResult result, String prefix, int caretOffset, CompletionResultSet resultSet, Set rtypes) { + + Map matching = new HashMap<>(); String mprefix = caseSensitive ? prefix : prefix.toUpperCase(); - - result.allImports().values().forEach((r) ->{ + + result.allImports().values().forEach((r) -> { Map refs = r.references; for (AntlrParserResult.Reference ref : refs.values()) { String mref = caseSensitive ? ref.name : ref.name.toUpperCase(); @@ -280,7 +345,7 @@ public void addReferences(Antlr4ParserResult result, String prefix, int caretOff } } }); - + int startOffset = caretOffset - prefix.length(); for (AntlrParserResult.Reference ref : matching.values()) { CompletionItem item = CompletionUtilities.newCompletionItemBuilder(ref.name) @@ -291,19 +356,20 @@ public void addReferences(Antlr4ParserResult result, String prefix, int caretOff .build(); resultSet.addItem(item); - } + } } } - + //The folowing is an excrept of org.netbeans.modules.csl.navigation.Icons - private static final String ICON_BASE = "org/netbeans/modules/csl/source/resources/icons/"; + private static final String ICON_BASE = "org/netbeans/modules/csl/source/resources/icons/"; + private static String getReferenceIcon(ReferenceType rtype) { switch (rtype) { case CHANNEL: return ICON_BASE + "database.gif"; case FRAGMENT: return ICON_BASE + "constantPublic.png"; - case MODE: + case MODE: return ICON_BASE + "class.png"; case RULE: return ICON_BASE + "rule.png"; diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Formatter.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Formatter.java index afc7d0e63eaa..ee57d609b461 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Formatter.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Formatter.java @@ -119,6 +119,11 @@ public void reformat(Context context, ParserResult compilationInfo) { tstart = token.getStartIndex(); tstop = token.getStopIndex(); } + + if ((cstart == cend) && (cstart == doc.getLength())) { + // Pressed enter at the end of the file + context.modifyIndent(cstart, inRule ? indentSize : 0); + } } catch (BadLocationException ex) {} } diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java index 40e20d3da2d6..ace5b430e84d 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4ParserResult.java @@ -56,8 +56,10 @@ public final class Antlr4ParserResult extends AntlrParserResult { private final List imports = new ArrayList<>(); private static final Logger LOG = Logger.getLogger(Antlr4ParserResult.class.getName()); + public static final Reference HIDDEN = new Reference(ReferenceType.CHANNEL, "HIDDEN", OffsetRange.NONE); - + final Set unknownReferences = new HashSet<>(); + public Antlr4ParserResult(Snapshot snapshot) { super(snapshot); references.put(HIDDEN.name, HIDDEN); @@ -86,6 +88,7 @@ private void checkReferences() { } occurrences.forEach((refName, offsets) -> { if (!allRefs.containsKey(refName)) { + unknownReferences.add(refName); for (OffsetRange offset : offsets) { errors.add(new DefaultError(null, "Unknown Reference: " + refName, null, getFileObject(), offset.getStart(), offset.getEnd(), Severity.ERROR)); } From ce31d6244c9abf663f99aaf3472f61348ab7be9f Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Fri, 28 Oct 2022 19:30:58 -0700 Subject: [PATCH 17/33] Added currentRuleType to ANTLR lexer state --- .../languages/antlr/AbstractAntlrLexer.java | 17 +++++-------- .../languages/antlr/v3/Antlr3Lexer.java | 25 +++++++++++++++++-- .../languages/antlr/v4/Antlr4Lexer.java | 25 +++++++++++++++++-- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AbstractAntlrLexer.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AbstractAntlrLexer.java index eec144e39db0..9f76582b2e3c 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AbstractAntlrLexer.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/AbstractAntlrLexer.java @@ -29,13 +29,13 @@ * * @author lkishalmi */ -public abstract class AbstractAntlrLexer implements Lexer { +public abstract class AbstractAntlrLexer implements Lexer { private final TokenFactory tokenFactory; - protected final org.antlr.v4.runtime.Lexer lexer; + protected final T lexer; private final LexerInputCharStream input; - public AbstractAntlrLexer(LexerRestartInfo info, org.antlr.v4.runtime.Lexer lexer) { + public AbstractAntlrLexer(LexerRestartInfo info, T lexer) { this.tokenFactory = info.tokenFactory(); this.lexer = lexer; this.input = (LexerInputCharStream) lexer.getInputStream(); @@ -46,11 +46,6 @@ public AbstractAntlrLexer(LexerRestartInfo info, org.antlr.v4.runt } - @Override - public Object state() { - return new LexerState(lexer); - } - @Override public void release() { } @@ -60,19 +55,19 @@ protected final Token token(AntlrTokenId id) { return tokenFactory.createToken(id); } - private static class LexerState { + public static class LexerState { final int state; final int mode; final IntegerList modes; - LexerState(org.antlr.v4.runtime.Lexer lexer) { + public LexerState(T lexer) { this.state= lexer.getState(); this.mode = lexer._mode; this.modes = new IntegerList(lexer._modeStack); } - public void restore(org.antlr.v4.runtime.Lexer lexer) { + public void restore(T lexer) { lexer.setState(state); lexer._modeStack.addAll(modes); lexer._mode = mode; diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3Lexer.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3Lexer.java index baded59e653a..34f43875db1b 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3Lexer.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v3/Antlr3Lexer.java @@ -18,6 +18,7 @@ */ package org.netbeans.modules.languages.antlr.v3; +import org.antlr.parser.antlr3.ANTLRv3Lexer; import org.netbeans.api.lexer.Token; import org.netbeans.spi.lexer.LexerRestartInfo; @@ -31,11 +32,11 @@ * * @author lkishalmi */ -public final class Antlr3Lexer extends AbstractAntlrLexer { +public final class Antlr3Lexer extends AbstractAntlrLexer { public Antlr3Lexer(LexerRestartInfo info) { - super(info, new org.antlr.parser.antlr3.ANTLRv3Lexer(new LexerInputCharStream(info.input()))); + super(info, new ANTLRv3Lexer(new LexerInputCharStream(info.input()))); } private org.antlr.v4.runtime.Token preFetchedToken = null; @@ -141,4 +142,24 @@ public Token nextToken() { } } + @Override + public Object state() { + return new State(lexer); + } + + public static class State extends AbstractAntlrLexer.LexerState { + final int currentRuleType; + + public State(ANTLRv3Lexer lexer) { + super(lexer); + this.currentRuleType = lexer.getCurrentRuleType(); + } + + @Override + public void restore(ANTLRv3Lexer lexer) { + super.restore(lexer); + lexer.setCurrentRuleType(currentRuleType); + } + + } } diff --git a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Lexer.java b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Lexer.java index 2c54130826b2..79efbc5cf5e2 100644 --- a/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Lexer.java +++ b/java/languages.antlr/src/org/netbeans/modules/languages/antlr/v4/Antlr4Lexer.java @@ -18,6 +18,7 @@ */ package org.netbeans.modules.languages.antlr.v4; +import org.antlr.parser.antlr4.ANTLRv4Lexer; import org.netbeans.api.lexer.Token; import org.netbeans.spi.lexer.LexerRestartInfo; @@ -31,11 +32,11 @@ * * @author lkishalmi */ -public final class Antlr4Lexer extends AbstractAntlrLexer { +public final class Antlr4Lexer extends AbstractAntlrLexer { public Antlr4Lexer(LexerRestartInfo info) { - super(info, new org.antlr.parser.antlr4.ANTLRv4Lexer(new LexerInputCharStream(info.input()))); + super(info, new ANTLRv4Lexer(new LexerInputCharStream(info.input()))); } private org.antlr.v4.runtime.Token preFetchedToken = null; @@ -136,4 +137,24 @@ public Token nextToken() { } } + @Override + public Object state() { + return new State(lexer); + } + + public static class State extends AbstractAntlrLexer.LexerState { + final int currentRuleType; + + public State(ANTLRv4Lexer lexer) { + super(lexer); + this.currentRuleType = lexer.getCurrentRuleType(); + } + + @Override + public void restore(ANTLRv4Lexer lexer) { + super.restore(lexer); + lexer.setCurrentRuleType(currentRuleType); + } + + } } From e5cf06f9ee780221283a822d898499cb255dc59b Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 29 Oct 2022 04:40:24 +0200 Subject: [PATCH 18/33] run cache action *after* checkout, otherwise we can't hash the binaries-lists. --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3c1737efae4..eacf03e1b55c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,6 +77,12 @@ jobs: with: java-version: ${{ matrix.java }} distribution: 'zulu' + + - name: Checkout ${{ github.ref }} ( ${{ github.sha }} ) + uses: actions/checkout@v3 + with: + persist-credentials: false + submodules: false - name: Caching dependencies uses: actions/cache@v3 @@ -84,12 +90,6 @@ jobs: path: ~/.hgexternalcache key: ${{ runner.os }}-${{ hashFiles('*/external/binaries-list', '*/*/external/binaries-list') }} restore-keys: ${{ runner.os }}- - - - name: Checkout ${{ github.ref }} ( ${{ github.sha }} ) - uses: actions/checkout@v3 - with: - persist-credentials: false - submodules: false - name: Build NetBeans run: ant -quiet -Dcluster.config=release build-nozip From 4bc583fc5b47cba72d831174667116a0790dc40f Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 31 Oct 2022 00:26:56 +0100 Subject: [PATCH 19/33] hide template link as last resort if it appears to be broken. --- .../netbeans/modules/project/ui/resources/license-default.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ide/projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt b/ide/projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt index 487df23f963c..8c54046ee99e 100644 --- a/ide/projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt +++ b/ide/projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt @@ -1,4 +1,6 @@ ${licenseFirst!""} ${licensePrefix}Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +<#if !.data_model["org.openide.filesystems.FileObject"].getPath()?contains("{") > ${licensePrefix}Click nbfs://nbhost/SystemFileSystem/${.data_model["org.openide.filesystems.FileObject"].getPath()} to edit this template + ${licenseLast!""} From 105a178f3c76bc473c96ca8ab9b291295b428141 Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Mon, 31 Oct 2022 22:21:56 -0700 Subject: [PATCH 20/33] Switched gradle.dist and gradle.editor module to regilar. Fixes #4866 --- extide/gradle.dists/nbproject/project.properties | 1 - extide/gradle.editor/nbproject/project.properties | 1 - java/gradle.kit/nbproject/project.xml | 12 ++++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extide/gradle.dists/nbproject/project.properties b/extide/gradle.dists/nbproject/project.properties index 0c0bc2444458..a3c15310927d 100644 --- a/extide/gradle.dists/nbproject/project.properties +++ b/extide/gradle.dists/nbproject/project.properties @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. -is.eager=true javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/extide/gradle.editor/nbproject/project.properties b/extide/gradle.editor/nbproject/project.properties index 0c0bc2444458..a3c15310927d 100644 --- a/extide/gradle.editor/nbproject/project.properties +++ b/extide/gradle.editor/nbproject/project.properties @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. -is.eager=true javac.source=1.8 javac.compilerargs=-Xlint -Xlint:-serial diff --git a/java/gradle.kit/nbproject/project.xml b/java/gradle.kit/nbproject/project.xml index c44a60813259..889a963562dd 100644 --- a/java/gradle.kit/nbproject/project.xml +++ b/java/gradle.kit/nbproject/project.xml @@ -38,6 +38,18 @@ 2.3 + + org.netbeans.modules.gradle.dists + + 1.6 + + + + org.netbeans.modules.gradle.editor + + 1.0 + + org.netbeans.modules.gradle.java From 9d7cf0232afd6271db7f03e83228e709194fd8d7 Mon Sep 17 00:00:00 2001 From: Tim Boudreau Date: Sat, 10 Sep 2022 05:04:51 -0400 Subject: [PATCH 21/33] Fix intermittent availability of generated classes to resolve against The previous code calls WeakListeners.propertyChange() with a lambda. It will be garbage collected instantaneously and never fire changes. --- .../classpath/ClassPathProviderImpl.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java index c6a7db415a8d..48c3a4707ecb 100644 --- a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java +++ b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java @@ -712,7 +712,8 @@ protected boolean isReset(PropertyChangeEvent evt) { * This selector chooses the annotation classpath, if it is not empty (has items, or is broken), or the regular * compile classpath if annotation path is empty. The selector reacts */ - private static class AnnotationPathSelector extends ClassPathSelector { + private static class AnnotationPathSelector extends ClassPathSelector + implements PropertyChangeListener { private final ClassPath annotationCP; private final Supplier compileClassPath; @@ -721,18 +722,14 @@ public AnnotationPathSelector(NbMavenProjectImpl proj, ClassPath anno, Supplier< this.annotationCP = anno; this.compileClassPath = compile; - anno.addPropertyChangeListener(WeakListeners.propertyChange( - e -> { - active = null; - support.firePropertyChange(PROP_ACTIVE_CLASS_PATH, null, null); - }, ClassPath.PROP_ROOTS, anno - )); -// proj.getProjectWatcher().addPropertyChangeListener((e) -> { -// if (NbMavenProject.PROP_PROJECT.equals(e.getPropertyName())) { -// active = null; -// support.firePropertyChange(PROP_ACTIVE_CLASS_PATH, null, null); -// } -// }); + anno.addPropertyChangeListener(WeakListeners.propertyChange(this, anno)); + proj.getProjectWatcher().addPropertyChangeListener(WeakListeners.propertyChange(this, anno)); + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + active = null; + support.firePropertyChange(PROP_ACTIVE_CLASS_PATH, null, null); } @Override From 7bfe9cc2042b37a850e587fe9b04d15fd4da0cdb Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 2 Nov 2022 06:19:57 +0100 Subject: [PATCH 22/33] Fixing java.editor tests (and behavior, where needed), adding the tests into GH actions. --- .github/workflows/main.yml | 4 ++ .../editor/javadoc/JavadocCompletionTask.java | 68 +++++++++++++------ ...nippet_HighlightAndReplace_cornercase.pass | 20 +----- .../javadocsnippet_LinkTag.pass | 23 +------ ...nippet_LinkTag_AlongWith_HighlightTag.pass | 22 +----- ...csnippet_LinkTag_AlongWith_ReplaceTag.pass | 22 +----- ...kTag_AlongWith_SubStringAndReplaceTag.pass | 24 +------ ...adocsnippet_LinkTag_AppliesToNextLine.pass | 24 +------ ...snippet_LinkTag_EmptyReplacementValue.pass | 26 ++----- ...inkTag_FieldRef_ToThisClass_UsingHash.pass | 22 +----- ...pet_LinkTag_Ref_ToThisClass_UsingHash.pass | 22 +----- ...ocsnippet_LinkTag_With_RegexAndRegion.pass | 27 ++------ ...csnippet_LinkTag_With_RegionAttribute.pass | 29 ++------ ...ocsnippet_Link_MultipleTag_OnSameLine.pass | 23 +------ ...et_NestedRegion_Highlight_And_replace.pass | 18 ----- ..._NestedRegion_ReplaceAnnotation_Regex.pass | 18 ----- ...tedRegion_ReplaceAnnotation_Substring.pass | 18 ----- ...nippet_Region_ReplaceAnnotation_Regex.pass | 18 ----- ...ion_ReplaceAnnotation_RegexInnComment.pass | 18 ----- ...eLine_MultipleReplaceAnnotation_Regex.pass | 18 ----- ...e_MultipleReplaceAnnotation_Substring.pass | 18 ----- ...e_ReplaceAnnotation_Regex_DoubleQuote.pass | 18 ----- ...vadocsnippet_SingleLine_Replace_Regex.pass | 18 ----- ...ocsnippet_SingleLine_Replace_RegexDot.pass | 18 ----- ...ippet_SingleLine_Replace_RegexDotStar.pass | 18 ----- ...csnippet_SingleLine_Replace_Substring.pass | 18 ----- ...javadocsnippet_TestError_HighlightTag.pass | 18 ----- .../javadocsnippet_TestError_LinkTag.pass | 24 +------ ...avadocsnippet_TestError_NoRegionToEnd.pass | 18 ----- .../javadocsnippet_TestError_ReplaceTag.pass | 18 ----- ...vadocsnippet_TestError_UnpairedRegion.pass | 18 ----- .../javadocsnippet_external_file.pass | 18 ----- .../javadocsnippet_file_empty.pass | 18 ----- .../javadocsnippet_file_invalid.pass | 18 ----- .../javadocsnippet_highlightRecord.pass | 18 ----- ...ghlightTagRegexWithAllCharacterChange.pass | 18 ----- ...agRegexWithAllCharacterChangeUsingDot.pass | 18 ----- ..._highlightTagSubstringApplyToNextLine.pass | 18 ----- ...tipleSnippetTagInOneJavaDocWithRegion.pass | 56 +++++---------- ...ocsnippet_highlightUsingNestedRegions.pass | 18 ----- .../javadocsnippet_highlightUsingRegex.pass | 18 ----- ...lightUsingRegionsEndedWithDoubleColon.pass | 18 ----- ...avadocsnippet_highlightUsingSubstring.pass | 18 ----- ...ippet_highlightUsingSubstringAndRegex.pass | 18 ----- ...t_highlightUsingSubstringRegexAndType.pass | 18 ----- .../javadocsnippet_noMarkupTagPresent.pass | 18 ----- .../javadocsnippet_region_invalid.pass | 18 ----- .../javadocsnippet_region_valid.pass | 18 ----- .../modules/editor/java/GoToSupportTest.java | 41 +---------- .../javadoc/JavadocCompletionQueryTest.java | 30 ++++++++ .../api/java/source/ui/ElementJavadoc.java | 36 ++++++---- 51 files changed, 158 insertions(+), 961 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3c1737efae4..93992ae48580 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1113,6 +1113,10 @@ jobs: if: env.test_java == 'true' && success() run: ant $OPTS -f java/java.completion test + - name: java.editor + if: env.test_java == 'true' && success() + run: ant $OPTS -f java/java.editor test-unit + - name: java.freeform run: ant $OPTS -f java/java.freeform test diff --git a/java/java.editor/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionTask.java b/java/java.editor/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionTask.java index 7dfa41084eca..3e0e5c4c9385 100644 --- a/java/java.editor/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionTask.java +++ b/java/java.editor/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionTask.java @@ -20,6 +20,7 @@ import com.sun.source.doctree.DocCommentTree; import com.sun.source.doctree.DocTree; +import com.sun.source.doctree.DocTree.Kind; import com.sun.source.doctree.ParamTree; import com.sun.source.doctree.ReferenceTree; import com.sun.source.tree.Scope; @@ -285,7 +286,15 @@ private DocTreePath getTag(final JavadocContext jdctx, final int offset) { new DocTreePathScanner() { @Override public Void scan(DocTree node, Void p) { - if (node != null && jdctx.positions.getStartPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, node) <= normalizedOffset && jdctx.positions.getEndPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, node) >= normalizedOffset) { + long endPos = jdctx.positions.getEndPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, node); + long startPos = jdctx.positions.getStartPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, node); + if (node.getKind() == Kind.ERRONEOUS && getCurrentPath() != null) { + String text = jdctx.javac.getText().substring((int) startPos, (int) endPos); + if (text.length() > 0 && text.charAt(0) == '{' && text.charAt(text.length() - 1) != '}') { + endPos = jdctx.positions.getEndPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, getCurrentPath().getLeaf()); + } + } + if (node != null && startPos <= normalizedOffset && endPos >= normalizedOffset) { final DocTreePath docTreePath = new DocTreePath(getCurrentPath(), node); if (JavadocCompletionUtils.isBlockTag(docTreePath) || JavadocCompletionUtils.isInlineTag(docTreePath)) { result[0] = docTreePath; @@ -374,6 +383,9 @@ private void insideTag(DocTreePath tag, JavadocContext jdctx) { case REFERENCE: insideReference(tag, jdctx); break; + case SNIPPET: + insideSnippet(tag, jdctx); + break; } } @@ -1216,11 +1228,6 @@ void resolveOtherText(JavadocContext jdctx, TokenSequence jdts) CharSequence text = token.text(); int pos = caretOffset - jdts.offset(); DocTreePath tag = getTag(jdctx, caretOffset); - int startPos = (int) jdctx.positions.getStartPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, tag.getLeaf()); - String subStr = JavadocCompletionUtils.getCharSequence(jdctx.doc, startPos, caretOffset).toString(); - int index = subStr.lastIndexOf("\n"); - String markupLine = JavadocCompletionUtils.getCharSequence(jdctx.doc, (index + startPos), caretOffset).toString(); - insideInlineSnippet(markupLine); if (pos > 0 && pos <= text.length() && text.charAt(pos - 1) == '{') { if (tag != null && !JavadocCompletionUtils.isBlockTag(tag)) { @@ -1242,26 +1249,43 @@ void resolveOtherText(JavadocContext jdctx, TokenSequence jdts) } } + void insideSnippet(DocTreePath tag, JavadocContext jdctx) { + int startPos = (int) jdctx.positions.getStartPosition(jdctx.javac.getCompilationUnit(), jdctx.comment, tag.getLeaf()); + String subStr = JavadocCompletionUtils.getCharSequence(jdctx.doc, startPos, caretOffset).toString(); + int index = subStr.lastIndexOf("\n"); + String markupLine = JavadocCompletionUtils.getCharSequence(jdctx.doc, (index + startPos), caretOffset).toString(); + insideInlineSnippet(markupLine); + } + + private static final List SNIPPET_TAGS = Collections.unmodifiableList(Arrays.asList( + "@highlight", + "@replace", + "@link", + "@start", + "@end" + )); + + private static final Pattern TAG_PATTERN = Pattern.compile("@\\b\\w{1,}\\b\\s+(?!.*@\\b\\w{1,}\\b\\s+)"); + void insideInlineSnippet(String subStr) { if (subStr.contains("//")) { - if (subStr.endsWith("@")) { - List inlineAttr = new ArrayList() { - { - add("highlight"); - add("replace"); - add("link"); - add("start"); - add("end"); + int lastAt = subStr.lastIndexOf('@'); + if (lastAt != (-1)) { + String suffix = subStr.substring(lastAt); + if (!suffix.contains(" ")) { + for (String str : SNIPPET_TAGS) { + if (str.startsWith(suffix)) { + items.add(factory.createNameItem(str.substring(1), this.caretOffset)); + } } - }; - for (String str : inlineAttr) { - items.add(factory.createNameItem(str, this.caretOffset)); + return ; } - } else { - String[] tags = {"@highlight", "@replace", "@link", "@start", "@end"}; - Matcher match = Pattern.compile("@\\b\\w{1,}\\b\\s+(?!.*@\\b\\w{1,}\\b\\s+)").matcher(subStr); - if (match.find() && Arrays.asList(tags).contains(match.group(0).trim())) { - completeInlineMarkupTag(match.group(0).trim(), new ArrayList() { + } + Matcher match = TAG_PATTERN.matcher(subStr); + if (match.find()) { + String tag = match.group(0); + if (SNIPPET_TAGS.contains(tag.trim())) { + completeInlineMarkupTag(tag.trim(), new ArrayList() { { add("substring"); add("regex"); diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_HighlightAndReplace_cornercase.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_HighlightAndReplace_cornercase.pass index 3e68eb867a9e..712977fa4f39 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_HighlightAndReplace_cornercase.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_HighlightAndReplace_cornercase.pass @@ -1,24 +1,6 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test
public void testHighlightAndReplace_cornercase()

  public static void \bmain\b(String... args) {	
 		 Sysreplace.out.println("tests"); 	
  }
  
-

+

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag.pass index b4a663503487..3f7d729cff13 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag.pass @@ -1,29 +1,10 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag()

A simple program

 class HelloWorld {
      public static void main(String... args) {
-         System.out.println("Hello World!");  
+         System.out.println("Hello World!");  
  }
  }
  
-
-

+

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_HighlightTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_HighlightTag.pass index dcd50f8fb29a..cb79b7b8e08c 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_HighlightTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_HighlightTag.pass @@ -1,29 +1,11 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_AlongWith_HighlightTag()

A simple program

 class HelloWorld {
      public static void main(String... args) {
          
-         System.out.println("Hello World!");
+         System.out.println("Hello World!");
  }
  }
  
-

+

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_ReplaceTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_ReplaceTag.pass index 01f1f9471508..8a9190d257af 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_ReplaceTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_ReplaceTag.pass @@ -1,29 +1,11 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_AlongWith_ReplaceTag()

A simple program

 class HelloWorld {
      public static void main(String... args) {
          
-         Syserr.out.println("Hello World!");
+         Syserr.out.println("Hello World!");
  }
  }
  
-

+

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_SubStringAndReplaceTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_SubStringAndReplaceTag.pass index c1938055e9e5..b3f1994f8570 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_SubStringAndReplaceTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AlongWith_SubStringAndReplaceTag.pass @@ -1,29 +1,11 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_AlongWith_SubStringAndReplaceTag()

A simple program

 class HelloWorld {
      public static void main(String... args) {
          
-         System.replacedout.println("Hello World!");
+         System.replacedout.println("Hello World!");
  }
  }
-
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AppliesToNextLine.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AppliesToNextLine.pass index 1479d48a41e5..80467e7e1c17 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AppliesToNextLine.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_AppliesToNextLine.pass @@ -1,29 +1,11 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_AppliesToNextLine()

A simple program

 class HelloWorld {
      public static void main(String... args) {
          
-         System.out.println("Hello World!");
+         System.out.println("Hello World!");
  }
  }
-
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_EmptyReplacementValue.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_EmptyReplacementValue.pass index 6b6f5a5be322..310a6c91942f 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_EmptyReplacementValue.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_EmptyReplacementValue.pass @@ -1,29 +1,11 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_EmptyReplacementValue()

A simple program

-
 class HelloWorld {
+
 class HelloWorld {
      public static void main(String... args) {
          
-         System.out.println("Hello World!");
+         System.out.println("Hello World!");
  }
  }
-
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_FieldRef_ToThisClass_UsingHash.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_FieldRef_ToThisClass_UsingHash.pass index 6ffb5a5ecd00..1916841d7217 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_FieldRef_ToThisClass_UsingHash.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_FieldRef_ToThisClass_UsingHash.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_FieldRef_ToThisClass_UsingHash()

A simple program

@@ -24,5 +6,5 @@ System.out.println(args[0]); } } - -

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_Ref_ToThisClass_UsingHash.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_Ref_ToThisClass_UsingHash.pass index 51b4c284754a..f2dab266ff50 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_Ref_ToThisClass_UsingHash.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_Ref_ToThisClass_UsingHash.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_Ref_ToThisClass_UsingHash()

A simple program

@@ -24,5 +6,5 @@ System.out.println(addExact(1,20)); } } - -

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegexAndRegion.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegexAndRegion.pass index 73897f5390b1..21d75fdcf41d 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegexAndRegion.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegexAndRegion.pass @@ -1,29 +1,12 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_With_RegexAndRegion()

A simple program

   public static void main(String... args) {
-       for (var arg : args) {                 
-           if (!arg.isBlank()) {
-               System.out.println(arg);
+       for (var arg : args) {                 
+           if (!arg.isBlank()) {
+               System.out.println(arg);
            }
        }                                      
  }
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegionAttribute.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegionAttribute.pass index c616e44c2304..5b5f6d39951b 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegionAttribute.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_LinkTag_With_RegionAttribute.pass @@ -1,31 +1,14 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLinkTag_With_RegionAttribute()

A simple program

 class HelloWorld {
      public static void main(String... args) {
-         System.out.println("Hello World!"); 
-         System.out.println(ArrayList.class); 
-         System.out.println("Hello World"); System.out.println(ArrayList.class);
+         System.out.println("Hello World!"); 
+         System.out.println(ArrayList.class); 
+         System.out.println("Hello World"); System.out.println(ArrayList.class);
          System.err.println("err");
-         System.err.println(ArrayList.class);
+         System.err.println(ArrayList.class);
  }
  }
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Link_MultipleTag_OnSameLine.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Link_MultipleTag_OnSameLine.pass index cecb0a1f4214..6c0c86eb1224 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Link_MultipleTag_OnSameLine.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Link_MultipleTag_OnSameLine.pass @@ -1,27 +1,10 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testLink_MultipleTag_OnSameLine()

A simple program

 class HelloWorld {
      public static void main(String... args) {
-         System.out.println(ArrayList.class); 
+         System.out.println(ArrayList.class); 
  }
  }
-

+ +

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_Highlight_And_replace.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_Highlight_And_replace.pass index 3269fdb57b43..e746d689dabe 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_Highlight_And_replace.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_Highlight_And_replace.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void testNestedRegion_Highlight_And_replace()

   public static void \bmain\b(String... args) {	
        for (var arg : args) {                         
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Regex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Regex.pass
index fa4010c81b3a..c40df372f806 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Regex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Regex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testNestedRegion_ReplaceAnnotation_Regex()

 class HelloWorld1 {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Substring.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Substring.pass
index 3e45bebe6dde..5e146608a37e 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Substring.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_NestedRegion_ReplaceAnnotation_Substring.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testNestedRegion_ReplaceAnnotation_Substring()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_Regex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_Regex.pass
index 00bda0f322f1..406ecd1cceeb 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_Regex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_Regex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testRegion_ReplaceAnnotation_Regex()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_RegexInnComment.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_RegexInnComment.pass
index 1bcbcb07cb3c..78df225937db 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_RegexInnComment.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_Region_ReplaceAnnotation_RegexInnComment.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testRegion_ReplaceAnnotation_RegexInnComment()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Regex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Regex.pass
index cc66e6ddb0b4..21c971b35188 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Regex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Regex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_MultipleReplaceAnnotation_Regex()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Substring.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Substring.pass
index 1c7dba4fe662..ac9a23369ec7 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Substring.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_MultipleReplaceAnnotation_Substring.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_MultipleReplaceAnnotation_Substring()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_ReplaceAnnotation_Regex_DoubleQuote.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_ReplaceAnnotation_Regex_DoubleQuote.pass
index 31c90f99d145..3f79d39d39c8 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_ReplaceAnnotation_Regex_DoubleQuote.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_ReplaceAnnotation_Regex_DoubleQuote.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_ReplaceAnnotation_Regex_DoubleQuote()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Regex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Regex.pass
index 071e094748db..a5dd54ba9f43 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Regex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Regex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_Replace_Regex()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDot.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDot.pass
index c59b5c523e1b..84036ecce775 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDot.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDot.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_Replace_RegexDot()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDotStar.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDotStar.pass
index 7e319b52226b..1a57784635b4 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDotStar.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_RegexDotStar.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_Replace_RegexDotStar()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Substring.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Substring.pass
index 4c4a4527bc98..79366b126660 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Substring.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_SingleLine_Replace_Substring.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void testSingleLine_Replace_Substring()

 class HelloWorld {
      public static void main(String... args) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_HighlightTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_HighlightTag.pass
index 5076e5a5a06f..f8a0fa69d3e0 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_HighlightTag.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_HighlightTag.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void errorsInHighlightTag()

error: snippet markup: Invalid value ^Blank for ^highlight tag mark up attribute ^substring
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_LinkTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_LinkTag.pass index 5c29e61a89f8..297414cff7ec 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_LinkTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_LinkTag.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regardingcopyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test
public void errorsInLinkTag()

error: snippet markup: Invalid value ^Blank for ^link tag mark up attribute ^substring
 
@@ -53,13 +35,13 @@
-
 class Helloclass {
+
 class Helloclass {
  }
  
 
-
 class HelloClass {
+
 class HelloClass {
  }
  
 
@@ -71,7 +53,7 @@
-
 class HelloClass {
+
 class HelloClass {
  }
  
 

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_NoRegionToEnd.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_NoRegionToEnd.pass index 109e38bf176d..3874175b8088 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_NoRegionToEnd.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_NoRegionToEnd.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void errorsInNoRegionToEnd()

error: snippet markup: no region to end @end ^anonymous
 

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_ReplaceTag.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_ReplaceTag.pass index e0c29affd454..173fb2afd7a4 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_ReplaceTag.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_ReplaceTag.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void errorsInReplaceTag()

error: snippet markup: Invalid value ^Blank for ^replace tag mark up attribute ^substring
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_UnpairedRegion.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_UnpairedRegion.pass index 60afed3e2de3..59b3db609f4f 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_UnpairedRegion.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_TestError_UnpairedRegion.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test
public void errorsInUnpairedRegion()

error: snippet markup: unpaired region highlight anonymous
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_external_file.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_external_file.pass index ca1153564836..a609314c62ce 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_external_file.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_external_file.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test
public void externalSnippetFile()

import java.util.Optional;
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_empty.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_empty.pass
index 73eb955da7fc..6b244a35176a 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_empty.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_empty.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void errorFileEmpty()

error: snippet markup: File invalid
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_invalid.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_invalid.pass
index 109dbbb4f1c8..51dabc0ccc3b 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_invalid.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_file_invalid.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void errorFileInvalid()

error: snippet markup: File invalid
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightRecord.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightRecord.pass
index d6cdb96dd101..ebeb16408796 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightRecord.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightRecord.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
private static void method(R r)

A simple program. System.out diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChange.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChange.pass index d2726f9510df..a42f299868fb 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChange.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChange.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void highlightTagRegexWithAllCharacterChange()

   public static void main(String... args) {
       
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChangeUsingDot.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChangeUsingDot.pass
index e03c964bb0d7..994db22393f0 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChangeUsingDot.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagRegexWithAllCharacterChangeUsingDot.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightTagRegexWithAllCharacterChangeUsingDot()

   public static void main(String... args) {
       
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagSubstringApplyToNextLine.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagSubstringApplyToNextLine.pass
index d2516b01dec7..9b05d647a32d 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagSubstringApplyToNextLine.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightTagSubstringApplyToNextLine.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightTagSubstringApplyToNextLine()

   public static void main(String... args) {
       
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingMultipleSnippetTagInOneJavaDocWithRegion.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingMultipleSnippetTagInOneJavaDocWithRegion.pass
index 4c0b96aa6d6d..229f31163cc9 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingMultipleSnippetTagInOneJavaDocWithRegion.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingMultipleSnippetTagInOneJavaDocWithRegion.pass
@@ -1,42 +1,20 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-test.​Test
public void highlightUsingSubstringRegexAndType()

-
   public static void main(String... substring) {
-       for (var regex : substring) {
-           if (!arg.isBlank()) {
-                System.out.println("italic");     
-                System.out.println("bold");       
-                System.out.println("highlight");  
- 
-                System.out.println("italic and highlight and bold");
- 
-                System.out.println("italic-cum-highlight-cum-bold");
-                System.out.println("Highlight all "+ substring + ":" + "subsubstringstring");
-
-                System.out.println("no mark up tag");//to-do
- 
-                System.out.println("Highlight/bold/italic all "+ substring + ":" + "subsubstringstring");
-                System.out.println("Highlight all regular exp :regex:"+ regex + " :" + "regexregex" +" regex ");
- 
-                System.out.println("Highlight/bold/italic all regular exp :regex:"+ regex + ":" + "regexregex"+" regex ");
- }
- }
+test.​Test
public void highlightUsingMultipleSnippetTagInOneJavaDocWithRegion()

+
   public static void main(String... args) {
+       for (var arg : args) {                 
+           if (!arg.isBlankarg()) {
+               System.out.println(arg);
+           }
+       }                                      
+   }
+   
+
+
+
   public static void main(String... args) {
+       for (var arg : args) {                 
+           if (!arg.isBlankarg()) {
+               System.out.println(arg);
+           }
+       }                                      
  }
  
 

\ No newline at end of file diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingNestedRegions.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingNestedRegions.pass index dbd0412fd024..0b642aa0f55d 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingNestedRegions.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingNestedRegions.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test

public void highlightUsingNestedRegions()

   public static void \bmain\b(String... args) {
  
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegex.pass
index 1270464aa833..7c96bd091327 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightUsingRegex()

   public static void main(String... args1) {
        for (var arg : args1) {                 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegionsEndedWithDoubleColon.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegionsEndedWithDoubleColon.pass
index cc9c7542e2fb..faac4e2c6653 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegionsEndedWithDoubleColon.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingRegionsEndedWithDoubleColon.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightUsingRegionsEndedWithDoubleColon()

   public static void \bmain\b(String... args) {
        for (var arg : args) {                         
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstring.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstring.pass
index 51453e8eee9d..7230e25d7227 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstring.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstring.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightUsingSubstring()

   public static void main(String... args) {
        for (var arg : args) {                 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringAndRegex.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringAndRegex.pass
index 9461f5cbeea8..dea56f3efa21 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringAndRegex.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringAndRegex.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightUsingSubstringAndRegex()

   public static void main(String... args1) {
        for (var arg : args1) {                 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringRegexAndType.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringRegexAndType.pass
index 4c0b96aa6d6d..83732f2b1f9f 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringRegexAndType.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_highlightUsingSubstringRegexAndType.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void highlightUsingSubstringRegexAndType()

   public static void main(String... substring) {
        for (var regex : substring) {
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_noMarkupTagPresent.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_noMarkupTagPresent.pass
index dff623a51d4e..82b3e07aeafc 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_noMarkupTagPresent.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_noMarkupTagPresent.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void noMarkupTagPresent()

   public static void main(String... args) {
      System.out.println("args"); // highligh substring = "args"
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_invalid.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_invalid.pass
index 8c73f61cabdd..d3a23a43a7ba 100644
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_invalid.pass
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_invalid.pass
@@ -1,21 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 test.​Test
public void errorRegionInvalid()

error: snippet markup: Region not found
 
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_valid.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_valid.pass index c2488bab0c18..9fc492db96fe 100644 --- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_valid.pass +++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/editor/java/GoToSupportTest/javadocsnippet_region_valid.pass @@ -1,21 +1,3 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ test.​Test
public void testRegionValid()

        
         if (v.isPresent()) {
diff --git a/java/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java b/java/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
index 2afff1e67612..544330fa53d6 100644
--- a/java/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
+++ b/java/java.editor/test/unit/src/org/netbeans/modules/editor/java/GoToSupportTest.java
@@ -1262,7 +1262,7 @@ protected void performTest(String source, int caretPos, String textToInsert, Str
         copyToWorkDir(new File(getDataDir(), "org/netbeans/modules/java/editor/javadocsnippet/data/" + source + ".java"), testSource);
         FileObject testSourceFO = FileUtil.toFileObject(testSource);
         
-        if(external) {
+        if (external) {
             FileUtil.createFolder(sourceDir, "test");
             copyFolder((new File(getDataDir(),"org/netbeans/modules/java/editor/javadocsnippet/data/snippet-files").toPath()),
                     new File(getWorkDir(), "src/test/snippet-files").toPath());
@@ -1359,7 +1359,6 @@ interface OrigUiUtilsCaller {
     }
     
     public void testRecords1() throws Exception {
-        if (!hasRecords()) return ;
         final boolean[] wasCalled = new boolean[1];
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
@@ -1396,7 +1395,6 @@ public void testRecords1() throws Exception {
     }
 
     public void testRecords2() throws Exception {
-        if (!hasRecords()) return ;
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1431,7 +1429,6 @@ public void testRecords2() throws Exception {
     }
 
     public void testRecords3() throws Exception {
-        if (!hasRecords()) return ;
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1466,7 +1463,6 @@ public void testRecords3() throws Exception {
     }
 
     public void testRecords4() throws Exception {
-        if (!hasRecords()) return ;
         final boolean[] wasCalled = new boolean[1];
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
@@ -1515,7 +1511,6 @@ public void run(CompilationController parameter) throws Exception {
     }
 
     public void testRecords5() throws Exception {
-        if (!hasRecords()) return ;
         final boolean[] wasCalled = new boolean[1];
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
@@ -1572,25 +1567,12 @@ private static boolean hasPatterns() {
         }
     }
 
-    private static boolean hasRecords() {
-        try {
-            SourceVersion.valueOf("RELEASE_14"); //NOI18N
-            return true;
-        } catch (IllegalArgumentException ex) {
-            //OK, no RELEASE_14, skip tests
-            return false;
-        }
-    }
-
     public void testJavadocSnippetHighlightRecord() throws Exception {
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
         
-        performTest("HighlightTag", 388, null, "javadocsnippet_highlightRecord.pass", this.sourceLevel, false);
+        performTest("HighlightTag", 1196, null, "javadocsnippet_highlightRecord.pass", this.sourceLevel, false);
     }
     
     public void testHighlightUsingSubstring() throws Exception {
@@ -1934,10 +1916,6 @@ public void testError_NoRegionToEnd() throws Exception {
     }
 
     public void testErrorFileEmpty() throws Exception {
-
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1946,9 +1924,6 @@ public void testErrorFileEmpty() throws Exception {
     }
 
     public void testErrorFileInvalid() throws Exception {
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1957,10 +1932,6 @@ public void testErrorFileInvalid() throws Exception {
     }
 
     public void testExternalSnippetFile() throws Exception {
-
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1969,10 +1940,6 @@ public void testExternalSnippetFile() throws Exception {
     }
 
     public void testErrorRegionInvalid() throws Exception {
-
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
@@ -1981,10 +1948,6 @@ public void testErrorRegionInvalid() throws Exception {
     }
 
     public void testExternalRegionValid() throws Exception {
-
-        if (!hasRecords()) {
-            return;
-        }
         this.sourceLevel = getLatestSourceVersion();
         EXTRA_OPTIONS.add("--enable-preview");
         JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
diff --git a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionQueryTest.java b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionQueryTest.java
index 74e42e0f691b..bfd4223c4abf 100644
--- a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionQueryTest.java
+++ b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/javadoc/JavadocCompletionQueryTest.java
@@ -557,6 +557,36 @@ public void testThrows2() throws Exception {
         performCompletionTest(code, "ClassCircularityError", "ClassFormatError", "ClassCastException", "ClassNotFoundException");
     }
     
+    public void testSnippet1() throws Exception {
+        String code =
+                "package p;\n" +
+                "class Clazz {\n" +
+                "    /**\n" +
+                "     * {@snippet\n" +
+                "     *  System.err.println(1); //@|\n" +
+                "     */\n" +
+                "    Clazz() {\n" +
+                "    }\n" +
+                "}\n";
+
+        performCompletionTest(code, "end:", "highlight:", "link:", "replace:", "start:");
+    }
+
+    public void testSnippet2() throws Exception {
+        String code =
+                "package p;\n" +
+                "class Clazz {\n" +
+                "    /**\n" +
+                "     * {@snippet\n" +
+                "     * //@e|\n" +
+                "     */\n" +
+                "    Clazz() {\n" +
+                "    }\n" +
+                "}\n";
+
+        performCompletionTest(code, "end:");
+    }
+
     private static String stripHTML(String from) {
         StringBuilder result = new StringBuilder();
         boolean inHTMLTag = false;
diff --git a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
index d55f029fcbae..d26bf1e55b26 100644
--- a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
+++ b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
@@ -120,7 +120,13 @@
 import com.sun.source.tree.Tree;
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.code.ClassFinder;
+import org.netbeans.api.java.queries.SourceLevelQuery;
+import org.netbeans.api.java.queries.SourceLevelQuery.Profile;
 import org.netbeans.api.java.source.ui.snippet.MarkupTagProcessor;
+import org.netbeans.modules.java.source.indexing.APTUtils;
+import org.netbeans.modules.java.source.indexing.FQN2Files;
+import org.netbeans.modules.java.source.parsing.JavacParser;
+import org.openide.filesystems.FileSystem;
 
 /** Utility class for viewing Javadoc comments as HTML.
  *
@@ -1434,8 +1440,8 @@ private String extractContent(TreePath docPath, DocTree attr, Set errorL
         String error = null;
         String text = null;
 
-        pckgName = pckgName.replaceAll("\\.", "\\\\");
-        FileObject snippetFile = classPath.findResource(pckgName + "\\snippet-files\\" + fileName);
+        pckgName = pckgName.replaceAll("\\.", "/");
+        FileObject snippetFile = classPath.findResource(pckgName + "/snippet-files/" + fileName);
         if (snippetFile == null || fileName.isEmpty()) {
             error = "error: snippet markup: File invalid";
             errorList.add(error);
@@ -1758,10 +1764,20 @@ private String prepareJavaDocForSnippetMarkupLinkTag(String target){
 
     private static class JavaDocSnippetLinkTagFileObject extends SimpleJavaFileObject {
 
+        private static final URI fakeFileObjectURI;
+        static {
+            try {
+                FileSystem mfs = FileUtil.createMemoryFileSystem();
+                FileObject fakeFileObject = mfs.getRoot().createData("JavaDocSnippetLinkTagFileObject.java");
+                fakeFileObjectURI = fakeFileObject.toURI();
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
         private String text;
 
         public JavaDocSnippetLinkTagFileObject(String text) {
-            super(URI.create("myfo:/JavaDocSnippetLinkTag.java"), JavaFileObject.Kind.SOURCE); //NOI18N
+            super(fakeFileObjectURI, JavaFileObject.Kind.SOURCE); //NOI18N
             this.text = text;
         }
 
@@ -1772,17 +1788,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
     }
     
     private void createSnippetMarkupLinkTag(StringBuilder sb, JavaDocSnippetLinkTagFileObject fileObject) throws IOException {
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        StringBuilder prjClsPath = new StringBuilder();
-        String prjSrcPath = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE).toString();
-        prjClsPath.append(prjSrcPath);
-        
-        for(ClassPath.Entry cpe : cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE).entries()){
-            prjClsPath.append(";");
-            prjClsPath.append(cpe.getRoot().getFileSystem().getDisplayName());
-        }
-        List opt = Arrays.asList("-cp",prjClsPath.toString());
-        JavacTask task = (JavacTask) compiler.getTask(null, null, null, opt, null, Arrays.asList(fileObject));
+        JavacTask task = JavacParser.createJavacTask(cpInfo, d -> {}, SourceLevelQuery.getSourceLevel(this.fileObject), Profile.DEFAULT, null, null, null, null, Collections.singletonList(fileObject));
 
         DocTrees docTrees = DocTrees.instance(task);//trees
         
@@ -1798,7 +1804,7 @@ private void createSnippetMarkupLinkTag(StringBuilder sb, JavaDocSnippetLinkTagF
                     for(DocTree dTree: body){
                         if(dTree instanceof LinkTree){
                             LinkTree linkTag = (LinkTree)dTree;
-                            appendReference(sb, linkTag.getReference(), body, path, doc, docTrees);
+                            appendReference(sb, linkTag.getReference(), linkTag.getLabel(), path, doc, docTrees);
                             break main;
                         }
                     }

From 74a6c2bbf5910615bf7de3933cfabdee7b6b0549 Mon Sep 17 00:00:00 2001
From: Neil C Smith 
Date: Wed, 2 Nov 2022 11:24:29 +0000
Subject: [PATCH 23/33] Fix incorrect source passed to WeakListeners inside
 ClassPathProviderImpl.AnnotationPathSelector.

---
 .../modules/maven/classpath/ClassPathProviderImpl.java         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java
index 48c3a4707ecb..f517f9eeb3cb 100644
--- a/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java
+++ b/java/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java
@@ -723,7 +723,8 @@ public AnnotationPathSelector(NbMavenProjectImpl proj, ClassPath anno, Supplier<
             this.compileClassPath = compile;
             
             anno.addPropertyChangeListener(WeakListeners.propertyChange(this, anno));
-            proj.getProjectWatcher().addPropertyChangeListener(WeakListeners.propertyChange(this, anno));
+            NbMavenProject watcher = proj.getProjectWatcher();
+            watcher.addPropertyChangeListener(WeakListeners.propertyChange(this, watcher));
         }
 
         @Override

From 949b4e474bbe70442de82cee7d9faedc7b972c3c Mon Sep 17 00:00:00 2001
From: Svata Dedic 
Date: Wed, 2 Nov 2022 17:35:14 +0100
Subject: [PATCH 24/33] Added logging for UIContext. Do not bind
 DialogDisplayer to Lookup at startup.

---
 .../commands/ProjectAuditCommand.java         | 12 +++++++++-
 .../java/lsp/server/protocol/UIContext.java   |  6 +++++
 .../server/protocol/WorkspaceUIContext.java   |  5 ++++
 .../server/ui/AbstractDialogDisplayer.java    | 24 +++++++------------
 .../server/ui/NotifyDescriptorAdapter.java    |  1 +
 5 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java
index f50739ff5ff2..2d82ed5da82d 100644
--- a/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java
+++ b/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java
@@ -27,6 +27,8 @@
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.eclipse.lsp4j.CodeAction;
 import org.eclipse.lsp4j.CodeActionParams;
 import org.netbeans.api.project.FileOwnerQuery;
@@ -37,10 +39,12 @@
 import org.netbeans.modules.cloud.oracle.adm.ProjectVulnerability;
 import org.netbeans.modules.java.lsp.server.protocol.CodeActionsProvider;
 import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.UIContext;
 import org.netbeans.modules.parsing.api.ResultIterator;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
 import org.openide.filesystems.FileObject;
+import org.openide.util.Lookup;
 import org.openide.util.NbBundle;
 import org.openide.util.lookup.ServiceProvider;
 
@@ -50,6 +54,8 @@
  */
 @ServiceProvider(service = CodeActionsProvider.class)
 public class ProjectAuditCommand extends CodeActionsProvider {
+    private static final Logger LOG = Logger.getLogger(ProjectAuditCommand.class.getName());
+    
     /**
      * Force executes the project audit using the supplied compartment and knowledgebase IDs.
      */
@@ -112,12 +118,16 @@ public CompletableFuture processCommand(NbCodeLanguageClient client, Str
         }
         JsonObject options = (JsonObject)o;
         
+        // PENDING: this is for debugging, temporary. Can be removed in the future when the messaging is stabilized
+        UIContext ctx = Lookup.getDefault().lookup(UIContext.class);
+        LOG.log(Level.FINE, "Running audit command with context: {0}", ctx);
+        
         boolean forceAudit = options.has("force") && options.get("force").getAsBoolean();
         String preferredName = options.has("auditName") ? options.get("auditName").getAsString() : null;
         
         return v.findKnowledgeBase(knowledgeBase).
                 exceptionally(th -> {
-                    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ERR_KnowledgeBaseSearchFailed(fn, th.getMessage()),
+                    DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(Bundle.ERR_KnowledgeBaseSearchFailed(fn, th.getMessage()),
                             NotifyDescriptor.ERROR_MESSAGE));
                     return null;
                 }).thenCompose((kb) -> {
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/UIContext.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/UIContext.java
index 2502e818e984..230021bc828c 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/UIContext.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/UIContext.java
@@ -24,6 +24,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.eclipse.lsp4j.MessageActionItem;
 import org.eclipse.lsp4j.MessageParams;
 import org.eclipse.lsp4j.MessageType;
@@ -38,6 +40,8 @@
 import org.openide.util.Lookup;
 
 public abstract class UIContext {
+    private static final Logger LOG = Logger.getLogger(UIContext.class.getName());
+    
     private static Reference lastCtx = new WeakReference<>(null);
     
     /**
@@ -50,11 +54,13 @@ public abstract class UIContext {
     public static synchronized UIContext find(Lookup lkp) {
         UIContext ctx = lkp.lookup(UIContext.class);
         if (ctx != null) {
+            LOG.log(Level.FINE, "Acquired user context from lookup: {0}, context instance: {1}", new Object[] { lkp, ctx });
             return ctx;
         }
         Lookup def = Lookup.getDefault();
         if (lkp != def) {
             ctx = def.lookup(UIContext.class);
+            LOG.log(Level.FINE, "Acquired user context from default lookup: {0}, context instance: {1}", new Object[] { lkp, ctx });
         }
         if (ctx == null) {
             // PENDING: better context transfer between threads is needed; this way the UIContext can remote to a bad
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceUIContext.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceUIContext.java
index aa041ccaea15..fa3ca4a1682a 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceUIContext.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceUIContext.java
@@ -21,6 +21,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.eclipse.lsp4j.MessageActionItem;
 import org.eclipse.lsp4j.MessageParams;
 import org.eclipse.lsp4j.ShowMessageRequestParams;
@@ -36,10 +38,13 @@
  * @author sdedic
  */
 class WorkspaceUIContext extends UIContext {
+    private static final Logger LOG = Logger.getLogger(WorkspaceUIContext.class.getName());
+    
     private final NbCodeLanguageClient client;
 
     public WorkspaceUIContext(NbCodeLanguageClient client) {
         this.client = client;
+        LOG.log(Level.FINE, "Starting WorkspaceUIContext for: {0}, context instance: {1}", new Object[] { client, this });
     }
 
     @Override
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/AbstractDialogDisplayer.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/AbstractDialogDisplayer.java
index 5f8a8a3b6f2c..ff7b6cf2208c 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/AbstractDialogDisplayer.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/AbstractDialogDisplayer.java
@@ -21,6 +21,8 @@
 import java.awt.Dialog;
 import java.awt.HeadlessException;
 import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import org.netbeans.modules.java.lsp.server.LspServerUtils;
 import org.netbeans.modules.java.lsp.server.protocol.UIContext;
 import org.openide.DialogDescriptor;
@@ -35,40 +37,30 @@
  * @author sdedic
  */
 public class AbstractDialogDisplayer extends DialogDisplayer {
-    private final Lookup context;
+    private static final Logger LOG = Logger.getLogger(AbstractDialogDisplayer.class.getName());
     
     public AbstractDialogDisplayer() {
-        this(Lookup.getDefault());
-    }
-
-    AbstractDialogDisplayer(Lookup context) {
-        this.context = context;
+        LOG.log(Level.FINE, "Creating dialog displayer with lookup context: {0}", Lookup.getDefault());
     }
     
     @Override
     public Object notify(NotifyDescriptor descriptor) {
-        LspServerUtils.avoidClientMessageThread(context);
-        UIContext ctx = UIContext.find(context);
+        LspServerUtils.avoidClientMessageThread(Lookup.getDefault());
+        UIContext ctx = UIContext.find();
         NotifyDescriptorAdapter adapter = new NotifyDescriptorAdapter(descriptor, ctx);
         return adapter.clientNotify();
     }
     
     @Override
     public void notifyLater(final NotifyDescriptor descriptor) {
-        UIContext ctx = context.lookup(UIContext.class);
-        if (ctx == null) {
-            ctx = UIContext.find();
-        }
+        UIContext ctx = UIContext.find();
         NotifyDescriptorAdapter adapter = new NotifyDescriptorAdapter(descriptor, ctx);
         adapter.clientNotifyLater();
     }
 
     @Override
     public  CompletableFuture notifyFuture(T descriptor) {
-        UIContext ctx = context.lookup(UIContext.class);
-        if (ctx == null) {
-            ctx = UIContext.find();
-        }
+        UIContext ctx = UIContext.find();
         NotifyDescriptorAdapter adapter = new NotifyDescriptorAdapter(descriptor, ctx);
         return adapter.clientNotifyCompletion();
     }
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/NotifyDescriptorAdapter.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/NotifyDescriptorAdapter.java
index 046ad6d7053e..9ac84a7ff98b 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/NotifyDescriptorAdapter.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ui/NotifyDescriptorAdapter.java
@@ -286,6 +286,7 @@ public Object clientNotify() {
     }
     
     public CompletableFuture clientNotifyLater() {
+        LOG.log(Level.FINE, "notifyLater with context: {0}", this.client);
         return clientNotifyCompletion().thenApply(d -> d.getValue()).exceptionally(t -> {
             if (t instanceof CompletionException) {
                 t = t.getCause();

From c2eb59a2b0c8e2368749ba71e79f7e071ba1ea12 Mon Sep 17 00:00:00 2001
From: Svata Dedic 
Date: Wed, 2 Nov 2022 17:35:32 +0100
Subject: [PATCH 25/33] Support deserialization in tests.

---
 .../server/explorer/api/NodeChangedParams.java | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/api/NodeChangedParams.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/api/NodeChangedParams.java
index e0f0168ca5b7..3ec690656908 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/api/NodeChangedParams.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/api/NodeChangedParams.java
@@ -28,10 +28,10 @@
  */
 public class NodeChangedParams {
     @NonNull
-    private final int rootId;
+    private int rootId;
+    
+    private Integer nodeId;
     
-    private final Integer nodeId;
-
     public NodeChangedParams(int rootId) {
         this.rootId = rootId;
         this.nodeId = null;
@@ -52,4 +52,16 @@ public int getRootId() {
     public Integer getNodeId() {
         return nodeId;
     }
+
+    // needed for testing, as GSON deserializes the structure on the client side.
+    public NodeChangedParams() {
+    }
+
+    public void setRootId(int rootId) {
+        this.rootId = rootId;
+    }
+
+    public void setNodeId(Integer nodeId) {
+        this.nodeId = nodeId;
+    }
 }

From feef7e998b7f82cf342c02dca36a03ecf5406d82 Mon Sep 17 00:00:00 2001
From: Svata Dedic 
Date: Wed, 2 Nov 2022 17:38:12 +0100
Subject: [PATCH 26/33] Mark failed audit message as error.

---
 .../netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
index cdf0113711c4..f9c1fd6e9d3c 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
@@ -512,7 +512,7 @@ private String doFindVulnerability(Project project, String compartmentId, String
             }
             if (auditDone) {
                 DialogDisplayer.getDefault().notifyLater(
-                                new NotifyDescriptor.Message(message));
+                                new NotifyDescriptor.Message(message, cacheItem.getAudit().getIsSuccess() ? NotifyDescriptor.INFORMATION_MESSAGE : NotifyDescriptor.ERROR_MESSAGE));
             }
             Diagnostic.ReporterControl reporter = Diagnostic.findReporterControl(Lookup.getDefault(), project.getProjectDirectory());
             reporter.diagnosticChanged(problematicFiles, null);

From 8a18a42c413c88fe021b1e62050a417664b10f2b Mon Sep 17 00:00:00 2001
From: Svata Dedic 
Date: Fri, 4 Nov 2022 13:37:38 +0100
Subject: [PATCH 27/33] Possible NPE fix, DepResult must be computed in
 advance.

---
 .../cloud/oracle/adm/VulnerabilityWorker.java      | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
index cdf0113711c4..deadb7900425 100644
--- a/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
+++ b/enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java
@@ -401,7 +401,6 @@ public String findVulnerability(Project project, AuditOptions auditOptions) thro
 
     private String doFindVulnerability(Project project, String compartmentId, String knowledgeBaseId, String projectDisplayName, AuditOptions auditOptions,
             ProgressHandle progressHandle, AtomicBoolean remoteCall) throws AuditException {
-        DependencyResult dr = null;
         List result = new ArrayList();
         
         CacheItem cacheItem = null;
@@ -409,12 +408,14 @@ private String doFindVulnerability(Project project, String compartmentId, String
         
         boolean auditDone = false;
 
+        DependencyResult dr = null;
+        
         if (!auditOptions.isForceAuditExecution()) {
             try {
                 savedAudit = AuditCache.getInstance().loadAudit(knowledgeBaseId);
             } catch (IOException ex) {
-                LOG.log(Level.WARNING, "Could not load cached audit data", ex);
-            }
+                LOG.log(Level.WARNING, "Could not load cached audit data", ex); 
+           }
 
             if (savedAudit == null) {
                 // attempt to find an active most recent audit:
@@ -489,7 +490,12 @@ private String doFindVulnerability(Project project, String compartmentId, String
             } finally {
                 progressHandle.finish();
             }
-        } else if (savedAudit != null) {
+        } else if (savedAudit != null && cacheItem == null) {
+            if (dr == null) {
+                progressHandle.progress(Bundle.MSG_AuditCollectDependencies());
+                dr = ProjectDependencies.findDependencies(project, ProjectDependencies.newQuery(Scopes.RUNTIME));
+                convert(dr.getRoot(), new HashMap<>(), result);
+            }
             cacheItem = new CacheItem(project, dr, savedAudit);
         }
 

From 12be8c315d8a6d73cba47770b1021d24f93cfbea Mon Sep 17 00:00:00 2001
From: Svata Dedic 
Date: Fri, 4 Nov 2022 13:49:33 +0100
Subject: [PATCH 28/33] Fixed mapping of key/value map-like dependency to the
 source.

---
 .../gradle/java/queries/DependencyText.java   | 14 +++-
 .../java/queries/TextDependencyScanner.java   |  9 +--
 .../dependencies/parse/variousSyntax.gradle   | 48 ++++++++++++
 .../java/queries/RegexpGradleScannerTest.java | 75 +++++++++++++++++++
 4 files changed, 137 insertions(+), 9 deletions(-)
 create mode 100644 java/gradle.java/test/unit/data/dependencies/parse/variousSyntax.gradle

diff --git a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/DependencyText.java b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/DependencyText.java
index bf332f615bfc..0f645397ba82 100644
--- a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/DependencyText.java
+++ b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/DependencyText.java
@@ -22,7 +22,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
-import org.netbeans.modules.gradle.api.GradleDependency;
 import org.netbeans.modules.project.dependency.Dependency;
 import org.netbeans.modules.project.dependency.DependencyResult;
 
@@ -106,6 +105,19 @@ public String toString() {
         sb.append(" [").append(startPos).append(", ").append(endPos).append("]}");
         return sb.toString();
     }
+    
+    public String getContentsOrGav() {
+        if (contents != null) {
+            return contents;
+        } else {
+            StringBuilder sb = new StringBuilder();
+            sb.append(group).append(':').append(name);
+            if (version != null && !version.isEmpty()) {
+                sb.append(':').append(version);
+            }
+            return sb.toString();
+        }
+    }
 
     /**
      * Dependency part information
diff --git a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/TextDependencyScanner.java b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/TextDependencyScanner.java
index 4cc3aa24ffec..d7feffb11e02 100644
--- a/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/TextDependencyScanner.java
+++ b/java/gradle.java/src/org/netbeans/modules/gradle/java/queries/TextDependencyScanner.java
@@ -634,13 +634,6 @@ private void computeGAV() {
                 if (text.group == null || text.name == null) {
                     continue;
                 }
-                StringBuilder sb = new StringBuilder();
-                sb.append(text.group).append(text.name);
-                if (text.version != null) {
-                    sb.append(text.version);
-                } else {
-                    text.version = "";
-                }
             }
         }
     }
@@ -668,7 +661,7 @@ private DependencyText findDependency(Dependency d) {
             if (DependencyText.KEYWORD_PROJECT.equals(t.keyword) &&
                 t.contents.equals(projectName)) {
                 return t;
-            } else if (t.keyword == null && t.contents != null && t.contents.equals(gav)) {
+            } else if (t.keyword == null && t.getContentsOrGav().equals(gav)) {
                 return t;
             }
         }
diff --git a/java/gradle.java/test/unit/data/dependencies/parse/variousSyntax.gradle b/java/gradle.java/test/unit/data/dependencies/parse/variousSyntax.gradle
new file mode 100644
index 000000000000..d3fb44b5b357
--- /dev/null
+++ b/java/gradle.java/test/unit/data/dependencies/parse/variousSyntax.gradle
@@ -0,0 +1,48 @@
+plugins {
+    id("com.github.johnrengelman.shadow") version "7.1.2"
+    id("io.micronaut.application") version "3.6.3"
+}
+version = "0.1"
+group = "com.example"
+repositories {
+    mavenCentral()
+}
+dependencies {
+    // with parenthesis
+    @@A@@annotationProcessor("io.micronaut:micronaut-http-validation")@@A@@
+    // without parenthesis
+    @@B@@implementation "io.micronaut:micronaut-http-client"@@B@@
+    // several deps in a common group
+    implementation(
+        @@C@@'io.micronaut:micronaut-jackson-databind'@@C@@,
+        @@D@@"jakarta.annotation:jakarta.annotation-api"@@D@@
+    )
+    // with a closure
+    @@E@@runtimeOnly("ch.qos.logback:logback-classic") {
+        transitive = true
+    }@@E@@
+    // map in parenthesis
+    @@F@@implementation(group : "io.micronaut", name: "micronaut-validation", version: "2.5")@@F@@
+    // list of maps in parenthesis
+    runtimeOnly(
+        @@G@@[group: 'org.hibernate', name: 'hibernate', version: '3.0.5', transitive: true]@@G@@,
+        @@H@@[group:'org.ow2.asm', name:'asm', version:'7.1']@@H@@
+    )
+    @@I@@implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.0'@@I@@
+}
+application {
+    mainClass.set("com.example.Application")
+}
+java {
+    sourceCompatibility = JavaVersion.toVersion("17")
+    targetCompatibility = JavaVersion.toVersion("17")
+}
+graalvmNative.toolchainDetection = false
+micronaut {
+    runtime("netty")
+    testRuntime("junit5")
+    processing {
+        incremental(true)
+        annotations("com.example.*")
+    }
+}
diff --git a/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/queries/RegexpGradleScannerTest.java b/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/queries/RegexpGradleScannerTest.java
index 3b95b650348b..ace9d9d80bdf 100644
--- a/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/queries/RegexpGradleScannerTest.java
+++ b/java/gradle.java/test/unit/src/org/netbeans/modules/gradle/java/queries/RegexpGradleScannerTest.java
@@ -18,13 +18,20 @@
  */
 package org.netbeans.modules.gradle.java.queries;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.project.dependency.ArtifactSpec;
+import org.netbeans.modules.project.dependency.Dependency;
+import org.netbeans.modules.project.dependency.ProjectSpec;
+import org.netbeans.modules.project.dependency.Scopes;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 
@@ -84,6 +91,7 @@ public void testScanSimpleScript() throws Exception {
         List deps = scanner.parseDependencyList(filteredText);
         assertEquals(12, deps.size());
         checkDependencyBoundaries(deps);
+        checkDependencyMap(scanner, deps);
     }
     
     public void testMicronautStarter() throws Exception {
@@ -96,11 +104,78 @@ public void testMicronautStarter() throws Exception {
         filteredText = filterAndStorePositions(f.asText());
         List deps = scanner.parseDependencyList(filteredText);
         assertEquals(7, deps.size());
+        checkDependencyMap(scanner, deps);
+    }
+    
+    private static final List expectedGavs = Arrays.asList(
+            "io.micronaut:micronaut-http-validation",
+            "io.micronaut:micronaut-http-client",
+            "io.micronaut:micronaut-jackson-databind",
+            "jakarta.annotation:jakarta.annotation-api",
+            "ch.qos.logback:logback-classic",
+            "io.micronaut:micronaut-validation:2.5",
+            "org.hibernate:hibernate:3.0.5",
+            "org.ow2.asm:asm:7.1",
+            "org.apache.logging.log4j:log4j-core:2.17.0"
+    );
+    
+    /**
+     * Checks that various declaration syntaxes are understood well by the parser.
+     */
+    public void testVariousSyntaxes() throws Exception {
+        FileObject f = FileUtil.toFileObject(getDataDir()).getFileObject("dependencies/parse/variousSyntax.gradle");
+        TextDependencyScanner scanner = new TextDependencyScanner();
+        
+        filteredText = filterAndStorePositions(f.asText());
+        scanner.withConfigurations(Arrays.asList(
+            "runtimeOnly", "implementation", "annotationProcessor"
+        ));
+        List deps = scanner.parseDependencyList(filteredText);
+        List gavs = deps.stream().map(DependencyText::getContentsOrGav).collect(Collectors.toList());
+        assertEquals(expectedGavs, gavs);
+        checkDependencyBoundaries(deps);
+        checkDependencyMap(scanner, deps);
+    }
+    
+    public void testMapLikeDeclaration() throws Exception {
+        FileObject f = FileUtil.toFileObject(getDataDir()).getFileObject("dependencies/parse/variousSyntax.gradle");
+        TextDependencyScanner scanner = new TextDependencyScanner();
+        
+        filteredText = filterAndStorePositions(f.asText());
+        scanner.withConfigurations(Arrays.asList(
+            "runtimeOnly", "implementation", "annotationProcessor"
+        ));
+        List deps = scanner.parseDependencyList(filteredText);
+        assertNotNull(deps);
+        checkDependencyBoundaries(deps);
+        checkDependencyMap(scanner, deps);
     }
     
     private Map startPosition = new HashMap<>();
     private Map endPosition = new HashMap<>();
     
+    private void checkDependencyMap(TextDependencyScanner scanner, List deps) {
+        List list = new ArrayList<>();
+        for (DependencyText t : deps) {
+            if (t.keyword == null && t.name != null && t.group != null && t.version != null) {
+                ArtifactSpec as = ArtifactSpec.builder(t.group, t.name, t.version, null).build();
+                Dependency d = Dependency.create(as, Scopes.RUNTIME, Collections.emptyList(), null);
+                list.add(d);
+            } else if ("project".equals(t.keyword)) {
+                ProjectSpec p = ProjectSpec.create(t.contents, null);
+                ArtifactSpec as = ArtifactSpec.builder(t.group, t.name, t.version, null).build();
+                Dependency d = Dependency.create(p, as, Scopes.RUNTIME, Collections.emptyList(), null);
+                list.add(d);
+            }
+        }
+        
+        DependencyText.Mapping mapping = scanner.mapDependencies(list);
+        for (Dependency d : list) {
+            DependencyText.Part found = mapping.getText(d, null);
+            assertNotNull(found);
+        }
+    }
+    
     private void checkDependencyBoundaries(List deps) {
         int pos = 0;
         for (DependencyText d : deps) {

From 01325508d998d5d5b0d02b31b3514a4aeee0f24c Mon Sep 17 00:00:00 2001
From: Jan Lahoda 
Date: Sat, 5 Nov 2022 07:00:36 +0100
Subject: [PATCH 29/33] Fixing dependencies.

---
 java/java.sourceui/nbproject/project.xml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/java/java.sourceui/nbproject/project.xml b/java/java.sourceui/nbproject/project.xml
index 84a7a656469d..9ac80a3c0929 100644
--- a/java/java.sourceui/nbproject/project.xml
+++ b/java/java.sourceui/nbproject/project.xml
@@ -78,6 +78,14 @@
                         1.40
                     
                 
+                
+                    org.netbeans.lib.nbjavac
+                    
+                    
+                    
+                        
+                    
+                
                 
                     org.netbeans.libs.javacapi
                     

From fb164d7cb84e12f53dd5cba516ae5f9afc03d1bb Mon Sep 17 00:00:00 2001
From: Jan Lahoda 
Date: Sun, 6 Nov 2022 06:21:03 +0100
Subject: [PATCH 30/33] Cleanup, running tests on JDK 11.

---
 .github/workflows/main.yml                                  | 4 ++++
 .../src/org/netbeans/api/java/source/ui/ElementJavadoc.java | 6 ------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 93992ae48580..d740ff4f8f83 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1248,6 +1248,10 @@ jobs:
         if: env.test_java == 'true' && success()
         run: ant $OPTS $OPTS_11 -f java/java.completion test
 
+      - name: java.editor
+        if: env.test_java == 'true' && success()
+        run: ant $OPTs $OPTS_11 -f java/java.editor test-unit
+
       - name: java/java.source
         run: ant $OPTS $OPTS_11 -f java/java.source test-unit
 
diff --git a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
index d26bf1e55b26..64e081a1e9a2 100644
--- a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
+++ b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java
@@ -101,7 +101,6 @@
 import org.netbeans.api.java.source.JavaSource.Phase;
 import org.netbeans.api.java.source.SourceUtils;
 import org.netbeans.modules.java.preprocessorbridge.api.JavaSourceUtil;
-import org.netbeans.modules.java.source.TreeShims;
 import org.netbeans.modules.java.source.JavadocHelper;
 import org.netbeans.modules.java.source.parsing.FileObjects;
 import org.netbeans.spi.java.classpath.support.ClassPathSupport;
@@ -112,19 +111,14 @@
 import org.openide.util.RequestProcessor;
 import org.openide.xml.XMLUtil;
 
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.ToolProvider;
 import com.sun.source.tree.ImportTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.code.ClassFinder;
 import org.netbeans.api.java.queries.SourceLevelQuery;
 import org.netbeans.api.java.queries.SourceLevelQuery.Profile;
 import org.netbeans.api.java.source.ui.snippet.MarkupTagProcessor;
-import org.netbeans.modules.java.source.indexing.APTUtils;
-import org.netbeans.modules.java.source.indexing.FQN2Files;
 import org.netbeans.modules.java.source.parsing.JavacParser;
 import org.openide.filesystems.FileSystem;
 

From f276f4d2cb6ed78984edb42e06ae84cb8e66baab Mon Sep 17 00:00:00 2001
From: Jan Lahoda 
Date: Sun, 6 Nov 2022 09:18:03 +0100
Subject: [PATCH 31/33] Resolving golden files for DelegateMethodGeneratorTest

---
 .../11/testMethodProposals2.pass              | 46 +++++++++++
 .../11/testMethodProposals3.pass              | 75 +++++++++++++++++
 .../12/testMethodProposals3.pass              | 79 ++++++++++++++++++
 .../13/testMethodProposals3.pass              | 82 +++++++++++++++++++
 .../17/testGenerate129140.pass                | 18 ----
 .../17/testGenerate133625a.pass               | 18 ----
 .../17/testGenerate133625b.pass               | 18 ----
 .../17/testGenerate133625c.pass               | 19 -----
 .../17/testGenerate133625d.pass               | 18 ----
 .../17/testMethodProposals1.pass              |  5 --
 .../codegen/DelegateMethodGeneratorTest.java  | 29 ++++++-
 11 files changed, 308 insertions(+), 99 deletions(-)
 create mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals2.pass
 create mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals3.pass
 create mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/12/testMethodProposals3.pass
 create mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/13/testMethodProposals3.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate129140.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625a.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625b.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625c.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625d.pass
 delete mode 100644 java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testMethodProposals1.pass

diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals2.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals2.pass
new file mode 100644
index 000000000000..7f7719992435
--- /dev/null
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals2.pass
@@ -0,0 +1,46 @@
+public abstract E get(int)
+public abstract E remove(int)
+public abstract E set(int,E)
+public abstract T[] toArray(T[])
+public abstract boolean add(E)
+public abstract boolean addAll(int,java.util.Collection)
+public abstract boolean addAll(java.util.Collection)
+public abstract boolean contains(java.lang.Object)
+public abstract boolean containsAll(java.util.Collection)
+public abstract boolean equals(java.lang.Object)
+public abstract boolean isEmpty()
+public abstract boolean remove(java.lang.Object)
+public abstract boolean removeAll(java.util.Collection)
+public abstract boolean retainAll(java.util.Collection)
+public abstract int hashCode()
+public abstract int indexOf(java.lang.Object)
+public abstract int lastIndexOf(java.lang.Object)
+public abstract int size()
+public abstract java.lang.Object[] toArray()
+public abstract java.util.Iterator iterator()
+public abstract java.util.List subList(int,int)
+public abstract java.util.ListIterator listIterator()
+public abstract java.util.ListIterator listIterator(int)
+public abstract void add(int,E)
+public abstract void clear()
+public default T[] toArray(java.util.function.IntFunction)
+public default boolean removeIf(java.util.function.Predicate)
+public default java.util.Spliterator spliterator()
+public default java.util.stream.Stream parallelStream()
+public default java.util.stream.Stream stream()
+public default void forEach(java.util.function.Consumer)
+public default void replaceAll(java.util.function.UnaryOperator)
+public default void sort(java.util.Comparator)
+public static java.util.List copyOf(java.util.Collection)
+public static java.util.List of()
+public static java.util.List of(E)
+public static java.util.List of(E,E)
+public static java.util.List of(E,E,E)
+public static java.util.List of(E,E,E,E)
+public static java.util.List of(E,E,E,E,E)
+public static java.util.List of(E,E,E,E,E,E)
+public static java.util.List of(E,E,E,E,E,E,E)
+public static java.util.List of(E,E,E,E,E,E,E,E)
+public static java.util.List of(E,E,E,E,E,E,E,E,E)
+public static java.util.List of(E,E,E,E,E,E,E,E,E,E)
+public static java.util.List of(E...)
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals3.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals3.pass
new file mode 100644
index 000000000000..2033f1f4ec56
--- /dev/null
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/11/testMethodProposals3.pass
@@ -0,0 +1,75 @@
+public boolean contains(java.lang.CharSequence)
+public boolean contentEquals(java.lang.CharSequence)
+public boolean contentEquals(java.lang.StringBuffer)
+public boolean endsWith(java.lang.String)
+public boolean equals(java.lang.Object)
+public boolean equalsIgnoreCase(java.lang.String)
+public boolean isBlank()
+public boolean isEmpty()
+public boolean matches(java.lang.String)
+public boolean regionMatches(boolean,int,java.lang.String,int,int)
+public boolean regionMatches(int,java.lang.String,int,int)
+public boolean startsWith(java.lang.String)
+public boolean startsWith(java.lang.String,int)
+public byte[] getBytes()
+public byte[] getBytes(java.lang.String)
+public byte[] getBytes(java.nio.charset.Charset)
+public char charAt(int)
+public char[] toCharArray()
+public int codePointAt(int)
+public int codePointBefore(int)
+public int codePointCount(int,int)
+public int compareTo(java.lang.String)
+public int compareToIgnoreCase(java.lang.String)
+public int hashCode()
+public int indexOf(int)
+public int indexOf(int,int)
+public int indexOf(java.lang.String)
+public int indexOf(java.lang.String,int)
+public int lastIndexOf(int)
+public int lastIndexOf(int,int)
+public int lastIndexOf(java.lang.String)
+public int lastIndexOf(java.lang.String,int)
+public int length()
+public int offsetByCodePoints(int,int)
+public java.lang.CharSequence subSequence(int,int)
+public java.lang.String concat(java.lang.String)
+public java.lang.String repeat(int)
+public java.lang.String replace(char,char)
+public java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence)
+public java.lang.String replaceAll(java.lang.String,java.lang.String)
+public java.lang.String replaceFirst(java.lang.String,java.lang.String)
+public java.lang.String strip()
+public java.lang.String stripLeading()
+public java.lang.String stripTrailing()
+public java.lang.String substring(int)
+public java.lang.String substring(int,int)
+public java.lang.String toLowerCase()
+public java.lang.String toLowerCase(java.util.Locale)
+public java.lang.String toString()
+public java.lang.String toUpperCase()
+public java.lang.String toUpperCase(java.util.Locale)
+public java.lang.String trim()
+public java.lang.String[] split(java.lang.String)
+public java.lang.String[] split(java.lang.String,int)
+public java.util.stream.IntStream chars()
+public java.util.stream.IntStream codePoints()
+public java.util.stream.Stream lines()
+public native java.lang.String intern()
+public static java.lang.String copyValueOf(char[])
+public static java.lang.String copyValueOf(char[],int,int)
+public static java.lang.String format(java.lang.String,java.lang.Object...)
+public static java.lang.String format(java.util.Locale,java.lang.String,java.lang.Object...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.CharSequence...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.Iterable)
+public static java.lang.String valueOf(boolean)
+public static java.lang.String valueOf(char)
+public static java.lang.String valueOf(char[])
+public static java.lang.String valueOf(char[],int,int)
+public static java.lang.String valueOf(double)
+public static java.lang.String valueOf(float)
+public static java.lang.String valueOf(int)
+public static java.lang.String valueOf(java.lang.Object)
+public static java.lang.String valueOf(long)
+public void getBytes(int,int,byte[],int)
+public void getChars(int,int,char[],int)
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/12/testMethodProposals3.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/12/testMethodProposals3.pass
new file mode 100644
index 000000000000..a8b92cac0756
--- /dev/null
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/12/testMethodProposals3.pass
@@ -0,0 +1,79 @@
+public R transform(java.util.function.Function)
+public boolean contains(java.lang.CharSequence)
+public boolean contentEquals(java.lang.CharSequence)
+public boolean contentEquals(java.lang.StringBuffer)
+public boolean endsWith(java.lang.String)
+public boolean equals(java.lang.Object)
+public boolean equalsIgnoreCase(java.lang.String)
+public boolean isBlank()
+public boolean isEmpty()
+public boolean matches(java.lang.String)
+public boolean regionMatches(boolean,int,java.lang.String,int,int)
+public boolean regionMatches(int,java.lang.String,int,int)
+public boolean startsWith(java.lang.String)
+public boolean startsWith(java.lang.String,int)
+public byte[] getBytes()
+public byte[] getBytes(java.lang.String)
+public byte[] getBytes(java.nio.charset.Charset)
+public char charAt(int)
+public char[] toCharArray()
+public int codePointAt(int)
+public int codePointBefore(int)
+public int codePointCount(int,int)
+public int compareTo(java.lang.String)
+public int compareToIgnoreCase(java.lang.String)
+public int hashCode()
+public int indexOf(int)
+public int indexOf(int,int)
+public int indexOf(java.lang.String)
+public int indexOf(java.lang.String,int)
+public int lastIndexOf(int)
+public int lastIndexOf(int,int)
+public int lastIndexOf(java.lang.String)
+public int lastIndexOf(java.lang.String,int)
+public int length()
+public int offsetByCodePoints(int,int)
+public java.lang.CharSequence subSequence(int,int)
+public java.lang.String concat(java.lang.String)
+public java.lang.String indent(int)
+public java.lang.String repeat(int)
+public java.lang.String replace(char,char)
+public java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence)
+public java.lang.String replaceAll(java.lang.String,java.lang.String)
+public java.lang.String replaceFirst(java.lang.String,java.lang.String)
+public java.lang.String resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup)
+public java.lang.String strip()
+public java.lang.String stripLeading()
+public java.lang.String stripTrailing()
+public java.lang.String substring(int)
+public java.lang.String substring(int,int)
+public java.lang.String toLowerCase()
+public java.lang.String toLowerCase(java.util.Locale)
+public java.lang.String toString()
+public java.lang.String toUpperCase()
+public java.lang.String toUpperCase(java.util.Locale)
+public java.lang.String trim()
+public java.lang.String[] split(java.lang.String)
+public java.lang.String[] split(java.lang.String,int)
+public java.util.Optional describeConstable()
+public java.util.stream.IntStream chars()
+public java.util.stream.IntStream codePoints()
+public java.util.stream.Stream lines()
+public native java.lang.String intern()
+public static java.lang.String copyValueOf(char[])
+public static java.lang.String copyValueOf(char[],int,int)
+public static java.lang.String format(java.lang.String,java.lang.Object...)
+public static java.lang.String format(java.util.Locale,java.lang.String,java.lang.Object...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.CharSequence...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.Iterable)
+public static java.lang.String valueOf(boolean)
+public static java.lang.String valueOf(char)
+public static java.lang.String valueOf(char[])
+public static java.lang.String valueOf(char[],int,int)
+public static java.lang.String valueOf(double)
+public static java.lang.String valueOf(float)
+public static java.lang.String valueOf(int)
+public static java.lang.String valueOf(java.lang.Object)
+public static java.lang.String valueOf(long)
+public void getBytes(int,int,byte[],int)
+public void getChars(int,int,char[],int)
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/13/testMethodProposals3.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/13/testMethodProposals3.pass
new file mode 100644
index 000000000000..543382cc4aca
--- /dev/null
+++ b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/13/testMethodProposals3.pass
@@ -0,0 +1,82 @@
+public R transform(java.util.function.Function)
+public boolean contains(java.lang.CharSequence)
+public boolean contentEquals(java.lang.CharSequence)
+public boolean contentEquals(java.lang.StringBuffer)
+public boolean endsWith(java.lang.String)
+public boolean equals(java.lang.Object)
+public boolean equalsIgnoreCase(java.lang.String)
+public boolean isBlank()
+public boolean isEmpty()
+public boolean matches(java.lang.String)
+public boolean regionMatches(boolean,int,java.lang.String,int,int)
+public boolean regionMatches(int,java.lang.String,int,int)
+public boolean startsWith(java.lang.String)
+public boolean startsWith(java.lang.String,int)
+public byte[] getBytes()
+public byte[] getBytes(java.lang.String)
+public byte[] getBytes(java.nio.charset.Charset)
+public char charAt(int)
+public char[] toCharArray()
+public int codePointAt(int)
+public int codePointBefore(int)
+public int codePointCount(int,int)
+public int compareTo(java.lang.String)
+public int compareToIgnoreCase(java.lang.String)
+public int hashCode()
+public int indexOf(int)
+public int indexOf(int,int)
+public int indexOf(java.lang.String)
+public int indexOf(java.lang.String,int)
+public int lastIndexOf(int)
+public int lastIndexOf(int,int)
+public int lastIndexOf(java.lang.String)
+public int lastIndexOf(java.lang.String,int)
+public int length()
+public int offsetByCodePoints(int,int)
+public java.lang.CharSequence subSequence(int,int)
+public java.lang.String concat(java.lang.String)
+public java.lang.String formatted(java.lang.Object...)
+public java.lang.String indent(int)
+public java.lang.String repeat(int)
+public java.lang.String replace(char,char)
+public java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence)
+public java.lang.String replaceAll(java.lang.String,java.lang.String)
+public java.lang.String replaceFirst(java.lang.String,java.lang.String)
+public java.lang.String resolveConstantDesc(java.lang.invoke.MethodHandles.Lookup)
+public java.lang.String strip()
+public java.lang.String stripIndent()
+public java.lang.String stripLeading()
+public java.lang.String stripTrailing()
+public java.lang.String substring(int)
+public java.lang.String substring(int,int)
+public java.lang.String toLowerCase()
+public java.lang.String toLowerCase(java.util.Locale)
+public java.lang.String toString()
+public java.lang.String toUpperCase()
+public java.lang.String toUpperCase(java.util.Locale)
+public java.lang.String translateEscapes()
+public java.lang.String trim()
+public java.lang.String[] split(java.lang.String)
+public java.lang.String[] split(java.lang.String,int)
+public java.util.Optional describeConstable()
+public java.util.stream.IntStream chars()
+public java.util.stream.IntStream codePoints()
+public java.util.stream.Stream lines()
+public native java.lang.String intern()
+public static java.lang.String copyValueOf(char[])
+public static java.lang.String copyValueOf(char[],int,int)
+public static java.lang.String format(java.lang.String,java.lang.Object...)
+public static java.lang.String format(java.util.Locale,java.lang.String,java.lang.Object...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.CharSequence...)
+public static java.lang.String join(java.lang.CharSequence,java.lang.Iterable)
+public static java.lang.String valueOf(boolean)
+public static java.lang.String valueOf(char)
+public static java.lang.String valueOf(char[])
+public static java.lang.String valueOf(char[],int,int)
+public static java.lang.String valueOf(double)
+public static java.lang.String valueOf(float)
+public static java.lang.String valueOf(int)
+public static java.lang.String valueOf(java.lang.Object)
+public static java.lang.String valueOf(long)
+public void getBytes(int,int,byte[],int)
+public void getChars(int,int,char[],int)
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate129140.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate129140.pass
deleted file mode 100644
index c8edec6d03f9..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate129140.pass
+++ /dev/null
@@ -1,18 +0,0 @@
-package test;
-
-import java.util.List;
-
-public class MethodProposals {
-
-    private Auxiliary a;
-    private List l;
-    private String s;
-    private List ll;
-    private List lext;
-    private List lsup;
-    private List lub;
-
-    public  T[] toArray(T[] ts) {
-        return ll.toArray(ts);
-    }
-}
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625a.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625a.pass
deleted file mode 100644
index b8ee04789d58..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625a.pass
+++ /dev/null
@@ -1,18 +0,0 @@
-package test;
-
-import java.util.List;
-
-public class MethodProposals {
-
-    private Auxiliary a;
-    private List l;
-    private String s;
-    private List ll;
-    private List lext;
-    private List lsup;
-    private List lub;
-
-    public boolean add(String e) {
-        return lext.add(e);
-    }
-}
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625b.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625b.pass
deleted file mode 100644
index d34800cce5aa..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625b.pass
+++ /dev/null
@@ -1,18 +0,0 @@
-package test;
-
-import java.util.List;
-
-public class MethodProposals {
-
-    private Auxiliary a;
-    private List l;
-    private String s;
-    private List ll;
-    private List lext;
-    private List lsup;
-    private List lub;
-
-    public boolean add(String e) {
-        return lsup.add(e);
-    }
-}
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625c.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625c.pass
deleted file mode 100644
index 90163e756177..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625c.pass
+++ /dev/null
@@ -1,19 +0,0 @@
-package test;
-
-import java.util.Collection;
-import java.util.List;
-
-public class MethodProposals {
-
-    private Auxiliary a;
-    private List l;
-    private String s;
-    private List ll;
-    private List lext;
-    private List lsup;
-    private List lub;
-
-    public boolean addAll(Collection clctn) {
-        return lsup.addAll(clctn);
-    }
-}
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625d.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625d.pass
deleted file mode 100644
index 0adc534a757e..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testGenerate133625d.pass
+++ /dev/null
@@ -1,18 +0,0 @@
-package test;
-
-import java.util.List;
-
-public class MethodProposals {
-
-    private Auxiliary a;
-    private List l;
-    private String s;
-    private List ll;
-    private List lext;
-    private List lsup;
-    private List lub;
-
-    public boolean add(Object e) {
-        return lub.add(e);
-    }
-}
diff --git a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testMethodProposals1.pass b/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testMethodProposals1.pass
deleted file mode 100644
index 5e3abe216254..000000000000
--- a/java/java.editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest/17/testMethodProposals1.pass
+++ /dev/null
@@ -1,5 +0,0 @@
-protected void test2()
-public java.lang.String toString()
-public static void test5()
-public void test1()
-void test3()
diff --git a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest.java b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest.java
index a3be1601b57e..1956d4d7e5d6 100644
--- a/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest.java
+++ b/java/java.editor/test/unit/src/org/netbeans/modules/java/editor/codegen/DelegateMethodGeneratorTest.java
@@ -160,7 +160,7 @@ public void run(CompilationController parameter) throws Exception {
         }, true);
 
         String version = System.getProperty("java.specification.version") + "/";
-        compareReferenceFiles(this.getName()+".ref",version+this.getName()+".pass",this.getName()+".diff");
+        compareReferenceFiles(this.getName()+".ref", findGoldenFile(), this.getName()+".diff");
     }
      
     private void performMethodProposalsTest(final String name) throws Exception {
@@ -229,8 +229,7 @@ private void compareMethodProposals(CompilationInfo info, ElementNode.Descriptio
             ref(s);
         }
         
-        String version = System.getProperty("java.specification.version") + "/";
-        compareReferenceFiles(this.getName()+".ref",version+this.getName()+".pass",this.getName()+".diff");
+        compareReferenceFiles(this.getName()+".ref", findGoldenFile(), this.getName()+".diff");
     }
     
     private String dump(ExecutableElement ee) {
@@ -246,6 +245,30 @@ private String dump(ExecutableElement ee) {
         return result.toString();
     }
 
+    public String findGoldenFile() {
+        String version = System.getProperty("java.specification.version");
+        for (String variant : computeVersionVariantsFor(version)) {
+            String path = variant + "/" + this.getName() + ".pass";
+            File goldenFile = new File(getDataDir()+"/goldenfiles/"+ getClass().getName().replace(".", "/") + "/" + path);
+            if (goldenFile.exists())
+                return path;
+        }
+        throw new AssertionError();
+    }
+
+    private List computeVersionVariantsFor(String version) {
+        int dot = version.indexOf('.');
+        version = version.substring(dot + 1);
+        int versionNum = Integer.parseInt(version);
+        List versions = new ArrayList<>();
+
+        for (int v = versionNum; v >= 8; v--) {
+            versions.add(v != 8 ? "" + v : "1." + v);
+        }
+
+        return versions;
+    }
+
     private FileObject testSourceFO;
     private JavaSource source;
     

From 9ed27cffeaa0b02411de5e3d2f20c7e4129379f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= 
Date: Tue, 8 Nov 2022 22:27:47 +0100
Subject: [PATCH 32/33] db.mysql: Bump connector/j version to prevent unittest
 failures ran against newer mysql server

---
 ide/db.mysql/external/binaries-list           |    2 +-
 ...t => mysql-connector-j-8.0.31-license.txt} | 1101 +++++------------
 ide/db.mysql/nbproject/project.properties     |    2 +-
 nbbuild/licenses/GPL-mysql-connector          | 1099 +++++-----------
 4 files changed, 561 insertions(+), 1643 deletions(-)
 rename ide/db.mysql/external/{mysql-connector-java-8.0.17-license.txt => mysql-connector-j-8.0.31-license.txt} (58%)

diff --git a/ide/db.mysql/external/binaries-list b/ide/db.mysql/external/binaries-list
index a0c50ecfccc5..323f53cc6e24 100644
--- a/ide/db.mysql/external/binaries-list
+++ b/ide/db.mysql/external/binaries-list
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-53DA6AFDC5F7B45CAAA5BC3627028B2041A36CEE mysql:mysql-connector-java:8.0.17
+3FD5850719D7E82D50705D34CC6A0037FAB5731F com.mysql:mysql-connector-j:8.0.31
diff --git a/ide/db.mysql/external/mysql-connector-java-8.0.17-license.txt b/ide/db.mysql/external/mysql-connector-j-8.0.31-license.txt
similarity index 58%
rename from ide/db.mysql/external/mysql-connector-java-8.0.17-license.txt
rename to ide/db.mysql/external/mysql-connector-j-8.0.31-license.txt
index f5de63322a78..eeaa4f59b35e 100644
--- a/ide/db.mysql/external/mysql-connector-java-8.0.17-license.txt
+++ b/ide/db.mysql/external/mysql-connector-j-8.0.31-license.txt
@@ -1,5 +1,5 @@
 Name: MySQL Connector/J
-Version: 8.0.17
+Version: 8.0.31
 License: GPL-mysql-connector
 Type: compile-time
 Comment: Dependency required to run unit tests with DB support
@@ -18,7 +18,7 @@ Introduction
    third-party software which may be included in this distribution of
    MySQL Connector/J 8.0.
 
-   Last updated: June 2019
+   Last updated: August 2022
 
 Licensing Information
 
@@ -41,8 +41,7 @@ Licensing Information
    a copy of which is reproduced below and can also be found along with
    its FAQ at http://oss.oracle.com/licenses/universal-foss-exception.
 
-   Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights
-   reserved.
+   Copyright (c) 2017, 2022, Oracle and/or its affiliates.
 
 Election of GPLv2
 
@@ -67,6 +66,11 @@ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 either express or implied. See the License for the specific language
 governing permissions and limitations under the License.
 
+
+  ======================================================================
+  ======================================================================
+
+
 GNU GENERAL PUBLIC LICENSE
 Version 2, June 1991
 
@@ -146,7 +150,6 @@ is covered only if its contents constitute a work based on the
 Program (independent of having been made by running the Program).
 Whether that is true depends on what the Program does.
 
-
   1. You may copy and distribute verbatim copies of the Program's
 source code as you receive it, in any medium, provided that you
 conspicuously and appropriately publish on each copy an appropriate
@@ -158,7 +161,6 @@ along with the Program.
 You may charge a fee for the physical act of transferring a copy, and
 you may at your option offer warranty protection in exchange for a fee.
 
-
   2. You may modify your copy or copies of the Program or any portion
 of it, thus forming a work based on the Program, and copy and
 distribute such modifications or work under the terms of Section 1
@@ -203,7 +205,6 @@ with the Program (or with a work based on the Program) on a volume of
 a storage or distribution medium does not bring the other work under
 the scope of this License.
 
-
   3. You may copy and distribute the Program (or a work based on it,
 under Section 2) in object code or executable form under the terms of
 Sections 1 and 2 above provided that you also do one of the following:
@@ -243,7 +244,6 @@ access to copy the source code from the same place counts as
 distribution of the source code, even though third parties are not
 compelled to copy the source along with the object code.
 
-
   4. You may not copy, modify, sublicense, or distribute the Program
 except as expressly provided under this License.  Any attempt
 otherwise to copy, modify, sublicense or distribute the Program is
@@ -252,7 +252,6 @@ However, parties who have received copies, or rights, from you under
 this License will not have their licenses terminated so long as such
 parties remain in full compliance.
 
-
   5. You are not required to accept this License, since you have not
 signed it.  However, nothing else grants you permission to modify or
 distribute the Program or its derivative works.  These actions are
@@ -262,7 +261,6 @@ Program), you indicate your acceptance of this License to do so, and
 all its terms and conditions for copying, distributing or modifying
 the Program or works based on it.
 
-
   6. Each time you redistribute the Program (or any work based on the
 Program), the recipient automatically receives a license from the
 original licensor to copy, distribute or modify the Program subject to
@@ -271,7 +269,6 @@ restrictions on the recipients' exercise of the rights granted herein.
 You are not responsible for enforcing compliance by third parties to
 this License.
 
-
   7. If, as a consequence of a court judgment or allegation of patent
 infringement or for any other reason (not limited to patent issues),
 conditions are imposed on you (whether by court order, agreement or
@@ -304,7 +301,6 @@ impose that choice.
 This section is intended to make thoroughly clear what is believed to
 be a consequence of the rest of this License.
 
-
   8. If the distribution and/or use of the Program is restricted in
 certain countries either by patents or by copyrighted interfaces, the
 original copyright holder who places the Program under this License
@@ -313,7 +309,6 @@ those countries, so that distribution is permitted only in or among
 countries not thus excluded.  In such case, this License incorporates
 the limitation as if written in the body of this License.
 
-
   9. The Free Software Foundation may publish revised and/or new
 versions of the General Public License from time to time.  Such new
 versions will be similar in spirit to the present version, but may
@@ -424,6 +419,9 @@ you may consider it more useful to permit linking proprietary
 applications with the library.  If this is what you want to do, use
 the GNU Lesser General Public License instead of this License.
 
+   ======================================================================
+   ======================================================================
+
 The Universal FOSS Exception, Version 1.0
 
    In addition to the rights set forth in the other license(s) included in
@@ -438,6 +436,7 @@ The Universal FOSS Exception, Version 1.0
    Software with Other FOSS, and the constants, function signatures, data
    structures and other invocation methods used to run or interact with
    each of them (as to each, such software's "Interfaces"):
+
     i. The Software's Interfaces may, to the extent permitted by the
        license of the Other FOSS, be copied into, used and distributed in
        the Other FOSS in order to enable interoperability, without
@@ -447,6 +446,7 @@ The Universal FOSS Exception, Version 1.0
        including without limitation as used in the Other FOSS (which upon
        any such use also then contains a portion of the Software under the
        Software License).
+
    ii. The Other FOSS's Interfaces may, to the extent permitted by the
        license of the Other FOSS, be copied into, used and distributed in
        the Software in order to enable interoperability, without requiring
@@ -454,6 +454,7 @@ The Universal FOSS Exception, Version 1.0
        License or otherwise altering their original terms, if this does
        not require any portion of the Software other than such Interfaces
        to be licensed under the terms other than the Software License.
+
    iii. If only Interfaces and no other code is copied between the
        Software and the Other FOSS in either direction, the use and/or
        distribution of the Software with the Other FOSS shall not be
@@ -475,103 +476,281 @@ The Universal FOSS Exception, Version 1.0
        of any kind for use or distribution of the Software in conjunction
        with software other than Other FOSS.
 
+   ======================================================================
+   ======================================================================
+
 Licenses for Third-Party Components
 
    The following sections contain licensing information for libraries that
-   we have included with the MySQL Connector/J 8.0 source and components
-   used to test MySQL Connector/J 8.0. Commonly used licenses referenced
-   herein can be found in Commonly Used Licenses. We are thankful to all
-   individuals that have created these.
+   may be included with this product. We are thankful to all individuals
+   that have created these. Standard licenses referenced herein are
+   detailed in the Standard Licenses section.
 
-Ant-Contrib
+c3p0 JDBC Library
 
-   The following software may be included in this product:
-Ant-Contrib
-Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
-Licensed under the Apache 1.1 License Agreement, a copy of which is reproduced b
-elow.
+   The MySQL Connector/J implements interfaces that are included in c3p0,
+   although no part of c3p0 is included or distributed with MySQL.
 
-The Apache Software License, Version 1.1
+Copyright (C) 2019 Machinery For Change, Inc.
 
-Copyright (c) 2001-2003 Ant-Contrib project.  All rights reserved.
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of EITHER:
+ *
+ *     1) The GNU Lesser General Public License (LGPL), version 2.1, as
+ *        published by the Free Software Foundation
+ *
+ * OR
+ *
+ *     2) The Eclipse Public License (EPL), version 1.0
+ * You may choose which license to accept if you wish to redistribute
+ * or modify this work. You may offer derivatives of this work
+ * under the license you have chosen, or you may provide the same
+ * choice of license which you have been offered here.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received copies of both LGPL v2.1 and EPL v1.0
+ * along with this software; see the files LICENSE-EPL and LICENSE-LGPL.
+ * If not, the text of these licenses are currently available at
+ *
+ * LGPL v2.1: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
+ *  EPL v1.0: http://www.eclipse.org/org/documents/epl-v10.php
 
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
+Eclipse Public License - v 1.0
 
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
+CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
+1. DEFINITIONS
 
+"Contribution" means:
 
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
+a) in the case of the initial Contributor, the initial code and documentation
 
+   distributed under this Agreement, and
 
- 3. The end-user documentation included with the redistribution, if
-    any, must include the following acknowlegement:
-       "This product includes software developed by the
-        Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
-    Alternately, this acknowlegement may appear in the software itself,
-    if and wherever such third-party acknowlegements normally appear.
+b) in the case of each subsequent Contributor:
 
+    i) changes to the Program, and
 
- 4. The name Ant-Contrib must not be used to endorse or promote
-    products derived from this software without prior written
-    permission. For written permission, please contact
-    ant-contrib-developers@lists.sourceforge.net.
+   ii) additions to the Program;
 
+where such changes and/or additions to the Program originate from and are
+distributed by that particular Contributor. A Contribution 'originates' from a
+Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additionsto
+the Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
 
- 5. Products derived from this software may not be called "Ant-Contrib"
-    nor may "Ant-Contrib" appear in their names without prior written
-    permission of the Ant-Contrib project.
+"Contributor" means any person or entity that distributes the Program.
 
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED.  IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
+"Licensed Patents " mean patent claims licensable by a Contributor which are
+necessarily infringed by the use or sale of its Contribution alone or when
+combined with the Program.
 
-c3p0 JDBC Library
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
 
-   This product may include a copy of c3p0-0.9.1-pre6.jar in both source
-   and object code in the following /src/lib/c3p0-0.9.1-pre6.jar. The
-   terms of the Oracle license do NOT apply to c3p0-0.9.1-pre6.jar; it is
-   licensed under the following license, separately from the Oracle
-   programs you receive. If you do not wish to install this library, you
-   may remove the file /src/lib/c3p0-0.9.1-pre6.jar, but the Oracle
-   program might not operate properly or at all without the library.
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free copyright license to
+reproduce, prepare derivative works of, publicly display, publicly perform,
+distribute and sublicense the Contribution of such Contributor, if any, and such
+derivative works, in source code and object code form.
 
-   This component is licensed under GNU Lesser General Public License
-   Version 2.1, February 1999.
+b) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
+Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form.
+This patent license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other combinations
+which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to
+its Contributions set forth herein, no assurances are provided by any
+Contributor that the Program does not infringe the patent or other intellectual
+property rights of any other entity. Each Contributor disclaims any liability to
+Recipient for claims brought by any other entity based on infringement of
+intellectual property rights or otherwise. As a condition to exercising the
+rights and licenses granted hereunder, each Recipient hereby assumes sole
+responsibility to secure any other intellectual property rights needed, if any.
+For example, if a third party patent license is required to allow Recipient to
+distribute the Program, it is Recipient's responsibility to acquire that license
+before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright license
+set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under
+its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+     i) effectively disclaims on behalf of all Contributors all warranties
+        and conditions, express and implied, including warranties or conditions
+        of title and non-infringement, and implied warranties or conditions of
+        merchantability and fitness for a particular purpose;
+
+    ii) effectively excludes on behalf of all Contributors all liability for
+        damages, including direct, indirect, special, incidental and
+        consequential damages, such as lost profits;
+
+   iii) states that any provisions which differ from this Agreement are
+        offered by that Contributor alone and not by any other party; and
+
+    iv) states that source code for the Program is available from such
+        Contributor, and informs licensees how to obtain it in a reasonable
+        manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within
+the Program.
+
+Each Contributor must identify itself as the originator of its Contribution,
+if any, in a manner that reasonably allows subsequent Recipients to identify
+the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with
+respect to end users, business partners and the like. While this license is
+intended to facilitate the commercial use of the Program, the Contributor who
+includes the Program in a commercial product offering should do so in a manner
+which does not create potential liability for other Contributors. Therefore, if
+a Contributor includes the Program in a commercial product offering, such
+Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
+every other Contributor ("Indemnified Contributor") against any losses, damages
+and costs (collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to the
+extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to
+control, and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may participate in
+any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product
+offering, Product X. That Contributor is then a Commercial Contributor. If that
+Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such
+Commercial Contributor's responsibility alone. Under this section, the
+Commercial Contributor would have to defend claims against the other
+Contributors related to those performance claims and warranties, and if a court
+requires any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
+Recipient is solely responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its exercise of
+rights under this Agreement , including but not limited to the risks and costs
+of program errors, compliance with applicable laws, damage to or loss of data,
+programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
+CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable
+law, it shall not affect the validity or enforceability of the remainder of the
+terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such
+provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Program itself
+(excluding combinations of the Program with other software or hardware)
+infringes such Recipient's patent(s), then such Recipient's rights granted under
+Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to
+comply with any of the material terms or conditions of this Agreement and does
+not cure such failure in a reasonable period of time after becoming aware of
+such noncompliance. If all Recipient's rights under this Agreement terminate,
+Recipient agrees to cease use and distribution of the Program as soon as
+reasonably practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in
+order to avoid inconsistency the Agreement is copyrighted and may only be
+modified in the following manner. The Agreement Steward reserves the right to
+publish new versions (including revisions) of this Agreement from time to time.
+No one other than the Agreement Steward has the right to modify this Agreement.
+The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
+may assign the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions) may always
+be distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to distribute the Program (including its Contributions)
+under the new version. Except as expressly stated in Sections 2(a) and 2(b)
+above, Recipient receives no rights or licenses to the intellectual property of
+any Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted under
+this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to this
+Agreement will bring a legal action under this Agreement more than one year
+after the cause of action arose. Each party waives its rights to a jury trial in
+any resulting litigation.
+
+   The LGPL v2.1 can be found in GNU Lesser General Public License Version
+   2.1, February 1999.
+
+   ======================================================================
+   ======================================================================
 
 Google Protocol Buffers
 
-   The following software may be included in this product:
 Copyright 2008 Google Inc.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 met:
 
-
     * Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.
-
     * Redistributions in binary form must reproduce the above
 copyright notice, this list of conditions and the following disclaimer
 in the documentation and/or other materials provided with the
 distribution.
-
     * Neither the name of Google Inc. nor the names of its
 contributors may be used to endorse or promote products derived from
 this software without specific prior written permission.
@@ -593,134 +772,13 @@ of the input file used when generating it.  This code is not
 standalone and requires a support library to be linked with it.  This
 support library is itself covered by the above license.
 
-jboss-common-jdbc-wrapper.jar
-
-   This product may include a copy of jboss-common-jdbc-wrapper.jar in
-   both source and object code in the following
-   /src/lib/jboss-common-jdbc-wrapper.jar. The terms of the Oracle license
-   do NOT apply to jboss-common-jdbc-wrapper.jar; it is licensed under the
-   following license, separately from the Oracle programs you receive. If
-   you do not wish to install this library, you may remove the file
-   /src/lib/jboss-common-jdbc-wrapper.jar, but the Oracle program might
-   not operate properly or at all without the library.
-
-   This component is licensed under GNU Lesser General Public License
-   Version 2.1, February 1999.
-
-NanoXML
-
-   The following software may be included in this product:
-
-   NanoXML
-
- * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
- *
-
- * This software is provided 'as-is', without any express or implied warranty.
-
- * In no event will the authors be held liable for any damages arising from the
-
- * use of this software.
- *
-
- * Permission is granted to anyone to use this software for any purpose,
-
- * including commercial applications, and to alter it and redistribute it
-
- * freely, subject to the following restrictions:
- *
-
- *  1. The origin of this software must not be misrepresented; you must not
-
- *     claim that you wrote the original software. If you use this software in
-
- *     a product, an acknowledgment in the product documentation would be
-
- *     appreciated but is not required.
- *
-
- *  2. Altered source versions must be plainly marked as such, and must not be
-
- *     misrepresented as being the original software.
- *
-
- *  3. This notice may not be removed or altered from any source distribution.
- *
-
-rox.jar
-
-   The following software may be included in this product:
-
-   rox.jar
-Copyright (c) 2006, James Greenfield
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-
-    * Redistributions of source code must retain the above copyright notice, thi
-s
-      list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-
-    * Neither the name of the  nor the names of its contributors
-      may be used to endorse or promote products derived from this software
-      without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIE
-D
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVI
-CES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Simple Logging Facade for Java (SLF4J)
-
-   The following software may be included in this product:
-Simple Logging Facade for Java (SLF4J)
-
-Copyright (c) 2004-2011 QOS.ch
-All rights reserved.
-
-Permission is hereby granted, free of charge,
-to any person obtaining a copy of this software
-and associated documentation files (the "Software"),
-to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify,
-merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the
-following conditions:
-
-The above copyright notice and this permission notice
-shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
-OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
-EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-OR OTHER DEALINGS IN THE SOFTWARE.
+   ======================================================================
+   ======================================================================
 
 Unicode Data Files
 
-   The following software may be included in this product:
-
    Unicode Data Files
+
 COPYRIGHT AND PERMISSION NOTICE
 
 Copyright (c) 1991-2014 Unicode, Inc. All rights reserved. Distributed under
@@ -740,154 +798,25 @@ clear notice in each modified Data File or in the Software as well as in the
 documentation associated with the Data File(s) or Software that the data or
 software has been modified.
 
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
-THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
-CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
-DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other
-dealings in these Data Files or Software without prior written authorization
-of the copyright holder.
-
-Commonly Used Licenses
-
-Artistic License (Perl) 1.0
-
-The "Artistic License"
-
-Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
-        "Package" refers to the collection of files distributed by the
-        Copyright Holder, and derivatives of that collection of files
-        created through textual modification.
-
-        "Standard Version" refers to such a Package if it has not been
-        modified, or has been modified in accordance with the wishes
-        of the Copyright Holder as specified below.
-
-        "Copyright Holder" is whoever is named in the copyright or
-        copyrights for the package.
-
-        "You" is you, if you're thinking about copying or distributing
-        this Package.
-
-        "Reasonable copying fee" is whatever you can justify on the
-        basis of media cost, duplication charges, time of people involved,
-        and so on.  (You will not be required to justify it to the
-        Copyright Holder, but only to the computing community at large
-        as a market that must bear the fee.)
-
-        "Freely Available" means that no fee is charged for the item
-        itself, though there may be fees involved in handling the item.
-        It also means that recipients of the item may redistribute it
-        under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder.  A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
-    a) place your modifications in the Public Domain or otherwise make them
-    Freely Available, such as by posting said modifications to Usenet or
-    an equivalent medium, or placing the modifications on a major archive
-    site such as uunet.uu.net, or by allowing the Copyright Holder to include
-    your modifications in the Standard Version of the Package.
-
-    b) use the modified Package only within your corporation or organization.
-
-    c) rename any non-standard executables so the names do not conflict
-    with standard executables, which must also be provided, and provide
-    a separate manual page for each non-standard executable that clearly
-    documents how it differs from the Standard Version.
-
-    d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
-    a) distribute a Standard Version of the executables and library files,
-    together with instructions (in the manual page or equivalent) on where
-    to get the Standard Version.
-
-    b) accompany the distribution with the machine-readable source of
-    the Package with your modifications.
-
-    c) give non-standard executables non-standard names, and clearly
-    document the differences in manual pages (or equivalent), together
-    with instructions on where to get the Standard Version.
-
-    d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package.  You may charge any fee you choose for support of this
-Package.  You may not charge a fee for this Package itself.  However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.  You may embed this Package's interpreter within
-an executable of yours (by linking); this shall be construed as a mere
-form of aggregation, provided that the complete Standard Version of the
-interpreter is so embedded.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whoever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.  If such scripts or library files are aggregated with this
-Package via the so-called "undump" or "unexec" methods of producing a
-binary executable image, then distribution of such an image shall
-neither be construed as a distribution of this Package nor shall it
-fall under the restrictions of Paragraphs 3 and 4, provided that you do
-not represent such an executable image as a Standard Version of this
-Package.
-
-7. C subroutines (or comparably compiled subroutines in other
-languages) supplied by you and linked into this Package in order to
-emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. Aggregation of this Package with a commercial distribution is always
-permitted provided that the use of this Package is embedded; that is,
-when no overt attempt is made to make this Package's interfaces visible
-to the end user of the commercial distribution.  Such use shall not be
-construed as a distribution of this Package.
-
-9. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-                                The End
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+these Data Files or Software without prior written authorization of the
+copyright holder.
+
+   ======================================================================
+   ======================================================================
+
+Standard Licenses
 
 GNU Lesser General Public License Version 2.1, February 1999
 
@@ -1053,7 +982,6 @@ on the Library (independent of the use of the Library in a tool for
 writing it).  Whether that is true depends on what the Library does
 and what the program that uses the Library does.
 
-
   1. You may copy and distribute verbatim copies of the Library's
 complete source code as you receive it, in any medium, provided that
 you conspicuously and appropriately publish on each copy an
@@ -1066,7 +994,6 @@ Library.
 and you may at your option offer warranty protection in exchange for a
 fee.
 
-
   2. You may modify your copy or copies of the Library or any portion
 of it, thus forming a work based on the Library, and copy and
 distribute such modifications or work under the terms of Section 1
@@ -1116,7 +1043,6 @@ with the Library (or with a work based on the Library) on a volume of
 a storage or distribution medium does not bring the other work under
 the scope of this License.
 
-
   3. You may opt to apply the terms of the ordinary GNU General Public
 License instead of this License to a given copy of the Library.  To do
 this, you must alter all the notices that refer to this License, so
@@ -1133,7 +1059,6 @@ subsequent copies and derivative works made from that copy.
   This option is useful when you wish to copy part of the code of
 the Library into a program that is not a library.
 
-
   4. You may copy and distribute the Library (or a portion or
 derivative of it, under Section 2) in object code or executable form
 under the terms of Sections 1 and 2 above provided that you accompany
@@ -1147,7 +1072,6 @@ source code from the same place satisfies the requirement to
 distribute the source code, even though third parties are not
 compelled to copy the source along with the object code.
 
-
   5. A program that contains no derivative of any portion of the
 Library, but is designed to work with the Library by being compiled or
 linked with it, is called a "work that uses the Library".  Such a
@@ -1179,7 +1103,6 @@ distribute the object code for the work under the terms of Section 6.
 Any executables containing that work also fall under Section 6,
 whether or not they are linked directly with the Library itself.
 
-
   6. As an exception to the Sections above, you may also combine or
 link a "work that uses the Library" with the Library to produce a
 work containing portions of the Library, and distribute that work
@@ -1242,7 +1165,6 @@ accompany the operating system.  Such a contradiction means you cannot
 use both them and the Library together in an executable that you
 distribute.
 
-
   7. You may place library facilities that are a work based on the
 Library side-by-side in a single library together with other library
 facilities not covered by this License, and distribute such a combined
@@ -1259,7 +1181,6 @@ permitted, and provided that you do these two things:
     that part of it is a work based on the Library, and explaining
     where to find the accompanying uncombined form of the same work.
 
-
   8. You may not copy, modify, sublicense, link with, or distribute
 the Library except as expressly provided under this License.  Any
 attempt otherwise to copy, modify, sublicense, link with, or
@@ -1268,7 +1189,6 @@ rights under this License.  However, parties who have received copies,
 or rights, from you under this License will not have their licenses
 terminated so long as such parties remain in full compliance.
 
-
   9. You are not required to accept this License, since you have not
 signed it.  However, nothing else grants you permission to modify or
 distribute the Library or its derivative works.  These actions are
@@ -1420,473 +1340,8 @@ necessary.  Here is a sample; alter the names:
 
 That's all there is to it!
 
-GNU Lesser General Public License Version 2, June 1991
-
-GNU LIBRARY GENERAL PUBLIC LICENSE
-
-Version 2, June 1991
-
-Copyright (C) 1991 Free Software Foundation, Inc.
-51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is numbered 2
-because it goes with version 2 of the ordinary GPL.]
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to
-share and change it. By contrast, the GNU General Public Licenses are
-intended to guarantee your freedom to share and change free software--to make
-sure the software is free for all its users.
-
-This license, the Library General Public License, applies to some specially
-designated Free Software Foundation software, and to any other libraries
-whose authors decide to use it. You can use it for your libraries, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you
-wish), that you receive source code or can get it if you want it, that you
-can change the software or use pieces of it in new free programs; and that
-you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to
-deny you these rights or to ask you to surrender the rights. These
-restrictions translate to certain responsibilities for you if you distribute
-copies of the library, or if you modify it.
-
-For example, if you distribute copies of the library, whether gratis or for a
-fee, you must give the recipients all the rights that we gave you. You must
-make sure that they, too, receive or can get the source code. If you link a
-program with the library, you must provide complete object files to the
-recipients so that they can relink them with the library, after making
-changes to the library and recompiling it. And you must show them these terms
-so they know their rights.
-
-Our method of protecting your rights has two steps: (1) copyright the
-library, and (2) offer you this license which gives you legal permission to
-copy, distribute and/or modify the library.
-
-Also, for each distributor's protection, we want to make certain that
-everyone understands that there is no warranty for this free library. If the
-library is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original version, so that any problems
-introduced by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We
-wish to avoid the danger that companies distributing free software will
-individually obtain patent licenses, thus in effect transforming the program
-into proprietary software. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-Most GNU software, including some libraries, is covered by the ordinary GNU
-General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary one;
-be sure to read it in full, and don't assume that anything in it is the same
-as in the ordinary license.
-
-The reason we have a separate public license for some libraries is that they
-blur the distinction we usually make between modifying or adding to a program
-and simply using it. Linking a program with a library, without changing the
-library, is in some sense simply using the library, and is analogous to
-running a utility program or application program. However, in a textual and
-legal sense, the linked executable is a combined work, a derivative of the
-original library, and the ordinary General Public License treats it as such.
-
-Because of this blurred distinction, using the ordinary General Public
-License for libraries did not effectively promote software sharing, because
-most developers did not use the libraries. We concluded that weaker
-conditions might promote sharing better.
-
-However, unrestricted linking of non-free programs would deprive the users of
-those programs of all benefit from the free status of the libraries
-themselves. This Library General Public License is intended to permit
-developers of non-free programs to use free libraries, while preserving your
-freedom as a user of such programs to change the free libraries that are
-incorporated in them. (We have not seen how to achieve this as regards
-changes in header files, but we have achieved it as regards changes in the
-actual functions of the Library.) The hope is that this will lead to faster
-development of free libraries.
-
-The precise terms and conditions for copying, distribution and modification
-follow. Pay close attention to the difference between a "work based on the
-library" and a "work that uses the library". The former contains code derived
-from the library, while the latter only works together with the library.
-
-Note that it is possible for a library to be covered by the ordinary General
-Public License rather than by this special one.
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License Agreement applies to any software library which contains a
-notice placed by the copyright holder or other authorized party saying it may
-be distributed under the terms of this Library General Public License (also
-called "this License"). Each licensee is addressed as "you".
-
-A "library" means a collection of software functions and/or data prepared so
-as to be conveniently linked with application programs (which use some of
-those functions and data) to form executables.
-
-The "Library", below, refers to any such software library or work which has
-been distributed under these terms. A "work based on the Library" means
-either the Library or any derivative work under copyright law: that is to
-say, a work containing the Library or a portion of it, either verbatim or
-with modifications and/or translated straightforwardly into another language.
-(Hereinafter, translation is included without limitation in the term
-"modification".)
-
-"Source code" for a work means the preferred form of the work for making
-modifications to it. For a library, complete source code means all the source
-code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-library.
-
-Activities other than copying, distribution and modification are not covered
-by this License; they are outside its scope. The act of running a program
-using the Library is not restricted, and output from such a program is
-covered only if its contents constitute a work based on the Library
-(independent of the use of the Library in a tool for writing it). Whether
-that is true depends on what the Library does and what the program that uses
-the Library does.
-
-1. You may copy and distribute verbatim copies of the Library's complete
-source code as you receive it, in any medium, provided that you conspicuously
-and appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this
-License and to the absence of any warranty; and distribute a copy of this
-License along with the Library.
-
-You may charge a fee for the physical act of transferring a copy, and you may
-at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Library or any portion of it,
-thus forming a work based on the Library, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you
-also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-    b) You must cause the files modified to carry prominent notices stating
-that you changed the files and the date of any change.
-    c) You must cause the whole of the work to be licensed at no charge to
-all third parties under the terms of this License.
-    d) If a facility in the modified Library refers to a function or a table
-of data to be supplied by an application program that uses the facility,
-other than as an argument passed when the facility is invoked, then you must
-make a good faith effort to ensure that, in the event an application does not
-supply such function or table, the facility still operates, and performs
-whatever part of its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has a
-purpose that is entirely well-defined independent of the application.
-Therefore, Subsection 2d requires that any application-supplied function or
-table used by this function must be optional: if the application does not
-supply it, the square root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Library, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Library, the distribution of the whole must be
-on the terms of this License, whose permissions for other licensees extend to
-the entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on
-the Library.
-
-In addition, mere aggregation of another work not based on the Library with
-the Library (or with a work based on the Library) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may opt to apply the terms of the ordinary GNU General Public License
-instead of this License to a given copy of the Library. To do this, you must
-alter all the notices that refer to this License, so that they refer to the
-ordinary GNU General Public License, version 2, instead of to this License.
-(If a newer version than version 2 of the ordinary GNU General Public License
-has appeared, then you can specify that version instead if you wish.) Do not
-make any other change in these notices.
-
-Once this change is made in a given copy, it is irreversible for that copy,
-so the ordinary GNU General Public License applies to all subsequent copies
-and derivative works made from that copy.
-
-This option is useful when you wish to copy part of the code of the Library
-into a program that is not a library.
-
-4. You may copy and distribute the Library (or a portion or derivative of it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you accompany it with the complete
-corresponding machine-readable source code, which must be distributed under
-the terms of Sections 1 and 2 above on a medium customarily used for software
-interchange.
-
-If distribution of object code is made by offering access to copy from a
-designated place, then offering equivalent access to copy the source code
-from the same place satisfies the requirement to distribute the source code,
-even though third parties are not compelled to copy the source along with the
-object code.
-
-5. A program that contains no derivative of any portion of the Library, but
-is designed to work with the Library by being compiled or linked with it, is
-called a "work that uses the Library". Such a work, in isolation, is not a
-derivative work of the Library, and therefore falls outside the scope of this
-License.
-
-However, linking a "work that uses the Library" with the Library creates an
-executable that is a derivative of the Library (because it contains portions
-of the Library), rather than a "work that uses the library". The executable
-is therefore covered by this License. Section 6 states terms for distribution
-of such executables.
-
-When a "work that uses the Library" uses material from a header file that is
-part of the Library, the object code for the work may be a derivative work of
-the Library even though the source code is not. Whether this is true is
-especially significant if the work can be linked without the Library, or if
-the work is itself a library. The threshold for this to be true is not
-precisely defined by law.
-
-If such an object file uses only numerical parameters, data structure layouts
-and accessors, and small macros and small inline functions (ten lines or less
-in length), then the use of the object file is unrestricted, regardless of
-whether it is legally a derivative work. (Executables containing this object
-code plus portions of the Library will still fall under Section 6.)
-
-Otherwise, if the work is a derivative of the Library, you may distribute the
-object code for the work under the terms of Section 6. Any executables
-containing that work also fall under Section 6, whether or not they are
-linked directly with the Library itself.
-
-6. As an exception to the Sections above, you may also compile or link a
-"work that uses the Library" with the Library to produce a work containing
-portions of the Library, and distribute that work under terms of your choice,
-provided that the terms permit modification of the work for the customer's
-own use and reverse engineering for debugging such modifications.
-
-You must give prominent notice with each copy of the work that the Library is
-used in it and that the Library and its use are covered by this License. You
-must supply a copy of this License. If the work during execution displays
-copyright notices, you must include the copyright notice for the Library
-among them, as well as a reference directing the user to the copy of this
-License. Also, you must do one of these things:
-
-    a) Accompany the work with the complete corresponding machine-readable
-source code for the Library including whatever changes were used in the work
-(which must be distributed under Sections 1 and 2 above); and, if the work is
-an executable linked with the Library, with the complete machine-readable
-"work that uses the Library", as object code and/or source code, so that the
-user can modify the Library and then relink to produce a modified executable
-containing the modified Library. (It is understood that the user who changes
-the contents of definitions files in the Library will not necessarily be able
-to recompile the application to use the modified definitions.)
-    b) Accompany the work with a written offer, valid for at least three
-years, to give the same user the materials specified in Subsection 6a, above,
-for a charge no more than the cost of performing this distribution.
-    c) If distribution of the work is made by offering access to copy from a
-designated place, offer equivalent access to copy the above specified
-materials from the same place.
-    d) Verify that the user has already received a copy of these materials or
-that you have already sent this user a copy.
-
-For an executable, the required form of the "work that uses the Library" must
-include any data and utility programs needed for reproducing the executable
-from it. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component itself
-accompanies the executable.
-
-It may happen that this requirement contradicts the license restrictions of
-other proprietary libraries that do not normally accompany the operating
-system. Such a contradiction means you cannot use both them and the Library
-together in an executable that you distribute.
-
-7. You may place library facilities that are a work based on the Library
-side-by-side in a single library together with other library facilities not
-covered by this License, and distribute such a combined library, provided
-that the separate distribution of the work based on the Library and of the
-other library facilities is otherwise permitted, and provided that you do
-these two things:
-
-    a) Accompany the combined library with a copy of the same work based on
-the Library, uncombined with any other library facilities. This must be
-distributed under the terms of the Sections above.
-    b) Give prominent notice with the combined library of the fact that part
-of it is a work based on the Library, and explaining where to find the
-accompanying uncombined form of the same work.
-
-8. You may not copy, modify, sublicense, link with, or distribute the Library
-except as expressly provided under this License. Any attempt otherwise to
-copy, modify, sublicense, link with, or distribute the Library is void, and
-will automatically terminate your rights under this License. However, parties
-who have received copies, or rights, from you under this License will not
-have their licenses terminated so long as such parties remain in full
-compliance.
-
-9. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the
-Library or its derivative works. These actions are prohibited by law if you
-do not accept this License. Therefore, by modifying or distributing the
-Library (or any work based on the Library), you indicate your acceptance of
-this License to do so, and all its terms and conditions for copying,
-distributing or modifying the Library or works based on it.
-
-10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the original
-licensor to copy, distribute, link with or modify the Library subject to
-these terms and conditions. You may not impose any further restrictions on
-the recipients' exercise of the rights granted herein. You are not
-responsible for enforcing compliance by third parties to this License.
-
-11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not excuse
-you from the conditions of this License. If you cannot distribute so as to
-satisfy simultaneously your obligations under this License and any other
-pertinent obligations, then as a consequence you may not distribute the
-Library at all. For example, if a patent license would not permit
-royalty-free redistribution of the Library by all those who receive copies
-directly or indirectly through you, then the only way you could satisfy both
-it and this License would be to refrain entirely from distribution of the
-Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply, and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents
-or other property right claims or to contest validity of any such claims;
-this section has the sole purpose of protecting the integrity of the free
-software distribution system which is implemented by public license
-practices. Many people have made generous contributions to the wide range of
-software distributed through that system in reliance on consistent
-application of that system; it is up to the author/donor to decide if he or
-she is willing to distribute software through any other system and a licensee
-cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-12. If the distribution and/or use of the Library is restricted in certain
-countries either by patents or by copyrighted interfaces, the original
-copyright holder who places the Library under this License may add an
-explicit geographical distribution limitation excluding those countries, so
-that distribution is permitted only in or among countries not thus excluded.
-In such case, this License incorporates the limitation as if written in the
-body of this License.
-
-13. The Free Software Foundation may publish revised and/or new versions of
-the Library General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and "any later
-version", you have the option of following the terms and conditions either of
-that version or of any later version published by the Free Software
-Foundation. If the Library does not specify a license version number, you may
-choose any version ever published by the Free Software Foundation.
-
-14. If you wish to incorporate parts of the Library into other free programs
-whose distribution conditions are incompatible with these, write to the
-author to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes make
-exceptions for this. Our decision will be guided by the two goals of
-preserving the free status of all derivatives of our free software and of
-promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
-LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO
-LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
-THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER
-SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
-How to Apply These Terms to Your New Libraries
-
-If you develop a new library, and you want it to be of the greatest possible
-use to the public, we recommend making it free software that everyone can
-redistribute and change. You can do so by permitting redistribution under
-these terms (or, alternatively, under the terms of the ordinary General
-Public License).
-
-To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-one line to give the library's name and an idea of what it does.
-Copyright (C) year  name of author
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-Boston, MA  02110-1301, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in
-the library `Frob' (a library for tweaking knobs) written
-by James Random Hacker.
-
-signature of Ty Coon, 1 April 1990
-Ty Coon, President of Vice
-
-That's all there is to it!
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
+   ======================================================================
+   ======================================================================
 
 Written Offer for Source Code
 
@@ -1900,6 +1355,7 @@ Written Offer for Source Code
    request to the address listed below or by sending an email to Oracle
    using the following link:
    http://www.oracle.com/goto/opensourcecode/request.
+
   Oracle America, Inc.
   Attn: Senior Vice President
   Development and Engineering Legal
@@ -1923,11 +1379,14 @@ Written Offer for Source Code
 
      * A telephone number in the event we need to reach you.
 
+
    We may charge you a fee to cover the cost of physical media and
    processing.
 
    Your request must be sent
+
     a. within three (3) years of the date you received the Oracle product
        that included the binary that is the subject of your request, or
+
     b. in the case of code licensed under the GPL v3 for as long as Oracle
        offers spare parts or customer support for that product model.
diff --git a/ide/db.mysql/nbproject/project.properties b/ide/db.mysql/nbproject/project.properties
index 61702569949e..4668ce59ff94 100644
--- a/ide/db.mysql/nbproject/project.properties
+++ b/ide/db.mysql/nbproject/project.properties
@@ -18,4 +18,4 @@ javac.source=1.8
 javac.compilerargs=-Xlint -Xlint:-serial
 spec.version.base=0.47.0
 
-test.unit.cp.extra=external/mysql-connector-java-8.0.17.jar
+test.unit.cp.extra=external/mysql-connector-j-8.0.31.jar
diff --git a/nbbuild/licenses/GPL-mysql-connector b/nbbuild/licenses/GPL-mysql-connector
index 9c5e8b8181d5..d1674c9f68d0 100644
--- a/nbbuild/licenses/GPL-mysql-connector
+++ b/nbbuild/licenses/GPL-mysql-connector
@@ -10,7 +10,7 @@ Introduction
    third-party software which may be included in this distribution of
    MySQL Connector/J 8.0.
 
-   Last updated: June 2019
+   Last updated: August 2022
 
 Licensing Information
 
@@ -33,8 +33,7 @@ Licensing Information
    a copy of which is reproduced below and can also be found along with
    its FAQ at http://oss.oracle.com/licenses/universal-foss-exception.
 
-   Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights
-   reserved.
+   Copyright (c) 2017, 2022, Oracle and/or its affiliates.
 
 Election of GPLv2
 
@@ -59,6 +58,11 @@ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 either express or implied. See the License for the specific language
 governing permissions and limitations under the License.
 
+
+  ======================================================================
+  ======================================================================
+
+
 GNU GENERAL PUBLIC LICENSE
 Version 2, June 1991
 
@@ -138,7 +142,6 @@ is covered only if its contents constitute a work based on the
 Program (independent of having been made by running the Program).
 Whether that is true depends on what the Program does.
 
-
   1. You may copy and distribute verbatim copies of the Program's
 source code as you receive it, in any medium, provided that you
 conspicuously and appropriately publish on each copy an appropriate
@@ -150,7 +153,6 @@ along with the Program.
 You may charge a fee for the physical act of transferring a copy, and
 you may at your option offer warranty protection in exchange for a fee.
 
-
   2. You may modify your copy or copies of the Program or any portion
 of it, thus forming a work based on the Program, and copy and
 distribute such modifications or work under the terms of Section 1
@@ -195,7 +197,6 @@ with the Program (or with a work based on the Program) on a volume of
 a storage or distribution medium does not bring the other work under
 the scope of this License.
 
-
   3. You may copy and distribute the Program (or a work based on it,
 under Section 2) in object code or executable form under the terms of
 Sections 1 and 2 above provided that you also do one of the following:
@@ -235,7 +236,6 @@ access to copy the source code from the same place counts as
 distribution of the source code, even though third parties are not
 compelled to copy the source along with the object code.
 
-
   4. You may not copy, modify, sublicense, or distribute the Program
 except as expressly provided under this License.  Any attempt
 otherwise to copy, modify, sublicense or distribute the Program is
@@ -244,7 +244,6 @@ However, parties who have received copies, or rights, from you under
 this License will not have their licenses terminated so long as such
 parties remain in full compliance.
 
-
   5. You are not required to accept this License, since you have not
 signed it.  However, nothing else grants you permission to modify or
 distribute the Program or its derivative works.  These actions are
@@ -254,7 +253,6 @@ Program), you indicate your acceptance of this License to do so, and
 all its terms and conditions for copying, distributing or modifying
 the Program or works based on it.
 
-
   6. Each time you redistribute the Program (or any work based on the
 Program), the recipient automatically receives a license from the
 original licensor to copy, distribute or modify the Program subject to
@@ -263,7 +261,6 @@ restrictions on the recipients' exercise of the rights granted herein.
 You are not responsible for enforcing compliance by third parties to
 this License.
 
-
   7. If, as a consequence of a court judgment or allegation of patent
 infringement or for any other reason (not limited to patent issues),
 conditions are imposed on you (whether by court order, agreement or
@@ -296,7 +293,6 @@ impose that choice.
 This section is intended to make thoroughly clear what is believed to
 be a consequence of the rest of this License.
 
-
   8. If the distribution and/or use of the Program is restricted in
 certain countries either by patents or by copyrighted interfaces, the
 original copyright holder who places the Program under this License
@@ -305,7 +301,6 @@ those countries, so that distribution is permitted only in or among
 countries not thus excluded.  In such case, this License incorporates
 the limitation as if written in the body of this License.
 
-
   9. The Free Software Foundation may publish revised and/or new
 versions of the General Public License from time to time.  Such new
 versions will be similar in spirit to the present version, but may
@@ -416,6 +411,9 @@ you may consider it more useful to permit linking proprietary
 applications with the library.  If this is what you want to do, use
 the GNU Lesser General Public License instead of this License.
 
+   ======================================================================
+   ======================================================================
+
 The Universal FOSS Exception, Version 1.0
 
    In addition to the rights set forth in the other license(s) included in
@@ -430,6 +428,7 @@ The Universal FOSS Exception, Version 1.0
    Software with Other FOSS, and the constants, function signatures, data
    structures and other invocation methods used to run or interact with
    each of them (as to each, such software's "Interfaces"):
+
     i. The Software's Interfaces may, to the extent permitted by the
        license of the Other FOSS, be copied into, used and distributed in
        the Other FOSS in order to enable interoperability, without
@@ -439,6 +438,7 @@ The Universal FOSS Exception, Version 1.0
        including without limitation as used in the Other FOSS (which upon
        any such use also then contains a portion of the Software under the
        Software License).
+
    ii. The Other FOSS's Interfaces may, to the extent permitted by the
        license of the Other FOSS, be copied into, used and distributed in
        the Software in order to enable interoperability, without requiring
@@ -446,6 +446,7 @@ The Universal FOSS Exception, Version 1.0
        License or otherwise altering their original terms, if this does
        not require any portion of the Software other than such Interfaces
        to be licensed under the terms other than the Software License.
+
    iii. If only Interfaces and no other code is copied between the
        Software and the Other FOSS in either direction, the use and/or
        distribution of the Software with the Other FOSS shall not be
@@ -467,103 +468,281 @@ The Universal FOSS Exception, Version 1.0
        of any kind for use or distribution of the Software in conjunction
        with software other than Other FOSS.
 
+   ======================================================================
+   ======================================================================
+
 Licenses for Third-Party Components
 
    The following sections contain licensing information for libraries that
-   we have included with the MySQL Connector/J 8.0 source and components
-   used to test MySQL Connector/J 8.0. Commonly used licenses referenced
-   herein can be found in Commonly Used Licenses. We are thankful to all
-   individuals that have created these.
+   may be included with this product. We are thankful to all individuals
+   that have created these. Standard licenses referenced herein are
+   detailed in the Standard Licenses section.
 
-Ant-Contrib
+c3p0 JDBC Library
 
-   The following software may be included in this product:
-Ant-Contrib
-Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
-Licensed under the Apache 1.1 License Agreement, a copy of which is reproduced b
-elow.
+   The MySQL Connector/J implements interfaces that are included in c3p0,
+   although no part of c3p0 is included or distributed with MySQL.
 
-The Apache Software License, Version 1.1
+Copyright (C) 2019 Machinery For Change, Inc.
 
-Copyright (c) 2001-2003 Ant-Contrib project.  All rights reserved.
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of EITHER:
+ *
+ *     1) The GNU Lesser General Public License (LGPL), version 2.1, as
+ *        published by the Free Software Foundation
+ *
+ * OR
+ *
+ *     2) The Eclipse Public License (EPL), version 1.0
+ * You may choose which license to accept if you wish to redistribute
+ * or modify this work. You may offer derivatives of this work
+ * under the license you have chosen, or you may provide the same
+ * choice of license which you have been offered here.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received copies of both LGPL v2.1 and EPL v1.0
+ * along with this software; see the files LICENSE-EPL and LICENSE-LGPL.
+ * If not, the text of these licenses are currently available at
+ *
+ * LGPL v2.1: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
+ *  EPL v1.0: http://www.eclipse.org/org/documents/epl-v10.php
 
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
+Eclipse Public License - v 1.0
 
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
+CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
+1. DEFINITIONS
 
+"Contribution" means:
 
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
+a) in the case of the initial Contributor, the initial code and documentation
 
+   distributed under this Agreement, and
 
- 3. The end-user documentation included with the redistribution, if
-    any, must include the following acknowlegement:
-       "This product includes software developed by the
-        Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
-    Alternately, this acknowlegement may appear in the software itself,
-    if and wherever such third-party acknowlegements normally appear.
+b) in the case of each subsequent Contributor:
 
+    i) changes to the Program, and
 
- 4. The name Ant-Contrib must not be used to endorse or promote
-    products derived from this software without prior written
-    permission. For written permission, please contact
-    ant-contrib-developers@lists.sourceforge.net.
+   ii) additions to the Program;
 
+where such changes and/or additions to the Program originate from and are
+distributed by that particular Contributor. A Contribution 'originates' from a
+Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additionsto
+the Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
 
- 5. Products derived from this software may not be called "Ant-Contrib"
-    nor may "Ant-Contrib" appear in their names without prior written
-    permission of the Ant-Contrib project.
+"Contributor" means any person or entity that distributes the Program.
 
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED.  IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
+"Licensed Patents " mean patent claims licensable by a Contributor which are
+necessarily infringed by the use or sale of its Contribution alone or when
+combined with the Program.
 
-c3p0 JDBC Library
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
 
-   This product may include a copy of c3p0-0.9.1-pre6.jar in both source
-   and object code in the following /src/lib/c3p0-0.9.1-pre6.jar. The
-   terms of the Oracle license do NOT apply to c3p0-0.9.1-pre6.jar; it is
-   licensed under the following license, separately from the Oracle
-   programs you receive. If you do not wish to install this library, you
-   may remove the file /src/lib/c3p0-0.9.1-pre6.jar, but the Oracle
-   program might not operate properly or at all without the library.
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free copyright license to
+reproduce, prepare derivative works of, publicly display, publicly perform,
+distribute and sublicense the Contribution of such Contributor, if any, and such
+derivative works, in source code and object code form.
 
-   This component is licensed under GNU Lesser General Public License
-   Version 2.1, February 1999.
+b) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
+Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form.
+This patent license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other combinations
+which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to
+its Contributions set forth herein, no assurances are provided by any
+Contributor that the Program does not infringe the patent or other intellectual
+property rights of any other entity. Each Contributor disclaims any liability to
+Recipient for claims brought by any other entity based on infringement of
+intellectual property rights or otherwise. As a condition to exercising the
+rights and licenses granted hereunder, each Recipient hereby assumes sole
+responsibility to secure any other intellectual property rights needed, if any.
+For example, if a third party patent license is required to allow Recipient to
+distribute the Program, it is Recipient's responsibility to acquire that license
+before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright license
+set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under
+its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+     i) effectively disclaims on behalf of all Contributors all warranties
+        and conditions, express and implied, including warranties or conditions
+        of title and non-infringement, and implied warranties or conditions of
+        merchantability and fitness for a particular purpose;
+
+    ii) effectively excludes on behalf of all Contributors all liability for
+        damages, including direct, indirect, special, incidental and
+        consequential damages, such as lost profits;
+
+   iii) states that any provisions which differ from this Agreement are
+        offered by that Contributor alone and not by any other party; and
+
+    iv) states that source code for the Program is available from such
+        Contributor, and informs licensees how to obtain it in a reasonable
+        manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within
+the Program.
+
+Each Contributor must identify itself as the originator of its Contribution,
+if any, in a manner that reasonably allows subsequent Recipients to identify
+the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with
+respect to end users, business partners and the like. While this license is
+intended to facilitate the commercial use of the Program, the Contributor who
+includes the Program in a commercial product offering should do so in a manner
+which does not create potential liability for other Contributors. Therefore, if
+a Contributor includes the Program in a commercial product offering, such
+Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
+every other Contributor ("Indemnified Contributor") against any losses, damages
+and costs (collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to the
+extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to
+control, and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may participate in
+any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product
+offering, Product X. That Contributor is then a Commercial Contributor. If that
+Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such
+Commercial Contributor's responsibility alone. Under this section, the
+Commercial Contributor would have to defend claims against the other
+Contributors related to those performance claims and warranties, and if a court
+requires any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
+Recipient is solely responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its exercise of
+rights under this Agreement , including but not limited to the risks and costs
+of program errors, compliance with applicable laws, damage to or loss of data,
+programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
+CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable
+law, it shall not affect the validity or enforceability of the remainder of the
+terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such
+provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Program itself
+(excluding combinations of the Program with other software or hardware)
+infringes such Recipient's patent(s), then such Recipient's rights granted under
+Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to
+comply with any of the material terms or conditions of this Agreement and does
+not cure such failure in a reasonable period of time after becoming aware of
+such noncompliance. If all Recipient's rights under this Agreement terminate,
+Recipient agrees to cease use and distribution of the Program as soon as
+reasonably practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in
+order to avoid inconsistency the Agreement is copyrighted and may only be
+modified in the following manner. The Agreement Steward reserves the right to
+publish new versions (including revisions) of this Agreement from time to time.
+No one other than the Agreement Steward has the right to modify this Agreement.
+The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
+may assign the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions) may always
+be distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to distribute the Program (including its Contributions)
+under the new version. Except as expressly stated in Sections 2(a) and 2(b)
+above, Recipient receives no rights or licenses to the intellectual property of
+any Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted under
+this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to this
+Agreement will bring a legal action under this Agreement more than one year
+after the cause of action arose. Each party waives its rights to a jury trial in
+any resulting litigation.
+
+   The LGPL v2.1 can be found in GNU Lesser General Public License Version
+   2.1, February 1999.
+
+   ======================================================================
+   ======================================================================
 
 Google Protocol Buffers
 
-   The following software may be included in this product:
 Copyright 2008 Google Inc.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
 met:
 
-
     * Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.
-
     * Redistributions in binary form must reproduce the above
 copyright notice, this list of conditions and the following disclaimer
 in the documentation and/or other materials provided with the
 distribution.
-
     * Neither the name of Google Inc. nor the names of its
 contributors may be used to endorse or promote products derived from
 this software without specific prior written permission.
@@ -585,134 +764,13 @@ of the input file used when generating it.  This code is not
 standalone and requires a support library to be linked with it.  This
 support library is itself covered by the above license.
 
-jboss-common-jdbc-wrapper.jar
-
-   This product may include a copy of jboss-common-jdbc-wrapper.jar in
-   both source and object code in the following
-   /src/lib/jboss-common-jdbc-wrapper.jar. The terms of the Oracle license
-   do NOT apply to jboss-common-jdbc-wrapper.jar; it is licensed under the
-   following license, separately from the Oracle programs you receive. If
-   you do not wish to install this library, you may remove the file
-   /src/lib/jboss-common-jdbc-wrapper.jar, but the Oracle program might
-   not operate properly or at all without the library.
-
-   This component is licensed under GNU Lesser General Public License
-   Version 2.1, February 1999.
-
-NanoXML
-
-   The following software may be included in this product:
-
-   NanoXML
-
- * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
- *
-
- * This software is provided 'as-is', without any express or implied warranty.
-
- * In no event will the authors be held liable for any damages arising from the
-
- * use of this software.
- *
-
- * Permission is granted to anyone to use this software for any purpose,
-
- * including commercial applications, and to alter it and redistribute it
-
- * freely, subject to the following restrictions:
- *
-
- *  1. The origin of this software must not be misrepresented; you must not
-
- *     claim that you wrote the original software. If you use this software in
-
- *     a product, an acknowledgment in the product documentation would be
-
- *     appreciated but is not required.
- *
-
- *  2. Altered source versions must be plainly marked as such, and must not be
-
- *     misrepresented as being the original software.
- *
-
- *  3. This notice may not be removed or altered from any source distribution.
- *
-
-rox.jar
-
-   The following software may be included in this product:
-
-   rox.jar
-Copyright (c) 2006, James Greenfield
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-
-    * Redistributions of source code must retain the above copyright notice, thi
-s
-      list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-
-    * Neither the name of the  nor the names of its contributors
-      may be used to endorse or promote products derived from this software
-      without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIE
-D
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVI
-CES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Simple Logging Facade for Java (SLF4J)
-
-   The following software may be included in this product:
-Simple Logging Facade for Java (SLF4J)
-
-Copyright (c) 2004-2011 QOS.ch
-All rights reserved.
-
-Permission is hereby granted, free of charge,
-to any person obtaining a copy of this software
-and associated documentation files (the "Software"),
-to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify,
-merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the
-following conditions:
-
-The above copyright notice and this permission notice
-shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
-OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
-EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-OR OTHER DEALINGS IN THE SOFTWARE.
+   ======================================================================
+   ======================================================================
 
 Unicode Data Files
 
-   The following software may be included in this product:
-
    Unicode Data Files
+
 COPYRIGHT AND PERMISSION NOTICE
 
 Copyright (c) 1991-2014 Unicode, Inc. All rights reserved. Distributed under
@@ -732,154 +790,25 @@ clear notice in each modified Data File or in the Software as well as in the
 documentation associated with the Data File(s) or Software that the data or
 software has been modified.
 
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
-THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
-CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
-DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other
-dealings in these Data Files or Software without prior written authorization
-of the copyright holder.
-
-Commonly Used Licenses
-
-Artistic License (Perl) 1.0
-
-The "Artistic License"
-
-Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
-        "Package" refers to the collection of files distributed by the
-        Copyright Holder, and derivatives of that collection of files
-        created through textual modification.
-
-        "Standard Version" refers to such a Package if it has not been
-        modified, or has been modified in accordance with the wishes
-        of the Copyright Holder as specified below.
-
-        "Copyright Holder" is whoever is named in the copyright or
-        copyrights for the package.
-
-        "You" is you, if you're thinking about copying or distributing
-        this Package.
-
-        "Reasonable copying fee" is whatever you can justify on the
-        basis of media cost, duplication charges, time of people involved,
-        and so on.  (You will not be required to justify it to the
-        Copyright Holder, but only to the computing community at large
-        as a market that must bear the fee.)
-
-        "Freely Available" means that no fee is charged for the item
-        itself, though there may be fees involved in handling the item.
-        It also means that recipients of the item may redistribute it
-        under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder.  A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
-    a) place your modifications in the Public Domain or otherwise make them
-    Freely Available, such as by posting said modifications to Usenet or
-    an equivalent medium, or placing the modifications on a major archive
-    site such as uunet.uu.net, or by allowing the Copyright Holder to include
-    your modifications in the Standard Version of the Package.
-
-    b) use the modified Package only within your corporation or organization.
-
-    c) rename any non-standard executables so the names do not conflict
-    with standard executables, which must also be provided, and provide
-    a separate manual page for each non-standard executable that clearly
-    documents how it differs from the Standard Version.
-
-    d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
-    a) distribute a Standard Version of the executables and library files,
-    together with instructions (in the manual page or equivalent) on where
-    to get the Standard Version.
-
-    b) accompany the distribution with the machine-readable source of
-    the Package with your modifications.
-
-    c) give non-standard executables non-standard names, and clearly
-    document the differences in manual pages (or equivalent), together
-    with instructions on where to get the Standard Version.
-
-    d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package.  You may charge any fee you choose for support of this
-Package.  You may not charge a fee for this Package itself.  However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.  You may embed this Package's interpreter within
-an executable of yours (by linking); this shall be construed as a mere
-form of aggregation, provided that the complete Standard Version of the
-interpreter is so embedded.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whoever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.  If such scripts or library files are aggregated with this
-Package via the so-called "undump" or "unexec" methods of producing a
-binary executable image, then distribution of such an image shall
-neither be construed as a distribution of this Package nor shall it
-fall under the restrictions of Paragraphs 3 and 4, provided that you do
-not represent such an executable image as a Standard Version of this
-Package.
-
-7. C subroutines (or comparably compiled subroutines in other
-languages) supplied by you and linked into this Package in order to
-emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. Aggregation of this Package with a commercial distribution is always
-permitted provided that the use of this Package is embedded; that is,
-when no overt attempt is made to make this Package's interfaces visible
-to the end user of the commercial distribution.  Such use shall not be
-construed as a distribution of this Package.
-
-9. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-                                The End
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+these Data Files or Software without prior written authorization of the
+copyright holder.
+
+   ======================================================================
+   ======================================================================
+
+Standard Licenses
 
 GNU Lesser General Public License Version 2.1, February 1999
 
@@ -1045,7 +974,6 @@ on the Library (independent of the use of the Library in a tool for
 writing it).  Whether that is true depends on what the Library does
 and what the program that uses the Library does.
 
-
   1. You may copy and distribute verbatim copies of the Library's
 complete source code as you receive it, in any medium, provided that
 you conspicuously and appropriately publish on each copy an
@@ -1058,7 +986,6 @@ Library.
 and you may at your option offer warranty protection in exchange for a
 fee.
 
-
   2. You may modify your copy or copies of the Library or any portion
 of it, thus forming a work based on the Library, and copy and
 distribute such modifications or work under the terms of Section 1
@@ -1108,7 +1035,6 @@ with the Library (or with a work based on the Library) on a volume of
 a storage or distribution medium does not bring the other work under
 the scope of this License.
 
-
   3. You may opt to apply the terms of the ordinary GNU General Public
 License instead of this License to a given copy of the Library.  To do
 this, you must alter all the notices that refer to this License, so
@@ -1125,7 +1051,6 @@ subsequent copies and derivative works made from that copy.
   This option is useful when you wish to copy part of the code of
 the Library into a program that is not a library.
 
-
   4. You may copy and distribute the Library (or a portion or
 derivative of it, under Section 2) in object code or executable form
 under the terms of Sections 1 and 2 above provided that you accompany
@@ -1139,7 +1064,6 @@ source code from the same place satisfies the requirement to
 distribute the source code, even though third parties are not
 compelled to copy the source along with the object code.
 
-
   5. A program that contains no derivative of any portion of the
 Library, but is designed to work with the Library by being compiled or
 linked with it, is called a "work that uses the Library".  Such a
@@ -1171,7 +1095,6 @@ distribute the object code for the work under the terms of Section 6.
 Any executables containing that work also fall under Section 6,
 whether or not they are linked directly with the Library itself.
 
-
   6. As an exception to the Sections above, you may also combine or
 link a "work that uses the Library" with the Library to produce a
 work containing portions of the Library, and distribute that work
@@ -1234,7 +1157,6 @@ accompany the operating system.  Such a contradiction means you cannot
 use both them and the Library together in an executable that you
 distribute.
 
-
   7. You may place library facilities that are a work based on the
 Library side-by-side in a single library together with other library
 facilities not covered by this License, and distribute such a combined
@@ -1251,7 +1173,6 @@ permitted, and provided that you do these two things:
     that part of it is a work based on the Library, and explaining
     where to find the accompanying uncombined form of the same work.
 
-
   8. You may not copy, modify, sublicense, link with, or distribute
 the Library except as expressly provided under this License.  Any
 attempt otherwise to copy, modify, sublicense, link with, or
@@ -1260,7 +1181,6 @@ rights under this License.  However, parties who have received copies,
 or rights, from you under this License will not have their licenses
 terminated so long as such parties remain in full compliance.
 
-
   9. You are not required to accept this License, since you have not
 signed it.  However, nothing else grants you permission to modify or
 distribute the Library or its derivative works.  These actions are
@@ -1412,473 +1332,8 @@ necessary.  Here is a sample; alter the names:
 
 That's all there is to it!
 
-GNU Lesser General Public License Version 2, June 1991
-
-GNU LIBRARY GENERAL PUBLIC LICENSE
-
-Version 2, June 1991
-
-Copyright (C) 1991 Free Software Foundation, Inc.
-51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is numbered 2
-because it goes with version 2 of the ordinary GPL.]
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to
-share and change it. By contrast, the GNU General Public Licenses are
-intended to guarantee your freedom to share and change free software--to make
-sure the software is free for all its users.
-
-This license, the Library General Public License, applies to some specially
-designated Free Software Foundation software, and to any other libraries
-whose authors decide to use it. You can use it for your libraries, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you
-wish), that you receive source code or can get it if you want it, that you
-can change the software or use pieces of it in new free programs; and that
-you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to
-deny you these rights or to ask you to surrender the rights. These
-restrictions translate to certain responsibilities for you if you distribute
-copies of the library, or if you modify it.
-
-For example, if you distribute copies of the library, whether gratis or for a
-fee, you must give the recipients all the rights that we gave you. You must
-make sure that they, too, receive or can get the source code. If you link a
-program with the library, you must provide complete object files to the
-recipients so that they can relink them with the library, after making
-changes to the library and recompiling it. And you must show them these terms
-so they know their rights.
-
-Our method of protecting your rights has two steps: (1) copyright the
-library, and (2) offer you this license which gives you legal permission to
-copy, distribute and/or modify the library.
-
-Also, for each distributor's protection, we want to make certain that
-everyone understands that there is no warranty for this free library. If the
-library is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original version, so that any problems
-introduced by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We
-wish to avoid the danger that companies distributing free software will
-individually obtain patent licenses, thus in effect transforming the program
-into proprietary software. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-Most GNU software, including some libraries, is covered by the ordinary GNU
-General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary one;
-be sure to read it in full, and don't assume that anything in it is the same
-as in the ordinary license.
-
-The reason we have a separate public license for some libraries is that they
-blur the distinction we usually make between modifying or adding to a program
-and simply using it. Linking a program with a library, without changing the
-library, is in some sense simply using the library, and is analogous to
-running a utility program or application program. However, in a textual and
-legal sense, the linked executable is a combined work, a derivative of the
-original library, and the ordinary General Public License treats it as such.
-
-Because of this blurred distinction, using the ordinary General Public
-License for libraries did not effectively promote software sharing, because
-most developers did not use the libraries. We concluded that weaker
-conditions might promote sharing better.
-
-However, unrestricted linking of non-free programs would deprive the users of
-those programs of all benefit from the free status of the libraries
-themselves. This Library General Public License is intended to permit
-developers of non-free programs to use free libraries, while preserving your
-freedom as a user of such programs to change the free libraries that are
-incorporated in them. (We have not seen how to achieve this as regards
-changes in header files, but we have achieved it as regards changes in the
-actual functions of the Library.) The hope is that this will lead to faster
-development of free libraries.
-
-The precise terms and conditions for copying, distribution and modification
-follow. Pay close attention to the difference between a "work based on the
-library" and a "work that uses the library". The former contains code derived
-from the library, while the latter only works together with the library.
-
-Note that it is possible for a library to be covered by the ordinary General
-Public License rather than by this special one.
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License Agreement applies to any software library which contains a
-notice placed by the copyright holder or other authorized party saying it may
-be distributed under the terms of this Library General Public License (also
-called "this License"). Each licensee is addressed as "you".
-
-A "library" means a collection of software functions and/or data prepared so
-as to be conveniently linked with application programs (which use some of
-those functions and data) to form executables.
-
-The "Library", below, refers to any such software library or work which has
-been distributed under these terms. A "work based on the Library" means
-either the Library or any derivative work under copyright law: that is to
-say, a work containing the Library or a portion of it, either verbatim or
-with modifications and/or translated straightforwardly into another language.
-(Hereinafter, translation is included without limitation in the term
-"modification".)
-
-"Source code" for a work means the preferred form of the work for making
-modifications to it. For a library, complete source code means all the source
-code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-library.
-
-Activities other than copying, distribution and modification are not covered
-by this License; they are outside its scope. The act of running a program
-using the Library is not restricted, and output from such a program is
-covered only if its contents constitute a work based on the Library
-(independent of the use of the Library in a tool for writing it). Whether
-that is true depends on what the Library does and what the program that uses
-the Library does.
-
-1. You may copy and distribute verbatim copies of the Library's complete
-source code as you receive it, in any medium, provided that you conspicuously
-and appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this
-License and to the absence of any warranty; and distribute a copy of this
-License along with the Library.
-
-You may charge a fee for the physical act of transferring a copy, and you may
-at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Library or any portion of it,
-thus forming a work based on the Library, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you
-also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-    b) You must cause the files modified to carry prominent notices stating
-that you changed the files and the date of any change.
-    c) You must cause the whole of the work to be licensed at no charge to
-all third parties under the terms of this License.
-    d) If a facility in the modified Library refers to a function or a table
-of data to be supplied by an application program that uses the facility,
-other than as an argument passed when the facility is invoked, then you must
-make a good faith effort to ensure that, in the event an application does not
-supply such function or table, the facility still operates, and performs
-whatever part of its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has a
-purpose that is entirely well-defined independent of the application.
-Therefore, Subsection 2d requires that any application-supplied function or
-table used by this function must be optional: if the application does not
-supply it, the square root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Library, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Library, the distribution of the whole must be
-on the terms of this License, whose permissions for other licensees extend to
-the entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on
-the Library.
-
-In addition, mere aggregation of another work not based on the Library with
-the Library (or with a work based on the Library) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may opt to apply the terms of the ordinary GNU General Public License
-instead of this License to a given copy of the Library. To do this, you must
-alter all the notices that refer to this License, so that they refer to the
-ordinary GNU General Public License, version 2, instead of to this License.
-(If a newer version than version 2 of the ordinary GNU General Public License
-has appeared, then you can specify that version instead if you wish.) Do not
-make any other change in these notices.
-
-Once this change is made in a given copy, it is irreversible for that copy,
-so the ordinary GNU General Public License applies to all subsequent copies
-and derivative works made from that copy.
-
-This option is useful when you wish to copy part of the code of the Library
-into a program that is not a library.
-
-4. You may copy and distribute the Library (or a portion or derivative of it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you accompany it with the complete
-corresponding machine-readable source code, which must be distributed under
-the terms of Sections 1 and 2 above on a medium customarily used for software
-interchange.
-
-If distribution of object code is made by offering access to copy from a
-designated place, then offering equivalent access to copy the source code
-from the same place satisfies the requirement to distribute the source code,
-even though third parties are not compelled to copy the source along with the
-object code.
-
-5. A program that contains no derivative of any portion of the Library, but
-is designed to work with the Library by being compiled or linked with it, is
-called a "work that uses the Library". Such a work, in isolation, is not a
-derivative work of the Library, and therefore falls outside the scope of this
-License.
-
-However, linking a "work that uses the Library" with the Library creates an
-executable that is a derivative of the Library (because it contains portions
-of the Library), rather than a "work that uses the library". The executable
-is therefore covered by this License. Section 6 states terms for distribution
-of such executables.
-
-When a "work that uses the Library" uses material from a header file that is
-part of the Library, the object code for the work may be a derivative work of
-the Library even though the source code is not. Whether this is true is
-especially significant if the work can be linked without the Library, or if
-the work is itself a library. The threshold for this to be true is not
-precisely defined by law.
-
-If such an object file uses only numerical parameters, data structure layouts
-and accessors, and small macros and small inline functions (ten lines or less
-in length), then the use of the object file is unrestricted, regardless of
-whether it is legally a derivative work. (Executables containing this object
-code plus portions of the Library will still fall under Section 6.)
-
-Otherwise, if the work is a derivative of the Library, you may distribute the
-object code for the work under the terms of Section 6. Any executables
-containing that work also fall under Section 6, whether or not they are
-linked directly with the Library itself.
-
-6. As an exception to the Sections above, you may also compile or link a
-"work that uses the Library" with the Library to produce a work containing
-portions of the Library, and distribute that work under terms of your choice,
-provided that the terms permit modification of the work for the customer's
-own use and reverse engineering for debugging such modifications.
-
-You must give prominent notice with each copy of the work that the Library is
-used in it and that the Library and its use are covered by this License. You
-must supply a copy of this License. If the work during execution displays
-copyright notices, you must include the copyright notice for the Library
-among them, as well as a reference directing the user to the copy of this
-License. Also, you must do one of these things:
-
-    a) Accompany the work with the complete corresponding machine-readable
-source code for the Library including whatever changes were used in the work
-(which must be distributed under Sections 1 and 2 above); and, if the work is
-an executable linked with the Library, with the complete machine-readable
-"work that uses the Library", as object code and/or source code, so that the
-user can modify the Library and then relink to produce a modified executable
-containing the modified Library. (It is understood that the user who changes
-the contents of definitions files in the Library will not necessarily be able
-to recompile the application to use the modified definitions.)
-    b) Accompany the work with a written offer, valid for at least three
-years, to give the same user the materials specified in Subsection 6a, above,
-for a charge no more than the cost of performing this distribution.
-    c) If distribution of the work is made by offering access to copy from a
-designated place, offer equivalent access to copy the above specified
-materials from the same place.
-    d) Verify that the user has already received a copy of these materials or
-that you have already sent this user a copy.
-
-For an executable, the required form of the "work that uses the Library" must
-include any data and utility programs needed for reproducing the executable
-from it. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component itself
-accompanies the executable.
-
-It may happen that this requirement contradicts the license restrictions of
-other proprietary libraries that do not normally accompany the operating
-system. Such a contradiction means you cannot use both them and the Library
-together in an executable that you distribute.
-
-7. You may place library facilities that are a work based on the Library
-side-by-side in a single library together with other library facilities not
-covered by this License, and distribute such a combined library, provided
-that the separate distribution of the work based on the Library and of the
-other library facilities is otherwise permitted, and provided that you do
-these two things:
-
-    a) Accompany the combined library with a copy of the same work based on
-the Library, uncombined with any other library facilities. This must be
-distributed under the terms of the Sections above.
-    b) Give prominent notice with the combined library of the fact that part
-of it is a work based on the Library, and explaining where to find the
-accompanying uncombined form of the same work.
-
-8. You may not copy, modify, sublicense, link with, or distribute the Library
-except as expressly provided under this License. Any attempt otherwise to
-copy, modify, sublicense, link with, or distribute the Library is void, and
-will automatically terminate your rights under this License. However, parties
-who have received copies, or rights, from you under this License will not
-have their licenses terminated so long as such parties remain in full
-compliance.
-
-9. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the
-Library or its derivative works. These actions are prohibited by law if you
-do not accept this License. Therefore, by modifying or distributing the
-Library (or any work based on the Library), you indicate your acceptance of
-this License to do so, and all its terms and conditions for copying,
-distributing or modifying the Library or works based on it.
-
-10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the original
-licensor to copy, distribute, link with or modify the Library subject to
-these terms and conditions. You may not impose any further restrictions on
-the recipients' exercise of the rights granted herein. You are not
-responsible for enforcing compliance by third parties to this License.
-
-11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not excuse
-you from the conditions of this License. If you cannot distribute so as to
-satisfy simultaneously your obligations under this License and any other
-pertinent obligations, then as a consequence you may not distribute the
-Library at all. For example, if a patent license would not permit
-royalty-free redistribution of the Library by all those who receive copies
-directly or indirectly through you, then the only way you could satisfy both
-it and this License would be to refrain entirely from distribution of the
-Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply, and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents
-or other property right claims or to contest validity of any such claims;
-this section has the sole purpose of protecting the integrity of the free
-software distribution system which is implemented by public license
-practices. Many people have made generous contributions to the wide range of
-software distributed through that system in reliance on consistent
-application of that system; it is up to the author/donor to decide if he or
-she is willing to distribute software through any other system and a licensee
-cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-12. If the distribution and/or use of the Library is restricted in certain
-countries either by patents or by copyrighted interfaces, the original
-copyright holder who places the Library under this License may add an
-explicit geographical distribution limitation excluding those countries, so
-that distribution is permitted only in or among countries not thus excluded.
-In such case, this License incorporates the limitation as if written in the
-body of this License.
-
-13. The Free Software Foundation may publish revised and/or new versions of
-the Library General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and "any later
-version", you have the option of following the terms and conditions either of
-that version or of any later version published by the Free Software
-Foundation. If the Library does not specify a license version number, you may
-choose any version ever published by the Free Software Foundation.
-
-14. If you wish to incorporate parts of the Library into other free programs
-whose distribution conditions are incompatible with these, write to the
-author to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes make
-exceptions for this. Our decision will be guided by the two goals of
-preserving the free status of all derivatives of our free software and of
-promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
-LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO
-LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
-THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER
-SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
-How to Apply These Terms to Your New Libraries
-
-If you develop a new library, and you want it to be of the greatest possible
-use to the public, we recommend making it free software that everyone can
-redistribute and change. You can do so by permitting redistribution under
-these terms (or, alternatively, under the terms of the ordinary General
-Public License).
-
-To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-one line to give the library's name and an idea of what it does.
-Copyright (C) year  name of author
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-Boston, MA  02110-1301, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright interest in
-the library `Frob' (a library for tweaking knobs) written
-by James Random Hacker.
-
-signature of Ty Coon, 1 April 1990
-Ty Coon, President of Vice
-
-That's all there is to it!
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
+   ======================================================================
+   ======================================================================
 
 Written Offer for Source Code
 
@@ -1892,6 +1347,7 @@ Written Offer for Source Code
    request to the address listed below or by sending an email to Oracle
    using the following link:
    http://www.oracle.com/goto/opensourcecode/request.
+
   Oracle America, Inc.
   Attn: Senior Vice President
   Development and Engineering Legal
@@ -1915,11 +1371,14 @@ Written Offer for Source Code
 
      * A telephone number in the event we need to reach you.
 
+
    We may charge you a fee to cover the cost of physical media and
    processing.
 
    Your request must be sent
+
     a. within three (3) years of the date you received the Oracle product
        that included the binary that is the subject of your request, or
+
     b. in the case of code licensed under the GPL v3 for as long as Oracle
        offers spare parts or customer support for that product model.

From 47632f8d5f35588db847e198ec977c15ee6c9fb2 Mon Sep 17 00:00:00 2001
From: Dusan Balek 
Date: Wed, 9 Nov 2022 17:52:15 +0100
Subject: [PATCH 33/33] LSP: Create test class code action added. (#4939)

---
 .../server/protocol/TestClassGenerator.java   | 311 ++++++++++++++++++
 1 file changed, 311 insertions(+)
 create mode 100644 java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TestClassGenerator.java

diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TestClassGenerator.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TestClassGenerator.java
new file mode 100644
index 000000000000..7a352e078790
--- /dev/null
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TestClassGenerator.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.protocol;
+
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSyntaxException;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreePath;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import org.eclipse.lsp4j.CodeAction;
+import org.eclipse.lsp4j.CodeActionKind;
+import org.eclipse.lsp4j.CodeActionParams;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.eclipse.lsp4j.ShowDocumentParams;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.java.project.JavaProjectConstants;
+import org.netbeans.api.java.queries.UnitTestForSourceQuery;
+import org.netbeans.api.java.source.ClasspathInfo;
+import org.netbeans.api.java.source.CompilationController;
+import org.netbeans.api.java.source.CompilationInfo;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.TreeUtilities;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.api.project.SourceGroup;
+import org.netbeans.modules.gsf.testrunner.api.TestCreatorProvider;
+import org.netbeans.modules.gsf.testrunner.plugin.CommonTestUtilProvider;
+import org.netbeans.modules.gsf.testrunner.plugin.GuiUtilsProvider;
+import org.netbeans.modules.java.lsp.server.Utils;
+import org.netbeans.modules.parsing.api.ResultIterator;
+import org.openide.filesystems.FileChangeAdapter;
+import org.openide.filesystems.FileChangeListener;
+import org.openide.filesystems.FileEvent;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = CodeActionsProvider.class, position = 100)
+public final class TestClassGenerator extends CodeActionsProvider {
+
+    private static final String GENERATE_TEST_CLASS_COMMAND = "java.generate.testClass";
+
+    private final Set commands = Collections.singleton(GENERATE_TEST_CLASS_COMMAND);
+
+    @Override
+    @NbBundle.Messages({
+        "# {0} - the testing framework to be used, e.g. JUnit, TestNG,...",
+        "# {1} - the location where the test class will be created",
+        "DN_GenerateTestClass=Create Test Class [{0} in {1}]"
+    })
+    public List getCodeActions(ResultIterator resultIterator, CodeActionParams params) throws Exception {
+        CompilationController info = CompilationController.get(resultIterator.getParserResult());
+        if (info == null) {
+            return Collections.emptyList();
+        }
+        info.toPhase(JavaSource.Phase.RESOLVED);
+        int offset = getOffset(info, params.getRange().getStart());
+        TreePath tp = info.getTreeUtilities().pathFor(offset);
+        if (!TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
+            return Collections.emptyList();
+        }
+        ClassTree cls = (ClassTree) tp.getLeaf();
+        SourcePositions sourcePositions = info.getTrees().getSourcePositions();
+        int startPos = (int) sourcePositions.getStartPosition(tp.getCompilationUnit(), cls);
+        String code = info.getText();
+	if (startPos < 0 || offset < 0 || offset < startPos || offset >= code.length()) {
+            return Collections.emptyList();
+        }
+        String headerText = code.substring(startPos, offset);
+        int idx = headerText.indexOf('{');
+        if (idx >= 0) {
+            return Collections.emptyList();
+        }
+        ClassPath cp = info.getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE);
+        FileObject fileObject = info.getFileObject();
+        if (!fileObject.isValid()) {
+            return Collections.emptyList();
+        }
+        FileObject root = cp.findOwnerRoot(fileObject);
+        if (root == null) {
+            return Collections.emptyList();
+        }
+        Map> validCombinations = getValidCombinations(info);
+        if (validCombinations == null || validCombinations.isEmpty()) {
+            return Collections.emptyList();
+        }
+        List result = new ArrayList<>();
+        for (Map.Entry> entrySet : validCombinations.entrySet()) {
+            Object location = entrySet.getKey();
+            for (String testingFramework : entrySet.getValue()) {
+                result.add((createCodeAction(Bundle.DN_GenerateTestClass(testingFramework, getLocationText(location)), CodeActionKind.Refactor, null, GENERATE_TEST_CLASS_COMMAND, Utils.toUri(fileObject), testingFramework, Utils.toUri(getTargetFolder(location)))));
+            }
+        }
+	return result;
+    }
+
+    @Override
+    public Set getCommands() {
+        return commands;
+    }
+
+    @Override
+    public CompletableFuture processCommand(NbCodeLanguageClient client, String command, List arguments) {
+        try {
+            if (arguments.size() > 2) {
+                String uri = ((JsonPrimitive) arguments.get(0)).getAsString();
+                FileObject fileObject = Utils.fromUri(uri);
+                if (fileObject == null) {
+                    throw new IllegalArgumentException(String.format("Cannot resolve source file from uri: %s", uri));
+                }
+                String testingFramework = ((JsonPrimitive) arguments.get(1)).getAsString();
+                String targetUri = ((JsonPrimitive) arguments.get(2)).getAsString();
+                FileObject targetFolder = Utils.fromUri(targetUri);
+                if (targetFolder == null) {
+                    throw new IllegalArgumentException(String.format("Cannot resolve target folder from uri: %s", targetUri));
+                }
+                Collection> providers = Lookup.getDefault().lookupResult(TestCreatorProvider.class).allItems();
+                for (final Lookup.Item provider : providers) {
+                    if (provider.getDisplayName().equals(testingFramework)) {
+                        final TestCreatorProvider.Context context = new TestCreatorProvider.Context(new FileObject[]{fileObject});
+                        context.setSingleClass(true);
+                        context.setTargetFolder(targetFolder);
+                        context.setTestClassName(getPreffiledName(fileObject, testingFramework));
+                        FileChangeListener fcl = new FileChangeAdapter() {
+                            @Override
+                            public void fileDataCreated(FileEvent fe) {
+                                RequestProcessor.getDefault().post(() -> {
+                                    client.showDocument(new ShowDocumentParams(Utils.toUri(fe.getFile())));
+                                }, 1000);
+                            }
+                        };
+                        targetFolder.addRecursiveListener(fcl);
+                        try {
+                            provider.getInstance().createTests(context);
+                        } finally {
+                            RequestProcessor.getDefault().post(() -> {
+                                targetFolder.removeRecursiveListener(fcl);
+                            }, 1000);
+                        }
+                    }
+                }
+            } else {
+                throw new IllegalArgumentException(String.format("Illegal number of arguments received for command: %s", command));
+            }
+        } catch (JsonSyntaxException | IllegalArgumentException | MalformedURLException ex) {
+            client.showMessage(new MessageParams(MessageType.Error, ex.getLocalizedMessage()));
+        }
+        return CompletableFuture.completedFuture(true);
+    }
+
+    private static String getLocationText(Object location) {
+	String text = location instanceof SourceGroup
+		? ((SourceGroup) location).getDisplayName()
+		: location instanceof FileObject
+		? FileUtil.getFileDisplayName((FileObject) location)
+		: location.toString();
+	return text;
+    }
+
+    private static Map> getValidCombinations(CompilationInfo info) {
+	List testingFrameworks = getTestingFrameworks(info.getFileObject());
+	if (testingFrameworks.isEmpty()) {
+	    return null;
+	}
+	Map> validCombinations = new HashMap<>();
+	for (Object location : getLocations(info.getFileObject())) {
+	    String targetFolderPath = getTargetFolderPath(location);
+	    List framework2Add = new ArrayList<>();
+	    for (String framework : testingFrameworks) {
+		String preffiledName = getPreffiledName(info.getFileObject(), framework);
+		preffiledName = preffiledName.replace('.', File.separatorChar).concat(".java");
+		String path = targetFolderPath.concat(File.separator).concat(preffiledName);
+		File f = new File(path);
+		FileObject fo = FileUtil.toFileObject(f);
+                if (fo == null) {
+                    framework2Add.add(framework);
+                }
+	    }
+	    if (!framework2Add.isEmpty()) {
+		validCombinations.put(location, framework2Add);
+	    }
+	}
+	return validCombinations;
+    }
+
+    private static List getTestingFrameworks(FileObject fileObject) {
+	List testingFrameworks = new ArrayList<>();
+	Collection> testCreatorProviders = Lookup.getDefault().lookupResult(TestCreatorProvider.class).allItems();
+	for (Lookup.Item provider : testCreatorProviders) {
+            if (provider.getInstance().enable(new FileObject[]{fileObject})) {
+                testingFrameworks.add(provider.getDisplayName());
+            }
+	}
+        return testingFrameworks;
+    }
+
+    private static Object[] getLocations(FileObject activeFO) {
+        Object[] locations = null;
+	Collection testUtilProviders = Lookup.getDefault().lookupAll(CommonTestUtilProvider.class);
+	for (CommonTestUtilProvider provider : testUtilProviders) {
+	    locations = provider.getTestTargets(activeFO);
+	    break;
+	}
+	if (locations != null && locations.length == 0) {
+            SourceGroup sourceGroupOwner = findSourceGroupOwner(activeFO);
+            if (sourceGroupOwner != null) {
+                locations = UnitTestForSourceQuery.findUnitTests(sourceGroupOwner.getRootFolder());
+            }
+        }
+        return locations != null ? locations : new Object[0];
+    }
+
+    private static String getPreffiledName(FileObject fileObj, String selectedFramework) {
+	ClassPath cp = ClassPath.getClassPath(fileObj, ClassPath.SOURCE);
+	String className = cp.getResourceName(fileObj, '.', false);
+	return className + getTestingFrameworkSuffix(selectedFramework) + "Test";
+    }
+
+    private static String getTestingFrameworkSuffix(String selectedFramework) {
+	if (selectedFramework == null) {
+	    return "";
+	}
+	String testngFramework = "";
+	Collection providers = Lookup.getDefault().lookupAll(GuiUtilsProvider.class);
+	for (GuiUtilsProvider provider : providers) {
+	    testngFramework = provider.getTestngFramework();
+	    break;
+	}
+	return selectedFramework.equals(testngFramework) ? "NG" : "";
+    }
+
+    private static FileObject getTargetFolder(Object selectedLocation) {
+	if (selectedLocation == null) {
+	    return null;
+	}
+	if (selectedLocation instanceof SourceGroup) {
+	    return ((SourceGroup) selectedLocation).getRootFolder();
+	}
+        if (selectedLocation instanceof URL) {
+	    return URLMapper.findFileObject((URL) selectedLocation);
+	}
+	assert selectedLocation instanceof FileObject;
+	return (FileObject) selectedLocation;
+    }
+
+    private static String getTargetFolderPath(Object selectedLocation) {
+	if (selectedLocation == null) {
+	    return null;
+	}
+	if (selectedLocation instanceof SourceGroup) {
+	    return ((SourceGroup) selectedLocation).getRootFolder().getPath();
+	}
+        if (selectedLocation instanceof URL) {
+	    return ((URL) selectedLocation).getPath();
+	}
+	assert selectedLocation instanceof FileObject;
+	return ((FileObject) selectedLocation).getPath();
+    }
+
+    private static SourceGroup findSourceGroupOwner(FileObject file) {
+        final Project project = FileOwnerQuery.getOwner(file);
+        if (project != null) {
+        final SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
+            for (int i = 0; i < sourceGroups.length; i++) {
+                SourceGroup srcGroup = sourceGroups[i];
+                FileObject root = srcGroup.getRootFolder();
+                if (((file==root)||(FileUtil.isParentOf(root,file))) && srcGroup.contains(file)) {
+                    return srcGroup;
+                }
+            }
+        }
+        return null;
+    }
+}