javahashmapkettlepdijanino

Meaning of java error "SNO: '+=' reconversion failed"?


I encountered a mysterious error in Pentaho Data Integration (PDI, a.k.a. Kettle) log displayed via Jenkins:

org.codehaus.janino.CompileException: SNO: "+=" reconversion failed

The only code that contains "+=" is like this...

import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
private static final String validKeys = "thing zero,thing two";
private Map/*<String, Long>*/ mapCount;

public boolean init ... {
    mapCount = new HashMap/*<String, Long>*/();
}
public boolean processRow ... {
    mapCount.put("thing zero", 0L);
    mapCount.put("thing one", 1L);
    Long calcUnidentified = 0L;
    Long calcTotal = 0L;
    Iterator it = mapCount.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry keyValuePair = (Map.Entry) it.next();
        
        String currentKey = keyValuePair.getKey().toString();
        Long currentValue = Long.valueOf(keyValuePair.getValue().toString());
        
        if (!validKeys.contains(currentKey)) {
            calcUnidentified += currentValue;
        }
        calcTotal += currentValue;
    }
}

I tried:


Solution

  • As strange as it may sound for java, the solution was to simply replace...

    calcUnidentified += currentValue;
    

    ...with...

    calcUnidentified = calcUnidentified + currentValue;
    

    As Thomas Kläger noted, this bug seems very specific to Janino (used by PDI for java).