aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-11-07 16:18:54 -0800
committerAndy Clement <aclement@pivotal.io>2016-11-07 16:18:54 -0800
commit611e04a9e1f3f2368f3ce3237b6288b119ac9943 (patch)
tree8664f783ff4eae5ba78e6c356b2f3a9c3c800825 /bcel-builder
parentde34df77ea7f7372894cf1e2352766118a798e98 (diff)
downloadaspectj-611e04a9e1f3f2368f3ce3237b6288b119ac9943.tar.gz
aspectj-611e04a9e1f3f2368f3ce3237b6288b119ac9943.zip
Fix 500796: Allow for kotlin creating 'synthetic' local variable table entries
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java
index 59cf7397e..21673dec0 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java
@@ -880,9 +880,19 @@ public class MethodGen extends FieldGenOrMethodGen {
}
/**
- * Compute maximum number of local variables.
+ * Compute maximum number of local variables based on the parameter count and bytecode usage of variables.
*/
public void setMaxLocals() {
+ setMaxLocals(false);
+ }
+
+ /**
+ * Compute maximum number of local variables.
+ *
+ * @param respectLocalVariableTable if true and the local variable table indicates more are in use
+ * than the code suggests, respect the higher value from the local variable table data.
+ */
+ public void setMaxLocals(boolean respectLocalVariableTable) {
if (il != null) {
int max = isStatic() ? 0 : 1;
@@ -903,10 +913,13 @@ public class MethodGen extends FieldGenOrMethodGen {
}
}
}
-
- maxLocals = max;
+ if (!respectLocalVariableTable || max > maxLocals) {
+ maxLocals = max;
+ }
} else {
- maxLocals = 0;
+ if (!respectLocalVariableTable) {
+ maxLocals = 0;
+ }
}
}