Index: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java =================================================================== diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java deleted file mode 100644 --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/GuavaDeprecation.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ /dev/null (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jackrabbit.oak.commons; - -import java.util.Locale; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GuavaDeprecation { - - private static final Logger LOG = LoggerFactory.getLogger(GuavaDeprecation.class); - - private static final String DEFAULT = "warn"; - - private static final String TLOGLEVEL = System.getProperty(GuavaDeprecation.class + ".LOGLEVEL", DEFAULT); - - private static String LOGLEVEL; - - static { - String t; - - switch (TLOGLEVEL.toLowerCase(Locale.ENGLISH)) { - case "error": - case "warn": - case "info": - case "debug": - t = TLOGLEVEL.toLowerCase(Locale.ENGLISH); - break; - default: - t = DEFAULT; - break; - } - - LOGLEVEL = t; - } - - private GuavaDeprecation() { - } - - public static void handleCall(String ticket) throws UnsupportedOperationException { - String message = "use of deprecated Guava-related API - this method is going to be removed in future Oak releases - see %s for details"; - - switch (LOGLEVEL) { - case "error": - if (LOG.isErrorEnabled()) { - LOG.error(String.format(message, ticket), new Exception("call stack")); - } - break; - case "warn": - if (LOG.isWarnEnabled()) { - LOG.warn(String.format(message, ticket), new Exception("call stack")); - } - break; - case "info": - if (LOG.isInfoEnabled()) { - LOG.info(String.format(message, ticket), new Exception("call stack")); - } - break; - case "debug": - if (LOG.isDebugEnabled()) { - LOG.debug(String.format(message, ticket), new Exception("call stack")); - } - break; - } - } - - // for testing - public static String setLogLevel(String level) { - String before = LOGLEVEL; - LOGLEVEL = level; - return before; - } -} Index: oak-core/src/main/java/org/apache/jackrabbit/oak/core/GuavaDeprecation.java =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/GuavaDeprecation.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/core/GuavaDeprecation.java deleted file mode 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/core/GuavaDeprecation.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ /dev/null (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jackrabbit.oak.core; - -import java.util.Locale; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GuavaDeprecation { - - private static final Logger LOG = LoggerFactory.getLogger(GuavaDeprecation.class); - - private static final String DEFAULT = "debug"; - - private static final String TLOGLEVEL = System.getProperty(GuavaDeprecation.class + ".LOGLEVEL", DEFAULT); - - private static String LOGLEVEL; - - static { - String t; - - switch (TLOGLEVEL.toLowerCase(Locale.ENGLISH)) { - case "error": - case "warn": - case "info": - case "debug": - t = TLOGLEVEL.toLowerCase(Locale.ENGLISH); - break; - default: - t = DEFAULT; - break; - } - - LOGLEVEL = t; - } - - private GuavaDeprecation() { - } - - public static void handleCall(String ticket) throws UnsupportedOperationException { - String message = "use of deprecated Guava-related API - this method is going to be removed in future Oak releases - see %s for details"; - - switch (LOGLEVEL) { - case "error": - if (LOG.isErrorEnabled()) { - LOG.error(String.format(message, ticket), new Exception("call stack")); - } - break; - case "warn": - if (LOG.isWarnEnabled()) { - LOG.warn(String.format(message, ticket), new Exception("call stack")); - } - break; - case "info": - if (LOG.isInfoEnabled()) { - LOG.info(String.format(message, ticket), new Exception("call stack")); - } - break; - case "debug": - if (LOG.isDebugEnabled()) { - LOG.debug(String.format(message, ticket), new Exception("call stack")); - } - break; - } - } - - // for testing - public static String setLogLevel(String level) { - String before = LOGLEVEL; - LOGLEVEL = level; - return before; - } -} Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java deleted file mode 100644 --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ /dev/null (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jackrabbit.oak.spi; - -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GuavaDeprecation { - - private static final Logger LOG = LoggerFactory.getLogger(GuavaDeprecation.class); - - private static final String DEFAULT = "warn"; - - private static final String TLOGLEVEL = System.getProperty(GuavaDeprecation.class + ".LOGLEVEL", DEFAULT); - - private static String LOGLEVEL; - - static { - String t; - - switch (TLOGLEVEL.toLowerCase(Locale.ENGLISH)) { - case "error": - case "warn": - case "info": - case "debug": - t = TLOGLEVEL.toLowerCase(Locale.ENGLISH); - break; - default: - t = DEFAULT; - break; - } - - LOGLEVEL = t; - } - - private GuavaDeprecation() { - } - - public static void handleCall(String ticket) throws UnsupportedOperationException { - handleCall(ticket, null, Collections.emptyList()); - } - - public static void handleCall(String ticket, String className, List allowed) throws UnsupportedOperationException { - String message = "use of deprecated Guava-related API - this method is going to be removed in future Oak releases - see %s for details"; - - switch (LOGLEVEL) { - case "error": - if (LOG.isErrorEnabled()) { - Exception ex = new Exception("call stack"); - if (deprecatedCaller(ex, className, allowed)) { - LOG.error(String.format(message, ticket), ex); - } - } - break; - case "warn": - if (LOG.isWarnEnabled()) { - Exception ex = new Exception("call stack"); - if (deprecatedCaller(ex, className, allowed)) { - LOG.warn(String.format(message, ticket), ex); - } - } - break; - case "info": - if (LOG.isInfoEnabled()) { - Exception ex = new Exception("call stack"); - if (deprecatedCaller(ex, className, allowed)) { - LOG.info(String.format(message, ticket), ex); - } - } - break; - case "debug": - if (LOG.isDebugEnabled()) { - Exception ex = new Exception("call stack"); - if (deprecatedCaller(ex, className, allowed)) { - LOG.debug(String.format(message, ticket), ex); - } - } - break; - } - } - - public static boolean deprecatedCaller(Exception ex, String className, List allowed) { - if (allowed == null) { - return true; - } else { - boolean classFound = false; - for (StackTraceElement el : ex.getStackTrace()) { - String cn = el.getClassName(); - if (!classFound) { - // still looking for the entry - classFound = cn.equals(className); - } else { - // still in class checked for? - if (cn.equals(className)) { - // go one - } else { - // check caller - for (String a : allowed) { - if (cn.startsWith(a)) { - return false; - } - } - } - } - } - return true; - } - } -} Index: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java (date 1635343031064) @@ -357,7 +357,7 @@ } if (entry.isAllow) { - if (!respectParent || predicate.apply(entry, false)) { + if (!respectParent || predicate.test(entry, false)) { allowBits.addDifference(entry.privilegeBits, denyBits); } long ap = PrivilegeBits.calculatePermissions(allowBits, parentAllowBits, true); @@ -366,7 +366,7 @@ return true; } } else { - if (!respectParent || predicate.apply(entry, false)) { + if (!respectParent || predicate.test(entry, false)) { denyBits.addDifference(entry.privilegeBits, allowBits); } long dp = PrivilegeBits.calculatePermissions(denyBits, parentDenyBits, false); @@ -656,7 +656,7 @@ while (next == null) { if (nextEntries.hasNext()) { PermissionEntry pe = nextEntries.next(); - if (predicate.apply(pe)) { + if (predicate.test(pe)) { next = pe; } else { treePermission.skipped = true; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/Constraints.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/Constraints.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/Constraints.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/Constraints.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/Constraints.java (date 1635343030958) @@ -21,7 +21,6 @@ import javax.jcr.PropertyType; import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,13 +63,4 @@ } } - /** - * @deprecated use {@link #asPredicate(int, String)} instead (see OAK-8874) - */ - @SuppressWarnings("unchecked") - @Deprecated - public static com.google.common.base.Predicate valueConstraint(int type, String constraint) { - GuavaDeprecation.handleCall("OAK-8874"); - return (com.google.common.base.Predicate) asPredicate(type, constraint); - } } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/PathConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/PathConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/PathConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/PathConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/PathConstraint.java (date 1635343030986) @@ -22,12 +22,11 @@ import javax.jcr.Value; import org.apache.jackrabbit.oak.commons.PathUtils; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PathConstraint implements Predicate, com.google.common.base.Predicate { +public class PathConstraint implements Predicate { private static final Logger log = LoggerFactory.getLogger(PathConstraint.class); private final String requiredValue; @@ -64,16 +63,6 @@ } } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(@Nullable Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - @Override public String toString() { return '\'' + requiredValue + '\''; Index: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java (date 1635343031278) @@ -694,14 +694,6 @@ return thisBuilder(); } - /** - * @deprecated Use {@link #getNodeCachePathPredicate()} instead. - */ - @Deprecated - public Predicate getNodeCachePredicate() { - return input -> input != null && nodeCachePredicate.apply(Path.fromString(input)); - } - public T setNodeCachePathPredicate(Predicate p){ this.nodeCachePredicate = p; return thisBuilder(); Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java (date 1635343031180) @@ -53,7 +53,6 @@ import javax.management.openmbean.TabularType; import org.apache.jackrabbit.oak.commons.TimeDurationFormatter; -import org.apache.jackrabbit.oak.spi.GuavaDeprecation; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -107,17 +106,6 @@ return new ManagementOperation(name, statusMessage, task); } - /** - * @deprecated use {@link #newManagementOperation(String, Supplier, Callable)} instead - */ - @Deprecated public static ManagementOperation newManagementOperation( - @NotNull String name, - @NotNull com.google.common.base.Supplier statusMessage, - @NotNull Callable task) { - GuavaDeprecation.handleCall("OAK-8687"); - return new ManagementOperation(name, () -> statusMessage.get(), task); - } - /** * An operation that is already done with the given {@code value}. * Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/UuidPredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/UuidPredicate.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/UuidPredicate.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/UuidPredicate.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/UuidPredicate.java (date 1635343031046) @@ -26,7 +26,6 @@ import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Type; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.jetbrains.annotations.NotNull; @@ -36,7 +35,7 @@ * property and the value of that property matches any of the UUIDs that * has been passed to the predicate's constructor. */ -public class UuidPredicate implements Predicate, com.google.common.base.Predicate { +public class UuidPredicate implements Predicate { private final String[] uuids; /** @@ -66,13 +65,4 @@ return false; } - /** - * @deprecated use {@link #test(NodeState)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(NodeState node) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(node); - } } Index: oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/persistentcache/package-info.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/persistentcache/package-info.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/persistentcache/package-info.java --- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/persistentcache/package-info.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/persistentcache/package-info.java (date 1635343031253) @@ -15,8 +15,8 @@ * limitations under the License. */ @Internal(since = "1.0.0") -@Version("3.0.0") +@Version("3.1.0") package org.apache.jackrabbit.oak.segment.spi.persistence.persistentcache; import org.apache.jackrabbit.oak.commons.annotations.Internal; -import org.osgi.annotation.versioning.Version; \ No newline at end of file +import org.osgi.annotation.versioning.Version; Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java (date 1635343031200) @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.2.0") +@Version("2.0.0") package org.apache.jackrabbit.oak.spi.whiteboard; import org.osgi.annotation.versioning.Version; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/ReferenceConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/ReferenceConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/ReferenceConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/ReferenceConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/ReferenceConstraint.java (date 1635343030997) @@ -20,9 +20,7 @@ import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; - -public class ReferenceConstraint implements Predicate, com.google.common.base.Predicate { +public class ReferenceConstraint implements Predicate { private final String requiredTargetType; @@ -36,16 +34,6 @@ return true; } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - @Override public String toString() { return '\'' + requiredTargetType + '\''; Index: oak-lucene/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-lucene/pom.xml b/oak-lucene/pom.xml --- a/oak-lucene/pom.xml (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-lucene/pom.xml (date 1635343031241) @@ -128,7 +128,7 @@ oak-search;scope=compile|runtime;inline=true, lucene-*;inline=true, - oak-core-spi;inline="org/apache/jackrabbit/oak/cache/AbstractCacheStats.class|org/apache/jackrabbit/oak/cache/CacheStats.class" + oak-core-spi;inline="org/apache/jackrabbit/oak/cache/*.class" Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/StringConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/StringConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/StringConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/StringConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/StringConstraint.java (date 1635343031007) @@ -24,11 +24,10 @@ import javax.jcr.RepositoryException; import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class StringConstraint implements Predicate, com.google.common.base.Predicate { +public class StringConstraint implements Predicate { private static final Logger log = LoggerFactory.getLogger(StringConstraint.class); private final Pattern pattern; @@ -62,16 +61,6 @@ } } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - @Override public String toString() { return "'" + pattern + '\''; Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java (date 1635343031191) @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.2.0") +@Version("2.0.0") package org.apache.jackrabbit.oak.commons.jmx; import org.osgi.annotation.versioning.Version; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypePredicate.java (date 1635343031020) @@ -23,7 +23,6 @@ import com.google.common.collect.Iterables; import org.apache.jackrabbit.oak.api.Tree; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.apache.jackrabbit.oak.plugins.tree.TreeUtil; @@ -49,7 +48,7 @@ * * @since Oak 0.11 */ -public class TypePredicate implements Predicate, com.google.common.base.Predicate { +public class TypePredicate implements Predicate { @NotNull public static TypePredicate isOrderable(@NotNull NodeState root) { @@ -201,35 +200,6 @@ return false; } - // backwards compatibility, see OAK-8874 - - /** - * @deprecated use {@link #test(NodeState)} instead (see OAK-8874) - */ - @Deprecated - public boolean apply(@Nullable NodeState input) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(input); - } - - /** - * @deprecated use {@link #test(Tree)} instead (see OAK-8874) - */ - @Deprecated - public boolean apply(@Nullable Tree input) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(input); - } - - /** - * @deprecated use {@link #test(String, Set)} instead (see OAK-8874) - */ - @Deprecated - public boolean apply(String primary, Set mixins) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(primary, mixins); - } - //------------------------------------------------------------< Object >-- @Override Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NumericConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NumericConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NumericConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NumericConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NumericConstraint.java (date 1635343030975) @@ -23,12 +23,11 @@ import javax.jcr.RepositoryException; import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class NumericConstraint implements Predicate, com.google.common.base.Predicate { +public abstract class NumericConstraint implements Predicate { private static final Logger log = LoggerFactory.getLogger(NumericConstraint.class); private boolean invalid; @@ -107,16 +106,6 @@ } } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(@Nullable Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - protected abstract T getValue(Value value) throws RepositoryException; protected abstract boolean less(T val, T bound); Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/PropertyPredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/PropertyPredicate.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/PropertyPredicate.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/PropertyPredicate.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/PropertyPredicate.java (date 1635343031036) @@ -24,7 +24,6 @@ import java.util.function.Predicate; import org.apache.jackrabbit.oak.api.PropertyState; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.jetbrains.annotations.NotNull; @@ -33,7 +32,7 @@ * the node has a property of the given {@code name} and the given * {@code propertyPredicate} holds on that property. */ -public class PropertyPredicate implements Predicate, com.google.common.base.Predicate { +public class PropertyPredicate implements Predicate { private final String name; private final Predicate propertyPredicate; @@ -53,13 +52,4 @@ return property != null && propertyPredicate.test(property); } - /** - * @deprecated use {@link #test(NodeState)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(NodeState node) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(node); - } } Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java (date 1635343031212) @@ -26,7 +26,6 @@ import javax.management.ObjectName; import org.apache.jackrabbit.oak.commons.jmx.JmxUtil; -import org.apache.jackrabbit.oak.spi.GuavaDeprecation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -170,17 +169,6 @@ } } - - /** - * @deprecated use {@link #getServices(Whiteboard, Class, java.util.function.Predicate)} instead - */ - @NotNull - @Deprecated public static List getServices(@NotNull Whiteboard wb, @NotNull Class type, - @Nullable com.google.common.base.Predicate predicate) { - GuavaDeprecation.handleCall("OAK-8685"); - return getServices(wb, type, (java.util.function.Predicate) (input) -> predicate.apply(input)); - } - /** * Returns the one of the currently available services from the whiteboard of the tracked type. If {@code predicate} is * not {@code null} only a service that match the predicate is returned. @@ -208,14 +196,4 @@ } - /** - * @deprecated use {@link #getService(Whiteboard, Class, Predicate)} instead - */ - @Nullable - @Deprecated - public static T getService(@NotNull Whiteboard wb, @NotNull Class type, - @Nullable com.google.common.base.Predicate predicate) { - GuavaDeprecation.handleCall("OAK-8685"); - return getService(wb, type, (Predicate) (input) -> predicate.apply(input)); - } } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NameConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NameConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NameConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NameConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/NameConstraint.java (date 1635343030966) @@ -21,12 +21,11 @@ import javax.jcr.RepositoryException; import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NameConstraint implements Predicate, com.google.common.base.Predicate { +public class NameConstraint implements Predicate { private static final Logger log = LoggerFactory.getLogger(NameConstraint.class); private final String requiredValue; @@ -46,16 +45,6 @@ } } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Deprecated - @Override - public boolean apply(@Nullable Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - @Override public String toString() { return '\'' + requiredValue + '\''; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/BooleanConstraint.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/BooleanConstraint.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/BooleanConstraint.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/BooleanConstraint.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/constraint/BooleanConstraint.java (date 1635343030950) @@ -21,11 +21,10 @@ import javax.jcr.RepositoryException; import javax.jcr.Value; -import org.apache.jackrabbit.oak.core.GuavaDeprecation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BooleanConstraint implements Predicate, com.google.common.base.Predicate { +public class BooleanConstraint implements Predicate { private static final Logger log = LoggerFactory.getLogger(BooleanConstraint.class); private final Boolean requiredValue; @@ -54,16 +53,6 @@ } } - /** - * @deprecated use {@link #test(Value)} instead (see OAK-8874) - */ - @Override - @Deprecated - public boolean apply(Value value) { - GuavaDeprecation.handleCall("OAK-8874"); - return test(value); - } - @Override public String toString() { return "'" + requiredValue + '\''; Index: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java --- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java (date 1635343031167) @@ -17,9 +17,7 @@ package org.apache.jackrabbit.oak.cache; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -42,7 +40,6 @@ import com.google.common.util.concurrent.UncheckedExecutionException; import org.apache.jackrabbit.oak.commons.annotations.Internal; -import org.apache.jackrabbit.oak.spi.GuavaDeprecation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -87,11 +84,6 @@ private static final AtomicInteger NEXT_CACHE_ID = new AtomicInteger(); private static final boolean PUT_HOT = Boolean.parseBoolean(System.getProperty("oak.cacheLIRS.putHot", "true")); - // see OAK-8702 - private static final List ALLOWED_USERS = Collections.unmodifiableList( - Arrays.asList(new String[] { "org.apache.jackrabbit.oak.plugins.blob.", "org.apache.jackrabbit.oak.plugins.document.", - "org.apache.jackrabbit.oak.segment.", "org.apache.jackrabbit.oak.plugins.segment." })); - /** * Listener for items that are evicted from the cache. The listener * is called for both, resident and non-resident items. In the @@ -180,7 +172,6 @@ CacheLIRS(Weigher weigher, long maxMemory, int averageMemory, int segmentCount, int stackMoveDistance, final CacheLoader loader, EvictionCallback evicted, String module) { - GuavaDeprecation.handleCall("OAK-8702", CacheLIRS.class.getName(), ALLOWED_USERS); LOG.debug("Init #{}, module={}, maxMemory={}, segmentCount={}, stackMoveDistance={}", cacheId, module, maxMemory, segmentCount, segmentCount); this.weigher = weigher; @@ -790,7 +781,6 @@ * @param averageMemory the average memory usage of an object * @param stackMoveDistance the number of other entries to be moved to * the top of the stack before moving an entry to the top - * @param evicted the eviction listener of this segment or {@code null} if none. */ Segment(CacheLIRS cache, long maxMemory, int averageMemory, int stackMoveDistance) { this.cache = cache; Index: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionEntryProviderImpl.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionEntryProviderImpl.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionEntryProviderImpl.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionEntryProviderImpl.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionEntryProviderImpl.java (date 1635343031089) @@ -113,7 +113,7 @@ while (next == null) { if (nextEntries.hasNext()) { PermissionEntry pe = nextEntries.next(); - if (predicate.apply(pe)) { + if (predicate.test(pe)) { next = pe; } } else { Index: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicateTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicateTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicateTest.java --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicateTest.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicateTest.java (date 1635343031120) @@ -69,11 +69,11 @@ when(pattern.matches()).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(); verifyNoMoreInteractions(pattern); @@ -88,10 +88,10 @@ when(pattern.matches(anyString())).thenReturn(false); when(pattern.matches(anyString(), anyBoolean())).thenReturn(false); - assertFalse(pred.apply(null)); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(null)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verify(pattern, times(2)).matches(parentPath, false); @@ -106,11 +106,11 @@ when(pattern.matches(anyString())).thenReturn(true); when(pattern.matches(anyString(), anyBoolean())).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -125,9 +125,9 @@ when(pattern.matches(parentPath)).thenReturn(false); when(pattern.matches(parentPath, false)).thenReturn(false); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -142,9 +142,9 @@ when(pattern.matches(parentPath)).thenReturn(true); when(pattern.matches(parentPath, false)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verify(pattern, times(2)).matches(parentPath, false); @@ -160,9 +160,9 @@ when(pattern.matches(anyString())).thenReturn(false); when(pattern.matches(anyString(), anyBoolean())).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -176,11 +176,11 @@ when(pattern.matches(anyString())).thenReturn(true); when(pattern.matches(anyString(), anyBoolean())).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -194,9 +194,9 @@ when(pattern.matches(path)).thenReturn(true); when(pattern.matches(parentPath)).thenReturn(false); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -211,9 +211,9 @@ when(pattern.matches(parentPath)).thenReturn(true); when(pattern.matches(parentPath, false)).thenReturn(true); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path); verifyNoMoreInteractions(pattern); @@ -227,9 +227,9 @@ // pattern neither matches path nor parent path when(pattern.matches(anyString(), anyBoolean())).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verify(pattern, times(2)).matches(parentPath, false); @@ -243,10 +243,10 @@ // pattern matches path and parent path when(pattern.matches(anyString(), anyBoolean())).thenReturn(true); - assertFalse(pred.apply(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertFalse(pred.test(null)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -259,9 +259,9 @@ // pattern only matches path when(pattern.matches(path, true)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -274,9 +274,9 @@ // pattern only matches parent path when(pattern.matches(parentPath, false)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verify(pattern, times(2)).matches(parentPath, false); @@ -291,9 +291,9 @@ // pattern neither matches path nor parent path when(pattern.matches(anyString(), anyBoolean())).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -306,11 +306,11 @@ // pattern matches path and parent path when(pattern.matches(anyString(), anyBoolean())).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -323,9 +323,9 @@ // pattern only matches path when(pattern.matches(path, true)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -339,9 +339,9 @@ when(pattern.matches(path, true)).thenReturn(false); when(pattern.matches(parentPath, false)).thenReturn(true); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(3)).matches(path, true); verifyNoMoreInteractions(pattern); @@ -362,38 +362,38 @@ when(pattern.matches(parent, ps)).thenReturn(false); when(pattern.matches(parent, null)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path and parent path when(pattern.matches(tree, ps)).thenReturn(true); when(pattern.matches(parent, ps)).thenReturn(true); when(pattern.matches(parent, null)).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); // pattern only matches path when(pattern.matches(tree, ps)).thenReturn(true); when(pattern.matches(parent, ps)).thenReturn(false); when(pattern.matches(parent, null)).thenReturn(false); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); // pattern only matches parent path when(pattern.matches(tree, ps)).thenReturn(false); when(pattern.matches(parent, ps)).thenReturn(true); when(pattern.matches(parent, null)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(12)).matches(tree, ps); verify(pattern, times(4)).matches(parent, null); @@ -415,38 +415,38 @@ when(pattern.matches(parent, ps)).thenReturn(false); when(pattern.matches(parent, null)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path and parent path when(pattern.matches(tree, ps)).thenReturn(true); when(pattern.matches(parent, ps)).thenReturn(true); when(pattern.matches(parent, null)).thenReturn(true); - assertFalse(pred.apply(null)); + assertFalse(pred.test(null)); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); // pattern only matches path when(pattern.matches(tree, ps)).thenReturn(true); when(pattern.matches(parent, ps)).thenReturn(false); when(pattern.matches(parent, null)).thenReturn(false); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); // pattern only matches parent path when(pattern.matches(tree, ps)).thenReturn(false); when(pattern.matches(parent, ps)).thenReturn(true); when(pattern.matches(parent, null)).thenReturn(true); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); verify(pattern, times(12)).matches(tree, ps); verify(pattern, never()).matches(parent, ps); @@ -461,16 +461,16 @@ // pattern doesn't match path when(pattern.matches(PathUtils.ROOT_PATH)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path when(pattern.matches(PathUtils.ROOT_PATH)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(6)).matches(PathUtils.ROOT_PATH); } @@ -483,16 +483,16 @@ // pattern doesn't match path when(pattern.matches(PathUtils.ROOT_PATH)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path when(pattern.matches(PathUtils.ROOT_PATH)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(pattern, times(6)).matches(PathUtils.ROOT_PATH); } @@ -508,16 +508,16 @@ // pattern doesn't match path when(pattern.matches(tree, null)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path when(pattern.matches(tree, null)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(tree, never()).getParent(); verify(pattern, times(6)).matches(tree, null); @@ -534,18 +534,18 @@ // pattern doesn't match path when(pattern.matches(tree, null)).thenReturn(false); - assertFalse(pred.apply(entry)); - assertFalse(pred.apply(entry, true)); - assertFalse(pred.apply(entry, false)); + assertFalse(pred.test(entry)); + assertFalse(pred.test(entry, true)); + assertFalse(pred.test(entry, false)); // pattern matches path when(pattern.matches(tree, null)).thenReturn(true); - assertTrue(pred.apply(entry)); - assertTrue(pred.apply(entry, true)); - assertTrue(pred.apply(entry, false)); + assertTrue(pred.test(entry)); + assertTrue(pred.test(entry, true)); + assertTrue(pred.test(entry, false)); verify(tree, never()).getParent(); verify(pattern, times(6)).matches(tree, null); } -} \ No newline at end of file +} Index: oak-segment-tar/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-segment-tar/pom.xml b/oak-segment-tar/pom.xml --- a/oak-segment-tar/pom.xml (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-segment-tar/pom.xml (date 1635343031262) @@ -53,7 +53,8 @@ netty-*, - concurrentlinkedhashmap-lru + concurrentlinkedhashmap-lru, + oak-core-spi;inline="org/apache/jackrabbit/oak/cache/*.class" ${guava.osgi.import}, Index: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/FilteringIndexStoreStrategyTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/FilteringIndexStoreStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/FilteringIndexStoreStrategyTest.java new file mode 100644 --- /dev/null (date 1635343031098) +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/FilteringIndexStoreStrategyTest.java (date 1635343031098) @@ -0,0 +1,66 @@ +package org.apache.jackrabbit.oak.plugins.index.property.strategy; + +import com.google.common.base.Predicate; +import com.google.common.base.Supplier; +import org.apache.jackrabbit.oak.api.CommitFailedException; +import org.apache.jackrabbit.oak.spi.state.NodeBuilder; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collections; +import java.util.Set; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class FilteringIndexStoreStrategyTest { + + private IndexStoreStrategy strategy; + private Predicate filter; + private FilteringIndexStoreStrategy filteringIndexStoreStrategy; + + @Before + public void setUp() throws Exception { + strategy = mock(IndexStoreStrategy.class); + filter = mock(Predicate.class); + } + + @Test(expected = CommitFailedException.class) + public void testUpdateThrowsExceptionWhenPathMatchesTheFilterButIndexIsReadOnly() throws CommitFailedException { + filteringIndexStoreStrategy = new FilteringIndexStoreStrategy(strategy, filter, true); + String path = "/container/content"; + when(filter.apply(path)).thenReturn(true); + + filteringIndexStoreStrategy.update(null, path, null, null, null, null); + } + + @Test + public void testUpdateSkipStrategyUpdateWhenPathDoesNotMatchTheFilter() throws CommitFailedException { + filteringIndexStoreStrategy = new FilteringIndexStoreStrategy(strategy, filter, false); + String path = "/content"; + when(filter.apply(path)).thenReturn(false); + + filteringIndexStoreStrategy.update(null, path, null, null, null, null); + + verify(strategy, never()).update(any(), any(), any(), any(), any(), any()); + } + + @Test + public void testUpdateUpdatesStrategyWhenPathMatchesTheFilterAndIndexIsNotReadOnly() throws CommitFailedException { + filteringIndexStoreStrategy = new FilteringIndexStoreStrategy(strategy, filter, false); + String path = "/container/content"; + String indexName = "someIndex"; + Supplier index = mock(Supplier.class); + NodeBuilder indexMeta = mock(NodeBuilder.class); + Set beforeKeys = Collections.singleton("beforeKey"); + Set afterKeys = Collections.singleton("afterKey"); + when(filter.apply(path)).thenReturn(true); + + filteringIndexStoreStrategy.update(index, path, indexName, indexMeta, beforeKeys, afterKeys); + + verify(strategy).update(index, path, indexName, indexMeta, beforeKeys, afterKeys); + } +} Index: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicate.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicate.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicate.java --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicate.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/EntryPredicate.java (date 1635343031077) @@ -16,13 +16,14 @@ */ package org.apache.jackrabbit.oak.security.authorization.permission; -import com.google.common.base.Predicate; import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Tree; import org.apache.jackrabbit.oak.commons.PathUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.function.Predicate; + /** * Predicate used to evaluation if a given {@code PermissionEntry} matches * the specified tree, property or path. @@ -32,11 +33,11 @@ @Nullable String getPath(); - default boolean apply(@Nullable PermissionEntry entry) { - return entry != null && apply(entry, true); + default boolean test(@Nullable PermissionEntry entry) { + return entry != null && test(entry, true); } - boolean apply(@NotNull PermissionEntry entry, boolean respectParent); + boolean test(@NotNull PermissionEntry entry, boolean respectParent); static EntryPredicate create() { return new EntryPredicate() { @@ -47,7 +48,7 @@ } @Override - public boolean apply(@NotNull PermissionEntry entry, boolean respectParent) { + public boolean test(@NotNull PermissionEntry entry, boolean respectParent) { return entry.matches(); } }; @@ -64,7 +65,7 @@ } @Override - public boolean apply(@NotNull PermissionEntry entry, boolean respectParent) { + public boolean test(@NotNull PermissionEntry entry, boolean respectParent) { respectParent &= rp; return entry.matches(tree, property) || (respectParent && entry.matches(parent, null)); } @@ -82,7 +83,7 @@ } @Override - public boolean apply(@NotNull PermissionEntry entry, boolean respectParent) { + public boolean test(@NotNull PermissionEntry entry, boolean respectParent) { respectParent &= rp; return entry.matches(path, isProperty) || (respectParent && entry.matches(parentPath, false)); } @@ -100,7 +101,7 @@ } @Override - public boolean apply(@NotNull PermissionEntry entry, boolean respectParent) { + public boolean test(@NotNull PermissionEntry entry, boolean respectParent) { respectParent &= rp; return entry.matches(path) || (respectParent && entry.matches(parentPath, false)); } Index: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/package-info.java (date 1635343030901) @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.6.0") +@Version("2.0.0") package org.apache.jackrabbit.oak.commons; import org.osgi.annotation.versioning.Version; Index: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/package-info.java (date 1635343030866) @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -@Version("1.1.0") +@Version("2.0.0") package org.apache.jackrabbit.oak.commons.io; -import org.osgi.annotation.versioning.Version; \ No newline at end of file +import org.osgi.annotation.versioning.Version; Index: oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java --- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileLineDifferenceIteratorTest.java (date 1635343030936) @@ -136,18 +136,6 @@ assertTransformed("", "a:4, b:1", asList("a:4", "b:1")); } - @Test - public void testDiffTransformDeprecated() throws IOException { - assertTransformedDeprecated("a:x,b:y", "a:1,b:2,c:3,e:4,h", asList("c:3", "e:4", "h")); - assertTransformedDeprecated("a,b,d,e", "a,b,c", asList("c")); - assertTransformedDeprecated("a:1,b:2,d:3,e:4,f:5", "a:z,b:y,c:x,f:w", asList("c:x")); - assertTransformedDeprecated("a,b,d,e,f", "a,b,c,f,h", asList("c", "h")); - assertTransformedDeprecated("3:1,7:6", "2:0,3:6,5:3,9:1", asList("2:0", "5:3", "9:1")); - assertTransformedDeprecated("", "", Collections. emptyList()); - assertTransformedDeprecated("", "a, b", asList("a", "b")); - assertTransformedDeprecated("", "a:4, b:1", asList("a:4", "b:1")); - } - private static List getLineBreakStrings() { return Lists.newArrayList("ab\nc\r", "ab\\z", "a\\\\z\nc", "/a", "/a/b\nc", "/a/b\rd", "/a/b\r\ne", "/a/c"); @@ -206,18 +194,4 @@ assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff)); } - private static void assertTransformedDeprecated(String marked, String all, List diff) throws IOException { - Iterator itr = new org.apache.jackrabbit.oak.commons.FileIOUtils.FileLineDifferenceIterator(lineItr(marked), lineItr(all), - new com.google.common.base.Function() { - @Nullable @Override - public String apply(@Nullable String input) { - if (input != null) { - return input.split(":")[0]; - } - return null; - } - }); - - assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff)); - } } Index: oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java --- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/FileIOUtilsTest.java (date 1635343030926) @@ -44,7 +44,6 @@ import com.google.common.collect.Sets; import com.google.common.primitives.Longs; import org.apache.commons.io.FileUtils; -import org.apache.jackrabbit.oak.commons.FileIOUtils.BurnOnCloseFileIterator; import org.jetbrains.annotations.Nullable; import org.junit.Assert; import org.junit.Rule; @@ -104,23 +103,6 @@ } }, null, null); assertEquals(added.size(), count); - - Set retrieved = readStringsAsSet(new FileInputStream(f), false); - assertEquals(actual, retrieved); - } - - @Test - public void writeCustomReadOrgStringsDeprecated() throws Exception { - Set added = newHashSet("a-", "z-", "e-", "b-"); - Set actual = newHashSet("a", "z", "e", "b"); - - File f = folder.newFile(); - int count = writeStrings(added.iterator(), f, false, new Function() { - @Nullable @Override public String apply(@Nullable String input) { - return Splitter.on("-").trimResults().omitEmptyStrings().splitToList(input).get(0); - } - }, null, null); - assertEquals(added.size(), count); Set retrieved = readStringsAsSet(new FileInputStream(f), false); assertEquals(actual, retrieved); @@ -358,18 +340,6 @@ org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator iterator = org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString())); - assertEquals(added, Sets.newHashSet(iterator)); - assertTrue(f.exists()); - } - - @Test - public void deprecatedfileIteratorTest() throws Exception { - Set added = newHashSet("a", "z", "e", "b"); - File f = assertWrite(added.iterator(), false, added.size()); - - BurnOnCloseFileIterator iterator = - BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString())); - assertEquals(added, Sets.newHashSet(iterator)); assertTrue(f.exists()); } @@ -382,18 +352,6 @@ org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator iterator = org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString()), f); - assertEquals(added, Sets.newHashSet(iterator)); - assertTrue(!f.exists()); - } - - @Test - public void deprecatedFileIteratorBurnTest() throws Exception { - Set added = newHashSet("a", "z", "e", "b"); - File f = assertWrite(added.iterator(), false, added.size()); - - BurnOnCloseFileIterator iterator = - BurnOnCloseFileIterator.wrap(FileUtils.lineIterator(f, UTF_8.toString()), f); - assertEquals(added, Sets.newHashSet(iterator)); assertTrue(!f.exists()); } @@ -406,18 +364,6 @@ org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator iterator = new org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator( FileUtils.lineIterator(f, UTF_8.toString()), f, (input) -> unescapeLineBreaks(input)); - assertEquals(added, Sets.newHashSet(iterator)); - assertTrue(!f.exists()); - } - - @Test - public void deprecatedFileIteratorLineBreakTest() throws IOException { - Set added = newHashSet(getLineBreakStrings()); - File f = assertWrite(added.iterator(), true, added.size()); - - BurnOnCloseFileIterator iterator = new BurnOnCloseFileIterator(FileUtils.lineIterator(f, UTF_8.toString()), - f, (input) -> unescapeLineBreaks(input)); - assertEquals(added, Sets.newHashSet(iterator)); assertTrue(!f.exists()); } @@ -433,21 +379,6 @@ org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator iterator = new org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator( FileUtils.lineIterator(f, UTF_8.toString()), f, (input) -> unescapeLineBreaks(input)); - assertEquals(added, Sets.newHashSet(iterator)); - assertTrue(!f.exists()); - } - - @Test - public void deprecatedFileIteratorRandomizedTest() throws Exception { - Set added = newHashSet(); - for (int i = 0; i < 100; i++) { - added.add(getRandomTestString()); - } - File f = assertWrite(added.iterator(), true, added.size()); - - BurnOnCloseFileIterator iterator = new BurnOnCloseFileIterator(FileUtils.lineIterator(f, UTF_8.toString()), - f, (input) -> unescapeLineBreaks(input)); - assertEquals(added, Sets.newHashSet(iterator)); assertTrue(!f.exists()); } Index: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/FileIOUtils.java (date 1635343030881) @@ -18,7 +18,6 @@ import java.io.BufferedReader; import java.io.BufferedWriter; -import java.io.Closeable; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -33,15 +32,10 @@ import com.google.common.base.Charsets; import com.google.common.base.Function; import com.google.common.base.Strings; -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.Iterators; -import com.google.common.collect.PeekingIterator; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.LineIterator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import static com.google.common.base.Charsets.UTF_8; import static com.google.common.collect.Sets.newHashSet; @@ -54,7 +48,6 @@ import static org.apache.commons.io.FileUtils.forceDelete; import static org.apache.commons.io.IOUtils.closeQuietly; import static org.apache.commons.io.IOUtils.copyLarge; -import static org.apache.commons.io.LineIterator.closeQuietly; import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.escapeLineBreak; import static org.apache.jackrabbit.oak.commons.sort.EscapeUtils.unescapeLineBreaks; import static org.apache.jackrabbit.oak.commons.sort.ExternalSort.mergeSortedFiles; @@ -74,15 +67,6 @@ } }; - /** - * @deprecated use {@link java.util.function.Function#identity()} instead - */ - @Deprecated public final static Function passThruTransformer = new Function() { - @Nullable @Override public String apply(@Nullable String input) { - return input; - } - }; - /** * Sorts the given file externally using the {@link #lexComparator} and removes duplicates. * @@ -270,16 +254,6 @@ return count; } - /** - * @deprecated use {@link #writeStrings(Iterator, File, boolean, java.util.function.Function, Logger, String)} instead - */ - @Deprecated public static int writeStrings(Iterator iterator, File f, boolean escape, - @NotNull Function transformer, @Nullable Logger logger, @Nullable String message) throws IOException { - GuavaDeprecation.handleCall("OAK-8677"); - java.util.function.Function tr2 = (s) -> transformer.apply(s); - return writeStrings(iterator, f, escape, tr2, logger, message); - } - /** * Reads strings from the given stream into a set and optionally unescaping for line breaks. * @@ -366,170 +340,4 @@ } } - /** - * FileLineDifferenceIterator class which iterates over the difference of 2 files line by line. - * - * If there is a scope for lines in the files containing line break characters it should be - * ensured that both the files are written with - * {@link #writeAsLine(BufferedWriter, String, boolean)} with true to escape line break - * characters. - * - * @deprecated use {@link org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator} instead - */ - @Deprecated public static class FileLineDifferenceIterator extends AbstractIterator implements Closeable { - private final PeekingIterator peekMarked; - private final LineIterator marked; - private final LineIterator all; - private Function transformer = new Function() { - @Override - public String apply(String input) { - return input; - } - }; - - public FileLineDifferenceIterator(LineIterator marked, LineIterator available) throws IOException { - this(marked, available, null); - } - - public FileLineDifferenceIterator(File marked, File available, - @Nullable Function transformer) throws IOException { - this(FileUtils.lineIterator(marked, UTF_8.toString()), - FileUtils.lineIterator(available, UTF_8.toString()), transformer); - } - - public FileLineDifferenceIterator(LineIterator marked, LineIterator available, - @Nullable Function transformer) throws IOException { - GuavaDeprecation.handleCall("OAK-8676"); - this.marked = marked; - this.peekMarked = Iterators.peekingIterator(marked); - this.all = available; - if (transformer != null) { - this.transformer = transformer; - } - } - - @Override - protected String computeNext() { - String diff = computeNextDiff(); - if (diff == null) { - close(); - return endOfData(); - } - return diff; - } - - @Override - public void close() { - LineIterator.closeQuietly(marked); - LineIterator.closeQuietly(all); - } - - private String computeNextDiff() { - if (!all.hasNext()) { - return null; - } - - //Marked finish the rest of all are part of diff - if (!peekMarked.hasNext()) { - return all.next(); - } - - String diff = null; - while (all.hasNext() && diff == null) { - diff = all.next(); - while (peekMarked.hasNext()) { - String marked = peekMarked.peek(); - int comparisonResult = transformer.apply(diff).compareTo(transformer.apply((marked))); - if (comparisonResult > 0) { - //Extra entries in marked. Ignore them and move on - peekMarked.next(); - } else if (comparisonResult == 0) { - //Matching entry found in marked move past it. Not a - //dif candidate - peekMarked.next(); - diff = null; - break; - } else { - //This entry is not found in marked entries - //hence part of diff - return diff; - } - } - } - return diff; - } - } - - /** - * Implements a {@link java.io.Closeable} wrapper over a {@link LineIterator}. - * Also has a transformer to transform the output. If the underlying file is - * provide then it deletes the file on {@link #close()}. - * - * If there is a scope for lines in the file containing line break characters it should be - * ensured that the files is written with - * {@link #writeAsLine(BufferedWriter, String, boolean)} with true to escape line break - * characters and should be properly unescaped on read. - * A custom transformer can also be provided to unescape. - * - * @param the type of elements in the iterator - * @deprecated use {@link org.apache.jackrabbit.oak.commons.io.BurnOnCloseFileIterator} instead - */ - @Deprecated public static class BurnOnCloseFileIterator extends AbstractIterator implements Closeable { - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final LineIterator iterator; - private final Function transformer; - private final File backingFile; - - public BurnOnCloseFileIterator(LineIterator iterator, Function transformer) { - this(iterator, null, transformer); - } - - public BurnOnCloseFileIterator(LineIterator iterator, File backingFile, - Function transformer) { - GuavaDeprecation.handleCall("OAK-8666"); - this.iterator = iterator; - this.transformer = transformer; - this.backingFile = backingFile; - } - - @Override - protected T computeNext() { - if (iterator.hasNext()) { - return transformer.apply(iterator.next()); - } - - try { - close(); - } catch (IOException e) { - log.warn("Error closing iterator", e); - } - return endOfData(); - } - - @Override - public void close() throws IOException { - closeQuietly(iterator); - if (backingFile != null && backingFile.exists()) { - forceDelete(backingFile); - } - } - - public static BurnOnCloseFileIterator wrap(LineIterator iter) { - return new BurnOnCloseFileIterator(iter, new Function() { - public String apply(String s) { - return s; - } - }); - } - - public static BurnOnCloseFileIterator wrap(LineIterator iter, File backingFile) { - return new BurnOnCloseFileIterator(iter, backingFile, - new Function() { - public String apply(String s) { - return s; - } - }); - } - } } Index: oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java --- a/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/MarkSweepGarbageCollector.java (date 1635343030846) @@ -426,7 +426,7 @@ fs.getMarkedRefs(), fs.getAvailableRefs(), transformer); - int candidates = FileIOUtils.writeStrings(iter, fs.getGcCandidates(), true); + int candidates = writeStrings(iter, fs.getGcCandidates(), true); LOG.debug("Found candidates - " + candidates); LOG.debug("Ending difference phase of the garbage collector"); @@ -983,7 +983,7 @@ public int filter(GarbageCollectableBlobStore blobStore, FileLineDifferenceIterator iter, GarbageCollectorFileState fs) throws IOException { // Write the original candidates - FileIOUtils.writeStrings(iter, fs.getGcCandidates(), true); + writeStrings(iter, fs.getGcCandidates(), true); // Filter the ids actively deleted BlobTrackingStore store = (BlobTrackingStore) blobStore; @@ -995,7 +995,7 @@ Iterator filter = tracker.getDeleteTracker().filter(candTemp); try { - return FileIOUtils.writeStrings(filter, fs.getGcCandidates(), true); + return writeStrings(filter, fs.getGcCandidates(), true); } finally { if (filter != null && filter instanceof FileLineDifferenceIterator) { ((FileLineDifferenceIterator) filter).close(); @@ -1047,7 +1047,7 @@ Iterator idsIter = null; try { idsIter = blobStore.getAllChunkIds(0); - blobsCount = FileIOUtils.writeStrings(idsIter, fs.getAvailableRefs(), true, LOG, "Retrieved blobs - "); + blobsCount = writeStrings(idsIter, fs.getAvailableRefs(), true, LOG, "Retrieved blobs - "); // sort the file sort(fs.getAvailableRefs()); @@ -1098,7 +1098,7 @@ new FileLineDifferenceIterator(availAfterGC, fs.getMarkedRefs(), transformer); File consistencyCandidatesAfterGC = new File(fs.getGcCandidates().getParent(), "consistencyCandidatesAfterGC"); // Write the original candidates - int candidates = FileIOUtils.writeStrings(iter, consistencyCandidatesAfterGC, true); + int candidates = writeStrings(iter, consistencyCandidatesAfterGC, true); LOG.trace("Ending difference phase of the consistency check"); LOG.warn("Consistency check found [{}] missing blobs", candidates); @@ -1141,7 +1141,7 @@ public int filter(GarbageCollectableBlobStore blobStore, FileLineDifferenceIterator iter, GarbageCollectorFileState fs) throws IOException { - return FileIOUtils.writeStrings(iter, fs.getGcCandidates(), true); + return writeStrings(iter, fs.getGcCandidates(), true); } } Index: oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java --- a/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/test/java/org/apache/jackrabbit/oak/commons/io/LazyInputStreamTest.java (date 1635343030910) @@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.commons.io; -import static com.google.common.io.Files.asByteSource; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; @@ -30,16 +29,11 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; -import java.util.Locale; import java.util.function.Supplier; -import org.apache.jackrabbit.oak.commons.GuavaDeprecation; -import org.apache.jackrabbit.oak.commons.junit.LogCustomizer; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.slf4j.event.Level; /** * Tests the LazyInputStream class. @@ -106,82 +100,6 @@ in = new LazyInputStream(asInputStreamSupplier(file)); assertEquals(0, in.read()); assertEquals(-1, in.read()); - - in.close(); - - file.delete(); - } - - @Test - public void testDeprecatedLogs() throws IOException { - for (Level level : new Level[] { Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR }) { - LogCustomizer lc = LogCustomizer.forLogger(GuavaDeprecation.class).enable(level).create(); - lc.starting(); - String defaultLevel = GuavaDeprecation.setLogLevel(level.toString().toLowerCase(Locale.ENGLISH)); - try { - testDeprecated(); - assertEquals(7, lc.getLogs().size()); - } finally { - lc.finished(); - GuavaDeprecation.setLogLevel(defaultLevel); - } - } - } - - private void testDeprecated() throws IOException { - createFile(); - - // test open / close (without reading) - LazyInputStream in = new LazyInputStream(asByteSource(file)); - in.close(); - - // test reading too much and closing too much - in = new LazyInputStream(asByteSource(file)); - assertEquals(0, in.read()); - assertEquals(-1, in.read()); - assertEquals(-1, in.read()); - assertEquals(-1, in.read()); - in.close(); - in.close(); - in.close(); - - // test markSupported, mark, and reset - in = new LazyInputStream(asByteSource(file)); - assertFalse(in.markSupported()); - in.mark(1); - assertEquals(0, in.read()); - try { - in.reset(); - fail(); - } catch (IOException e) { - // expected - } - assertEquals(-1, in.read()); - in.close(); - - // test read(byte[]) - in = new LazyInputStream(asByteSource(file)); - byte[] test = new byte[2]; - assertEquals(1, in.read(test)); - in.close(); - - // test read(byte[],int,int) - in = new LazyInputStream(asByteSource(file)); - assertEquals(1, in.read(test, 0, 2)); - in.close(); - - // test skip - in = new LazyInputStream(asByteSource(file)); - assertEquals(2, in.skip(2)); - assertEquals(-1, in.read(test)); - in.close(); - - createFile(); - - // test that the file is closed after reading the last byte - in = new LazyInputStream(asByteSource(file)); - assertEquals(0, in.read()); - assertEquals(-1, in.read()); in.close(); Index: oak-core/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-core/pom.xml b/oak-core/pom.xml --- a/oak-core/pom.xml (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-core/pom.xml (date 1635343031130) @@ -49,6 +49,9 @@ com.codahale.metrics*;version="[3.1, 4)";resolution:=optional, * + + oak-core-spi;inline="org/apache/jackrabbit/oak/cache/*.class" + org.apache.jackrabbit.oak, org.apache.jackrabbit.oak.namepath.impl, Index: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java --- a/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/io/LazyInputStream.java (date 1635343030861) @@ -26,7 +26,6 @@ import com.google.common.io.ByteSource; import org.apache.commons.io.input.ClosedInputStream; -import org.apache.jackrabbit.oak.commons.GuavaDeprecation; /** * * This input stream delays accessing the {@link InputStream} until the first byte is read @@ -44,16 +43,6 @@ this.inputStreamSupplier = inputStreamSupplier; } - /** - * @deprecated Use {@link #LazyInputStream(Supplier)} instead - */ - @Deprecated public LazyInputStream(ByteSource byteSource) { - super(null); - this.byteSource = byteSource; - this.inputStreamSupplier = null; - GuavaDeprecation.handleCall("OAK-8661"); - } - @Override public int read() throws IOException { ensureOpen(); Index: oak-store-document/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-store-document/pom.xml b/oak-store-document/pom.xml --- a/oak-store-document/pom.xml (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-store-document/pom.xml (date 1635343031298) @@ -48,11 +48,14 @@ org.bson*;version="[3.8, 4)";resolution:=optional, * + + oak-core-spi;inline="org/apache/jackrabbit/oak/cache/*.class", + quartz;inline=org/quartz/CronExpression*|org/quartz/ValueSet* + org.apache.jackrabbit.oak.plugins.document.spi, org.apache.jackrabbit.oak.plugins.document.spi.lease - quartz;inline=org/quartz/CronExpression*|org/quartz/ValueSet* Index: oak-blob-plugins/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/oak-blob-plugins/pom.xml b/oak-blob-plugins/pom.xml --- a/oak-blob-plugins/pom.xml (revision ca5367d8279ab72b8b839bc751ec4f817b4dc45f) +++ b/oak-blob-plugins/pom.xml (date 1635343030854) @@ -39,6 +39,9 @@ ${guava.osgi.import}, * + + oak-core-spi;inline="org/apache/jackrabbit/oak/cache/*.class" + org.apache.jackrabbit.oak.plugins.blob, org.apache.jackrabbit.oak.plugins.blob.datastore,