[jbosstools-commits] JBoss Tools SVN: r23127 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences and 6 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jun 30 12:50:49 EDT 2010


Author: akazakov
Date: 2010-06-30 12:50:48 -0400 (Wed, 30 Jun 2010)
New Revision: 23127

Added:
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/TypeInterceptorBinding.java
Modified:
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMethod.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new validation rule: interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -68,6 +68,9 @@
 	public String OBSERVERS_ANNOTATION_TYPE_NAME = "javax.enterprise.event.Observes";
 
 	public String INJECTIONPOINT_TYPE_NAME = "javax.enterprise.inject.spi.InjectionPoint";
-	
+
 	public String INSTANCE_TYPE_NAME = "javax.enterprise.inject.Instance";
+
+	public String PRE_DESTROY_TYPE_NAME = "javax.annotation.PreDestroy";
+	public String POST_CONSTRUCTOR_TYPE_NAME = "javax.annotation.PostConstruct";
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -239,6 +239,33 @@
 	}
 
 	/**
+	 * Returns the annotation declaration if it exists in the annotated element. If the
+	 * annotation declared in a stereotype then returns this stereotype declaration.
+	 * Returns null if there is not this annotation declaration neither corresponding
+	 * stereotype declaration. Doesn't check if a stereotype is inherited or not.
+	 * 
+	 * @param bean
+	 * @param scopeTypeName
+	 * @return
+	 */
+	public static IAnnotationDeclaration getAnnotationDeclaration(IAnnotated annotated, ICDIAnnotation annotation) {
+		List<IAnnotationDeclaration> annotations = annotated.getAnnotations();
+		for (IAnnotationDeclaration annotationDeclaration : annotations) {
+			ICDIAnnotation annotationElement = annotationDeclaration.getAnnotation();
+			if(annotationElement!=null && annotation.equals(annotationElement)) {
+				return annotationDeclaration;
+			}
+		}
+		if(annotated instanceof IStereotyped) {
+			Set<IStereotypeDeclaration> stereoTypeDeclarations = ((IStereotyped)annotated).getStereotypeDeclarations();
+			for (IStereotypeDeclaration stereotypeDeclaration : stereoTypeDeclarations) {
+				getAnnotationDeclaration(stereotypeDeclaration.getStereotype(), annotation);
+			}
+		}
+		return null;
+	}
+
+	/**
 	 * Return @Named declaration or the stereotype declaration if it declares @Named.
 	 * 
 	 * @param stereotyped

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotated.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -12,7 +12,6 @@
 
 import java.util.List;
 
-import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
 import org.jboss.tools.common.text.ITextSourceReference;
 
 /**
@@ -28,7 +27,7 @@
 	 * @return all annotations of the element, or an empty list if no
 	 *         annotations are present
 	 */
-	List<AnnotationDeclaration> getAnnotations();
+	List<IAnnotationDeclaration> getAnnotations();
 
 	/**
 	 * Get element annotation of a certain annotation type.

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IAnnotationDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -43,4 +43,11 @@
 	 * @return the corresponding IType of the annotation
 	 */
 	IType getType();
+
+	/**
+	 * Returns the corresponding annotation. May be null.
+	 * 
+	 * @return the corresponding annotation
+	 */
+	ICDIAnnotation getAnnotation();
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMethod.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanMethod.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -46,4 +46,10 @@
 	 * @return
 	 */
 	public boolean isObserver();
+
+	/**
+	 * Returns true if method is annotated with @PreDestroy or @PostConstruct
+	 * @return
+	 */
+	public boolean isLifeCycleCallbackMethod();
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -41,11 +41,27 @@
 	Set<IBeanMethod> getBeanConstructors();
 
 	/**
+	 * Returns a set of the methods that are declared in this bean class.
+	 * 
+	 * @return a set of the methods that are declared in this bean class.
+	 */
+	Set<IBeanMethod> getAllMethods();
+
+	/**
+	 * Obtains the interceptor binding declarations of the class bean.
+	 * This set includes bindings declared in this java class.
+	 * Use getInterceptorBindings() to get all bindings (i.g. from Stereotypes)   
+	 * 
+	 * @return the set of interceptor binding declarations
+	 */
+	Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations();
+
+	/**
 	 * Obtains the interceptor bindings of the bean.
 	 * 
 	 * @return the set of interceptor bindings
 	 */
