Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
758 stars 55 forks source link

1.16 doesn't seem to be compatible with Java 15 #24

Closed runfalk closed 3 years ago

runfalk commented 3 years ago

I just tried updating from 1.14 to 1.16 and got the following error:

> io/soabase/recordbuilder/processor/RecordBuilderProcessor has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 59.0

I assume this is because 1.16 currently only works on the Java 16 preview?

- annotationProcessor 'io.soabase.record-builder:record-builder-processor:1.14.ea'
+ annotationProcessor 'io.soabase.record-builder:record-builder-processor:1.16'
Randgalt commented 3 years ago

OK - I've released JDK 15-specific artifacts. See the doc here and let me know if it works for you: https://github.com/Randgalt/record-builder#java-15-versions

runfalk commented 3 years ago

Thanks for making an update! So I tried replacing it (everything was working with the old version) and got the following error.

error: package ThingBuilder does not exist
public record Thing(int a, int b, int c) implements ThingBuilder.With
                                                                ^

The record in question looks like this:

package com.pkg.name;

import io.soabase.recordbuilder.core.RecordBuilder;

@RecordBuilder
public record Thing(int a, int b, int c) implements ThingBuilder.With {}

This is the change I made to the Gradle file. The version diff between processor and core was because of automatic dependency updates by Renovate bot. 1.14 processor with 1.16 core did work (though it produces a warning warning: /path/to/build/record-builder-core-1.16.jar(/io/soabase/recordbuilder/core/RecordBuilder.class): major version 60 is newer than 59, the highest major version supported by this compiler).

         // Automatic implementation of builders for records
-        annotationProcessor 'io.soabase.record-builder:record-builder-processor:1.14.ea'
-        implementation 'io.soabase.record-builder:record-builder-core:1.16'
+        annotationProcessor 'io.soabase.record-builder:record-builder-processor-java15:1.17'
+        implementation 'io.soabase.record-builder:record-builder-core-java15:1.17'
Randgalt commented 3 years ago

OK - I think what I was trying to do with Maven won't work so I've removed it. I just released new versions compiled with Java 15. Let me know if they work. For gradle:

annotationProcessor 'io.soabase.record-builder:record-builder-processor:1.18-java15'
implementation 'io.soabase.record-builder:record-builder-core:1.18-java15'

Thanks for your patience.

runfalk commented 3 years ago

Yes, this works. Thank you!