immutables / immutables-vavr

Immutables encodings for Vavr
Other
33 stars 7 forks source link

Compilation error with maps and lists #3

Closed io7m closed 7 years ago

io7m commented 7 years ago

https://github.com/io7m/immutables-javaslang-bug-20161226

The generated code ends up as:


  private SMFHeader(SMFHeader.Builder builder) {
    this.schemaIdentifier = builder.schemaIdentifier;
    this.coordinateSystem = builder.coordinateSystem;
    this.attributesInOrder = builder.this.attributesInOrder_list;
    this.attributesByName = builder.this.attributesByName_map;
    if (builder.triangleCountIsSet()) {
      initShim.setTriangleCount(builder.triangleCount);
    }
    if (builder.triangleIndexSizeBitsIsSet()) {
      initShim.setTriangleIndexSizeBits(builder.triangleIndexSizeBits);
    }
    if (builder.vertexCountIsSet()) {
      initShim.setVertexCount(builder.vertexCount);
    }
    if (builder.metaCountIsSet()) {
      initShim.setMetaCount(builder.metaCount);
    }
    this.triangleCount = initShim.triangleCount();
    this.triangleIndexSizeBits = initShim.triangleIndexSizeBits();
    this.vertexCount = initShim.vertexCount();
    this.metaCount = initShim.metaCount();
    this.initShim = null;
  }
[ERROR] /home/someone/git/com.github/io7m/immutables-javaslang-bug-20161226/target/generated-sources/annotations/com/io7m/bugs/immutables_javaslang/SMFHeader.java:[53,30] cannot find symbol
  symbol:   class builder
  location: class com.io7m.bugs.immutables_javaslang.SMFHeader
[ERROR] /home/someone/git/com.github/io7m/immutables-javaslang-bug-20161226/target/generated-sources/annotations/com/io7m/bugs/immutables_javaslang/SMFHeader.java:[54,29] cannot find symbol
  symbol:   class builder
  location: class com.io7m.bugs.immutables_javaslang.SMFHeader

I suspect the generated code should be builder and not builder.this.

@elucash: Is this one a bug in the immutables generator, or in the encodings here?

io7m commented 7 years ago

@elucash: Any estimated time on when/if you'll get a chance to take a look at this? I'm almost certain it's a bug in the generator, but I've taken a look at the templates and am unfortunately unable to work out how they could yield the above code.

elucash commented 7 years ago

@io7m sorry, was too busy. Can you, please, take a look at the most recent snapshot? I've tried to fix this (test passed) by avoiding inlining of a build method when it's used in the constructor that takes builder.

io7m commented 7 years ago

Can do!

io7m commented 7 years ago

Nice one, that seems to have fixed it!

io7m commented 7 years ago

Any chance you could push a 2.3.11 release, if you have time?

elucash commented 7 years ago

released 2.4.0, currently propagating to Central