Author: akazakov
Date: 2010-07-01 19:33:27 -0400 (Thu, 01 Jul 2010)
New Revision: 23165
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/SimpleAnnotation.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.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/CDIProject.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/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
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/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new validation rules:
- Array-valued member of an interceptor binding type is not annotated @Nonbinding
- Anotation-valued member of an interceptor binding type is not annotated @Nonbinding
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -209,6 +209,14 @@
IInterceptorBinding getInterceptorBinding(String qualifiedName);
/**
+ * Returns the interceptor binding type by resource path.
+ *
+ * @param resource path
+ * @return interceptor binding type by resource path
+ */
+ IInterceptorBinding getInterceptorBinding(IPath path);
+
+ /**
* Returns qualifier model element for fully qualified name
* of qualifier annotation type
* @param qualifiedName
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -45,5 +45,6 @@
defaultPreferences.put(CDIPreferences.INJECTED_DECORATOR, CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferences.WARNING);
defaultPreferences.put(CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING,
CDIPreferences.WARNING);
+ defaultPreferences.put(CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
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/CDIProject.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -67,6 +67,7 @@
private Map<String, StereotypeElement> stereotypes = new HashMap<String,
StereotypeElement>();
private Map<IPath, StereotypeElement> stereotypesByPath = new HashMap<IPath,
StereotypeElement>();
private Map<String, InterceptorBindingElement> interceptorBindings = new
HashMap<String, InterceptorBindingElement>();
+ private Map<IPath, InterceptorBindingElement> interceptorBindingsByPath = new
HashMap<IPath, InterceptorBindingElement>();
private Map<String, QualifierElement> qualifiers = new HashMap<String,
QualifierElement>();
private Map<IPath, QualifierElement> qualifiersByPath = new HashMap<IPath,
QualifierElement>();
private Map<String, ScopeElement> scopes = new HashMap<String,
ScopeElement>();
@@ -728,14 +729,17 @@
return result;
}
+ @Override
public CDIProject getCDIProject() {
return this;
}
+ @Override
public IResource getResource() {
return n.getProject();
}
+ @Override
public IPath getSourcePath() {
return n.getProject().getFullPath();
}
@@ -764,6 +768,14 @@
return interceptorBindings.get(qualifiedName);
}
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.cdi.core.IBeanManager#getInterceptorBinding(org.eclipse.core.runtime.IPath)
+ */
+ public IInterceptorBinding getInterceptorBinding(IPath path) {
+ return interceptorBindingsByPath.get(path);
+ }
+
public QualifierElement getQualifier(String qualifiedName) {
return qualifiers.get(qualifiedName);
}
@@ -794,6 +806,7 @@
interceptorBindings.clear();
qualifiers.clear();
qualifiersByPath.clear();
+ interceptorBindingsByPath.clear();
scopes.clear();
List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
for (AnnotationDefinition d: ds) {
@@ -808,6 +821,9 @@
InterceptorBindingElement s = new InterceptorBindingElement();
initAnnotationElement(s, d);
interceptorBindings.put(d.getQualifiedName(), s);
+ if(d.getResource() != null && d.getResource().getFullPath() != null) {
+ interceptorBindingsByPath.put(d.getResource().getFullPath(), s);
+ }
} else if(d.getKind() == AnnotationDefinition.QUALIFIER) {
QualifierElement s = new QualifierElement();
initAnnotationElement(s, d);
@@ -1024,7 +1040,7 @@
try {
type = EclipseJavaUtil.findType(EclipseUtil.getJavaProject(getNature().getProject()),
fullyQualifiedBeanType);
} catch (JavaModelException e) {
- //ignore
+ CDICorePlugin.getDefault().logError(e);
}
if(type == null) {
return Collections.emptySet();
@@ -1035,7 +1051,7 @@
try {
type = EclipseJavaUtil.findType(EclipseUtil.getJavaProject(getNature().getProject()),
s);
} catch (JavaModelException e) {
- //ignore
+ CDICorePlugin.getDefault().logError(e);
}
if(type != null) qualifiers.add(type);
}
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -86,8 +86,8 @@
} else if(AnnotationHelper.CDI_ANNOTATION_TYPES.contains(qualifiedName)) {
kind = AnnotationDefinition.CDI;
}
-
- if(kind == QUALIFIER) {
+
+ if(kind == QUALIFIER || kind == INTERCEPTOR_BINDING) {
initMemberDefinitions(contextType, context);
}
}
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -46,6 +46,7 @@
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanMethod;
+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.IDecorator;
@@ -264,6 +265,11 @@
for (IQualifier qualifier : qualifiers) {
validateQualifier(qualifier);
}
+
+ IInterceptorBinding[] bindings = cdiProject.getInterceptorBindings();
+ for (IInterceptorBinding binding : bindings) {
+ validateInterceptorBinding(binding);
+ }
return OK_STATUS;
}
@@ -286,6 +292,9 @@
IQualifier qualifier = cdiProject.getQualifier(file.getFullPath());
validateQualifier(qualifier);
+
+ IInterceptorBinding binding = cdiProject.getInterceptorBinding(file.getFullPath());
+ validateInterceptorBinding(binding);
}
/**
@@ -1759,16 +1768,36 @@
* 5.2.5. Qualifier annotations with members
* - array-valued or annotation-valued member of a qualifier type is not annotated
@Nonbinding (Non-Portable behavior)
*/
- IType type = qualifier.getSourceType();
+ validateAnnotationMembers(qualifier,
CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER,
CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER,
CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER);
+ }
+
+ private void validateInterceptorBinding(IInterceptorBinding binding) {
+ if(binding==null) {
+ return;
+ }
+ IResource resource = binding.getResource();
+ if (resource == null || !resource.getName().toLowerCase().endsWith(".java"))
{
+ // validate sources only
+ return;
+ }
+ /*
+ * 9.5.2. Interceptor binding types with members
+ * array-valued or annotation-valued member of an interceptor binding type is not
annotated @Nonbinding (Non-Portable behavior)
+ */
+ validateAnnotationMembers(binding,
CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER);
+ }
+
+ private void validateAnnotationMembers(ICDIAnnotation annotation, String
arrayMessageErrorKey, String annotationValueErrorKey, String preferencesKey) {
+ IType type = annotation.getSourceType();
try {
IMethod[] methods = type.getMethods();
for (IMethod method : methods) {
String returnTypeSignature = method.getReturnType();
int kind = Signature.getTypeSignatureKind(returnTypeSignature);
if(kind == Signature.ARRAY_TYPE_SIGNATURE) {
- if(!qualifier.getNonBindingMethods().contains(method)) {
+ if(!annotation.getNonBindingMethods().contains(method)) {
ITextSourceReference reference =
CDIUtil.convertToSourceReference(method.getNameRange());
- addError(CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER,
CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, reference,
qualifier.getResource());
+ addError(arrayMessageErrorKey, preferencesKey, reference,
annotation.getResource());
}
} else if(kind == Signature.CLASS_TYPE_SIGNATURE) {
String typeName = Signature.getSignatureSimpleName(returnTypeSignature);
@@ -1781,9 +1810,9 @@
if(typeName!=null) {
IType memberType = type.getJavaProject().findType(typeName);
if(memberType!=null && memberType.isAnnotation()) {
- if(!qualifier.getNonBindingMethods().contains(method)) {
+ if(!annotation.getNonBindingMethods().contains(method)) {
ITextSourceReference reference =
CDIUtil.convertToSourceReference(method.getNameRange());
- addError(CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER,
CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, reference,
qualifier.getResource());
+ addError(annotationValueErrorKey, preferencesKey, reference,
annotation.getResource());
}
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-07-01
23:33:27 UTC (rev 23165)
@@ -169,9 +169,6 @@
- non-static, non-private, final method of a managed bean has a method level
interceptor binding
-
-
-
9.5.2. Interceptor binding types with members
- the set of interceptor bindings of a bean or interceptor, including bindings
inherited from stereotypes and other interceptor bindings, has two instances
@@ -180,8 +177,6 @@
- array-valued or annotation-valued member of an interceptor binding type
is not annotated @Nonbinding (Non-Portable behavior)
-
-
10.4.2. Declaring an observer method
- method has more than one parameter annotated @Observes
- observer method is annotated @Produces or @Inject or has a parameter annotated
@Disposes
@@ -189,6 +184,8 @@
and the method is not a business method of the EJB
- interceptor or decorator has a method with a parameter annotated @Observes
+
+
10.4.3. Conditional observer methods
- bean with scope @Dependent has an observer method declared receive=IF_EXISTS
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-07-01
23:33:27 UTC (rev 23165)
@@ -17,10 +17,10 @@
INJECTION_TYPE_IS_VARIABLE=Injection point type is a type variable
INJECT_RESOLVES_TO_NULLABLE_BEAN=Injection point of primitive type resolves to the bean
that may have a null value
STEREOTYPE_IS_ANNOTATED_TYPED=Stereotype is annotated @Typed
-MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER=Annotation-valued member
of a qualifier type is not annotated @Nonbinding
-MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER=Array-valued member of a
qualifier type is not annotated @Nonbinding
-MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Annotation-valued
member of an interceptor binding type is not annotated @Nonbinding
-MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Array-valued member
of an interceptor binding type is not annotated @Nonbinding
+MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_QUALIFIER_TYPE_MEMBER=Annotation-valued member
of a qualifier type should be annotated @Nonbinding [JSR-299 �5.2.5]
+MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_QUALIFIER_TYPE_MEMBER=Array-valued member of a
qualifier type should be annotated @Nonbinding [JSR-299 �5.2.5]
+MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Annotation-valued
member of an interceptor binding type should be annotated @Nonbinding [JSR-299 �9.5.2]
+MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER=Array-valued member
of an interceptor binding type should be annotated @Nonbinding [JSR-299 �9.5.2]
MULTIPLE_SCOPE_TYPE_ANNOTATIONS=Bean class or producer method or field specifies multiple
scope type annotations
MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE=Bean does not explicitly declare a scope
when there is no default scope
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -54,7 +54,7 @@
{CDIPreferences.INJECTION_TYPE_IS_VARIABLE,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectionTypeIsVariable_label},
{CDIPreferences.STEREOTYPE_IS_ANNOTATED_TYPED,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label},
{CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label},
-// {CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label},
+ {CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label},
},
CDICorePlugin.PLUGIN_ID
);
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -0,0 +1,23 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors.members;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.interceptor.InterceptorBinding;
+
+@Inherited
+@InterceptorBinding
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@interface InterceptorBindingMemberBroken {
+ SimpleAnnotation memberBroken();
+ @Nonbinding SimpleAnnotation member();
+ String[] pricesBroken();
+ @Nonbinding String[] prices();
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/SimpleAnnotation.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/SimpleAnnotation.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/SimpleAnnotation.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors.members;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@interface SimpleAnnotation {}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/members/SimpleAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-07-01
23:31:43 UTC (rev 23164)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-07-01
23:33:27 UTC (rev 23165)
@@ -1289,6 +1289,30 @@
}
/**
+ * 9.5.2. Interceptor binding types with members
+ * - annotation-valued member of an interceptor binding type is not annotated
@Nonbinding (Non-Portable behavior)
+ *
+ * @throws Exception
+ */
+ public void testAnnotationTypeMemberWithoutNonBindingInInterceptorByndingType() throws
Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java");
+ assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
19);
+ assertMarkerIsNotCreated(file,
CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
20);
+ }
+
+ /**
+ * 9.5.2. Interceptor binding types with members
+ * - array-valued member of an interceptor binding type is not annotated @Nonbinding
(Non-Portable behavior)
+ *
+ * @throws Exception
+ */
+ public void testArrayTypeMemberWithoutNonBindingInInterceptorByndingType() throws
Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/members/InterceptorBindingMemberBroken.java");
+ assertMarkerIsCreated(file,
CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
21);
+ assertMarkerIsNotCreated(file,
CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER,
22);
+ }
+
+ /**
* 10.4.2. Declaring an observer method
* - method has more than one parameter annotated @Observes
*