Skip to content

Commit

Permalink
WELD-299
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Dec 3, 2009
1 parent 8886bdc commit 395b379
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
Expand Up @@ -16,6 +16,8 @@
*/
package org.jboss.weld.metadata.cache;

import static org.jboss.weld.logging.Category.REFLECTION;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
import static org.jboss.weld.logging.messages.MetadataMessage.NON_BINDING_MEMBER_TYPE;

import java.lang.annotation.Annotation;
Expand All @@ -25,12 +27,12 @@
import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;

import org.jboss.weld.DefinitionException;
import org.jboss.weld.WeldException;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.Reflections;
import org.jboss.weld.util.collections.Arrays2;
import org.slf4j.cal10n.LocLogger;

/**
*
Expand All @@ -41,7 +43,7 @@
*/
public class BindingTypeModel<T extends Annotation> extends AnnotationModel<T>
{

private static final LocLogger log = loggerFactory().getLogger(REFLECTION);

private static final Set<Class<? extends Annotation>> META_ANNOTATIONS = Arrays2.<Class<? extends Annotation>>asSet(Qualifier.class);

Expand Down Expand Up @@ -79,7 +81,8 @@ private void checkArrayAndAnnotationValuedMembers()
{
if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
{
throw new DefinitionException(NON_BINDING_MEMBER_TYPE, annotatedMethod);
super.valid = false;
log.debug(NON_BINDING_MEMBER_TYPE, annotatedMethod);
}
}

Expand Down
@@ -0,0 +1,50 @@
package org.jboss.weld.tests.beanManager.annotation;

import javax.persistence.PersistenceContext;

import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;

@Artifact
public class ManagerAnnotationTest extends AbstractWeldTest
{

@Test
public void testIsQualifier() throws Exception
{
assert !getCurrentManager().isQualifier(PersistenceContext.class);
}

@Test
public void testIsInterceptorBinding() throws Exception
{
assert !getCurrentManager().isInterceptorBinding(PersistenceContext.class);
}

@Test
public void testIsNormalScope() throws Exception
{
assert !getCurrentManager().isNormalScope(PersistenceContext.class);
}

@Test
public void testIsPassivatingScope() throws Exception
{
assert !getCurrentManager().isPassivatingScope(PersistenceContext.class);
}

@Test
public void testIsScope() throws Exception
{
assert !getCurrentManager().isScope(PersistenceContext.class);
}

@Test
public void testIsStereotype() throws Exception
{
assert !getCurrentManager().isStereotype(PersistenceContext.class);
}


}

0 comments on commit 395b379

Please sign in to comment.