Integer (Statement stat) { while (true) { Statement parent = stat.getParent(); if (parent == null) { break; } if (parent.type == StatementType.CATCH_ALL || parent.type == StatementType.TRY_CATCH) { if (parent.getFirst() == stat) { return parent.id; } } else if (parent.type == StatementType.SYNCHRONIZED) { if (((SynchronizedStatement)parent).getBody() == stat) { return parent.id; } } stat = parent; } return null; }