Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
723 stars 51 forks source link

Delete any pre-existing classfile for RecordInterface #147

Closed Randgalt closed 5 months ago

Randgalt commented 1 year ago

Fixes #139

It seems the existence of an old .class file for the record being generated by @RecordInterface is exposing a bug in javac. This change checks for the existence of the class file and deletes. It's an ugly hack but seems to work.

Randgalt commented 1 year ago

@youribonnaffe and @cykl

As mentioned in #139 I've been able to reproduce the problem with IntelliJ when I manually compile a single interface annotated with @RecordInterface. In this instance, the presence of a .class file of the generated record from a previous compile is the source of the problem. If that .class file is deleted then compilation works correctly. This PR adds a hack that deletes any .class file for the record. Please let me know if it fixes the issue for you as well. If it does, we can figure out a way to make it less of a hack.

Randgalt commented 5 months ago

Closed in favor of https://github.com/Randgalt/record-builder/pull/174