You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2015/09/02 13:49:20 UTC

wicket git commit: WICKET-5978 simpler solution with a single INSTANCE

Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x a92be9ee1 -> 8f8b1a49b


WICKET-5978 simpler solution with a single INSTANCE


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/8f8b1a49
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/8f8b1a49
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/8f8b1a49

Branch: refs/heads/wicket-6.x
Commit: 8f8b1a49ba5eca1a9782d387e9b9f8ac5a61a1cd
Parents: a92be9e
Author: Sven Meier <sv...@apache.org>
Authored: Wed Sep 2 13:48:41 2015 +0200
Committer: Sven Meier <sv...@apache.org>
Committed: Wed Sep 2 13:48:41 2015 +0200

----------------------------------------------------------------------
 .../wicket/proxy/LazyInitProxyFactory.java      | 26 ++++----------------
 1 file changed, 5 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8f8b1a49/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
----------------------------------------------------------------------
diff --git a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
index 39cfc6c..ab4a0b2 100644
--- a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
+++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
@@ -167,7 +167,7 @@ public class LazyInitProxyFactory
 			CGLibInterceptor handler = new CGLibInterceptor(type, locator);
 
 			Callback[] callbacks = new Callback[2];
-			callbacks[CGLIB_CALLBACK_NO_OVERRIDE] = new SerializableNoOpCallback();
+			callbacks[CGLIB_CALLBACK_NO_OVERRIDE] = SerializableNoOpCallback.INSTANCE;
 			callbacks[CGLIB_CALLBACK_HANDLER] = handler;
 
 			Enhancer e = new Enhancer();
@@ -175,7 +175,7 @@ public class LazyInitProxyFactory
 			e.setInterfaces(new Class[] { Serializable.class, ILazyInitProxy.class,
 					IWriteReplace.class });
 			e.setSuperclass(type);
-			e.setCallbackFilter(new NoOpForProtectedMethodsCGLibCallbackFilter());
+			e.setCallbackFilter(NoOpForProtectedMethodsCGLibCallbackFilter.INSTANCE);
 			e.setCallbacks(callbacks);
 			e.setNamingPolicy(WicketNamingPolicy.INSTANCE);
 
@@ -367,15 +367,7 @@ public class LazyInitProxyFactory
 	{
 		private static final long serialVersionUID = 1L;
 
-		@Override
-		public int hashCode() {
-			return getClass().hashCode();
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			return obj instanceof SerializableNoOpCallback;
-		}
+		private static final NoOp INSTANCE = new SerializableNoOpCallback();
 	}
 
 	/**
@@ -394,6 +386,8 @@ public class LazyInitProxyFactory
 	 */
 	private static class NoOpForProtectedMethodsCGLibCallbackFilter implements CallbackFilter
 	{
+		private static final CallbackFilter INSTANCE = new NoOpForProtectedMethodsCGLibCallbackFilter();
+
 		@Override
 		public int accept(Method method) {
 			if (Modifier.isProtected(method.getModifiers()))
@@ -405,16 +399,6 @@ public class LazyInitProxyFactory
 				return CGLIB_CALLBACK_HANDLER;
 			}
 		}
-
-		@Override
-		public int hashCode() {
-			return getClass().hashCode();
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			return obj instanceof NoOpForProtectedMethodsCGLibCallbackFilter;
-		}
 	}
 
 	/**