Author: scabanovich
Date: 2007-07-26 06:55:00 -0400 (Thu, 26 Jul 2007)
New Revision: 2671
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
Log:
EXIN-217 merge() in SeamObject is better to return null if no changes detected.
It cannot be a problem to process null value in sub-classes and clients.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-26
09:24:41 UTC (rev 2670)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-26
10:55:00 UTC (rev 2671)
@@ -44,9 +44,7 @@
List<Change> changes = super.merge(s);
SeamComponentDeclaration d = (SeamComponentDeclaration)s;
- if(!source.equals(d.source)) {
- source = d.source;
- }
+ source = d.source;
if(!stringsEqual(name, d.name)) {
changes = Change.addChange(changes, new Change(this, "name", name,
d.name));
name = d.name;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-26
09:24:41 UTC (rev 2670)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2007-07-26
10:55:00 UTC (rev 2671)
@@ -109,7 +109,9 @@
/**
* Merges loaded object into current object.
- * If changes were done returns a list of changes.
+ * If changes were done returns a list of changes.
+ * If there are no changes, null is returned,
+ * which prevents creating a lot of unnecessary objects.
* @param f
* @return list of changes
*/
@@ -117,8 +119,11 @@
source = s.source;
id = s.id;
resource = s.resource;
-
- return new ArrayList<Change>();
+ //If there are no changes, null is returned,
+ //which prevents creating a lot of unnecessary objects.
+ //Subclasses and clients must check returned
+ //value for null, before using it.
+ return null;
}
}
Show replies by date