From 5ab4fe2e6066108ae357392ad2f490afce6106ef Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Tue, 26 May 2020 13:59:01 +0200 Subject: [PATCH 1/5] No Guava classes used --- .gitignore | 1 + pom.xml | 29 +- .../aemrules/AemRulesSonarPlugin.java | 7 +- .../aemrules/extensions/RulesLoader.java | 30 +- .../com/cognifide/aemrules/htl/HtlChecks.java | 4 +- .../aemrules/htl/HtlFilesAnalyzer.java | 5 +- .../htl/checks/AvoidExtraSlyTagsCheck.java | 4 +- .../checks/DefaultDisplayContextCheck.java | 51 +- .../HtlAttributesShouldBeAtTheEndCheck.java | 4 +- .../aemrules/htl/checks/HtlCommentsCheck.java | 6 +- .../UseSlyTagsOverRedundantMarkupCheck.java | 7 +- .../aemrules/htl/lex/ElementTokenizer.java | 9 +- .../aemrules/htl/rules/HtlCheckClasses.java | 3 +- .../aemrules/htl/visitors/HtlScanner.java | 4 +- .../AdministrativeAccessUsageCheck.java | 14 +- .../aemrules/java/checks/ConstantsCheck.java | 3 +- .../checks/ModifiableValueMapUsageCheck.java | 3 +- .../checks/PreferSlingServletAnnotation.java | 11 +- .../java/checks/SessionShouldBeLoggedOut.java | 4 +- .../checks/SynchronizedKeywordUsageCheck.java | 4 +- .../java/checks/ThreadSafeFieldCheck.java | 9 +- .../close/FindRRDeclarationVisitor.java | 5 +- .../close/ResourceResolverShouldBeClosed.java | 4 +- .../FindSessionDeclarationVisitor.java | 4 +- .../FindVariableDeclarationVisitor.java | 5 +- .../aemrules/java/rules/JavaCheckClasses.java | 4 +- .../aemrules/java/util/ConstantsChecker.java | 799 +++++++++--------- .../cognifide/aemrules/utils/Comparables.java | 45 + .../cognifide/aemrules/utils/MultiMap.java | 96 +++ .../cognifide/aemrules/utils/Throwables.java | 36 + 30 files changed, 683 insertions(+), 527 deletions(-) create mode 100644 src/main/java/com/cognifide/aemrules/utils/Comparables.java create mode 100644 src/main/java/com/cognifide/aemrules/utils/MultiMap.java create mode 100644 src/main/java/com/cognifide/aemrules/utils/Throwables.java diff --git a/.gitignore b/.gitignore index 9f584667..2e34aaf9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ atlassian-ide-plugin.xml .classpath .project .settings/ +.java-version \ No newline at end of file diff --git a/pom.xml b/pom.xml index baff20f0..499cef8a 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,8 @@ UTF-8 1.1.2-1.4.0 7.9.2 + + 3.0.1.1444 6.2.0.21135 4rVf3NGV0jyQ3EGrc8L86oEDoHWm6MgDD @@ -131,6 +133,12 @@ sonar-plugin ${sonar.java.plugin} provided + + + + + + org.sonarsource.sslr-squid-bridge @@ -159,11 +167,6 @@ - - com.google.guava - guava - 28.2-jre - org.apache.commons commons-lang3 @@ -173,12 +176,12 @@ org.sonarsource.html sonar-html-plugin ${sonar.html.version} - - - com.google.guava - guava - - + + + + + + @@ -293,8 +296,8 @@ maven-compiler-plugin 3.5.1 - 1.8 - 1.8 + 11 + 11 diff --git a/src/main/java/com/cognifide/aemrules/AemRulesSonarPlugin.java b/src/main/java/com/cognifide/aemrules/AemRulesSonarPlugin.java index f627c741..1935f2f9 100644 --- a/src/main/java/com/cognifide/aemrules/AemRulesSonarPlugin.java +++ b/src/main/java/com/cognifide/aemrules/AemRulesSonarPlugin.java @@ -25,15 +25,16 @@ import com.cognifide.aemrules.htl.Constants; import com.cognifide.aemrules.htl.HtlProfile; import com.cognifide.aemrules.htl.HtlSensor; -import com.google.common.collect.ImmutableList; import org.sonar.api.Plugin; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; +import java.util.List; + public class AemRulesSonarPlugin implements Plugin { - private static ImmutableList pluginProperties() { - return ImmutableList.of( + private static List pluginProperties() { + return List.of( PropertyDefinition.builder(Constants.FILE_EXTENSIONS_PROP_KEY) .name("File suffixes") .description("List of file suffixes that will be scanned.") diff --git a/src/main/java/com/cognifide/aemrules/extensions/RulesLoader.java b/src/main/java/com/cognifide/aemrules/extensions/RulesLoader.java index 36a32804..f159c185 100644 --- a/src/main/java/com/cognifide/aemrules/extensions/RulesLoader.java +++ b/src/main/java/com/cognifide/aemrules/extensions/RulesLoader.java @@ -20,17 +20,16 @@ package com.cognifide.aemrules.extensions; import com.cognifide.aemrules.metadata.Metadata; -import com.google.common.base.Function; -import com.google.common.base.Functions; -import com.google.common.collect.ImmutableMap; -import com.google.common.io.Resources; import java.io.IOException; import java.lang.reflect.Field; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.List; +import java.util.Map; import java.util.Optional; import javax.annotation.CheckForNull; + +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,20 +51,17 @@ public class RulesLoader { private static final String RULE_DESCRIPTION_EXTENSION = "md"; - private static final Function, RuleParamType> TYPE_FOR_CLASS = Functions.forMap( - ImmutableMap., RuleParamType>builder() - .put(Integer.class, RuleParamType.INTEGER) - .put(int.class, RuleParamType.INTEGER) - .put(Float.class, RuleParamType.FLOAT) - .put(float.class, RuleParamType.FLOAT) - .put(Boolean.class, RuleParamType.BOOLEAN) - .put(boolean.class, RuleParamType.BOOLEAN) - .build(), - RuleParamType.STRING + private static final Map, RuleParamType> TYPE_FOR_CLASS = Map.of( + Integer.class, RuleParamType.INTEGER, + int.class, RuleParamType.INTEGER, + Float.class, RuleParamType.FLOAT, + float.class, RuleParamType.FLOAT, + Boolean.class, RuleParamType.BOOLEAN, + boolean.class, RuleParamType.BOOLEAN ); private static RuleParamType guessType(Class type) { - return TYPE_FOR_CLASS.apply(type); + return TYPE_FOR_CLASS.getOrDefault(type, RuleParamType.STRING); } public void load(RulesDefinition.NewExtendedRepository repo, List> annotatedClasses) { @@ -123,8 +119,8 @@ private String loadResource(String resourceFolder, String ruleKey, String fileEx String result = null; try { String path = String.format("/%s/%s.%s", resourceFolder, ruleKey, fileExtension); - URL url = Resources.getResource(RulesLoader.class, path); - result = Resources.toString(url, StandardCharsets.UTF_8); + URL url = getClass().getResource(path); + result = IOUtils.toString(url, StandardCharsets.UTF_8); } catch (IOException | IllegalArgumentException e) { LOG.error("Cannot read resource file.", e); } diff --git a/src/main/java/com/cognifide/aemrules/htl/HtlChecks.java b/src/main/java/com/cognifide/aemrules/htl/HtlChecks.java index 6c5efaaa..1b8dd054 100644 --- a/src/main/java/com/cognifide/aemrules/htl/HtlChecks.java +++ b/src/main/java/com/cognifide/aemrules/htl/HtlChecks.java @@ -20,8 +20,8 @@ package com.cognifide.aemrules.htl; import com.cognifide.aemrules.htl.api.HtlCheck; -import com.google.common.collect.Sets; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -34,7 +34,7 @@ public class HtlChecks { private final CheckFactory checkFactory; - private Set> checksByRepository = Sets.newHashSet(); + private final Set> checksByRepository = new HashSet<>(); private HtlChecks(CheckFactory checkFactory) { this.checkFactory = checkFactory; diff --git a/src/main/java/com/cognifide/aemrules/htl/HtlFilesAnalyzer.java b/src/main/java/com/cognifide/aemrules/htl/HtlFilesAnalyzer.java index d55a2d91..54e80ee8 100644 --- a/src/main/java/com/cognifide/aemrules/htl/HtlFilesAnalyzer.java +++ b/src/main/java/com/cognifide/aemrules/htl/HtlFilesAnalyzer.java @@ -21,10 +21,11 @@ import com.cognifide.aemrules.htl.api.ParsingErrorRule; import com.cognifide.aemrules.htl.rules.HtlCheckClasses; -import com.google.common.base.Throwables; import java.io.IOException; import java.io.InterruptedIOException; import java.util.concurrent.CancellationException; + +import com.cognifide.aemrules.utils.Throwables; import org.apache.sling.scripting.sightly.compiler.SightlyCompilerException; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.rule.CheckFactory; @@ -41,7 +42,7 @@ public abstract class HtlFilesAnalyzer { private static final Logger LOGGER = Loggers.get(HtlFilesAnalyzer.class); protected final HtlChecks checks; - private RuleKey parsingErrorRuleKey; + private final RuleKey parsingErrorRuleKey; public HtlFilesAnalyzer(CheckFactory checkFactory) { this.checks = HtlChecks.createHtlCheck(checkFactory) diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/AvoidExtraSlyTagsCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/AvoidExtraSlyTagsCheck.java index dd759f58..86622ea4 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/AvoidExtraSlyTagsCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/AvoidExtraSlyTagsCheck.java @@ -22,13 +22,13 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.StringUtils; import org.sonar.check.Priority; import org.sonar.check.Rule; import org.sonar.plugins.html.node.Attribute; import org.sonar.plugins.html.node.TagNode; +import java.util.List; import java.util.Optional; @Rule( @@ -51,7 +51,7 @@ public class AvoidExtraSlyTagsCheck extends AbstractHtlCheck { private static final String SLY_TAG = "sly"; - private static final ImmutableList SLY_ATTRIBUTES = ImmutableList.of("data-sly-use", + private static final List SLY_ATTRIBUTES = List.of("data-sly-use", "data-sly-test", "data-sly-call"); diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java index 65abc425..f287c4a8 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java @@ -21,8 +21,8 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; +import com.cognifide.aemrules.utils.MultiMap; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableMultimap; import org.sonar.check.Priority; import org.sonar.check.Rule; import org.sonar.plugins.html.node.TagNode; @@ -52,35 +52,36 @@ public class DefaultDisplayContextCheck extends AbstractHtlCheck { private static final String VIOLATION_MESSAGE = "Explicitly using default display context, please remove display context from expression"; - private static final ImmutableMultimap TAG_ATTRIBUTE_MAPPING = ImmutableMultimap.builder() - .put("form", "action") - .put("blockquote", "cite") - .put("del", "cite") - .put("ins", "cite") - .put("q", "cite") - .put("object", "data") - .put("button", "formaction") - .put("input", "formaction") - .put("a", "href") - .put("area", "href") - .put("link", "href") - .put("base", "href") - .put("html", "manifest") - .put("video", "poster") - .put("audio", "src") - .put("embed", "src") - .put("iframe", "src") - .put("img", "src") - .put("input", "src") - .put("script", "src") - .put("source", "src") - .put("track", "src").build(); + private static final MultiMap TAG_ATTRIBUTE_MAPPING = MultiMap.builder(m -> { + m.add("form", "action"); + m.add("blockquote", "cite"); + m.add("del", "cite"); + m.add("ins", "cite"); + m.add("q", "cite"); + m.add("object", "data"); + m.add("button", "formaction"); + m.add("input", "formaction"); + m.add("a", "href"); + m.add("area", "href"); + m.add("link", "href"); + m.add("base", "href"); + m.add("html", "manifest"); + m.add("video", "poster"); + m.add("audio", "src"); + m.add("embed", "src"); + m.add("iframe", "src"); + m.add("img", "src"); + m.add("input", "src"); + m.add("script", "src"); + m.add("source", "src"); + m.add("track", "src"); + }); @Override public void startElement(TagNode node) { String nodeName = node.getNodeName(); if (TAG_ATTRIBUTE_MAPPING.containsKey(nodeName)) { - Collection supportedAttributes = TAG_ATTRIBUTE_MAPPING.get(nodeName); + Collection supportedAttributes = TAG_ATTRIBUTE_MAPPING.getAll(nodeName); node.getAttributes().stream() .filter(attribute -> supportedAttributes.contains(attribute.getName())) .filter(a -> CONTEXT_URI_DEFINITION.matcher(a.getValue()).find()) diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheck.java index 8d2b9954..9fcce478 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheck.java @@ -21,8 +21,8 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; +import com.cognifide.aemrules.utils.Comparables; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Ordering; import java.util.List; import java.util.stream.Collectors; @@ -53,7 +53,7 @@ public class HtlAttributesShouldBeAtTheEndCheck extends AbstractHtlCheck { static final String RULE_MESSAGE = "Always place HTL attributes at the end"; private static boolean isOrdered(Iterable list) { - return Ordering.natural().isOrdered(list); + return Comparables.isOrdered(list); } @Override diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/HtlCommentsCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/HtlCommentsCheck.java index 0088a331..2abb9202 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/HtlCommentsCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/HtlCommentsCheck.java @@ -22,7 +22,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -52,9 +51,8 @@ public class HtlCommentsCheck extends AbstractHtlCheck { static final String RULE_MESSAGE = "Always use HTL style of comments"; - private static final List SSI_ELEMENTS = Lists - .newArrayList("comment", "config", "echo", "exec", "fsize", "flastmod", "include", "printenv", - "set"); + private static final List SSI_ELEMENTS = List.of("comment", "config", "echo", "exec", "fsize", "flastmod", + "include", "printenv", "set"); private static final Pattern CONDITIONAL_COMMENT_PATTERN = Pattern .compile(""); diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheck.java index 8948ffbf..38e8b734 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheck.java @@ -22,7 +22,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.StringUtils; import org.apache.sling.scripting.sightly.compiler.expression.Expression; import org.sonar.check.Priority; @@ -55,10 +54,12 @@ public class UseSlyTagsOverRedundantMarkupCheck extends AbstractHtlCheck { private static final String SLY_TAG = "sly"; - private static final ImmutableList SLY_ATTRIBUTES = ImmutableList.of("data-sly-use", + private static final List SLY_ATTRIBUTES = List.of( + "data-sly-use", "data-sly-include", "data-sly-resource", - "data-sly-call"); + "data-sly-call" + ); @Override public void startHtlElement(List expressions, TagNode node) { diff --git a/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java b/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java index 89bc1cea..e7b18c19 100644 --- a/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java +++ b/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java @@ -19,7 +19,6 @@ */ package com.cognifide.aemrules.htl.lex; -import com.google.common.collect.ImmutableSet; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; @@ -33,11 +32,11 @@ class ElementTokenizer extends AbstractTokenizer> { - private static EndQNameMatcher endQNameMatcher = new EndQNameMatcher(); + private static final EndQNameMatcher endQNameMatcher = new EndQNameMatcher(); - private static EndTokenMatcher endTokenMatcher = new EndTokenMatcher(); + private static final EndTokenMatcher endTokenMatcher = new EndTokenMatcher(); - private static EndUnquotedAttributeMatcher endUnquotedAttributeMatcher = new EndUnquotedAttributeMatcher(); + private static final EndUnquotedAttributeMatcher endUnquotedAttributeMatcher = new EndUnquotedAttributeMatcher(); public ElementTokenizer(String startToken, String endToken) { super(startToken, endToken); @@ -196,7 +195,7 @@ public boolean match(int character) { private static final class EndUnquotedAttributeMatcher implements EndMatcher { - private static final Set FORBIDDEN = ImmutableSet.of( + private static final Set FORBIDDEN = Set.of( '"', '\'', '=', diff --git a/src/main/java/com/cognifide/aemrules/htl/rules/HtlCheckClasses.java b/src/main/java/com/cognifide/aemrules/htl/rules/HtlCheckClasses.java index 94e7270b..f1d70d0b 100644 --- a/src/main/java/com/cognifide/aemrules/htl/rules/HtlCheckClasses.java +++ b/src/main/java/com/cognifide/aemrules/htl/rules/HtlCheckClasses.java @@ -38,7 +38,6 @@ import com.cognifide.aemrules.htl.checks.SlyElementsAreAutomaticallyUnwrappedCheck; import com.cognifide.aemrules.htl.checks.UseMostRestrictiveHtlContextCheck; import com.cognifide.aemrules.htl.checks.UseSlyTagsOverRedundantMarkupCheck; -import com.google.common.collect.ImmutableList; import org.sonar.check.Rule; import java.util.List; @@ -50,7 +49,7 @@ public final class HtlCheckClasses { public static final String REPOSITORY_NAME = "AEM Rules"; - private static final List> CLASSES = ImmutableList.of( + private static final List> CLASSES = List.of( ParsingErrorCheck.class, HtlCommentsCheck.class, AvoidExtraSlyTagsCheck.class, diff --git a/src/main/java/com/cognifide/aemrules/htl/visitors/HtlScanner.java b/src/main/java/com/cognifide/aemrules/htl/visitors/HtlScanner.java index b01239a7..50870e67 100644 --- a/src/main/java/com/cognifide/aemrules/htl/visitors/HtlScanner.java +++ b/src/main/java/com/cognifide/aemrules/htl/visitors/HtlScanner.java @@ -19,7 +19,7 @@ */ package com.cognifide.aemrules.htl.visitors; -import com.google.common.collect.Lists; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -42,7 +42,7 @@ public class HtlScanner { private static final ExpressionParser expressionParser = new ExpressionParser(); - private final List checkVisitors = Lists.newArrayList(); + private final List checkVisitors = new ArrayList<>(); private static void scanElementTag(DefaultHtlVisitor visitor, TagNode node) { if (!node.isEndElement()) { visitor.startElement(node); diff --git a/src/main/java/com/cognifide/aemrules/java/checks/AdministrativeAccessUsageCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/AdministrativeAccessUsageCheck.java index 1cbdf055..0cbf6772 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/AdministrativeAccessUsageCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/AdministrativeAccessUsageCheck.java @@ -26,8 +26,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.Map; import org.sonar.check.Priority; @@ -56,12 +54,12 @@ public class AdministrativeAccessUsageCheck extends IssuableSubscriptionVisitor public static final String RULE_MESSAGE = "Do not use deprecated administrative access methods"; - private static final Map SUBSTITUTES = ImmutableMap.builder() - .put("loginAdministrative", "loginService") - .put("getAdministrativeResourceResolver", "getServiceResourceResolver") - .build(); + private static final Map SUBSTITUTES = Map.of( + "loginAdministrative", "loginService", + "getAdministrativeResourceResolver", "getServiceResourceResolver" + ); - private static final List matchers = ImmutableList.of( + private static final List matchers = List.of( MethodMatcher.create( MethodNamePredicate.is("loginAdministrative"), OwnerTypePredicate.is("org.apache.sling.jcr.api.SlingRepository"), @@ -74,7 +72,7 @@ public class AdministrativeAccessUsageCheck extends IssuableSubscriptionVisitor @Override public List nodesToVisit() { - return ImmutableList.of(Tree.Kind.METHOD_INVOCATION); + return List.of(Tree.Kind.METHOD_INVOCATION); } @Override diff --git a/src/main/java/com/cognifide/aemrules/java/checks/ConstantsCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/ConstantsCheck.java index 1dc655a1..c9520e96 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/ConstantsCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/ConstantsCheck.java @@ -23,7 +23,6 @@ import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.java.util.ConstantsChecker; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Lists; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.sonar.check.Priority; @@ -53,7 +52,7 @@ public class ConstantsCheck extends IssuableSubscriptionVisitor { @Override public List nodesToVisit() { - return Lists.newArrayList(Kind.STRING_LITERAL); + return List.of(Kind.STRING_LITERAL); } @Override diff --git a/src/main/java/com/cognifide/aemrules/java/checks/ModifiableValueMapUsageCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/ModifiableValueMapUsageCheck.java index 2afeb7a1..50e0466f 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/ModifiableValueMapUsageCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/ModifiableValueMapUsageCheck.java @@ -22,7 +22,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableSet; import java.util.List; import java.util.Set; import org.sonar.check.Priority; @@ -58,7 +57,7 @@ public class ModifiableValueMapUsageCheck extends BaseTreeVisitor implements Jav private static final String MODIFIABLE_VALUE_MAP_FULL_NAME = "org.apache.sling.api.resource.ModifiableValueMap"; - private static final Set MUTABLE_METHODS = ImmutableSet.of("put", "putAll", "remove"); + private static final Set MUTABLE_METHODS = Set.of("put", "putAll", "remove"); private JavaFileScannerContext context; diff --git a/src/main/java/com/cognifide/aemrules/java/checks/PreferSlingServletAnnotation.java b/src/main/java/com/cognifide/aemrules/java/checks/PreferSlingServletAnnotation.java index 7db0c487..8dc24491 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/PreferSlingServletAnnotation.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/PreferSlingServletAnnotation.java @@ -26,7 +26,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Sets; import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.sonar.check.Priority; @@ -69,17 +68,19 @@ public class PreferSlingServletAnnotation extends BaseTreeVisitor implements Jav public static final String NAME = "name"; - private static final Set SERVLET_CONSTANTS = Sets.newHashSet( + private static final Set SERVLET_CONSTANTS = Set.of( "SLING_SERVLET_METHODS", "SLING_SERVLET_EXTENSIONS", "SLING_SERVLET_SELECTORS", - "SLING_SERVLET_RESOURCE_TYPES"); + "SLING_SERVLET_RESOURCE_TYPES" + ); - private static final Set SERVLET_CONSTANTS_VALUES = Sets.newHashSet( + private static final Set SERVLET_CONSTANTS_VALUES = Set.of( "sling.servlet.paths", "sling.servlet.resourceTypes", "sling.servlet.selectors", - "sling.servlet.extensions"); + "sling.servlet.extensions" + ); private JavaFileScannerContext context; diff --git a/src/main/java/com/cognifide/aemrules/java/checks/SessionShouldBeLoggedOut.java b/src/main/java/com/cognifide/aemrules/java/checks/SessionShouldBeLoggedOut.java index 329b82a9..66dcac99 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/SessionShouldBeLoggedOut.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/SessionShouldBeLoggedOut.java @@ -25,8 +25,8 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Sets; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; import org.sonar.check.Priority; @@ -117,7 +117,7 @@ private void collectLongSessionClosed(MethodTree method) { } protected boolean checkIfLoggedOut(MethodTree method, VariableTree injector) { - Set usagesOfSession = Sets.newHashSet(injector.symbol().usages()); + Set usagesOfSession = new HashSet<>(injector.symbol().usages()); CheckLoggedOutVisitor checkLoggedOutVisitor = new CheckLoggedOutVisitor(usagesOfSession); FinallyBlockVisitor finallyBlockVisitor = new FinallyBlockVisitor(checkLoggedOutVisitor); method.accept(finallyBlockVisitor); diff --git a/src/main/java/com/cognifide/aemrules/java/checks/SynchronizedKeywordUsageCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/SynchronizedKeywordUsageCheck.java index 114ce660..6e8bde76 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/SynchronizedKeywordUsageCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/SynchronizedKeywordUsageCheck.java @@ -24,7 +24,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableList; import java.util.List; import org.sonar.check.Priority; import org.sonar.check.Rule; @@ -57,8 +56,7 @@ public class SynchronizedKeywordUsageCheck extends IssuableSubscriptionVisitor { protected static final String DESCRIPTION = "Check if using 'synchronized' can be replaced with more sophisticated solution."; - private static final List ACCEPTED_NODE_KINDS - = ImmutableList.of(Kind.SYNCHRONIZED_STATEMENT, Kind.METHOD); + private static final List ACCEPTED_NODE_KINDS = List.of(Kind.SYNCHRONIZED_STATEMENT, Kind.METHOD); @Override public List nodesToVisit() { diff --git a/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java index 3fdeac70..11a3664b 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java @@ -22,7 +22,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Sets; import java.util.Set; import org.sonar.check.Priority; import org.sonar.check.Rule; @@ -56,24 +55,24 @@ public class ThreadSafeFieldCheck extends BaseTreeVisitor implements JavaFileSca public static final String RULE_MESSAGE = "Usage of %s as a field is not thread safe."; - private static Set vulnerableClasses = Sets.newHashSet( + private static final Set vulnerableClasses = Set.of( // empty for now ); - private static Set vulnerableInterfaces = Sets.newHashSet( + private static final Set vulnerableInterfaces = Set.of( "javax.servlet.Servlet", "javax.servlet.Filter", "org.osgi.service.event.EventHandler" ); - private static Set vulnerableAnnotations = Sets.newHashSet( + private static final Set vulnerableAnnotations = Set.of( "org.apache.felix.scr.annotations.Component", "org.osgi.service.component.annotations.Component", "org.apache.felix.scr.annotations.sling.SlingServlet", // this is possibly duplicative, but that shouldn't be a problem. "org.apache.felix.scr.annotations.sling.SlingFilter" // this is possibly duplicative, but that shouldn't be a problem. ); - private static Set nonThreadSafeTypes = Sets.newHashSet( + private static final Set nonThreadSafeTypes = Set.of( "org.apache.sling.api.resource.ResourceResolver", "javax.jcr.Session", "com.day.cq.wcm.api.PageManager", diff --git a/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java b/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java index 3e5f294e..559d8932 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java @@ -20,6 +20,7 @@ package com.cognifide.aemrules.java.checks.resourceresolver.close; import java.util.Collection; +import java.util.HashSet; import java.util.Set; import org.sonar.plugins.java.api.semantic.Symbol; @@ -34,8 +35,6 @@ import org.sonar.plugins.java.api.tree.TryStatementTree; import org.sonar.plugins.java.api.tree.VariableTree; -import com.google.common.collect.Sets; - /** * Finds all injector variable declarations. Used in method's bodies only. Works only for declaration within the same file - api limitations: {@link * Symbol#declaration()} @@ -49,7 +48,7 @@ class FindRRDeclarationVisitor extends BaseTreeVisitor { private final Set resourceResolvers; FindRRDeclarationVisitor() { - resourceResolvers = Sets.newHashSet(); + resourceResolvers = new HashSet<>(); } public Collection getDeclarations() { diff --git a/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/ResourceResolverShouldBeClosed.java b/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/ResourceResolverShouldBeClosed.java index fa1d92e7..a51e793a 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/ResourceResolverShouldBeClosed.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/resourceresolver/close/ResourceResolverShouldBeClosed.java @@ -24,8 +24,8 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.Sets; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; import org.sonar.check.Priority; @@ -116,7 +116,7 @@ private void collectLongResourceResolverClosed(MethodTree method) { } protected boolean checkIfResourceResolverIsClosed(MethodTree method, VariableTree injector) { - Set usagesOfRR = Sets.newHashSet(injector.symbol().usages()); + Set usagesOfRR = new HashSet<>(injector.symbol().usages()); CheckClosedVisitor checkClosedVisitor = new CheckClosedVisitor(usagesOfRR); FinallyBlockVisitor finallyBlockVisitor = new FinallyBlockVisitor(checkClosedVisitor); method.accept(finallyBlockVisitor); diff --git a/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java b/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java index 4344be04..42678550 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java @@ -19,7 +19,6 @@ */ package com.cognifide.aemrules.java.checks.visitors; -import com.google.common.collect.Sets; import org.sonar.plugins.java.api.tree.AssignmentExpressionTree; import org.sonar.plugins.java.api.tree.BaseTreeVisitor; import org.sonar.plugins.java.api.tree.IdentifierTree; @@ -33,6 +32,7 @@ import org.sonar.plugins.java.api.tree.VariableTree; import java.util.Collection; +import java.util.HashSet; import java.util.Set; /** @@ -47,7 +47,7 @@ public class FindSessionDeclarationVisitor extends BaseTreeVisitor { private final Set sessions; public FindSessionDeclarationVisitor() { - sessions = Sets.newHashSet(); + sessions = new HashSet<>(); } public Collection getDeclarations() { diff --git a/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindVariableDeclarationVisitor.java b/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindVariableDeclarationVisitor.java index 5451b5bb..012e3e2a 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindVariableDeclarationVisitor.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/visitors/FindVariableDeclarationVisitor.java @@ -19,6 +19,7 @@ */ package com.cognifide.aemrules.java.checks.visitors; +import java.util.ArrayList; import java.util.List; import org.sonar.plugins.java.api.tree.BaseTreeVisitor; @@ -26,8 +27,6 @@ import org.sonar.plugins.java.api.tree.TryStatementTree; import org.sonar.plugins.java.api.tree.VariableTree; -import com.google.common.collect.Lists; - /** * Finds all injector variable declarations. Used in method's bodies only. */ @@ -39,7 +38,7 @@ public class FindVariableDeclarationVisitor extends BaseTreeVisitor { public FindVariableDeclarationVisitor(String variableTypeName) { this.variableTypeName = variableTypeName; - variables = Lists.newArrayList(); + this.variables = new ArrayList<>(); } public List getDeclarations() { diff --git a/src/main/java/com/cognifide/aemrules/java/rules/JavaCheckClasses.java b/src/main/java/com/cognifide/aemrules/java/rules/JavaCheckClasses.java index 9bdf6b9e..764c00bd 100644 --- a/src/main/java/com/cognifide/aemrules/java/rules/JavaCheckClasses.java +++ b/src/main/java/com/cognifide/aemrules/java/rules/JavaCheckClasses.java @@ -34,7 +34,6 @@ import com.cognifide.aemrules.java.checks.slingquery.SlingQueryImplicitStrategyCheck; import com.cognifide.aemrules.version.AemVersion; import com.cognifide.aemrules.version.VersionSupportChecker; -import com.google.common.collect.ImmutableList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -49,8 +48,7 @@ public class JavaCheckClasses implements CheckRegistrar { public static final String REPOSITORY_NAME = "AEM Rules"; - public static final List> CHECK_CLASSES - = ImmutableList.of( + public static final List> CHECK_CLASSES = List.of( AdministrativeAccessUsageCheck.class, AnnotationsConstantsCheck.class, ConstantsCheck.class, diff --git a/src/main/java/com/cognifide/aemrules/java/util/ConstantsChecker.java b/src/main/java/com/cognifide/aemrules/java/util/ConstantsChecker.java index 8ff583fb..c8adf61a 100644 --- a/src/main/java/com/cognifide/aemrules/java/util/ConstantsChecker.java +++ b/src/main/java/com/cognifide/aemrules/java/util/ConstantsChecker.java @@ -19,448 +19,437 @@ */ package com.cognifide.aemrules.java.util; -import com.google.common.collect.ImmutableMap; - import java.util.Map; public class ConstantsChecker { - private static final Map CONSTANTS; - - private static final Map ANNOTATION_CONSTANTS; - - static { - CONSTANTS = ImmutableMap.builder() - + private static final Map CONSTANTS = Map.ofEntries( // interface com.day.cq.commons.jcr.JcrConstants - .put("jcr:autoCreated", "JCR_AUTOCREATED from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:baseVersion", "JCR_BASEVERSION from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:child", "JCR_CHILD from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:childNodeDefinition", "JCR_CHILDNODEDEFINITION from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:content", "JCR_CONTENT from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:data", "JCR_DATA from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:defaultPrimaryType", "JCR_DEFAULTPRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:defaultValues", "JCR_DEFAULTVALUES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:encoding", "JCR_ENCODING from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:frozenMixinTypes", "JCR_FROZENMIXINTYPES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:frozenNode", "JCR_FROZENNODE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:frozenPrimaryType", "JCR_FROZENPRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:frozenUuid", "JCR_FROZENUUID from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:hasOrderableChildNodes", "JCR_HASORDERABLECHILDNODES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:isCheckedOut", "JCR_ISCHECKEDOUT from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:isMixin", "JCR_ISMIXIN from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:language", "JCR_LANGUAGE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:lockIsDeep", "JCR_LOCKISDEEP from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:lockOwner", "JCR_LOCKOWNER from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:mandatory", "JCR_MANDATORY from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:mergeFailed", "JCR_MERGEFAILED from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:mimeType", "JCR_MIMETYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:mixinTypes", "JCR_MIXINTYPES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:multiple", "JCR_MULTIPLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:name", "JCR_NAME from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:nodeTypeName", "JCR_NODETYPENAME from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:onParentVersion", "JCR_ONPARENTVERSION from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:predecessors", "JCR_PREDECESSORS from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:primaryItemName", "JCR_PRIMARYITEMNAME from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:primaryType", "JCR_PRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:propertyDefinition", "JCR_PROPERTYDEFINITION from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:protected", "JCR_PROTECTED from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:requiredPrimaryTypes", "JCR_REQUIREDPRIMARYTYPES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:requiredType", "JCR_REQUIREDTYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:rootVersion", "JCR_ROOTVERSION from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:sameNameSiblings", "JCR_SAMENAMESIBLINGS from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:statement", "JCR_STATEMENT from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:successors", "JCR_SUCCESSORS from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:supertypes", "JCR_SUPERTYPES from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:system", "JCR_SYSTEM from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:uuid", "JCR_UUID from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:valueConstraints", "JCR_VALUECONSTRAINTS from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:versionHistory", "JCR_VERSIONHISTORY from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:versionLabels", "JCR_VERSIONLABELS from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:versionStorage", "JCR_VERSIONSTORAGE from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:versionableUuid", "JCR_VERSIONABLEUUID from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:path", "JCR_PATH from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:score", "JCR_SCORE from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:lockable", "MIX_LOCKABLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:referenceable", "MIX_REFERENCEABLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:versionable", "MIX_VERSIONABLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:base", "NT_BASE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:childNodeDefinition", "NT_CHILDNODEDEFINITION from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:file", "NT_FILE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:folder", "NT_FOLDER from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:frozenNode", "NT_FROZENNODE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:hierarchyNode", "NT_HIERARCHYNODE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:linkedFile", "NT_LINKEDFILE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:nodeType", "NT_NODETYPE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:propertyDefinition", "NT_PROPERTYDEFINITION from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:query", "NT_QUERY from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:resource", "NT_RESOURCE from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:unstructured", "NT_UNSTRUCTURED from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:version", "NT_VERSION from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:versionHistory", "NT_VERSIONHISTORY from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:versionLabels", "NT_VERSIONLABELS from interface com.day.cq.commons.jcr.JcrConstants") - .put("nt:versionedChild", "NT_VERSIONEDCHILD from interface com.day.cq.commons.jcr.JcrConstants") - .put("jcr:title", "JCR_TITLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:title", "MIX_TITLE from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:created", "MIX_CREATED from interface com.day.cq.commons.jcr.JcrConstants") - .put("mix:lastModified", "MIX_LAST_MODIFIED from interface com.day.cq.commons.jcr.JcrConstants") + Map.entry("jcr:autoCreated", "JCR_AUTOCREATED from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:baseVersion", "JCR_BASEVERSION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:child", "JCR_CHILD from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:childNodeDefinition", "JCR_CHILDNODEDEFINITION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:content", "JCR_CONTENT from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:data", "JCR_DATA from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:defaultPrimaryType", "JCR_DEFAULTPRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:defaultValues", "JCR_DEFAULTVALUES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:encoding", "JCR_ENCODING from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:frozenMixinTypes", "JCR_FROZENMIXINTYPES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:frozenNode", "JCR_FROZENNODE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:frozenPrimaryType", "JCR_FROZENPRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:frozenUuid", "JCR_FROZENUUID from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:hasOrderableChildNodes", "JCR_HASORDERABLECHILDNODES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:isCheckedOut", "JCR_ISCHECKEDOUT from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:isMixin", "JCR_ISMIXIN from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:language", "JCR_LANGUAGE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:lockIsDeep", "JCR_LOCKISDEEP from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:lockOwner", "JCR_LOCKOWNER from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:mandatory", "JCR_MANDATORY from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:mergeFailed", "JCR_MERGEFAILED from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:mimeType", "JCR_MIMETYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:mixinTypes", "JCR_MIXINTYPES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:multiple", "JCR_MULTIPLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:name", "JCR_NAME from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:nodeTypeName", "JCR_NODETYPENAME from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:onParentVersion", "JCR_ONPARENTVERSION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:predecessors", "JCR_PREDECESSORS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:primaryItemName", "JCR_PRIMARYITEMNAME from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:primaryType", "JCR_PRIMARYTYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:propertyDefinition", "JCR_PROPERTYDEFINITION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:protected", "JCR_PROTECTED from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:requiredPrimaryTypes", "JCR_REQUIREDPRIMARYTYPES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:requiredType", "JCR_REQUIREDTYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:rootVersion", "JCR_ROOTVERSION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:sameNameSiblings", "JCR_SAMENAMESIBLINGS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:statement", "JCR_STATEMENT from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:successors", "JCR_SUCCESSORS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:supertypes", "JCR_SUPERTYPES from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:system", "JCR_SYSTEM from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:uuid", "JCR_UUID from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:valueConstraints", "JCR_VALUECONSTRAINTS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:versionHistory", "JCR_VERSIONHISTORY from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:versionLabels", "JCR_VERSIONLABELS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:versionStorage", "JCR_VERSIONSTORAGE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:versionableUuid", "JCR_VERSIONABLEUUID from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:path", "JCR_PATH from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:score", "JCR_SCORE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:lockable", "MIX_LOCKABLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:referenceable", "MIX_REFERENCEABLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:versionable", "MIX_VERSIONABLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:base", "NT_BASE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:childNodeDefinition", "NT_CHILDNODEDEFINITION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:file", "NT_FILE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:folder", "NT_FOLDER from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:frozenNode", "NT_FROZENNODE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:hierarchyNode", "NT_HIERARCHYNODE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:linkedFile", "NT_LINKEDFILE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:nodeType", "NT_NODETYPE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:propertyDefinition", "NT_PROPERTYDEFINITION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:query", "NT_QUERY from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:resource", "NT_RESOURCE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:unstructured", "NT_UNSTRUCTURED from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:version", "NT_VERSION from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:versionHistory", "NT_VERSIONHISTORY from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:versionLabels", "NT_VERSIONLABELS from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("nt:versionedChild", "NT_VERSIONEDCHILD from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("jcr:title", "JCR_TITLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:title", "MIX_TITLE from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:created", "MIX_CREATED from interface com.day.cq.commons.jcr.JcrConstants"), + Map.entry("mix:lastModified", "MIX_LAST_MODIFIED from interface com.day.cq.commons.jcr.JcrConstants"), // interface com.day.cq.dam.api.DamConstants - .put("dam:Asset", "NT_DAM_ASSET from interface com.day.cq.dam.api.DamConstants") - .put("dam:AssetContent", "NT_DAM_ASSETCONTENT from interface com.day.cq.dam.api.DamConstants") - .put("dam:extracted", "PN_EXTRACTED from interface com.day.cq.dam.api.DamConstants") - .put("dam:sha1", "PN_SHA1 from interface com.day.cq.dam.api.DamConstants") - .put("dam:size", "DAM_SIZE from interface com.day.cq.dam.api.DamConstants") - .put("cq:versionCreator", "PN_VERSION_CREATOR from interface com.day.cq.dam.api.DamConstants") - .put("dc:contributor", "DC_CONTRIBUTOR from interface com.day.cq.dam.api.DamConstants") - .put("dc:coverage", "DC_COVERAGE from interface com.day.cq.dam.api.DamConstants") - .put("dc:creator", "DC_CREATOR from interface com.day.cq.dam.api.DamConstants") - .put("dc:date", "DC_DATE from interface com.day.cq.dam.api.DamConstants") - .put("dc:description", "DC_DESCRIPTION from interface com.day.cq.dam.api.DamConstants") - .put("dc:extent", "DC_EXTENT from interface com.day.cq.dam.api.DamConstants") - .put("dc:format", "DC_FORMAT from interface com.day.cq.dam.api.DamConstants") - .put("dc:identifier", "DC_IDENTIFIER from interface com.day.cq.dam.api.DamConstants") - .put("dc:language", "DC_LANGUAGE from interface com.day.cq.dam.api.DamConstants") - .put("dc:modified", "DC_MODIFIED from interface com.day.cq.dam.api.DamConstants") - .put("dc:publisher", "DC_PUBLISHER from interface com.day.cq.dam.api.DamConstants") - .put("dc:relation", "DC_RELATION from interface com.day.cq.dam.api.DamConstants") - .put("dc:rights", "DC_RIGHTS from interface com.day.cq.dam.api.DamConstants") - .put("dc:subject", "DC_SUBJECT from interface com.day.cq.dam.api.DamConstants") - .put("dc:title", "DC_TITLE from interface com.day.cq.dam.api.DamConstants") - .put("dc:type", "DC_TYPE from interface com.day.cq.dam.api.DamConstants") - .put("cq5dam.thumbnail", "PREFIX_ASSET_THUMBNAIL from interface com.day.cq.dam.api.DamConstants") - .put("exif:PixelXDimension", "EXIF_PIXELXDIMENSION from interface com.day.cq.dam.api.DamConstants") - .put("exif:PixelYDimension", "EXIF_PIXELYDIMENSION from interface com.day.cq.dam.api.DamConstants") - .put("tiff:ImageLength", "TIFF_IMAGELENGTH from interface com.day.cq.dam.api.DamConstants") - .put("tiff:ImageWidth", "TIFF_IMAGEWIDTH from interface com.day.cq.dam.api.DamConstants") - .put("assetExpired", "ACTIVITY_TYPE_ASSET_EXPIRED from interface com.day.cq.dam.api.DamConstants") - .put("assetExpiring", "ACTIVITY_TYPE_ASSET_EXPIRING from interface com.day.cq.dam.api.DamConstants") - .put("dam:lastPostExpirationRun", "LAST_EXPIRY_NOTIFICATION_PROPNAME from interface com.day.cq.dam.api.DamConstants") - .put("dam/collection", "COLLECTION_SLING_RES_TYPE from interface com.day.cq.dam.api.DamConstants") - .put("dam/smartcollection", "SMART_COLLECTION_SLING_RES_TYPE from interface com.day.cq.dam.api.DamConstants") - .put("dam/content/schemaeditors/forms", "SCHEMA_EDITOR_FORMS_BASE_DIR from interface com.day.cq.dam.api.DamConstants") - .put("processingProfile", "PROCESSING_PROFILE from interface com.day.cq.dam.api.DamConstants") - .put("metadataProfile", "METADATA_PROFILE from interface com.day.cq.dam.api.DamConstants") - .put("videoProfile", "VIDEO_PROFILE from interface com.day.cq.dam.api.DamConstants") - .put("imageProfile", "IMAGE_PROFILE from interface com.day.cq.dam.api.DamConstants") - .put("folderThumbnail", "THUMBNAIL_NODE from interface com.day.cq.dam.api.DamConstants") - .put("downloadUrl", "DOWNLOAD_URL from interface com.day.cq.dam.api.DamConstants") + Map.entry("dam:Asset", "NT_DAM_ASSET from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam:AssetContent", "NT_DAM_ASSETCONTENT from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam:extracted", "PN_EXTRACTED from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam:sha1", "PN_SHA1 from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam:size", "DAM_SIZE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("cq:versionCreator", "PN_VERSION_CREATOR from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:contributor", "DC_CONTRIBUTOR from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:coverage", "DC_COVERAGE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:creator", "DC_CREATOR from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:date", "DC_DATE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:description", "DC_DESCRIPTION from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:extent", "DC_EXTENT from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:format", "DC_FORMAT from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:identifier", "DC_IDENTIFIER from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:language", "DC_LANGUAGE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:modified", "DC_MODIFIED from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:publisher", "DC_PUBLISHER from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:relation", "DC_RELATION from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:rights", "DC_RIGHTS from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:subject", "DC_SUBJECT from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:title", "DC_TITLE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dc:type", "DC_TYPE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("cq5dam.thumbnail", "PREFIX_ASSET_THUMBNAIL from interface com.day.cq.dam.api.DamConstants"), + Map.entry("exif:PixelXDimension", "EXIF_PIXELXDIMENSION from interface com.day.cq.dam.api.DamConstants"), + Map.entry("exif:PixelYDimension", "EXIF_PIXELYDIMENSION from interface com.day.cq.dam.api.DamConstants"), + Map.entry("tiff:ImageLength", "TIFF_IMAGELENGTH from interface com.day.cq.dam.api.DamConstants"), + Map.entry("tiff:ImageWidth", "TIFF_IMAGEWIDTH from interface com.day.cq.dam.api.DamConstants"), + Map.entry("assetExpired", "ACTIVITY_TYPE_ASSET_EXPIRED from interface com.day.cq.dam.api.DamConstants"), + Map.entry("assetExpiring", "ACTIVITY_TYPE_ASSET_EXPIRING from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam:lastPostExpirationRun", "LAST_EXPIRY_NOTIFICATION_PROPNAME from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam/collection", "COLLECTION_SLING_RES_TYPE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam/smartcollection", "SMART_COLLECTION_SLING_RES_TYPE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("dam/content/schemaeditors/forms", "SCHEMA_EDITOR_FORMS_BASE_DIR from interface com.day.cq.dam.api.DamConstants"), + Map.entry("processingProfile", "PROCESSING_PROFILE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("metadataProfile", "METADATA_PROFILE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("videoProfile", "VIDEO_PROFILE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("imageProfile", "IMAGE_PROFILE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("folderThumbnail", "THUMBNAIL_NODE from interface com.day.cq.dam.api.DamConstants"), + Map.entry("downloadUrl", "DOWNLOAD_URL from interface com.day.cq.dam.api.DamConstants"), // interface com.day.cq.wcm.api.NameConstants - .put("cq:Page", "NT_PAGE from interface com.day.cq.wcm.api.NameConstants") - .put("cq:PseudoPage", "NT_PSEUDO_PAGE from interface com.day.cq.wcm.api.NameConstants") - .put("cq:Template", "NT_TEMPLATE from interface com.day.cq.wcm.api.NameConstants") - .put("cq:Component", "NT_COMPONENT from interface com.day.cq.wcm.api.NameConstants") - .put("cq:EditConfig", "NT_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants") - .put("dialog", "NN_DIALOG from interface com.day.cq.wcm.api.NameConstants") - .put("dialogPath", "PN_DIALOG_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("design_dialog", "NN_DESIGN_DIALOG from interface com.day.cq.wcm.api.NameConstants") - .put("designDialogPath", "PN_DESIGN_DIALOG_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:editConfig", "NN_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants") - .put("cq:childEditConfig", "NN_CHILD_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants") - .put("icon.png", "NN_ICON_PNG from interface com.day.cq.wcm.api.NameConstants") - .put("thumbnail.png", "NN_THUMBNAIL_PNG from interface com.day.cq.wcm.api.NameConstants") - .put("cq:cellName", "PN_CELL_NAME from interface com.day.cq.wcm.api.NameConstants") - .put("cq:isContainer", "PN_IS_CONTAINER from interface com.day.cq.wcm.api.NameConstants") - .put("cq:noDecoration", "PN_NO_DECORATION from interface com.day.cq.wcm.api.NameConstants") - .put("cq:htmlTag", "NN_HTML_TAG from interface com.day.cq.wcm.api.NameConstants") - .put("allowedPaths", "PN_ALLOWED_PATHS from interface com.day.cq.wcm.api.NameConstants") - .put("allowedChildren", "PN_ALLOWED_CHILDREN from interface com.day.cq.wcm.api.NameConstants") - .put("allowedParents", "PN_ALLOWED_PARENTS from interface com.day.cq.wcm.api.NameConstants") - .put("componentGroup", "PN_COMPONENT_GROUP from interface com.day.cq.wcm.api.NameConstants") - .put("sitePath", "PN_SITE_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:templatePath", "PN_TEMPLATE_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:template", "NN_TEMPLATE from interface com.day.cq.wcm.api.NameConstants") - .put("cq:tagName", "PN_TAG_NAME from interface com.day.cq.wcm.api.NameConstants") - .put("cq:infoProviders", "NN_INFO_PROVIDERS from interface com.day.cq.wcm.api.NameConstants") - .put("className", "PN_CLASS_NAME from interface com.day.cq.wcm.api.NameConstants") - .put("cq:disableTargeting", "PN_DISABLE_TARGETING from interface com.day.cq.wcm.api.NameConstants") - .put("cq:layout", "PN_LAYOUT from interface com.day.cq.wcm.api.NameConstants") - .put("cq:dialogMode", "PN_DIALOG_MODE from interface com.day.cq.wcm.api.NameConstants") - .put("cq:inplaceEditing", "NN_INPLACE_EDITING from interface com.day.cq.wcm.api.NameConstants") - .put("cq:emptyText", "PN_EMPTY_TEXT from interface com.day.cq.wcm.api.NameConstants") - .put("cq:actions", "PN_ACTIONS from interface com.day.cq.wcm.api.NameConstants") - .put("cq:actionConfigs", "NN_ACTION_CONFIGS from interface com.day.cq.wcm.api.NameConstants") - .put("cq:formParameters", "NN_FORM_PARAMETERS from interface com.day.cq.wcm.api.NameConstants") - .put("cq:dropTargets", "NN_DROP_TARGETS from interface com.day.cq.wcm.api.NameConstants") - .put("cq:listeners", "NN_LISTENERS from interface com.day.cq.wcm.api.NameConstants") - .put("propertyName", "PN_DT_NAME from interface com.day.cq.wcm.api.NameConstants") - .put("cq:inherit", "PN_INHERIT from interface com.day.cq.wcm.api.NameConstants") - .put("cq:designPath", "PN_DESIGN_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:parentPath", "PN_PARENT_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:childrenOrder", "PN_CHILDREN_ORDER from interface com.day.cq.wcm.api.NameConstants") - .put("cq:siblingOrder", "PN_SIBLING_ORDER from interface com.day.cq.wcm.api.NameConstants") - .put("cq:versionComment", "PN_VERSION_COMMENT from interface com.day.cq.wcm.api.NameConstants") - .put("onTime", "PN_ON_TIME from interface com.day.cq.wcm.api.NameConstants") - .put("offTime", "PN_OFF_TIME from interface com.day.cq.wcm.api.NameConstants") - .put("cq:lastModified", "PN_PAGE_LAST_MOD from interface com.day.cq.wcm.api.NameConstants") - .put("cq:lastModifiedBy", "PN_PAGE_LAST_MOD_BY from interface com.day.cq.wcm.api.NameConstants") - .put("cq:defaultView", "PN_DEFAULT_VIEW from interface com.day.cq.wcm.api.NameConstants") - .put("sling:vanityPath", "PN_SLING_VANITY_PATH from interface com.day.cq.wcm.api.NameConstants") - .put("cq:allowedTemplates", "PN_ALLOWED_TEMPLATES from interface com.day.cq.wcm.api.NameConstants") + Map.entry("cq:Page", "NT_PAGE from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:PseudoPage", "NT_PSEUDO_PAGE from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:Template", "NT_TEMPLATE from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:Component", "NT_COMPONENT from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:EditConfig", "NT_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("dialog", "NN_DIALOG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("dialogPath", "PN_DIALOG_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("design_dialog", "NN_DESIGN_DIALOG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("designDialogPath", "PN_DESIGN_DIALOG_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:editConfig", "NN_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:childEditConfig", "NN_CHILD_EDIT_CONFIG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("icon.png", "NN_ICON_PNG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("thumbnail.png", "NN_THUMBNAIL_PNG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:cellName", "PN_CELL_NAME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:isContainer", "PN_IS_CONTAINER from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:noDecoration", "PN_NO_DECORATION from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:htmlTag", "NN_HTML_TAG from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("allowedPaths", "PN_ALLOWED_PATHS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("allowedChildren", "PN_ALLOWED_CHILDREN from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("allowedParents", "PN_ALLOWED_PARENTS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("componentGroup", "PN_COMPONENT_GROUP from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("sitePath", "PN_SITE_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:templatePath", "PN_TEMPLATE_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:template", "NN_TEMPLATE from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:tagName", "PN_TAG_NAME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:infoProviders", "NN_INFO_PROVIDERS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("className", "PN_CLASS_NAME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:disableTargeting", "PN_DISABLE_TARGETING from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:layout", "PN_LAYOUT from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:dialogMode", "PN_DIALOG_MODE from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:inplaceEditing", "NN_INPLACE_EDITING from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:emptyText", "PN_EMPTY_TEXT from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:actions", "PN_ACTIONS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:actionConfigs", "NN_ACTION_CONFIGS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:formParameters", "NN_FORM_PARAMETERS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:dropTargets", "NN_DROP_TARGETS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:listeners", "NN_LISTENERS from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("propertyName", "PN_DT_NAME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:inherit", "PN_INHERIT from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:designPath", "PN_DESIGN_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:parentPath", "PN_PARENT_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:childrenOrder", "PN_CHILDREN_ORDER from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:siblingOrder", "PN_SIBLING_ORDER from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:versionComment", "PN_VERSION_COMMENT from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("onTime", "PN_ON_TIME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("offTime", "PN_OFF_TIME from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:lastModified", "PN_PAGE_LAST_MOD from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:lastModifiedBy", "PN_PAGE_LAST_MOD_BY from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:defaultView", "PN_DEFAULT_VIEW from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("sling:vanityPath", "PN_SLING_VANITY_PATH from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:allowedTemplates", "PN_ALLOWED_TEMPLATES from interface com.day.cq.wcm.api.NameConstants"), // interface com.day.cq.wcm.webservicesupport.ConfigurationConstants - .put("cq/cloudserviceconfigs/components/servicepage", "RT_SERVICE from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants") - .put("cq/cloudserviceconfigs/components/configpage", "RT_CONFIGURATION from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants") - .put("cq:cloudserviceconfigs", "PN_CONFIGURATIONS from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants") + Map.entry("cq/cloudserviceconfigs/components/servicepage", "RT_SERVICE from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants"), + Map.entry("cq/cloudserviceconfigs/components/configpage", "RT_CONFIGURATION from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants"), + Map.entry("cq:cloudserviceconfigs", "PN_CONFIGURATIONS from interface com.day.cq.wcm.webservicesupport.ConfigurationConstants"), // class org.apache.sling.jcr.resource.JcrResourceConstants - .put("http://sling.apache.org/jcr/sling/1.0", "SLING_NAMESPACE_URI from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("sling:resourceType", "SLING_RESOURCE_TYPE_PROPERTY from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("sling:resourceSuperType", "SLING_RESOURCE_SUPER_TYPE_PROPERTY from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("user.jcr.credentials", "AUTHENTICATION_INFO_CREDENTIALS from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("user.jcr.workspace", "AUTHENTICATION_INFO_WORKSPACE from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("user.jcr.session", "AUTHENTICATION_INFO_SESSION from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("sling:Folder", "NT_SLING_FOLDER from class org.apache.sling.jcr.resource.JcrResourceConstants") - .put("sling:OrderedFolder", "NT_SLING_ORDERED_FOLDER from class org.apache.sling.jcr.resource.JcrResourceConstants") + Map.entry("http://sling.apache.org/jcr/sling/1.0", "SLING_NAMESPACE_URI from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("sling:resourceType", "SLING_RESOURCE_TYPE_PROPERTY from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("sling:resourceSuperType", "SLING_RESOURCE_SUPER_TYPE_PROPERTY from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("user.jcr.credentials", "AUTHENTICATION_INFO_CREDENTIALS from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("user.jcr.workspace", "AUTHENTICATION_INFO_WORKSPACE from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("user.jcr.session", "AUTHENTICATION_INFO_SESSION from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("sling:Folder", "NT_SLING_FOLDER from class org.apache.sling.jcr.resource.JcrResourceConstants"), + Map.entry("sling:OrderedFolder", "NT_SLING_ORDERED_FOLDER from class org.apache.sling.jcr.resource.JcrResourceConstants"), // interface com.day.cq.tagging.TagConstants - .put("cq:Tag", "NT_TAG from interface com.day.cq.tagging.TagConstants") - .put("cq:Taggable", "NT_TAGGABLE from interface com.day.cq.tagging.TagConstants") - .put("cq:movedTo", "PN_MOVED_TO from interface com.day.cq.tagging.TagConstants") - .put("cq:backlinks", "PN_BACKLINKS from interface com.day.cq.tagging.TagConstants") + Map.entry("cq:Tag", "NT_TAG from interface com.day.cq.tagging.TagConstants"), + Map.entry("cq:Taggable", "NT_TAGGABLE from interface com.day.cq.tagging.TagConstants"), + Map.entry("cq:movedTo", "PN_MOVED_TO from interface com.day.cq.tagging.TagConstants"), + Map.entry("cq:backlinks", "PN_BACKLINKS from interface com.day.cq.tagging.TagConstants"), // interface com.day.cq.replication.ReplicationStatus - .put("cq:ReplicationStatus", "NODE_TYPE from interface com.day.cq.replication.ReplicationStatus") + Map.entry("cq:ReplicationStatus", "NODE_TYPE from interface com.day.cq.replication.ReplicationStatus"), // interface org.apache.jackrabbit.vault.packaging.JcrPackage - .put("application/zip", "MIME_TYPE from interface org.apache.jackrabbit.vault.packaging.JcrPackage") - .put("vlt:definition", "NN_VLT_DEFINITION from interface org.apache.jackrabbit.vault.packaging.JcrPackage") - .put("vlt:Package", "NT_VLT_PACKAGE from interface org.apache.jackrabbit.vault.packaging.JcrPackage") - .put("vlt:PackageDefinition", "NT_VLT_PACKAGE_DEFINITION from interface org.apache.jackrabbit.vault.packaging.JcrPackage") + Map.entry("application/zip", "MIME_TYPE from interface org.apache.jackrabbit.vault.packaging.JcrPackage"), + Map.entry("vlt:definition", "NN_VLT_DEFINITION from interface org.apache.jackrabbit.vault.packaging.JcrPackage"), + Map.entry("vlt:Package", "NT_VLT_PACKAGE from interface org.apache.jackrabbit.vault.packaging.JcrPackage"), + Map.entry("vlt:PackageDefinition", "NT_VLT_PACKAGE_DEFINITION from interface org.apache.jackrabbit.vault.packaging.JcrPackage"), // interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition - .put("acHandling", "PN_AC_HANDLING from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("buildCount", "PN_BUILD_COUNT from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("cndPattern", "PN_CND_PATTERN from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("dependencies", "PN_DEPENDENCIES from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("noIntermediateSaves", "PN_DISABLE_INTERMEDIATE_SAVE from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastUnpacked", "PN_LAST_UNPACKED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastUnpackedBy", "PN_LAST_UNPACKED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastUnwrapped", "PN_LAST_UNWRAPPED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastUnwrappedBy", "PN_LAST_UNWRAPPED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastWrapped", "PN_LAST_WRAPPED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("lastWrappedBy", "PN_LAST_WRAPPED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("requiresRestart", "PN_REQUIRES_RESTART from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("requiresRoot", "PN_REQUIRES_ROOT from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("subPackages", "PN_SUB_PACKAGES from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") + Map.entry("acHandling", "PN_AC_HANDLING from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("buildCount", "PN_BUILD_COUNT from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("cndPattern", "PN_CND_PATTERN from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("dependencies", "PN_DEPENDENCIES from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("noIntermediateSaves", "PN_DISABLE_INTERMEDIATE_SAVE from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastUnpacked", "PN_LAST_UNPACKED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastUnpackedBy", "PN_LAST_UNPACKED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastUnwrapped", "PN_LAST_UNWRAPPED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastUnwrappedBy", "PN_LAST_UNWRAPPED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastWrapped", "PN_LAST_WRAPPED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("lastWrappedBy", "PN_LAST_WRAPPED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("requiresRestart", "PN_REQUIRES_RESTART from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("requiresRoot", "PN_REQUIRES_ROOT from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("subPackages", "PN_SUB_PACKAGES from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), // interface org.apache.sling.api.resource.ResourceResolverFactory - .put("user.password", "PASSWORD from interface org.apache.sling.api.resource.ResourceResolverFactory") - .put("sling.service.subservice", "SUBSERVICE from interface org.apache.sling.api.resource.ResourceResolverFactory") - .put("user.name", "USER from interface org.apache.sling.api.resource.ResourceResolverFactory") - .put("user.impersonation", "USER_IMPERSONATION from interface org.apache.sling.api.resource.ResourceResolverFactory") + Map.entry("user.password", "PASSWORD from interface org.apache.sling.api.resource.ResourceResolverFactory"), + Map.entry("sling.service.subservice", "SUBSERVICE from interface org.apache.sling.api.resource.ResourceResolverFactory"), + Map.entry("user.name", "USER from interface org.apache.sling.api.resource.ResourceResolverFactory"), + Map.entry("user.impersonation", "USER_IMPERSONATION from interface org.apache.sling.api.resource.ResourceResolverFactory"), // class com.adobe.granite.workflow.event.WorkflowEvent - .put("Delagatee", "DELEGATEE from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("EventType", "EVENT_TYPE from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("fromNodeName", "FROM_NODE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("JobFailed", "JOB_FAILED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("ModelDeleted", "MODEL_DELETED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("ModelDeployed", "MODEL_DEPLOYED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("NodeTransition", "NODE_TRANSITION_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("ParentWorkflowId", "PARENT_WORKFLOW_ID from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("ProcessTimeout", "PROCESS_TIMEOUT_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("ResourceCollectionModified", "RESOURCE_COLLECTION_MODIFIED from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("TimeStamp", "TIME_STAMP from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("toNodeName", "TO_NODE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("User", "USER from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("VariableName", "VARIABLE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("VariableUpdate", "VARIABLE_UPDATE_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("VariableValue", "VARIABLE_VALUE from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("Workdata", "WORK_DATA from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("Workitem", "WORK_ITEM from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowAborted", "WORKFLOW_ABORTED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowCompleted", "WORKFLOW_COMPLETED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowInstanceId", "WORKFLOW_INSTANCE_ID from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowName", "WORKFLOW_NAME from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowNode", "WORKFLOW_NODE from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowResumed", "WORKFLOW_RESUMED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowStarted", "WORKFLOW_STARTED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowSuspended", "WORKFLOW_SUSPENDED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkflowVersion", "WORKFLOW_VERSION from class com.adobe.granite.workflow.event.WorkflowEvent") - .put("WorkItemDelegated", "WORKITEM_DELEGATION_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent") + Map.entry("Delagatee", "DELEGATEE from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("EventType", "EVENT_TYPE from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("fromNodeName", "FROM_NODE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("JobFailed", "JOB_FAILED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("ModelDeleted", "MODEL_DELETED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("ModelDeployed", "MODEL_DEPLOYED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("NodeTransition", "NODE_TRANSITION_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("ParentWorkflowId", "PARENT_WORKFLOW_ID from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("ProcessTimeout", "PROCESS_TIMEOUT_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("ResourceCollectionModified", "RESOURCE_COLLECTION_MODIFIED from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("TimeStamp", "TIME_STAMP from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("toNodeName", "TO_NODE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("User", "USER from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("VariableName", "VARIABLE_NAME from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("VariableUpdate", "VARIABLE_UPDATE_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("VariableValue", "VARIABLE_VALUE from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("Workdata", "WORK_DATA from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("Workitem", "WORK_ITEM from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowAborted", "WORKFLOW_ABORTED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowCompleted", "WORKFLOW_COMPLETED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowInstanceId", "WORKFLOW_INSTANCE_ID from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowName", "WORKFLOW_NAME from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowNode", "WORKFLOW_NODE from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowResumed", "WORKFLOW_RESUMED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowStarted", "WORKFLOW_STARTED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowSuspended", "WORKFLOW_SUSPENDED_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkflowVersion", "WORKFLOW_VERSION from class com.adobe.granite.workflow.event.WorkflowEvent"), + Map.entry("WorkItemDelegated", "WORKITEM_DELEGATION_EVENT from class com.adobe.granite.workflow.event.WorkflowEvent"), // mix - .put("cq:lastReplicated", - "NODE_PROPERTY_LAST_REPLICATED from interface com.day.cq.replication.ReplicationStatus" - + " or constant PN_PAGE_LAST_REPLICATED from interface com.day.cq.wcm.api.NameConstants") - .put("cq:lastReplicatedBy", - "NODE_PROPERTY_LAST_REPLICATED_BY from interface com.day.cq.replication.ReplicationStatus" - + " or constant PN_PAGE_LAST_REPLICATED_BY from interface com.day.cq.wcm.api.NameConstants") - .put("cq:lastReplicationAction", - "NODE_PROPERTY_LAST_REPLICATION_ACTION from interface com.day.cq.replication.ReplicationStatus" - + " or constant PN_PAGE_LAST_REPLICATION_ACTION from interface com.day.cq.wcm.api.NameConstants") - .put("cq:tags", "PN_TAGS from interface com.day.cq.tagging.TagConstants.PN_TAGS or interface com.day.cq.wcm.api.NameConstants") - .put("cq:name", "PN_NAME from interface com.day.cq.dam.api.DamConstants.PN_NAME or interface com.day.cq.wcm.api.NameConstants") - .put("jcr:created", - "JCR_CREATED from interface com.day.cq.commons.jcr.JcrConstants" - + " or constant PN_CREATED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("jcr:createdBy", - "JCR_CREATED_BY from interface com.day.cq.commons.jcr.JcrConstants" - + " or constant PN_CREATED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("jcr:description", - "JCR_DESCRIPTION from interface com.day.cq.commons.jcr.JcrConstants" - + " or constant PN_DESCRIPTION from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("jcr:lastModified", - "JCR_LASTMODIFIED from interface com.day.cq.commons.jcr.JcrConstants" - + " or constant PN_LASTMODIFIED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .put("jcr:lastModifiedBy", "JCR_LAST_MODIFIED_BY from interface com.day.cq.commons.jcr.JcrConstants" - + " or constant PN_LASTMODIFIED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") - .build(); - - ANNOTATION_CONSTANTS = ImmutableMap.builder() + Map.entry("cq:lastReplicated", + "NODE_PROPERTY_LAST_REPLICATED from interface com.day.cq.replication.ReplicationStatus" + + " or constant PN_PAGE_LAST_REPLICATED from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:lastReplicatedBy", + "NODE_PROPERTY_LAST_REPLICATED_BY from interface com.day.cq.replication.ReplicationStatus" + + " or constant PN_PAGE_LAST_REPLICATED_BY from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:lastReplicationAction", + "NODE_PROPERTY_LAST_REPLICATION_ACTION from interface com.day.cq.replication.ReplicationStatus" + + " or constant PN_PAGE_LAST_REPLICATION_ACTION from interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:tags", "PN_TAGS from interface com.day.cq.tagging.TagConstants.PN_TAGS or interface com.day.cq.wcm.api.NameConstants"), + Map.entry("cq:name", "PN_NAME from interface com.day.cq.dam.api.DamConstants.PN_NAME or interface com.day.cq.wcm.api.NameConstants"), + Map.entry("jcr:created", + "JCR_CREATED from interface com.day.cq.commons.jcr.JcrConstants" + + " or constant PN_CREATED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("jcr:createdBy", + "JCR_CREATED_BY from interface com.day.cq.commons.jcr.JcrConstants" + + " or constant PN_CREATED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("jcr:description", + "JCR_DESCRIPTION from interface com.day.cq.commons.jcr.JcrConstants" + + " or constant PN_DESCRIPTION from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("jcr:lastModified", + "JCR_LASTMODIFIED from interface com.day.cq.commons.jcr.JcrConstants" + + " or constant PN_LASTMODIFIED from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition"), + Map.entry("jcr:lastModifiedBy", "JCR_LAST_MODIFIED_BY from interface com.day.cq.commons.jcr.JcrConstants" + + " or constant PN_LASTMODIFIED_BY from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition") + ); + private static final Map ANNOTATION_CONSTANTS = Map.ofEntries( // class org.apache.sling.api.SlingConstants - .put("org.apache.sling.api.include.servlet", "ATTR_REQUEST_SERVLET from class org.apache.sling.api.SlingConstants") - .put("org.apache.sling.api.include.resource", "ATTR_REQUEST_CONTENT from class org.apache.sling.api.SlingConstants") - .put("org.apache.sling.api.include.request_path_info", "ATTR_REQUEST_PATH_INFO from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.include.request_uri", "ATTR_INCLUDE_REQUEST_URI from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.include.context_path", "ATTR_INCLUDE_CONTEXT_PATH from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.include.servlet_path", "ATTR_INCLUDE_SERVLET_PATH from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.include.path_info", "ATTR_INCLUDE_PATH_INFO from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.include.query_string", "ATTR_INCLUDE_QUERY_STRING from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.exception", "ERROR_EXCEPTION from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.exception_type", "ERROR_EXCEPTION_TYPE from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.message", "ERROR_MESSAGE from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.request_uri", "ERROR_REQUEST_URI from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.servlet_name", "ERROR_SERVLET_NAME from class org.apache.sling.api.SlingConstants") - .put("javax.servlet.error.status_code", "ERROR_STATUS from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/Resource/ADDED", "TOPIC_RESOURCE_ADDED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/Resource/REMOVED", "TOPIC_RESOURCE_REMOVED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/Resource/CHANGED", "TOPIC_RESOURCE_CHANGED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/ResourceProvider/ADDED", "TOPIC_RESOURCE_PROVIDER_ADDED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/ResourceProvider/REMOVED", "TOPIC_RESOURCE_PROVIDER_REMOVED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/resource/ResourceResolverMapping/CHANGED", - "TOPIC_RESOURCE_RESOLVER_MAPPING_CHANGED from class org.apache.sling.api.SlingConstants") - .put("path", "PROPERTY_PATH from class org.apache.sling.api.SlingConstants") - .put("userid", "PROPERTY_USERID from class org.apache.sling.api.SlingConstants") - .put("resourceType", "PROPERTY_RESOURCE_TYPE from class org.apache.sling.api.SlingConstants") - .put("resourceSuperType", "PROPERTY_RESOURCE_SUPER_TYPE from class org.apache.sling.api.SlingConstants") - .put("resourceChangedAttributes", "PROPERTY_CHANGED_ATTRIBUTES from class org.apache.sling.api.SlingConstants") - .put("resourceAddedAttributes", "PROPERTY_ADDED_ATTRIBUTES from class org.apache.sling.api.SlingConstants") - .put("resourceRemovedAttributes", "PROPERTY_REMOVED_ATTRIBUTES from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/adapter/AdapterFactory/ADDED", "TOPIC_ADAPTER_FACTORY_ADDED from class org.apache.sling.api.SlingConstants") - .put("org/apache/sling/api/adapter/AdapterFactory/REMOVED", "TOPIC_ADAPTER_FACTORY_REMOVED from class org.apache.sling.api.SlingConstants") - .put("adaptables", "PROPERTY_ADAPTABLE_CLASSES from class org.apache.sling.api.SlingConstants") - .put("adapters", "PROPERTY_ADAPTER_CLASSES from class org.apache.sling.api.SlingConstants") - .put("sling.core.current.servletName", "SLING_CURRENT_SERVLET_NAME from class org.apache.sling.api.SlingConstants") + Map.entry("org.apache.sling.api.include.servlet", "ATTR_REQUEST_SERVLET from class org.apache.sling.api.SlingConstants"), + Map.entry("org.apache.sling.api.include.resource", "ATTR_REQUEST_CONTENT from class org.apache.sling.api.SlingConstants"), + Map.entry("org.apache.sling.api.include.request_path_info", "ATTR_REQUEST_PATH_INFO from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.include.request_uri", "ATTR_INCLUDE_REQUEST_URI from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.include.context_path", "ATTR_INCLUDE_CONTEXT_PATH from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.include.servlet_path", "ATTR_INCLUDE_SERVLET_PATH from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.include.path_info", "ATTR_INCLUDE_PATH_INFO from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.include.query_string", "ATTR_INCLUDE_QUERY_STRING from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.exception", "ERROR_EXCEPTION from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.exception_type", "ERROR_EXCEPTION_TYPE from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.message", "ERROR_MESSAGE from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.request_uri", "ERROR_REQUEST_URI from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.servlet_name", "ERROR_SERVLET_NAME from class org.apache.sling.api.SlingConstants"), + Map.entry("javax.servlet.error.status_code", "ERROR_STATUS from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/Resource/ADDED", "TOPIC_RESOURCE_ADDED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/Resource/REMOVED", "TOPIC_RESOURCE_REMOVED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/Resource/CHANGED", "TOPIC_RESOURCE_CHANGED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/ResourceProvider/ADDED", "TOPIC_RESOURCE_PROVIDER_ADDED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/ResourceProvider/REMOVED", "TOPIC_RESOURCE_PROVIDER_REMOVED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/resource/ResourceResolverMapping/CHANGED", + "TOPIC_RESOURCE_RESOLVER_MAPPING_CHANGED from class org.apache.sling.api.SlingConstants"), + Map.entry("path", "PROPERTY_PATH from class org.apache.sling.api.SlingConstants"), + Map.entry("userid", "PROPERTY_USERID from class org.apache.sling.api.SlingConstants"), + Map.entry("resourceType", "PROPERTY_RESOURCE_TYPE from class org.apache.sling.api.SlingConstants"), + Map.entry("resourceSuperType", "PROPERTY_RESOURCE_SUPER_TYPE from class org.apache.sling.api.SlingConstants"), + Map.entry("resourceChangedAttributes", "PROPERTY_CHANGED_ATTRIBUTES from class org.apache.sling.api.SlingConstants"), + Map.entry("resourceAddedAttributes", "PROPERTY_ADDED_ATTRIBUTES from class org.apache.sling.api.SlingConstants"), + Map.entry("resourceRemovedAttributes", "PROPERTY_REMOVED_ATTRIBUTES from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/adapter/AdapterFactory/ADDED", "TOPIC_ADAPTER_FACTORY_ADDED from class org.apache.sling.api.SlingConstants"), + Map.entry("org/apache/sling/api/adapter/AdapterFactory/REMOVED", "TOPIC_ADAPTER_FACTORY_REMOVED from class org.apache.sling.api.SlingConstants"), + Map.entry("adaptables", "PROPERTY_ADAPTABLE_CLASSES from class org.apache.sling.api.SlingConstants"), + Map.entry("adapters", "PROPERTY_ADAPTER_CLASSES from class org.apache.sling.api.SlingConstants"), + Map.entry("sling.core.current.servletName", "SLING_CURRENT_SERVLET_NAME from class org.apache.sling.api.SlingConstants"), // class org.apache.sling.api.servlets.HttpConstants - .put("OPTIONS", "METHOD_OPTIONS from class org.apache.sling.api.servlets.HttpConstants") - .put("GET", "METHOD_GET from class org.apache.sling.api.servlets.HttpConstants") - .put("HEAD", "METHOD_HEAD from class org.apache.sling.api.servlets.HttpConstants") - .put("POST", "METHOD_POST from class org.apache.sling.api.servlets.HttpConstants") - .put("PUT", "METHOD_PUT from class org.apache.sling.api.servlets.HttpConstants") - .put("DELETE", "METHOD_DELETE from class org.apache.sling.api.servlets.HttpConstants") - .put("TRACE", "METHOD_TRACE from class org.apache.sling.api.servlets.HttpConstants") - .put("CONNECT", "METHOD_CONNECT from class org.apache.sling.api.servlets.HttpConstants") - .put("Accept", "HEADER_ACCEPT from class org.apache.sling.api.servlets.HttpConstants") - .put("ETag", "HEADER_ETAG from class org.apache.sling.api.servlets.HttpConstants") - .put("If-Match", "HEADER_IF_MATCH from class org.apache.sling.api.servlets.HttpConstants") - .put("If-Modified-Since", "HEADER_IF_MODIFIED_SINCE from class org.apache.sling.api.servlets.HttpConstants") - .put("Last-Modified", "HEADER_LAST_MODIFIED from class org.apache.sling.api.servlets.HttpConstants") + Map.entry("OPTIONS", "METHOD_OPTIONS from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("GET", "METHOD_GET from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("HEAD", "METHOD_HEAD from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("POST", "METHOD_POST from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("PUT", "METHOD_PUT from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("DELETE", "METHOD_DELETE from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("TRACE", "METHOD_TRACE from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("CONNECT", "METHOD_CONNECT from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("Accept", "HEADER_ACCEPT from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("ETag", "HEADER_ETAG from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("If-Match", "HEADER_IF_MATCH from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("If-Modified-Since", "HEADER_IF_MODIFIED_SINCE from class org.apache.sling.api.servlets.HttpConstants"), + Map.entry("Last-Modified", "HEADER_LAST_MODIFIED from class org.apache.sling.api.servlets.HttpConstants"), // interface org.osgi.framework.Constants - .put("System Bundle", "SYSTEM_BUNDLE_LOCATION from interface org.osgi.framework.Constants") - .put("system.bundle", "SYSTEM_BUNDLE_SYMBOLICNAME from interface org.osgi.framework.Constants") - .put("Bundle-Category", "BUNDLE_CATEGORY from interface org.osgi.framework.Constants") - .put("Bundle-ClassPath", "BUNDLE_CLASSPATH from interface org.osgi.framework.Constants") - .put("Bundle-Copyright", "BUNDLE_COPYRIGHT from interface org.osgi.framework.Constants") - .put("Bundle-Description", "BUNDLE_DESCRIPTION from interface org.osgi.framework.Constants") - .put("Bundle-Name", "BUNDLE_NAME from interface org.osgi.framework.Constants") - .put("Bundle-NativeCode", "BUNDLE_NATIVECODE from interface org.osgi.framework.Constants") - .put("Export-Package", "EXPORT_PACKAGE from interface org.osgi.framework.Constants") - .put("Export-Service", "EXPORT_SERVICE from interface org.osgi.framework.Constants") - .put("Import-Package", "IMPORT_PACKAGE from interface org.osgi.framework.Constants") - .put("DynamicImport-Package", "DYNAMICIMPORT_PACKAGE from interface org.osgi.framework.Constants") - .put("Import-Service", "IMPORT_SERVICE from interface org.osgi.framework.Constants") - .put("Bundle-Vendor", "BUNDLE_VENDOR from interface org.osgi.framework.Constants") - .put("Bundle-Version", "BUNDLE_VERSION from interface org.osgi.framework.Constants") - .put("Bundle-DocURL", "BUNDLE_DOCURL from interface org.osgi.framework.Constants") - .put("Bundle-ContactAddress", "BUNDLE_CONTACTADDRESS from interface org.osgi.framework.Constants") - .put("Bundle-Activator", "BUNDLE_ACTIVATOR from interface org.osgi.framework.Constants") - .put("Bundle-UpdateLocation", "BUNDLE_UPDATELOCATION from interface org.osgi.framework.Constants") - .put("specification-version", "PACKAGE_SPECIFICATION_VERSION from interface org.osgi.framework.Constants") - .put("processor", "BUNDLE_NATIVECODE_PROCESSOR from interface org.osgi.framework.Constants") - .put("osname", "BUNDLE_NATIVECODE_OSNAME from interface org.osgi.framework.Constants") - .put("osversion", "BUNDLE_NATIVECODE_OSVERSION from interface org.osgi.framework.Constants") - .put("language", "BUNDLE_NATIVECODE_LANGUAGE from interface org.osgi.framework.Constants") - .put("Bundle-RequiredExecutionEnvironment", "BUNDLE_REQUIREDEXECUTIONENVIRONMENT from interface org.osgi.framework.Constants") - .put("Bundle-SymbolicName", "BUNDLE_SYMBOLICNAME from interface org.osgi.framework.Constants") - .put("singleton", "SINGLETON_DIRECTIVE from interface org.osgi.framework.Constants") - .put("fragment-attachment", "FRAGMENT_ATTACHMENT_DIRECTIVE from interface org.osgi.framework.Constants") - .put("always", "FRAGMENT_ATTACHMENT_ALWAYS from interface org.osgi.framework.Constants") - .put("resolve-time", "FRAGMENT_ATTACHMENT_RESOLVETIME from interface org.osgi.framework.Constants") - .put("never", "FRAGMENT_ATTACHMENT_NEVER from interface org.osgi.framework.Constants") - .put("Bundle-Localization", "BUNDLE_LOCALIZATION from interface org.osgi.framework.Constants") - .put("OSGI-INF/l10n/bundle", "BUNDLE_LOCALIZATION_DEFAULT_BASENAME from interface org.osgi.framework.Constants") - .put("Require-Bundle", "REQUIRE_BUNDLE from interface org.osgi.framework.Constants") - .put("bundle-version", "BUNDLE_VERSION_ATTRIBUTE from interface org.osgi.framework.Constants") - .put("Fragment-Host", "FRAGMENT_HOST from interface org.osgi.framework.Constants") - .put("selection-filter", "SELECTION_FILTER_ATTRIBUTE from interface org.osgi.framework.Constants") - .put("Bundle-ManifestVersion", "BUNDLE_MANIFESTVERSION from interface org.osgi.framework.Constants") - .put("version", "VERSION_ATTRIBUTE from interface org.osgi.framework.Constants") - .put("bundle-symbolic-name", "BUNDLE_SYMBOLICNAME_ATTRIBUTE from interface org.osgi.framework.Constants") - .put("resolution", "RESOLUTION_DIRECTIVE from interface org.osgi.framework.Constants") - .put("optional", "RESOLUTION_OPTIONAL from interface org.osgi.framework.Constants") - .put("uses", "USES_DIRECTIVE from interface org.osgi.framework.Constants") - .put("include", "INCLUDE_DIRECTIVE from interface org.osgi.framework.Constants") - .put("exclude", "EXCLUDE_DIRECTIVE from interface org.osgi.framework.Constants") - .put("mandatory", "MANDATORY_DIRECTIVE from interface org.osgi.framework.Constants") - .put("visibility", "VISIBILITY_DIRECTIVE from interface org.osgi.framework.Constants") - .put("private", "VISIBILITY_PRIVATE from interface org.osgi.framework.Constants") - .put("reexport", "VISIBILITY_REEXPORT from interface org.osgi.framework.Constants") - .put("extension", "EXTENSION_DIRECTIVE from interface org.osgi.framework.Constants") - .put("framework", "EXTENSION_FRAMEWORK from interface org.osgi.framework.Constants") - .put("bootclasspath", "EXTENSION_BOOTCLASSPATH from interface org.osgi.framework.Constants") - .put("Bundle-ActivationPolicy", "BUNDLE_ACTIVATIONPOLICY from interface org.osgi.framework.Constants") - .put("lazy", "ACTIVATION_LAZY from interface org.osgi.framework.Constants") - .put("org.osgi.framework.version", "FRAMEWORK_VERSION from interface org.osgi.framework.Constants") - .put("org.osgi.framework.vendor", "FRAMEWORK_VENDOR from interface org.osgi.framework.Constants") - .put("org.osgi.framework.language", "FRAMEWORK_LANGUAGE from interface org.osgi.framework.Constants") - .put("org.osgi.framework.os.name", "FRAMEWORK_OS_NAME from interface org.osgi.framework.Constants") - .put("org.osgi.framework.os.version", "FRAMEWORK_OS_VERSION from interface org.osgi.framework.Constants") - .put("org.osgi.framework.processor", "FRAMEWORK_PROCESSOR from interface org.osgi.framework.Constants") - .put("org.osgi.framework.executionenvironment", "FRAMEWORK_EXECUTIONENVIRONMENT from interface org.osgi.framework.Constants") - .put("org.osgi.framework.bootdelegation", "FRAMEWORK_BOOTDELEGATION from interface org.osgi.framework.Constants") - .put("org.osgi.framework.system.packages", "FRAMEWORK_SYSTEMPACKAGES from interface org.osgi.framework.Constants") - .put("org.osgi.framework.system.packages.extra", "FRAMEWORK_SYSTEMPACKAGES_EXTRA from interface org.osgi.framework.Constants") - .put("org.osgi.supports.framework.extension", "SUPPORTS_FRAMEWORK_EXTENSION from interface org.osgi.framework.Constants") - .put("org.osgi.supports.bootclasspath.extension", "SUPPORTS_BOOTCLASSPATH_EXTENSION from interface org.osgi.framework.Constants") - .put("org.osgi.supports.framework.fragment", "SUPPORTS_FRAMEWORK_FRAGMENT from interface org.osgi.framework.Constants") - .put("org.osgi.supports.framework.requirebundle", "SUPPORTS_FRAMEWORK_REQUIREBUNDLE from interface org.osgi.framework.Constants") - .put("org.osgi.framework.security", "FRAMEWORK_SECURITY from interface org.osgi.framework.Constants") - .put("osgi", "FRAMEWORK_SECURITY_OSGI from interface org.osgi.framework.Constants") - .put("org.osgi.framework.storage", "FRAMEWORK_STORAGE from interface org.osgi.framework.Constants") - .put("org.osgi.framework.storage.clean", "FRAMEWORK_STORAGE_CLEAN from interface org.osgi.framework.Constants") - .put("onFirstInit", "FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT from interface org.osgi.framework.Constants") - .put("org.osgi.framework.library.extensions", "FRAMEWORK_LIBRARY_EXTENSIONS from interface org.osgi.framework.Constants") - .put("org.osgi.framework.command.execpermission", "FRAMEWORK_EXECPERMISSION from interface org.osgi.framework.Constants") - .put("org.osgi.framework.trust.repositories", "FRAMEWORK_TRUST_REPOSITORIES from interface org.osgi.framework.Constants") - .put("org.osgi.framework.windowsystem", "FRAMEWORK_WINDOWSYSTEM from interface org.osgi.framework.Constants") - .put("org.osgi.framework.startlevel.beginning", "FRAMEWORK_BEGINNING_STARTLEVEL from interface org.osgi.framework.Constants") - .put("org.osgi.framework.bundle.parent", "FRAMEWORK_BUNDLE_PARENT from interface org.osgi.framework.Constants") - .put("service.id", "SERVICE_ID from interface org.osgi.framework.Constants") - .put("service.pid", "SERVICE_PID from interface org.osgi.framework.Constants") - .put("service.ranking", "SERVICE_RANKING from interface org.osgi.framework.Constants") - .put("service.vendor", "SERVICE_VENDOR from interface org.osgi.framework.Constants") - .put("service.description", "SERVICE_DESCRIPTION from interface org.osgi.framework.Constants") + Map.entry("System Bundle", "SYSTEM_BUNDLE_LOCATION from interface org.osgi.framework.Constants"), + Map.entry("system.bundle", "SYSTEM_BUNDLE_SYMBOLICNAME from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Category", "BUNDLE_CATEGORY from interface org.osgi.framework.Constants"), + Map.entry("Bundle-ClassPath", "BUNDLE_CLASSPATH from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Copyright", "BUNDLE_COPYRIGHT from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Description", "BUNDLE_DESCRIPTION from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Name", "BUNDLE_NAME from interface org.osgi.framework.Constants"), + Map.entry("Bundle-NativeCode", "BUNDLE_NATIVECODE from interface org.osgi.framework.Constants"), + Map.entry("Export-Package", "EXPORT_PACKAGE from interface org.osgi.framework.Constants"), + Map.entry("Export-Service", "EXPORT_SERVICE from interface org.osgi.framework.Constants"), + Map.entry("Import-Package", "IMPORT_PACKAGE from interface org.osgi.framework.Constants"), + Map.entry("DynamicImport-Package", "DYNAMICIMPORT_PACKAGE from interface org.osgi.framework.Constants"), + Map.entry("Import-Service", "IMPORT_SERVICE from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Vendor", "BUNDLE_VENDOR from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Version", "BUNDLE_VERSION from interface org.osgi.framework.Constants"), + Map.entry("Bundle-DocURL", "BUNDLE_DOCURL from interface org.osgi.framework.Constants"), + Map.entry("Bundle-ContactAddress", "BUNDLE_CONTACTADDRESS from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Activator", "BUNDLE_ACTIVATOR from interface org.osgi.framework.Constants"), + Map.entry("Bundle-UpdateLocation", "BUNDLE_UPDATELOCATION from interface org.osgi.framework.Constants"), + Map.entry("specification-version", "PACKAGE_SPECIFICATION_VERSION from interface org.osgi.framework.Constants"), + Map.entry("processor", "BUNDLE_NATIVECODE_PROCESSOR from interface org.osgi.framework.Constants"), + Map.entry("osname", "BUNDLE_NATIVECODE_OSNAME from interface org.osgi.framework.Constants"), + Map.entry("osversion", "BUNDLE_NATIVECODE_OSVERSION from interface org.osgi.framework.Constants"), + Map.entry("language", "BUNDLE_NATIVECODE_LANGUAGE from interface org.osgi.framework.Constants"), + Map.entry("Bundle-RequiredExecutionEnvironment", "BUNDLE_REQUIREDEXECUTIONENVIRONMENT from interface org.osgi.framework.Constants"), + Map.entry("Bundle-SymbolicName", "BUNDLE_SYMBOLICNAME from interface org.osgi.framework.Constants"), + Map.entry("singleton", "SINGLETON_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("fragment-attachment", "FRAGMENT_ATTACHMENT_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("always", "FRAGMENT_ATTACHMENT_ALWAYS from interface org.osgi.framework.Constants"), + Map.entry("resolve-time", "FRAGMENT_ATTACHMENT_RESOLVETIME from interface org.osgi.framework.Constants"), + Map.entry("never", "FRAGMENT_ATTACHMENT_NEVER from interface org.osgi.framework.Constants"), + Map.entry("Bundle-Localization", "BUNDLE_LOCALIZATION from interface org.osgi.framework.Constants"), + Map.entry("OSGI-INF/l10n/bundle", "BUNDLE_LOCALIZATION_DEFAULT_BASENAME from interface org.osgi.framework.Constants"), + Map.entry("Require-Bundle", "REQUIRE_BUNDLE from interface org.osgi.framework.Constants"), + Map.entry("bundle-version", "BUNDLE_VERSION_ATTRIBUTE from interface org.osgi.framework.Constants"), + Map.entry("Fragment-Host", "FRAGMENT_HOST from interface org.osgi.framework.Constants"), + Map.entry("selection-filter", "SELECTION_FILTER_ATTRIBUTE from interface org.osgi.framework.Constants"), + Map.entry("Bundle-ManifestVersion", "BUNDLE_MANIFESTVERSION from interface org.osgi.framework.Constants"), + Map.entry("version", "VERSION_ATTRIBUTE from interface org.osgi.framework.Constants"), + Map.entry("bundle-symbolic-name", "BUNDLE_SYMBOLICNAME_ATTRIBUTE from interface org.osgi.framework.Constants"), + Map.entry("resolution", "RESOLUTION_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("optional", "RESOLUTION_OPTIONAL from interface org.osgi.framework.Constants"), + Map.entry("uses", "USES_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("include", "INCLUDE_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("exclude", "EXCLUDE_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("mandatory", "MANDATORY_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("visibility", "VISIBILITY_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("private", "VISIBILITY_PRIVATE from interface org.osgi.framework.Constants"), + Map.entry("reexport", "VISIBILITY_REEXPORT from interface org.osgi.framework.Constants"), + Map.entry("extension", "EXTENSION_DIRECTIVE from interface org.osgi.framework.Constants"), + Map.entry("framework", "EXTENSION_FRAMEWORK from interface org.osgi.framework.Constants"), + Map.entry("bootclasspath", "EXTENSION_BOOTCLASSPATH from interface org.osgi.framework.Constants"), + Map.entry("Bundle-ActivationPolicy", "BUNDLE_ACTIVATIONPOLICY from interface org.osgi.framework.Constants"), + Map.entry("lazy", "ACTIVATION_LAZY from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.version", "FRAMEWORK_VERSION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.vendor", "FRAMEWORK_VENDOR from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.language", "FRAMEWORK_LANGUAGE from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.os.name", "FRAMEWORK_OS_NAME from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.os.version", "FRAMEWORK_OS_VERSION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.processor", "FRAMEWORK_PROCESSOR from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.executionenvironment", "FRAMEWORK_EXECUTIONENVIRONMENT from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.bootdelegation", "FRAMEWORK_BOOTDELEGATION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.system.packages", "FRAMEWORK_SYSTEMPACKAGES from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.system.packages.extra", "FRAMEWORK_SYSTEMPACKAGES_EXTRA from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.supports.framework.extension", "SUPPORTS_FRAMEWORK_EXTENSION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.supports.bootclasspath.extension", "SUPPORTS_BOOTCLASSPATH_EXTENSION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.supports.framework.fragment", "SUPPORTS_FRAMEWORK_FRAGMENT from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.supports.framework.requirebundle", "SUPPORTS_FRAMEWORK_REQUIREBUNDLE from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.security", "FRAMEWORK_SECURITY from interface org.osgi.framework.Constants"), + Map.entry("osgi", "FRAMEWORK_SECURITY_OSGI from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.storage", "FRAMEWORK_STORAGE from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.storage.clean", "FRAMEWORK_STORAGE_CLEAN from interface org.osgi.framework.Constants"), + Map.entry("onFirstInit", "FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.library.extensions", "FRAMEWORK_LIBRARY_EXTENSIONS from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.command.execpermission", "FRAMEWORK_EXECPERMISSION from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.trust.repositories", "FRAMEWORK_TRUST_REPOSITORIES from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.windowsystem", "FRAMEWORK_WINDOWSYSTEM from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.startlevel.beginning", "FRAMEWORK_BEGINNING_STARTLEVEL from interface org.osgi.framework.Constants"), + Map.entry("org.osgi.framework.bundle.parent", "FRAMEWORK_BUNDLE_PARENT from interface org.osgi.framework.Constants"), + Map.entry("service.id", "SERVICE_ID from interface org.osgi.framework.Constants"), + Map.entry("service.pid", "SERVICE_PID from interface org.osgi.framework.Constants"), + Map.entry("service.ranking", "SERVICE_RANKING from interface org.osgi.framework.Constants"), + Map.entry("service.vendor", "SERVICE_VENDOR from interface org.osgi.framework.Constants"), + Map.entry("service.description", "SERVICE_DESCRIPTION from interface org.osgi.framework.Constants"), // class org.apache.sling.engine.EngineConstants - .put("javax.servlet.Filter", "FILTER_NAME from class org.apache.sling.engine.EngineConstants") - .put("sling.filter.scope", "SLING_FILTER_SCOPE from class org.apache.sling.engine.EngineConstants") - .put("COMPONENT", "FILTER_SCOPE_COMPONENT from class org.apache.sling.engine.EngineConstants") - .put("ERROR", "FILTER_SCOPE_ERROR from class org.apache.sling.engine.EngineConstants") - .put("INCLUDE", "FILTER_SCOPE_INCLUDE from class org.apache.sling.engine.EngineConstants") - .put("FORWARD", "FILTER_SCOPE_FORWARD from class org.apache.sling.engine.EngineConstants") - .put("REQUEST", "FILTER_SCOPE_REQUEST from class org.apache.sling.engine.EngineConstants") + Map.entry("javax.servlet.Filter", "FILTER_NAME from class org.apache.sling.engine.EngineConstants"), + Map.entry("sling.filter.scope", "SLING_FILTER_SCOPE from class org.apache.sling.engine.EngineConstants"), + Map.entry("COMPONENT", "FILTER_SCOPE_COMPONENT from class org.apache.sling.engine.EngineConstants"), + Map.entry("ERROR", "FILTER_SCOPE_ERROR from class org.apache.sling.engine.EngineConstants"), + Map.entry("INCLUDE", "FILTER_SCOPE_INCLUDE from class org.apache.sling.engine.EngineConstants"), + Map.entry("FORWARD", "FILTER_SCOPE_FORWARD from class org.apache.sling.engine.EngineConstants"), + Map.entry("REQUEST", "FILTER_SCOPE_REQUEST from class org.apache.sling.engine.EngineConstants"), // class com.adobe.granite.workflow.event.WorkflowEvent - .put("com/adobe/granite/workflow/event", "EVENT_TOPIC from class com.adobe.granite.workflow.event.WorkflowEvent") - - .build(); - } + Map.entry("com/adobe/granite/workflow/event", "EVENT_TOPIC from class com.adobe.granite.workflow.event.WorkflowEvent") + ); private ConstantsChecker() { // empty diff --git a/src/main/java/com/cognifide/aemrules/utils/Comparables.java b/src/main/java/com/cognifide/aemrules/utils/Comparables.java new file mode 100644 index 00000000..a7ade05e --- /dev/null +++ b/src/main/java/com/cognifide/aemrules/utils/Comparables.java @@ -0,0 +1,45 @@ +/*- + * #%L + * AEM Rules for SonarQube + * %% + * Copyright (C) 2015-2019 Cognifide Limited + * %% + * Licensed 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. + * #L% + */ +package com.cognifide.aemrules.utils; + +import java.util.Iterator; + +public final class Comparables { + + private Comparables() { + // intentionally empty + } + + public static > boolean isOrdered(Iterable list) { + Iterator i = list.iterator(); + if (i.hasNext()) { + T previous = i.next(); + while (i.hasNext()) { + T current = i.next(); + if (previous.compareTo(current) > 0) { + return false; + } + previous = current; + } + } + return true; + } + +} diff --git a/src/main/java/com/cognifide/aemrules/utils/MultiMap.java b/src/main/java/com/cognifide/aemrules/utils/MultiMap.java new file mode 100644 index 00000000..dcbf3968 --- /dev/null +++ b/src/main/java/com/cognifide/aemrules/utils/MultiMap.java @@ -0,0 +1,96 @@ +/*- + * #%L + * AEM Rules for SonarQube + * %% + * Copyright (C) 2015-2019 Cognifide Limited + * %% + * Licensed 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. + * #L% + */ +package com.cognifide.aemrules.utils; + +import java.util.*; +import java.util.function.Consumer; + +/** + * @link https://gist.github.com/kendfinger/9007632 + */ +public class MultiMap { + + private Map> delegate; + + public static MultiMap builder(Consumer> builder) { + MultiMap result = new MultiMap<>(); + builder.accept(result); + return result; + } + + public void put(K key, Collection values) { + createMap(); + delegate.put(key, values); + } + + private void createMap() { + if (delegate == null) { + delegate = new HashMap<>(); + } + } + + public Collection getAll(K key) { + if (getAll().containsKey(key)) { + return getAll().get(key); + } else { + LinkedList value = new LinkedList<>(); + getAll().put(key, value); + return value; + } + } + + public void add(K key, V value) { + getAll(key).add(value); + } + + public boolean remove(K key, V value) { + return getAll(key).remove(value); + } + + public void clear() { + delegate = null; + createMap(); + } + + public void clear(K key) { + put(key, new LinkedList()); + } + + public Map> getAll() { + createMap(); + return delegate; + } + + public boolean addAll(K key, Collection values) { + return getAll(key).addAll(values); + } + + public boolean isEmpty() { + return getAll().isEmpty(); + } + + public boolean isEmpty(K key) { + return getAll(key).isEmpty(); + } + + public boolean containsKey(V key) { + return getAll().containsKey(key); + } +} \ No newline at end of file diff --git a/src/main/java/com/cognifide/aemrules/utils/Throwables.java b/src/main/java/com/cognifide/aemrules/utils/Throwables.java new file mode 100644 index 00000000..acaaaf27 --- /dev/null +++ b/src/main/java/com/cognifide/aemrules/utils/Throwables.java @@ -0,0 +1,36 @@ +/*- + * #%L + * AEM Rules for SonarQube + * %% + * Copyright (C) 2015-2019 Cognifide Limited + * %% + * Licensed 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. + * #L% + */ +package com.cognifide.aemrules.utils; + +public final class Throwables { + + private Throwables() { + // intentionally empty + } + + public static Throwable getRootCause(Throwable throwable) { + Throwable cause; + while((cause = throwable.getCause()) != null) { + throwable = cause; + } + + return throwable; + } +} From beade9e2fac211d44470a6b58e4b5e5917ec03f6 Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Tue, 26 May 2020 14:02:45 +0200 Subject: [PATCH 2/5] Minors --- pom.xml | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 499cef8a..d4ba3905 100644 --- a/pom.xml +++ b/pom.xml @@ -91,10 +91,8 @@ UTF-8 1.1.2-1.4.0 7.9.2 - - - 3.0.1.1444 - 6.2.0.21135 + 3.2.0.2082 + 6.4.0.21967 4rVf3NGV0jyQ3EGrc8L86oEDoHWm6MgDD v${project.version} @@ -133,12 +131,12 @@ sonar-plugin ${sonar.java.plugin} provided - - - - - - + + + com.google.guava + guava + + org.sonarsource.sslr-squid-bridge @@ -176,12 +174,12 @@ org.sonarsource.html sonar-html-plugin ${sonar.html.version} - - - - - - + + + com.google.guava + guava + + From 79027f59213de5bc905f08d31fa5c45cedb82b9b Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Tue, 26 May 2020 14:07:55 +0200 Subject: [PATCH 3/5] Reverting sonar plugin version amendments --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d4ba3905..07964502 100644 --- a/pom.xml +++ b/pom.xml @@ -91,8 +91,8 @@ UTF-8 1.1.2-1.4.0 7.9.2 - 3.2.0.2082 - 6.4.0.21967 + 3.0.1.1444 + 6.2.0.21135 4rVf3NGV0jyQ3EGrc8L86oEDoHWm6MgDD v${project.version} From 996b56acb31eddd8cdd825aa74895e0ee06fe337 Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Tue, 26 May 2020 14:19:05 +0200 Subject: [PATCH 4/5] No guava even in unit tests --- pom.xml | 5 +++++ .../cognifide/aemrules/utils/Throwables.java | 14 ++++++++++++++ src/test/files/checks/java/SampleServlet.java | 3 +-- .../aemrules/extensions/RulesLoaderTest.java | 17 ++++++++--------- .../aemrules/htl/AbstractBaseTest.java | 3 ++- .../cognifide/aemrules/htl/HtlSensorTest.java | 5 ++--- .../aemrules/htl/visitors/HtlScannerTest.java | 5 ++--- .../aemrules/matcher/MethodMatcherTest.java | 3 +-- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 07964502..9948d72e 100644 --- a/pom.xml +++ b/pom.xml @@ -59,6 +59,11 @@ Jędrzej Pluciński jedrzej.plucinski@cognifide.com + + krystian.panek + Krystian Panek + krystian.panek@cognifide.com + diff --git a/src/main/java/com/cognifide/aemrules/utils/Throwables.java b/src/main/java/com/cognifide/aemrules/utils/Throwables.java index acaaaf27..0de9df95 100644 --- a/src/main/java/com/cognifide/aemrules/utils/Throwables.java +++ b/src/main/java/com/cognifide/aemrules/utils/Throwables.java @@ -33,4 +33,18 @@ public static Throwable getRootCause(Throwable throwable) { return throwable; } + + public static RuntimeException propagate(Throwable throwable) { + throwIfUnchecked(throwable); + throw new RuntimeException(throwable); + } + + public static void throwIfUnchecked(Throwable throwable) { + if (throwable instanceof RuntimeException) { + throw (RuntimeException) throwable; + } + if (throwable instanceof Error) { + throw (Error) throwable; + } + } } diff --git a/src/test/files/checks/java/SampleServlet.java b/src/test/files/checks/java/SampleServlet.java index ac7f3e81..d76fbfcf 100644 --- a/src/test/files/checks/java/SampleServlet.java +++ b/src/test/files/checks/java/SampleServlet.java @@ -19,7 +19,6 @@ */ package com.example; -import com.google.common.collect.Maps; import java.io.IOException; import java.util.Map; import javax.servlet.ServletException; @@ -73,7 +72,7 @@ public static ResourceResolver getResourceResolverForUser(ResourceResolverFactor throws LoginException { ResourceResolver resolver; if (userId != null) { - Map authenticationInfo = Maps.newHashMap(); + Map authenticationInfo = new HashMap<>(); authenticationInfo.put(ResourceResolverFactory.USER_IMPERSONATION, userId); resolver = factory.getServiceResourceResolver(authenticationInfo); } else { diff --git a/src/test/java/com/cognifide/aemrules/extensions/RulesLoaderTest.java b/src/test/java/com/cognifide/aemrules/extensions/RulesLoaderTest.java index c35fb1f8..2e28b66b 100644 --- a/src/test/java/com/cognifide/aemrules/extensions/RulesLoaderTest.java +++ b/src/test/java/com/cognifide/aemrules/extensions/RulesLoaderTest.java @@ -26,7 +26,6 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; import com.cognifide.aemrules.version.AemVersion; -import com.google.common.collect.ImmutableList; import java.util.List; import org.junit.Assert; import org.junit.Before; @@ -73,7 +72,7 @@ public void setUp() { @Test public void shouldLoadRuleWithAllSettings() { - givenRulesLoaded(ImmutableList.of(RuleWithAllSettings.class)); + givenRulesLoaded(List.of(RuleWithAllSettings.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); @@ -87,7 +86,7 @@ public void shouldLoadRuleWithAllSettings() { @Test public void shouldNotSetTechnicalDebtWhenAnnotationNotPresent() { - givenRulesLoaded(ImmutableList.of(RuleWithoutMetadataAnnotation.class)); + givenRulesLoaded(List.of(RuleWithoutMetadataAnnotation.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); @@ -101,7 +100,7 @@ public void shouldNotSetTechnicalDebtWhenAnnotationNotPresent() { @Test public void shouldNotSetTechnicalDebtWhenTechnicalDebtNotSetInMetadata() { - givenRulesLoaded(ImmutableList.of(RuleWithEmptyTechnicalDebt.class)); + givenRulesLoaded(List.of(RuleWithEmptyTechnicalDebt.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); @@ -115,7 +114,7 @@ public void shouldNotSetTechnicalDebtWhenTechnicalDebtNotSetInMetadata() { @Test public void shouldNotLoadRuleWhenRuleAnnotationIsNotPresent() { - givenRulesLoaded(ImmutableList.of(RuleWithoutRuleAnnotation.class)); + givenRulesLoaded(List.of(RuleWithoutRuleAnnotation.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); @@ -126,7 +125,7 @@ public void shouldNotLoadRuleWhenRuleAnnotationIsNotPresent() { @Test public void shouldSetDefaultValuesWhenRuleAttributeWithNameOnly() { - givenRulesLoaded(ImmutableList.of(RuleWithOnlyNameAttribute.class)); + givenRulesLoaded(List.of(RuleWithOnlyNameAttribute.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule("com.cognifide.aemrules.extensions.RulesLoaderTest.RuleWithOnlyNameAttribute"); @@ -140,12 +139,12 @@ public void shouldSetDefaultValuesWhenRuleAttributeWithNameOnly() { @Test(expected = IllegalStateException.class) public void shouldThrowExceptionWhenRuleNameNotProvide() { - givenRulesLoaded(ImmutableList.of(RuleWithoutNameAttributeSet.class)); + givenRulesLoaded(List.of(RuleWithoutNameAttributeSet.class)); } @Test public void shouldLoadRuleWithProperty() { - givenRulesLoaded(ImmutableList.of(RuleWithRuleProperty.class)); + givenRulesLoaded(List.of(RuleWithRuleProperty.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); @@ -158,7 +157,7 @@ public void shouldLoadRuleWithProperty() { @Test public void shouldLoadRuleWithPropertyWithoutAttributes() { - givenRulesLoaded(ImmutableList.of(RuleWithRulePropertyWithoutAttributes.class)); + givenRulesLoaded(List.of(RuleWithRulePropertyWithoutAttributes.class)); RepositoryImpl repository = (RepositoryImpl) context.repository(JavaCheckClasses.REPOSITORY_KEY); RulesDefinition.Rule rule = repository.rule(RULE_KEY); diff --git a/src/test/java/com/cognifide/aemrules/htl/AbstractBaseTest.java b/src/test/java/com/cognifide/aemrules/htl/AbstractBaseTest.java index f6cb9081..a7287921 100644 --- a/src/test/java/com/cognifide/aemrules/htl/AbstractBaseTest.java +++ b/src/test/java/com/cognifide/aemrules/htl/AbstractBaseTest.java @@ -24,12 +24,13 @@ import com.cognifide.aemrules.htl.lex.HtlLexer; import com.cognifide.aemrules.htl.rules.HtlCheckClasses; import com.cognifide.aemrules.htl.visitors.HtlScanner; -import com.google.common.base.Throwables; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; + +import com.cognifide.aemrules.utils.Throwables; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.rule.RuleKey; diff --git a/src/test/java/com/cognifide/aemrules/htl/HtlSensorTest.java b/src/test/java/com/cognifide/aemrules/htl/HtlSensorTest.java index 8a96e703..6bd37d6f 100644 --- a/src/test/java/com/cognifide/aemrules/htl/HtlSensorTest.java +++ b/src/test/java/com/cognifide/aemrules/htl/HtlSensorTest.java @@ -26,10 +26,10 @@ import com.cognifide.aemrules.extensions.AemRulesRulesDefinition; import com.cognifide.aemrules.htl.checks.HtlAttributesShouldBeAtTheEndCheck; import com.cognifide.aemrules.htl.rules.HtlCheckClasses; -import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -40,7 +40,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.rule.CheckFactory; -import org.sonar.api.batch.rule.internal.ActiveRulesBuilder; import org.sonar.api.batch.rule.internal.DefaultActiveRules; import org.sonar.api.batch.rule.internal.NewActiveRule; import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; @@ -170,7 +169,7 @@ private DefaultInputFile createInputFile(File dir, String fileName) throws IOExc .setModuleBaseDir(dir.toPath()) .setLanguage(HtmlConstants.LANGUAGE_KEY) .setType(InputFile.Type.MAIN) - .initMetadata(Files.toString(new File(dir, fileName), StandardCharsets.UTF_8)) + .initMetadata(Files.readString(new File(dir, fileName).toPath(), StandardCharsets.UTF_8)) .setCharset(StandardCharsets.UTF_8) .build(); } diff --git a/src/test/java/com/cognifide/aemrules/htl/visitors/HtlScannerTest.java b/src/test/java/com/cognifide/aemrules/htl/visitors/HtlScannerTest.java index e29151e6..7167d5ed 100644 --- a/src/test/java/com/cognifide/aemrules/htl/visitors/HtlScannerTest.java +++ b/src/test/java/com/cognifide/aemrules/htl/visitors/HtlScannerTest.java @@ -21,15 +21,15 @@ import static org.junit.Assert.assertEquals; -import com.cognifide.aemrules.htl.checks.AbstractHtlCheck; import com.cognifide.aemrules.htl.lex.HtlLexer; -import com.google.common.base.Throwables; import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.util.List; + +import com.cognifide.aemrules.utils.Throwables; import org.apache.sling.scripting.sightly.compiler.expression.Expression; import org.junit.Before; import org.junit.Test; @@ -37,7 +37,6 @@ import org.sonar.api.internal.google.common.io.Files; import org.sonar.plugins.html.api.HtmlConstants; import org.sonar.plugins.html.node.CommentNode; -import org.sonar.plugins.html.node.ExpressionNode; import org.sonar.plugins.html.node.Node; import org.sonar.plugins.html.node.TagNode; import org.sonar.plugins.html.visitor.HtmlSourceCode; diff --git a/src/test/java/com/cognifide/aemrules/matcher/MethodMatcherTest.java b/src/test/java/com/cognifide/aemrules/matcher/MethodMatcherTest.java index 2b53ce69..13055d67 100644 --- a/src/test/java/com/cognifide/aemrules/matcher/MethodMatcherTest.java +++ b/src/test/java/com/cognifide/aemrules/matcher/MethodMatcherTest.java @@ -19,7 +19,6 @@ */ package com.cognifide.aemrules.matcher; -import com.google.common.collect.Lists; import org.junit.Assert; import org.junit.Test; import org.sonar.java.model.JParser; @@ -160,7 +159,7 @@ private void givenMethodInvocationTree(String codeToParse) { } private CompilationUnitTree parse(String source) { - List classpath = Lists.newArrayList(new File(TEST_CLASSES_FILEPATH), new File(CLASSES_FILEPATH)); + List classpath = List.of(new File(TEST_CLASSES_FILEPATH), new File(CLASSES_FILEPATH)); return JParser.parse(JAVA_VERSION, UNIT_NAME, source, classpath); } From 6b11e6d79d549b5612711be055b6e646b74cea5d Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Thu, 25 Jun 2020 12:41:17 +0200 Subject: [PATCH 5/5] CR fixes --- .gitignore | 3 +- .../checks/DefaultDisplayContextCheck.java | 52 +++++----- .../aemrules/htl/lex/ElementTokenizer.java | 12 +-- .../java/checks/ThreadSafeFieldCheck.java | 16 ++-- .../cognifide/aemrules/utils/MultiMap.java | 96 ------------------- 5 files changed, 42 insertions(+), 137 deletions(-) delete mode 100644 src/main/java/com/cognifide/aemrules/utils/MultiMap.java diff --git a/.gitignore b/.gitignore index 2e34aaf9..341e7171 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ atlassian-ide-plugin.xml .classpath .project .settings/ -.java-version \ No newline at end of file +.java-version +.DS_Store \ No newline at end of file diff --git a/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java b/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java index f287c4a8..a7ca95ff 100644 --- a/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java +++ b/src/main/java/com/cognifide/aemrules/htl/checks/DefaultDisplayContextCheck.java @@ -21,13 +21,14 @@ import com.cognifide.aemrules.metadata.Metadata; import com.cognifide.aemrules.tag.Tags; -import com.cognifide.aemrules.utils.MultiMap; import com.cognifide.aemrules.version.AemVersion; import org.sonar.check.Priority; import org.sonar.check.Rule; import org.sonar.plugins.html.node.TagNode; import java.util.Collection; +import java.util.List; +import java.util.Map; import java.util.regex.Pattern; @Rule( @@ -52,36 +53,35 @@ public class DefaultDisplayContextCheck extends AbstractHtlCheck { private static final String VIOLATION_MESSAGE = "Explicitly using default display context, please remove display context from expression"; - private static final MultiMap TAG_ATTRIBUTE_MAPPING = MultiMap.builder(m -> { - m.add("form", "action"); - m.add("blockquote", "cite"); - m.add("del", "cite"); - m.add("ins", "cite"); - m.add("q", "cite"); - m.add("object", "data"); - m.add("button", "formaction"); - m.add("input", "formaction"); - m.add("a", "href"); - m.add("area", "href"); - m.add("link", "href"); - m.add("base", "href"); - m.add("html", "manifest"); - m.add("video", "poster"); - m.add("audio", "src"); - m.add("embed", "src"); - m.add("iframe", "src"); - m.add("img", "src"); - m.add("input", "src"); - m.add("script", "src"); - m.add("source", "src"); - m.add("track", "src"); - }); + private static final Map> TAG_ATTRIBUTE_MAPPING = Map.ofEntries( + Map.entry("a", List.of("href")), + Map.entry("area", List.of("href")), + Map.entry("audio", List.of("src")), + Map.entry("base", List.of("href")), + Map.entry("blockquote", List.of("cite")), + Map.entry("button", List.of("formaction")), + Map.entry("del", List.of("cite")), + Map.entry("embed", List.of("src")), + Map.entry("form", List.of("action")), + Map.entry("html", List.of("manifest")), + Map.entry("img", List.of("src")), + Map.entry("ins", List.of("cite")), + Map.entry("input", List.of("formaction", "src")), + Map.entry("iframe", List.of("src")), + Map.entry("link", List.of("href")), + Map.entry("q", List.of("cite")), + Map.entry("object", List.of("data")), + Map.entry("video", List.of("poster")), + Map.entry("script", List.of("src")), + Map.entry("source", List.of("src")), + Map.entry("track", List.of("src")) + ); @Override public void startElement(TagNode node) { String nodeName = node.getNodeName(); if (TAG_ATTRIBUTE_MAPPING.containsKey(nodeName)) { - Collection supportedAttributes = TAG_ATTRIBUTE_MAPPING.getAll(nodeName); + Collection supportedAttributes = TAG_ATTRIBUTE_MAPPING.get(nodeName); node.getAttributes().stream() .filter(attribute -> supportedAttributes.contains(attribute.getName())) .filter(a -> CONTEXT_URI_DEFINITION.matcher(a.getValue()).find()) diff --git a/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java b/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java index e7b18c19..7cbb68e6 100644 --- a/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java +++ b/src/main/java/com/cognifide/aemrules/htl/lex/ElementTokenizer.java @@ -32,11 +32,11 @@ class ElementTokenizer extends AbstractTokenizer> { - private static final EndQNameMatcher endQNameMatcher = new EndQNameMatcher(); + private static final EndQNameMatcher END_Q_NAME_MATCHER = new EndQNameMatcher(); - private static final EndTokenMatcher endTokenMatcher = new EndTokenMatcher(); + private static final EndTokenMatcher END_TOKEN_MATCHER = new EndTokenMatcher(); - private static final EndUnquotedAttributeMatcher endUnquotedAttributeMatcher = new EndUnquotedAttributeMatcher(); + private static final EndUnquotedAttributeMatcher END_UNQUOTED_ATTRIBUTE_MATCHER = new EndUnquotedAttributeMatcher(); public ElementTokenizer(String startToken, String endToken) { super(startToken, endToken); @@ -80,7 +80,7 @@ private static void handleBeforeAttributeValue(CodeReader codeReader, TagNode el codeReader.pop(); attribute.setQuoteChar((char) ch); } else { - codeReader.popTo(endUnquotedAttributeMatcher, sbValue); + codeReader.popTo(END_UNQUOTED_ATTRIBUTE_MATCHER, sbValue); attribute.setValue(sbValue.toString().trim()); } } @@ -89,7 +89,7 @@ private static void handleBeforeAttributeValue(CodeReader codeReader, TagNode el private static void handleBeforeAttributeName(CodeReader codeReader, TagNode element) { Attribute attribute; StringBuilder sbQName = new StringBuilder(); - codeReader.popTo(endQNameMatcher, sbQName); + codeReader.popTo(END_Q_NAME_MATCHER, sbQName); attribute = new Attribute(sbQName.toString().trim()); attribute.setLine(codeReader.getLinePosition() + element.getStartLinePosition() - 1); element.getAttributes().add(attribute); @@ -97,7 +97,7 @@ private static void handleBeforeAttributeName(CodeReader codeReader, TagNode ele private static void handleBeforeNodeName(CodeReader codeReader, TagNode element) { StringBuilder sbNodeName = new StringBuilder(); - codeReader.popTo(endTokenMatcher, sbNodeName); + codeReader.popTo(END_TOKEN_MATCHER, sbNodeName); element.setNodeName(sbNodeName.toString()); } diff --git a/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java b/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java index 11a3664b..4c0a9321 100644 --- a/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java +++ b/src/main/java/com/cognifide/aemrules/java/checks/ThreadSafeFieldCheck.java @@ -55,24 +55,24 @@ public class ThreadSafeFieldCheck extends BaseTreeVisitor implements JavaFileSca public static final String RULE_MESSAGE = "Usage of %s as a field is not thread safe."; - private static final Set vulnerableClasses = Set.of( + private static final Set VULNERABLE_CLASSES = Set.of( // empty for now ); - private static final Set vulnerableInterfaces = Set.of( + private static final Set VULNERABLE_INTERFACES = Set.of( "javax.servlet.Servlet", "javax.servlet.Filter", "org.osgi.service.event.EventHandler" ); - private static final Set vulnerableAnnotations = Set.of( + private static final Set VULNERABLE_ANNOTATIONS = Set.of( "org.apache.felix.scr.annotations.Component", "org.osgi.service.component.annotations.Component", "org.apache.felix.scr.annotations.sling.SlingServlet", // this is possibly duplicative, but that shouldn't be a problem. "org.apache.felix.scr.annotations.sling.SlingFilter" // this is possibly duplicative, but that shouldn't be a problem. ); - private static final Set nonThreadSafeTypes = Set.of( + private static final Set NON_THREAD_SAFE_TYPES = Set.of( "org.apache.sling.api.resource.ResourceResolver", "javax.jcr.Session", "com.day.cq.wcm.api.PageManager", @@ -116,7 +116,7 @@ private void checkMember(Tree member) { if (isVariableField) { VariableTree variableField = (VariableTree) member; String name = variableField.type().symbolType().fullyQualifiedName(); - if (nonThreadSafeTypes.contains(name)) { + if (NON_THREAD_SAFE_TYPES.contains(name)) { context.reportIssue(this, member, String.format(RULE_MESSAGE, name)); } } @@ -126,7 +126,7 @@ private boolean hasAnnotation(ClassTree clazz) { boolean hasAnnotation = false; for (AnnotationTree annotationTree : clazz.modifiers().annotations()) { String name = annotationTree.annotationType().symbolType().fullyQualifiedName(); - hasAnnotation |= vulnerableAnnotations.contains(name); + hasAnnotation |= VULNERABLE_ANNOTATIONS.contains(name); } return hasAnnotation; } @@ -136,7 +136,7 @@ private boolean extendsVulnerableClass(ClassTree clazz) { TypeTree type = clazz.superClass(); if (type != null) { String name = type.symbolType().fullyQualifiedName(); - extendsClass = vulnerableClasses.contains(name); + extendsClass = VULNERABLE_CLASSES.contains(name); } return extendsClass; } @@ -145,7 +145,7 @@ private boolean implementsVulnerableInterface(ClassTree clazz) { boolean implementsInterface = false; for (TypeTree typeTree : clazz.superInterfaces()) { String name = typeTree.symbolType().fullyQualifiedName(); - implementsInterface |= vulnerableInterfaces.contains(name); + implementsInterface |= VULNERABLE_INTERFACES.contains(name); } return implementsInterface; } diff --git a/src/main/java/com/cognifide/aemrules/utils/MultiMap.java b/src/main/java/com/cognifide/aemrules/utils/MultiMap.java deleted file mode 100644 index dcbf3968..00000000 --- a/src/main/java/com/cognifide/aemrules/utils/MultiMap.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * #%L - * AEM Rules for SonarQube - * %% - * Copyright (C) 2015-2019 Cognifide Limited - * %% - * Licensed 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. - * #L% - */ -package com.cognifide.aemrules.utils; - -import java.util.*; -import java.util.function.Consumer; - -/** - * @link https://gist.github.com/kendfinger/9007632 - */ -public class MultiMap { - - private Map> delegate; - - public static MultiMap builder(Consumer> builder) { - MultiMap result = new MultiMap<>(); - builder.accept(result); - return result; - } - - public void put(K key, Collection values) { - createMap(); - delegate.put(key, values); - } - - private void createMap() { - if (delegate == null) { - delegate = new HashMap<>(); - } - } - - public Collection getAll(K key) { - if (getAll().containsKey(key)) { - return getAll().get(key); - } else { - LinkedList value = new LinkedList<>(); - getAll().put(key, value); - return value; - } - } - - public void add(K key, V value) { - getAll(key).add(value); - } - - public boolean remove(K key, V value) { - return getAll(key).remove(value); - } - - public void clear() { - delegate = null; - createMap(); - } - - public void clear(K key) { - put(key, new LinkedList()); - } - - public Map> getAll() { - createMap(); - return delegate; - } - - public boolean addAll(K key, Collection values) { - return getAll(key).addAll(values); - } - - public boolean isEmpty() { - return getAll().isEmpty(); - } - - public boolean isEmpty(K key) { - return getAll(key).isEmpty(); - } - - public boolean containsKey(V key) { - return getAll().containsKey(key); - } -} \ No newline at end of file