beanknife icon indicating copy to clipboard operation
beanknife copied to clipboard

Configuration inheritance fails on rebuild with JDK 19

Open marriesvdh opened this issue 1 year ago • 3 comments

Issue:

The initial build works fine. However after changing a beanknife config class (adding a space is enough) and building again, two problems occur:

  1. For the edited config class, the inherited annotations are ignored in the build.
  2. The generated Meta class only contains the edited class.

Problem 1 occurs when building with JDK 19.0.2, but not with JDK 1.8.0_42 Problem 2 occurs with both SDKs

Steps to reproduce:

  • See https://github.com/marriesvdh/beanknife-inheritance-bug for a sample project
  • Build the project
    • The BeanView and BeanView2 classes are generated correctly (@ViewSetters(Access.PUBLIC) is inherited correctly, so BeanView contains a setter)
    • BeanMeta contains a reference to both views
  • Touch BeanViewConfig by adding a space
  • Build the project again (without clean)
    • The setter is not present anymore in the generated BeanView class.
    • The generated BeanMeta class only contains a reference to BeanView (and not BeanView2)

(After performing mvn clean, the first build is correct again)

Temporary workaround?

I assume the problem lies in the incremental compilation feature of Beanknife. Is it possible to disable this feature and rebuild all Beanknife classes everytime? As a temporary fix.

For now, cleaning before each build solves the issue.

marriesvdh avatar May 05 '23 11:05 marriesvdh

I have tested on jdk17, I can't reproduce the issue. I will try on jdk19 later.

vipcxj avatar May 06 '23 12:05 vipcxj

I have tested it on openjdk 19.0.2, I still can't reproduce the issue. Which ide are you used. I check it using IDEA

vipcxj avatar May 06 '23 17:05 vipcxj

Thanks for looking into this!

I'm using Intellij IDEA Ultimate 2023.1.1 (newest). When building outside of the IDE (using the maven wrapper in the sample project), it works! When configuring Intellij to use maven for building (setting: Delegate IDE build/run actions to Maven), it also works.

So apparently the issue only occurs with the Intellij (incremental) builder. Maybe this is an Intellij bug then, what do you think?

marriesvdh avatar May 10 '23 13:05 marriesvdh