Hopefully a workaround for sun bug 6419926
This commit is contained in:
parent
2a1e476fb5
commit
d272183923
@ -36,6 +36,7 @@ import javax.lang.model.type.TypeMirror;
|
|||||||
import javax.lang.model.util.Types;
|
import javax.lang.model.util.Types;
|
||||||
import javax.tools.JavaFileObject;
|
import javax.tools.JavaFileObject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
public class ConvertSourcePosition implements SourcePosition {
|
public class ConvertSourcePosition implements SourcePosition {
|
||||||
|
|
||||||
@ -113,7 +114,13 @@ public class ConvertSourcePosition implements SourcePosition {
|
|||||||
JavaFileObject sourceFile = compUnit.getSourceFile();
|
JavaFileObject sourceFile = compUnit.getSourceFile();
|
||||||
if (sourceFile == null)
|
if (sourceFile == null)
|
||||||
return emptySourcePosition;
|
return emptySourcePosition;
|
||||||
File file = new File(sourceFile.toUri());
|
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6419926
|
||||||
|
// compels us to check that the returned URIs are absolute, which
|
||||||
|
// they happen not to be for the default compiler on some unices
|
||||||
|
URI uri = sourceFile.toUri();
|
||||||
|
if (!uri.isAbsolute())
|
||||||
|
uri = URI.create("file://" + uri.toString());
|
||||||
|
File file = new File(uri);
|
||||||
ExpressionTree pkgName = compUnit.getPackageName();
|
ExpressionTree pkgName = compUnit.getPackageName();
|
||||||
if (callback != null && pkgName != null)
|
if (callback != null && pkgName != null)
|
||||||
callback.deriveSourcePath(file, pkgName.toString());
|
callback.deriveSourcePath(file, pkgName.toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user