aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-06-28 17:00:57 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-06-28 17:00:57 +0200
commit3ad9c273d9fcc6e3a5b0019c3e3b01b7e6d47d67 (patch)
treec79df93d0614de024dc56077790a4d2c31cbe2c8 /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
parent29e8e2af39a3d6672692eba0e8f9b8966a047f96 (diff)
parent315671e79d118de718ae53b664878dd168f70ca2 (diff)
downloadlombok-3ad9c273d9fcc6e3a5b0019c3e3b01b7e6d47d67.tar.gz
lombok-3ad9c273d9fcc6e3a5b0019c3e3b01b7e6d47d67.tar.bz2
lombok-3ad9c273d9fcc6e3a5b0019c3e3b01b7e6d47d67.zip
Merge branch 'master' of github.com:rzwitserloot/lombok
Conflicts: doc/changelog.markdown
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java88
1 files changed, 7 insertions, 81 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 6a903e4c..8326e1d0 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -46,16 +46,13 @@ import lombok.core.AnnotationValues;
import lombok.core.AnnotationValues.AnnotationValue;
import lombok.core.TypeResolver;
import lombok.core.configuration.NullCheckExceptionType;
+import lombok.core.debug.ProblemReporter;
import lombok.core.handlers.HandlerUtil;
import lombok.eclipse.EclipseAST;
import lombok.eclipse.EclipseNode;
import lombok.experimental.Accessors;
import lombok.experimental.Tolerate;
-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.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
@@ -106,7 +103,6 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
-import org.osgi.framework.Bundle;
/**
* Container for static utility methods useful to handlers written for eclipse.
@@ -116,36 +112,16 @@ public class EclipseHandlerUtil {
//Prevent instantiation
}
- private static final String DEFAULT_BUNDLE = "org.eclipse.jdt.core";
-
- /**
- * Generates an error in the Eclipse error log. Note that most people never look at it!
- *
- * @param cud The {@code CompilationUnitDeclaration} where the error occurred.
- * An error will be generated on line 0 linking to the error log entry. Can be {@code null}.
- * @param message Human readable description of the problem.
- * @param error The associated exception. Can be {@code null}.
- */
- public static void error(CompilationUnitDeclaration cud, String message, Throwable error) {
- error(cud, message, null, error);
- }
-
/**
* Generates an error in the Eclipse error log. Note that most people never look at it!
*
* @param cud The {@code CompilationUnitDeclaration} where the error occurred.
* An error will be generated on line 0 linking to the error log entry. Can be {@code null}.
* @param message Human readable description of the problem.
- * @param bundleName Can be {@code null} to default to {@code org.eclipse.jdt.core} which is usually right.
- * @param error The associated exception. Can be {@code null}.
+ * @param ex The associated exception. Can be {@code null}.
*/
- public static void error(CompilationUnitDeclaration cud, String message, String bundleName, Throwable error) {
- if (bundleName == null) bundleName = DEFAULT_BUNDLE;
- try {
- new EclipseWorkspaceLogger().error(message, bundleName, error);
- } catch (NoClassDefFoundError e) { //standalone ecj does not jave Platform, ILog, IStatus, and friends.
- new TerminalLogger().error(message, bundleName, error);
- }
+ public static void error(CompilationUnitDeclaration cud, String message, Throwable ex) {
+ ProblemReporter.error(message, ex);
if (cud != null) EclipseAST.addProblemToCompilationResult(cud.getFileName(), cud.compilationResult, false, message + " - See error log.", 0, 0);
}
@@ -153,60 +129,10 @@ public class EclipseHandlerUtil {
* Generates a warning in the Eclipse error log. Note that most people never look at it!
*
* @param message Human readable description of the problem.
- * @param error The associated exception. Can be {@code null}.
- */
- public static void warning(String message, Throwable error) {
- warning(message, null, error);
- }
-
- /**
- * Generates a warning in the Eclipse error log. Note that most people never look at it!
- *
- * @param message Human readable description of the problem.
- * @param bundleName Can be {@code null} to default to {@code org.eclipse.jdt.core} which is usually right.
- * @param error The associated exception. Can be {@code null}.
+ * @param ex The associated exception. Can be {@code null}.
*/
- public static void warning(String message, String bundleName, Throwable error) {
- if (bundleName == null) bundleName = DEFAULT_BUNDLE;
- try {
- new EclipseWorkspaceLogger().warning(message, bundleName, error);
- } catch (NoClassDefFoundError e) { //standalone ecj does not jave Platform, ILog, IStatus, and friends.
- new TerminalLogger().warning(message, bundleName, error);
- }
- }
-
- private static class TerminalLogger {
- void error(String message, String bundleName, Throwable error) {
- System.err.println(message);
- if (error != null) error.printStackTrace();
- }
-
- void warning(String message, String bundleName, Throwable error) {
- System.err.println(message);
- if (error != null) error.printStackTrace();
- }
- }
-
- private static class EclipseWorkspaceLogger {
- void error(String message, String bundleName, Throwable error) {
- msg(IStatus.ERROR, message, bundleName, error);
- }
-
- void warning(String message, String bundleName, Throwable error) {
- msg(IStatus.WARNING, message, bundleName, error);
- }
-
- private void msg(int msgType, 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%s\n", bundleName, message, error);
- return;
- }
-
- ILog log = Platform.getLog(bundle);
-
- log.log(new Status(msgType, bundleName, message, error));
- }
+ public static void warning(String message, Throwable ex) {
+ ProblemReporter.warning(message, ex);
}
public static ASTNode getGeneratedBy(ASTNode node) {