static final String TAG = "BugInstance";
static final String[] INTERNAL = { };
- static final Object[][] EXTERNAL = { { BugClass.TAG, BugClass.class},
- { BugMethod.TAG, BugMethod.class},
- { LocalVariable.TAG, LocalVariable.class},
- { SourceLine.TAG, SourceLine.class} };
+ static final Object[][] EXTERNAL = { { BugClass.TAG, BugClass.class },
+ { BugMethod.TAG, BugMethod.class },
+ { Field.TAG, Field.class },
+ { LocalVariable.TAG, LocalVariable.class },
+ { SourceLine.TAG, SourceLine.class } };
static final String CATEGORY = "category";
static final String TYPE = "type";
String m_type;
ArrayList<BugClass> m_classes;
ArrayList<BugMethod> m_methods;
- ArrayList<LocalVariable> m_locals;
+ ArrayList<Variable> m_vars;
ArrayList<SourceLine> m_lines;
ArrayList<Location> m_locations;
m_category = m_type = null;
m_classes = new ArrayList<BugClass>();
m_methods = new ArrayList<BugMethod>();
- m_locals = new ArrayList<LocalVariable>();
+ m_vars = new ArrayList<Variable>();
m_lines = new ArrayList<SourceLine>();
m_locations = new ArrayList<Location>();
}
String category,
String type,
Location[] locations,
- LocalVariable[] variables)
+ Variable[] variables)
{
super(TAG, INTERNAL, EXTERNAL);
m_lines = new ArrayList<SourceLine>();
m_locations = new ArrayList<Location>(Arrays.asList(locations));
- m_locals = new ArrayList<LocalVariable>(Arrays.asList(variables));
+ m_vars = new ArrayList<Variable>(Arrays.asList(variables));
}
public String getCategory() { return m_category; }
public String getType() { return m_type; }
- public List<LocalVariable> getVariables() { return Collections.unmodifiableList(m_locals); }
+ public List<Variable> getVariables() { return Collections.unmodifiableList(m_vars); }
public List<Location> getLocations() { return Collections.unmodifiableList(m_locations); }
@Override
m_methods.add((BugMethod)pr);
}
}
+ else if (Field.TAG.equals(localName)) {
+ ParseResult[] collected = collectParsedChildren(Field.class);
+ for (ParseResult pr : collected) {
+ assert(pr instanceof Field);
+ m_vars.add((Field)pr);
+ }
+ }
else if (LocalVariable.TAG.equals(localName)) {
ParseResult[] collected = collectParsedChildren(LocalVariable.class);
for (ParseResult pr : collected) {
assert(pr instanceof LocalVariable);
- m_locals.add((LocalVariable)pr);
+ m_vars.add((LocalVariable)pr);
}
}
else if (SourceLine.TAG.equals(localName)) {
for (BugMethod bm : m_methods) {
bm.dump(pw, childIndent);
}
- for (LocalVariable lv : m_locals) {
- if (null != lv) {
- lv.dump(pw, childIndent);
- }
+ for (Variable var : m_vars) {
+ pw.println(margin + " " + var.getDescription());
}
for (SourceLine sl : m_lines) {
sl.dump(pw, childIndent);