excilys/androidannotations — Issue #129: Package annotations with RetentionPolicy.SOURCE in separate JAR to lighten the final APK
Author: pdecat
Created: 2012-03-09 01:24:44+00:00
State: open

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!