Skip to content

Commit a5f6877

Browse files
reschkeandreeastroe96
authored andcommitted
OAK-11311: Remove usage of Guava ImmutableList.of() (apache#1923)
* OAK-11311: Remove usage of Guava ImmutableList - oak-upgrade * OAK-11311: Remove usage of Guava ImmutableList - oak-upgrade * OAK-11311: Remove usage of Guava ImmutableList - oak-store-spi * OAK-11311: Remove usage of Guava ImmutableList - oak-store-document - tests * OAK-11311: Remove usage of Guava ImmutableList - oak-store-document * OAK-11311: Remove usage of Guava ImmutableList - oak-store-document * OAK-11311: Remove usage of Guava ImmutableList - oak-authorization-cug * OAK-11311: Remove usage of Guava ImmutableList - oak-store-composite * OAK-11311: Remove usage of Guava ImmutableList - oak-solr-cote * OAK-11311: Remove usage of Guava ImmutableList - oak-segment-tar * OAK-11311: Remove usage of Guava ImmutableList - oak-segment-azure * OAK-11311: Remove usage of Guava ImmutableList - oak-security-spi - tests * OAK-11311: Remove usage of Guava ImmutableList - oak-security-spi * OAK-11311: Remove usage of Guava ImmutableList - remove unintended change in oak-core * OAK-11311: Remove usage of Guava ImmutableList - oak-search * OAK-11311: Remove usage of Guava ImmutableList - oak-run-commons * OAK-11311: Remove usage of Guava ImmutableList - oak-run-commons * OAK-11311: Remove usage of Guava ImmutableList - oak-run * OAK-11311: Remove usage of Guava ImmutableList - oak-query-spi * OAK-11311: Remove usage of Guava ImmutableList - oak-lucene * OAK-11311: Remove usage of Guava ImmutableList - oak-search - remove duplicate import * OAK-11311: Remove usage of Guava ImmutableList - oak-store-document - remove unused imports * OAK-11311: Remove usage of Guava ImmutableList - oak-security-spi - make a few lists unmodifiable * OAK-11311: Remove usage of Guava ImmutableList - oak-jcr * OAK-11311: Remove usage of Guava ImmutableList - oak-it * OAK-11311: Remove usage of Guava ImmutableList - oak-exercise * OAK-11311: Remove usage of Guava ImmutableList - oak-core-spi * OAK-11311: Remove usage of Guava ImmutableList - oak-core tests * OAK-11311: Remove usage of Guava ImmutableList - oak-core * OAK-11311: Remove usage of Guava ImmutableList - oak-commons * OAK-11311: Remove usage of Guava ImmutableList - oak-blob-plugins * OAK-11311: Remove usage of Guava ImmutableList - oak-blob-cloud * OAK-11311: Remove usage of Guava ImmutableList - oak-benchmarks * OAK-11311: Remove usage of Guava ImmutableList - oak-authorization-principalbased * OAK-11311: Remove usage of Guava ImmutableList - oak-auth-external * OAK-11311: Remove usage of Guava ImmutableList - oak-doc * OAK-11311: remove unused imports
1 parent 0751c3f commit a5f6877

File tree

48 files changed

+83
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+83
-126
lines changed

oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/principal/ExternalIdentityRepositoryInitializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
2323
import org.jetbrains.annotations.NotNull;
2424

25-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
25+
import java.util.List;
2626

2727
/**
2828
* Implementation of the {@code RepositoryInitializer} interface responsible for
@@ -54,12 +54,12 @@ public void initialize(@NotNull NodeBuilder builder) {
5454
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
5555
if (enforceUniqueIds && !index.hasChildNode("externalId")) {
5656
NodeBuilder definition = IndexUtils.createIndexDefinition(index, "externalId", true, true,
57-
ImmutableList.of(ExternalIdentityConstants.REP_EXTERNAL_ID), null);
57+
List.of(ExternalIdentityConstants.REP_EXTERNAL_ID), null);
5858
definition.setProperty("info", "Oak index assuring uniqueness of rep:externalId properties.");
5959
}
6060
if (!index.hasChildNode("externalPrincipalNames")) {
6161
NodeBuilder definition = IndexUtils.createIndexDefinition(index, "externalPrincipalNames", true, false,
62-
ImmutableList.of(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES), null);
62+
List.of(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES), null);
6363
definition.setProperty("info",
6464
"Oak index used by the principal management provided by the external authentication module.");
6565
}

oak-authorization-cug/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/cug/impl/CugConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import javax.jcr.RepositoryException;
2727
import javax.jcr.security.AccessControlManager;
2828

29-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
3029
import org.apache.jackrabbit.oak.api.Root;
3130
import org.apache.jackrabbit.oak.api.Tree;
3231
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
@@ -171,7 +170,7 @@ public List<? extends CommitHook> getCommitHooks(@NotNull String workspaceName)
171170
@NotNull
172171
@Override
173172
public List<? extends ValidatorProvider> getValidators(@NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull MoveTracker moveTracker) {
174-
return ImmutableList.of(new CugValidatorProvider());
173+
return List.of(new CugValidatorProvider());
175174
}
176175

177176
@NotNull

oak-authorization-principalbased/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/principalbased/impl/PrincipalBasedAuthorizationConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;
1818

19-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
2019
import org.apache.jackrabbit.guava.common.collect.Iterables;
2120
import org.apache.jackrabbit.oak.api.Root;
2221
import org.apache.jackrabbit.oak.api.Tree;
@@ -164,7 +163,7 @@ public List<? extends CommitHook> getCommitHooks(@NotNull String workspaceName)
164163
@NotNull
165164
@Override
166165
public List<? extends ValidatorProvider> getValidators(@NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull MoveTracker moveTracker) {
167-
return ImmutableList.of(new PrincipalPolicyValidatorProvider(new MgrProviderImpl(this), principals, workspaceName));
166+
return List.of(new PrincipalPolicyValidatorProvider(new MgrProviderImpl(this), principals, workspaceName));
168167
}
169168

170169
@NotNull

oak-benchmarks-lucene/src/main/java/org/apache/jackrabbit/oak/scalability/suites/ScalabilityNodeRelationshipSuite.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import javax.jcr.RepositoryException;
3333
import javax.jcr.Session;
3434

35-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
3635
import org.apache.commons.math3.stat.descriptive.SynchronizedDescriptiveStatistics;
3736
import org.apache.jackrabbit.api.JackrabbitSession;
3837
import org.apache.jackrabbit.api.security.user.Authorizable;
@@ -104,7 +103,7 @@ public class ScalabilityNodeRelationshipSuite extends ScalabilityNodeSuite {
104103
protected static final List<String> NODE_LEVELS = Splitter.on(",").trimResults()
105104
.omitEmptyStrings().splitToList(System.getProperty("nodeLevels", "10,5,2,1"));
106105

107-
protected static final List<String> NODE_LEVELS_DEFAULT = ImmutableList.of("10","5","2","1");
106+
protected static final List<String> NODE_LEVELS_DEFAULT = List.of("10","5","2","1");
108107

109108
private static final int NUM_USERS =
110109
(NODE_LEVELS.size() >= 1 ? Integer.parseInt(NODE_LEVELS.get(0)) : Integer.parseInt(NODE_LEVELS_DEFAULT.get(0)));

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentHasPermissionTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
import javax.jcr.RepositoryException;
2121
import javax.jcr.Session;
2222

23-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
24-
2523
/**
2624
* Concurrently calls Session#hasPermission on the deep tree:
2725
* - the path argument a random path out of the deep tree
2826
* - the actions are randomly selected from the combinations listed in {@link #ACTIONS}
2927
*/
3028
public class ConcurrentHasPermissionTest extends ConcurrentReadDeepTreeTest {
3129

32-
private static final List<String> ACTIONS = ImmutableList.of(
30+
private static final List<String> ACTIONS = List.of(
3331
Session.ACTION_READ,
3432
Session.ACTION_ADD_NODE,
3533
Session.ACTION_SET_PROPERTY,

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/FacetSearchTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package org.apache.jackrabbit.oak.benchmark;
1818

19-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
2019
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
2120
import org.apache.jackrabbit.oak.api.Tree;
2221
import org.apache.jackrabbit.oak.api.Type;
@@ -245,7 +244,7 @@ public void initialize(@NotNull NodeBuilder builder) {
245244
t.setProperty("jcr:primaryType", "nt:unstructured", NAME);
246245

247246
NodeBuilder uuid = IndexUtils.createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "uuid", true, true,
248-
ImmutableList.<String>of("jcr:uuid"), null);
247+
List.of("jcr:uuid"), null);
249248
uuid.setProperty("info",
250249
"Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable').");
251250

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PropertyFullTextTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
package org.apache.jackrabbit.oak.benchmark;
1818

19-
20-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
2119
import org.apache.jackrabbit.oak.api.Tree;
2220
import org.apache.jackrabbit.oak.benchmark.wikipedia.WikipediaImport;
2321
import org.apache.jackrabbit.oak.commons.PathUtils;
@@ -36,11 +34,11 @@
3634
import javax.jcr.query.RowIterator;
3735

3836
import java.io.File;
37+
import java.util.List;
3938
import java.util.Set;
4039
import java.util.concurrent.TimeUnit;
4140
import java.util.concurrent.atomic.AtomicReference;
4241

43-
4442
import static java.util.Objects.requireNonNull;
4543
import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
4644
import static org.apache.jackrabbit.oak.api.Type.LONG;
@@ -181,7 +179,7 @@ public void initialize(final @NotNull NodeBuilder builder) {
181179
t.setProperty("jcr:primaryType", "nt:unstructured", NAME);
182180

183181
NodeBuilder uuid = IndexUtils.createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "uuid", true, true,
184-
ImmutableList.<String>of("jcr:uuid"), null);
182+
List.of("jcr:uuid"), null);
185183
uuid.setProperty("info",
186184
"Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable').");
187185

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/SearchTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import javax.jcr.query.QueryResult;
4141
import javax.jcr.query.RowIterator;
4242

43-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
4443
import org.apache.commons.io.FileUtils;
4544
import org.apache.jackrabbit.oak.benchmark.wikipedia.WikipediaImport;
4645
import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
@@ -219,7 +218,7 @@ protected class UUIDInitializer implements RepositoryInitializer {
219218
public void initialize(@NotNull NodeBuilder builder) {
220219

221220
NodeBuilder uuid = IndexUtils.createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "uuid", true, true,
222-
ImmutableList.<String>of("jcr:uuid"), null);
221+
List.of("jcr:uuid"), null);
223222
uuid.setProperty("info",
224223
"Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable').");
225224

oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/authentication/external/PrincipalNameResolutionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
import javax.security.auth.login.Configuration;
2020

21-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
2221
import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
2322
import org.apache.jackrabbit.oak.spi.security.authentication.ConfigurationUtil;
2423
import org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef;
2524
import org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SyncMBeanImpl;
2625
import org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SynchronizationMBean;
2726

27+
import java.util.List;
28+
2829
/**
2930
* Benchmark for {@link SynchronizationMBean#syncExternalUsers(String[])}
3031
*/
@@ -33,7 +34,7 @@ public class PrincipalNameResolutionTest extends AbstractExternalTest {
3334
private SynchronizationMBean bean;
3435

3536
public PrincipalNameResolutionTest(int numberOfUsers, int membershipSize, long expTime, int roundtripDelay) {
36-
super(numberOfUsers, membershipSize, expTime, true, ImmutableList.<String>of(), roundtripDelay, 0L);
37+
super(numberOfUsers, membershipSize, expTime, true, List.of(), roundtripDelay, 0L);
3738
}
3839

3940
@Override

oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/AbstractSharedCachingDataStore.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.slf4j.LoggerFactory;
5858

5959
import org.apache.jackrabbit.guava.common.base.Stopwatch;
60-
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
6160
import org.apache.jackrabbit.guava.common.collect.Iterators;
6261
import org.apache.jackrabbit.guava.common.io.Closeables;
6362
import org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorService;
@@ -374,7 +373,7 @@ public boolean exists(final DataIdentifier identifier) {
374373
}
375374

376375
public List<DataStoreCacheStatsMBean> getStats() {
377-
return ImmutableList.of(cache.getCacheStats(), cache.getStagingCacheStats());
376+
return List.of(cache.getCacheStats(), cache.getStagingCacheStats());
378377
}
379378

380379
protected CompositeDataStoreCache getCache() {

0 commit comments

Comments
 (0)