diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-04-23 23:36:09 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-04-23 23:36:09 +0200 |
commit | 0268a9f02075d0aff3099e721a99956dbc715f6e (patch) | |
tree | 9701612451f2937ec12f436cda32955126886fb0 /src/eclipseAgent/lombok/eclipse | |
parent | b5625e5698ae8c584032730aaa332f5198d80245 (diff) | |
download | lombok-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.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse')
3 files changed, 5 insertions, 5 deletions
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; |