-	Set<IInterceptorBindingDeclaration> getInterceptorBindings();
+	Set<IInterceptorBinding> getInterceptorBindings();
 
 	/**
 	 * Returns a set of observer methods of the bean.

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -15,7 +15,7 @@
 import org.eclipse.jdt.core.IMethod;
 
 /**
- * Represents an interceptor binding type.
+ * Represents a qualifier.
  * 
  * @author Viacheslav Kabanovich
  */

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotype.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -19,7 +19,7 @@
  * 
  * @author Alexey Kazakov
  */
-public interface IStereotype extends IScoped, IStereotyped, ICDINamedAnnotation {
+public interface IStereotype extends IScoped, IStereotyped, ICDINamedAnnotation, IAnnotated {
 
 	/**
 	 * Returns the location of @Name declaration of this stereotype. If the bean

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -44,5 +44,6 @@
 		defaultPreferences.put(CDIPreferences.INJECT_RESOLVES_TO_NULLABLE_BEAN, CDIPreferences.WARNING);
 		defaultPreferences.put(CDIPreferences.INJECTED_DECORATOR, CDIPreferences.WARNING);
 		defaultPreferences.put(CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferences.WARNING);
+		defaultPreferences.put(CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferences.WARNING);
 	}
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -62,13 +62,21 @@
 		return definition;
 	}
 
-	public List<AnnotationDeclaration> getAnnotations() {
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotations()
+	 */
+	public List<IAnnotationDeclaration> getAnnotations() {
 		if(definition!=null) {
 			return definition.getAnnotations();
 		}
 		return Collections.emptyList();
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotation(java.lang.String)
+	 */
 	public IAnnotationDeclaration getAnnotation(String annotationTypeName) {
 		if(definition!=null) {
 			return definition.getAnnotation(annotationTypeName);
@@ -84,6 +92,10 @@
 		return getAnnotation(annotationTypeName);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#isAnnotationPresent(java.lang.String)
+	 */
 	public boolean isAnnotationPresent(String annotationTypeName) {
 		return definition!=null && definition.isAnnotationPresent(annotationTypeName);
 	}
@@ -116,7 +128,7 @@
 
 	public Set<IStereotypeDeclaration> getStereotypeDeclarations(boolean includeInherited) {
 		Set<IStereotypeDeclaration> result = new HashSet<IStereotypeDeclaration>();
-		for (AnnotationDeclaration d: definition.getAnnotations()) {
+		for (IAnnotationDeclaration d: definition.getAnnotations()) {
 			if(d instanceof IStereotypeDeclaration) {
 				if(d instanceof IStereotypeDeclaration) {
 					result.add((IStereotypeDeclaration)d);
@@ -154,7 +166,7 @@
 	public Set<IQualifierDeclaration> getQualifierDeclarations(boolean includeInherited) {
 		Set<IQualifierDeclaration> result = new HashSet<IQualifierDeclaration>();
 		Set<IQualifier> qs = new HashSet<IQualifier>();
-		for(AnnotationDeclaration a: definition.getAnnotations()) {
+		for(IAnnotationDeclaration a: definition.getAnnotations()) {
 			int k = getCDIProject().getNature().getDefinitions().getAnnotationKind(a.getType());
 			if(k == AnnotationDefinition.QUALIFIER) {
 				IQualifierDeclaration q = (IQualifierDeclaration)a;

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AnnotationDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -18,6 +18,7 @@
 import org.jboss.tools.cdi.core.CDICoreNature;
 import org.jboss.tools.cdi.core.CDICorePlugin;
 import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.common.model.util.EclipseJavaUtil;
 
 /**
@@ -76,7 +77,6 @@
 		return annotationTypeName;
 	}
 
-	
 	public IType getType() {
 		return type;
 	}
@@ -89,4 +89,11 @@
 		return startPosition;
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotationDeclaration#getAnnotation()
+	 */
+	public ICDIAnnotation getAnnotation() {
+		return null;
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -87,4 +87,11 @@
 		return false;
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IBeanMethod#isLifeCycleCallbackMethod()
+	 */
+	public boolean isLifeCycleCallbackMethod() {
+		return definition.getAnnotation(CDIConstants.PRE_DESTROY_TYPE_NAME)!=null || definition.getAnnotation(CDIConstants.POST_CONSTRUCTOR_TYPE_NAME)!=null;
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -426,6 +426,15 @@
 	public static String getQualifierDeclarationKey(IQualifierDeclaration d) throws CoreException {
 		IQualifier q = d.getQualifier();
 		Set<IMethod> nb = q == null ? new HashSet<IMethod>() : q.getNonBindingMethods();
+		return getAnnotationDeclarationKey(d, nb);
+	}
+
+	public static String getAnnotationDeclarationKey(IAnnotationDeclaration d) throws CoreException {
+		return getAnnotationDeclarationKey(d, null);
+	}
+
+	public static String getAnnotationDeclarationKey(IAnnotationDeclaration d, Set<IMethod> ignoredMembers) throws CoreException {
+		Set<IMethod> nb = ignoredMembers == null ? new HashSet<IMethod>() : ignoredMembers;
 		IType type = d.getType();
 		IMethod[] ms = type.getMethods();
 		StringBuffer result = new StringBuffer();
@@ -581,10 +590,13 @@
 			return false;
 		}
 		AnnotationDefinition d = n.getDefinitions().getAnnotation(annotationType);
-		List<AnnotationDeclaration> ds = d.getAnnotations();
-		for (AnnotationDeclaration a: ds) {
-			if(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME.equals(a.getTypeName())) {
-				return true;
+		List<IAnnotationDeclaration> ds = d.getAnnotations();
+		for (IAnnotationDeclaration a: ds) {
+			if(a instanceof AnnotationDeclaration) {
+				AnnotationDeclaration aa = (AnnotationDeclaration)a;
+				if(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME.equals(aa.getTypeName())) {
+					return true;
+				}
 			}
 		}		
 		return false;
@@ -598,22 +610,25 @@
 			return false;
 		}
 		AnnotationDefinition d = n.getDefinitions().getAnnotation(annotationType);
-		List<AnnotationDeclaration> ds = d.getAnnotations();
-		for (AnnotationDeclaration a: ds) {
-			if(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME.equals(a.getTypeName())) {
-				IAnnotation ann = a.getDeclaration();
-				try {
-					IMemberValuePair[] ps = ann.getMemberValuePairs();
-					if(ps != null) for (IMemberValuePair p: ps) {
-						if("passivating".equals(p.getMemberName())) {
-							Object o = p.getValue();
-							return o != null && "true".equalsIgnoreCase(o.toString());
+		List<IAnnotationDeclaration> ds = d.getAnnotations();
+		for (IAnnotationDeclaration a: ds) {
+			if(a instanceof AnnotationDeclaration) {
+				AnnotationDeclaration aa = (AnnotationDeclaration)a;
+				if(CDIConstants.NORMAL_SCOPE_ANNOTATION_TYPE_NAME.equals(aa.getTypeName())) {
+					IAnnotation ann = a.getDeclaration();
+					try {
+						IMemberValuePair[] ps = ann.getMemberValuePairs();
+						if(ps != null) for (IMemberValuePair p: ps) {
+							if("passivating".equals(p.getMemberName())) {
+								Object o = p.getValue();
+								return o != null && "true".equalsIgnoreCase(o.toString());
+							}
 						}
+					} catch (JavaModelException e) {
+						CDICorePlugin.getDefault().logError(e);
 					}
-				} catch (JavaModelException e) {
-					CDICorePlugin.getDefault().logError(e);
+					return true;
 				}
-				return true;
 			}
 		}		
 		return false;

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -23,13 +23,13 @@
 import org.eclipse.jdt.core.IMemberValuePair;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
 import org.jboss.tools.cdi.core.CDIConstants;
 import org.jboss.tools.cdi.core.CDICorePlugin;
 import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.core.IBeanMethod;
 import org.jboss.tools.cdi.core.IClassBean;
 import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInterceptorBinding;
 import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
 import org.jboss.tools.cdi.core.IParametedType;
 import org.jboss.tools.cdi.core.IParameter;
@@ -174,10 +174,14 @@
 		return result;
 	}
 
-	public Set<IInterceptorBindingDeclaration> getInterceptorBindings() {
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IClassBean#getInterceptorBindingDeclarations()
+	 */
+	public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
 		Set<IInterceptorBindingDeclaration> result = new HashSet<IInterceptorBindingDeclaration>();
-		List<AnnotationDeclaration> as = definition.getAnnotations();
-		for (AnnotationDeclaration a: as) {
+		List<IAnnotationDeclaration> as = definition.getAnnotations();
+		for (IAnnotationDeclaration a: as) {
 			if(a instanceof InterceptorBindingDeclaration) {
 				result.add((InterceptorBindingDeclaration)a);
 			}
@@ -185,6 +189,20 @@
 		return result;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IClassBean#getInterceptorBindings()
+	 */
+	public Set<IInterceptorBinding> getInterceptorBindings() {
+		// TODO collect bindings from stereotypes. See https://jira.jboss.org/browse/JBIDE-6550 
+		Set<IInterceptorBinding> result = new HashSet<IInterceptorBinding>();
+		Set<IInterceptorBindingDeclaration> declarations = getInterceptorBindingDeclarations();
+		for (IInterceptorBindingDeclaration declaration: declarations) {
+			result.add(declaration.getInterceptorBinding());
+		}
+		return result;
+	}
+
 	public Set<IBeanMethod> getObserverMethods() {
 		Set<IBeanMethod> result = new HashSet<IBeanMethod>();
 		for (BeanMethod m: methods) {
@@ -475,4 +493,13 @@
 		return false;
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IClassBean#getAllMethods()
+	 */
+	public Set<IBeanMethod> getAllMethods() {
+		Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+		result.addAll(methods);
+		return result;
+	}
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -10,6 +10,7 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl;
 
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.cdi.core.IInterceptorBinding;
 import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
 
@@ -25,8 +26,19 @@
 		d.copyTo(this);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IInterceptorBindingDeclaration#getInterceptorBinding()
+	 */
 	public IInterceptorBinding getInterceptorBinding() {
 		return project.getDelegate().getInterceptorBinding(getTypeName());
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotationDeclaration#getAnnotation()
+	 */
+	public ICDIAnnotation getAnnotation() {
+		return getInterceptorBinding();
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -15,6 +15,7 @@
 import java.util.Set;
 
 import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.core.IInterceptorBinding;
 import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
 
@@ -29,8 +30,8 @@
 
 	public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
 		Set<IInterceptorBindingDeclaration> result = new HashSet<IInterceptorBindingDeclaration>();
-		List<AnnotationDeclaration> as = definition.getAnnotations();
-		for (AnnotationDeclaration a: as) {
+		List<IAnnotationDeclaration> as = definition.getAnnotations();
+		for (IAnnotationDeclaration a: as) {
 			if(a instanceof InterceptorBindingDeclaration) {
 				result.add((InterceptorBindingDeclaration)a);
 			}

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -61,7 +61,7 @@
 		throw new RuntimeException("Not implemented because limitations of JDT model.");
 	}
 
-	public List<AnnotationDeclaration> getAnnotations() {
+	public List<IAnnotationDeclaration> getAnnotations() {
 		throw new RuntimeException("Not implemented because limitations of JDT model.");
 	}
 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -10,6 +10,7 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl;
 
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.cdi.core.IQualifier;
 import org.jboss.tools.cdi.core.IQualifierDeclaration;
 
@@ -26,8 +27,19 @@
 		d.copyTo(this);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IQualifierDeclaration#getQualifier()
+	 */
 	public IQualifier getQualifier() {
 		return project.getDelegate().getQualifier(getTypeName());
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotationDeclaration#getAnnotation()
+	 */
+	public ICDIAnnotation getAnnotation() {
+		return getQualifier();
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -10,6 +10,7 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl;
 
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.cdi.core.IScope;
 import org.jboss.tools.cdi.core.IScopeDeclaration;
 
@@ -26,8 +27,19 @@
 		d.copyTo(this);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IScopeDeclaration#getScope()
+	 */
 	public IScope getScope() {
 		return project.getDelegate().getScope(getTypeName());
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotationDeclaration#getAnnotation()
+	 */
+	public ICDIAnnotation getAnnotation() {
+		return getScope();
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeDeclaration.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -10,6 +10,7 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl;
 
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.cdi.core.IStereotype;
 import org.jboss.tools.cdi.core.IStereotypeDeclaration;
 
@@ -26,8 +27,19 @@
 		d.copyTo(this);
 	}
 
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IStereotypeDeclaration#getStereotype()
+	 */
 	public IStereotype getStereotype() {
 		return project.getDelegate().getStereotype(getTypeName());
 	}
 
-}
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotationDeclaration#getAnnotation()
+	 */
+	public ICDIAnnotation getAnnotation() {
+		return getStereotype();
+	}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -10,16 +10,19 @@
  ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl;
 
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
 import org.eclipse.jdt.core.IAnnotation;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
 import org.jboss.tools.cdi.core.IScope;
 import org.jboss.tools.cdi.core.IScopeDeclaration;
 import org.jboss.tools.cdi.core.IStereotype;
 import org.jboss.tools.cdi.core.IStereotypeDeclaration;
+import org.jboss.tools.common.text.ITextSourceReference;
 
 /**
  * 
@@ -52,8 +55,8 @@
 	 */
 	public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
 		Set<IInterceptorBindingDeclaration> result = new HashSet<IInterceptorBindingDeclaration>();
-		List<AnnotationDeclaration> as = definition.getAnnotations();
-		for (AnnotationDeclaration a: as) {
+		List<IAnnotationDeclaration> as = definition.getAnnotations();
+		for (IAnnotationDeclaration a: as) {
 			if(a instanceof InterceptorBindingDeclaration) {
 				result.add((InterceptorBindingDeclaration)a);
 			}
@@ -75,7 +78,7 @@
 	 */
 	public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
 		Set<IStereotypeDeclaration> result = new HashSet<IStereotypeDeclaration>();
-		for (AnnotationDeclaration d: definition.getAnnotations()) {
+		for (IAnnotationDeclaration d: definition.getAnnotations()) {
 			if(d instanceof IStereotypeDeclaration) {
 				result.add((IStereotypeDeclaration)d);
 			}
@@ -124,4 +127,42 @@
 	public Set<IScopeDeclaration> getScopeDeclarations() {
 		return ProducerField.getScopeDeclarations(getCDIProject().getNature(), definition.getAnnotations());
 	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotations()
+	 */
+	public List<IAnnotationDeclaration> getAnnotations() {
+		if(definition!=null) {
+			return definition.getAnnotations();
+		}
+		return Collections.emptyList();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotation(java.lang.String)
+	 */
+	public IAnnotationDeclaration getAnnotation(String annotationTypeName) {
+		if(definition!=null) {
+			return definition.getAnnotation(annotationTypeName);
+		}
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotationPosition(java.lang.String)
+	 */
+	public ITextSourceReference getAnnotationPosition(String annotationTypeName) {
+		return getAnnotation(annotationTypeName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IAnnotated#isAnnotationPresent(java.lang.String)
+	 */
+	public boolean isAnnotationPresent(String annotationTypeName) {
+		return definition!=null && definition.isAnnotationPresent(annotationTypeName);
+	}
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -23,6 +23,7 @@
 import org.jboss.tools.cdi.core.CDIConstants;
 import org.jboss.tools.cdi.core.CDICorePlugin;
 import org.jboss.tools.cdi.core.IAnnotated;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.QualifierDeclaration;
@@ -36,7 +37,7 @@
  *
  */
 public abstract class AbstractMemberDefinition implements IAnnotated {
-	protected List<AnnotationDeclaration> annotations = new ArrayList<AnnotationDeclaration>();
+	protected List<IAnnotationDeclaration> annotations = new ArrayList<IAnnotationDeclaration>();
 	protected IAnnotatable member;
 	protected Map<String, AnnotationDeclaration> annotationsByType = new HashMap<String, AnnotationDeclaration>();
 	protected IResource resource;
@@ -88,7 +89,7 @@
 	 * (non-Javadoc)
 	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotations()
 	 */
-	public List<AnnotationDeclaration> getAnnotations() {
+	public List<IAnnotationDeclaration> getAnnotations() {
 		return annotations;
 	}
 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 
@@ -19,6 +19,7 @@
 import org.eclipse.jdt.core.IMethod;
 import org.eclipse.jdt.core.IType;
 import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
 
 /**
@@ -63,9 +64,12 @@
 		}
 		Map<String, AnnotationDeclaration> ds = new HashMap<String, AnnotationDeclaration>();
 		
-		for (AnnotationDeclaration a: annotations) {
-			String typeName = a.getTypeName();
-			ds.put(typeName, a);
+		for (IAnnotationDeclaration a: annotations) {
+			if(a instanceof AnnotationDeclaration) {
+				AnnotationDeclaration aa = (AnnotationDeclaration)a;
+				String typeName = aa.getTypeName();
+				ds.put(typeName, aa);
+			}
 		}
 
 		if(ds.containsKey(CDIConstants.SCOPE_ANNOTATION_TYPE_NAME) 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,3 +1,13 @@
+/******************************************************************************* 
+ * Copyright (c) 2009 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ * Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/ 
 package org.jboss.tools.cdi.internal.core.impl.definition;
 
 import org.jboss.tools.cdi.core.CDIConstants;
@@ -12,18 +22,27 @@
 		this.typeDefinition = typeDefinition;
 	}
 
+	@Override
 	public AbstractTypeDefinition getTypeDefinition() {
 		return typeDefinition;
 	}
 
 	public boolean isCDIAnnotated() {
-		return getInjectAnnotation() != null || getProducesAnnotation() != null;
+		return getInjectAnnotation() != null || getProducesAnnotation() != null || getPreDestroyMethod() != null || getPostConstructorMethod() != null;
 	}
 
 	public AnnotationDeclaration getProducesAnnotation() {
 		return annotationsByType.get(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
 	}
 
+	public AnnotationDeclaration getPreDestroyMethod() {
+		return annotationsByType.get(CDIConstants.PRE_DESTROY_TYPE_NAME);
+	}
+
+	public AnnotationDeclaration getPostConstructorMethod() {
+		return annotationsByType.get(CDIConstants.POST_CONSTRUCTOR_TYPE_NAME);
+	}
+
 	public AnnotationDeclaration getInjectAnnotation() {
 		return annotationsByType.get(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
 	}
@@ -31,5 +50,4 @@
 	public AnnotationDeclaration getDelegateAnnotation() {
 		return annotationsByType.get(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME);
 	}
-
-}
+}
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1,5 +1,5 @@
 /******************************************************************************* 
- * Copyright (c) 2007 Red Hat, Inc. 
+ * Copyright (c) 2009 Red Hat, Inc. 
  * Distributed under license by Red Hat, Inc. All rights reserved. 
  * This program is made available under the terms of the 
  * Eclipse Public License v1.0 which accompanies this distribution, 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -72,7 +72,7 @@
 	 * 
 	 * @see org.jboss.tools.cdi.core.IAnnotated#getAnnotations()
 	 */
-	public List<AnnotationDeclaration> getAnnotations() {
+	public List<IAnnotationDeclaration> getAnnotations() {
 		return Collections.emptyList();
 	}
 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -19,6 +19,7 @@
 import org.eclipse.jdt.core.IMethod;
 import org.eclipse.jdt.core.IType;
 import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
 import org.jboss.tools.cdi.internal.core.impl.ParametedType;
 
@@ -40,7 +41,7 @@
 	protected void init(IType contextType, DefinitionContext context) throws CoreException {
 		super.init(contextType, context);
 		isAbstract = Flags.isAbstract(type.getFlags());
-		for (AnnotationDeclaration a: annotations) {
+		for (IAnnotationDeclaration a: annotations) {
 			//provide initialization
 			context.getAnnotationKind(a.getType());
 		}

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -347,7 +347,7 @@
 		}
 
 		if (bean instanceof IClassBean) {
-			Set<IInterceptorBindingDeclaration> bindingDeclarations = ((IClassBean) bean).getInterceptorBindings();
+			Set<IInterceptorBindingDeclaration> bindingDeclarations = ((IClassBean) bean).getInterceptorBindingDeclarations();
 			for (IInterceptorBindingDeclaration bindingDeclaration : bindingDeclarations) {
 				IInterceptorBinding binding = bindingDeclaration.getInterceptorBinding();
 				if (!binding.getSourceType().isReadOnly()) {
@@ -1253,12 +1253,52 @@
 		 * 9.2. Declaring the interceptor bindings of an interceptor
 		 *  - interceptor declared using @Interceptor does not declare any interceptor binding (Non-Portable behavior)
 		 */
-		Set<IInterceptorBindingDeclaration> bindings = interceptor.getInterceptorBindings();
+		Set<IInterceptorBinding> bindings = interceptor.getInterceptorBindings();
 		if(bindings.isEmpty()) {
 			ITextSourceReference declaration = interceptor.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
 			if(declaration!=null) {
 				addError(CDIValidationMessages.MISSING_INTERCEPTOR_BINDING, CDIPreferences.MISSING_INTERCEPTOR_BINDING, declaration, interceptor.getResource());
 			}
+		} else {
+			/*
+			 * 9.2. Declaring the interceptor bindings of an interceptor
+			 *  - interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
+			 */
+			for (IInterceptorBinding binding : bindings) {
+				boolean markedAsWrong = false;
+				IAnnotationDeclaration target = binding.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+				if(target!=null) {
+					try {
+						IMemberValuePair[] ps = target.getDeclaration().getMemberValuePairs();
+						if (ps != null && ps.length==1) {
+							IMemberValuePair pair = ps[0];
+							Object value = pair.getValue();
+							if(value != null && value instanceof Object[]) {
+								Object[] values = (Object[]) value;
+								if(values.length>1) {
+									Set<IBeanMethod> methods = interceptor.getAllMethods();
+									for (IBeanMethod method : methods) {
+										if(method.isLifeCycleCallbackMethod()) {
+											ITextSourceReference declaration = CDIUtil.getAnnotationDeclaration(interceptor, binding);
+											if(declaration==null) {
+												declaration = interceptor.getInterceptorAnnotation();
+											}
+											addError(CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, declaration, interceptor.getResource());
+											markedAsWrong = true;
+											break;
+										}
+									}
+								}
+							}
+						}
+					} catch (JavaModelException e) {
+						CDICorePlugin.getDefault().logError(e);
+					}
+				}
+				if(markedAsWrong) {
+					break;
+				}
+			}
 		}
 	}
 

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties	2010-06-30 16:50:48 UTC (rev 23127)
@@ -69,7 +69,7 @@
 ILLEGAL_INJECTION_POINT_DELEGATE=Injection point that is a producer method parameter cannot be annotated @Delegate [JSR-299 §8.1.2]
 ILLEGAL_BEAN_DECLARING_DELEGATE=Bean class that is not a decorator cannot have an injection point annotated @Delegate [JSR-299 §8.1.2]
 DELEGATE_HAS_ILLEGAL_TYPE=The delegate type must implement or extend the decorated type {0} [JSR-299 §8.1.3]
-ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING=Interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
+ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING=Interceptor for lifecycle callbacks may only declare interceptor binding types that are defined as @Target(TYPE) [JSR-299 §9.2] 
 ILLEGAL_INTERCEPTOR_BINDING_METHOD=Non-static, non-private, final method of a managed bean has a interceptor binding (either method level, or declaring class level)
 CONFLICTING_INTERCEPTOR_BINDINGS=The set of interceptor bindings of a bean or interceptor, including bindings inherited from stereotypes and other interceptor bindings, has two instances of a certain interceptor binding type and the instances have different values of some annotation member
 OBSERVER_IN_INTERCEPTOR_OR_DECORATOR=Interceptor or decorator has a method with a parameter annotated @Observes

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -112,7 +112,7 @@
 				{CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectionPointDelegate_label},
 				{CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalBeanDeclaringDelegate_label},
 				{CDIPreferences.DELEGATE_HAS_ILLEGAL_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_delegateHasIllegalType_label},
-//				{CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalLifecycleCallbackInterceptorBinding_label},
+				{CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalLifecycleCallbackInterceptorBinding_label},
 //				{CDIPreferences.ILLEGAL_INTERCEPTOR_BINDING_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInterceptorBindingMethod_label},
 //				{CDIPreferences.CONFLICTING_INTERCEPTOR_BINDINGS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingInterceptorBindings_label},
 //				{CDIPreferences.OBSERVER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerInInterceptorOrDecorator_label},

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.Interceptor;
+
+ at TypeInterceptorBinding
+ at Interceptor
+public class InterceptorWithLifeCycleMethodOk {
+
+    @PostConstruct
+    public void initialize() {
+    }
+
+	@PreDestroy
+	public void destroy() {
+	}
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.Interceptor;
+
+ at Interceptor
+ at InterceptorStereotype
+public class InterceptorWithPostConstructorBroken {
+
+    @PostConstruct
+    public void initialize() {
+    }
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import javax.annotation.PreDestroy;
+import javax.interceptor.Interceptor;
+
+ at Interceptor
+ at CatInterceptorBinding
+public class InterceptorWithPreDestroyBroken {
+
+	@PreDestroy
+	public void destroy() {		
+	}
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/TypeInterceptorBinding.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/TypeInterceptorBinding.java	                        (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/TypeInterceptorBinding.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+ at InterceptorBinding
+ at Inherited
+ at Target({ TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface TypeInterceptorBinding {
+
+}
\ No newline at end of file


Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/TypeInterceptorBinding.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/beans.xml	2010-06-30 16:50:48 UTC (rev 23127)
@@ -6,5 +6,8 @@
       <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.AlternativeInterceptorBroken</class>
       <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.CatInterceptor</class>
       <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.NoInterceptorBinfdingsInInterceptor</class>
+      <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.InterceptorWithLifeCycleMethodOk</class>
+      <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.InterceptorWithPostConstructorBroken</class>
+      <class>org.jboss.jsr299.tck.tests.jdt.validation.interceptors.InterceptorWithPreDestroyBroken</class>
    </interceptors>
 </beans>
\ No newline at end of file

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -32,6 +32,6 @@
 		IBean bean = beans.iterator().next();
 		assertTrue("The bean should be an interceptor", bean instanceof IClassBean);
 		IClassBean interceptor = (IClassBean)bean;
-		assertFalse("The intercpetor should inherites interceptor bindings", interceptor.getInterceptorBindings().isEmpty());
+		assertFalse("The intercpetor should inherites interceptor bindings", interceptor.getInterceptorBindingDeclarations().isEmpty());
 	}
 }
\ No newline at end of file

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -22,6 +22,7 @@
 import org.jboss.tools.cdi.core.CDICorePlugin;
 import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIAnnotation;
 import org.jboss.tools.cdi.core.ICDIProject;
 import org.jboss.tools.cdi.core.IClassBean;
 import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -182,6 +183,10 @@
 			public int getStartPosition() {
 				return 0;
 			}
+
+			public ICDIAnnotation getAnnotation() {
+				return null;
+			}
 		};
 		return annotationDeclaration;
 	}

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java	2010-06-30 15:40:58 UTC (rev 23126)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java	2010-06-30 16:50:48 UTC (rev 23127)
@@ -1170,6 +1170,43 @@
 	}
 
 	/**
+	 * 9.2. Declaring the interceptor bindings of an interceptor
+	 *  - interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
+	 *    @PreDestroy
+	 * 
+	 * @throws Exception
+	 */
+	public void testInterceptorBinfdingsInInterceptorWithPreDestroyBroken() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InterceptorWithPreDestroyBroken.java");
+		assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, 7);
+	}
+
+	/**
+	 * 9.2. Declaring the interceptor bindings of an interceptor
+	 *  - interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
+	 *    @PostConstruct
+	 * 
+	 * @throws Exception
+	 */
+	public void testInterceptorBinfdingsInInterceptorWithPostConstructBroken() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InterceptorWithPostConstructorBroken.java");
+		assertMarkerIsCreated(file, CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, 7);
+	}
+
+	/**
+	 * 9.2. Declaring the interceptor bindings of an interceptor
+	 *  - interceptor for lifecycle callbacks declares an interceptor binding type that is defined @Target({TYPE, METHOD})
+	 * 
+	 * @throws Exception
+	 */
+	public void testInterceptorBinfdingsInInterceptorWithLifeCycleMethodOk() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InterceptorWithLifeCycleMethodOk.java");
+		assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING);
+		file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/CatInterceptor.java");
+		assertMarkerIsNotCreated(file, CDIValidationMessages.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING);
+	}
+
+	/**
 	 * 10.4.2. Declaring an observer method
 	 *  - method has more than one parameter annotated @Observes
 	 *  
@@ -1245,6 +1282,6 @@
 	}
 
 	private static String convertMessageToPatern(String message) {
-		return message.replace("[", "\\[").replace("]", "\\]").replace("<", "\\<").replace(">", "\\>");
+		return message.replace("[", "\\[").replace("]", "\\]").replace("<", "\\<").replace(">", "\\>").replace("(", "\\(").replace(")", "\\)");
 	}
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list