You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2021/09/12 15:36:04 UTC
[sling-maven-plugin] branch master updated: cosmetic: eliminate
some code warnings
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new d67d5c1 cosmetic: eliminate some code warnings
d67d5c1 is described below
commit d67d5c1900782c68c1bfcbdc499c02cf31224916
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Sun Sep 12 17:35:51 2021 +0200
cosmetic: eliminate some code warnings
---
.../bundlesupport/GenerateAdapterMetadataMojo.java | 15 +++++++--------
.../method/IntermediateUrisExtractorTest.java | 21 ++++++++++-----------
2 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/sling-maven-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java b/sling-maven-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
index a54e0a6..fabf269 100644
--- a/sling-maven-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
+++ b/sling-maven-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
@@ -5,9 +5,9 @@
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -56,10 +56,10 @@ import org.scannotation.AnnotationDB;
/**
* Build <a href="http://sling.apache.org/documentation/the-sling-engine/adapters.html">adapter metadata (JSON)</a> for the Web Console Plugin at {@code /system/console/status-adapters} and
- * {@code /system/console/adapters} from classes annotated with
+ * {@code /system/console/adapters} from classes annotated with
* <a href="https://github.com/apache/sling-adapter-annotations">adapter annotations</a>.
*/
-@Mojo(name="generate-adapter-metadata", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
+@Mojo(name="generate-adapter-metadata", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE)
public class GenerateAdapterMetadataMojo extends AbstractMojo {
@@ -126,7 +126,6 @@ public class GenerateAdapterMetadataMojo extends AbstractMojo {
final ClassNode classNode = new ClassNode();
classReader.accept(classNode, SKIP_CODE | SKIP_DEBUG | SKIP_FRAMES);
- @SuppressWarnings("unchecked")
final List<AnnotationNode> annotations = classNode.invisibleAnnotations;
for (final AnnotationNode annotation : annotations) {
if (ADAPTABLE_DESC.equals(annotation.desc)) {
@@ -153,7 +152,7 @@ public class GenerateAdapterMetadataMojo extends AbstractMojo {
}
}
-
+
private void addAnnotatedClasses(final AnnotationDB annotationDb, final Set<String> annotatedClassNames, final Class<? extends Annotation> clazz) {
Set<String> classNames = annotationDb.getAnnotationIndex().get(clazz.getName());
if (classNames == null || classNames.isEmpty()) {
@@ -262,10 +261,10 @@ public class GenerateAdapterMetadataMojo extends AbstractMojo {
if (adapterClasses == null) {
throw new IllegalArgumentException("Adapter annotation is malformed. Expecting a list of adapter classes");
}
-
+
for (final Type adapterClass : adapterClasses) {
JsonSupport.accumulate(adaptableDescription, condition, adapterClass.getClassName());
}
}
-
+
}
diff --git a/sling-maven-plugin/src/test/java/org/apache/sling/maven/bundlesupport/deploy/method/IntermediateUrisExtractorTest.java b/sling-maven-plugin/src/test/java/org/apache/sling/maven/bundlesupport/deploy/method/IntermediateUrisExtractorTest.java
index 71d359a..a099836 100644
--- a/sling-maven-plugin/src/test/java/org/apache/sling/maven/bundlesupport/deploy/method/IntermediateUrisExtractorTest.java
+++ b/sling-maven-plugin/src/test/java/org/apache/sling/maven/bundlesupport/deploy/method/IntermediateUrisExtractorTest.java
@@ -5,9 +5,9 @@
* licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,41 +17,40 @@
package org.apache.sling.maven.bundlesupport.deploy.method;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.apache.sling.maven.bundlesupport.deploy.method.IntermediateUrisExtractor;
import org.junit.Test;
public class IntermediateUrisExtractorTest {
-
+
@Test
public void extractPaths() {
- doTest("http://localhost:8080/apps/slingshot/install",
+ doTest("http://localhost:8080/apps/slingshot/install",
Arrays.asList("http://localhost:8080/apps/slingshot/install", "http://localhost:8080/apps/slingshot", "http://localhost:8080/apps" ));
}
-
+
private void doTest(String input, List<String> expectedOutput) {
List<String> paths = IntermediateUrisExtractor.extractIntermediateUris(input);
-
+
assertThat(paths, equalTo(expectedOutput));
}
@Test
public void extractPaths_trailingSlash() {
-
- doTest("http://localhost:8080/apps/slingshot/install/",
+
+ doTest("http://localhost:8080/apps/slingshot/install/",
Arrays.asList("http://localhost:8080/apps/slingshot/install", "http://localhost:8080/apps/slingshot", "http://localhost:8080/apps" ));
}
@Test
public void extractPaths_empty() {
-
+
doTest("http://localhost:8080", Collections.<String> emptyList());
}