We use JTest from parasoft for static analysis. It usually flags up these
sort of errors. The reasoning behind their rules can be found at:

http://www.parasoft.com/products/jtest/manuals/v4_1/r_index.htm#1001102 -
Scan to correct section

John
-----Original Message-----
From: Jason Dillon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2001 20:32
To: marc fleury
Cc: Jboss-Development@Lists. Sourceforge. Net
Subject: [JBoss-dev] Re: on the use of final


> My question though is "is it worth it?" what are the advantages of using
> final as opposed to not using final and not worrying about the mutability
of
> it?
> 
> speed gain?

Depends on where final is used.  For final as a method attribute modifier 
there is no speed increase, it is just an engineering tool to prevent the 
value from being modified.  It is common to use final for constructors.  For

example:

   class MyClass
   {
      int foo;
   
      MyClass(int foo) {
         foo = foo;
      }
   }

This is an error, but will compile and execute.  To avoid this type of bug, 
mark method attributes which should not change as final:

   class MyClass  
   { 
      int foo;
  
      MyClass(final int foo) {
         foo = foo; // COMPILE ERROR
      }
   } 

Final on a method, could cause a speed increase, allowing the compiler to 
inline the method.  From what I remember, the HotSpot VM folks at JavaOne 
said that this will have little or no effect due to new compiler techniques.

 * * *

Which usage of final are you refering too?

--jason



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to