ion-cli icon indicating copy to clipboard operation
ion-cli copied to clipboard

`ion generate` produces incorrect Java code for multi-dimensional lists

Open popematt opened this issue 1 year ago • 0 comments

Given ISL such as

type: {
  name: Matrix,
  type: list,
  element: {
    type: list,
    element: int
  }
}

The read method for the resulting Matrix class looks like this:

    public static Matrix readFrom(IonReader reader) {
        java.util.ArrayList<java.util.ArrayList<Integer>> value = new java.util.ArrayList<java.util.ArrayList<Integer>>();
        if(reader.getType() != IonType.LIST) {
            throw new IonException("Expected List, found " + reader.getType() + " while reading value.");
        }
        reader.stepIn();
        while (reader.hasNext()) {
            reader.next();
            value.add(java.util.ArrayList<Integer>.readFrom(reader));
        }
        reader.stepOut();
        Matrix matrix = new Matrix();
        matrix.value = value;
        return  matrix;
    }

There is no such method java.util.ArrayList<Integer>.readFrom().

popematt avatar Oct 30 '24 22:10 popematt