This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 09ecc4d restore support for invokedynamic=true and targetBytecode=1.7
09ecc4d is described below
commit 09ecc4ddd5cff6cb383cbc0e1d856dd606dbb1a9
Author: Eric Milles <[email protected]>
AuthorDate: Wed Jan 22 16:06:49 2020 -0600
restore support for invokedynamic=true and targetBytecode=1.7
---
.../groovy/classgen/asm/WriterController.java | 24 ++++++++++------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git
a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
index 4c124a9..daf249c 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/WriterController.java
@@ -112,7 +112,7 @@ public class WriterController {
this.unaryExpressionHelper = new UnaryExpressionHelper(this);
if (optimizeForInt) {
this.fastPathBinaryExpHelper = new
BinaryExpressionMultiTypeDispatcher(this);
- // todo: replace with a real fast path unary expression helper
when available
+ // TODO: replace with a real fast path unary expression helper
when available
this.fastPathUnaryExpressionHelper = new
UnaryExpressionHelper(this);
} else {
this.fastPathBinaryExpHelper = this.binaryExpHelper;
@@ -140,10 +140,7 @@ public class WriterController {
}
private ClassVisitor createClassVisitor(final ClassVisitor cv) {
- if (!LOG_CLASSGEN) {
- return cv;
- }
- if (cv instanceof LoggableClassVisitor) {
+ if (!LOG_CLASSGEN || cv instanceof LoggableClassVisitor) {
return cv;
}
return new LoggableClassVisitor(cv);
@@ -151,16 +148,17 @@ public class WriterController {
private static int chooseBytecodeVersion(final boolean invokedynamic,
final boolean previewFeatures, final String targetBytecode) {
Integer bytecodeVersion =
CompilerConfiguration.JDK_TO_BYTECODE_VERSION_MAP.get(targetBytecode);
+ if (bytecodeVersion == null) {
+ throw new GroovyBugError("Bytecode version [" + targetBytecode +
"] is not supported by the compiler");
+ }
- if (invokedynamic && bytecodeVersion < Opcodes.V1_8) {
- return Opcodes.V1_8;
+ if (invokedynamic && bytecodeVersion <= Opcodes.V1_7) {
+ return Opcodes.V1_7; // invokedynamic added here
+ } else if (previewFeatures) {
+ return bytecodeVersion | Opcodes.V_PREVIEW;
} else {
- if (null != bytecodeVersion) {
- return previewFeatures ? bytecodeVersion | Opcodes.V_PREVIEW :
bytecodeVersion;
- }
+ return bytecodeVersion;
}
-
- throw new GroovyBugError("Bytecode version ["+targetBytecode+"] is not
supported by the compiler");
}
public AsmClassGenerator getAcg() {
@@ -260,7 +258,7 @@ public class WriterController {
this.constructorNode = null;
}
- public ConstructorNode getConstructorNode(){
+ public ConstructorNode getConstructorNode() {
return constructorNode;
}