-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Type use annotations on receiver not copied to generated code #732
Comments
Is this an issue you have run into in practice? It seems to me that if we are going to deal with it seriously we should copy receiver annotations whenever we are implementing an abstract method, so also in the implementations of |
Yes. We are working on using the Checker Framework to build a generic checker that can ensure some properties about the order in which methods are called on builder-like objects, e.g., that required setters are called before I'll also note that we are not blocked on this issue at the moment. For our checker, the only problem is that if any client code directly uses the generated |
I have a different (perhaps larger) issue although I'm surprised hasn't come up... import com.my.package.Foo.Bar;
import com.my.package.Foo.Baz;
import org.checkerframework.checker.nullness.qual.Nullable;
@AutoFactory
class MyClass {
MyClass(
@Nullable Bar bar,
@Nullable Baz baz,
...
) { ... }
} The above seems to be generating: import com.my.package.Foo;
import org.checkerframework.checker.nullness.qual.Nullable;
class MyClassFactory {
MyClassFactory(
@Nullable Foo.Bar bar,
@Nullable Foo.Baz baz,
...
) { ... }
} Because the build dies with this error:
Why isn't the generated code using the same scoping setup as the source? |
@wesalvaro can you open a separate issue for that? It looks like we should be generating Also, that's a bug in AutoFactory, not AutoValue like the earlier bug. |
Consider the following example:
In
AutoValue_Animal.Builder
, I see the@TypeUseTest
annotation copied down to the implementation ofsetName
. But, I do not see the@TypeUseTest
annotation onthis
copied down for the implementation ofbuild
.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.
The text was updated successfully, but these errors were encountered: