On 1 October 2014 22:02, Konstantin Kolinko <knst.koli...@gmail.com> wrote: > 2014-10-01 8:02 GMT+04:00 <ol...@apache.org>: >> Author: olamy >> Date: Wed Oct 1 04:02:59 2014 >> New Revision: 1628592 >> >> URL: http://svn.apache.org/r1628592 >> Log: >> minot formatting >> >> Modified: >> >> tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java >> >> tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/RunMojo.java >> >> Modified: >> tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java >> URL: >> http://svn.apache.org/viewvc/tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java?rev=1628592&r1=1628591&r2=1628592&view=diff >> ============================================================================== >> --- >> tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java >> (original) >> +++ >> tomcat/maven-plugin/branches/tc8.x/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java >> Wed Oct 1 04:02:59 2014 >> @@ -734,7 +734,7 @@ public abstract class AbstractRunMojo >> // normally this one only but just in case ... >> if ( jarScanner instanceof StandardJarScanner ) >> { >> - ( (StandardJarScanner) jarScanner ).setScanAllDirectories( >> jarScanAllDirectories ); >> + ( StandardJarScanner.class.cast( jarScanner ) >> ).setScanAllDirectories( jarScanAllDirectories ); >> } > > > Is there any profit in changing > > ( (StandardJarScanner) jarScanner ) > > to > > StandardJarScanner.class.cast( jarScanner ) > ? > > 1) The former is an operation, the latter is a method call. I think an > operation executes more efficiently. > > 2) The latter is longer text.
I found that more readable (but that's really subjective :-) ) > > 3) I have seen compilers to spot errors in class-cast operations (such > as "unnecessary class-cast" and "illegal class-cast" errors). > > I suspect that it would be harder to them to spot such errors in > method calls, though I do not have experience here. Make sense I will revert that. > > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > -- Olivier Lamy http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org