aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java2
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchVal.java19
2 files changed, 18 insertions, 3 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index 38af8b16..73d6ee90 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -1395,7 +1395,7 @@ public class PrettyPrinter extends JCTree.Visitor {
}
}
- @Override public void visitTypeBoundKind(TypeBoundKind tree) {
+ public void visitTypeBoundKind(TypeBoundKind tree) {
print(String.valueOf(tree.kind));
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
index 30574ea6..2b8dfbaa 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
@@ -57,6 +57,9 @@ public class PatchVal {
return expr.resolveType(scope);
} catch (NullPointerException e) {
return null;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // This will occur internally due to for example 'val x = mth("X");', where mth takes 2 arguments.
+ return null;
}
}
@@ -66,6 +69,9 @@ public class PatchVal {
return expr.resolveType(scope);
} catch (NullPointerException e) {
return null;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // This will occur internally due to for example 'val x = mth("X");', where mth takes 2 arguments.
+ return null;
}
}
@@ -164,7 +170,7 @@ public class PatchVal {
TypeBinding resolved = null;
try {
- resolved = decomponent ? getForEachComponentType(init, scope) : init.resolveType(scope);
+ resolved = decomponent ? getForEachComponentType(init, scope) : resolveForExpression(init, scope);
} catch (NullPointerException e) {
// This definitely occurs if as part of resolving the initializer expression, a
// lambda expression in it must also be resolved (such as when lambdas are part of
@@ -222,7 +228,7 @@ public class PatchVal {
private static TypeBinding getForEachComponentType(Expression collection, BlockScope scope) {
if (collection != null) {
TypeBinding resolved = collection.resolvedType;
- if (resolved == null) resolved = collection.resolveType(scope);
+ if (resolved == null) resolved = resolveForExpression(collection, scope);
if (resolved == null) return null;
if (resolved.isArrayType()) {
resolved = ((ArrayBinding) resolved).elementsType();
@@ -250,4 +256,13 @@ public class PatchVal {
return null;
}
+
+ private static TypeBinding resolveForExpression(Expression collection, BlockScope scope) {
+ try {
+ return collection.resolveType(scope);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Known cause of issues; for example: val e = mth("X"), where mth takes 2 arguments.
+ return null;
+ }
+ }
}