aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 15:09:55 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 21:04:22 +0200
commit2d6bbe0b8bff09d105b77161c1d26a00ce43bf0c (patch)
treef9948a9904d837960887e81a956b29f92d918002 /bundle-plugin/src
parent6923743ed320ce339727ad57f6fc2da5f82f5e3f (diff)
Unify on List.of
Diffstat (limited to 'bundle-plugin/src')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java5
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JarFiles.java5
-rw-r--r--bundle-plugin/src/test/java/com/yahoo/container/plugin/osgi/ImportPackageTest.java5
3 files changed, 6 insertions, 9 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
index cbe5e97374c..74780cdaa25 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
@@ -9,7 +9,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.jar.Manifest;
@@ -37,7 +36,7 @@ public class AnalyzeBundle {
static List<Export> exportedPackages(File jarFile) {
var manifest = getOsgiManifest(jarFile);
- if (manifest == null) return Collections.emptyList();
+ if (manifest == null) return List.of();
try {
return parseExports(manifest);
} catch (Exception e) {
@@ -55,7 +54,7 @@ public class AnalyzeBundle {
private static List<String> nonPublicApiPackages(File jarFile) {
var manifest = getOsgiManifest(jarFile);
- if (manifest == null) return Collections.emptyList();
+ if (manifest == null) return List.of();
return getMainAttributeValue(manifest, "X-JDisc-Non-PublicApi-Export-Package")
.map(s -> Arrays.asList(s.split(",")))
.orElseGet(ArrayList::new);
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JarFiles.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JarFiles.java
index af403946f39..c66aa61a8ee 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JarFiles.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/JarFiles.java
@@ -4,7 +4,6 @@ package com.yahoo.container.plugin.util;
import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.jar.JarFile;
@@ -25,8 +24,8 @@ public class JarFiles {
.map(s -> Arrays.stream(s.split(","))
.map(ArtifactId::fromStringValue)
.toList())
- .orElse(Collections.emptyList()))
- .orElse(Collections.emptyList());
+ .orElse(List.of()))
+ .orElse(List.of());
}
diff --git a/bundle-plugin/src/test/java/com/yahoo/container/plugin/osgi/ImportPackageTest.java b/bundle-plugin/src/test/java/com/yahoo/container/plugin/osgi/ImportPackageTest.java
index caaa8d5c6c0..7ad1afff01d 100644
--- a/bundle-plugin/src/test/java/com/yahoo/container/plugin/osgi/ImportPackageTest.java
+++ b/bundle-plugin/src/test/java/com/yahoo/container/plugin/osgi/ImportPackageTest.java
@@ -6,7 +6,6 @@ import com.yahoo.container.plugin.osgi.ExportPackages.Parameter;
import com.yahoo.container.plugin.osgi.ImportPackages.Import;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -23,8 +22,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class ImportPackageTest {
private static final String PACKAGE_NAME = "com.yahoo.exported";
- private final Set<String> referencedPackages = Collections.singleton(PACKAGE_NAME);
- private final Map<String, Export> exports = exportByPackageName(new Export(List.of(PACKAGE_NAME), Collections.emptyList()));
+ private final Set<String> referencedPackages = Set.of(PACKAGE_NAME);
+ private final Map<String, Export> exports = exportByPackageName(new Export(List.of(PACKAGE_NAME), List.of()));
private final Map<String, Export> exportsWithVersion = exportByPackageName(
new Export(List.of(PACKAGE_NAME), List.of(new Parameter("version", "1.3"))));