Skip to content

ion generate produces incorrect Java code for multi-dimensional lists #167

Description

@popematt

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().

Activity

  1. added
    bugSomething isn't working
    code generationImprovements for code generation subcommand `generate`
    on Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode generationImprovements for code generation subcommand `generate`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions