aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2012-04-23 23:36:09 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-04-23 23:36:09 +0200
commit0268a9f02075d0aff3099e721a99956dbc715f6e (patch)
tree9701612451f2937ec12f436cda32955126886fb0
parentb5625e5698ae8c584032730aaa332f5198d80245 (diff)
downloadlombok-0268a9f02075d0aff3099e721a99956dbc715f6e.tar.gz
lombok-0268a9f02075d0aff3099e721a99956dbc715f6e.tar.bz2
lombok-0268a9f02075d0aff3099e721a99956dbc715f6e.zip
Replaced the 'try some reflection and if that fails, oh well' code with catch(Throwable) instead of catch(Exception). The whole point is to default to an alternative path is anything goes wrong, and it turns out there are various ways to get Throwables instead of Exceptions.
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java4
-rw-r--r--src/core/lombok/javac/JavacResolution.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java2
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java4
5 files changed, 9 insertions, 9 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index c15c758e..4cf64a14 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1421,12 +1421,12 @@ public class EclipseHandlerUtil {
Method intLiteralFactoryMethod_ = null;
try {
intLiteralConstructor_ = IntLiteral.class.getConstructor(parameterTypes);
- } catch (Exception ignore) {
+ } catch (Throwable ignore) {
// probably eclipse 3.7++
}
try {
intLiteralFactoryMethod_ = IntLiteral.class.getMethod("buildIntLiteral", parameterTypes);
- } catch (Exception ignore) {
+ } catch (Throwable ignore) {
// probably eclipse versions before 3.7
}
intLiteralConstructor = intLiteralConstructor_;
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java
index 4e988183..6da60907 100644
--- a/src/core/lombok/javac/JavacResolution.java
+++ b/src/core/lombok/javac/JavacResolution.java
@@ -105,7 +105,7 @@ public class JavacResolution {
d.setAccessible(true);
e.setAccessible(true);
f.setAccessible(true);
- } catch (Exception x) {
+ } catch (Throwable x) {
z = true;
}
@@ -114,7 +114,7 @@ public class JavacResolution {
h = Log.class.getDeclaredField("deferredDiagnostics");
g.setAccessible(true);
h.setAccessible(true);
- } catch (Exception x) {
+ } catch (Throwable x) {
}
errWriterField = a;
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
index 7c73b465..6908d623 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
@@ -659,7 +659,7 @@ public class PatchDelegate {
try {
m = ClassScope.class.getDeclaredMethod("buildFieldsAndMethods");
m.setAccessible(true);
- } catch (Exception e) {
+ } catch (Throwable t) {
// 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.
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
index 1bc3904e..54b37341 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
@@ -227,7 +227,7 @@ public class PatchValEclipse {
try {
f = Name.class.getDeclaredField("index");
f.setAccessible(true);
- } catch (Exception e) {
+ } catch (Throwable t) {
// Leave it null, in which case we don't set index. That'll result in error log messages but its better than crashing here.
}
@@ -274,7 +274,7 @@ public class PatchValEclipse {
Class<?> z = Class.forName("org.eclipse.jdt.core.dom.ASTConverter");
h = z.getDeclaredMethod("recordNodes", org.eclipse.jdt.core.dom.ASTNode.class, org.eclipse.jdt.internal.compiler.ast.ASTNode.class);
h.setAccessible(true);
- } catch (Exception e) {
+ } catch (Throwable t) {
// Most likely we're in ecj or some other plugin usage of the eclipse compiler. No need for this.
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
index abace3df..dacd81b4 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipsePortal.java
@@ -118,10 +118,10 @@ public class PatchValEclipsePortal {
Object.class,
Class.forName(SINGLEVARIABLEDECLARATION_SIG),
Class.forName(LOCALDECLARATION_SIG));
- } catch (Exception e) {
+ } catch (Throwable t) {
// 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;
+ problem_ = t;
}
copyInitializationOfForEachIterable = m;
copyInitializationOfLocalDeclaration = n;