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/10/05 15:31:19 UTC
[groovy] branch danielsun/GROOVY-10281 updated (bc07d8e -> 3bc65f4)
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a change to branch danielsun/GROOVY-10281
in repository https://gitbox.apache.org/repos/asf/groovy.git.
discard bc07d8e Try to address "java.security.AccessControlException: suppressAccessChecks"
new 3bc65f4 Try to address "java.security.AccessControlException: suppressAccessChecks"
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (bc07d8e)
\
N -- N -- N refs/heads/danielsun/GROOVY-10281 (3bc65f4)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[groovy] 01/01: Try to address
"java.security.AccessControlException: suppressAccessChecks"
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch danielsun/GROOVY-10281
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 3bc65f41d9818e6f7e9c85b191ff1959defa2a57
Author: Daniel Sun <su...@apache.org>
AuthorDate: Tue Oct 5 22:19:27 2021 +0800
Try to address "java.security.AccessControlException: suppressAccessChecks"
---
.../groovy/control/CompilerConfiguration.java | 78 +++-------------------
src/test/groovy/bugs/Groovy10281.groovy | 62 -----------------
2 files changed, 8 insertions(+), 132 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index ae5b2c7..760b9d6 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -40,7 +40,6 @@ import java.util.Set;
import java.util.StringTokenizer;
import static org.apache.groovy.util.SystemUtil.getBooleanSafe;
-import static org.apache.groovy.util.SystemUtil.getIntegerSafe;
import static org.apache.groovy.util.SystemUtil.getSystemPropertySafe;
import static org.codehaus.groovy.runtime.StringGroovyMethods.isAtLeast;
@@ -402,16 +401,6 @@ public class CompilerConfiguration {
private boolean sealedAnnotations;
/**
- * Whether logging class generation is enabled
- */
- private boolean logClassgen;
-
- /**
- * sets logging class generation stack trace max depth
- */
- private int logClassgenStackTraceMaxDepth;
-
- /**
* options for joint compilation (null by default == no joint compilation)
*/
private Map<String, Object> jointCompilationOptions;
@@ -432,7 +421,6 @@ public class CompilerConfiguration {
private BytecodeProcessor bytecodePostprocessor;
-
/**
* Sets the compiler flags/settings to default values.
*
@@ -474,8 +462,6 @@ public class CompilerConfiguration {
recordsNative = !getBooleanSafe("groovy.records.native.disable");
sealedNative = !getBooleanSafe("groovy.sealed.native.disable");
sealedAnnotations = !getBooleanSafe("groovy.sealed.annotations.disable");
- logClassgen = getBooleanSafe("groovy.log.classgen");
- logClassgenStackTraceMaxDepth = getIntegerSafe("groovy.log.classgen.stacktrace.max.depth", 0);
sourceEncoding = getSystemPropertySafe("groovy.source.encoding",
getSystemPropertySafe("file.encoding", DEFAULT_SOURCE_ENCODING));
setTargetDirectorySafe(getSystemPropertySafe("groovy.target.directory"));
@@ -524,8 +510,6 @@ public class CompilerConfiguration {
setPreviewFeatures(configuration.isPreviewFeatures());
setSealedNative(configuration.isSealedNative());
setSealedAnnotations(configuration.isSealedAnnotations());
- setLogClassgen(configuration.isLogClassgen());
- setLogClassgenStackTraceMaxDepth(configuration.getLogClassgenStackTraceMaxDepth());
setDefaultScriptExtension(configuration.getDefaultScriptExtension());
setSourceEncoding(configuration.getSourceEncoding());
Map<String, Object> jointCompilationOptions = configuration.getJointCompilationOptions();
@@ -693,19 +677,6 @@ public class CompilerConfiguration {
text = configuration.getProperty("groovy.sealed.annotations.disable");
if (text != null) setSealedAnnotations(!text.equalsIgnoreCase("false"));
- text = configuration.getProperty("groovy.log.classgen");
- if (text != null) setLogClassgen(text.equalsIgnoreCase("true"));
-
- text = configuration.getProperty("groovy.log.classgen.stacktrace.max.depth");
- if (text != null) {
- int logClassgenStackTraceMaxDepth = 0;
- try {
- logClassgenStackTraceMaxDepth = Integer.parseInt(text);
- } catch (Exception ignored) {
- }
- setLogClassgenStackTraceMaxDepth(Math.max(logClassgenStackTraceMaxDepth, 0));
- }
-
text = configuration.getProperty("groovy.classpath");
if (text != null) setClasspath(text);
@@ -753,7 +724,6 @@ public class CompilerConfiguration {
}
}
-
/**
* Gets the currently configured warning level. See {@link WarningMessage}
* for level details.
@@ -1089,46 +1059,6 @@ public class CompilerConfiguration {
}
/**
- * Returns whether logging class generation is enabled
- *
- * @return whether logging class generation is enabled
- * @since 4.0.0
- */
- public boolean isLogClassgen() {
- return logClassgen;
- }
-
- /**
- * Sets whether logging class generation is enabled
- *
- * @param logClassgen whether to enable logging class generation
- * @since 4.0.0
- */
- public void setLogClassgen(boolean logClassgen) {
- this.logClassgen = logClassgen;
- }
-
- /**
- * Returns stack trace max depth of logging class generation
- *
- * @return stack trace max depth of logging class generation
- * @since 4.0.0
- */
- public int getLogClassgenStackTraceMaxDepth() {
- return logClassgenStackTraceMaxDepth;
- }
-
- /**
- * Sets stack trace max depth of logging class generation
- *
- * @param logClassgenStackTraceMaxDepth stack trace max depth of logging class generation
- * @since 4.0.0
- */
- public void setLogClassgenStackTraceMaxDepth(int logClassgenStackTraceMaxDepth) {
- this.logClassgenStackTraceMaxDepth = logClassgenStackTraceMaxDepth;
- }
-
- /**
* Gets the joint compilation options for this configuration.
* @return the options
*/
@@ -1243,4 +1173,12 @@ public class CompilerConfiguration {
Boolean runtimeGroovydocEnabled = getOptimizationOptions().get(RUNTIME_GROOVYDOC);
return Optional.ofNullable(runtimeGroovydocEnabled).orElse(Boolean.FALSE).booleanValue();
}
+
+ public boolean isLogClassgen() {
+ return false;
+ }
+
+ public int getLogClassgenStackTraceMaxDepth() {
+ return 0;
+ }
}
diff --git a/src/test/groovy/bugs/Groovy10281.groovy b/src/test/groovy/bugs/Groovy10281.groovy
deleted file mode 100644
index 4468433..0000000
--- a/src/test/groovy/bugs/Groovy10281.groovy
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package bugs
-
-import groovy.transform.CompileStatic
-import org.codehaus.groovy.control.CompilationUnit
-import org.codehaus.groovy.control.CompilerConfiguration
-import org.codehaus.groovy.control.Phases
-import org.junit.Test
-
-@CompileStatic
-final class Groovy10281 {
- @Test
- void testLoggingClassGenWithStacktrace() {
- def result = logClassGen(true)
- assert result.contains('// org.codehaus.groovy.classgen.AsmClassGenerator#visitClass:')
- assert result.contains('public class helloWorld extends groovy/lang/Script {')
- assert result.contains('LDC "Hello, world!"')
- }
-
- @Test
- void testLoggingClassGenWithoutStacktrace() {
- def result = logClassGen(false)
- assert !result.contains('// org.codehaus.groovy.classgen.AsmClassGenerator#visitClass:')
- assert result.contains('public class helloWorld extends groovy/lang/Script {')
- assert result.contains('LDC "Hello, world!"')
- }
-
- private static String logClassGen(boolean stacktrace) {
- def code = """
- println 'Hello, world!'
- """
- def result = new StringWriter()
- PrintWriter pw = new PrintWriter(result)
- def config = stacktrace ? new CompilerConfiguration(logClassgen: true, logClassgenStackTraceMaxDepth: 50, output: pw)
- : new CompilerConfiguration(logClassgen: true, output: pw)
-
- new CompilationUnit(config).with {
- addSource 'helloWorld.groovy', code
- compile Phases.CLASS_GENERATION
- }
-
- pw.close()
- return result.toString()
- }
-}