You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "rishabhdaim (via GitHub)" <gi...@apache.org> on 2024/09/02 06:04:10 UTC
[PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
rishabhdaim opened a new pull request, #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#issuecomment-2341589579
Works for me; at some point we need final cleanup sweep anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#discussion_r1752305432
##########
oak-run/src/main/java/org/apache/jackrabbit/oak/index/IndexDefinitionUpdater.java:
##########
@@ -130,7 +130,7 @@ private void writeReindexingLuceneDefs(String outFilePath, List<String> reindexi
}
private List<String> getReindexIndexPaths() {
- return stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false)
+ return StreamSupport.stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false)
Review Comment:
It is returning `List` not `Set`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#discussion_r1751905317
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/Namespaces.java:
##########
@@ -138,8 +138,10 @@ public static String addCustomMapping(
public static void buildIndexNode(NodeBuilder namespaces) {
// initialize prefix and URI sets with the defaults namespace
// that's not stored along with the other mappings
- Set<String> prefixes = newHashSet("");
- Set<String> uris = newHashSet("");
+ Set<String> prefixes = new HashSet<>();
Review Comment:
Use CollectionUtils?
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/composite/LimitedScopeProvider.java:
##########
@@ -34,6 +34,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+
Review Comment:
drop
##########
oak-run/src/main/java/org/apache/jackrabbit/oak/index/IndexDefinitionUpdater.java:
##########
@@ -280,7 +280,7 @@ private static String toString(PropertyState ps) {
String v = BLOB_LENGTH.apply(ps.getValue(BINARY));
val.append(" = {").append(v).append("}");
} else if (ps.getType() == BINARIES) {
- String v = stream(ps.getValue(BINARIES).spliterator(), false)
+ String v = StreamSupport.stream(ps.getValue(BINARIES).spliterator(), false)
Review Comment:
CollectionUtils?
##########
oak-run/src/main/java/org/apache/jackrabbit/oak/index/IndexDefinitionUpdater.java:
##########
@@ -130,7 +130,7 @@ private void writeReindexingLuceneDefs(String outFilePath, List<String> reindexi
}
private List<String> getReindexIndexPaths() {
- return stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false)
+ return StreamSupport.stream(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME).getChildNodeEntries().spliterator(), false)
Review Comment:
Use CollectionUtils?
##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ActiveDeletedBlobCollectorMBeanImpl.java:
##########
@@ -213,7 +213,7 @@ public void flagActiveDeletionSafe() {
*/
private boolean waitForRunningIndexCycles() {
Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = Maps.asMap(
- Sets.newHashSet(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
+ new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
Review Comment:
use CollectionUtils?
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java:
##########
@@ -102,11 +102,11 @@ public Iterable<NodeDocument> getModifiedDocs(final long fromModified, final lon
@NotNull final Set<String> includePaths,
@NotNull final Set<String> excludePaths) {
// (_modified = fromModified && _id > fromId || _modified > fromModified && _modified < toModified)
- final Stream<NodeDocument> s1 = stream(getSelectedDocuments(store,
+ final Stream<NodeDocument> s1 = StreamSupport.stream(getSelectedDocuments(store,
Review Comment:
CollectionUtils?
##########
oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/permission/Permissions.java:
##########
@@ -29,13 +29,13 @@
import org.jetbrains.annotations.Nullable;
import javax.jcr.Session;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
+
+import static java.util.stream.Collectors.toSet;
Review Comment:
We should agree on a consistent strategy whether the Collector imports should be static (I'm leaning towards "no")..
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java:
##########
@@ -75,7 +75,7 @@ public VersionGCSupport(DocumentStore store) {
* @return matching documents.
*/
public Iterable<NodeDocument> getPossiblyDeletedDocs(final long fromModified, final long toModified) {
- return stream(getSelectedDocuments(store, NodeDocument.DELETED_ONCE, 1).spliterator(), false)
+ return StreamSupport.stream(getSelectedDocuments(store, NodeDocument.DELETED_ONCE, 1).spliterator(), false)
Review Comment:
CollectionUtils?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#discussion_r1752305030
##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ActiveDeletedBlobCollectorMBeanImpl.java:
##########
@@ -213,7 +213,7 @@ public void flagActiveDeletionSafe() {
*/
private boolean waitForRunningIndexCycles() {
Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = Maps.asMap(
- Sets.newHashSet(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
+ new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
Review Comment:
I don't think this would give us any additional benefit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#discussion_r1752305030
##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ActiveDeletedBlobCollectorMBeanImpl.java:
##########
@@ -213,7 +213,7 @@ public void flagActiveDeletionSafe() {
*/
private boolean waitForRunningIndexCycles() {
Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = Maps.asMap(
- Sets.newHashSet(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
+ new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
Review Comment:
I don't think this won't give us any additional benefit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#issuecomment-2339639772
@reschke @mbaedke Updated this PR with utils from oak-commons. Could you please review and share feedback?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#discussion_r1745169800
##########
oak-auth-external/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/DefaultSyncHandlerTest.java:
##########
@@ -245,7 +245,8 @@ public void testListIdentitiesAfterSync() throws Exception {
sync(USER_ID, false);
// membership-nesting is 1 => expect only 'USER_ID' plus the declared group-membership
- Set<String> expected = Sets.newHashSet(USER_ID);
+ Set<String> expected = new HashSet<>();
Review Comment:
maybe:
Set<String> expected = Stream.of(USER_ID).collect(Collectors.toSet());
?
##########
oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreUtilsTest.java:
##########
@@ -518,12 +524,13 @@ public void testStreamFromGetAllRecords() throws Exception {
File rootFolder = folder.newFolder();
dataStore = getBlobStore(rootFolder);
int number = 10;
- Set<DataRecord> added = newHashSet();
+ Set<DataRecord> added = new HashSet<>();
for (int i = 0; i < number; i++) {
added.add(dataStore.addRecord(randomStream(i, 16516)));
}
- Set<DataRecord> retrieved = newHashSet((dataStore.getAllRecords()));
+ Set<DataRecord> retrieved = new HashSet<>();
Review Comment:
dito
##########
oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreUtilsTest.java:
##########
@@ -471,15 +471,18 @@ public void testGetAllRecords() throws Exception {
File rootFolder = folder.newFolder();
dataStore = getBlobStore(rootFolder);
int number = 10;
- Set<String> added = newHashSet();
+ Set<String> added = new HashSet<>();
for (int i = 0; i < number; i++) {
String rec = dataStore.addRecord(randomStream(i, 16516))
.getIdentifier().toString();
added.add(rec);
}
- Set<String> retrieved = newHashSet(Iterables.transform(newHashSet(dataStore.getAllRecords()),
- input -> input.getIdentifier().toString()));
+ Set<DataRecord> recordSet = new HashSet<>();
Review Comment:
Maybe
CollectionUtils.toSet(...)
?
##########
oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/SharedDataStoreUtilsTest.java:
##########
@@ -508,8 +511,11 @@ public void testGetAllRecordsWithMeta() throws Exception {
added.add(rec);
}
- Set<String> retrieved = newHashSet(Iterables.transform(newHashSet(dataStore.getAllRecords()),
- input -> input.getIdentifier().toString()));
+ Set<DataRecord> recordSet = new HashSet<>();
Review Comment:
dito
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678#issuecomment-2341448355
thanks for the review @reschke. I only changed where we are using Guava's `newHashSet`.
Let's open separate Jiras for other changes instead of piggybacking this one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-11024 : removed usage of Sets.newHashSet [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim merged PR #1678:
URL: https://github.com/apache/jackrabbit-oak/pull/1678
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org