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

Java, generated code fails to compile with error-prone compiler #138

Closed
estekhin opened this issue Dec 15, 2014 · 3 comments
Closed

Java, generated code fails to compile with error-prone compiler #138

estekhin opened this issue Dec 15, 2014 · 3 comments

Comments

@estekhin
Copy link

In particular, I have problems with repeated fields.

Generated code for repeated fields looks like this:

  public Builder addAllXXX(java.lang.Iterable<java.lang.String> values) {
    ensureXXXIsMutable();
    super.addAll(values, XXX_);
    onChanged();
    return this;
  }

Error-prone compiler rejects this code with

error: [StaticAccessedFromInstance] A static variable or method should not be accessed from an instance
        super.addAll(values, XXX_);  
             ^                             
    (see http://code.google.com/p/error-prone/wiki/StaticAccessedFromInstance)
  Did you mean 'Builder.addAll(values, XXX_);'?
@estekhin
Copy link
Author

This happens with protoc 2.5.0, protoc 2.6.1 and the latest error-prone.

@jmason
Copy link

jmason commented Jun 12, 2015

(bump) -- any news on this? https://groups.google.com/forum/#!msg/error-prone-discuss/scOsD6nFFeU/2KlkDzxGArEJ suggests that there's an internal protoc change that could be pushed to the external repo to avoid it.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jan 20, 2016

This is fixed in the latest versions.

@xfxyjwf xfxyjwf closed this as completed Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants