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):

a screenshot android studio showing error associated parameter snackbar.length_short, reads: "value must >= 1 (was 01)"

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) { 

a screenshot android studio showing no error associated parameter snackbar.length_short

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

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -