AJCVariableDecl decl = null;
// Find the declaration. Should be first.
Iterator<AJCTree> usageIterator = fixableHere.iterator();
while (usageIterator.hasNext()) {
AJCTree usage = usageIterator.next();
if (usage instanceof AJCVariableDecl) {
decl = (AJCVariableDecl) usage;
usageIterator.remove();
break;
}
}
if (decl == null) {
log.fatal("Unable to find decl for {}!", sym);
return;
}
UnboxMapper mapper = new UnboxMapper(sym);
// Fix up all usages, including the init...
for (AJCTree usage : fixableHere) {
AJCForest.getInstance().increment("Boxed Usages Removed:");
log.info("Fixing usage: {}", usage);
AJCTree replacement = mapper.replacementTree(usage);
log.info("Swapping {} for {}", usage, replacement);
log.debug("Parent: {}:{}", usage.mParentNode, usage.mParentNode.getClass().getCanonicalName());
usage.swapFor(replacement);
}