- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
question for bytecode fans
Mon, 2009-11-30, 13:19
Hi,
I wanted to know more about the enhancement ticket: "FindBugs should be run
during nightly tests", http://lampsvn.epfl.ch/trac/scala/ticket/571
and thus I run FindBugs on scala-compiler.jar, with the command line:
findbugs.bat -textui -exclude NMSe.xml -auxclasspath scala-library.jar
scala-compiler.jar
where NMSe.xml is used to filter harmless warings like "Class name does not
start with lower case letter". The contents of NMSe.xml are simply:
(More on such filters at http://findbugs.sourceforge.net/manual/filter.html
an on Bug Codes at http://findbugs.sourceforge.net/bugDescriptions.html )
I haven't analyzed yet all the output (for an excerpt see below) and before
getting into that I wanted to ask the community whether someone has been
exploring this already. I have the feeling that many of the reported errors
are false-positives but I don't see an easy way to tell which those are.
Related question: is there a way to obtain automatically a witness trace,
for some reported condition?
Some representative examples of the FindBugs output follow:
H B Eq:
scala.tools.nsc.backend.icode.GenICode$ICodePhase$Finalizer.equals(Object)
checks for operand being a scala.tools.nsc.ast.Trees$Tree At
GenICode.scala:[line 1620]
M C UMAC: Uncallable method
scala.tools.nsc.typechecker.Implicits$ImplicitSearch$$anonfun$applicableInfos$1.apply(List)
defined in anonymous class At Implicits.scala:[line 547]
M C NP: Null pointer dereference of ? in
scala.tools.nsc.backend.icode.analysis.CopyPropagation$CopyAnalysis$$anonfun$scala$tools$nsc$backend$icode$analysis$CopyPropagation$CopyAnalysis$$retain$2.apply(Tuple2)
Dereferenced at CopyPropagation.scala:[line 253]
M D NP: Load of known null value in
scala.tools.nsc.backend.icode.analysis.CopyPropagation$CopyAnalysis$$anonfun$scala$tools$nsc$backend$icode$analysis$CopyPropagation$CopyAnalysis$$retain$2.apply(Tuple2)
At CopyPropagation.scala:[line 253]
M C EC: Using pointer equality to compare a Trees$Tree with a Trees$StubTree
in scala.tools.nsc.ast.Trees$StubTree$class.equalsStructure0(Trees$StubTree,
Trees$Tree, Function2) At Trees.scala:[line 950]
M D ST: Write to static field
scala.tools.nsc.InterpreterResults$Success$.MODULE$ from instance method new
scala.tools.nsc.InterpreterResults$Success$() At
InterpreterResults.scala:[line 15]
M C EC: Call to equals() with null argument in
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$push$1$1.apply(String)
At GenJVM.scala:[line 288]
M V EI2: new scala.tools.nsc.util.BitSet$$anonfun$$up$1(BitSet, BitSet,
long[]) may expose internal representation by storing an externally mutable
object into BitSet$$anonfun$$up$1.words$4 At BitSet.scala:[line 56]
M D IM: Check for oddness that won't work for negative numbers in
scala.tools.nsc.javac.JavaTokens$.isCloseBrace(int) At
JavaTokens.scala:[line 146]
M B CN: Class scala.tools.ant.sabbus.Settings implements Cloneable but does
not define or use clone method At Settings.scala:[lines 18-96]
M D RCN: Redundant nullcheck of this, which is known to be non-null in
scala.tools.nsc.backend.icode.Primitives$LogicalOp.toString() Redundant
null check at Primitives.scala:[line 224]
As always, comments are welcome.