}
try {
BalancedTokenizer tokenizer = new BalancedTokenizer(source);
String packageName = null;
ClassName className = null;
ArrayList<Long> orphanLineNumbers = new ArrayList<Long>();
while (tokenizer.hasNext()) {
JavaTokenizer.Token token = tokenizer.next();
switch (token.kind) {
case WORD:
if (tokenizer.getCurrentLevel() == 0) {
if (token.text.equals("package")) {
packageName = JavaUtils.parseQualifiedName(tokenizer);
} else if (token.text.equals("import")) {
String name = JavaUtils.parseQualifiedName(tokenizer, true);
if (name.equals("static")) {
name += " " + JavaUtils.parseQualifiedName(tokenizer, true);
}
importNames.add(name);
} else if (TYPE_KEYWORDS.contains(token.text)) {
String name = JavaUtils.parseQualifiedName(tokenizer);
if (packageName != null) {
name = packageName + "." + name;
}
className = new ClassName(name.replace('.', '/'));
contractLineNumbers
.put(className, new ArrayList<Long>(orphanLineNumbers));
orphanLineNumbers.clear();
JavaUtils.skipPast(tokenizer, "{");
}