You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2021/12/14 09:34:31 UTC
[sling-org-apache-sling-models-impl] branch master updated: cosmetic: eliminate code warnings
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git
The following commit(s) were added to refs/heads/master by this push:
new 56c28d1 cosmetic: eliminate code warnings
56c28d1 is described below
commit 56c28d1000a32b801a73ec9cb40553286b70ada3
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Tue Dec 14 10:34:18 2021 +0100
cosmetic: eliminate code warnings
---
src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java | 4 ++--
.../java/org/apache/sling/models/impl/injectors/ValueMapInjector.java | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
index fb6605e..a534adf 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
@@ -685,6 +685,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
return request;
}
+ @SuppressWarnings("unchecked")
private <ModelType> Result<ModelType> createObject(final Object adaptable, final ModelClass<ModelType> modelClass)
throws InstantiationException, InvocationTargetException, IllegalAccessException {
DisposalCallbackRegistryImpl registry = new DisposalCallbackRegistryImpl();
@@ -699,7 +700,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
ModelType object;
if (constructorToUse.getConstructor().getParameterTypes().length == 0) {
// no parameters for constructor injection? instantiate it right away
-
+
object = constructorToUse.newInstance();
} else {
// instantiate with constructor injection
@@ -770,7 +771,6 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
* @param type Model type
* @return Constructor or null if none found
*/
- @SuppressWarnings("unchecked")
private <ModelType> ModelClassConstructor<ModelType> getBestMatchingConstructor(Object adaptable, ModelClass<ModelType> type) {
ModelClassConstructor<ModelType>[] constructors = type.getConstructors();
diff --git a/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java b/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
index 5aa56df..1a36844 100644
--- a/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
+++ b/src/main/java/org/apache/sling/models/impl/injectors/ValueMapInjector.java
@@ -27,7 +27,6 @@ import java.util.List;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;