On Tue, Jul 26, 2011 at 4:22 PM, bvahdat <babak.vah...@swissonline.ch> wrote:
> Hi Claus,
>
> There're many places in Camel (including the unit-tests) where an inner
> class is declared to be nonstatic although a static one would also do the
> job. On ther other hand as stands in the Java-Bible[1]   it makes sense in
> such cases to move towards the static-ones. Best reason I see for this (as
> already mentioned in [1]) is the avoidance of the extraneous reference to
> it's enclosing instance which costs *time* and *space*. So that I can even
> imagine that running the tests on the Apache CI-Servers would/could even run
> faster!

Yeah I can imagine there may be some inner clases that could be
converted to static, if they dont need access to their enclosing
class.

For unit tests I doubt it have any effect, as the unit test is short
lived and executed once when testing. In camel-core it could be
another matter as that code is what you run in production.

>
> I've already a patch available on my workspace, but before creating a ticket
> (including the patch), I first wanted to check what the Lead-Rider  thinks
> about such a change.
>
> Another question I have is regarding the patch I provided by [2]. Just
> wonder why you didn't want to take over the 2 changes with
> assertTrue(file.delete()) stuff in TestSupport:
>

This caused unit tests to fail.

>        // assert on the return value below so that we surely know that the
> file has been deleted
>        // as it could be that some native processes're sitting on the file
> prohibiting the deletion
>        // (i.e. on windows that could be the windows explorer, etc.)
>        assertTrue(file.delete());
>
> Or maybe even better:
>
>        assertTrue("deletion of " + file.getAbsolutePath() + " failed!",
> file.delete());
>
> [1]
> http://books.google.ch/books?id=ka2VUBqHiWkC&lpg=PA106&dq=effective%20java%20non%20static%20inner%20classes&pg=PA106#v=onepage&q&f=false
> [2] https://issues.apache.org/jira/browse/CAMEL-4255
>
> Regards, Babak
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Favor-static-member-classes-over-nonstatic-tp4634964p4634964.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to