diff --git a/src/core/lombok/javac/handlers/HandleCleanup.java b/src/core/lombok/javac/handlers/HandleCleanup.java
index fc74e31..b3416a6 100644
--- a/src/core/lombok/javac/handlers/HandleCleanup.java
+++ b/src/core/lombok/javac/handlers/HandleCleanup.java
@@ -53,6 +53,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Options;
 
 /**
  * Handles the {@code lombok.Cleanup} annotation for javac.
@@ -60,6 +61,10 @@ import com.sun.tools.javac.util.Name;
 @ProviderFor(JavacAnnotationHandler.class)
 public class HandleCleanup extends JavacAnnotationHandler<Cleanup> {
 	@Override public void handle(AnnotationValues<Cleanup> annotation, JCAnnotation ast, JavacNode annotationNode) {
+		Options options = Options.instance(annotationNode.getContext());
+		if (options.keySet().contains("ide") && !options.keySet().contains("backgroundCompilation")) {
+			return;
+		}
 		deleteAnnotationIfNeccessary(annotationNode, Cleanup.class);
 		String cleanupName = annotation.getInstance().value();
 		if (cleanupName.length() == 0) {
diff --git a/src/core/lombok/javac/handlers/HandleSneakyThrows.java b/src/core/lombok/javac/handlers/HandleSneakyThrows.java
index a5bd74e..f96c592 100644
--- a/src/core/lombok/javac/handlers/HandleSneakyThrows.java
+++ b/src/core/lombok/javac/handlers/HandleSneakyThrows.java
@@ -41,11 +41,21 @@ import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
 import com.sun.tools.javac.tree.TreeMaker;
 import com.sun.tools.javac.tree.JCTree.JCAnnotation;
 import com.sun.tools.javac.tree.JCTree.JCBlock;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCIdent;
 import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
 import com.sun.tools.javac.tree.JCTree.JCStatement;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.util.Pair;
+import java.lang.reflect.Field;
+import java.util.Set;
+import javax.tools.JavaFileObject;
+import lombok.Lombok;
 
 /**
  * Handles the {@code lombok.SneakyThrows} annotation for javac.
@@ -75,7 +85,9 @@ public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> {
 			break;
 		}
 	}
-	
+
+        private static final int UNDEFINED_MARKER_POSITION = -17;
+
 	private void handleMethod(JavacNode annotation, JCMethodDecl method, Collection<String> exceptions) {
 		JavacNode methodNode = annotation.up();
 		
@@ -87,6 +99,32 @@ public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> {
 		if (method.body == null) return;
 		if (method.body.stats.isEmpty()) return;
 		
+		Options options = Options.instance(annotation.getContext());
+		if (options.keySet().contains("ide") && !options.keySet().contains("backgroundCompilation")) {
+			try {
+				JCIdent undef = annotation.getTreeMaker().Ident(annotation.toName("$$undefined"));
+				undef.pos = UNDEFINED_MARKER_POSITION;
+				method.thrown = method.thrown.append(undef);
+				methodNode.rebuild();
+
+				final Context ctx = annotation.getContext();
+				Log log = Log.instance(ctx);
+				Field recordedField = Log.class.getDeclaredField("recorded");
+				recordedField.setAccessible(true);
+				Set<Pair<JavaFileObject, Integer>> recorded = (Set<Pair<JavaFileObject, Integer>>) recordedField.get(log);
+				recorded.add(new Pair<JavaFileObject, Integer>(((JCCompilationUnit) annotation.top().get()).sourcefile, UNDEFINED_MARKER_POSITION));
+				return ;
+			} catch (IllegalArgumentException ex) {
+				Lombok.sneakyThrow(ex);
+			} catch (IllegalAccessException ex) {
+				Lombok.sneakyThrow(ex);
+			} catch (NoSuchFieldException ex) {
+				Lombok.sneakyThrow(ex);
+			} catch (SecurityException ex) {
+				Lombok.sneakyThrow(ex);
+			}
+		}
+
 		final JCStatement constructorCall = method.body.stats.get(0);
 		final boolean isConstructorCall = isConstructorCall(constructorCall);
 		List<JCStatement> contents = isConstructorCall ? method.body.stats.tail : method.body.stats;
diff --git a/src/core/lombok/javac/handlers/HandleSynchronized.java b/src/core/lombok/javac/handlers/HandleSynchronized.java
index 7a9a49f..2a1ea40 100644
--- a/src/core/lombok/javac/handlers/HandleSynchronized.java
+++ b/src/core/lombok/javac/handlers/HandleSynchronized.java
@@ -35,6 +35,7 @@ import com.sun.tools.javac.tree.JCTree.JCNewArray;
 import com.sun.tools.javac.tree.JCTree.JCStatement;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Options;
 
 import lombok.Synchronized;
 import lombok.core.AnnotationValues;
@@ -52,6 +53,10 @@ public class HandleSynchronized extends JavacAnnotationHandler<Synchronized> {
 	private static final String STATIC_LOCK_NAME = "$LOCK";
 	
 	@Override public void handle(AnnotationValues<Synchronized> annotation, JCAnnotation ast, JavacNode annotationNode) {
+		Options options = Options.instance(annotationNode.getContext());
+		if (options.keySet().contains("ide") && !options.keySet().contains("backgroundCompilation")) {
+			return;
+		}
 		deleteAnnotationIfNeccessary(annotationNode, Synchronized.class);
 		JavacNode methodNode = annotationNode.up();
 		
