remarked out the work in progress on resolving file paths in eclipse; this causes ClassNotFoundErrors in ecj mode

This commit is contained in:
Reinier Zwitserloot committed 2014-06-10 12:00:05 +02:00
1 parent e453c2fafa
commit 01d2115b4f
1 file changed
+33 -37
+33 -37
View File
@@ -22,7 +22,6 @@
package lombok.eclipse; package lombok.eclipse;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URI; import java.net.URI;
@@ -51,9 +50,6 @@ import org.eclipse.jdt.internal.compiler.ast.Initializer;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.core.Openable;
import org.eclipse.jdt.internal.core.builder.SourceFile;
/** /**
* Wraps around Eclipse's internal AST view to add useful features as well as the ability to visit parents from children, * Wraps around Eclipse's internal AST view to add useful features as well as the ability to visit parents from children,
@@ -119,39 +115,39 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> {
} }
} }
/** This is ongoing research for issues with lombok.config resolution. */ // /** This is ongoing research for issues with lombok.config resolution. */
@SuppressWarnings("unused") private String getAlternativeAbsolutePathDEBUG() { // @SuppressWarnings("unused") private String getAlternativeAbsolutePathDEBUG() {
try { // try {
ICompilationUnit cu = this.compilationUnitDeclaration.compilationResult.compilationUnit; // ICompilationUnit cu = this.compilationUnitDeclaration.compilationResult.compilationUnit;
//
if (cu instanceof Openable) { // if (cu instanceof Openable) {
String x = ((Openable) cu).getResource().getFullPath().makeAbsolute().toString(); // String x = ((Openable) cu).getResource().getFullPath().makeAbsolute().toString();
int lastLoc = x.lastIndexOf('/'); // int lastLoc = x.lastIndexOf('/');
x = x.substring(0, lastLoc + 1) + "lombok.config"; // x = x.substring(0, lastLoc + 1) + "lombok.config";
URI lombokConfigLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(x)).getLocationURI(); // URI lombokConfigLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(x)).getLocationURI();
InputStream in = ResourcesPlugin.getWorkspace().getRoot().getFile(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(x)).getFullPath()).getContents(true); // InputStream in = ResourcesPlugin.getWorkspace().getRoot().getFile(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(x)).getFullPath()).getContents(true);
byte[] b = new byte[100000]; // byte[] b = new byte[100000];
int p = 0; // int p = 0;
while (true) { // while (true) {
int r = in.read(b, p, b.length - p); // int r = in.read(b, p, b.length - p);
if (r == -1) break; // if (r == -1) break;
p += r; // p += r;
} // }
in.close(); // in.close();
return "(Contents of lombok.config: " + new String(b, 0, p, "UTF-8"); // return "(Contents of lombok.config: " + new String(b, 0, p, "UTF-8");
//
// return "(alt strategy result C: '" + ((Openable) cu).getResource().getFullPath().makeAbsolute().toString() + "'): resolved: " + EclipseWorkspaceBasedFileResolver.resolve(((Openable) cu).getResource().getFullPath().makeAbsolute().toString()); //// return "(alt strategy result C: '" + ((Openable) cu).getResource().getFullPath().makeAbsolute().toString() + "'): resolved: " + EclipseWorkspaceBasedFileResolver.resolve(((Openable) cu).getResource().getFullPath().makeAbsolute().toString());
} // }
if (cu instanceof SourceFile) { // if (cu instanceof SourceFile) {
String cuFileName = new String(((SourceFile) cu).getFileName()); // String cuFileName = new String(((SourceFile) cu).getFileName());
String cuIFilePath = ((SourceFile) cu).resource.getFullPath().toString(); // String cuIFilePath = ((SourceFile) cu).resource.getFullPath().toString();
return "(alt strategy result A: \"" + cuFileName + "\" B: \"" + cuIFilePath + "\")"; // return "(alt strategy result A: \"" + cuFileName + "\" B: \"" + cuIFilePath + "\")";
} // }
return "(alt strategy failed: cu isn't a SourceFile or Openable but a " + cu.getClass() + ")"; // return "(alt strategy failed: cu isn't a SourceFile or Openable but a " + cu.getClass() + ")";
} catch (Exception e) { // } catch (Exception e) {
return "(alt strategy failed: " + e + ")"; // return "(alt strategy failed: " + e + ")";
} // }
} // }
private static class EclipseWorkspaceBasedFileResolver { private static class EclipseWorkspaceBasedFileResolver {
public static URI resolve(String path) { public static URI resolve(String path) {