My first Groovy program
When I heard the JavaPosse interview about Groovy I became really interested in it. The fact that it offers a scripting language based on the JVM and that it can be seamlessly integrated with Java fascinated me. So I decided to buy the Groovy in Action book and try it out. This is my first attempt at something that might become useful later: def foundtypes = [:] def sum = 0 def stats = "" bugs = new XmlSlurper().parse(new File("/home/ds/findbugs.xml")); bugs.BugInstance.findAll { instance -> instance.@category =~ 'CORRECTNESS|BAD_PRACTICE|MT_CORRECTNESS' }.each { instance -> type = instance.@type.toString() foundtypes[type] = foundtypes.get(type,0) + 1 } foundtypes.each { sum += it.value } println "Found ${foundtypes.size()} types of errors and $sum total:" foundtypes.each() { type -> stats += type.key.padLeft(42) + " : " stats += type.value + "\n" } println stats What this does is slur