Indeed.  This probably only works because no one uses class attributes in LZX.  
I suspect I was just being lazy in re-using the variable name.  I agree with 
your suggested fix.

On 2010-04-06, at 17:58, Henry Minsky wrote:

> On line 2058 in NodeModel.java:
> 
> in  addAttributeElement()
> 
>                if (ALLOCATION_INSTANCE.equals(allocation)) {
>                    attrs = this.attrs;
>                } else if (ALLOCATION_CLASS.equals(allocation)) {
>                    attrs = this.classAttrs;
>                }
> 
> The tool reported to  assignment to "attrs = this.attrs" as redundant, but
> the bug is that if we're bashing
> 'attrs', we should have
> a local 'attrs' var declared, like we do previously in the code for
> addProperty, right?
> 
>    LinkedHashMap attrs;
>    if (ALLOCATION_INSTANCE.equals(allocation)) {
>      attrs = this.attrs;
>    } else if (ALLOCATION_CLASS.equals(allocation)) {
>      attrs = this.classAttrs;
>    } else {
> 
> Because it looks like the code in is supposed to just side-effect the attrs
> instance var, not actually bash it.
> We should really use a different local variable name, to avoid this
> confusion.
> 
> 
> 
> 
> -- 
> Henry Minsky
> Software Architect
> [email protected]


Reply via email to