JBoss Tools SVN: r22295 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-24 15:24:14 -0400 (Mon, 24 May 2010)
New Revision: 22295
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
Log:
https://jira.jboss.org/browse/JBIDE-5808
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2010-05-24 18:43:55 UTC (rev 22294)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2010-05-24 19:24:14 UTC (rev 22295)
@@ -52,5 +52,12 @@
* @return the element annotation of the given annotation type, or a null
* value
*/
- public ITextSourceReference getAnnotationPosition(String annotationTypeName);
+ ITextSourceReference getAnnotationPosition(String annotationTypeName);
+
+ /**
+ * Returns the bean method which has this parameter.
+ *
+ * @return the bean method which has this parameter
+ */
+ IBeanMethod getBeanMethod();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java 2010-05-24 18:43:55 UTC (rev 22294)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java 2010-05-24 19:24:14 UTC (rev 22295)
@@ -29,4 +29,8 @@
return getDelegateAnnotation() != null;
}
-}
+ @Override
+ protected Parameter newParameter() {
+ return new InjectionPointParameter();
+ }
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java 2010-05-24 18:43:55 UTC (rev 22294)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java 2010-05-24 19:24:14 UTC (rev 22295)
@@ -5,6 +5,7 @@
import org.eclipse.jdt.core.IMember;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IBeanMethod;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IParameter;
@@ -93,4 +94,11 @@
return null;
}
-}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IParameter#getBeanMethod()
+ */
+ public IBeanMethod getBeanMethod() {
+ return beanMethod;
+ }
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-05-24 18:43:55 UTC (rev 22294)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-05-24 19:24:14 UTC (rev 22295)
@@ -46,11 +46,13 @@
public ProducerMethod() {}
+ @Override
public void setDefinition(MethodDefinition definition) {
super.setDefinition(definition);
produces = definition.getProducesAnnotation();
}
+ @Override
protected Parameter newParameter() {
return new InjectionPointParameter();
}
15 years, 11 months
JBoss Tools SVN: r22294 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-24 14:43:55 -0400 (Mon, 24 May 2010)
New Revision: 22294
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.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/errorList.txt
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/tck/TCKTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/browse/JBIDE-5808
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-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -443,6 +443,23 @@
return null;
}
+ /**
+ * Returns all the injection point parameters of the bean class.
+ *
+ * @param bean
+ * @return
+ */
+ public static Set<IInjectionPointParameter> getInjectionPointParameters(IClassBean bean) {
+ Set<IInjectionPoint> points = bean.getInjectionPoints();
+ Set<IInjectionPointParameter> params = new HashSet<IInjectionPointParameter>();
+ for (IInjectionPoint injection : points) {
+ if(injection instanceof IInjectionPointParameter) {
+ params.add((IInjectionPointParameter)injection);
+ }
+ }
+ return params;
+ }
+
private static IType getSuperClass(IType type) throws JavaModelException {
String superclassName = type.getSuperclassName();
if(superclassName!=null) {
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-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -832,9 +832,8 @@
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 IInjectionPointParameter) {
IInjectionPointParameter pinjection = (IInjectionPointParameter)injection;
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-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-24 18:43:55 UTC (rev 22294)
@@ -102,9 +102,6 @@
and qualifier @Default, and may not validly make use of the JTA UserTransaction
according to the Java EE platform specification
-
-
-
3.7.1. Declaring a bean constructor
- bean class has more than one constructor annotated @Inject
- bean constructor has a parameter annotated @Disposes, or @Observes
@@ -112,6 +109,9 @@
3.8.1. Declaring an injected field
- injected field is annotated @Produces
+
+
+
3.9.1. Declaring an initializer method
- generic method of a bean is annotated @Inject (initializer method is a non-abstract,
non-static, non-generic method of a bean class)
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-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSuite.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -18,6 +18,7 @@
import org.jboss.tools.cdi.core.test.tck.EnterpriseQualifierDefinitionTest;
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.InjectionPointTest;
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;
@@ -44,6 +45,7 @@
suite.addTestSuite(EnterpriseStereotypeDefinitionTest.class);
suite.addTestSuite(StereotypeInheritenceTest.class);
suite.addTestSuite(ProducerMethodDefinitionTest.class);
+ suite.addTestSuite(InjectionPointTest.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/InjectionPointTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class InjectionPointTest extends TCKTest {
+
+ /**
+ * Section 3.7.1 - Declaring a bean constructor
+ * - All parameters of a bean constructor are injection points.
+ */
+ public void testQualifierTypeAnnotatedConstructor() {
+ IClassBean bean = getClassBean("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Duck.java");
+ Set<IInjectionPointParameter> points = CDIUtil.getInjectionPointParameters(bean);
+ assertEquals("There should be two injection point parameters in the bean.", 2, points.size());
+ }
+
+ /**
+ * Section 3.9.1 - Declaring an initializer method
+ * - All initializer method parameters are injection points.
+ */
+ public void testBindingTypeOnInitializerParameter() {
+ IClassBean bean = getClassBean("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Mainz.java");
+ Set<IInjectionPointParameter> points = CDIUtil.getInjectionPointParameters(bean);
+ assertEquals("There should be two injection point parameters in the bean.", 1, points.size());
+ }
+}
\ 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/InjectionPointTest.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/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-05-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.FileFilter;
+import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
@@ -22,6 +23,9 @@
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
@@ -115,6 +119,18 @@
return beans;
}
+ protected IClassBean getClassBean(String path) {
+ IFile file = tckProject.getFile(path);
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ for (IBean bean : beans) {
+ if(bean instanceof IClassBean) {
+ return (IClassBean)bean;
+ }
+ }
+ fail("Can't find a class bean in " + path);
+ return null;
+ }
+
protected IQualifierDeclaration getQualifierDeclarationFromBeanClass(String beanClassFilePath, String annotationTypeName) throws JavaModelException {
IFile file = tckProject.getFile(beanClassFilePath);
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
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-24 17:18:22 UTC (rev 22293)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-24 18:43:55 UTC (rev 22294)
@@ -691,6 +691,9 @@
* 3.4.2. Declaring a producer field
* - producer field is annotated @Inject
*
+ * 3.8.1. Declaring an injected field
+ * - injected field is annotated @Produces
+ *
* @throws Exception
*/
public void testProducerAnnotatedInject() throws Exception {
15 years, 11 months
JBoss Tools SVN: r22293 - 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-24 13:18:22 -0400 (Mon, 24 May 2010)
New Revision: 22293
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.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: Non-static method of a session bean class has a parameter annotated @Observes, and the method is not a business method of the EJB
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-24 17:06:45 UTC (rev 22292)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-24 17:18:22 UTC (rev 22293)
@@ -413,6 +413,8 @@
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
+
+ validateSessionBeanMethod(bean, observer, declarations, CDIValidationMessages.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN);
}
}
@@ -431,8 +433,8 @@
boundDisposers.addAll(disposerMethods);
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);
@@ -448,8 +450,8 @@
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) {
@@ -465,11 +467,11 @@
}
/*
- * 3.3.6. Declaring a disposer method - a disposer method has a
- * parameter annotated @Observes.
+ * 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.
+ * 10.4.2. Declaring an observer method
+ * - a observer method has a parameter annotated @Disposes.
*/
Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
boolean observesExists = false;
@@ -488,11 +490,11 @@
}
/*
- * 3.3.6. Declaring a disposer method - a disposer method is
- * annotated @Inject.
+ * 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.9.1. Declaring an initializer method
+ * - an initializer method has a parameter annotated @Disposes
*
* 3.7.1. Declaring a bean constructor
* - bean constructor has a parameter annotated @Disposes
@@ -512,16 +514,15 @@
}
/*
- * 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);
/*
- * 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;
@@ -534,8 +535,8 @@
}
/*
- * 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;
@@ -549,9 +550,8 @@
}
/*
- * 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)) {
for (ITextSourceReference declaration : disposerDeclarations) {
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-24 17:06:45 UTC (rev 22292)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-24 17:18:22 UTC (rev 22293)
@@ -91,7 +91,7 @@
{CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_constructorParameterIllegallyAnnotated_label},
// {CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_genericMethodAnnotatedInject_label},
{CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleObservingParameters_label},
-// {CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalObserverInSessionBean_label},
+ {CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalObserverInSessionBean_label},
// {CDIPreferences.ILLEGAL_CONDITIONAL_OBSERVER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalConditionalObserver_label},
},
CDICorePlugin.PLUGIN_ID
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-24 17:06:45 UTC (rev 22292)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-24 17:18:22 UTC (rev 22293)
@@ -856,6 +856,17 @@
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, 28, 28);
}
+ /**
+ * 10.4.2. Declaring an observer method
+ * - non-static method of a session bean class has a parameter annotated @Observes, and the method is not a business method of the EJB
+ *
+ * @throws Exception
+ */
+ public void testObserverMethodOnEnterpriseBeanNotBusinessMethodOrStaticFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/notBusinessMethod/TibetanTerrier_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_OBSERVER_IN_SESSION_BEAN, 25);
+ }
+
public static int getMarkersNumber(IResource resource) {
return AbstractResourceMarkerTest.getMarkersNumberByGroupName(resource, null);
}
15 years, 11 months
JBoss Tools SVN: r22292 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-24 13:06:45 -0400 (Mon, 24 May 2010)
New Revision: 22292
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.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 rules: 1. Bean class has more than one constructor annotated @Inject; 2. Bean constructor has a parameter annotated @Disposes; 3. Bean constructor has a parameter annotated @Observes; 4. Observer method is annotated @Inject; 5. Method has more than one parameter annotated @Observes
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2010-05-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -324,8 +324,10 @@
if(srcs[i].isPrefixOf(path)) {
if(f.getName().endsWith(".java")) {
ICompilationUnit unit = EclipseUtil.getCompilationUnit(f);
- IType[] ts = unit.getTypes();
- fileSet.add(f.getFullPath(), ts);
+ if(unit!=null) {
+ IType[] ts = unit.getTypes();
+ fileSet.add(f.getFullPath(), ts);
+ }
}
return false;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2010-05-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -38,7 +38,7 @@
*
* @return a set of bean constructors of the bean.
*/
- Set<IBeanMethod> getBeanConstructor();
+ Set<IBeanMethod> getBeanConstructors();
/**
* Obtains the interceptor bindings of the bean.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2010-05-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -15,7 +15,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,7 +30,6 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
-import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
@@ -42,7 +40,6 @@
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.definition.FieldDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
-import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.text.ITextSourceReference;
@@ -102,13 +99,22 @@
return (TypeDefinition)definition;
}
- public Set<IBeanMethod> getBeanConstructor() {
+ public Set<IBeanMethod> getBeanConstructors() {
Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+ IBeanMethod defaultConstructor = null;
for (BeanMethod m: methods) {
if(m.getDefinition().isConstructor()) {
- result.add(m);
+ if(m.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME)==null && m.getMethod().getNumberOfParameters()==0) {
+ defaultConstructor = m;
+ } else {
+ result.add(m);
+ }
}
}
+ // If a bean class does not explicitly declare a constructor using @Inject, the constructor that accepts no parameters is the bean constructor.
+ if(result.isEmpty() && defaultConstructor!=null) {
+ result.add(defaultConstructor);
+ }
return result;
}
@@ -180,7 +186,7 @@
public Set<IBeanMethod> getObserverMethods() {
Set<IBeanMethod> result = new HashSet<IBeanMethod>();
for (BeanMethod m: methods) {
- if(m.isDisposer()) {
+ if(m.isObserver()) {
result.add(m);
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-05-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -57,7 +57,7 @@
MethodDefinition m = new MethodDefinition();
m.setTypeDefinition(this);
m.setMethod(ms[i], context);
- if(m.isCDIAnnotated()) {
+ if(m.isCDIAnnotated() || (ms[i].isConstructor() && ms[i].getNumberOfParameters()==0)) {
methods.add(m);
}
}
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-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -271,6 +271,7 @@
if (reporter.isCancelled() || file == null || !file.isAccessible()) {
return;
}
+ displaySubtask(CDIValidationMessages.VALIDATING_RESOURCE, new String[] {file.getProject().getName(), file.getName()});
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
for (IBean bean : beans) {
validateBean(bean);
@@ -337,6 +338,7 @@
private void validateClassBean(IClassBean bean) {
validateDisposers(bean);
+ validateObserves(bean);
if (!(bean instanceof ISessionBean)) {
validateManagedBean(bean);
} else {
@@ -347,7 +349,7 @@
}
private void validateConstructors(IClassBean bean) {
- Set<IBeanMethod> constructors = bean.getBeanConstructor();
+ Set<IBeanMethod> constructors = bean.getBeanConstructors();
if(constructors.size()>1) {
Set<IAnnotationDeclaration> injects = new HashSet<IAnnotationDeclaration>();
for (IBeanMethod constructor : constructors) {
@@ -368,6 +370,52 @@
}
}
+ private void validateObserves(IClassBean bean) {
+ Set<IBeanMethod> observes = bean.getObserverMethods();
+ if (observes.isEmpty()) {
+ return;
+ }
+ for (IBeanMethod observer : observes) {
+ List<IParameter> params = observer.getParameters();
+ Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
+ for (IParameter param : params) {
+ ITextSourceReference declaration = param.getAnnotationPosition(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
+ if (declaration != null) {
+ declarations.add(declaration);
+ }
+ }
+ /*
+ * 10.4.2. Declaring an observer method
+ * - method has more than one parameter annotated @Observes
+ */
+ if(declarations.size()>1) {
+ for (ITextSourceReference declaration : declarations) {
+ addError(CDIValidationMessages.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, declaration, bean.getResource());
+ }
+ }
+ /*
+ * 3.7.1. Declaring a bean constructor
+ * - bean constructor has a parameter annotated @Observes
+ *
+ * 10.4.2. Declaring an observer method
+ * - observer method is annotated @Inject
+ */
+ IAnnotationDeclaration injectDeclaration = observer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ try {
+ if (injectDeclaration != null) {
+ String pref = observer.getMethod().isConstructor()?CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED:CDIPreferences.OBSERVER_ANNOTATED_INJECT;
+ String message = observer.getMethod().isConstructor()?CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES:CDIValidationMessages.OBSERVER_ANNOTATED_INJECT;
+ addError(message, pref, injectDeclaration, bean.getResource());
+ for (ITextSourceReference declaration : declarations) {
+ addError(message, pref, declaration, bean.getResource());
+ }
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ }
+
private void validateDisposers(IClassBean bean) {
Set<IBeanMethod> disposers = bean.getDisposers();
if (disposers.isEmpty()) {
@@ -387,8 +435,7 @@
* 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());
}
@@ -436,8 +483,7 @@
}
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());
}
}
@@ -447,13 +493,22 @@
*
* 3.9.1. Declaring an initializer method - an initializer method
* has a parameter annotated @Disposes
+ *
+ * 3.7.1. Declaring a bean constructor
+ * - bean constructor has a parameter annotated @Disposes
*/
IAnnotationDeclaration injectDeclaration = disposer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
- 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());
+ try {
+ if (injectDeclaration != null) {
+ String pref = disposer.getMethod().isConstructor()?CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED:CDIPreferences.DISPOSER_ANNOTATED_INJECT;
+ String message = disposer.getMethod().isConstructor()?CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES:CDIValidationMessages.DISPOSER_ANNOTATED_INJECT;
+ addError(message, pref, injectDeclaration, bean.getResource());
+ for (ITextSourceReference declaration : disposerDeclarations) {
+ addError(message, pref, declaration, bean.getResource());
+ }
}
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
}
/*
@@ -983,14 +1038,12 @@
}
}
if (!hasDefaultConstructor) {
- 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 {
// 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);
@@ -1095,8 +1148,7 @@
}
}
if (!typeWasFound) {
- addError(CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, typedDeclaration,
- bean.getResource());
+ addError(CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, typedDeclaration, bean.getResource());
}
}
}
@@ -1135,8 +1187,7 @@
}
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());
}
}
}
@@ -1221,8 +1272,7 @@
Set<IScopeDeclaration> scopeDeclarations = stereotype.getScopeDeclarations();
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-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -65,7 +65,8 @@
public static String MULTIPLE_DISPOSERS_FOR_PRODUCER;
public static String ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN;
public static String MULTIPLE_INJECTION_CONSTRUCTORS;
- public static String CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED;
+ public static String CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES;
+ public static String CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES;
public static String GENERIC_METHOD_ANNOTATED_INJECT;
public static String MULTIPLE_OBSERVING_PARAMETERS;
public static String ILLEGAL_OBSERVER_IN_SESSION_BEAN;
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-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-24 17:06:45 UTC (rev 22292)
@@ -44,7 +44,8 @@
MULTIPLE_DISPOSERS_FOR_PRODUCER=There are multiple disposer methods for a single producer method
ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN=Non-static field of a session bean class is annotated @Produces
MULTIPLE_INJECTION_CONSTRUCTORS=Bean class has more than one constructor annotated @Inject
-CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED=Bean constructor has a parameter annotated @Disposes, or @Observes
+CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES=Bean constructor has a parameter annotated @Disposes
+CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES=Bean constructor has a parameter annotated @Observes
GENERIC_METHOD_ANNOTATED_INJECT=Generic method of a bean is annotated @Inject
MULTIPLE_OBSERVING_PARAMETERS=Method has more than one parameter annotated @Observes
ILLEGAL_OBSERVER_IN_SESSION_BEAN=Non-static method of a session bean class has a parameter annotated @Observes, and the method is not a business method of the EJB
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-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -78,7 +78,7 @@
new String[][]{
{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_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.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
@@ -87,10 +87,10 @@
{CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_noProducerMatchingDisposer_label},
{CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposersForProducer_label},
{CDIPreferences.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerFieldInSessionBean_label},
-// {CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleInjectionConstructors_label},
-// {CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_constructorParameterIllegallyAnnotated_label},
+ {CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleInjectionConstructors_label},
+ {CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_constructorParameterIllegallyAnnotated_label},
// {CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_genericMethodAnnotatedInject_label},
-// {CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleObservingParameters_label},
+ {CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleObservingParameters_label},
// {CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalObserverInSessionBean_label},
// {CDIPreferences.ILLEGAL_CONDITIONAL_OBSERVER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalConditionalObserver_label},
},
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.java 2010-05-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -22,7 +22,8 @@
class AustralianTerrier_Broken
{
- public @Inject void observesAfterBeanDiscovery(@Observes AfterBeanDiscovery discovery)
+ @Inject
+ public void observesAfterBeanDiscovery(@Observes AfterBeanDiscovery discovery)
{
}
}
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-24 15:56:44 UTC (rev 22291)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-24 17:06:45 UTC (rev 22292)
@@ -768,6 +768,28 @@
}
/**
+ * 3.7.1. Declaring a bean constructor
+ * - bean constructor has a parameter annotated @Disposes
+ *
+ * @throws Exception
+ */
+ public void testConstructorHasDisposesParameter() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/constructorHasDisposesParameter/DisposingConstructor.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_DISPOSES, 24, 25);
+ }
+
+ /**
+ * 3.7.1. Declaring a bean constructor
+ * - bean constructor has a parameter annotated @Observes
+ *
+ * @throws Exception
+ */
+ public void testConstructorHasObservesParameter() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/constructorHasObservesParameter/ObservingConstructor.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.CONSTRUCTOR_PARAMETER_ANNOTATED_OBSERVES, 25, 26);
+ }
+
+ /**
* 3.9.1. Declaring an initializer method
* - an initializer method has a parameter annotated @Disposes
*
@@ -792,6 +814,17 @@
/**
* 10.4.2. Declaring an observer method
+ * - method has more than one parameter annotated @Observes
+ *
+ * @throws Exception
+ */
+ public void testObserverMethodMustHaveOnlyOneEventParameter() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/tooManyParameters/YorkshireTerrier_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.MULTIPLE_OBSERVING_PARAMETERS, 24, 24);
+ }
+
+ /**
+ * 10.4.2. Declaring an observer method
* - an observer method is annotated @Produces
*
* @throws Exception
@@ -803,6 +836,17 @@
/**
* 10.4.2. Declaring an observer method
+ * - observer method is annotated @Inject
+ *
+ * @throws Exception
+ */
+ public void testObserverMethodAnnotatedInitializerFails() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/broken/observer/isInitializer/AustralianTerrier_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.OBSERVER_ANNOTATED_INJECT, 25, 26);
+ }
+
+ /**
+ * 10.4.2. Declaring an observer method
* - a observer method is annotated @Disposes.
*
* @throws Exception
15 years, 11 months
JBoss Tools SVN: r22291 - trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-05-24 11:56:44 -0400 (Mon, 24 May 2010)
New Revision: 22291
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
Log:
JBIDE-6326 - fixing issue with menu
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-24 15:39:29 UTC (rev 22290)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-24 15:56:44 UTC (rev 22291)
@@ -323,7 +323,8 @@
copyMenuAction.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent arg0) {
- resultsText.selectAll();
+ if (resultsText.getSelectionCount() == 0)
+ resultsText.selectAll();
resultsText.copy();
}
@@ -399,11 +400,12 @@
}
public void focusGained(FocusEvent arg0) {
- if (resultsText.getText().trim().length() > 0){
- resultsTextMenu.setVisible(true);
- } else {
- resultsTextMenu.setVisible(false);
- }
+ setMenusForCurrentState();
+// if (resultsText.getText().trim().length() > 0){
+// resultsTextMenu.setVisible(true);
+// } else {
+// resultsTextMenu.setVisible(false);
+// }
}
});
15 years, 11 months
JBoss Tools SVN: r22290 - branches/3.2.helios/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-05-24 11:39:29 -0400 (Mon, 24 May 2010)
New Revision: 22290
Modified:
branches/3.2.helios/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
Log:
JBIDE-6218 - astools compilation error
Modified: branches/3.2.helios/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java
===================================================================
--- branches/3.2.helios/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2010-05-24 15:30:36 UTC (rev 22289)
+++ branches/3.2.helios/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/BuildDeployTest.java 2010-05-24 15:39:29 UTC (rev 22290)
@@ -236,7 +236,7 @@
swc.setAttribute(DeployableServer.TEMP_DEPLOY_DIRECTORY, tempDeploy.toOSString());
swc.setRuntime(runtime);
swc.setAutoPublishTime(1);
- swc.setAutoPublishSetting(Server.AUTO_PUBLISH_ENABLE);
+ swc.setAutoPublishSetting(Server.AUTO_PUBLISH_RESOURCE);
}
server = wc.save(true, new NullProgressMonitor());
15 years, 11 months
JBoss Tools SVN: r22288 - trunk/jsf/docs/userguide/en-US.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-05-24 11:23:30 -0400 (Mon, 24 May 2010)
New Revision: 22288
Modified:
trunk/jsf/docs/userguide/en-US/editors.xml
Log:
https://jira.jboss.org/browse/TOOLSDOC-8 - added the "Export/Import of the Templates for Unknown Tags" section.
Modified: trunk/jsf/docs/userguide/en-US/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en-US/editors.xml 2010-05-24 15:23:01 UTC (rev 22287)
+++ trunk/jsf/docs/userguide/en-US/editors.xml 2010-05-24 15:23:30 UTC (rev 22288)
@@ -1503,7 +1503,7 @@
</section>
</section>
<section id="vpe_templating">
- <title>Visual Templates</title>
+ <title>Visual Templates for Unknown Tags</title>
<para>The VPE also makes it possible to create visual templates for unknown tags.</para>
<para>To call the <property>Template dialog</property> for a tag, right-click on it in
Visual mode and select <emphasis>
@@ -1578,6 +1578,50 @@
<para>Here it's possible to add a new and edit or remove any listed in the table
template.</para>
</section>
+
+ <section id="templates_export_import">
+ <title>Export/Import of the Templates for Unknown Tags</title>
+ <para>If you have a number of custom tags for which you have defined visual templates, you may need to share
+ the templates definitions with other team members. In this case you can use export/import functionality for unknown tag templates.</para>
+
+ <para>To export all visual templates you defined for unknown tags, navigate to <emphasis>
+ <property>File > Export > Other > Unknown tags templates</property>.</emphasis> Here is what the wizard looks like.</para>
+
+ <figure>
+ <title>Export of Unknown Tags Templates</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/export_template.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>At this point click <emphasis>
+ <property>Browse</property></emphasis> to set the path where to save the external XML file with templates
+ and then press <emphasis>
+ <property>Finish</property>
+ </emphasis>
+ to complete the export.</para>
+
+ <para>For import, use the similar steps. Follow to <emphasis>
+ <property>File > Import > Other > Unknown tags templates</property></emphasis> to open the import wizard.
+ Click <emphasis>
+ <property>Browse</property></emphasis> to point to the XML file which stores the custom tags templates and
+ then hit <emphasis>
+ <property>Finish</property></emphasis> to complete the import.
+ </para>
+
+ <figure>
+ <title>Import of Custom Tags Templates</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/import_template.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+
+
<section id="AdvancedSettings954">
<title>VPE Toolbar</title>
<para>The Visual Page Editor toolbar includes the next buttons: </para>
15 years, 11 months
JBoss Tools SVN: r22287 - trunk/jsf/docs/userguide/en-US/images/visual_page.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-05-24 11:23:01 -0400 (Mon, 24 May 2010)
New Revision: 22287
Added:
trunk/jsf/docs/userguide/en-US/images/visual_page/export_template.png
trunk/jsf/docs/userguide/en-US/images/visual_page/import_template.png
Log:
https://jira.jboss.org/browse/TOOLSDOC-8 - added new images for the "Export/Import of the Templates for Unknown Tags" section.
Added: trunk/jsf/docs/userguide/en-US/images/visual_page/export_template.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/visual_page/export_template.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/visual_page/import_template.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/visual_page/import_template.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 11 months
JBoss Tools SVN: r22286 - trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-05-24 11:03:51 -0400 (Mon, 24 May 2010)
New Revision: 22286
Added:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDITextExtTestSuite.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-6311
Added: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDITextExtTestSuite.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDITextExtTestSuite.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDITextExtTestSuite.java 2010-05-24 15:03:51 UTC (rev 22286)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.text.ext.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+public class CDITextExtTestSuite extends TestSuite {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("CDI Text Ext Tests");
+ suite.addTest(InjectedPointHyperlinkDetectorTest.suite());
+ suite.addTest(ProducerDisposerHyperlinkDetectorTest.suite());
+ suite.addTest(InjectedPointInProducerMethodHyperlinkDetectorTest.suite());
+ return suite;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CDITextExtTestSuite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java 2010-05-24 14:46:12 UTC (rev 22285)
+++ trunk/cdi/tests/org.jboss.tools.cdi.text.ext.test/src/org/jboss/tools/cdi/text/ext/test/CdiTextExtAllTests.java 2010-05-24 15:03:51 UTC (rev 22286)
@@ -1,15 +1,15 @@
package org.jboss.tools.cdi.text.ext.test;
+import org.jboss.tools.cdi.core.test.CDICoreTestSetup;
+
import junit.framework.Test;
import junit.framework.TestSuite;
public class CdiTextExtAllTests {
public static Test suite() {
TestSuite suite = new TestSuite(CdiTextExtAllTests.class.getName());
- suite.addTest(InjectedPointHyperlinkDetectorTest.suite());
- suite.addTest(ProducerDisposerHyperlinkDetectorTest.suite());
- suite.addTest(InjectedPointInProducerMethodHyperlinkDetectorTest.suite());
+ suite.addTest(new CDICoreTestSetup(CDITextExtTestSuite.suite()));
return suite;
}
}
15 years, 11 months