⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorcountingbugreporter.java

📁 A static analysis tool to find bugs in Java programs
💻 JAVA
字号:
package edu.umd.cs.findbugs;import java.util.HashSet;import java.util.Set;/** * A delegating bug reporter which counts reported bug instances, * missing classes, and serious analysis errors. */public class ErrorCountingBugReporter extends DelegatingBugReporter {	private int bugCount;	private int missingClassCount;	private int errorCount;	private Set<String> missingClassSet = new HashSet<String>();	public ErrorCountingBugReporter(BugReporter realBugReporter) {		super(realBugReporter);		this.bugCount = 0;		this.missingClassCount = 0;		this.errorCount = 0;		// Add an observer to record when bugs make it through		// all priority and filter criteria, so our bug count is		// accurate.		realBugReporter.addObserver(new BugReporterObserver() {			public void reportBug(BugInstance bugInstance) {				++bugCount;			}		});	}	public int getBugCount() {		return bugCount;	}	public int getMissingClassCount() {		return missingClassCount;	}	public int getErrorCount() {		return errorCount;	}	@Override	public void logError(String message) {		++errorCount;		super.logError(message);	}	@Override	public void reportMissingClass(ClassNotFoundException ex) {		String missing = AbstractBugReporter.getMissingClassName(ex);		if (missing.charAt(0) == '[') return;		if (missingClassSet.add(missing))			++missingClassCount;		super.reportMissingClass(ex);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -