aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse/Eclipse.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-20 23:46:17 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-21 00:10:58 +0200
commit255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba (patch)
tree347c4b1cf5b34b3975cc00e26a42c75ee1295b76 /src/lombok/eclipse/Eclipse.java
parent2e8e43a12e21151ff470a2729373b4af4980d113 (diff)
downloadlombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.tar.gz
lombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.tar.bz2
lombok-255bd5907176cb5d2c4fb1cf6a9b48b14af0b4ba.zip
Due to a java bug, constants in enums don't work, so instead the default access level for @Getter and @Setter have now just been hardcoded in GetterHandler and SetterHandler.
Added ability to look up the Node object for any given AST object on Node itself, as you don't usually have the AST object. Added toString() method generating to @Data, and this required some fancy footwork in finding if we've already generated methods, and editing a generated method to fill in binding and type resolutions. HandleGetter and HandleSetter have been updated to use these features. Exceptions caused by lombok handlers show up in the eclipse error log, but now, if they are related to a CompilationUnit, also as a problem (error) on the CUD - those error log entries are easy to miss! Our ASTs can now be appended to. When you generate a new AST node, you should add it to the AST, obviously. Getter/Setter have been updated to use this.
Diffstat (limited to 'src/lombok/eclipse/Eclipse.java')
-rw-r--r--src/lombok/eclipse/Eclipse.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lombok/eclipse/Eclipse.java b/src/lombok/eclipse/Eclipse.java
index baac26a9..a7286058 100644
--- a/src/lombok/eclipse/Eclipse.java
+++ b/src/lombok/eclipse/Eclipse.java
@@ -19,37 +19,45 @@ import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.Literal;
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.osgi.framework.Bundle;
public class Eclipse {
+ public static final int ECLIPSE_DO_NOT_TOUCH_FLAG = ASTNode.Bit24;
private Eclipse() {
//Prevent instantiation
}
private static final String DEFAULT_BUNDLE = "org.eclipse.jdt.core";
- public static void error(String message) {
- error(message, DEFAULT_BUNDLE, null);
+ public static final TypeReference TYPEREF_JAVA_LANG_STRING = new QualifiedTypeReference(
+ TypeConstants.JAVA_LANG_STRING, new long[] {0, 0, 0});
+
+ public static void error(CompilationUnitDeclaration cud, String message) {
+ error(cud, message, DEFAULT_BUNDLE, null);
}
- public static void error(String message, Throwable error) {
- error(message, DEFAULT_BUNDLE, error);
+ public static void error(CompilationUnitDeclaration cud, String message, Throwable error) {
+ error(cud, message, DEFAULT_BUNDLE, error);
}
- public static void error(String message, String bundleName) {
- error(message, bundleName, null);
+ public static void error(CompilationUnitDeclaration cud, String message, String bundleName) {
+ error(cud, message, bundleName, null);
}
- public static void error(String message, String bundleName, Throwable error) {
+ public static void error(CompilationUnitDeclaration cud, String message, String bundleName, Throwable error) {
Bundle bundle = Platform.getBundle(bundleName);
if ( bundle == null ) {
System.err.printf("Can't find bundle %s while trying to report error:\n%s\n", bundleName, message);
@@ -59,6 +67,7 @@ public class Eclipse {
ILog log = Platform.getLog(bundle);
log.log(new Status(IStatus.ERROR, bundleName, message, error));
+ if ( cud != null ) EclipseAST.addProblemToCompilationResult(cud, false, message + " - See error log.", 0, 0);
}
static String toQualifiedName(char[][] typeName) {