SLING-11358 : Fix redundant constructs
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
index 84673c8..ec6ee33 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
@@ -19,7 +19,6 @@
 package org.apache.sling.jcr.resource.internal;
 
 import java.io.Closeable;
-import java.io.IOException;
 import java.util.Set;
 
 import javax.jcr.RepositoryException;
@@ -64,7 +63,7 @@
      * Close session.
      */
     @Override
-    public void close() throws IOException {
+    public void close() {
         this.session.logout();
     }
 
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
index 9b940da..de06723 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
@@ -25,7 +25,6 @@
 import static javax.jcr.observation.Event.PROPERTY_REMOVED;
 
 import java.io.Closeable;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -81,7 +80,7 @@
      * Dispose this listener.
      */
     @Override
-    public void close() throws IOException {
+    public void close() {
         // unregister from observations
         this.baseConfig.unregister(this);
     }
@@ -91,9 +90,9 @@
      */
     @Override
     public void onEvent(final EventIterator events) {
-        final Map<String, ResourceChange> addedEvents = new HashMap<String, ResourceChange>();
-        final Map<String, ResourceChange> changedEvents = new HashMap<String, ResourceChange>();
-        final Map<String, ResourceChange> removedEvents = new HashMap<String, ResourceChange>();
+        final Map<String, ResourceChange> addedEvents = new HashMap<>();
+        final Map<String, ResourceChange> changedEvents = new HashMap<>();
+        final Map<String, ResourceChange> removedEvents = new HashMap<>();
 
         while (events.hasNext()) {
             final Event event = events.nextEvent();
@@ -147,7 +146,7 @@
             }
         }
 
-        final List<ResourceChange> changes = new ArrayList<ResourceChange>();
+        final List<ResourceChange> changes = new ArrayList<>();
         changes.addAll(addedEvents.values());
         changes.addAll(removedEvents.values());
         changes.addAll(changedEvents.values());
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
index 8def019..f5268cf 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
@@ -79,8 +79,8 @@
 
     private final Method isSystemUserMethod;
 
-    private final Set<String> validIds = new CopyOnWriteArraySet<String>();
-    private final Set<String> validPrincipalNames = new CopyOnWriteArraySet<String>();
+    private final Set<String> validIds = new CopyOnWriteArraySet<>();
+    private final Set<String> validPrincipalNames = new CopyOnWriteArraySet<>();
 
     private boolean allowOnlySystemUsers;
 
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrValueMap.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrValueMap.java
index facc115..03e396e 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrValueMap.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrValueMap.java
@@ -49,10 +49,10 @@
     protected final Node node;
 
     /** A cache for the properties. */
-    protected final Map<String, JcrPropertyMapCacheEntry> cache = new LinkedHashMap<String, JcrPropertyMapCacheEntry>();
+    protected final Map<String, JcrPropertyMapCacheEntry> cache = new LinkedHashMap<>();
 
     /** A cache for the values. */
-    protected final Map<String, Object> valueCache = new LinkedHashMap<String, Object>();
+    protected final Map<String, Object> valueCache = new LinkedHashMap<>();
 
     /** Has the node been read completely? */
     private boolean fullyRead = false;
@@ -406,7 +406,7 @@
 
     private Map<String, Object> transformEntries(final Map<String, JcrPropertyMapCacheEntry> map) {
 
-        final Map<String, Object> transformedEntries = new LinkedHashMap<String, Object>(map.size());
+        final Map<String, Object> transformedEntries = new LinkedHashMap<>(map.size());
         for (final Map.Entry<String, JcrPropertyMapCacheEntry> entry : map.entrySet())
             transformedEntries.put(entry.getKey(), entry.getValue().getPropertyValueOrNull());
 
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java b/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
index 7a08518..a8351f1 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
@@ -47,13 +47,13 @@
      * @throws RepositoryException if the repository's namespaced prefixes cannot be retrieved
      */
     public static void handleMixinTypes(final Node node, final String[] mixinTypes) throws RepositoryException {
-        final Set<String> newTypes = new HashSet<String>();
+        final Set<String> newTypes = new HashSet<>();
         if (mixinTypes != null) {
             for (final String value : mixinTypes) {
                 newTypes.add(value);
             }
         }
-        final Set<String> oldTypes = new HashSet<String>();
+        final Set<String> oldTypes = new HashSet<>();
         for (final NodeType mixinType : node.getMixinNodeTypes()) {
             oldTypes.add(mixinType.getName());
         }
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
index ac85e9b..e178f2f 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
@@ -114,8 +114,6 @@
                     return next != null;
                 }
 
-                ;
-
                 @Override
                 public ValueMap next() {
                     if (next == null) {
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
index 0fe68f7..8c9e6f1 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
@@ -23,7 +23,6 @@
 import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
 
 import org.apache.jackrabbit.api.binary.BinaryDownload;
 import org.apache.jackrabbit.api.binary.BinaryDownloadOptions;
@@ -109,7 +108,7 @@
         return ((Scope.PUBLIC.equals(scope) || Scope.EXTERNAL.equals(scope)) && Operation.READ.equals(operation));
     }
 
-    private @NotNull URI getUriFromProperty(@NotNull Resource resource, @NotNull Node node, @NotNull Property binaryProperty) throws ValueFormatException, RepositoryException {
+    private @NotNull URI getUriFromProperty(@NotNull Resource resource, @NotNull Node node, @NotNull Property binaryProperty) throws RepositoryException {
         Binary binary = binaryProperty.getBinary();
         if (!(binary instanceof BinaryDownload)) {
             binary.dispose();
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
index 5661b4d..96bc306 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
@@ -141,7 +141,7 @@
         return null;
     }
 
-    private static Item getSubitem(Node node, String relPath) throws RepositoryException {
+    private static Item getSubitem(Node node, String relPath) {
         try {
             if (relPath.length() == 0) { // not using isEmpty() due to 1.5 compatibility
                 return node;
@@ -153,8 +153,7 @@
                 return null;
             }
         } catch (RepositoryException e) {
-            log.debug("getSubitem: Can't get subitem {} of {}: {}",
-                    new Object[]{relPath, node.toString(), e.toString()});
+            log.debug("getSubitem: Can't get subitem {} of {}: {}", relPath, node.toString(), e.toString());
             return null;
         }
     }
@@ -175,7 +174,7 @@
         return item.isNode() && ((Node) item).isNodeType(NodeType.MIX_VERSIONABLE);
     }
 
-    Item getItemOrNull(String path) throws RepositoryException {
+    Item getItemOrNull(String path) {
         // Check first if the path is absolute. If it isn't, then we return null because the previous itemExists method,
         // which was replaced by this method, would have returned null as well (instead of throwing an exception).
         if (path.isEmpty() || path.charAt(0) != '/') {
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
index e714606..e676536 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
@@ -25,10 +25,8 @@
 import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
-import javax.jcr.ValueFormatException;
 
 import org.apache.sling.adapter.annotations.Adaptable;
 import org.apache.sling.adapter.annotations.Adapter;
@@ -43,7 +41,6 @@
 import org.apache.sling.jcr.resource.internal.JcrModifiableValueMap;
 import org.apache.sling.jcr.resource.internal.JcrValueMap;
 import org.apache.sling.jcr.resource.internal.NodeUtil;
-import org.jetbrains.annotations.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderState.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderState.java
index 5014484..de2196c 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderState.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderState.java
@@ -19,7 +19,6 @@
 package org.apache.sling.jcr.resource.internal.helper.jcr;
 
 import java.io.Closeable;
-import java.io.IOException;
 
 import javax.jcr.Session;
 
@@ -72,7 +71,7 @@
     }
 
     @Override
-    public void close() throws IOException {
+    public void close() {
         logout();
     }
 
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
index 9d85ae4..f2bb1a7 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
@@ -251,11 +251,7 @@
         }
         this.listeners.clear();
         if (this.listenerConfig != null) {
-            try {
-                this.listenerConfig.close();
-            } catch (final IOException e) {
-                // ignore this as the method above does not throw it
-            }
+            this.listenerConfig.close();
             this.listenerConfig = null;
         }
         logger.debug("Unregistered resource listeners");
@@ -378,7 +374,7 @@
 
     @Override
     public Collection<String> getAttributeNames(final @NotNull ResolveContext<JcrProviderState> ctx) {
-        final Set<String> names = new HashSet<String>();
+        final Set<String> names = new HashSet<>();
         final String[] sessionNames = ctx.getProviderState().getSession().getAttributeNames();
         for (final String name : sessionNames) {
             if (isAttributeVisible(name)) {
@@ -601,7 +597,7 @@
     @Override
     public boolean copy(final @NotNull ResolveContext<JcrProviderState> ctx,
                         final String srcAbsPath,
-                        final String destAbsPath) throws PersistenceException {
+                        final String destAbsPath) {
         return false;
     }
 
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
index c2b9607..f1d831b 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
@@ -49,8 +49,6 @@
 import org.apache.jackrabbit.util.Text;
 import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.helper.jcr.SlingRepositoryTestBase;
 
 public class JcrModifiableValueMapTest extends SlingRepositoryTestBase {
@@ -71,7 +69,7 @@
 
         final Map<String, Object> values = this.initialSet();
         for (Map.Entry<String, Object> entry : values.entrySet()) {
-            setProperty(rootNode, entry.getKey().toString(), entry.getValue());
+            setProperty(rootNode, entry.getKey(), entry.getValue());
         }
         getSession().save();
     }
@@ -134,12 +132,12 @@
         super.tearDown();
     }
 
-    private HelperData getHelperData() throws Exception {
-        return new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>());
+    private HelperData getHelperData() {
+        return new HelperData(new AtomicReference<>(), new AtomicReference<>());
     }
 
     private Map<String, Object> initialSet() {
-        final Map<String, Object> values = new HashMap<String, Object>();
+        final Map<String, Object> values = new HashMap<>();
         values.put("string", "test");
         values.put("long", 1L);
         values.put("bool", Boolean.TRUE);
@@ -203,7 +201,7 @@
         assertNull(pvm.get("something"));
 
         // now put a serializable object
-        final List<String> strings = new ArrayList<String>();
+        final List<String> strings = new ArrayList<>();
         strings.add("a");
         strings.add("b");
         pvm.put("something", strings);
@@ -242,7 +240,7 @@
     }
 
     private Set<String> getMixinNodeTypes(final Node node) throws RepositoryException {
-        final Set<String> mixinTypes = new HashSet<String>();
+        final Set<String> mixinTypes = new HashSet<>();
         for (final NodeType mixinNodeType : node.getMixinNodeTypes()) {
             mixinTypes.add(mixinNodeType.getName());
         }
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
index ceb86f9..8c4a4f8 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
@@ -25,7 +25,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.observation.Event;
@@ -43,7 +42,6 @@
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.osgi.framework.InvalidSyntaxException;
 
 /**
  * This test case asserts that JcrResourceListener scales to an
@@ -86,7 +84,7 @@
 
     @Ignore("SLING-3399")  // FIXME SLING-3399
     @Test
-    public void testManyEvents() throws RepositoryException, InterruptedException, InvalidSyntaxException {
+    public void testManyEvents() {
         jcrResourceListener.onEvent(events);
     }
 
@@ -94,7 +92,7 @@
         int count;
 
         @Override
-        public String getPath() throws RepositoryException {
+        public String getPath() {
             return "path-" + count++;
         }
     }
@@ -144,7 +142,7 @@
 
                         @Override
                         public Set<String> getPropertyNamesHint() {
-                            return new HashSet<String>();
+                            return new HashSet<>();
                         }
                     };
                     return Collections.singletonList(config);
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
index f5ddc2a..dafcef9 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
@@ -30,8 +30,6 @@
 import java.util.Set;
 
 import javax.jcr.Credentials;
-import javax.jcr.LoginException;
-import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -65,7 +63,7 @@
 
     private String pathToModify = "/test" + System.currentTimeMillis() + "-modify";
 
-    private final List<ResourceChange> events = synchronizedList(new ArrayList<ResourceChange>());
+    private final List<ResourceChange> events = synchronizedList(new ArrayList<>());
 
     SlingRepository repository;
 
@@ -79,23 +77,22 @@
                 new SlingRepository() {
 
                     @Override
-                    public Session login(Credentials credentials, String workspaceName)
-                            throws LoginException, NoSuchWorkspaceException, RepositoryException {
+                    public Session login(Credentials credentials, String workspaceName) throws RepositoryException {
                         return repository.login(credentials, workspaceName);
                     }
 
                     @Override
-                    public Session login(String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException {
+                    public Session login(String workspaceName) throws RepositoryException {
                         return repository.login(workspaceName);
                     }
 
                     @Override
-                    public Session login(Credentials credentials) throws LoginException, RepositoryException {
+                    public Session login(Credentials credentials) throws RepositoryException {
                         return repository.login(credentials);
                     }
 
                     @Override
-                    public Session login() throws LoginException, RepositoryException {
+                    public Session login() throws RepositoryException {
                         return repository.login();
                     }
 
@@ -130,12 +127,12 @@
                     }
 
                     @Override
-                    public Session loginService(String subServiceName, String workspace) throws LoginException, RepositoryException {
+                    public Session loginService(String subServiceName, String workspace) throws RepositoryException {
                         return repository.loginAdministrative(workspace);
                     }
 
                     @Override
-                    public Session loginAdministrative(String workspace) throws LoginException, RepositoryException {
+                    public Session loginAdministrative(String workspace) throws RepositoryException {
                         return repository.loginAdministrative(workspace);
                     }
 
@@ -150,7 +147,7 @@
     }
 
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         if (adminSession != null) {
             adminSession.logout();
             adminSession = null;
@@ -169,9 +166,9 @@
     public void testSimpleOperations() throws Exception {
         generateEvents(adminSession);
         assertEquals("Received: " + events, 5, events.size());
-        final Set<String> addPaths = new HashSet<String>();
-        final Set<String> modifyPaths = new HashSet<String>();
-        final Set<String> removePaths = new HashSet<String>();
+        final Set<String> addPaths = new HashSet<>();
+        final Set<String> modifyPaths = new HashSet<>();
+        final Set<String> removePaths = new HashSet<>();
 
         for (final ResourceChange event : events) {
             if (event.getType() == ChangeType.ADDED) {
@@ -270,9 +267,9 @@
             }
             System.out.println("Events = " + events);
             assertEquals("Received: " + events, 6, events.size());
-            final Set<String> addPaths = new HashSet<String>();
-            final Set<String> modifyPaths = new HashSet<String>();
-            final Set<String> removePaths = new HashSet<String>();
+            final Set<String> addPaths = new HashSet<>();
+            final Set<String> modifyPaths = new HashSet<>();
+            final Set<String> removePaths = new HashSet<>();
 
             for (final ResourceChange event : events) {
                 if (event.getType() == ChangeType.ADDED) {
@@ -372,7 +369,7 @@
 
                 @Override
                 public Set<String> getPropertyNamesHint() {
-                    return new HashSet<String>();
+                    return new HashSet<>();
                 }
             };
             return Collections.singletonList(config);
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidatorTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidatorTest.java
index 0fdfd2b..f7a1d24 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidatorTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidatorTest.java
@@ -26,7 +26,6 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.naming.NamingException;
 
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.user.Group;
@@ -54,7 +53,7 @@
     public final SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);
 
     @Before
-    public void setUp() throws IllegalArgumentException, IllegalAccessException, RepositoryException, NamingException,
+    public void setUp() throws IllegalArgumentException, IllegalAccessException, RepositoryException,
             NoSuchFieldException, SecurityException {
         jcrSystemUserValidator = new JcrSystemUserValidator();
         final Field repositoryField = jcrSystemUserValidator.getClass().getDeclaredField("repository");
@@ -80,7 +79,7 @@
         session.save();
     }
 
-    private void setAllowOnlySystemUsers(boolean allowOnlySystemUsers) throws Exception {
+    private void setAllowOnlySystemUsers(boolean allowOnlySystemUsers) {
         final JcrSystemUserValidator.Config config = new JcrSystemUserValidator.Config() {
             @Override
             public Class<? extends Annotation> annotationType() {
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
index 4af065d..0f5326f 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
@@ -31,8 +31,6 @@
 import org.apache.jackrabbit.commons.JcrUtils;
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.HelperData;
 import org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator;
 import org.apache.sling.testing.mock.jcr.MockJcr;
@@ -42,7 +40,7 @@
 public class JcrNodeResourceIteratorTest extends TestCase {
 
     private HelperData getHelperData() {
-        return new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>());
+        return new HelperData(new AtomicReference<>(), new AtomicReference<>());
     }
 
     public void testEmpty() {
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProviderTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProviderTest.java
index 12db94b..3678c0f 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProviderTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProviderTest.java
@@ -32,7 +32,6 @@
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.ValueFormatException;
 
 import org.apache.jackrabbit.api.binary.BinaryDownload;
 import org.apache.jackrabbit.api.binary.BinaryDownloadOptions;
@@ -79,10 +78,10 @@
     }
 
     @Test
-    public void testMockedProperty() throws ValueFormatException, RepositoryException, URISyntaxException {
+    public void testMockedProperty() throws RepositoryException, URISyntaxException {
         uriProvider = new BinaryDownloadUriProvider(false) {
             @Override
-            protected Property getPrimaryProperty(Node node) throws RepositoryException {
+            protected Property getPrimaryProperty(Node node) {
                 return property;
             }
         };
@@ -99,7 +98,7 @@
     }
 
     @Test
-    public void testPropertyWithoutExternallyAccessibleBlobStore() throws URISyntaxException, RepositoryException, IOException {
+    public void testPropertyWithoutExternallyAccessibleBlobStore() {
         IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> uriProvider.toURI(fileResource, Scope.EXTERNAL, Operation.READ));
         assertEquals("Cannot provide url for downloading the binary property at '/test/jcr:content/jcr:data'", e.getMessage());
     }
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
index 0fe14f7..7e2c5d2 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
@@ -23,8 +23,6 @@
 import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.HelperData;
 
 import javax.jcr.GuestCredentials;
@@ -98,7 +96,7 @@
     }
 
     private void compareGetItemOrNull(String path, String expectedPath) throws RepositoryException {
-        HelperData helper = new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>());
+        HelperData helper = new HelperData(new AtomicReference<>(), new AtomicReference<>());
         Item item1 = new JcrItemResourceFactory(session, helper).getItemOrNull(path);
         Item item2 = new JcrItemResourceFactory(nonJackrabbitSession, helper).getItemOrNull(path);
         if (expectedPath == null) {
@@ -149,7 +147,7 @@
     }
 
     private void compareGetParentOrNull(Session s, String path, boolean nullExpected) throws RepositoryException {
-        HelperData helper = new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>());
+        HelperData helper = new HelperData(new AtomicReference<>(), new AtomicReference<>());
 
         String parentPath = PathUtils.getParentPath(path);
         Node parent = new JcrItemResourceFactory(s, helper).getParentOrNull(s.getItem(path), parentPath);
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
index 3306411..60711e7 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
@@ -35,15 +35,13 @@
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.api.JcrResourceConstants;
 import org.apache.sling.jcr.resource.internal.HelperData;
 
 public class JcrNodeResourceTest extends JcrItemResourceTestBase {
 
-    private HelperData getHelperData() throws Exception {
-        return new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>());
+    private HelperData getHelperData() {
+        return new HelperData(new AtomicReference<>(), new AtomicReference<>());
     }
 
     public void testLinkedFile() throws Exception {
@@ -218,13 +216,13 @@
         assertEquals(JcrConstants.NT_UNSTRUCTURED, props.get(JcrConstants.JCR_PRIMARYTYPE));
 
         // assert we have nothing else left
-        final Set<String> existingKeys = new HashSet<String>();
+        final Set<String> existingKeys = new HashSet<>();
         existingKeys.add(JcrConstants.JCR_LASTMODIFIED);
         existingKeys.add(JcrConstants.JCR_MIMETYPE);
         existingKeys.add(JcrConstants.JCR_ENCODING);
         existingKeys.add(JcrConstants.JCR_DATA);
         existingKeys.add(JcrConstants.JCR_PRIMARYTYPE);
-        final Set<Object> crossCheck = new HashSet<Object>(props.keySet());
+        final Set<Object> crossCheck = new HashSet<>(props.keySet());
         crossCheck.removeAll(existingKeys);
         assertTrue(crossCheck.isEmpty());
 
@@ -246,7 +244,7 @@
         assertEquals(JcrConstants.NT_UNSTRUCTURED, propsSecond.get(JcrConstants.JCR_PRIMARYTYPE));
 
         // assert we have nothing else left
-        final Set<Object> crossCheck2 = new HashSet<Object>(propsSecond.keySet());
+        final Set<Object> crossCheck2 = new HashSet<>(propsSecond.keySet());
         crossCheck2.removeAll(existingKeys);
         assertTrue(crossCheck2.isEmpty());
     }
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
index ead1fcd..f4f83f5 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderSessionHandlingTest.java
@@ -37,8 +37,6 @@
 import java.util.Map;
 
 import javax.jcr.Credentials;
-import javax.jcr.LoginException;
-import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Value;
@@ -60,13 +58,12 @@
 import org.mockito.Mockito;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentContext;
 
 @RunWith(Parameterized.class)
 public class JcrResourceProviderSessionHandlingTest {
 
-    private enum LoginStyle {USER, SESSION, SERVICE};
+    private enum LoginStyle {USER, SESSION, SERVICE}
 
     private static final String AUTH_USER = "admin";
     private static final char[] AUTH_PASSWORD = "admin".toCharArray();
@@ -124,8 +121,7 @@
 
         @SuppressWarnings("deprecation")
         @Override
-        public Session loginService(String subServiceName, String workspace)
-                throws LoginException, RepositoryException {
+        public Session loginService(String subServiceName, String workspace) throws RepositoryException {
             // just fake service logins by doing administrative logins instead
             return wrapped.loginAdministrative(workspace);
         }
@@ -163,24 +159,22 @@
         }
 
         @Override
-        public Session login(Credentials credentials, String workspaceName)
-                throws LoginException, NoSuchWorkspaceException, RepositoryException {
+        public Session login(Credentials credentials, String workspaceName) throws RepositoryException {
             return wrapped.login(credentials, workspaceName);
         }
 
         @Override
-        public Session login(Credentials credentials) throws LoginException, RepositoryException {
+        public Session login(Credentials credentials) throws RepositoryException {
             return wrapped.login(credentials);
         }
 
         @Override
-        public Session login(String workspaceName)
-                throws LoginException, NoSuchWorkspaceException, RepositoryException {
+        public Session login(String workspaceName) throws RepositoryException {
             return wrapped.login(workspaceName);
         }
 
         @Override
-        public Session login() throws LoginException, RepositoryException {
+        public Session login() throws RepositoryException {
             return wrapped.login();
         }
 
@@ -191,7 +185,7 @@
 
         @SuppressWarnings("deprecation")
         @Override
-        public Session loginAdministrative(String workspace) throws LoginException, RepositoryException {
+        public Session loginAdministrative(String workspace) throws RepositoryException {
             return wrapped.loginAdministrative(workspace);
         }
 
@@ -217,7 +211,7 @@
                 Bundle mockBundle = mock(Bundle.class);
                 BundleContext mockBundleContext = mock(BundleContext.class);
                 when(mockBundle.getBundleContext()).thenReturn(mockBundleContext);
-                when(mockBundleContext.getService(Matchers.<ServiceReference<Object>>any())).thenReturn(repo);
+                when(mockBundleContext.getService(Matchers.any())).thenReturn(repo);
                 authInfo.put(ResourceResolverFactory.SUBSERVICE, "dummy-service");
                 authInfo.put(ResourceProvider.AUTH_SERVICE_BUNDLE, mockBundle);
                 break;
@@ -232,7 +226,7 @@
         }
 
         ComponentContext ctx = mock(ComponentContext.class);
-        when(ctx.locateService(anyString(), Mockito.<ServiceReference<Object>>any())).thenReturn(repo);
+        when(ctx.locateService(anyString(), Mockito.any())).thenReturn(repo);
 
         jcrResourceProvider = new JcrResourceProvider();
         jcrResourceProvider.activate(ctx);
@@ -241,7 +235,7 @@
     }
 
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
 
         // Some tests do a logout, so check for liveness before trying to log out.
         if (jcrProviderState.getSession().isLive()) {
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
index a51cfad..6fc48b5 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderTest.java
@@ -25,13 +25,10 @@
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.nodetype.NodeType;
 
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.HelperData;
 import org.apache.sling.spi.resource.provider.ResolveContext;
 import org.apache.sling.spi.resource.provider.ResourceContext;
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
index 560e784..3ffa912 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
@@ -24,15 +24,13 @@
 import javax.jcr.RepositoryException;
 
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.external.URIProvider;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.HelperData;
 
 public class JcrTestNodeResource extends JcrNodeResource {
 
     public JcrTestNodeResource(ResourceResolver resourceResolver, Node node,
                                ClassLoader dynamicClassLoader) throws RepositoryException {
-        super(resourceResolver, node.getPath(), null, node, new HelperData(new AtomicReference<DynamicClassLoaderManager>(), new AtomicReference<URIProvider[]>()));
+        super(resourceResolver, node.getPath(), null, node, new HelperData(new AtomicReference<>(), new AtomicReference<>()));
     }
 
 }
diff --git a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SlingRepositoryProvider.java b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SlingRepositoryProvider.java
index 0a00906..8a7030d 100644
--- a/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SlingRepositoryProvider.java
+++ b/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/SlingRepositoryProvider.java
@@ -53,7 +53,6 @@
 
 
     private static BundleContext getFakeContext() {
-        BundleContext mockContext = Mockito.mock(BundleContext.class);
-        return mockContext;
+        return Mockito.mock(BundleContext.class);
     }
 }