Git Product home page Git Product logo

auto-data-class's People

Contributors

xinthink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zijianwang90

auto-data-class's Issues

Can't build when adding to a Compose project.

Hi,
Thanks for it, it's great. I'm just filling an issue cause currently we can't add auto-data-class in an existing jetpack compose project we always end up with the following error when trying to build
e: java.lang.NoSuchMethodError: org.jetbrains.kotlin.codegen.state.GenerationState$Builder.isIrBackend(Z)Lorg/jetbrains/kotlin/codegen/state/GenerationState$Builder;
Just to let you know (as compose is still in an early early stage it might come from this ;) )

Regards

Generics support

I can use generic in AutoValue&Gson:

@AutoValue
public abstract class ObjectListResponse<T> {

    public static <T> TypeAdapter<ObjectListResponse<T>> typeAdapter(
            Gson gson, TypeToken<? extends ObjectListResponse<T>> typeToken) {
        return new AutoValue_ObjectListResponse.GsonTypeAdapter<>(gson, typeToken);
    }

    @SerializedName("meta")
    @NonNull public abstract MetaData getMetaData();

    @SerializedName("objects")
    @NonNull public abstract List<T> getObjects();
}

And after declaration I can use ObjectListResponse properly to simplify responses:

@GET("wallet")
Single<Response<ObjectListResponse<WalletPojo>>> getWallet(@Header("Authorization") String token);

I cannot declare the same behaviour with DataClass. I used the next interface:

@DataClass
interface ObjectListKey<T> {

    @get:DataProp("meta")
    val metaData: MetaKey

    @get: DataProp("objects")
    val objects: List<T>
}

And there were errors in generated files. Does anybody know how to declare behaviour with generics with DataClass?

Unresolved reference: Generated

I added dependencies to my gradle file:

implementation 'com.fivemiles.auto:auto-data-class-lib:0.5.3'
kapt 'com.fivemiles.auto:auto-data-class-processor:0.5.3'

There was an error in generated files:

DC_Message.kt: (8, 25): Unresolved reference: Generated

It seems that compiler cannot find javax.annotation.Generated and we need to add additional dependency to resolve it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.