cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [3/3] cayenne git commit: warnings cleanup
Date Thu, 22 Oct 2015 14:21:39 GMT
warnings cleanup


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/57eef9ec
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/57eef9ec
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/57eef9ec

Branch: refs/heads/master
Commit: 57eef9ecb66eed3875f7ce0badf20cb976582663
Parents: 055eaac
Author: aadamchik <aadamchik@apache.org>
Authored: Thu Oct 22 17:16:53 2015 +0300
Committer: aadamchik <aadamchik@apache.org>
Committed: Thu Oct 22 17:16:53 2015 +0300

----------------------------------------------------------------------
 .../apache/cayenne/di/DIRuntimeException.java   |  5 +-
 .../di/spi/ConstructorInjectingProvider.java    |  3 +-
 .../apache/cayenne/di/spi/DefaultBinder.java    | 70 ++++++++++----------
 .../apache/cayenne/di/spi/DefaultInjector.java  | 17 +++--
 .../org/apache/cayenne/di/spi/DefaultScope.java |  3 +-
 5 files changed, 53 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/57eef9ec/cayenne-di/src/main/java/org/apache/cayenne/di/DIRuntimeException.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/DIRuntimeException.java b/cayenne-di/src/main/java/org/apache/cayenne/di/DIRuntimeException.java
