eclipse-vertx / eclipse-vertx/vert.x

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

Open
#5,090 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
1d 7h
Merged PRs (30d)
30

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.