On Jun 29, 2:29 am, Jan Goyvaerts <java.arti...@gmail.com> wrote:
>    - The new java hints are certainly nice but in my opinion nothing beats
>    Findbugs indeed. It does the checks mentioned in the cast and quite some
>    others. The SQE project provides a plugin for Findbugs, PMD, Checkstyle en
>    dependency check. It's a bit performance-hungry though...

Yes, findbugs is very nice, but I think it's also a good idea to have
IDE support for this.  Findbugs will find the errors for you, but it
will not FIX them. To take the logger example again, NetBeans rewrites
your source code to use a message template rather than the string
concatenation syntax. For collections it replaces the .length == 0
with isEmpty(), etc. etc.  It also has an educational aspect in that
the warnings are right there when you are editing the source, rather
than when you are combing over the source code later.

Findbugs has one huge strength: it operates on bytecode only. This
means that it can find bugs in your code regardless of which JVM
language you used. This was an amazing realization for me back when we
were working on the Visual Basic compiler -- we had debugging and even
findbugs working, since in both cases only the byte code and a
suitable linenumber table mattered!

It does however mean that it cannot operate on source since it has no
parse tree, so (1) it won't be able to have rewriting rules like the
ones I described above, and (2) it won't be able to find bugs that are
source-code oriented. For example, I've seen MANY bugs that were the
result of leaving out braces in an if/else construct. The original if-
conditional had a single statement as the body, and somebody came
along later and added another statement not realizing the body hadn't
been defined without braces, and voila -- the indentation is lying.
The statement LOOKS like it's part of the if, but it's not.  Findbugs
cannot find this.  Tools operating on source code can. (And yes,
NetBeans has a quickfix for this, which I don't think is enabled by
default, but I have it enabled and I use its quickfix whenever I see
anybody violating it. And I also take the opportunity to see if the
logic looks correct.

>    why it is scanning the very same Maven libraries each time I'm starting up 
> ?

Sorry, I don't use Maven so I can't really comment on this other than
to say I'm sorry it sounds like it's not fixed yet.

I suspect the Maven support itself may be initiating a lot of scanning
or refresh operations, since Maven is an external tool, so after it
runs the IDE has really very little idea what running the task has
done.  I used to work on something similar, the Rails support in
NetBeans, and when running certain code generators via the rails
infrastructure I had no idea what would happen to the files on disk,
so to be on the safe side, for any unknown actions it would just force
a disk refresh. It's possible that the Maven support is doing
something similar -- I'm just speculating here. All I can say is that
for the project types I'm using (Java+JavaFX) and for some other
project types I've seen described (such as PHP) it is working well.

-- Tor

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to