JBoss Tools SVN: r43109 - branches/jbosstools-3.3.x/runtime/tests.
by jbosstools-commits@lists.jboss.org
Author: psuchy
Date: 2012-08-20 09:10:24 -0400 (Mon, 20 Aug 2012)
New Revision: 43109
Modified:
branches/jbosstools-3.3.x/runtime/tests/pom.xml
Log:
Modified: branches/jbosstools-3.3.x/runtime/tests/pom.xml
===================================================================
--- branches/jbosstools-3.3.x/runtime/tests/pom.xml 2012-08-20 12:42:24 UTC (rev 43108)
+++ branches/jbosstools-3.3.x/runtime/tests/pom.xml 2012-08-20 13:10:24 UTC (rev 43109)
@@ -14,6 +14,7 @@
<packaging>pom</packaging>
<modules>
<module>org.jboss.tools.runtime.test</module>
+ <module>org.jboss.tools.runtime.as.ui.bot.test</module>
</modules>
</project>
12 years, 4 months
JBoss Tools SVN: r43108 - in trunk: build/parent and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mickael_istria
Date: 2012-08-20 08:42:24 -0400 (Mon, 20 Aug 2012)
New Revision: 43108
Modified:
trunk/as/tests/org.jboss.tools.as.test.core/pom.xml
trunk/build/parent/pom.xml
Log:
JBIDE-12420: propage skipPrivateRequirements to AS.
Modified: trunk/as/tests/org.jboss.tools.as.test.core/pom.xml
===================================================================
(Binary files differ)
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2012-08-20 12:10:39 UTC (rev 43107)
+++ trunk/build/parent/pom.xml 2012-08-20 12:42:24 UTC (rev 43108)
@@ -22,17 +22,23 @@
<systemProperties></systemProperties>
<platformSystemProperties></platformSystemProperties>
<maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
+
<swtbot.test.skip>true</swtbot.test.skip>
<!-- Used to install 3rd-party runtimes for testing -->
<skipRequirements>${skipTests}</skipRequirements>
+ <!-- Skip downloading private stuff, to be propagated to tests to skip executing test based on private stuff -->
+ <!-- See JBIDE-12420 -->
+ <skipPrivateRequirements>true</skipPrivateRequirements>
<requirementsDirectory>${project.build.directory}/requirements</requirementsDirectory>
+ <!-- Tests Timeout in seconds -->
+ <surefire.timeout>2400</surefire.timeout>
+ <!-- Default coverage filter, to be overriden when necessary -->
+ <coverage.filter>org.jboss.tools.*</coverage.filter>
<!-- target files available for building: multiple sites, 1 unified site,
1 local mirrored site -->
- <target.platform.classifier.unified>unified
- </target.platform.classifier.unified>
- <target.platform.classifier.local>local
- </target.platform.classifier.local>
+ <target.platform.classifier.unified>unified</target.platform.classifier.unified>
+ <target.platform.classifier.local>local</target.platform.classifier.local>
<!-- 1a. URL of latest JBT target platform site -->
<jbosstools-target-site>http://download.jboss.org/jbosstools/updates/target-platform_3.4.juno.SR0...</jbosstools-target-site>
@@ -73,11 +79,6 @@
<!-- 5. extra requirements (for 3rd party "Extras" site) -->
<jboss-requirements-composite-extras-mirror>http://download.jboss.org/jbosstools/updates/juno/extras/</jboss-requirements-composite-extras-mirror>
- <!-- Tests Timeout in seconds -->
- <surefire.timeout>2400</surefire.timeout>
- <!-- Default coverage filter, to be overriden when necessary -->
- <coverage.filter>org.jboss.tools.*</coverage.filter>
-
<!-- JBIDE-11700, JBIDE-11865: latest stable build of m2e-apt for use with JBDS product builds -->
<m2e-apt>http://download.jboss.org/jbosstools/updates/requirements/m2eclipse/m2e-a...</m2e-apt>
12 years, 4 months
JBoss Tools SVN: r43107 - in branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test: src/org/jboss/tools/runtime/as/ui/bot/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: psuchy
Date: 2012-08-20 08:10:39 -0400 (Mon, 20 Aug 2012)
New Revision: 43107
Added:
branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/pom.xml
branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/ProjectTestsSuite.java
Log:
mavenization of org.jboss.tools.runtime.as.ui.bot.test
Added: branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/pom.xml
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ application/xml
Added: branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/ProjectTestsSuite.java
===================================================================
--- branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/ProjectTestsSuite.java (rev 0)
+++ branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/ProjectTestsSuite.java 2012-08-20 12:10:39 UTC (rev 43107)
@@ -0,0 +1,26 @@
+package org.jboss.tools.runtime.as.ui.bot.test;
+
+import org.jboss.tools.runtime.as.ui.bot.test.detector.RuntimeDuplications;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.ServerWithSeam;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.DetectSeam22;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam23.CheckSeam23;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam23.DetectSeam23;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.server.jboss7.DetectJBoss7;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.server.jboss7.OperateJBoss7;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({
+ //DetectJBoss7.class,
+ //OperateJBoss7.class,
+ DetectSeam22.class,
+ CheckSeam22.class,
+ DetectSeam23.class,
+ CheckSeam23.class
+})
+public class ProjectTestsSuite {
+
+}
12 years, 4 months
JBoss Tools SVN: r43106 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: src/org/jboss/tools/hb/ui/bot/suite and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-20 08:01:56 -0400 (Mon, 20 Aug 2012)
New Revision: 43106
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/DebugSuite.java
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/pom.xml
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java
Log:
Debug suite adn profile added, failing jobs removed from jenkins suite until fixed
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/pom.xml
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/pom.xml 2012-08-20 08:03:37 UTC (rev 43105)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/pom.xml 2012-08-20 12:01:56 UTC (rev 43106)
@@ -57,6 +57,12 @@
</properties>
</profile>
<profile>
+ <id>debug</id>
+ <properties>
+ <test.suite.class>org.jboss.tools.hb.ui.bot.suite.DebugSuite</test.suite.class>
+ </properties>
+ </profile>
+ <profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/DebugSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/DebugSuite.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/DebugSuite.java 2012-08-20 12:01:56 UTC (rev 43106)
@@ -0,0 +1,22 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.view.JPADetailViewTest;
+import org.jboss.tools.hb.ui.bot.test.view.PackageInfoTest;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Suite of tests for to be executed on jenkins slave
+ * Same test from Hibernate suite are not here because of known issues
+ * @author jpeterka
+ *
+ */
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({
+ JPADetailViewTest.class,
+ PackageInfoTest.class
+ })
+public class DebugSuite {
+
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/DebugSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java 2012-08-20 08:03:37 UTC (rev 43105)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java 2012-08-20 12:01:56 UTC (rev 43106)
@@ -25,8 +25,8 @@
CreateRevengFileTest.class,
CreateMappingFileTest.class,
EditMappingFileTest.class,
- JPADetailViewTest.class,
- PackageInfoTest.class
+ //JPADetailViewTest.class, // failing, investigate
+ //PackageInfoTest.class // failing, investigate
})
public class JenkinsSuite {
12 years, 4 months
JBoss Tools SVN: r43105 - in branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser: portlet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-20 04:03:37 -0400 (Mon, 20 Aug 2012)
New Revision: 43105
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java
Log:
Changed simple string to regex (to match on Windows)
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java 2012-08-17 23:18:58 UTC (rev 43104)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java 2012-08-20 08:03:37 UTC (rev 43105)
@@ -1,5 +1,8 @@
package org.jboss.tools.portlet.ui.bot.matcher.browser;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.hamcrest.Description;
@@ -76,7 +79,10 @@
if ("".equals(expectedText)){
return pageText.equals(expectedText);
}
- return pageText.contains(expectedText);
+ System.out.println(pageText);
+ Pattern p = Pattern.compile(expectedText, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+ Matcher m = p.matcher(pageText);
+ return m.matches();
}
@Override
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java 2012-08-17 23:18:58 UTC (rev 43104)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java 2012-08-20 08:03:37 UTC (rev 43105)
@@ -28,7 +28,7 @@
public boolean matchesSafely(PortletDefinition portletTitle) {
pageMatcher = new PageSourceMatcher(PORTAL_URL + portletTitle.getPage(), duration);
pageMatcher.setBot(getBot());
- return pageMatcher.matchesSafely("<span class=\"portlet-titlebar-title\">" + portletTitle.getDisplayName() + "</span>");
+ return pageMatcher.matchesSafely(".*<span class=(.?\")?portlet-titlebar-title(.?\")?>" + portletTitle.getDisplayName() + "</span>.*");
}
@Override
12 years, 4 months
JBoss Tools SVN: r43104 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core: generic and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-17 19:18:58 -0400 (Fri, 17 Aug 2012)
New Revision: 43104
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/GenericClassBean.java
Log:
JBIDE-12417
https://issues.jboss.org/browse/JBIDE-12417
Replaced Set by Collection in interfaces.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2012-08-17 23:13:26 UTC (rev 43103)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2012-08-17 23:18:58 UTC (rev 43104)
@@ -152,7 +152,7 @@
}
- public Set<IBean> getResolvedBeans(Set<IBean> result) {
+ public Collection<IBean> getResolvedBeans(Collection<IBean> result) {
Set<IBean> defaultBeans = new HashSet<IBean>();
for (IBean b: result) {
if(isBeanDefault(b)) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/GenericClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/GenericClassBean.java 2012-08-17 23:13:26 UTC (rev 43103)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/generic/GenericClassBean.java 2012-08-17 23:18:58 UTC (rev 43104)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.solder.core.generic;
-import java.util.Set;
+import java.util.Collection;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.internal.core.impl.AbstractBeanElement;
@@ -54,7 +54,7 @@
}
public IBean getGenericProducerBean() {
- Set<IBean> bs = getCDIProject().getBeans(genericProducerBean.getTypeDefinition().getType().getPath());
+ Collection<IBean> bs = getCDIProject().getBeans(genericProducerBean.getTypeDefinition().getType().getPath());
for (IBean b: bs) {
if(b instanceof AbstractBeanElement) {
if(((AbstractBeanElement)b).getDefinition() == genericProducerBean) {
12 years, 4 months
JBoss Tools SVN: r43103 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: core/extension/feature and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-17 19:13:26 -0400 (Fri, 17 Aug 2012)
New Revision: 43103
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/IBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeansXMLData.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.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/EventBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.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/ProducerField.java
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/StereotypeElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeansXMLDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
Log:
JBIDE-12417
https://issues.jboss.org/browse/JBIDE-12417
Replaced Set by Collection in interfaces.
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 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -721,9 +721,9 @@
* @param bean
* @return
*/
- public static Set<IInjectionPointParameter> getInjectionPointParameters(IClassBean bean) {
+ public static Collection<IInjectionPointParameter> getInjectionPointParameters(IClassBean bean) {
Collection<IInjectionPoint> points = bean.getInjectionPoints();
- Set<IInjectionPointParameter> params = new HashSet<IInjectionPointParameter>();
+ Collection<IInjectionPointParameter> params = new ArrayList<IInjectionPointParameter>();
for (IInjectionPoint injection : points) {
if(injection instanceof IInjectionPointParameter) {
params.add((IInjectionPointParameter)injection);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.core;
import java.util.Collection;
-import java.util.Set;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.common.el.core.resolver.IVariable;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.core;
import java.util.Collection;
-import java.util.Set;
/**
* This interface if common protocol to have access to scoped of bean class or
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IAmbiguousBeanResolverFeature.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core.extension.feature;
-import java.util.Set;
+import java.util.Collection;
import org.jboss.tools.cdi.core.IBean;
@@ -28,6 +28,6 @@
* @param result
* @return
*/
- public Set<IBean> getResolvedBeans(Set<IBean> result);
+ public Collection<IBean> getResolvedBeans(Collection<IBean> result);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -271,12 +271,12 @@
return result;
}
- public Set<IScopeDeclaration> getScopeDeclarations() {
+ public Collection<IScopeDeclaration> getScopeDeclarations() {
return getScopeDeclarations(getCDIProject().getNature(), definition.getAnnotations());
}
- public static Set<IScopeDeclaration> getScopeDeclarations(CDICoreNature n, List<? extends IAnnotationDeclaration> ds) {
- Set<IScopeDeclaration> result = new HashSet<IScopeDeclaration>();
+ public static Collection<IScopeDeclaration> getScopeDeclarations(CDICoreNature n, List<? extends IAnnotationDeclaration> ds) {
+ Collection<IScopeDeclaration> result = new ArrayList<IScopeDeclaration>(1);
for (IAnnotationDeclaration d: ds) {
int k = n.getDefinitions().getAnnotationKind(d.getType());
if(k > 0 && (k & AnnotationDefinition.SCOPE) > 0 && d instanceof IScopeDeclaration) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeansXMLData.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeansXMLData.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeansXMLData.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -17,10 +19,10 @@
public class BeansXMLData {
- private Set<INodeReference> interceptors = new HashSet<INodeReference>();
- private Set<INodeReference> decorators = new HashSet<INodeReference>();
- private Set<INodeReference> stereotypeAlternatives = new HashSet<INodeReference>();
- private Set<INodeReference> typeAlternatives = new HashSet<INodeReference>();
+ private Collection<INodeReference> interceptors = new ArrayList<INodeReference>();
+ private Collection<INodeReference> decorators = new ArrayList<INodeReference>();
+ private Collection<INodeReference> stereotypeAlternatives = new ArrayList<INodeReference>();
+ private Collection<INodeReference> typeAlternatives = new ArrayList<INodeReference>();
private Set<String> interceptorTypes = new HashSet<String>();
private Set<String> decoratorTypes = new HashSet<String>();
@@ -42,62 +44,64 @@
}
}
- public Set<INodeReference> getInterceptors() {
+ public Collection<INodeReference> getInterceptors() {
return interceptors;
}
- public Set<INodeReference> getDecorators() {
+ public Collection<INodeReference> getDecorators() {
return decorators;
}
- public Set<INodeReference> getStereotypeAlternatives() {
+ public Collection<INodeReference> getStereotypeAlternatives() {
return stereotypeAlternatives;
}
- public Set<INodeReference> getTypeAlternatives() {
+ public Collection<INodeReference> getTypeAlternatives() {
return typeAlternatives;
}
- public Set<String> getInterceptorTypes() {
+ public Collection<String> getInterceptorTypes() {
return interceptorTypes;
}
- public Set<String> getDecoratorTypes() {
+ public Collection<String> getDecoratorTypes() {
return decoratorTypes;
}
- public Set<String> getStereotypeAlternativeTypes() {
+ public Collection<String> getStereotypeAlternativeTypes() {
return stereotypeAlternativeTypes;
}
- public Set<String> getTypeAlternativeTypes() {
+ public Collection<String> getTypeAlternativeTypes() {
return typeAlternativeTypes;
}
- public void addInterceptor(INodeReference r) {
- synchronized (this) {
- interceptors.add(r);
- }
+ public synchronized void addInterceptor(INodeReference r) {
+ interceptors.add(r);
if (r.getValue() != null) {
- synchronized (this) {
- interceptorTypes.add(r.getValue());
- }
+ interceptorTypes.add(r.getValue());
}
}
public synchronized void addDecorator(INodeReference r) {
decorators.add(r);
- decoratorTypes.add(r.getValue());
+ if (r.getValue() != null) {
+ decoratorTypes.add(r.getValue());
+ }
}
public synchronized void addStereotypeAlternative(INodeReference r) {
stereotypeAlternatives.add(r);
- stereotypeAlternativeTypes.add(r.getValue());
+ if (r.getValue() != null) {
+ stereotypeAlternativeTypes.add(r.getValue());
+ }
}
public synchronized void addTypeAlternative(INodeReference r) {
typeAlternatives.add(r);
- typeAlternativeTypes.add(r.getValue());
+ if (r.getValue() != null) {
+ typeAlternativeTypes.add(r.getValue());
+ }
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -115,7 +115,7 @@
public CDIProject() {}
- public CDIProject getModifiedCopy(IFile file, Set<IBean> beans) {
+ public CDIProject getModifiedCopy(IFile file, Collection<IBean> beans) {
CDIProject p = null;
try {
p = (CDIProject)clone();
@@ -128,7 +128,7 @@
synchronized(this) {
p.allBeans.addAll(allBeans);
}
- Set<IBean> oldBeans = getBeans(file.getFullPath());
+ Collection<IBean> oldBeans = getBeans(file.getFullPath());
p.allBeans.removeAll(oldBeans);
p.allBeans.addAll(beans);
@@ -239,8 +239,8 @@
public List<INodeReference> getAlternatives(String fullQualifiedTypeName) {
List<INodeReference> result = new ArrayList<INodeReference>();
synchronized (allBeansXMLData) {
- Set<INodeReference> typeAlternatives = allBeansXMLData.getTypeAlternatives();
- Set<INodeReference> stereotypeAlternatives = allBeansXMLData.getStereotypeAlternatives();
+ Collection<INodeReference> typeAlternatives = allBeansXMLData.getTypeAlternatives();
+ Collection<INodeReference> stereotypeAlternatives = allBeansXMLData.getStereotypeAlternatives();
for (INodeReference r: typeAlternatives) {
if(fullQualifiedTypeName.equals(r.getValue())) result.add(r);
}
@@ -269,7 +269,7 @@
return null;
}
- public Set<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames) {
+ public Collection<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames) {
Set<IBean> result = new HashSet<IBean>();
synchronized (this) {
Set<IBean> beans = beansByName.get(name);
@@ -281,7 +281,7 @@
return getResolvedBeans(result, attemptToResolveAmbiguousNames);
}
- public Set<IBean> getResolvedBeans(Set<IBean> result, boolean attemptToResolveAmbiguousness) {
+ public Collection<IBean> getResolvedBeans(Collection<IBean> result, boolean attemptToResolveAmbiguousness) {
if(result.size() > 1) {
Iterator<IBean> it = result.iterator();
while(it.hasNext()) {
@@ -358,7 +358,7 @@
return result;
}
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IQualifierDeclaration... qualifiers) {
Set<IBean> result = new HashSet<IBean>();
IParametedType type = beanType;
@@ -717,11 +717,8 @@
return result.toString();
}
- public synchronized Set<IBean> getBeans(IPath path) {
- Set<IBean> result = new HashSet<IBean>();
- Set<IBean> beans = beansByPath.get(path);
- if(beans != null && !beans.isEmpty()) result.addAll(beans);
- return result;
+ public synchronized Collection<IBean> getBeans(IPath path) {
+ return (beansByPath.containsKey(path)) ? new ArrayList<IBean>(beansByPath.get(path)) : new ArrayList<IBean>(0);
}
static int q = 0;
@@ -750,8 +747,7 @@
public List<INodeReference> getDecoratorClasses(String fullQualifiedTypeName) {
List<INodeReference> result = new ArrayList<INodeReference>();
synchronized (allBeansXMLData) {
- Set<INodeReference> decorators = allBeansXMLData.getDecorators();
- for (INodeReference r: decorators) {
+ for (INodeReference r: allBeansXMLData.getDecorators()) {
if(fullQualifiedTypeName.equals(r.getValue())) result.add(r);
}
}
@@ -770,8 +766,7 @@
String fullQualifiedTypeName) {
List<INodeReference> result = new ArrayList<INodeReference>();
synchronized (allBeansXMLData) {
- Set<INodeReference> interceptors = allBeansXMLData.getInterceptors();
- for (INodeReference r: interceptors) {
+ for (INodeReference r: allBeansXMLData.getInterceptors()) {
if(fullQualifiedTypeName.equals(r.getValue())) result.add(r);
}
}
@@ -1507,15 +1502,15 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBeanManager#getNamedBeans(boolean)
*/
- public Set<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames) {
+ public Collection<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames) {
//TODO use a cache for named beans with attemptToResolveAmbiguousNames==true
- Set<IBean> result = new HashSet<IBean>();
+ Collection<IBean> result = new HashSet<IBean>();
synchronized (this) {
if(attemptToResolveAmbiguousNames) {
Set<String> names = new HashSet<String>();
for (IBean bean : namedBeans) {
if(!names.contains(bean.getName())) {
- Set<IBean> beans = getBeans(bean.getName(), attemptToResolveAmbiguousNames);
+ Collection<IBean> beans = getBeans(bean.getName(), attemptToResolveAmbiguousNames);
if(beans.isEmpty()) {
result.add(bean);
} else {
@@ -1535,11 +1530,11 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBeanManager#getBeans(boolean, org.eclipse.jdt.core.IType, org.eclipse.jdt.core.IType[])
*/
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IType... qualifiers) {
- Set<IBean> result = new HashSet<IBean>();
+ Collection<IBean> result = new HashSet<IBean>();
IParametedType type = beanType;
- Set<IBean> beans = new HashSet<IBean>();
+ Collection<IBean> beans = new ArrayList<IBean>();
synchronized(this) {
beans.addAll(allBeans);
}
@@ -1563,7 +1558,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBeanManager#getBeans(boolean, java.lang.String, java.lang.String[])
*/
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
String fullyQualifiedBeanType,
String... fullyQualifiedQualifiersTypes) {
IType type = getNature().getType(fullyQualifiedBeanType);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -76,7 +76,7 @@
ICDIProject project;
IFile file;
- Set<IBean> beans = new HashSet<IBean>();
+ Collection<IBean> beans = new HashSet<IBean>();
StereotypeElement stereotype;
QualifierElement qualifier;
ScopeElement scope;
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 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -164,17 +164,19 @@
}
public void setSuperClassBean(IClassBean bean) {
- if(!(bean instanceof ClassBean)) return;
-
- HashSet<IClassBean> beans = new HashSet<IClassBean>();
- beans.add(this);
- IClassBean b = bean;
- while(b != null) {
- if(beans.contains(b)) {
- bean = null;
- break;
+ if(!(bean instanceof ClassBean) || bean == this) return;
+
+ if(bean.getSuperClassBean() != null) {
+ HashSet<IClassBean> beans = new HashSet<IClassBean>();
+ beans.add(this);
+ IClassBean b = bean;
+ while(b != null) {
+ if(beans.contains(b)) {
+ bean = null;
+ break;
+ }
+ b = b.getSuperClassBean();
}
- b = b.getSuperClassBean();
}
superClassBean = (ClassBean)bean;
@@ -234,7 +236,7 @@
}
public static Collection<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations(AbstractMemberDefinition definition) {
- Set<IInterceptorBindingDeclaration> result = new HashSet<IInterceptorBindingDeclaration>();
+ Collection<IInterceptorBindingDeclaration> result = new ArrayList<IInterceptorBindingDeclaration>();
List<IAnnotationDeclaration> as = definition.getAnnotations();
for (IAnnotationDeclaration a: as) {
if(a instanceof InterceptorBindingDeclaration) {
@@ -461,7 +463,7 @@
protected void computeScope() {
//1. Declaration of scope in the class.
- Set<IScopeDeclaration> scopes = getScopeDeclarations();
+ Collection<IScopeDeclaration> scopes = getScopeDeclarations();
if(!scopes.isEmpty()) {
scope = scopes.iterator().next().getScope();
return;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -12,9 +12,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.CDIConstants;
@@ -56,16 +54,16 @@
return getCDIProject().getScope(CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME);
}
- public Set<IScopeDeclaration> getScopeDeclarations() {
- return new HashSet<IScopeDeclaration>();
+ public Collection<IScopeDeclaration> getScopeDeclarations() {
+ return new ArrayList<IScopeDeclaration>(0);
}
public Collection<IStereotypeDeclaration> getStereotypeDeclarations() {
- return new HashSet<IStereotypeDeclaration>();
+ return new ArrayList<IStereotypeDeclaration>(0);
}
public List<IAnnotationDeclaration> getAnnotations() {
- return new ArrayList<IAnnotationDeclaration>();
+ return new ArrayList<IAnnotationDeclaration>(0);
}
public IAnnotationDeclaration getAnnotation(String annotationTypeName) {
@@ -92,18 +90,18 @@
return null;
}
- public Set<IParametedType> getLegalTypes() {
+ public Collection<IParametedType> getLegalTypes() {
return getAllTypes();
}
- public Set<IParametedType> getAllTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
+ public Collection<IParametedType> getAllTypes() {
+ ArrayList<IParametedType> result = new ArrayList<IParametedType>(1);
result.add(type);
return result;
}
- public Set<ITypeDeclaration> getAllTypeDeclarations() {
- return new HashSet<ITypeDeclaration>();
+ public Collection<ITypeDeclaration> getAllTypeDeclarations() {
+ return new ArrayList<ITypeDeclaration>(0);
}
public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
@@ -153,8 +151,8 @@
return null;
}
- public Set<IInjectionPoint> getInjectionPoints() {
- return new HashSet<IInjectionPoint>();
+ public Collection<IInjectionPoint> getInjectionPoints() {
+ return new ArrayList<IInjectionPoint>(0);
}
public IBean getSpecializedBean() {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointParameter.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,13 +10,10 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.Set;
-
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
-import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.common.java.IAnnotationDeclaration;
import org.jboss.tools.common.text.ITextSourceReference;
@@ -39,15 +36,6 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.cdi.core.IInjectionPoint#getQualifierDeclarations()
- */
- @Override
- public Set<IQualifierDeclaration> getQualifierDeclarations() {
- return super.getQualifierDeclarations();
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.cdi.core.IInjectionPoint#isDelegate()
*/
@Override
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 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -12,9 +12,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.ILocalVariable;
@@ -89,7 +87,7 @@
return getDefinition().getVariable();
}
- public Set<String> getAnnotationTypes() {
+ public Collection<String> getAnnotationTypes() {
return getDefinition().getAnnotationTypes();
}
@@ -110,8 +108,8 @@
return result;
}
- public Set<IQualifierDeclaration> getQualifierDeclarations() {
- Set<IQualifierDeclaration> result = new HashSet<IQualifierDeclaration>();
+ public Collection<IQualifierDeclaration> getQualifierDeclarations() {
+ Collection<IQualifierDeclaration> result = new ArrayList<IQualifierDeclaration>();
List<IAnnotationDeclaration> ds = definition.getAnnotations();
for (IAnnotationDeclaration d: ds) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Set;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.CDIConstants;
@@ -39,8 +39,8 @@
public ProducerField() {}
- public Set<ITypeDeclaration> getAllTypeDeclarations() {
- Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
+ public Collection<ITypeDeclaration> getAllTypeDeclarations() {
+ Collection<ITypeDeclaration> result = new ArrayList<ITypeDeclaration>(1);
if(typeDeclaration != null && typeDeclaration.getStartPosition() > 0) {
result.add(typeDeclaration);
}
@@ -55,16 +55,15 @@
return getClassBean().getBeanClass();
}
- public Set<IInjectionPoint> getInjectionPoints() {
- return new HashSet<IInjectionPoint>();
+ public Collection<IInjectionPoint> getInjectionPoints() {
+ return new ArrayList<IInjectionPoint>(0);
}
- public Set<IParametedType> getLegalTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
+ public Collection<IParametedType> getLegalTypes() {
AnnotationDeclaration d = getDefinition().getTypedAnnotation();
- Set<IParametedType> all = getAllTypes();
+ Collection<IParametedType> all = getAllTypes();
if(d != null) {
- result.addAll(getRestrictedTypeDeclarations(all));
+ Collection<IParametedType> result = new HashSet<IParametedType>(getRestrictedTypeDeclarations(all));
ParametedType object = getObjectType(getBeanClass());
if(object != null) {
result.add(object);
@@ -78,11 +77,11 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
- public Set<IParametedType> getAllTypes() {
+ public Collection<IParametedType> getAllTypes() {
if(typeDeclaration != null) {
return typeDeclaration.getAllTypes();
}
- return new HashSet<IParametedType>();
+ return new ArrayList<IParametedType>(0);
}
public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
@@ -141,11 +140,11 @@
}
public IScope getScope() {
- Set<IScopeDeclaration> ds = getScopeDeclarations();
+ Collection<IScopeDeclaration> ds = getScopeDeclarations();
if(!ds.isEmpty()) {
return ds.iterator().next().getScope();
}
- Set<IScope> defaults = new HashSet<IScope>();
+ Collection<IScope> defaults = new HashSet<IScope>();
for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
IScope sc = s.getScope();
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 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -59,8 +60,8 @@
return new InjectionPointParameter();
}
- public Set<ITypeDeclaration> getAllTypeDeclarations() {
- Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
+ public Collection<ITypeDeclaration> getAllTypeDeclarations() {
+ Collection<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
if(typeDeclaration != null && typeDeclaration.getStartPosition() > 0) {
result.add(typeDeclaration);
}
@@ -75,8 +76,8 @@
return getClassBean().getBeanClass();
}
- public Set<IInjectionPoint> getInjectionPoints() {
- HashSet<IInjectionPoint> result = new HashSet<IInjectionPoint>();
+ public Collection<IInjectionPoint> getInjectionPoints() {
+ Collection<IInjectionPoint> result = new ArrayList<IInjectionPoint>();
for (IParameter p: parameters) {
if(p instanceof IInjectionPoint) {
result.add((IInjectionPoint)p);
@@ -85,10 +86,10 @@
return result;
}
- public Set<IParametedType> getLegalTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
+ public Collection<IParametedType> getLegalTypes() {
+ Collection<IParametedType> result = new HashSet<IParametedType>();
AnnotationDeclaration d = getDefinition().getTypedAnnotation();
- Set<IParametedType> all = getAllTypes();
+ Collection<IParametedType> all = getAllTypes();
if(d != null) {
result.addAll(getRestrictedTypeDeclarations(all));
ParametedType object = getObjectType(getBeanClass());
@@ -104,11 +105,11 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
- public Set<IParametedType> getAllTypes() {
+ public Collection<IParametedType> getAllTypes() {
if(typeDeclaration != null) {
return typeDeclaration.getAllTypes();
}
- return new HashSet<IParametedType>();
+ return new ArrayList<IParametedType>(0);
}
public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
@@ -207,7 +208,7 @@
//same as ProducerField.getScope
public IScope getScope() {
- Set<IScopeDeclaration> ds = getScopeDeclarations();
+ Collection<IScopeDeclaration> ds = getScopeDeclarations();
if(!ds.isEmpty()) {
return ds.iterator().next().getScope();
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,11 +10,10 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IInterceptorBinding;
@@ -72,7 +71,7 @@
* @see org.jboss.tools.cdi.core.IStereotype#getStereotypeDeclarations()
*/
public Collection<IStereotypeDeclaration> getStereotypeDeclarations() {
- Set<IStereotypeDeclaration> result = new HashSet<IStereotypeDeclaration>();
+ Collection<IStereotypeDeclaration> result = new ArrayList<IStereotypeDeclaration>();
for (IAnnotationDeclaration d: definition.getAnnotations()) {
if(d instanceof IStereotypeDeclaration) {
result.add((IStereotypeDeclaration)d);
@@ -99,7 +98,7 @@
* @see org.jboss.tools.cdi.core.IScoped#getScope()
*/
public IScope getScope() {
- Set<IScopeDeclaration> ss = getScopeDeclarations();
+ Collection<IScopeDeclaration> ss = getScopeDeclarations();
if(!ss.isEmpty()) {
return ss.iterator().next().getScope();
}
@@ -117,7 +116,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IScoped#getScopeDeclarations()
*/
- public Set<IScopeDeclaration> getScopeDeclarations() {
+ public Collection<IScopeDeclaration> getScopeDeclarations() {
return ProducerField.getScopeDeclarations(getCDIProject().getNature(), definition.getAnnotations());
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl.definition;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -99,9 +99,9 @@
return parametedType.getInheritedTypes();
}
- public Set<IParametedType> getAllTypes() {
+ public Collection<IParametedType> getAllTypes() {
if(parametedType == null) {
- return Collections.emptySet();
+ return Collections.emptyList();
}
return parametedType.getAllTypes();
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeansXMLDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeansXMLDefinition.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeansXMLDefinition.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl.definition;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.cdi.xml.beans.model.CDIBeansConstants;
@@ -28,10 +28,10 @@
public class BeansXMLDefinition implements CDIBeansConstants {
private IPath path;
- private Set<INodeReference> typeAlternatives = new HashSet<INodeReference>();
- private Set<INodeReference> stereotypeAlternatives = new HashSet<INodeReference>();
- private Set<INodeReference> decorators = new HashSet<INodeReference>();
- private Set<INodeReference> interceptors = new HashSet<INodeReference>();
+ private Collection<INodeReference> typeAlternatives = new ArrayList<INodeReference>();
+ private Collection<INodeReference> stereotypeAlternatives = new ArrayList<INodeReference>();
+ private Collection<INodeReference> decorators = new ArrayList<INodeReference>();
+ private Collection<INodeReference> interceptors = new ArrayList<INodeReference>();
public BeansXMLDefinition() {}
@@ -82,19 +82,19 @@
return path;
}
- public Set<INodeReference> getTypeAlternatives() {
+ public Collection<INodeReference> getTypeAlternatives() {
return typeAlternatives;
}
- public Set<INodeReference> getStereotypeAlternatives() {
+ public Collection<INodeReference> getStereotypeAlternatives() {
return stereotypeAlternatives;
}
- public Set<INodeReference> getDecorators() {
+ public Collection<INodeReference> getDecorators() {
return decorators;
}
- public Set<INodeReference> getInterceptors() {
+ public Collection<INodeReference> getInterceptors() {
return interceptors;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-08-17 22:35:57 UTC (rev 43102)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-08-17 23:13:26 UTC (rev 43103)
@@ -12,9 +12,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IAnnotation;
@@ -259,15 +257,15 @@
return null;
}
- public static boolean checkBeanQualifiers(IBean selectedBean, IBean bean, Set<IQualifier> qualifiers){
- HashSet<ValuedQualifier> valuedQualifiers = new HashSet<ValuedQualifier>();
+ public static boolean checkBeanQualifiers(IBean selectedBean, IBean bean, Collection<IQualifier> qualifiers){
+ Collection<ValuedQualifier> valuedQualifiers = new ArrayList<ValuedQualifier>();
for(IQualifier qualifier : qualifiers){
valuedQualifiers.add(new ValuedQualifier(qualifier));
}
return checkValuedQualifiers(selectedBean, bean, valuedQualifiers);
}
- public static boolean checkValuedQualifiers(IBean selectedBean, IBean bean, Set<ValuedQualifier> qualifiers){
+ public static boolean checkValuedQualifiers(IBean selectedBean, IBean bean, Collection<ValuedQualifier> qualifiers){
for(ValuedQualifier qualifier : qualifiers){
if(!isBeanContainQualifier(bean, qualifier)){
return false;
12 years, 4 months
JBoss Tools SVN: r43102 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core: definition and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-17 18:35:57 -0400 (Fri, 17 Aug 2012)
New Revision: 43102
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
Log:
JBIDE-12417
https://issues.jboss.org/browse/JBIDE-12417
Replaced Set by Collection in interfaces.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigExtension.java 2012-08-17 20:04:56 UTC (rev 43101)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/CDISeamConfigExtension.java 2012-08-17 22:35:57 UTC (rev 43102)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -126,8 +125,7 @@
public void buildDefinitions() {
List<SeamBeansDefinition> newDefinitions = new ArrayList<SeamBeansDefinition>();
- Set<IPath> paths = fileSet.getAllPaths();
- for (IPath p: paths) {
+ for (IPath p: fileSet.getAllPaths()) {
boolean isSeamBeans = false;
XModelObject o = fileSet.getBeanXML(p);
if(o == null) {
@@ -195,8 +193,7 @@
public void validateResource(IFile file, CDICoreValidator validator) {
SeamBeansDefinition def = context.getDefinition(file.getFullPath());
if(def != null) {
- Set<SAXNodeProblem> nodes = def.getUnresolvedNodes();
- for (SAXNodeProblem problem: nodes) {
+ for (SAXNodeProblem problem: def.getUnresolvedNodes()) {
SAXNode node = problem.getNode();
String problemId = problem.getProblemId();
String message = problem.getMessage();
@@ -213,8 +210,7 @@
validator.addError(message, CDISeamConfigPreferences.ANNOTATION_EXPECTED, ref, file);
}
}
- Set<SeamBeanDefinition> bs = def.getBeanDefinitions();
- for (SeamBeanDefinition b: bs) {
+ for (SeamBeanDefinition b: def.getBeanDefinitions()) {
List<SeamFieldDefinition> fs = b.getFields();
for (SeamFieldDefinition f: fs) {
List<SeamFieldValueDefinition> vs = f.getValueDefinitions();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2012-08-17 20:04:56 UTC (rev 43101)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/definition/SeamBeansDefinition.java 2012-08-17 22:35:57 UTC (rev 43102)
@@ -46,7 +46,7 @@
public class SeamBeansDefinition {
IResource resource;
XModelObject file;
- Set<SAXNodeProblem> unresolvedNodes = new HashSet<SAXNodeProblem>();
+ List<SAXNodeProblem> unresolvedNodes = new ArrayList<SAXNodeProblem>();
Set<String> possibleTypeNames = new HashSet<String>();
Set<SeamBeanDefinition> beanDefinitions = new HashSet<SeamBeanDefinition>();
@@ -73,7 +73,7 @@
return resource;
}
- public Set<SAXNodeProblem> getUnresolvedNodes() {
+ public List<SAXNodeProblem> getUnresolvedNodes() {
return unresolvedNodes;
}
@@ -282,8 +282,7 @@
}
private IParametedType getCollection(ParametedType t) {
- Set<IParametedType> is = t.getAllTypes();
- for (IParametedType i: is) {
+ for (IParametedType i: t.getAllTypes()) {
if("java.util.Collection".equals(i.getType().getFullyQualifiedName())) {
return i;
}
@@ -292,8 +291,7 @@
}
private IParametedType getMap(ParametedType t) {
- Set<IParametedType> is = t.getAllTypes();
- for (IParametedType i: is) {
+ for (IParametedType i: t.getAllTypes()) {
if("java.util.Map".equals(i.getType().getFullyQualifiedName())) {
return i;
}
12 years, 4 months
JBoss Tools SVN: r43101 - in trunk: cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-17 16:04:56 -0400 (Fri, 17 Aug 2012)
New Revision: 43101
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/TestNamed.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaSupressWarningsTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java
Log:
JBIDE-12436
False validation problem for elements annotated @SuppressWarnings
JUnit Test is added for the issue
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/TestNamed.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/TestNamed.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/TestNamed.java 2012-08-17 20:04:56 UTC (rev 43101)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.jbt.validation;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class TestNamed {
+
+ @SuppressWarnings("cdi-ambiguous-dependency")
+ @Inject String s; // Ambiguous
+
+ @Produces
+ public String foo1;
+
+ @Produces
+ public String foo2;
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/TestNamed.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2012-08-17 20:01:53 UTC (rev 43100)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2012-08-17 20:04:56 UTC (rev 43101)
@@ -25,6 +25,7 @@
import org.jboss.tools.cdi.ui.test.search.ELReferencesQueryParticipantTest;
import org.jboss.tools.cdi.ui.test.search.FiveDependentProjectsSearchParticipantTest;
import org.jboss.tools.cdi.ui.test.search.FiveDependentProjectsTestSetup;
+import org.jboss.tools.cdi.ui.test.validation.java.CDIAsYouTypeInJavaSupressWarningsTest;
import org.jboss.tools.cdi.ui.test.validation.java.CDIAsYouTypeInJavaValidationTest;
import org.jboss.tools.cdi.ui.test.wizard.AddQualifiersToBeanWizardTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIClassWizardFactoryTest;
@@ -66,11 +67,11 @@
suite.addTestSuite(CATest.class);
suite.addTestSuite(OpenCDINamedBeanDialogTest.class);
suite.addTestSuite(CDIAsYouTypeInJavaValidationTest.class);
+ suite.addTestSuite(CDIAsYouTypeInJavaSupressWarningsTest.class);
suiteAll.addTest(new CDICoreTestSetup(suite));
suiteAll.addTestSuite(AddQualifiersToBeanWizardTest.class);
-
suiteAll.addTestSuite(CDIRefactoringTest.class);
TestSuite dependentSuite = new TestSuite("Dependent Projects Tests");
Added: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaSupressWarningsTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaSupressWarningsTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaSupressWarningsTest.java 2012-08-17 20:04:56 UTC (rev 43101)
@@ -0,0 +1,125 @@
+package org.jboss.tools.cdi.ui.test.validation.java;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.source.Annotation;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.cdi.internal.core.validation.CDICoreValidator;
+import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
+import org.jboss.tools.common.base.test.validation.AbstractAsYouTypeValidationTest;
+import org.jboss.tools.common.base.test.validation.java.BaseAsYouTypeInJavaValidationTest;
+
+public class CDIAsYouTypeInJavaSupressWarningsTest extends TCKTest {
+ private static final String PAGE_NAME = "JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/TestNamed.java";
+
+ private BaseAsYouTypeInJavaValidationTest baseTest = null;
+ protected IProject project;
+
+ private static final String SUPPRESSWARNINGS_NAME = "cdi-ambiguous-dependency";
+ private static final String INJECT_ANNOTATION_NAME = "@Inject";
+ private static final String ERROR_MESSAGE = CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS;
+
+ @Override
+ public void setUp() throws Exception {
+ project = TCKTest.findTestProject();
+ if (baseTest == null) {
+ baseTest = new BaseAsYouTypeInJavaValidationTest(project, CDICoreValidator.PROBLEM_TYPE);
+ }
+ }
+
+ public void testAsYouTypeInJavaValidation() throws BadLocationException, CoreException {
+ assertNotNull("Test project '" + TCKTest.MAIN_PROJECT_NAME + "' is not prepared", project);
+ baseTest.openEditor(PAGE_NAME);
+ try {
+ doAsYouTypeValidationMarkerAnnotationsRemovalTest();
+ } finally {
+ baseTest.closeEditor();
+ }
+ }
+
+ /**
+ * The test procedure steps:
+ * - Find EL by a given number
+ * - Set up a broken EL and save the document => see problem marker appearance on that EL
+ * - Set up a another broken EL => see annotation appearance on that EL instead of a problem marker
+ * (an old problem marker has to disappear)
+ * - Set up a good EL again => see annotation to disappear on that EL
+ *
+ * @param goodEL
+ * @param elToValidate
+ * @param errorMessage
+ * @param numberOfRegionToTest
+ * @throws BadLocationException
+ * @throws CoreException
+ */
+ public void doAsYouTypeValidationMarkerAnnotationsRemovalTest() throws BadLocationException, CoreException {
+
+ //============================
+ // The test procedure steps:
+ // - Find annotation: @SuppressWarnings("cdi-ambiguous-dependency")
+ // - Find MarkerAnnotation in line: @Inject String s; // Ambiguous
+ //============================
+
+ String documentContent = baseTest.getDocument().get();
+
+ int start = (documentContent == null ? -1 : documentContent
+ .indexOf(SUPPRESSWARNINGS_NAME, 0));
+ assertFalse("No annotation for \'" + SUPPRESSWARNINGS_NAME + "\' found in document", (start == -1));
+ int length = SUPPRESSWARNINGS_NAME.length();
+
+ int injectStart = (documentContent == null ? -1 : documentContent
+ .indexOf(INJECT_ANNOTATION_NAME, start));
+ int injectLength = INJECT_ANNOTATION_NAME.length();
+
+ // do check marker and marker annotation are absent at line of @Inject annotation
+ int line = baseTest.getDocument().getLineOfOffset(injectStart);
+ baseTest.assertNoResourceMarkerIsCreated(baseTest.getFile(), toRegex(ERROR_MESSAGE), line + 1);
+
+ Annotation problemAnnotation = baseTest.waitForAnnotation(
+ start, start + length, ERROR_MESSAGE, AbstractAsYouTypeValidationTest.MAX_SECONDS_TO_WAIT, true, false);
+ assertNull("Problem Marker Annotation found for \'" + INJECT_ANNOTATION_NAME + "\'!", problemAnnotation);
+
+ //=================================================================================================
+ // - Remove some chars in @SuppressWarning Annotation Type => see error annotation to appear
+ //=================================================================================================
+
+ baseTest.getDocument().replace(start, length, "xyz");
+
+ problemAnnotation = baseTest.waitForAnnotation(
+ start, start + length, null, AbstractAsYouTypeValidationTest.MAX_SECONDS_TO_WAIT, false, true); // Still use the same length (Just to have a place to look in)
+ assertNotNull("Problem Annotation didn't appeare!", problemAnnotation);
+
+ String message = problemAnnotation.getText();
+ assertEquals(
+ "Not expected error message found in ProblemAnnotation. Expected: ["
+ + ERROR_MESSAGE + "], Found: [" + message + "]",
+ ERROR_MESSAGE, message);
+
+ //=================================================================================================
+ // - Restore broken @SupressWarnings Annotation Type => see error annotation disappearance
+ //=================================================================================================
+
+ baseTest.getDocument().replace(start, 3, SUPPRESSWARNINGS_NAME);
+
+ problemAnnotation = baseTest.waitForAnnotation(
+ start, start + length, ERROR_MESSAGE, AbstractAsYouTypeValidationTest.MAX_SECONDS_TO_WAIT, false, false);
+
+ assertNull("Problem Annotation didn't disappeare!", problemAnnotation);
+ }
+
+ private String toRegex(String text) {
+ StringBuilder result = new StringBuilder(text);
+
+ int i = -1;
+ while ((i = result.indexOf("[", i+1)) != -1) {
+ result.insert(i++, '\\');
+ }
+ i = -1;
+ while ((i = result.indexOf("]", i+1)) != -1) {
+ result.insert(i++, '\\');
+ }
+
+ return result.toString();
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/validation/java/CDIAsYouTypeInJavaSupressWarningsTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java 2012-08-17 20:01:53 UTC (rev 43100)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/validation/java/BaseAsYouTypeInJavaValidationTest.java 2012-08-17 20:04:56 UTC (rev 43101)
@@ -114,4 +114,21 @@
fail("Resource Marker not found for type: " + fResourceMarkerType + ", message: [" + errorMessage + "] at line: " + line);
}
+
+ public void assertNoResourceMarkerIsCreated(IFile file,
+ String errorMessage, int line) throws CoreException {
+ IMarker[] markers = AbstractResourceMarkerTest.findMarkers(
+ file, fResourceMarkerType, errorMessage, true);
+
+ assertTrue("Resource Marker is found for type: " + fResourceMarkerType + ", message: [" + errorMessage + "] at line: " + line, (markers == null || markers.length == 0));
+
+ if (markers != null) {
+ for (IMarker m : markers) {
+ Integer l = m.getAttribute(IMarker.LINE_NUMBER, -1);
+ if (l != null && line == l.intValue()) {
+ fail("Resource Marker is found for type: " + fResourceMarkerType + ", message: [" + errorMessage + "] at line: " + line);
+ }
+ }
+ }
+ }
}
12 years, 4 months
JBoss Tools SVN: r43100 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-17 16:01:53 -0400 (Fri, 17 Aug 2012)
New Revision: 43100
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10611
As-you-type CDI validation
The annotations from the new Validator Problem Messages are merged with the existing annotations (the only new annotations are added as well as old annotations are removed while the existing ones are saved within the Document Annotation Model) instead of removing all the annotations by a region and creating the new ones from the Validator Problem Messages.
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 18:42:55 UTC (rev 43099)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 20:01:53 UTC (rev 43100)
@@ -130,11 +130,6 @@
Set<Annotation> fAnnotations = new HashSet<Annotation>();
- /**
- * This set contains annotations that should be removed regardless to their positions
- */
- Set<Annotation> fAlwaysRemoveAnnotations = new HashSet<Annotation>();
-
public void update() {
clearAllAnnotations();
getAnnotationModel(); // This updates saved annotation model if needed
@@ -165,59 +160,11 @@
Annotation[] annotations = fAnnotations.toArray(new Annotation[0]);
for (Annotation annotation : annotations) {
fAnnotations.remove(annotation);
- if (fAlwaysRemoveAnnotations.contains(annotation))
- fAlwaysRemoveAnnotations.remove(annotation);
if(fAnnotationModel != null)
fAnnotationModel.removeAnnotation(annotation);
}
}
- /**
- * This method removes from annotation model each annotation stored
- * in JavaELProblemReporter.fAnnotations(Annotation, Position) that
- * has position inside [start,end] region;
- *
- * @deprecated Don't use this method
- */
- public void clearAnnotations(int start, int end) {
- if (fAnnotations.isEmpty()) {
- return;
- }
- Annotation[] annotations = fAnnotations.toArray(new Annotation[0]);
- for (Annotation annotation : annotations) {
- Position position = getAnnotationModel().getPosition(annotation);
- if (!fAlwaysRemoveAnnotations.contains(annotation) && (position != null && position.getOffset() >= start &&
- position.getOffset() <= end)) {
- // remove annotation from managed annotations map as well as from the model
- fAnnotations.remove(annotation);
- getAnnotationModel().removeAnnotation(annotation);
- }
- }
- }
-
- /**
- * This method removes from annotation model each annotation stored
- * in JavaELProblemReporter.fAnnotations(Annotation, Position) that
- * or exists in fAlwaysRemoveAnnotations
- * that indicates it should be removed without regard to its actual position.
- *
- * @deprecated Don't use this method
- */
- public void clearAlwaysRemoveAnnotations() {
- if (fAnnotations.isEmpty()) {
- return;
- }
- Annotation[] annotations = fAnnotations.toArray(new Annotation[0]);
- for (Annotation annotation : annotations) {
- if (fAlwaysRemoveAnnotations.contains(annotation)) {
- // remove annotation from managed annotations map as well as from the model
- fAnnotations.remove(annotation);
- fAlwaysRemoveAnnotations.remove(annotation);
- getAnnotationModel().removeAnnotation(annotation);
- }
- }
- }
-
@Override
public void addMessage(IValidator origin, IMessage message) {
messages.add(message);
@@ -279,35 +226,27 @@
}
Map<Annotation, Position> annotationsToAdd = new HashMap<Annotation, Position>();
- Set<Annotation> cleanAllAnnotationsToAdd = new HashSet<Annotation>();
for (IMessage message : messages) {
if (!(message instanceof ValidationMessage) ||
existingValidationMessages.contains(message))
continue;
ValidationMessage valMessage = (ValidationMessage)message;
- boolean cleanAllAnnotations = Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
Position position = new Position(valMessage.getOffset(), valMessage.getLength());
TempJavaProblem problem = new TempJavaProblem(valMessage, editorInputName);
TempJavaProblemAnnotation problemAnnotation = new TempJavaProblemAnnotation(problem, fCompilationUnit);
annotationsToAdd.put(problemAnnotation, position);
- if (cleanAllAnnotations)
- cleanAllAnnotationsToAdd.add(problemAnnotation);
}
getAnnotationModel(); // This is to update saved document annotation model
for (Annotation a : annotationsToRemove) {
fAnnotations.remove(a);
- if (fAlwaysRemoveAnnotations.contains(a))
- fAlwaysRemoveAnnotations.remove(a);
fAnnotationModel.removeAnnotation(a);
}
for (Annotation a : annotationsToAdd.keySet()) {
Position p = annotationsToAdd.get(a);
fAnnotations.add(a);
- if (cleanAllAnnotationsToAdd.contains(a))
- fAlwaysRemoveAnnotations.add(a);
fAnnotationModel.addAnnotation(a, p);
}
removeAllMessages();
@@ -498,7 +437,6 @@
// an element in case of at lease one string is validated,
// because the string validation performs the validation of an element
// as well
- fReporter.clearAlwaysRemoveAnnotations();
fValidatorManager.validateJavaElement(
Arrays.asList(
new IRegion[] {
12 years, 4 months