Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vertx-core has an implicit build time dependency to verx-codegen (under specific circumstances) #5090

Open
jensbaitingerbosch opened this issue Feb 2, 2024 · 1 comment
Labels

Comments

@jensbaitingerbosch
Copy link

Version

4.5.1 and 4.5.2

Context

When extending a class that is annotated with @DataObject, vertx-codegen must be in the compile classpath. Otherwise the project will not compile. Especially when using an AnnotationProcessor (like Lombok), the code that would be generated by by the annotation processor is not generated and the subsequent compiler errors (in case of lombok that all getters, setters are not there) are overwelming the line that class file for io.vertx.codegen.annotations.DataObject not found (which then causes a very long error search).

Reproducer:

Test.java

import io.vertx.core.VertxOptions;
import lombok.Data;


@Data
public class Test {
  public static void main(String[] args) {
    new Test().setTest(1);
  }

  private int test; // Lombok should generate the setter used above in the main method

  private class MyOwnOptions extends VertxOptions {
      // just an example
  }
}

build.grade.kts

plugins {
    id("java")
}
repositories {
    mavenCentral()
}

dependencies {
    annotationProcessor("org.projectlombok:lombok:1.18.30")
    implementation("org.projectlombok:lombok:1.18.30")
    implementation("io.vertx:vertx-core:4.5.2")
}

Produces the following output:

> Task :compileJava FAILED
1 actionable task: 1 executed
error: cannot access DataObject
  class file for io.vertx.codegen.annotations.DataObject not found
/Users/xxxx/dev/experiments/vertxlombok/src/main/java/Test.java:9: error: cannot find symbol
    new Test().setTest(1);
              ^
  symbol:   method setTest(int)
  location: class Test
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 196ms

In that small example there is only one error about code that should be generated by Lombok, though in my real project there were hundrets of errors, that made it difficult to see the real issue

@vietj
Copy link
Member

vietj commented Feb 2, 2024

what is the actual bug here ? it seems to be expected behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants