Questions tagged [auto-value]

Immutable value type code generation for Java 1.6+.

AutoValue, a part of Google's open source auto project, makes creating immutable value type classes in Java easy.

Documentation can be found here.

118 questions
2
votes
2 answers

How to make IntelliJ IDEA recognize build-time generated sources?

I made a small zip example to illustrate the issue. I have in the project the Animal class from AutoValue example and a maven pom file to do the code generation and compilation. See below. Running mvn clean install works great and generates and…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
2
votes
1 answer

How can I use @AutoFactory with an @AutoValue class?

Say I have a simple AutoValue class: @AutoValue abstract class Foo { abstract CommonDependency commonDep(); abstract String uniqueDataPerInstance(); static Foo create(CommonDependency commonDep, String data) { return new…
Cory Petosky
  • 12,458
  • 3
  • 39
  • 44
2
votes
0 answers

Auto-Value-Gson: generics - java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

I experience problems with auto-value-gson in combination with generics. Unfortunately, it's not able to create an adapter for my Response class. Response.java @AutoValue public abstract class Response { @SerializedName(value="client",…
Roman
  • 21
  • 3
2
votes
0 answers

Auto-Value-Gson : Cannot resolve symbol GsonTypeAdapter

I have so far implemented a Parcelable class with AutoValue and now I'd like to be able to deserialize it Gson. So I have found the AutoValue Extension named auto-value-gson and I have tried to implement a class just like the examples on the github…
mt0s
  • 5,781
  • 10
  • 42
  • 53
2
votes
1 answer

Using Retrofit 2.0 with Autovalue

I am trying to use AutoValue library from here I have using Retrofit 2.0 for web service call, all web service request getting failed with HTTP Request error 400. By further investigation I got to know that I have to set the TypeAdapterFactory and…
Sandeep Tengale
  • 152
  • 4
  • 13
2
votes
1 answer

AutoValue - Failed to invoke public uk.ivanc.archimvp.model.entities.Campaigns() with no args

LogCat : cause : java.lang.InstantiationException: Can't instantiate abstract class uk.ivanc.archimvp.model.entities.Campaigns detailMessage : Failed to invoke public uk.ivanc.archimvp.model.entities.Campaigns() with no…
TooCool
  • 10,598
  • 15
  • 60
  • 85
2
votes
2 answers

Using AutoValue Annotations in Eclipse

I'm porting an SDK from Android to plain Java and have run into an AutoParcel annotation that I don't understand. Here's the original class and a snippet below: @AutoParcel.Builder public abstract static class Builder { public abstract Builder…
Tony Laidig
  • 1,048
  • 2
  • 11
  • 33
2
votes
2 answers

LogFactory ClassNotFoundException with Google AutoValue and spring-context-support

A Spring boot project depends on auto-value 1.1 and spring-context-support 4.2.1. When I run it with mvn spring-boot:run, I see the following error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
Shaun
  • 68
  • 1
  • 6
2
votes
1 answer

custom final field for AutoValue with Builder

When using AutoValue with the Builder pattern, how can I initialize other custom final fields in the constructor? Example @AutoValue abstract class PathExample { static Builder builder() { return new AutoValue_PathExample.Builder(); } …
TmTron
  • 17,012
  • 10
  • 94
  • 142
2
votes
0 answers

How to use Google's AutoValue with Android Studio's Unit Testing support?

I want to use AutoValue with Android Studios' new Unit Testing support. Is this possible? Or can generated code not be seen by src/test/java classes? The android-apt plugin does not work with testApt scope
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
2
votes
1 answer

@AutoValue - "cannot find symbol class Generated" Error

I am getting "cannot find symbol class Generated" while using the @AutoValue annotation. public abstract class Office{ public static Office create(String cityName, String companyName, String regionName) { return new AutoValue_Office(cityName,…
rahul.ramanujam
  • 5,608
  • 7
  • 34
  • 56
1
vote
0 answers

Android Room + AutoValue breaks schema generation

I have a rather complicated (though not entirely unusual) scenario that seems to break with Android Room version 2.4.0 (specifically 2.4.0-beta01. It works on 2.4.0-alpha05). I'll put the code down below, but I'll attempt to describe my situation in…
skywalkerdude
  • 117
  • 1
  • 8
1
vote
2 answers

How can I create a AutoValue class with generics?

I would like to have a data class using AutoValue and one of the property is generic, wondering what I am doing wrong ? public abstract class Data { public static Data createData(T value, Integer index) { return new…
Artur A
  • 257
  • 3
  • 20
1
vote
0 answers

Cannot use any newer version of auto-value than 1.5.3

I am using Gradle to build an Android Studio project. I am using auto-value in one of my modules but for some reason, any version of auto-value higher than 1.5.3 causes a compilation failure. My dependency in build.gradle for the module looks like…
sohum
  • 3,207
  • 2
  • 39
  • 63
1
vote
2 answers

Exclude dependencies in AnnotationProcessorPaths

I have the following build configuration: Parent POM: org.apache.maven.plugins maven-compiler-plugin 3.8.1
Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137