JBoss Tools SVN: r22205 - trunk/documentation/guides/JBDS_Release_Notes/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-05-19 21:59:31 -0400 (Wed, 19 May 2010)
New Revision: 22205
Modified:
trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
Log:
updated release notes with new fixed issues
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-05-19 19:41:00 UTC (rev 22204)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-05-20 01:59:31 UTC (rev 22205)
@@ -189,6 +189,11 @@
</listitem>
<listitem>
<para>
+ <ulink url="http://jira.jboss.com/jira/browse/JBDS-1181">JBDS-1181</ulink>: When creating a <guilabel>New Process Project</guilabel> the <guilabel>Configure JBoss jBPM Runtime</guilabel> screen included a link to <guilabel>Download the JBoss jBPM package if you have none available yet.</guilabel> that would direct users to a location that did not exist. For the previous release a redirect was created after this issue was found that directed a user to the sourceforge location of the files. This version of the JBoss Developer Studio sees the removal of the link.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<ulink url="http://jira.jboss.com/jira/browse/JBDS-1168">JBDS-1168</ulink>: The JBoss Developer Studio Installer was missleading in terms of system requirements. The consequence of this was that some users were unsure if the JBoss Developer Studio supported Java 6 even though it was required for the JBoss Enterprise Application Platform 5 and which JDK distributions were supported. The text in Step 4 of installation has been updated to inform the user that the JBoss Developer Studio works with both Java 5 and 6 (though Java 6 is required for JBoss Enterprise Application Platform 5), has been tested with the OpenJDK, SunJDK and IBM JDK distributions and the misspelt <emphasis>gij Java</emphasis> has been corrected to <emphasis>gcj Java</emphasis>.
</para>
</listitem>
15 years, 11 months
JBoss Tools SVN: r22204 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-19 15:41:00 -0400 (Wed, 19 May 2010)
New Revision: 22204
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java
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/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.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 CDI validation rule: 1. Producer method or fiels is annotated @Inject; 2. Non-static method of a session bean class is annotated @Produces, and the method is not a business method of the session bean; 3. Interceptor declares has a producer field or method.; 4. Decorator declares has a producer field or method.
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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -17,11 +17,16 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.IKbProject;
@@ -303,4 +308,55 @@
public static boolean isInterceptor(IBean bean) {
return bean instanceof IInterceptor || (bean instanceof IClassBean && bean.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME)!=null);
}
+
+ /**
+ * Returns false if the method is a non-static method of the session bean class, and the method is not a business method of the session bean.
+ *
+ * @param bean
+ * @param method
+ * @return
+ */
+ public static boolean isBusinessMethod(ISessionBean bean, IBeanMethod method) {
+ return getBusinessMethodDeclaration(bean, method)!=null;
+ }
+
+ /**
+ * Returns IMethod of @Local interface which is implemented by given business method.
+ * Returns null if the method is a non-static method of the session bean class, and the method is not a business method of the session bean.
+ * If the method is a static one then returns this method.
+ *
+ * @param bean
+ * @param method
+ * @return
+ */
+ public static IMethod getBusinessMethodDeclaration(ISessionBean bean, IBeanMethod method) {
+ try {
+ if (!Flags.isStatic(method.getMethod().getFlags())) {
+ Set<IParametedType> types = bean.getLegalTypes();
+ for (IParametedType type : types) {
+ IType sourceType = type.getType();
+ if (sourceType == null) {
+ continue;
+ }
+ IAnnotation annotation = sourceType.getAnnotation(CDIConstants.LOCAL_ANNOTATION_TYPE_NAME);
+ if (annotation == null) {
+ annotation = sourceType.getAnnotation("Local"); //$NON-NLS-N1
+ }
+ if (annotation != null && CDIConstants.LOCAL_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(sourceType, "Local"))) { //$NON-NLS-N1
+ IMethod[] methods = sourceType.getMethods();
+ for (IMethod iMethod : methods) {
+ if (method.getMethod().isSimilar(iMethod)) {
+ return iMethod;
+ }
+ }
+ break;
+ }
+ }
+ return null;
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ return method.getMethod();
+ }
}
\ No newline at end of file
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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.cdi.internal.core.validation;
import java.util.ArrayList;
@@ -27,7 +27,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
@@ -63,7 +62,7 @@
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.cdi.internal.core.impl.SessionBean;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
@@ -87,6 +86,7 @@
/*
* (non-Javadoc)
+ *
* @see org.jboss.tools.jst.web.kb.validation.IValidator#getId()
*/
public String getId() {
@@ -95,44 +95,50 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#getValidatingProjects(org.eclipse.core.resources.IProject)
+ *
+ * @see
+ * org.jboss.tools.jst.web.kb.validation.IValidator#getValidatingProjects
+ * (org.eclipse.core.resources.IProject)
*/
public IValidatingProjectSet getValidatingProjects(IProject project) {
IValidationContext rootContext = null;
- IProject war = null; //TODO get war ?
- if(war != null && war.isAccessible()) {
+ IProject war = null; // TODO get war ?
+ if (war != null && war.isAccessible()) {
IKbProject kbProject = KbProjectFactory.getKbProject(war, false);
- if(kbProject!=null) {
+ if (kbProject != null) {
rootContext = kbProject.getValidationContext();
} else {
KbProject.checkKBBuilderInstalled(war);
CDICoreNature cdiProject = CDICorePlugin.getCDI(project, false);
- if(cdiProject != null) {
- rootContext = null; //cdiProject.getDelegate().getValidationContext();
+ if (cdiProject != null) {
+ rootContext = null; // cdiProject.getDelegate().getValidationContext();
}
}
}
- if(rootContext == null) {
+ if (rootContext == null) {
CDICoreNature cdiProject = CDICorePlugin.getCDI(project, false);
- if(cdiProject != null) {
+ if (cdiProject != null) {
rootContext = cdiProject.getValidationContext();
}
}
List<IProject> projects = new ArrayList<IProject>();
projects.add(project);
-// IProject[] array = set.getAllProjects();
-// for (int i = 0; i < array.length; i++) {
-// if(array[i].isAccessible()) {
-// projects.add(array[i]);
-// }
-// }
+ // IProject[] array = set.getAllProjects();
+ // for (int i = 0; i < array.length; i++) {
+ // if(array[i].isAccessible()) {
+ // projects.add(array[i]);
+ // }
+ // }
return new ValidatingProjectSet(project, projects, rootContext);
}
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
+ *
+ * @see
+ * org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse
+ * .core.resources.IProject)
*/
public boolean shouldValidate(IProject project) {
try {
@@ -146,10 +152,18 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter, org.jboss.tools.jst.web.kb.validation.IValidationContext)
+ *
+ * @see
+ * org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager
+ * #init(org.eclipse.core.resources.IProject,
+ * org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper,
+ * org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager,
+ * org.eclipse.wst.validation.internal.provisional.core.IReporter,
+ * org.jboss.tools.jst.web.kb.validation.IValidationContext)
*/
@Override
- public void init(IProject project, ContextValidationHelper validationHelper, org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
+ public void init(IProject project, ContextValidationHelper validationHelper, org.eclipse.wst.validation.internal.provisional.core.IValidator manager,
+ IReporter reporter) {
super.init(project, validationHelper, manager, reporter);
cdiProject = CDICorePlugin.getCDIProject(project, false);
projectName = project.getName();
@@ -157,29 +171,36 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set, org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ *
+ * @see
+ * org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set,
+ * org.eclipse.core.resources.IProject,
+ * org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper,
+ * org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager,
+ * org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
- public IStatus validate(Set<IFile> changedFiles, IProject project,
- ContextValidationHelper validationHelper, ValidatorManager manager,
- IReporter reporter) throws ValidationException {
+ public IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter)
+ throws ValidationException {
init(project, validationHelper, manager, reporter);
displaySubtask(CDIValidationMessages.SEARCHING_RESOURCES);
- if(cdiProject == null) {
+ if (cdiProject == null) {
return OK_STATUS;
}
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- Set<IPath> resources = new HashSet<IPath>(); // Resources which we have to validate.
- for(IFile currentFile : changedFiles) {
- if(reporter.isCancelled()) {
+ Set<IPath> resources = new HashSet<IPath>(); // Resources which we have
+ // to validate.
+ for (IFile currentFile : changedFiles) {
+ if (reporter.isCancelled()) {
break;
}
if (ValidationUtil.checkFileExtensionForJavaAndXml(currentFile)) {
resources.add(currentFile.getFullPath());
- // Get all the paths of related resources for given file. These links were saved in previous validation process.
+ // Get all the paths of related resources for given file. These
+ // links were saved in previous validation process.
Set<String> oldReletedResources = validationContext.getVariableNamesByCoreResource(currentFile.getFullPath(), false);
- if(oldReletedResources!=null) {
+ if (oldReletedResources != null) {
for (String resourcePath : oldReletedResources) {
resources.add(Path.fromOSString(resourcePath));
}
@@ -187,7 +208,8 @@
}
}
// Validate all collected linked resources.
- // Remove all links between collected resources because they will be linked again during validation.
+ // Remove all links between collected resources because they will be
+ // linked again during validation.
validationContext.removeLinkedCoreResources(resources);
IFile[] filesToValidate = new IFile[resources.size()];
@@ -208,16 +230,21 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ *
+ * @see
+ * org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse
+ * .core.resources.IProject,
+ * org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper,
+ * org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager,
+ * org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
- public IStatus validateAll(IProject project,
- ContextValidationHelper validationHelper, ValidatorManager manager,
- IReporter reporter) throws ValidationException {
+ public IStatus validateAll(IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter)
+ throws ValidationException {
init(project, validationHelper, manager, reporter);
- if(cdiProject == null) {
+ if (cdiProject == null) {
return OK_STATUS;
}
- displaySubtask(CDIValidationMessages.VALIDATING_PROJECT, new String[]{projectName});
+ displaySubtask(CDIValidationMessages.VALIDATING_PROJECT, new String[] { projectName });
removeAllMessagesFromResource(cdiProject.getNature().getProject());
IBean[] beans = cdiProject.getBeans();
for (IBean bean : beans) {
@@ -225,7 +252,7 @@
}
IStereotype[] stereoTypes = cdiProject.getStereotypes();
- for (IStereotype type: stereoTypes) {
+ for (IStereotype type : stereoTypes) {
validateStereotype(type);
}
@@ -238,7 +265,7 @@
* @param file
*/
private void validateResource(IFile file) {
- if(reporter.isCancelled() || file==null || !file.isAccessible()) {
+ if (reporter.isCancelled() || file == null || !file.isAccessible()) {
return;
}
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
@@ -255,26 +282,26 @@
* @param bean
*/
private void validateBean(IBean bean) {
- if(reporter.isCancelled()) {
+ if (reporter.isCancelled()) {
return;
}
// Collect all relations between the bean and other CDI elements.
String name = bean.getName();
- if(name!=null) {
+ if (name != null) {
validationContext.addVariableNameForELValidation(name);
}
String beanPath = bean.getResource().getFullPath().toOSString();
Set<IScopeDeclaration> scopeDeclarations = bean.getScopeDeclarations();
for (IScopeDeclaration scopeDeclaration : scopeDeclarations) {
IScope scope = scopeDeclaration.getScope();
- if(!scope.getSourceType().isReadOnly()) {
+ if (!scope.getSourceType().isReadOnly()) {
validationContext.addLinkedCoreResource(beanPath, scope.getResource().getFullPath(), false);
}
}
Set<IStereotypeDeclaration> stereotypeDeclarations = bean.getStereotypeDeclarations();
for (IStereotypeDeclaration stereotypeDeclaration : stereotypeDeclarations) {
IStereotype stereotype = stereotypeDeclaration.getStereotype();
- if(!stereotype.getSourceType().isReadOnly()) {
+ if (!stereotype.getSourceType().isReadOnly()) {
validationContext.addLinkedCoreResource(beanPath, stereotype.getResource().getFullPath(), false);
}
}
@@ -283,8 +310,8 @@
validateTyped(bean);
validateBeanScope(bean);
- if(bean instanceof IProducer) {
- validateProducer((IProducer)bean);
+ if (bean instanceof IProducer) {
+ validateProducer((IProducer) bean);
}
Set<IInjectionPoint> points = bean.getInjectionPoints();
@@ -292,51 +319,53 @@
validateInjectionPoint(point);
}
- if(bean instanceof IInterceptor) {
- validateInterceptor((IInterceptor)bean);
+ if (bean instanceof IInterceptor) {
+ validateInterceptor((IInterceptor) bean);
}
- if(bean instanceof IDecorator) {
- validateDecorator((IDecorator)bean);
+ if (bean instanceof IDecorator) {
+ validateDecorator((IDecorator) bean);
}
- if(bean instanceof IClassBean) {
- validateClassBean((IClassBean)bean);
+ if (bean instanceof IClassBean) {
+ validateClassBean((IClassBean) bean);
}
}
private void validateClassBean(IClassBean bean) {
validateDisposers(bean);
- if(!(bean instanceof ISessionBean)) {
+ if (!(bean instanceof ISessionBean)) {
validateManagedBean(bean);
} else {
- validateSessionBean((ISessionBean)bean);
+ validateSessionBean((ISessionBean) bean);
}
validateMixedClassBean(bean);
}
private void validateDisposers(IClassBean bean) {
Set<IBeanMethod> disposers = bean.getDisposers();
- if(disposers.isEmpty()) {
+ if (disposers.isEmpty()) {
return;
}
Set<IBeanMethod> boundDisposers = new HashSet<IBeanMethod>();
Set<IProducer> producers = bean.getProducers();
for (IProducer producer : producers) {
- if(producer instanceof IProducerMethod) {
- IProducerMethod producerMethod = (IProducerMethod)producer;
- Set<IBeanMethod> disposerMethods = producer.getCDIProject().resolveDisposers(producerMethod);
+ if (producer instanceof IProducerMethod) {
+ IProducerMethod producerMethod = (IProducerMethod) producer;
+ Set<IBeanMethod> disposerMethods = producer.getCDIProject().resolveDisposers(producerMethod);
boundDisposers.addAll(disposerMethods);
- if(disposerMethods.size()>1) {
+ if (disposerMethods.size() > 1) {
/*
- * 3.3.7. Disposer method resolution
- * - there are multiple disposer methods for a single producer method
+ * 3.3.7. Disposer method resolution - there are multiple
+ * disposer methods for a single producer method
*/
for (IBeanMethod disposerMethod : disposerMethods) {
- Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod,
+ CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
for (ITextSourceReference declaration : disposerDeclarations) {
- addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean.getResource());
+ addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean
+ .getResource());
}
}
}
@@ -347,54 +376,55 @@
List<IParameter> params = disposer.getParameters();
/*
- * 3.3.6. Declaring a disposer method
- * - method has more than one parameter annotated @Disposes
+ * 3.3.6. Declaring a disposer method - method has more than one
+ * parameter annotated @Disposes
*/
Set<ITextSourceReference> disposerDeclarations = new HashSet<ITextSourceReference>();
for (IParameter param : params) {
ITextSourceReference declaration = param.getAnnotationPosition(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
- if(declaration!=null) {
+ if (declaration != null) {
disposerDeclarations.add(declaration);
}
}
- if(disposerDeclarations.size()>1) {
+ if (disposerDeclarations.size() > 1) {
for (ITextSourceReference declaration : disposerDeclarations) {
addError(CDIValidationMessages.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, declaration, bean.getResource());
}
}
/*
- * 3.3.6. Declaring a disposer method
- * - a disposer method has a parameter annotated @Observes.
- *
- * 10.4.2. Declaring an observer method
- * - a observer method has a parameter annotated @Disposes.
+ * 3.3.6. Declaring a disposer method - a disposer method has a
+ * parameter annotated @Observes.
+ *
+ * 10.4.2. Declaring an observer method - a observer method has a
+ * parameter annotated @Disposes.
*/
Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
boolean observesExists = false;
declarations.addAll(disposerDeclarations);
for (IParameter param : params) {
ITextSourceReference declaration = param.getAnnotationPosition(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
- if(declaration!=null) {
+ if (declaration != null) {
declarations.add(declaration);
observesExists = true;
}
}
- if(observesExists) {
+ if (observesExists) {
for (ITextSourceReference declaration : declarations) {
- addError(CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, declaration, bean.getResource());
+ addError(CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, declaration,
+ bean.getResource());
}
}
/*
- * 3.3.6. Declaring a disposer method
- * - a disposer method is annotated @Inject.
- *
- * 3.9.1. Declaring an initializer method
- * - an initializer method has a parameter annotated @Disposes
+ * 3.3.6. Declaring a disposer method - a disposer method is
+ * annotated @Inject.
+ *
+ * 3.9.1. Declaring an initializer method - an initializer method
+ * has a parameter annotated @Disposes
*/
IAnnotationDeclaration injectDeclaration = disposer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
- if(injectDeclaration!=null) {
+ if (injectDeclaration != null) {
addError(CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, CDIPreferences.DISPOSER_ANNOTATED_INJECT, injectDeclaration, bean.getResource());
for (ITextSourceReference declaration : disposerDeclarations) {
addError(CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, CDIPreferences.DISPOSER_ANNOTATED_INJECT, declaration, bean.getResource());
@@ -402,42 +432,48 @@
}
/*
- * 3.3.6. Declaring a disposer method
- * - a non-static method of a session bean class has a parameter annotated @Disposes, and the method is not a business method of the session bean
+ * 3.3.6. Declaring a disposer method - a non-static method of a
+ * session bean class has a parameter annotated @Disposes, and the
+ * method is not a business method of the session bean
*/
- validateSessionBeanMethod(bean, disposer, disposerDeclarations, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN);
+ validateSessionBeanMethod(bean, disposer, disposerDeclarations, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN,
+ CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN);
/*
- * 3.3.6. Declaring a disposer method
- * - decorators may not declare disposer methods
+ * 3.3.6. Declaring a disposer method - decorators may not declare
+ * disposer methods
*/
- if(bean instanceof IDecorator) {
- IDecorator decorator = (IDecorator)bean;
+ if (bean instanceof IDecorator) {
+ IDecorator decorator = (IDecorator) bean;
IAnnotationDeclaration decoratorDeclaration = decorator.getDecoratorAnnotation();
- addError(CDIValidationMessages.DISPOSER_IN_DECORATOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, decoratorDeclaration, bean.getResource());
+ addError(CDIValidationMessages.DISPOSER_IN_DECORATOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, decoratorDeclaration, bean
+ .getResource());
for (ITextSourceReference declaration : disposerDeclarations) {
addError(CDIValidationMessages.DISPOSER_IN_DECORATOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, declaration, bean.getResource());
}
}
/*
- * 3.3.6. Declaring a disposer method
- * - interceptors may not declare disposer methods
+ * 3.3.6. Declaring a disposer method - interceptors may not declare
+ * disposer methods
*/
- if(bean instanceof IInterceptor) {
- IInterceptor interceptor = (IInterceptor)bean;
+ if (bean instanceof IInterceptor) {
+ IInterceptor interceptor = (IInterceptor) bean;
IAnnotationDeclaration interceptorDeclaration = interceptor.getInterceptorAnnotation();
- addError(CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, interceptorDeclaration, bean.getResource());
+ addError(CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, interceptorDeclaration, bean
+ .getResource());
for (ITextSourceReference declaration : disposerDeclarations) {
- addError(CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, declaration, bean.getResource());
+ addError(CDIValidationMessages.DISPOSER_IN_INTERCEPTOR, CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, declaration, bean
+ .getResource());
}
}
/*
- * 3.3.7. Disposer method resolution
- * - there is no producer method declared by the (same) bean class that is assignable to the disposed parameter of a disposer method
+ * 3.3.7. Disposer method resolution - there is no producer method
+ * declared by the (same) bean class that is assignable to the
+ * disposed parameter of a disposer method
*/
- if(!boundDisposers.contains(disposer)) {
+ if (!boundDisposers.contains(disposer)) {
for (ITextSourceReference declaration : disposerDeclarations) {
addError(CDIValidationMessages.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, declaration, bean.getResource());
}
@@ -446,7 +482,8 @@
}
/**
- * If the method is not a static method and is not a business method of the session bean and is observer or disposer then mark it as incorrect.
+ * If the method is not a static method and is not a business method of the
+ * session bean and is observer or disposer then mark it as incorrect.
*
* @param bean
* @param method
@@ -454,109 +491,75 @@
* @param errorKey
*/
private void validateSessionBeanMethod(IClassBean bean, IBeanMethod method, Set<ITextSourceReference> annotatedParams, String errorMessageKey, String preferencesKey) {
- if(bean instanceof ISessionBean) {
- if(annotatedParams!=null) {
- try {
- if(!Flags.isStatic(method.getMethod().getFlags())) {
- ISessionBean sessionBean = (ISessionBean)bean;
- Set<IParametedType> types = sessionBean.getLegalTypes();
- boolean businessMethod = false;
- for (IParametedType type : types) {
- IType sourceType = type.getType();
- if(sourceType==null) {
- continue;
- }
- IAnnotation annotation = sourceType.getAnnotation(CDIConstants.LOCAL_ANNOTATION_TYPE_NAME);
- if(annotation==null) {
- annotation = sourceType.getAnnotation("Local"); //$NON-NLS-N1
- }
- if(annotation!=null && CDIConstants.LOCAL_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(sourceType, "Local"))) { //$NON-NLS-N1
- IMethod[] methods = sourceType.getMethods();
- for (IMethod iMethod : methods) {
- if(method.getMethod().isSimilar(iMethod)) {
- businessMethod = true;
- break;
- }
- }
- break;
- }
- }
- if(!businessMethod) {
- for (ITextSourceReference declaration : annotatedParams) {
- addError(errorMessageKey, preferencesKey, declaration, bean.getResource());
- }
- }
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
+ if (bean instanceof ISessionBean && annotatedParams != null) {
+ IMethod iMethod = CDIUtil.getBusinessMethodDeclaration((SessionBean)bean, method);
+ if(iMethod==null) {
+ saveAllSuperTypesAsLinkedResources(bean);
+ for (ITextSourceReference declaration : annotatedParams) {
+ addError(errorMessageKey, preferencesKey, declaration, bean.getResource());
}
+ } else {
+ validationContext.addLinkedCoreResource(bean.getSourcePath().toOSString(), iMethod.getResource().getFullPath(), false);
}
}
}
- private static final String[] RESOURCE_ANNOTATIONS = {CDIConstants.RESOURCE_ANNOTATION_TYPE_NAME, CDIConstants.WEB_SERVICE_REF_ANNOTATION_TYPE_NAME, CDIConstants.EJB_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_CONTEXT_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_UNIT_ANNOTATION_TYPE_NAME};
+ private static final String[] RESOURCE_ANNOTATIONS = { CDIConstants.RESOURCE_ANNOTATION_TYPE_NAME, CDIConstants.WEB_SERVICE_REF_ANNOTATION_TYPE_NAME, CDIConstants.EJB_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_CONTEXT_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_UNIT_ANNOTATION_TYPE_NAME };
private void validateProducer(IProducer producer) {
try {
- Set<ITypeDeclaration> typeDeclarations = producer
- .getAllTypeDeclarations();
+ Set<ITypeDeclaration> typeDeclarations = producer.getAllTypeDeclarations();
ITypeDeclaration typeDeclaration = null;
if (!typeDeclarations.isEmpty()) {
/*
- * 3.3. Producer methods
- * - producer method return type contains a wildcard type parameter
+ * 3.3. Producer methods - producer method return type contains
+ * a wildcard type parameter
*
- * 2.2.1 Legal bean types
- * - a parameterized type that contains a wildcard type parameter is not a legal bean type.
+ * 2.2.1 Legal bean types - a parameterized type that contains a
+ * wildcard type parameter is not a legal bean type.
*
- * 3.4. Producer fields
- * - producer field type contains a wildcard type parameter
+ * 3.4. Producer fields - producer field type contains a
+ * wildcard type parameter
*/
- typeDeclaration = typeDeclarations.iterator()
- .next();
- String[] paramTypes = Signature
- .getTypeArguments(typeDeclaration.getSignature());
+ typeDeclaration = typeDeclarations.iterator().next();
+ String[] paramTypes = Signature.getTypeArguments(typeDeclaration.getSignature());
for (String paramType : paramTypes) {
if (Signature.getTypeSignatureKind(paramType) == Signature.WILDCARD_TYPE_SIGNATURE) {
if (producer instanceof IProducerField) {
- addError(
- CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD,
- CDIPreferences.PRODUCER_FIELD_TYPE_HAS_WILDCARD,
- typeDeclaration, producer.getResource());
+ addError(CDIValidationMessages.PRODUCER_FIELD_TYPE_HAS_WILDCARD, CDIPreferences.PRODUCER_FIELD_TYPE_HAS_WILDCARD, typeDeclaration,
+ producer.getResource());
} else {
- addError(
- CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD,
- CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD,
+ addError(CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD,
typeDeclaration, producer.getResource());
}
}
}
/**
- * 3.3. Producer methods
- * - producer method with a parameterized return type with a type variable declares any scope other than @Dependent
- *
- * 3.4. Producer fields
- * - producer field with a parameterized type with a type variable declares any scope other than @Dependent
+ * 3.3. Producer methods - producer method with a parameterized
+ * return type with a type variable declares any scope other
+ * than @Dependent
+ *
+ * 3.4. Producer fields - producer field with a parameterized
+ * type with a type variable declares any scope other than @Dependent
*/
- if(paramTypes.length>0) {
+ if (paramTypes.length > 0) {
IAnnotationDeclaration scopeOrStereotypeDeclaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(producer);
- if(scopeOrStereotypeDeclaration!=null) {
+ if (scopeOrStereotypeDeclaration != null) {
boolean field = producer instanceof IProducerField;
- addError(
- field?CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD:CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
- field?CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD:CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
+ addError(field ? CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD : CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
+ field ? CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD : CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
scopeOrStereotypeDeclaration, producer.getResource());
}
}
}
/*
- * 3.3.2. Declaring a producer method
- * - producer method is annotated @Inject
+ * 3.3.2. Declaring a producer method - producer method is annotated
+ * @Inject
*/
IAnnotationDeclaration inject = producer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
- if(inject!=null) {
+ if (inject != null) {
addError(CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, CDIPreferences.PRODUCER_ANNOTATED_INJECT, inject, producer.getResource());
}
@@ -564,93 +567,89 @@
if (producer instanceof IProducerField) {
/*
- * 3.5.1. Declaring a resource
- * - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
+ * 3.5.1. Declaring a resource - producer field declaration
+ * specifies an EL name (together with one of @Resource,
+ * @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*/
IProducerField producerField = (IProducerField) producer;
if (producerField.getName() != null) {
IAnnotationDeclaration declaration;
for (String annotationType : RESOURCE_ANNOTATIONS) {
- declaration = producerField
- .getAnnotation(annotationType);
+ declaration = producerField.getAnnotation(annotationType);
if (declaration != null) {
- IAnnotationDeclaration nameDeclaration = producerField
- .getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
+ IAnnotationDeclaration nameDeclaration = producerField.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
if (nameDeclaration != null) {
declaration = nameDeclaration;
}
- addError(
- CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME,
- CDIPreferences.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME,
+ addError(CDIValidationMessages.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, CDIPreferences.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME,
declaration, producer.getResource());
}
}
}
/*
- * 3.4. Producer fields
- * - producer field type is a type variable
+ * 3.4. Producer fields - producer field type is a type variable
*/
- if(typeVariables.length>0) {
+ if (typeVariables.length > 0) {
String typeSign = producerField.getField().getTypeSignature();
String typeString = Signature.toString(typeSign);
for (String variableSig : typeVariables) {
String variableName = Signature.getTypeVariable(variableSig);
- if(typeString.equals(variableName)) {
- addError(
- CDIValidationMessages.PRODUCER_FIELD_TYPE_IS_VARIABLE,
- CDIPreferences.PRODUCER_FIELD_TYPE_IS_VARIABLE,
- typeDeclaration!=null?typeDeclaration:producer, producer.getResource());
+ if (typeString.equals(variableName)) {
+ addError(CDIValidationMessages.PRODUCER_FIELD_TYPE_IS_VARIABLE, CDIPreferences.PRODUCER_FIELD_TYPE_IS_VARIABLE,
+ typeDeclaration != null ? typeDeclaration : producer, producer.getResource());
}
}
}
} else {
IProducerMethod producerMethod = (IProducerMethod) producer;
List<IParameter> params = producerMethod.getParameters();
- Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
- declarations
- .add(producerMethod
- .getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+ Set<ITextSourceReference> observesDeclarations = new HashSet<ITextSourceReference>();
+ Set<ITextSourceReference> disposalDeclarations = new HashSet<ITextSourceReference>();
+ observesDeclarations.add(producerMethod.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+ disposalDeclarations.add(producerMethod.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
for (IParameter param : params) {
/*
- * 3.3.6. Declaring a disposer method
- * - a disposer method is annotated @Produces.
+ * 3.3.6. Declaring a disposer method - a disposer method is
+ * annotated @Produces.
*
- * 3.3.2. Declaring a producer method
- * - a has a parameter annotated @Disposes
+ * 3.3.2. Declaring a producer method - a has a parameter
+ * annotated @Disposes
*/
- ITextSourceReference declaration = param
- .getAnnotationPosition(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ ITextSourceReference declaration = param.getAnnotationPosition(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
if (declaration != null) {
- declarations.add(declaration);
+ disposalDeclarations.add(declaration);
}
/*
- * 3.3.2. Declaring a producer method
- * - a has a parameter annotated @Observers
+ * 3.3.2. Declaring a producer method - a has a parameter
+ * annotated @Observers
*
- * 10.4.2. Declaring an observer method
- * - an observer method is annotated @Produces
+ * 10.4.2. Declaring an observer method - an observer method
+ * is annotated @Produces
*/
- declaration = param
- .getAnnotationPosition(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
+ declaration = param.getAnnotationPosition(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
if (declaration != null) {
- declarations.add(declaration);
+ observesDeclarations.add(declaration);
}
}
- if (declarations.size() > 1) {
- for (ITextSourceReference declaration : declarations) {
- addError(
- CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED,
- CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED,
+ if (observesDeclarations.size() > 1) {
+ for (ITextSourceReference declaration : observesDeclarations) {
+ addError(CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED,
declaration, producer.getResource());
}
}
+ if (disposalDeclarations.size() > 1) {
+ for (ITextSourceReference declaration : disposalDeclarations) {
+ addError(CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED,
+ declaration, producer.getResource());
+ }
+ }
/*
- * 3.3. Producer methods
- * - producer method return type is a type variable
+ * 3.3. Producer methods - producer method return type is a type
+ * variable
*
- * 2.2.1 - Legal bean types
- * - a type variable is not a legal bean type
+ * 2.2.1 - Legal bean types - a type variable is not a legal
+ * bean type
*/
String typeSign = producerMethod.getMethod().getReturnType();
String typeString = Signature.toString(typeSign);
@@ -658,50 +657,72 @@
boolean marked = false;
for (ITypeParameter param : paramTypes) {
String variableName = param.getElementName();
- if(variableName.equals(typeString)) {
- addError(
- CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
- CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
- typeDeclaration!=null?typeDeclaration:producer, producer.getResource());
+ if (variableName.equals(typeString)) {
+ addError(CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
+ typeDeclaration != null ? typeDeclaration : producer, producer.getResource());
marked = true;
}
}
- if(!marked && typeVariables.length>0) {
+ if (!marked && typeVariables.length > 0) {
for (String variableSig : typeVariables) {
String variableName = Signature.getTypeVariable(variableSig);
- if(typeString.equals(variableName)) {
- addError(
- CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
- CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
- typeDeclaration!=null?typeDeclaration:producer, producer.getResource());
+ if (typeString.equals(variableName)) {
+ addError(CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE,
+ typeDeclaration != null ? typeDeclaration : producer, producer.getResource());
}
}
}
+ /*
+ * 3.3.2. Declaring a producer method
+ * - non-static method of a session bean class is annotated @Produces, and the method is not a business method of the session bean
+ */
+ IClassBean classBean = producer.getClassBean();
+ if(classBean instanceof ISessionBean) {
+ IMethod method = CDIUtil.getBusinessMethodDeclaration((SessionBean)classBean, producerMethod);
+ if(method==null) {
+ addError(CDIValidationMessages.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, producer.getProducesAnnotation(), producer.getResource());
+ saveAllSuperTypesAsLinkedResources(classBean);
+ } else {
+ validationContext.addLinkedCoreResource(classBean.getSourcePath().toOSString(), method.getResource().getFullPath(), false);
+ }
+ }
}
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
}
+ private void saveAllSuperTypesAsLinkedResources(IClassBean bean) {
+ Set<IParametedType> types = bean.getAllTypes();
+ for (IParametedType type : types) {
+ IType superType = type.getType();
+ if(superType!=null && !superType.isBinary() && superType.getResource()!=null && superType!=bean.getBeanClass()) {
+ validationContext.addLinkedCoreResource(bean.getSourcePath().toOSString(), superType.getResource().getFullPath(), false);
+ }
+ }
+ }
+
private void validateInjectionPoint(IInjectionPoint injection) {
/*
- * 3.11. The qualifier @Named at injection points
- * - injection point other than injected field declares a @Named annotation that does not specify the value member
+ * 3.11. The qualifier @Named at injection points - injection point
+ * other than injected field declares a @Named annotation that does not
+ * specify the value member
*/
- if(!(injection instanceof IInjectionPointField)) {
+ if (!(injection instanceof IInjectionPointField)) {
IAnnotationDeclaration named = injection.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
- if(named!=null) {
+ if (named != null) {
try {
IMemberValuePair[] values = named.getDeclaration().getMemberValuePairs();
boolean valueExists = false;
for (IMemberValuePair pair : values) {
- if("value".equals(pair.getMemberName())) {
+ if ("value".equals(pair.getMemberName())) {
valueExists = true;
break;
}
}
- if(!valueExists) {
- addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named, injection.getResource());
+ if (!valueExists) {
+ addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named,
+ injection.getResource());
}
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
@@ -711,8 +732,9 @@
}
/**
- * Validates class bean which may be both a session and decorator (or interceptor).
- *
+ * Validates class bean which may be both a session and decorator (or
+ * interceptor).
+ *
* @param bean
*/
private void validateMixedClassBean(IClassBean bean) {
@@ -720,59 +742,67 @@
ITextSourceReference decoratorDeclaration = bean.getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
ITextSourceReference interceptorDeclaration = bean.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
- if(sessionDeclaration!=null) {
+ if (sessionDeclaration != null) {
/*
- * 3.2. Session beans
- * - bean class of a session bean is annotated @Decorator
+ * 3.2. Session beans - bean class of a session bean is annotated
+ * @Decorator
*/
- if(decoratorDeclaration!=null) {
- addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, sessionDeclaration, bean.getResource());
- addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, decoratorDeclaration, bean.getResource());
+ if (decoratorDeclaration != null) {
+ addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR,
+ sessionDeclaration, bean.getResource());
+ addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_DECORATOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR,
+ decoratorDeclaration, bean.getResource());
}
/*
- * 3.2. Session beans
- * - bean class of a session bean is annotated @Interceptor
+ * 3.2. Session beans - bean class of a session bean is annotated
+ * @Interceptor
*/
- if(interceptorDeclaration!=null) {
- addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, sessionDeclaration, bean.getResource());
- addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, interceptorDeclaration, bean.getResource());
+ if (interceptorDeclaration != null) {
+ addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR,
+ sessionDeclaration, bean.getResource());
+ addError(CDIValidationMessages.SESSION_BEAN_ANNOTATED_INTERCEPTOR, CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR,
+ interceptorDeclaration, bean.getResource());
}
}
}
private void validateSessionBean(ISessionBean bean) {
IAnnotationDeclaration declaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
- if(declaration!=null) {
+ if (declaration != null) {
IType type = bean.getBeanClass();
try {
/*
- * 3.2. Session beans
- * - session bean with a parameterized bean class declares any scope other than @Dependent
+ * 3.2. Session beans - session bean with a parameterized bean
+ * class declares any scope other than @Dependent
*/
String[] typeVariables = type.getTypeParameterSignatures();
- if(typeVariables.length>0) {
- addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_SESSION_BEAN_WITH_GENERIC_TYPE, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, declaration, bean.getResource());
+ if (typeVariables.length > 0) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_SESSION_BEAN_WITH_GENERIC_TYPE, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN,
+ declaration, bean.getResource());
} else {
- if(bean.isStateless()) {
+ if (bean.isStateless()) {
/*
- * 3.2. Session beans
- * - session bean specifies an illegal scope
- * (a stateless session bean must belong to the @Dependent pseudo-scope)
+ * 3.2. Session beans - session bean specifies an
+ * illegal scope (a stateless session bean must belong
+ * to the @Dependent pseudo-scope)
*/
- if(declaration!=null) {
- addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, declaration, bean.getResource());
+ if (declaration != null) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_STATELESS_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN,
+ declaration, bean.getResource());
}
- } else if(bean.isSingleton()) {
+ } else if (bean.isSingleton()) {
/*
- * 3.2. Session beans
- * - session bean specifies an illegal scope
- * (a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope)
+ * 3.2. Session beans - session bean specifies an
+ * illegal scope (a singleton bean must belong to either
+ * the @ApplicationScoped scope or to the @Dependent
+ * pseudo-scope)
*/
- if(declaration!=null) {
+ if (declaration != null) {
declaration = CDIUtil.getDifferentScopeDeclarationThanApplicationScoped(bean);
}
- if(declaration!=null) {
- addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, declaration, bean.getResource());
+ if (declaration != null) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_SINGLETON_SESSION_BEAN, CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN,
+ declaration, bean.getResource());
}
}
}
@@ -781,93 +811,101 @@
}
}
/*
- * 3.2.4. Specializing a session bean
- * - session bean class annotated @Specializes does not directly extend the bean class of another session bean
+ * 3.2.4. Specializing a session bean - session bean class annotated
+ * @Specializes does not directly extend the bean class of another
+ * session bean
*/
IAnnotationDeclaration specializesDeclaration = bean.getSpecializesAnnotationDeclaration();
- if(specializesDeclaration!=null) {
+ if (specializesDeclaration != null) {
+ saveAllSuperTypesAsLinkedResources(bean);
IBean sBean = bean.getSpecializedBean();
- if(sBean==null) {
+ if (sBean == null) {
// The specializing bean extends nothing
- addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, specializesDeclaration, bean.getResource());
- } else if(!CDIUtil.isSessionBean(sBean)) {
- // The specializing bean directly extends a non-session bean class
- addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, specializesDeclaration, bean.getResource());
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, specializesDeclaration,
+ bean.getResource());
+ } else if (!CDIUtil.isSessionBean(sBean)) {
+ // The specializing bean directly extends a non-session bean
+ // class
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, specializesDeclaration,
+ bean.getResource());
}
}
}
private void validateManagedBean(IClassBean bean) {
/*
- * 3.1. Managed beans
- * - the bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
+ * 3.1. Managed beans - the bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
*/
IAnnotationDeclaration decorator = bean.getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
IAnnotationDeclaration interceptor = bean.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
- if(decorator!=null && interceptor!=null) {
+ if (decorator != null && interceptor != null) {
addError(CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, decorator, bean.getResource());
addError(CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, interceptor, bean.getResource());
}
IAnnotationDeclaration declaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
- if(declaration!=null) {
+ if (declaration != null) {
IType type = bean.getBeanClass();
try {
/*
- * 3.1. Managed beans
- * - managed bean with a public field declares any scope other than @Dependent
+ * 3.1. Managed beans - managed bean with a public field declares any scope other than @Dependent
*/
IField[] fields = type.getFields();
for (IField field : fields) {
- if(Flags.isPublic(field.getFlags()) && !Flags.isStatic(field.getFlags())) {
- addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, declaration, bean.getResource());
+ if (Flags.isPublic(field.getFlags()) && !Flags.isStatic(field.getFlags())) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN,
+ declaration, bean.getResource());
break;
}
}
/*
- * 3.1. Managed beans
- * - managed bean with a parameterized bean class declares any scope other than @Dependent
+ * 3.1. Managed beans - managed bean with a parameterized bean class declares any scope other than @Dependent
*/
String[] typeVariables = type.getTypeParameterSignatures();
- if(typeVariables.length>0) {
- addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, declaration, bean.getResource());
+ if (typeVariables.length > 0) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN,
+ declaration, bean.getResource());
}
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
}
/*
- * 3.1.4. Specializing a managed bean
- * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ * 3.1.4. Specializing a managed bean - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
*/
IAnnotationDeclaration specializesDeclaration = bean.getSpecializesAnnotationDeclaration();
- if(specializesDeclaration!=null) {
+ if (specializesDeclaration != null) {
+ saveAllSuperTypesAsLinkedResources(bean);
try {
IBean sBean = bean.getSpecializedBean();
- if(sBean!=null) {
- if(sBean instanceof ISessionBean || sBean.getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME)!=null || sBean.getAnnotation(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME)!=null) {
+ if (sBean != null) {
+ if (sBean instanceof ISessionBean || sBean.getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME) != null
+ || sBean.getAnnotation(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME) != null) {
// The specializing bean directly extends an enterprise bean class
- addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN,
+ specializesDeclaration, bean.getResource());
} else {
// Validate the specializing bean extends a non simple bean
boolean hasDefaultConstructor = true;
IMethod[] methods = sBean.getBeanClass().getMethods();
for (IMethod method : methods) {
- if(method.isConstructor()) {
- if(Flags.isPublic(method.getFlags()) && method.getParameterNames().length==0) {
+ if (method.isConstructor()) {
+ if (Flags.isPublic(method.getFlags()) && method.getParameterNames().length == 0) {
hasDefaultConstructor = true;
break;
}
hasDefaultConstructor = false;
}
}
- if(!hasDefaultConstructor) {
- addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ if (!hasDefaultConstructor) {
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN,
+ specializesDeclaration, bean.getResource());
}
}
} else {
// The specializing bean extends nothing
- addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration,
+ bean.getResource());
}
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
@@ -877,84 +915,103 @@
private void validateInterceptor(IInterceptor interceptor) {
/*
- * 2.5.3. Beans with no EL name
- * - interceptor has a name (Non-Portable behavior)
+ * 2.5.3. Beans with no EL name - interceptor has a name (Non-Portable behavior)
*/
- if(interceptor.getName()!=null) {
+ if (interceptor.getName() != null) {
ITextSourceReference declaration = interceptor.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
if (declaration == null) {
declaration = interceptor.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
}
- if(declaration==null) {
+ if (declaration == null) {
declaration = CDIUtil.getNamedStereotypeDeclaration(interceptor);
}
addError(CDIValidationMessages.INTERCEPTOR_HAS_NAME, CDIPreferences.INTERCEPTOR_HAS_NAME, declaration, interceptor.getResource());
}
/*
- * 2.6.1. Declaring an alternative
- * - interceptor is an alternative (Non-Portable behavior)
+ * 2.6.1. Declaring an alternative - interceptor is an alternative (Non-Portable behavior)
*/
- if(interceptor.isAlternative()) {
+ if (interceptor.isAlternative()) {
ITextSourceReference declaration = interceptor.getAlternativeDeclaration();
- if(declaration==null) {
+ if (declaration == null) {
declaration = interceptor.getInterceptorAnnotation();
}
- addError(CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration, interceptor.getResource());
+ addError(CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration, interceptor
+ .getResource());
}
+ /*
+ * 3.3.2. Declaring a producer method
+ * - interceptor has a method annotated @Produces
+ *
+ * 3.4.2. Declaring a producer field
+ * - interceptor has a field annotated @Produces
+ */
+ Set<IProducer> producers = interceptor.getProducers();
+ for (IProducer producer : producers) {
+ addError(CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, producer.getProducesAnnotation(), interceptor.getResource());
+ }
}
private void validateDecorator(IDecorator decorator) {
/*
- * 2.5.3. Beans with no EL name
- * - decorator has a name (Non-Portable behavior)
+ * 2.5.3. Beans with no EL name - decorator has a name (Non-Portable behavior)
*/
- if(decorator.getName()!=null) {
+ if (decorator.getName() != null) {
ITextSourceReference declaration = decorator.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
if (declaration == null) {
declaration = decorator.getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
}
- if(declaration==null) {
+ if (declaration == null) {
declaration = CDIUtil.getNamedStereotypeDeclaration(decorator);
}
addError(CDIValidationMessages.DECORATOR_HAS_NAME, CDIPreferences.DECORATOR_HAS_NAME, declaration, decorator.getResource());
}
/*
- * 2.6.1. Declaring an alternative
- * - decorator is an alternative (Non-Portable behavior)
+ * 2.6.1. Declaring an alternative - decorator is an alternative (Non-Portable behavior)
*/
- if(decorator.isAlternative()) {
+ if (decorator.isAlternative()) {
ITextSourceReference declaration = decorator.getAlternativeDeclaration();
- if(declaration==null) {
+ if (declaration == null) {
declaration = decorator.getDecoratorAnnotation();
}
addError(CDIValidationMessages.DECORATOR_IS_ALTERNATIVE, CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration, decorator.getResource());
}
+
+ /*
+ * 3.3.2. Declaring a producer method
+ * - decorator has a method annotated @Produces
+ *
+ * 3.4.2. Declaring a producer field
+ * - decorator has a field annotated @Produces
+ */
+ Set<IProducer> producers = decorator.getProducers();
+ for (IProducer producer : producers) {
+ addError(CDIValidationMessages.PRODUCER_IN_DECORATOR, CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, producer.getProducesAnnotation(), decorator.getResource());
+ }
}
/*
- * 2.2.2. Restricting the bean types of a bean
- * - bean class or producer method or field specifies a @Typed annotation,
- * and the value member specifies a class which does not correspond to a type
- * in the unrestricted set of bean types of a bean
+ * 2.2.2. Restricting the bean types of a bean - bean class or producer method or field specifies a @Typed annotation,
+ * and the value member specifies a class which does not correspond to a type in the unrestricted set of bean types of a bean
*/
private void validateTyped(IBean bean) {
Set<ITypeDeclaration> typedDeclarations = bean.getRestrictedTypeDeclaratios();
- if(!typedDeclarations.isEmpty()) {
+ if (!typedDeclarations.isEmpty()) {
Set<IParametedType> allTypes = bean.getAllTypes();
for (ITypeDeclaration typedDeclaration : typedDeclarations) {
IType typedType = typedDeclaration.getType();
- if(typedType!=null) {
+ if (typedType != null) {
boolean typeWasFound = false;
for (IParametedType type : allTypes) {
- if(type!=null && typedType.getFullyQualifiedName().equals(type.getType().getFullyQualifiedName())) {
+ if (type != null && typedType.getFullyQualifiedName().equals(type.getType().getFullyQualifiedName())) {
typeWasFound = true;
break;
}
}
- if(!typeWasFound) {
- addError(CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, typedDeclaration, bean.getResource());
+ if (!typeWasFound) {
+ addError(CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, typedDeclaration,
+ bean.getResource());
}
}
}
@@ -963,49 +1020,54 @@
private void validateBeanScope(IBean bean) {
Set<IScopeDeclaration> scopes = bean.getScopeDeclarations();
- // 2.4.3. Declaring the bean scope
- // - bean class or producer method or field specifies multiple scope type annotations
+ // 2.4.3. Declaring the bean scope
+ // - bean class or producer method or field specifies multiple scope type annotations
//
- if(scopes.size()>1) {
+ if (scopes.size() > 1) {
for (IScopeDeclaration scope : scopes) {
addError(CDIValidationMessages.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, CDIPreferences.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, scope, bean.getResource());
}
}
// 2.4.4. Default scope
- // - bean does not explicitly declare a scope when there is no default scope
- // (there are two different stereotypes declared by the bean that declare different default scopes)
+ // - bean does not explicitly declare a scope when there is no default
+ // scope
+ // (there are two different stereotypes declared by the bean that
+ // declare different default scopes)
//
- // Such bean definitions are invalid because they declares two stereotypes that have different default scopes and the bean does not explictly define a scope to resolve the conflict.
+ // Such bean definitions are invalid because they declares two
+ // stereotypes that have different default scopes and the bean does not
+ // explictly define a scope to resolve the conflict.
Set<IStereotypeDeclaration> stereotypeDeclarations = bean.getStereotypeDeclarations();
- if(!stereotypeDeclarations.isEmpty() && scopes.isEmpty()) {
+ if (!stereotypeDeclarations.isEmpty() && scopes.isEmpty()) {
Map<String, IStereotypeDeclaration> declarationMap = new HashMap<String, IStereotypeDeclaration>();
for (IStereotypeDeclaration stereotypeDeclaration : stereotypeDeclarations) {
IStereotype stereotype = stereotypeDeclaration.getStereotype();
IScope scope = stereotype.getScope();
- if(scope!=null) {
+ if (scope != null) {
declarationMap.put(scope.getSourceType().getFullyQualifiedName(), stereotypeDeclaration);
}
}
- if(declarationMap.size()>1) {
+ if (declarationMap.size() > 1) {
for (IStereotypeDeclaration stereotypeDeclaration : declarationMap.values()) {
- addError(CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, stereotypeDeclaration, bean.getResource());
+ addError(CDIValidationMessages.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE,
+ stereotypeDeclaration, bean.getResource());
}
}
}
/*
- * 2.4.1. Built-in scope types
- * - interceptor or decorator has any scope other than @Dependent (Non-Portable behavior)
+ * 2.4.1. Built-in scope types - interceptor or decorator has any scope
+ * other than @Dependent (Non-Portable behavior)
*/
boolean interceptor = bean instanceof IInterceptor;
boolean decorator = bean instanceof IDecorator;
- if(interceptor || decorator) {
+ if (interceptor || decorator) {
IAnnotationDeclaration scopeOrStereotypeDeclaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
- if(scopeOrStereotypeDeclaration!=null) {
+ if (scopeOrStereotypeDeclaration != null) {
String key = CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR;
String message = CDIValidationMessages.ILLEGAL_SCOPE_FOR_DECORATOR;
- if(interceptor) {
+ if (interceptor) {
key = CDIPreferences.ILLEGAL_SCOPE_FOR_INTERCEPTOR;
message = CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR;
}
@@ -1021,59 +1083,61 @@
*/
private void validateStereotype(IStereotype stereotype) {
// 2.7.1.3. Declaring a @Named stereotype
- // - stereotype declares a non-empty @Named annotation (Non-Portable behavior)
- // - stereotype declares any other qualifier annotation
- // - stereotype is annotated @Typed
+ // - stereotype declares a non-empty @Named annotation (Non-Portable
+ // behavior)
+ // - stereotype declares any other qualifier annotation
+ // - stereotype is annotated @Typed
- if(stereotype == null) {
+ if (stereotype == null) {
return;
}
IResource resource = stereotype.getResource();
- if(resource == null || !resource.getName().toLowerCase().endsWith(".java")) {
- //validate sources only
+ if (resource == null || !resource.getName().toLowerCase().endsWith(".java")) {
+ // validate sources only
return;
}
List<IAnnotationDeclaration> as = stereotype.getAnnotationDeclarations();
// 1. non-empty name
IAnnotationDeclaration nameDeclaration = stereotype.getNameDeclaration();
- if(nameDeclaration != null) {
+ if (nameDeclaration != null) {
IMemberValuePair[] ps = null;
try {
ps = nameDeclaration.getDeclaration().getMemberValuePairs();
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
- if(ps != null && ps.length > 0) {
+ if (ps != null && ps.length > 0) {
Object name = ps[0].getValue();
- if(name != null && name.toString().length() > 0) {
+ if (name != null && name.toString().length() > 0) {
ITextSourceReference location = nameDeclaration;
addError(CDIValidationMessages.STEREOTYPE_DECLARES_NON_EMPTY_NAME, CDIPreferences.STEREOTYPE_DECLARES_NON_EMPTY_NAME, location, resource);
}
}
}
- // 2. typed annotation
+ // 2. typed annotation
IAnnotationDeclaration typedDeclaration = stereotype.getAnnotationDeclaration(CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
- if(typedDeclaration != null) {
+ if (typedDeclaration != null) {
ITextSourceReference location = typedDeclaration;
addError(CDIValidationMessages.STEREOTYPE_IS_ANNOTATED_TYPED, CDIPreferences.STEREOTYPE_IS_ANNOTATED_TYPED, location, resource);
}
// 3. Qualifier other than @Named
- for (IAnnotationDeclaration a: as) {
- if(a instanceof IQualifierDeclaration && a != nameDeclaration) {
+ for (IAnnotationDeclaration a : as) {
+ if (a instanceof IQualifierDeclaration && a != nameDeclaration) {
ITextSourceReference location = a;
addError(CDIValidationMessages.ILLEGAL_QUALIFIER_IN_STEREOTYPE, CDIPreferences.ILLEGAL_QUALIFIER_IN_STEREOTYPE, location, resource);
}
}
// 2.7.1.1. Declaring the default scope for a stereotype
- // - stereotype declares more than one scope
+ // - stereotype declares more than one scope
Set<IScopeDeclaration> scopeDeclarations = stereotype.getScopeDeclarations();
- if(scopeDeclarations.size()>1) {
+ if (scopeDeclarations.size() > 1) {
for (IScopeDeclaration scope : scopeDeclarations) {
- addError(CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, scope, stereotype.getResource());
+ addError(CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, scope,
+ stereotype.getResource());
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -53,7 +53,8 @@
public static String ILLEGAL_SCOPE_FOR_DECORATOR;
public static String PRODUCER_ANNOTATED_INJECT;
- public static String PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED;
+ public static String PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES;
+ public static String PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES;
public static String OBSERVER_ANNOTATED_INJECT;
public static String OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED;
public static String ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN;
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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-19 19:41:00 UTC (rev 22204)
@@ -57,9 +57,6 @@
any scope other than @Dependent
- producer method return type is a type variable
-
-
-
3.3.2. Declaring a producer method
- producer method is annotated @Inject
- producer method has a parameter annotated @Disposes
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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-19 19:41:00 UTC (rev 22204)
@@ -32,7 +32,8 @@
ILLEGAL_SCOPE_FOR_DECORATOR=Decorator has any scope other than @Dependent
PRODUCER_ANNOTATED_INJECT=Producer method or field is annotated @Inject
-PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED=Producer method has a parameter annotated @Disposes or @Observes
+PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES=Producer method has a parameter annotated @Disposes
+PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES=Producer method has a parameter annotated @Observes
OBSERVER_ANNOTATED_INJECT=Observer method is annotated @Inject
OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED=Observer method has a parameter annotated @Disposes
ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN=Non-static method of a session bean class is annotated @Produces, and the method is not a business method of the session bean
@@ -52,8 +53,8 @@
BOTH_INTERCEPTOR_AND_DECORATOR=The bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
SESSION_BEAN_ANNOTATED_INTERCEPTOR=Bean class of a session bean is annotated @Interceptor
SESSION_BEAN_ANNOTATED_DECORATOR=Bean class of a session bean is annotated @Decorator
-PRODUCER_IN_INTERCEPTOR=Interceptor has a member annotated @Produces
-PRODUCER_IN_DECORATOR=Decorator has a member annotated @Produces
+PRODUCER_IN_INTERCEPTOR=Producer cannot be declared in an interceptor
+PRODUCER_IN_DECORATOR=Producer cannot be declared in a decorator
DISPOSER_IN_INTERCEPTOR=Interceptor has a method annotated @Disposes
DISPOSER_IN_DECORATOR=Decorator has a method annotated @Disposes
MULTIPLE_DELEGATE=Decorator has more than one delegate injection point
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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -80,7 +80,7 @@
{CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerParameterIllegallyAnnotated_label},
// {CDIPreferences.OBSERVER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerAnnotatedInject_label},
{CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerParameterIllegallyAnnotated_label},
-// {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
+ {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
{CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
{CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
{CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
@@ -102,7 +102,7 @@
new String[][]{
{CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_bothInterceptorAndDecorator_label},
{CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_sessionBeanAnnotatedInterceptorOrDecorator_label},
-// {CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
+ {CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
{CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerInInterceptorOrDecorator_label},
// {CDIPreferences.MULTIPLE_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDelegate_label},
// {CDIPreferences.MISSING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingDelegate_label},
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.producers;
+
+import javax.decorator.Decorator;
+import javax.enterprise.inject.Produces;
+
+@Decorator
+public class DecoratorHasProducerFieldBroken {
+
+ @Produces public FunnelWeaver<String> getAnotherFunnelWeaver;
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.producers;
+
+import javax.decorator.Decorator;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+@Decorator
+public class DecoratorHasProducerMethodBroken {
+
+ @Produces
+ public FunnelWeaver<String> create2(InjectionPoint point) {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.producers;
+
+import javax.enterprise.inject.Produces;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+public class InterceptorHasProducerFieldBroken {
+
+ @AroundInvoke
+ public Object alwaysReturnThis(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+
+ @Produces public FunnelWeaver<String> anotherFunnelWeaver;
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.producers;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor
+public class InterceptorHasProducerMethodBroken {
+
+ @AroundInvoke
+ public Object alwaysReturnThis(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+
+ @Produces
+ public FunnelWeaver<String> create2(InjectionPoint point) {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.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-05-19 16:39:54 UTC (rev 22203)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-19 19:41:00 UTC (rev 22204)
@@ -479,7 +479,7 @@
*/
public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedDisposes/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 25, 26);
}
/**
@@ -490,10 +490,43 @@
*/
public void testProducerMethodWithParameterAnnotatedObserves() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedObserves/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 26);
}
/**
+ * 3.3.2. Declaring a producer method
+ * - non-static method of a session bean class is annotated @Produces, and the method is not a business method of the session bean
+ *
+ * @throws Exception
+ */
+ public void testProducerMethodOnSessionBeanMustBeBusinessMethod() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/enterprise/nonbusiness/FooProducer.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, 25);
+ }
+
+ /**
+ * 3.3.2. Declaring a producer method
+ * - decorator has a method annotated @Produces
+ *
+ * @throws Exception
+ */
+ public void testDecoratorMustNotHaveProducerMethod() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/DecoratorHasProducerMethodBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_DECORATOR, 10);
+ }
+
+ /**
+ * 3.3.2. Declaring a producer method
+ * - interceptor has a method annotated @Produces
+ *
+ * @throws Exception
+ */
+ public void testInterceptorMustNotHaveProducerMethod() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/InterceptorHasProducerMethodBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 17);
+ }
+
+ /**
* 3.5.1. Declaring a resource
* - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
@@ -534,7 +567,7 @@
*/
public void testProducesUnallowed() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/producesUnallowed/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 30, 31);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_DISPOSES, 30, 31);
}
/**
@@ -655,6 +688,28 @@
}
/**
+ * 3.4.2. Declaring a producer field
+ * - decorator has a field annotated @Produces
+ *
+ * @throws Exception
+ */
+ public void testDecoratorMustNotHaveProducerField() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/DecoratorHasProducerFieldBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_DECORATOR, 9);
+ }
+
+ /**
+ * 3.4.2. Declaring a producer field
+ * - interceptor has a field annotated @Produces
+ *
+ * @throws Exception
+ */
+ public void testInterceptorMustNotHaveProducerField() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/InterceptorHasProducerFieldBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_IN_INTERCEPTOR, 16);
+ }
+
+ /**
* 3.9.1. Declaring an initializer method
* - an initializer method has a parameter annotated @Disposes
*
@@ -674,7 +729,7 @@
*/
public void testObserverMethodAnnotatedProducesFails() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/isProducer/BorderTerrier_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 25);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED_OBSERVES, 25, 25);
}
/**
15 years, 11 months
JBoss Tools SVN: r22203 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test: tck and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-19 12:39:54 -0400 (Wed, 19 May 2010)
New Revision: 22203
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ProducerMethodDefinitionTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
Log:
https://jira.jboss.org/browse/JBIDE-5808
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-05-19 16:15:55 UTC (rev 22202)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-05-19 16:39:54 UTC (rev 22203)
@@ -19,6 +19,7 @@
import org.jboss.tools.cdi.core.test.tck.EnterpriseScopeDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.EnterpriseStereotypeDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.NameDefinitionTest;
+import org.jboss.tools.cdi.core.test.tck.ProducerMethodDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.QualifierDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.ScopeDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.StereotypeDefinitionTest;
@@ -42,6 +43,7 @@
suite.addTestSuite(DefaultNamedTest.class);
suite.addTestSuite(EnterpriseStereotypeDefinitionTest.class);
suite.addTestSuite(StereotypeInheritenceTest.class);
+ suite.addTestSuite(ProducerMethodDefinitionTest.class);
suite.addTestSuite(ValidationTest.class);
return suite;
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ProducerMethodDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ProducerMethodDefinitionTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ProducerMethodDefinitionTest.java 2010-05-19 16:39:54 UTC (rev 22203)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.core.test.tck;
+
+import java.util.Set;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ProducerMethodDefinitionTest extends TCKTest {
+
+ /**
+ * Section 3.3.2 - Declaring a producer method
+ * i) All producer method parameters are injection points.
+ *
+ * @throws JavaModelException
+ */
+ public void testBindingTypesAppliedToProducerMethodParameters() throws JavaModelException {
+ Set<IBean> beans = cdiProject.getBeans(true, "org.jboss.jsr299.tck.tests.implementation.producer.method.definition.Tarantula", "org.jboss.jsr299.tck.tests.implementation.producer.method.definition.Deadliest");
+ IBean bean = beans.iterator().next();
+ Set<IInjectionPoint> injections = bean.getInjectionPoints();
+ assertEquals("Wrong number of injection points in the producer.", 2, injections.size());
+ // TODO use real location for injection points.
+ assertLocationEquals(injections, 0, 0);
+ assertLocationEquals(injections, 0, 0);
+ }
+
+ // TODO continue implementing producer tests.
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ProducerMethodDefinitionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
JBoss Tools SVN: r22202 - in trunk/cdi: plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-19 12:15:55 -0400 (Wed, 19 May 2010)
New Revision: 22202
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/errorList.txt
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 CDI validation rule: If a producer method is annotated @Inject, the container automatically detects the problem and treats it as a definition error.
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-05-19 14:56:48 UTC (rev 22201)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-19 16:15:55 UTC (rev 22202)
@@ -551,6 +551,15 @@
}
}
+ /*
+ * 3.3.2. Declaring a producer method
+ * - producer method is annotated @Inject
+ */
+ IAnnotationDeclaration inject = producer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ if(inject!=null) {
+ addError(CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, CDIPreferences.PRODUCER_ANNOTATED_INJECT, inject, producer.getResource());
+ }
+
String[] typeVariables = producer.getBeanClass().getTypeParameterSignatures();
if (producer instanceof IProducerField) {
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-05-19 14:56:48 UTC (rev 22201)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-19 16:15:55 UTC (rev 22202)
@@ -51,17 +51,15 @@
- session bean class annotated @Specializes does not directly extend
the bean class of another session bean
-
-
-
-
-
3.3. Producer methods
- producer method return type contains a wildcard type parameter
- producer method with a parameterized return type with a type variable declares
any scope other than @Dependent
- producer method return type is a type variable
+
+
+
3.3.2. Declaring a producer method
- producer method is annotated @Inject
- producer method has a parameter annotated @Disposes
@@ -70,6 +68,9 @@
is not a business method of the session bean
- interceptor or decorator has a method annotated @Produces
+
+
+
3.3.3. Specializing a producer method
- method annotated @Specializes is static or does not directly override another producer method
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-05-19 14:56:48 UTC (rev 22201)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-19 16:15:55 UTC (rev 22202)
@@ -76,7 +76,7 @@
private static SectionDescription SECTION_MEMBER = new SectionDescription(
CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_member,
new String[][]{
-// {CDIPreferences.PRODUCER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerAnnotatedInject_label},
+ {CDIPreferences.PRODUCER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerAnnotatedInject_label},
{CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerParameterIllegallyAnnotated_label},
// {CDIPreferences.OBSERVER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerAnnotatedInject_label},
{CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerParameterIllegallyAnnotated_label},
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-05-19 14:56:48 UTC (rev 22201)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-19 16:15:55 UTC (rev 22202)
@@ -415,8 +415,85 @@
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/broken/directlyExtendsNothing/Cow_Broken.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_SESSION_BEAN, 22);
}
-
+
/**
+ * 3.3. Producer methods
+ * - producer method return type contains a wildcard type parameter
+ *
+ * 2.2.1 - Legal bean types
+ * - a parameterized type that contains a wildcard type parameter is not a legal bean type.
+ *
+ * @throws Exception
+ */
+ public void testParameterizedReturnTypeWithWildcard() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithWildcard/SpiderProducer.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, 24);
+ }
+
+ /**
+ * 3.3. Producer methods
+ * - producer method return type is a type variable
+ *
+ * 2.2.1 - Legal bean types
+ * - a type variable is not a legal bean type
+ *
+ * @throws Exception
+ */
+ public void testParameterizedType() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter2/TProducer.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 25);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/SpiderProducerVariableType_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 13);
+ }
+
+ /**
+ * 3.3. Producer methods
+ * - producer method with a parameterized return type with a type variable declares any scope other than @Dependent
+ *
+ * @throws Exception
+ */
+ public void testParameterizedReturnTypeWithWrongScope() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 39);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 21);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 35);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 31);
+ }
+
+ /**
+ * 3.3.2. Declaring a producer method
+ * - producer method is annotated @Inject
+ *
+ * @throws Exception
+ */
+ public void testInitializerMethodAnnotatedProduces() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/methodAnnotatedProduces/Pheasant_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_ANNOTATED_INJECT, 25);
+ }
+
+ /**
+ * 3.3.2. Declaring a producer method
+ * - a producer method has a parameter annotated @Disposes
+ *
+ * @throws Exception
+ */
+ public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedDisposes/SpiderProducer_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
+ }
+
+ /**
+ * 3.3.2. Declaring a producer method
+ * - a producer method has a parameter annotated @Observers
+ *
+ * @throws Exception
+ */
+ public void testProducerMethodWithParameterAnnotatedObserves() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedObserves/SpiderProducer_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
+ }
+
+ /**
* 3.5.1. Declaring a resource
* - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
@@ -541,20 +618,6 @@
}
/**
- * 3.3. Producer methods
- * - producer method return type contains a wildcard type parameter
- *
- * 2.2.1 - Legal bean types
- * - a parameterized type that contains a wildcard type parameter is not a legal bean type.
- *
- * @throws Exception
- */
- public void testParameterizedReturnTypeWithWildcard() throws Exception {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithWildcard/SpiderProducer.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, 24);
- }
-
- /**
* 3.4. Producer fields
* - producer field type contains a wildcard type parameter
*
@@ -567,22 +630,6 @@
}
/**
- * 3.3. Producer methods
- * - producer method return type is a type variable
- *
- * 2.2.1 - Legal bean types
- * - a type variable is not a legal bean type
- *
- * @throws Exception
- */
- public void testParameterizedType() throws Exception {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter2/TProducer.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 25);
- file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/SpiderProducerVariableType_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, 13);
- }
-
- /**
* 3.4. Producer fields.
* - producer field type is a type variable
*
@@ -594,20 +641,6 @@
}
/**
- * 3.3. Producer methods
- * - producer method with a parameterized return type with a type variable declares any scope other than @Dependent
- *
- * @throws Exception
- */
- public void testParameterizedReturnTypeWithWrongScope() throws Exception {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 39);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 21);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 35);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 31);
- }
-
- /**
* 3.4. Producer fields
* - producer field with a parameterized type with a type variable declares any scope other than @Dependent
*
@@ -634,28 +667,6 @@
}
/**
- * 3.3.2. Declaring a producer method
- * - a producer method has a parameter annotated @Disposes
- *
- * @throws Exception
- */
- public void testProducerMethodWithParameterAnnotatedDisposes() throws Exception {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedDisposes/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
- }
-
- /**
- * 3.3.2. Declaring a producer method
- * - a producer method has a parameter annotated @Observers
- *
- * @throws Exception
- */
- public void testProducerMethodWithParameterAnnotatedObserves() throws Exception {
- IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterAnnotatedObserves/SpiderProducer_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, 25, 26);
- }
-
- /**
* 10.4.2. Declaring an observer method
* - an observer method is annotated @Produces
*
15 years, 11 months
JBoss Tools SVN: r22201 - in trunk/bpel/docs/reference/en-US: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2010-05-19 10:56:48 -0400 (Wed, 19 May 2010)
New Revision: 22201
Added:
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_10.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_11.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_12.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_4.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_5.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_6.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_7.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_8.png
trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_9.png
Modified:
trunk/bpel/docs/reference/en-US/modules/reference.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/browse/TOOLSDOC-23 - Described creating wizards and Business Process Editor in the reference section.</p>
</body></html>
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_10.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_10.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_11.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_11.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_12.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_12.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_4.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_5.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_5.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_6.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_6.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_7.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_7.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_8.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_8.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_9.png
===================================================================
(Binary files differ)
Property changes on: trunk/bpel/docs/reference/en-US/images/reference/bpel_ref_9.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/bpel/docs/reference/en-US/modules/reference.xml
===================================================================
--- trunk/bpel/docs/reference/en-US/modules/reference.xml 2010-05-19 13:50:47 UTC (rev 22200)
+++ trunk/bpel/docs/reference/en-US/modules/reference.xml 2010-05-19 14:56:48 UTC (rev 22201)
@@ -9,7 +9,7 @@
</keywordset>
</chapterinfo>
<title>Reference</title>
- <para>This chapter includes detailed reference information about all BPEL tools Wizards and editors.</para>
+ <para>This chapter includes detailed reference information about all BPEL tools wizards and editors.</para>
<section>
<title>Wizards</title>
<section>
@@ -24,7 +24,7 @@
</imageobject>
</mediaobject>
</figure>
- <para>The wizard consists of only one page:</para>
+ <para>It consists of only one page:</para>
<itemizedlist>
<listitem><para>On the page you can adjust the name of the project and the directory where it will be created.</para>
<para>If "<property>Use default</property>" option is checked the output directory will be the workspace,
@@ -42,7 +42,8 @@
</section>
<section>
<title>New BPEL Process file Wizard</title>
- <para>Using New BPEL Process file Wizard user can create BPEL process file and WSDL file if it is necessary.
+ <para>Using <property>New BPEL Process file Wizard</property>
+ user can create BPEL process file and WSDL file if it is necessary.
The wizard includes several pages:</para>
<itemizedlist>
<listitem><para>The first page has the following options to set:</para>
@@ -88,7 +89,7 @@
with the one of messages used within the process is empty.There are no any orchestration logic.</para></listitem>
<listitem><para><emphasis>Synchronous BPEL Process</emphasis> -
similar to Asynchronous BPEL Process temlate except the fact that here
- the caller is notified asynchronously when the process completes.</para></listitem>
+ the caller is notified synchronously when the process completes.</para></listitem>
</itemizedlist></entry>
<entry>Asynchronous BPEL Process</entry>
</row>
@@ -100,7 +101,8 @@
</row>
</tbody>
</tgroup>
- </table> <figure>
+ </table>
+ <figure>
<title>New BPEL Process file Wizard</title>
<mediaobject>
<imageobject>
@@ -110,10 +112,135 @@
</figure>
</listitem>
+ <listitem><para>On the second page the user should select the BPEL project
+ and folder where the process file will be created:</para>
+ <figure>
+ <title>New BPEL Process file Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
</itemizedlist>
+ <note>
+ <para>Process files that are used in the BPEL project must be under the <property>bpelContent</property> folder. Only in this case
+ these files can be deployed to JBoss server.
+ </para>
+ </note>
</section>
+ </section>
+ <section>
+ <title>Editors</title>
+ <section>
+ <title>Business Process Editor</title>
+ <para>Business Process Editor is intended to facilitate the process of changing and
+ adding new logic to BPEL process file.You can open <emphasis>.bpel</emphasis>
+ in this editor by right click the file in the project explorer and selecting
+ <property>Open With...->Business Process Editor</property>
+ </para>
+ <figure>
+ <title>Business Process Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The editor consists of two tabs:<property>Design</property> tab and <property>Source</property> tab.</para>
+ <section>
+ <title>Design tab</title>
+ <para>Design tab is the main part of Business Process Editor.It consists of 3 parts:</para>
+ <itemizedlist>
+ <listitem><para>Visual Pane:</para>
+ <figure>
+ <title>Visual Pane of Business Process Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The Visual Pane graphically displays the order in which the activities are executed.</para>
+ </listitem>
+ <listitem><para>Palette:</para>
+ <figure>
+ <title>Palette of Business Process Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_7.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>The <property>Palette</property> represents different elements of the BPEL activities
+ organized into functional categories.
+ Using it the user can easily add new elements to the sequence activity.
+ To do this,he should just click the required element and then drug
+ and drop it to the place on the Visual Pane where it should be added.</para>
+ </listitem>
+ <listitem><para>Behavior Components View:</para>
+ <figure>
+ <title>Behavior Components View of Business Process Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_8.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Execution behavior components are grouped into the <property>
+ Behavior Components View</property>.
+ The view is also fully syncronized with Properties view where you can customize all
+ the properties of the component.</para>
+ <figure>
+ <title>Process Structure View of Business Process Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_9.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>To add an element to some component group click plus(<inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_10.png"/>
+ </imageobject>
+ </inlinemediaobject>) icon,
+ for its deleting you should click the element and
+ use its <property>Delete</property> option in the popup menu.</para>
+ </listitem>
+
+ </itemizedlist>
+
+
+ </section>
+ <section>
+ <title>Source tab</title>
+ <para>Source tab can be used for editing BPEL process file directly.
+ The validation of file structure is also available.
+ </para>
+ <figure>
+ <title>Validation error in Source tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_11.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>If the user wants to disable/unable validation he can do it by following
+ <property>Window->Preferences->Validation</property>.</para>
+ <figure>
+ <title>Validation error in Source tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/reference/bpel_ref_12.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+ </section>
</section>
+
</chapter>
15 years, 11 months
JBoss Tools SVN: r22200 - trunk/jst/plugins/org.jboss.tools.jst.web.ui.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-05-19 09:50:47 -0400 (Wed, 19 May 2010)
New Revision: 22200
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
Log:
https://jira.jboss.org/browse/JBIDE-6309
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-19 12:32:30 UTC (rev 22199)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-19 13:50:47 UTC (rev 22200)
@@ -745,8 +745,8 @@
id="xhtml_attribute_value">
</contextType>
<include
- file="/src/templates/xhtmldefault-templates.xml"
- translations="/src/templates/xhtmldefault-templates.properties">
+ file="templates/xhtmldefault-templates.xml"
+ translations="$nl$/templates/xhtmldefault-templates.properties">
</include>
</extension>
15 years, 11 months
JBoss Tools SVN: r22199 - trunk/jst/plugins/org.jboss.tools.jst.web.ui.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-05-19 08:32:30 -0400 (Wed, 19 May 2010)
New Revision: 22199
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
Log:
https://jira.jboss.org/browse/JBIDE-6309
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-19 09:52:48 UTC (rev 22198)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-19 12:32:30 UTC (rev 22199)
@@ -745,8 +745,8 @@
id="xhtml_attribute_value">
</contextType>
<include
- file="src/templates/xhtmldefault-templates.xml"
- translations="src/templates/xhtmldefault-templates.properties">
+ file="/src/templates/xhtmldefault-templates.xml"
+ translations="/src/templates/xhtmldefault-templates.properties">
</include>
</extension>
15 years, 11 months
JBoss Tools SVN: r22198 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-05-19 05:52:48 -0400 (Wed, 19 May 2010)
New Revision: 22198
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6301
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-05-19 09:13:43 UTC (rev 22197)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-05-19 09:52:48 UTC (rev 22198)
@@ -42,7 +42,7 @@
ViewName_WebProjects=Web Projects
ViewCategory_JBossToolsWeb=JBoss Tools Web
-VPE_Templates=Templates
+VPE_Templates=Code Templates
All_XHTML_context_type_Extension_Element.name=All XHTML
XHTML_New_context_type_Extension_Element.name=New XHTML
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-05-19 09:13:43 UTC (rev 22197)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-05-19 09:52:48 UTC (rev 22198)
@@ -16,7 +16,7 @@
GENERAL=General
# Unknown tags templates dialog messages
-TEMPLATES=Templates
+TEMPLATES=Visual Templates
TEMPLATE=Unknown tag template
UNKNOWN_TAGS_DIALOG_DESCRIPTION=Set up parameters for the unknown tag
TAG_ATTRIBUTES=Set up tag attributes
@@ -87,7 +87,7 @@
BaseActionManager_InsertBefore=Insert Before
BaseActionManager_InsertTag=Insert Tag
BaseActionManager_ReplaceWith=Replace With
-SETUP_TEMPLATE_FOR_MENU=Setup Template for <{0}>...
+SETUP_TEMPLATE_FOR_MENU=Setup Visual Template for <{0}>...
INSERT_AROUND=Insert around
INSERT_BEFORE=Insert before
INSERT_AFTER=Insert after
15 years, 11 months
JBoss Tools SVN: r22197 - trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-19 05:13:43 -0400 (Wed, 19 May 2010)
New Revision: 22197
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
Log:
add missing export-package: org.jboss.tools.cdi.internal.core.refactoring
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2010-05-19 06:52:30 UTC (rev 22196)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2010-05-19 09:13:43 UTC (rev 22197)
@@ -29,6 +29,7 @@
org.jboss.tools.cdi.internal.core.impl,
org.jboss.tools.cdi.internal.core.impl.definition,
org.jboss.tools.cdi.internal.core.project.facet,
+ org.jboss.tools.cdi.internal.core.refactoring,
org.jboss.tools.cdi.internal.core.scanner,
org.jboss.tools.cdi.internal.core.scanner.lib,
org.jboss.tools.cdi.internal.core.validation
15 years, 11 months
JBoss Tools SVN: r22196 - in trunk: hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-05-19 02:52:30 -0400 (Wed, 19 May 2010)
New Revision: 22196
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DragAndDropHelper.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
Log:
Fix warnings.
Modified: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2010-05-18 21:26:04 UTC (rev 22195)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/RuleFlowTest.java 2010-05-19 06:52:30 UTC (rev 22196)
@@ -28,7 +28,6 @@
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2010-05-18 21:26:04 UTC (rev 22195)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hibernate/ui/bot/testcase/ConsoleTest.java 2010-05-19 06:52:30 UTC (rev 22196)
@@ -16,6 +16,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.hibernate.ui.bot.testsuite.HibernateTest;
import org.jboss.tools.hibernate.ui.bot.testsuite.Project;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -192,7 +193,7 @@
private void openConsoleConfiguration() {
SWTBot viewBot = open.viewOpen(ActionItem.View.HibernateHibernateConfigurations.LABEL).bot();
- SWTBotTreeItem item = eclipse.selectTreeLocation(viewBot, Project.PROJECT_NAME);
+ SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(viewBot, Project.PROJECT_NAME);
item.doubleClick();
}
}
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DragAndDropHelper.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DragAndDropHelper.java 2010-05-18 21:26:04 UTC (rev 22195)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DragAndDropHelper.java 2010-05-19 06:52:30 UTC (rev 22196)
@@ -40,6 +40,7 @@
* @param targetWidget
*/
public static void dragAndDropOnTo(Widget sourceWidget, Widget targetWidget){
+ log.info("Drag and Drop from " + sourceWidget + " to " + targetWidget);
try {
if (DragAndDropHelper.robot == null){
DragAndDropHelper.robot = new Robot();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-05-18 21:26:04 UTC (rev 22195)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-05-19 06:52:30 UTC (rev 22196)
@@ -325,6 +325,7 @@
* For debug purposes. Displays formatted node
* @param node
*/
+ @SuppressWarnings("unused")
private void displaynsIDOMNode(nsIDOMNode node) {
System.out.println("");
System.out.print("<" + node.getNodeName() + " ");
15 years, 11 months