That's a very interesting project, thanks for sharing! Dawid
On Thu, Jan 30, 2025 at 11:25 PM Robert Muir <rcm...@gmail.com> wrote: > For this one I would use ast-grep, maybe set threshold at 100 > arguments which is a crazy amount and would detect where things might > go bad. You might have to refine this example, but it is good for such > things and fast as hell. > > https://s.apache.org/ueozj > > On Thu, Jan 30, 2025 at 5:27 PM Chris Hostetter > <hossman_luc...@fucit.org> wrote: > > > > > > : 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 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: dev-h...@lucene.apache.org > >