Skip to content

Commit

Permalink
WELD-506 Added proxying of private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
drallen committed May 28, 2010
1 parent 8749a47 commit f0c1da9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
Expand Up @@ -402,6 +402,20 @@ protected void addMethodsFromClass(CtClass proxyClassType)
proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), createInterceptorBody(method), proxyClassType));
}
}
// Also add all private methods from the class hierarchy
CtClass superClass = proxyClassType.getSuperclass();
while (!superClass.getName().equals("java.lang.Object"))
{
for (CtMethod method : superClass.getDeclaredMethods())
{
if (Modifier.isPrivate(method.getModifiers()) && !method.getDeclaringClass().getName().equals("java.lang.Object"))
{
log.trace("Adding method " + method.getLongName());
proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), createInterceptorBody(method), proxyClassType));
}
}
superClass = superClass.getSuperclass();
}
}
catch (Exception e)
{
Expand Down
Expand Up @@ -24,7 +24,7 @@
public class EventQualifierTest extends AbstractWeldTest
{

@Test(description="WELD-226", groups="broken")
@Test(description="WELD-226")
public void testDefaultQualifierNotRequired()
{
Bar bar = getReference(Bar.class);
Expand Down
Expand Up @@ -8,7 +8,7 @@
public class ObserverInjectionTest extends AbstractWeldTest
{

@Test(description="WELD-535", groups="broken")
@Test(description="WELD-535")
public void testInjectionHappens()
{
SampleObserver sampleObserver = getReference(SampleObserver.class);
Expand Down

0 comments on commit f0c1da9

Please sign in to comment.