Author: scabanovich
Date: 2011-08-31 14:29:43 -0400 (Wed, 31 Aug 2011)
New Revision: 34444
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/ClassBean.java
Log:
JBIDE-9271
https://issues.jboss.org/browse/JBIDE-9271
Prevented multiple invocation of update for dependent cdi projects.
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 2011-08-31
18:23:28 UTC (rev 34443)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-08-31
18:29:43 UTC (rev 34444)
@@ -1054,6 +1054,9 @@
s.setSourcePath(r);
}
}
+
+ static long q = 0;
+ static long time = 0;
void rebuildBeans() {
List<TypeDefinition> typeDefinitions = n.getAllTypeDefinitions();
@@ -1066,18 +1069,24 @@
if(typeDefinition.isVetoed()) {
continue;
}
- ClassBean bean = null;
- if(typeDefinition.getInterceptorAnnotation() != null ||
ic.isInterceptor(typeDefinition.getType())) {
- bean = new InterceptorBean();
- } else if(typeDefinition.getDecoratorAnnotation() != null ||
ic.isDecorator(typeDefinition.getType())) {
- bean = new DecoratorBean();
- } else if(typeDefinition.getStatefulAnnotation() != null ||
typeDefinition.getStatelessAnnotation() != null || typeDefinition.getSingletonAnnotation()
!= null) {
- bean = new SessionBean();
+
+ ClassBean bean = (ClassBean)classBeans.get(typeDefinition.getType());
+ if(bean != null && (bean.getDefinition() == typeDefinition)) {
+ //Type definitions are rebuilt when changed, otherwise old bean should be reused.
+ bean.cleanCache();
} else {
- bean = new ClassBean();
+ if(typeDefinition.getInterceptorAnnotation() != null ||
ic.isInterceptor(typeDefinition.getType())) {
+ bean = new InterceptorBean();
+ } else if(typeDefinition.getDecoratorAnnotation() != null ||
ic.isDecorator(typeDefinition.getType())) {
+ bean = new DecoratorBean();
+ } else if(typeDefinition.getStatefulAnnotation() != null ||
typeDefinition.getStatelessAnnotation() != null || typeDefinition.getSingletonAnnotation()
!= null) {
+ bean = new SessionBean();
+ } else {
+ bean = new ClassBean();
+ }
+ bean.setParent(this);
+ bean.setDefinition(typeDefinition);
}
- bean.setParent(this);
- bean.setDefinition(typeDefinition);
if(typeDefinition.hasBeanConstructor()) {
beans.add(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 2011-08-31
18:23:28 UTC (rev 34443)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2011-08-31
18:29:43 UTC (rev 34444)
@@ -585,4 +585,9 @@
public IMember getSourceMember() {
return getBeanClass();
}
+
+ public void cleanCache() {
+ specializingClassBeans.clear();
+ scope = null;
+ }
}
\ No newline at end of file