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

AutoValue generation broken when used with javax.validation annotations #652

Closed
jawpio opened this issue Jul 17, 2018 · 7 comments
Closed

Comments

@jawpio
Copy link

jawpio commented Jul 17, 2018

Autovalue code with javax.validation is failed to be generated within eclipse.

  • not working example
@AutoValue
public abstract class ColumnRestrictionDto {

	@AutoValue.CopyAnnotations(exclude = Valid.class)
	@Valid
	@NotNull
	public abstract ColumnRestrictionsDto getColumn();

	public static Builder builder() {
		return new AutoValue_ColumnRestrictionDto.Builder();
	}

	@AutoValue.Builder
	@JsonPOJOBuilder(withPrefix = "set")
	public abstract static class Builder {

		public abstract Builder setColumn(ColumnRestrictionsDto value);

		public abstract ColumnRestrictionDto build();
	}
}
  • working code
@AutoValue
public abstract class ColumnRestrictionDto {

	public abstract ColumnRestrictionsDto getColumn();

	public static Builder builder() {
		return new AutoValue_ColumnRestrictionDto.Builder();
	}

	@AutoValue.Builder
	@JsonPOJOBuilder(withPrefix = "set")
	public abstract static class Builder {

		public abstract Builder setColumn(ColumnRestrictionsDto value);

		public abstract ColumnRestrictionDto build();
	}
}

you can test it with following code - https://github.com/jawpio/eclipse-autovalue-fail

Could be connected with following issue #505 .

@eamonnmcmanus
Copy link
Member

Can you confirm that it fails with the latest AutoValue (1.6.2) before we investigate? The build.gradle there says 1.5.1.

@jawpio
Copy link
Author

jawpio commented Jul 18, 2018

@eamonnmcmanus I can confirm. It fails with 1.6.2 and 1.6.1...

@eamonnmcmanus
Copy link
Member

I sent a PR to update to the latest version. It works when invoking Gradle directly. What does it do in Eclipse?

@jawpio
Copy link
Author

jawpio commented Jul 18, 2018

I can confirm, invoking Gradle directly works fine (also with old AutoValue versions).
In Eclipse AutoValue classes are not generated and if you open "Error Log" view you'll see following exception.
eclipse.autovalue.error.txt

@eamonnmcmanus
Copy link
Member

Thanks for attaching the Error Log. The exceptions there show that this is a bug in the Eclipse compiler. I would suggest logging a bug there.

@jawpio
Copy link
Author

jawpio commented Aug 28, 2018

FYI, eclipse issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=535066.

@eamonnmcmanus
Copy link
Member

Thanks for logging that! Hopefully it will be addressed punctually by the Eclipse team. We've added workarounds to AutoValue for Eclipse bugs before, but I don't see an obvious way we could do it here.

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

2 participants