File resolvedFile = null;
if (obj != null) {
URI uri = obj.toUri();
source = uri.getPath();
if (obj instanceof JavaFileObjectImpl) {
JavaFileObjectImpl foo = (JavaFileObjectImpl)obj;
try {
resolvedFile = foo.getFile();
}
catch (Exception ignore) {
}
} else {
// We are likely in eclipse (with its JavaFileObject wrapper) and we should get the file from the URI