You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/11/07 14:54:20 UTC
[groovy] branch master updated: Eliminate redundant checks for Java7
This is an automated email from the ASF dual-hosted git repository.
sunlan 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 de17150 Eliminate redundant checks for Java7
de17150 is described below
commit de17150ee844a943c070c01c07b81fd547ff074d
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Nov 7 22:53:25 2021 +0800
Eliminate redundant checks for Java7
---
src/main/java/org/codehaus/groovy/control/CompilationUnit.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
index c713f01..e79db18 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
@@ -87,6 +87,7 @@ import static org.codehaus.groovy.transform.stc.StaticTypesMarker.SWITCH_CONDITI
* This is commonly used when you want to wire a new AST Transformation into the compilation.
*/
public class CompilationUnit extends ProcessingUnit {
+ private static final int COMPUTE_MAX_STACK_AND_FRAMES = ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES;
/** The overall AST for this CompilationUnit. */
protected CompileUnit ast; // TODO: Switch to private and access through getAST().
@@ -790,12 +791,7 @@ public class CompilationUnit extends ProcessingUnit {
};
protected ClassVisitor createClassVisitor() {
- CompilerConfiguration config = getConfiguration();
- int computeMaxStackAndFrames = ClassWriter.COMPUTE_MAXS;
- if (CompilerConfiguration.isPostJDK7(config.getTargetBytecode()) || config.isIndyEnabled()) {
- computeMaxStackAndFrames += ClassWriter.COMPUTE_FRAMES;
- }
- return new ClassWriter(computeMaxStackAndFrames) {
+ return new ClassWriter(COMPUTE_MAX_STACK_AND_FRAMES) {
private ClassNode getClassNode(String name) {
// try classes under compilation
CompileUnit cu = getAST();