Skip to content

Commit

Permalink
WELD-309
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Jan 28, 2010
1 parent c8380f3 commit 1973bba
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
Expand Up @@ -47,6 +47,7 @@
import org.jboss.weld.introspector.WeldField;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.AnnotatedTypes;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.collections.HashSetSupplier;
import org.jboss.weld.util.reflection.HierarchyDiscovery;
Expand Down Expand Up @@ -365,6 +366,17 @@ private <X> WeldClass<X> getDeclaringWeldClass(Member member, ClassTransformer t
}
}

@Override
public boolean equals(Object other)
{
if (other instanceof WeldClassImpl<?>)
{
WeldClassImpl<?> that = (WeldClassImpl<?>) other;
return AnnotatedTypes.compareAnnotatedTypes(this, that) && this.getActualTypeArguments().length == that.getActualTypeArguments().length && Arrays.equals(this.getActualTypeArguments(), that.getActualTypeArguments());
}
return false;
}

/**
* Gets the implementing class
*
Expand Down
Expand Up @@ -270,7 +270,7 @@ public boolean equals(Object other)
if (super.equals(other) && other instanceof WeldConstructor)
{
WeldConstructor<?> that = (WeldConstructor<?>) other;
return this.getDeclaringType().equals(that.getDeclaringType()) && this.getWeldParameters().equals(that.getWeldParameters());
return this.getJavaMember().equals(that.getJavaMember()) && this.getWeldParameters().equals(that.getWeldParameters());
}
return false;
}
Expand Down
Expand Up @@ -138,10 +138,10 @@ public String toString()
@Override
public boolean equals(Object other)
{
if (other instanceof WeldField<?, ?>)
if (super.equals(other) && other instanceof WeldField<?, ?>)
{
WeldField<?, ?> that = (WeldField<?, ?>) other;
return this.getDeclaringType().equals(that.getDeclaringType()) && this.getName().equals(that.getName());
return this.getJavaMember().equals(that.getJavaMember());
}
else
{
Expand Down
Expand Up @@ -190,10 +190,10 @@ public List<WeldParameter<?, X>> getWeldParameters(Class<? extends Annotation> a
@Override
public boolean equals(Object other)
{
if (other instanceof WeldMethod)
if (super.equals(other) && other instanceof WeldMethod)
{
WeldMethod<?, ?> that = (WeldMethod<?, ?>) other;
return this.getDeclaringType().equals(that.getDeclaringType()) && this.getName().equals(that.getName()) && this.getWeldParameters().equals(that.getWeldParameters());
return this.getJavaMember().equals(that.getJavaMember()) && this.getWeldParameters().equals(that.getWeldParameters());
}
else
{
Expand Down
Expand Up @@ -36,6 +36,7 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import javax.inject.Inject;

import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
Expand Down Expand Up @@ -553,4 +554,10 @@ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)

beforeBeanDiscovery.addAnnotatedType(type);
}

public void vetoOriginalTumbleDryer(@Observes ProcessAnnotatedType<TumbleDryer> event)
{
event.veto();
}

}

0 comments on commit 1973bba

Please sign in to comment.