Type use annotations on receiver not copied to generated code
- Dominant language
- Java
- Stars
- 10.6k
- Forks
- 1.2k
- Avg merge
- 6h 32m
- Merged PRs (30d)
- 13
Description
Consider the following example:
```java
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
public @interface TypeUseTest {
String[] value() default {};
}
```
```java
import com.google.auto.value.AutoValue;
@AutoValue
abstract class Animal {
abstract String name();
abstract int numberOfLegs();
static Builder builder() {
return new AutoValue_Animal.Builder();
}
@AutoValue.Builder
abstract static class Builder {
abstract Builder setName(@TypeUseTest({"hi"}) String value);
abstract Builder setNumberOfLegs(int value);
abstract Animal build(@TypeUseTest({"hi", "bye"}) Builder this);
}
}
```
In `AutoValue_Animal.Builder`, I see the `@TypeUseTest` annotation copied down to the implementation of `setName`. But, I do not see the `@TypeUseTest` annotation on `this` copied down for the implementation of `build`.
This may be a bit of a corner case, but it would be great if it were supported! If the maintainers are interested and can point me roughly where the code should go, I can look into opening a PR.
Contributor guide
Assessment
This issue has not been assessed yet.