Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Package annotations with RetentionPolicy.SOURCE in separate JAR to lighten the final APK #129

@pdecat

Description

@pdecat

It is my understanding that annotations declared with @retention(RetentionPolicy.SOURCE) are discarded at compilation time and as such are not needed at runtime.

Most annotations are in this case, with the exceptions being:

com.googlecode.androidannotations.annotations.EBean / @retention(RetentionPolicy.CLASS)
com.googlecode.androidannotations.annotations.rest.Rest / @retention(RetentionPolicy.CLASS)
com.googlecode.androidannotations.annotations.EApplication / @retention(RetentionPolicy.CLASS)

Including them in the androidannotation-api JAR ends up in making the final APK unnecessarily big.

Indeed, a quick analysis of the com/googlecode/androidannotations/androidannotations/2.4/androidannotations-2.4-api.jar file seems to indicate that these annotations are taking up to 60% of its size.

Placing those annotations in a separate JAR that could be depended on with a "provided" scope would lighten the final APK, wouldn't it.

I'm not that familiar with the annotation processor so I wouldn't be surprised if I'm completely wrong...

Best regards,
Patrick.

PS: thanks to pyricau and a-thomas for the great presentation at last evening PAUG!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions