Author: marius.bogoevici
Date: 2010-04-13 13:54:15 -0400 (Tue, 13 Apr 2010)
New Revision: 6110
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
Log:
WELD-477 private final methods are ignored when checking proxiability
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2010-04-13 17:35:12 UTC
(rev 6109)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Proxies.java 2010-04-13 17:54:15 UTC
(rev 6110)
@@ -326,7 +326,7 @@
}
else if (Reflections.isTypeOrAnyMethodFinal(clazz))
{
- return new UnproxyableResolutionException(NOT_PROXYABLE_FINAL_TYPE_OR_METHOD,
clazz, Reflections.getFinalMethodOrType(clazz));
+ return new UnproxyableResolutionException(NOT_PROXYABLE_FINAL_TYPE_OR_METHOD,
clazz, Reflections.getNonPrivateFinalMethodOrType(clazz));
}
else if (clazz.isPrimitive())
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java 2010-04-13
17:35:12 UTC (rev 6109)
+++
core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java 2010-04-13
17:54:15 UTC (rev 6110)
@@ -148,6 +148,17 @@
}
/**
+ * Checks if member is private
+ *
+ * @param member The member to check
+ * @return True if final, false otherwise
+ */
+ public static boolean isPrivate(Member member)
+ {
+ return Modifier.isPrivate(member.getModifiers());
+ }
+
+ /**
* Checks if type or member is final
*
* @param type Type or member
@@ -155,10 +166,10 @@
*/
public static boolean isTypeOrAnyMethodFinal(Class<?> type)
{
- return getFinalMethodOrType(type) != null;
+ return getNonPrivateFinalMethodOrType(type) != null;
}
- public static Object getFinalMethodOrType(Class<?> type)
+ public static Object getNonPrivateFinalMethodOrType(Class<?> type)
{
if (isFinal(type))
{
@@ -166,7 +177,7 @@
}
for (Method method : type.getDeclaredMethods())
{
- if (isFinal(method))
+ if (isFinal(method) && !isPrivate(method))
{
return method;
}
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java 2010-04-13
17:35:12 UTC (rev 6109)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java 2010-04-13
17:54:15 UTC (rev 6110)
@@ -28,7 +28,7 @@
public class ProxiabilityTest extends AbstractWeldTest
{
- @Test(description = "https://jira.jboss.org/jira/browse/WELD-477",
groups="broken")
+ @Test(description = "https://jira.jboss.org/jira/browse/WELD-477")
public void testClassWithPrivateFinalMethodsProxyable()
{
InjectedClass injectedClassInstance = getReference(InjectedClass.class);
Show replies by date