On Jul 29, 2013, at 3:53 PM, Jeremy Boynes wrote: > This is what lies under the syntactic sugar, and causes no warnings in > javac or IDEA (and I presume Eclipse). Should we stick to it?
I would say no. This is why generics exist, so that you don't have to write code like that. > > Index: java/org/apache/catalina/startup/WebappServiceLoader.java > =================================================================== > --- java/org/apache/catalina/startup/WebappServiceLoader.java (revision > 1508175) > +++ java/org/apache/catalina/startup/WebappServiceLoader.java (working copy) > @@ -82,10 +82,11 @@ > > // if the ServletContext has ORDERED_LIBS, then use that to > specify the > // set of JARs from WEB-INF/lib that should be used for loading > services > - List<String> orderedLibs = (List<String>) > context.getAttribute(ServletContext.ORDERED_LIBS); > + List<?> orderedLibs = (List<?>) > context.getAttribute(ServletContext.ORDERED_LIBS); > if (orderedLibs != null) { > // handle ordered libs directly, ... > - for (String lib : orderedLibs) { > + for (Object o : orderedLibs) { > + String lib = (String) o; > URL jarUrl = context.getResource(LIB + lib); > if (jarUrl == null) { > // should not happen, just ignore > > > > On Mon, Jul 29, 2013 at 12:40 PM, Mark Thomas <ma...@apache.org> wrote: > >> On 29/07/2013 21:04, Nick Williams wrote: >>> On Jul 29, 2013, at 2:02 PM, Jeremy Boynes wrote: >>> >>>> This flags as a warning for me in IDEA without the suppression. Isn't >> this >>>> an unchecked cast (Object to List<String>)? >> >> It is an unchecked cast but there is no way to avoid the cast so there >> is no point the IDE flagging it as there is nothing the developer can do >> to fix it. Eclipse added an option (Ignore unavoidable generic type >> problems) not to flag issues such as this as of a recent(ish) version. >> >>> Yes, that's an unchecked cast. The @SuppressWarnings was not unnecessary. >> >> Yes, it is unchecked cast. However, the warning is pointless and >> shouldn't have been generated in the first place. >> >> The Tomcat 8 code base should not exhibit any warnings with the defined >> Eclipse settings [1]. Ditto for FindBugs and Checkstyle with the >> provided configurations. >> >> The intention is to add additional checks over time although we haven't >> added any for a while. >> >> Mark >> >> >> http://svn.apache.org/viewvc/tomcat/trunk/res/ide-support/eclipse/java-compiler-errors-warnings.txt?view=annotate >> >> >>> >>> N >>> >>>> >>>> >>>> On Mon, Jul 29, 2013 at 11:38 AM, <ma...@apache.org> wrote: >>>> >>>>> Author: markt >>>>> Date: Mon Jul 29 18:38:08 2013 >>>>> New Revision: 1508171 >>>>> >>>>> URL: http://svn.apache.org/r1508171 >>>>> Log: >>>>> Remove unnecessary @SuppressWarnings >>>>> >>>>> Modified: >>>>> >> tomcat/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java >>>>> >>>>> Modified: >>>>> tomcat/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java >>>>> URL: >>>>> >> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java?rev=1508171&r1=1508170&r2=1508171&view=diff >>>>> >>>>> >> ============================================================================== >>>>> --- >> tomcat/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java >>>>> (original) >>>>> +++ >> tomcat/trunk/java/org/apache/catalina/startup/WebappServiceLoader.java >>>>> Mon Jul 29 18:38:08 2013 >>>>> @@ -82,7 +82,6 @@ public class WebappServiceLoader<T> { >>>>> >>>>> // if the ServletContext has ORDERED_LIBS, then use that to >>>>> specify the >>>>> // set of JARs from WEB-INF/lib that should be used for loading >>>>> services >>>>> - @SuppressWarnings("unchecked") >>>>> List<String> orderedLibs = (List<String>) >>>>> context.getAttribute(ServletContext.ORDERED_LIBS); >>>>> if (orderedLibs != null) { >>>>> // handle ordered libs directly, ... >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >>>>> For additional commands, e-mail: dev-h...@tomcat.apache.org >>>>> >>>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: dev-h...@tomcat.apache.org >>> >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org