Android Studio incorrectly flagging arguments annotated with Snackbar.Duration -
background
i wrote wrapper around default snackbar.make
method apply custom styling snackbar
instances. method signature of custom wrapper follows:
public static snackbar makecustom( @nonnull view view, @stringres int resid, @snackbar.duration int duration)
where snackbar.duration
annotation defined in android.support.design.widget.snackbar.java
follows:
/** * @hide */ @intdef({length_indefinite, length_short, length_long}) @intrange(from = 1) @retention(retentionpolicy.source) public @interface duration {}
when invoke makecustom
following arguments:
makecustom( activity.findviewbyid(android.r.id.content), messageresid, snackbar.length_short);
i see following error in ide (android studio):
i see no such error if directly invoke snackbar.make
, has following signature:
public static snackbar make( @nonnull view view, @stringres int resid, @duration int duration) {
it appear when used in own method signature, android studio fails recognize values satisfying either of following constraints
@intdef({length_indefinite, length_short, length_long}) @intrange(from = 1)
should considered valid, instead expecting values satisfy both of above constraints simultaneously (which impossible, since length_indefinite
, length_short
, length_long
have values -2
, -1
, 0
respectively).
questions
- am applying
snackbar.duration
annotation properly? - if so:
- is flagged error android studio bug?
- is weird behavior perhaps why annotation marked hidden in source code?
Comments
Post a Comment