index 076b496..b5efa8d 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/DIRuntimeException.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/DIRuntimeException.java
@@ -24,7 +24,10 @@ package org.apache.cayenne.di;
  * @since 4.0
  */
 public class DIRuntimeException extends RuntimeException {
-    /**
+   
+	private static final long serialVersionUID = 396131653561690312L;
+
+	/**
      * Creates new <code>ConfigurationException</code> without detail message.
      */
     public DIRuntimeException() {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/57eef9ec/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ConstructorInjectingProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ConstructorInjectingProvider.java
b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ConstructorInjectingProvider.java
index 9b3a66a..84fc21b 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ConstructorInjectingProvider.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ConstructorInjectingProvider.java
@@ -51,7 +51,8 @@ class ConstructorInjectingProvider<T> implements Provider<T>
{
         this.injector = injector;
     }
 
-    private void initConstructor(Class<? extends T> implementation) {
+    @SuppressWarnings("unchecked")
+	private void initConstructor(Class<? extends T> implementation) {
 
         Constructor<?>[] constructors = implementation.getDeclaredConstructors();
         Constructor<?> lastMatch = null;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/57eef9ec/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultBinder.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultBinder.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultBinder.java
index 8b7df87..38993b4 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultBinder.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultBinder.java
@@ -33,45 +33,43 @@ import org.apache.cayenne.di.MapBuilder;
  */
 class DefaultBinder implements Binder {
 
-    private DefaultInjector injector;
+	private DefaultInjector injector;
 
-    DefaultBinder(DefaultInjector injector) {
-        this.injector = injector;
-    }
+	DefaultBinder(DefaultInjector injector) {
+		this.injector = injector;
+	}
 
-    @Override
-    public <T> BindingBuilder<T> bind(Class<T> interfaceType) {
-        return new DefaultBindingBuilder<T>(Key.get(interfaceType), injector);
-    }
+	@Override
+	public <T> BindingBuilder<T> bind(Class<T> interfaceType) {
+		return new DefaultBindingBuilder<T>(Key.get(interfaceType), injector);
+	}
 
-    @Override
-    public <T> BindingBuilder<T> bind(Key<T> key) {
-        return new DefaultBindingBuilder<T>(key, injector);
-    }
+	@Override
+	public <T> BindingBuilder<T> bind(Key<T> key) {
+		return new DefaultBindingBuilder<T>(key, injector);
+	}
 
-    @Override
-    public <T> ListBuilder<T> bindList(String bindingName) {
-        Class<?> listClass = List.class;
-        return new DefaultListBuilder<T>(
-                Key.get((Class<List<?>>) listClass, bindingName),
-                injector);
-    }
+	@SuppressWarnings("unchecked")
+	@Override
+	public <T> ListBuilder<T> bindList(String bindingName) {
+		Class<?> listClass = List.class;
+		return new DefaultListBuilder<T>(Key.get((Class<List<?>>) listClass,
bindingName), injector);
+	}
 
-    @Override
-    public <T> MapBuilder<T> bindMap(String bindingName) {
-        Class<?> mapClass = Map.class;
-        return new DefaultMapBuilder<T>(Key.get(
-                (Class<Map<String, ?>>) mapClass,
-                bindingName), injector);
-    }
-    
-    @Override
-    public <T> DecoratorBuilder<T> decorate(Class<T> interfaceType) {
-        return new DefaultDecoratorBuilder<T>(Key.get(interfaceType), injector);
-    }
-    
-    @Override
-    public <T> DecoratorBuilder<T> decorate(Key<T> key) {
-        return new DefaultDecoratorBuilder<T>(key, injector);
-    }
+	@SuppressWarnings("unchecked")
+	@Override
+	public <T> MapBuilder<T> bindMap(String bindingName) {
+		Class<?> mapClass = Map.class;
+		return new DefaultMapBuilder<T>(Key.get((Class<Map<String, ?>>) mapClass,
bindingName), injector);
+	}
+
+	@Override
+	public <T> DecoratorBuilder<T> decorate(Class<T> interfaceType) {
+		return new DefaultDecoratorBuilder<T>(Key.get(interfaceType), injector);
+	}
+
+	@Override
+	public <T> DecoratorBuilder<T> decorate(Key<T> key) {
+		return new DefaultDecoratorBuilder<T>(key, injector);
+	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/57eef9ec/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
index 6c270b8..772ba5d 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultInjector.java
@@ -76,7 +76,8 @@ public class DefaultInjector implements Injector {
         return injectionStack;
     }
 
-    <T> Binding<T> getBinding(Key<T> key) throws DIRuntimeException {
+    @SuppressWarnings("unchecked")
+	<T> Binding<T> getBinding(Key<T> key) throws DIRuntimeException {
 
         if (key == null) {
             throw new NullPointerException("Null key");
@@ -93,7 +94,8 @@ public class DefaultInjector implements Injector {
     
     <T> void putDecorationAfter(Key<T> bindingKey, DecoratorProvider<T>
decoratorProvider) {
 
-        Decoration<T> decoration = (Decoration<T>) decorations.get(bindingKey);
+        @SuppressWarnings("unchecked")
+		Decoration<T> decoration = (Decoration<T>) decorations.get(bindingKey);
         if (decoration == null) {
             decoration = new Decoration<T>();
             decorations.put(bindingKey, decoration);
@@ -104,7 +106,8 @@ public class DefaultInjector implements Injector {
     
     <T> void putDecorationBefore(Key<T> bindingKey, DecoratorProvider<T>
decoratorProvider) {
 
-        Decoration<T> decoration = (Decoration<T>) decorations.get(bindingKey);
+        @SuppressWarnings("unchecked")
+		Decoration<T> decoration = (Decoration<T>) decorations.get(bindingKey);
         if (decoration == null) {
             decoration = new Decoration<T>();
             decorations.put(bindingKey, decoration);
@@ -148,7 +151,8 @@ public class DefaultInjector implements Injector {
             throw new NullPointerException("Null key");
         }
 
-        Binding<T> binding = (Binding<T>) bindings.get(key);
+        @SuppressWarnings("unchecked")
+		Binding<T> binding = (Binding<T>) bindings.get(key);
 
         if (binding == null) {
             throw new DIRuntimeException(
@@ -179,7 +183,8 @@ public class DefaultInjector implements Injector {
         return noScope;
     }
     
-    void applyDecorators() {
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+	void applyDecorators() {
         for (Entry<Key<?>, Decoration<?>> e : decorations.entrySet()) {
 
             Binding b = bindings.get(e.getKey());
@@ -188,7 +193,7 @@ public class DefaultInjector implements Injector {
                 continue;
             }
 
-            b.decorate(e.getValue());
+			b.decorate(e.getValue());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/57eef9ec/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultScope.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultScope.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultScope.java
index f3fec26..417cfa6 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultScope.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultScope.java
@@ -44,7 +44,8 @@ public class DefaultScope implements Scope {
 
     private static final String SPECIAL_EVENT = AfterScopeEnd.class.getName();
 
-    public DefaultScope(Class<? extends Annotation>... customEventTypes) {
+    @SafeVarargs
+	public DefaultScope(Class<? extends Annotation>... customEventTypes) {
         this.listeners = new ConcurrentHashMap<>();
         this.eventTypes = new HashSet<Class<? extends Annotation>>();
 


Mime
View raw message