cosmetic: eliminate some code warnings (no functional change)
authorStefan Seifert <sseifert@apache.org>
Fri, 9 Sep 2016 14:14:37 +0000 (14:14 +0000)
committerStefan Seifert <sseifert@apache.org>
Fri, 9 Sep 2016 14:14:37 +0000 (14:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1760024 13f79535-47bb-0310-9956-ffa450edef68

pom.xml
src/main/java/org/apache/sling/models/impl/ResourceTypeBasedResourcePicker.java
src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
src/test/java/org/apache/sling/models/impl/AdapterFactoryTest.java
src/test/java/org/apache/sling/models/impl/ImplementsExtendsTest.java
src/test/java/org/apache/sling/models/impl/InterfaceInheritanceTest.java
src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
src/test/java/org/apache/sling/models/impl/OptionalPrimitivesTest.java
src/test/java/org/apache/sling/models/impl/ResourceModelConstructorTest.java

diff --git a/pom.xml b/pom.xml
index 9988aaa..153e9e5 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,6 @@
         <version>26</version>
         <relativePath />
     </parent>
-    <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.models.impl</artifactId>
     <packaging>bundle</packaging>
     <version>1.3.0-SNAPSHOT</version>
index 7d8750b..e38281d 100644 (file)
  */
 package org.apache.sling.models.impl;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.models.annotations.Model;
 import org.apache.sling.models.spi.ImplementationPicker;
 import org.osgi.framework.Constants;
 
-import javax.annotation.Nonnull;
-import java.util.HashMap;
-import java.util.Map;
-
 @Component
 @Service
 @Property(name = Constants.SERVICE_RANKING, intValue = (Integer.MAX_VALUE - 1))
@@ -41,7 +41,6 @@ public class ResourceTypeBasedResourcePicker implements ImplementationPicker {
         if (resource == null) {
             return null;
         }
-        final ResourceResolver resolver = resource.getResourceResolver();
 
         Map<String, Class<?>> implementationsByRT = mapByResourceType(implementationsTypes);
         return AdapterImplementations.getModelClassForResource(resource, implementationsByRT);
index af6c340..5723f97 100644 (file)
@@ -87,6 +87,7 @@ public class OSGiServiceInjector implements Injector, StaticInjectAnnotationProc
         return getValue(adaptable, type, filterString, callbackRegistry);
     }
 
+    @SuppressWarnings("unchecked")
     private <T> Object getService(Object adaptable, Class<T> type, String filter,
             DisposalCallbackRegistry callbackRegistry) {
         // cannot use SlingScriptHelper since it does not support ordering by service ranking due to https://issues.apache.org/jira/browse/SLING-5665
@@ -107,6 +108,7 @@ public class OSGiServiceInjector implements Injector, StaticInjectAnnotationProc
         }
     }
 
+    @SuppressWarnings("unchecked")
     private <T> Object[] getServices(Object adaptable, Class<T> type, String filter,
             DisposalCallbackRegistry callbackRegistry) {
         // cannot use SlingScriptHelper since it does not support ordering by service ranking due to https://issues.apache.org/jira/browse/SLING-5665
index 5e432df..f114b81 100644 (file)
@@ -29,11 +29,10 @@ import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.apache.sling.models.annotations.Model;
 import org.apache.sling.models.annotations.injectorspecific.Self;
 import org.apache.sling.models.factory.InvalidAdaptableException;
-import org.apache.sling.models.factory.ModelClassException;
 import org.apache.sling.models.factory.MissingElementsException;
+import org.apache.sling.models.factory.ModelClassException;
 import org.apache.sling.models.impl.injectors.SelfInjector;
 import org.apache.sling.models.impl.injectors.ValueMapInjector;
-import org.apache.sling.models.testmodels.classes.BindingsModel;
 import org.apache.sling.models.testmodels.classes.ConstructorWithExceptionModel;
 import org.apache.sling.models.testmodels.classes.DefaultStringModel;
 import org.apache.sling.models.testmodels.classes.InvalidModelWithMissingAnnotation;
index 0107320..f01a5c1 100644 (file)
@@ -17,9 +17,7 @@
 package org.apache.sling.models.impl;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyBoolean;
@@ -36,8 +34,6 @@ import java.util.Hashtable;
 import java.util.Map;
 import java.util.Vector;
 
-import javax.jws.WebParam.Mode;
-
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
@@ -158,7 +154,7 @@ public class ImplementsExtendsTest {
         // make sure adaption is not longer possible: implementation class mapping is removed
         Resource res = getMockResourceWithProps();
         try {
-            SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
+            factory.getAdapter(res, SampleServiceInterface.class);
             Assert.fail("Getting the model for interface 'SampleServiceInterface' should fail after the accroding adapter factory has been unregistered");
         } catch (ModelClassException e) {
             
index d59b127..5ff64e8 100644 (file)
  */
 package org.apache.sling.models.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
-import org.apache.sling.models.impl.injectors.ChildResourceInjector;
 import org.apache.sling.models.impl.injectors.ValueMapInjector;
-import org.apache.sling.models.testmodels.classes.*;
 import org.apache.sling.models.testmodels.interfaces.SubClassModel;
 import org.apache.sling.models.testmodels.interfaces.SuperClassModel;
 import org.junit.Before;
@@ -33,15 +41,6 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.service.component.ComponentContext;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 @RunWith(MockitoJUnitRunner.class)
 public class InterfaceInheritanceTest {
 
index 21b3d09..0ac19a7 100644 (file)
@@ -31,7 +31,6 @@ import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.scripting.SlingBindings;
 import org.apache.sling.api.scripting.SlingScriptHelper;
index 264c2e4..ab184b7 100644 (file)
@@ -28,7 +28,6 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.models.impl.injectors.ChildResourceInjector;
 import org.apache.sling.models.impl.injectors.ValueMapInjector;
-import org.apache.sling.models.testmodels.classes.constructorinjection.OptionalPrimitivesModel;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
index d1d661f..8478a6d 100644 (file)
  */
 package org.apache.sling.models.impl;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -27,7 +29,6 @@ import org.apache.commons.lang.RandomStringUtils;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
-import org.apache.sling.models.impl.ParameterizedTypeFromRequestAttributeTest.TestModel;
 import org.apache.sling.models.impl.injectors.ChildResourceInjector;
 import org.apache.sling.models.impl.injectors.ValueMapInjector;
 import org.apache.sling.models.testmodels.classes.ChildModel;