2014-10-01 8:02 GMT+04:00  <[email protected]>:
> 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.

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.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to