2011/9/16 <ma...@apache.org>: > ma...@apache.org wrote: > >>Konstantin Kolinko <knst.koli...@gmail.com> wrote: >> >>>2011/9/6 <ma...@apache.org>: >>>> Author: markt >>>> Date: Tue Sep 6 11:12:17 2011 >>>> New Revision: 1165601 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=1165601&view=rev >>>> Log: >>>> Add another 3.7+ note >>>> >>>> Modified: >>>> >>> tomcat/trunk/res/ide-support/eclipse/java-compiler-errors-warnings.txt >>>> >>>> @@ -50,6 +50,7 @@ >>>> Generic types >>>> - All - W >>>> + (ignore unavoidable generics warnings) (Eclipse 3.7+) >>> >>>What value do you mean for that checkbox? >>> [ ] or [x] Ignore unavoidable generic type problems >> >>Checked. >> >>>My setting was "[ ]". >>> >>>When I changed it to "[x]" I got +11 more warnings than before >>>(Those are "Unnecessary @SuppressWarnings("unchecked")"). >> >>Same here. >> >>>As far as I do not grasp what those "unavoidable" problems are, I have >>>slight preference to keep it as "[ ]". >> >>My preference was for checked since it would allow me to delete some >>stuff. I haven't got around to that yet. >>
Looking at what warnings this flag suppresses, I start to like it. But, the compiler in Oracle JDK 6 is not so clever. When building with build.xml as is, it prints a warning that problems are there: [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. If I add <compilerarg value="-Xlint:unchecked"/>, it lists all those warnings, and it can be seen that those are the ones that are ignored by Eclipse if this "Ignore unavoidable generic type problems" flag is enabled. E.g. in AbstractReplicatedMap class. I have some hope that if all those places will be marked with @SuppressWarnings("unchecked") then javac warning will disappear. The "ignore unavoidable .. problems" flag makes finding and fixing them a bit harder. It confirms my preference for having it turned off. For information, some examples of these are the generic type problems that are suppressed by this flag: 1) Documentation in Eclipse mentions the following: [[[ As an example, a type may be forced to use raw types in its method signatures and return types because the methods it overrides from a super type are declared to use raw types in the first place. ]]] Sounds like the code in ExpressionEvaluatorImpl, that extends old deprecated class from JSP EL API. The API that it implements does not use generics. 2) Casting from Object to a generic type. This conversion is itself unchecked by its nature, so it cannot be avoided. E.g. (in AbstractHttp11Processor): @SuppressWarnings("unchecked") AbstractInputBuffer<S> internalBuffer = (AbstractInputBuffer<S>) request.getInputBuffer(); or (in VariableMapperImpl): @SuppressWarnings("unchecked") @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.vars = (Map<String, ValueExpression>) in.readObject(); } 3) Implementation details when non-generics class extends generics class: e.g. AbstractReplicatedMap. This is not much, because the warnings are already there. If the flag is unchecked there are just twice more warnings there. Either annotating the whole class with @SuppressWarnings, or changing its implementation to use genetics would be a solution here, regardless of the flag. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org