aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-09-20 20:28:41 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-09-20 20:28:41 +0200
commitf37e2fd760e4aa8f01981b3ce000ccb7523a556d (patch)
tree2f58597ee2db3e47e0cd82818a308474cc543d68 /src/eclipseAgent/lombok/eclipse/agent
parente72b2b2d797361bd804cddfb0b80dc5684586436 (diff)
downloadlombok-f37e2fd760e4aa8f01981b3ce000ccb7523a556d.tar.gz
lombok-f37e2fd760e4aa8f01981b3ce000ccb7523a556d.tar.bz2
lombok-f37e2fd760e4aa8f01981b3ce000ccb7523a556d.zip
Slightly improved error reporting if the PatchValEclipsePortal fails to work.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
index 8c308912..9e80be42 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
@@ -1,10 +1,3 @@
-package lombok.eclipse.agent;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import lombok.Lombok;
-
/*
* Copyright © 2011 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans.
*
@@ -26,6 +19,13 @@ import lombok.Lombok;
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+package lombok.eclipse.agent;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import lombok.Lombok;
+
public class PatchValEclipsePortal {
static final String LOCALDECLARATION_SIG = "org.eclipse.jdt.internal.compiler.ast.LocalDeclaration";
static final String PARSER_SIG = "org.eclipse.jdt.internal.compiler.parser.Parser";
@@ -43,6 +43,9 @@ public class PatchValEclipsePortal {
Lombok.sneakyThrow(e);
} catch (InvocationTargetException e) {
Lombok.sneakyThrow(e);
+ } catch (NullPointerException e) {
+ e.initCause(Reflection.problem);
+ throw e;
}
}
@@ -57,6 +60,9 @@ public class PatchValEclipsePortal {
Lombok.sneakyThrow(e);
} catch (InvocationTargetException e) {
Lombok.sneakyThrow(e);
+ } catch (NullPointerException e) {
+ e.initCause(Reflection.problem);
+ throw e;
}
}
@@ -70,6 +76,9 @@ public class PatchValEclipsePortal {
Lombok.sneakyThrow(e);
} catch (InvocationTargetException e) {
Lombok.sneakyThrow(e);
+ } catch (NullPointerException e) {
+ e.initCause(Reflection.problem);
+ throw e;
}
}
@@ -83,6 +92,9 @@ public class PatchValEclipsePortal {
Lombok.sneakyThrow(e);
} catch (InvocationTargetException e) {
Lombok.sneakyThrow(e);
+ } catch (NullPointerException e) {
+ e.initCause(Reflection.problem);
+ throw e;
}
}
@@ -91,9 +103,11 @@ public class PatchValEclipsePortal {
public static final Method copyInitializationOfLocalDeclaration;
public static final Method addFinalAndValAnnotationToVariableDeclarationStatement;
public static final Method addFinalAndValAnnotationToSingleVariableDeclaration;
+ public static final Throwable problem;
static {
Method m = null, n = null, o = null, p = null;
+ Throwable problem_ = null;
try {
m = PatchValEclipse.class.getMethod("copyInitializationOfForEachIterable", Class.forName(PARSER_SIG));
n = PatchValEclipse.class.getMethod("copyInitializationOfLocalDeclaration", Class.forName(PARSER_SIG));
@@ -108,12 +122,13 @@ public class PatchValEclipsePortal {
} catch (Exception e) {
// That's problematic, but as long as no local classes are used we don't actually need it.
// Better fail on local classes than crash altogether.
+ problem_ = e;
}
copyInitializationOfForEachIterable = m;
copyInitializationOfLocalDeclaration = n;
addFinalAndValAnnotationToVariableDeclarationStatement = o;
addFinalAndValAnnotationToSingleVariableDeclaration = p;
-
+ problem = problem_;
}
}
}