: Have seen it on other cases, too. Seems to happen when you create long lists
: based on methods that use generics for their return type.

Havng gone down Dawid's compiler-dev@ thread rabbit hole: correct.

: The workaround is to hardcode the type in the asList() call, then the code
: does not have to handle the generic return of each parameter:
: 
:       Arrays.<Entry<String,String>>asList(....)

Uwe: does forbidden-apis have enough type information to recognize:
  1) the length of a varargs list
  2) when the source code it's checking is missing explicit generic type 
declarations in the method call


I'm wondering if a new forbidden-api feature could restrict usage based on 
generics and/or varargs length, such that we could write a rule saying 
"Arrays.asList w/ varargs.length > 3 must specify explicit type"

So this would be forbidden...

   Arrays.asList("x", 2, "y", 3);

...but these would be legal...

    Arrays.<Object>asList("x", 2, "y", 3);
    Arrays.asList("x", 2, foo);




-Hoss
http://www.lucidworks.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to