You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/03/14 12:54:51 UTC

[1/3] groovy git commit: GROOVY-6792: ClassFormatError if a method has dots within its name (enable only with system property for now)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X c24167c09 -> 35730b7f7


GROOVY-6792: ClassFormatError if a method has dots within its name (enable only with system property for now)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9a7a9e4a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9a7a9e4a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9a7a9e4a

Branch: refs/heads/GROOVY_2_4_X
Commit: 9a7a9e4a1f3d27742b485ad36179d19d5a8b6a3c
Parents: c24167c
Author: paulk <pa...@asert.com.au>
Authored: Tue Mar 14 20:54:41 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Tue Mar 14 21:08:46 2017 +1000

----------------------------------------------------------------------
 .../codehaus/groovy/classgen/ClassCompletionVerifier.java    | 3 +++
 src/test/groovy/bugs/Groovy6792Bug.groovy                    | 8 ++++++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/9a7a9e4a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
index 92f55ef..b666e29 100644
--- a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
+++ b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
@@ -55,6 +55,8 @@ import static org.objectweb.asm.Opcodes.*;
  */
 public class ClassCompletionVerifier extends ClassCodeVisitorSupport {
     private static final String[] INVALID_NAME_CHARS = {".", ":", "/", ";", "[", "<", ">"};
+    // the groovy.compiler.strictNames system property is experimental and may change default value or be removed in a future version of Groovy
+    private final boolean strictNames = Boolean.parseBoolean(System.getProperty("groovy.compiler.strictNames", "false"));
     private ClassNode currentClass;
     private SourceUnit source;
     private boolean inConstructor = false;
@@ -291,6 +293,7 @@ public class ClassCompletionVerifier extends ClassCodeVisitorSupport {
     }
 
     private void checkMethodsForIncorrectName(ClassNode cn) {
+        if (!strictNames) return;
         List<MethodNode> methods = cn.getAllDeclaredMethods();
         for (MethodNode mNode : methods) {
             String name = mNode.getName();

http://git-wip-us.apache.org/repos/asf/groovy/blob/9a7a9e4a/src/test/groovy/bugs/Groovy6792Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy6792Bug.groovy b/src/test/groovy/bugs/Groovy6792Bug.groovy
index 9223174..53bfd4e 100644
--- a/src/test/groovy/bugs/Groovy6792Bug.groovy
+++ b/src/test/groovy/bugs/Groovy6792Bug.groovy
@@ -31,6 +31,8 @@ class Groovy6792Bug extends CompilableTestSupport {
     }
 
     void testMethodWithInvalidName() {
+        // currently groovy.compiler.strictNames is experimental
+        System.setProperty('groovy.compiler.strictNames', 'true')
         def message = shouldNotCompile """
             class Foo {
                 def "bar.baz"(){}
@@ -38,4 +40,10 @@ class Groovy6792Bug extends CompilableTestSupport {
         """
         assert message.contains("You are not allowed to have '.' in a method name")
     }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown()
+        System.setProperty('groovy.compiler.strictNames', 'false')
+    }
 }


[2/3] groovy git commit: GROOVY-8119: Groovy Language Specification documentation has bad internal links to "type checking section"

Posted by pa...@apache.org.
GROOVY-8119: Groovy Language Specification documentation has bad internal links to "type checking section"


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6aedd579
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6aedd579
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6aedd579

Branch: refs/heads/GROOVY_2_4_X
Commit: 6aedd5798b27bc8020b0d77abfd5c92e17388cc5
Parents: 9a7a9e4
Author: paulk <pa...@asert.com.au>
Authored: Tue Mar 14 21:05:52 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Tue Mar 14 21:09:07 2017 +1000

----------------------------------------------------------------------
 src/spec/doc/core-semantics.adoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6aedd579/src/spec/doc/core-semantics.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/core-semantics.adoc b/src/spec/doc/core-semantics.adoc
index 1baf68f..c2dd9a4 100644
--- a/src/spec/doc/core-semantics.adoc
+++ b/src/spec/doc/core-semantics.adoc
@@ -863,7 +863,7 @@ include::{projectdir}/src/spec/test/typing/OptionalTypingTest.groovy[tags=option
 <2> we can still call the `toUpperCase` method, because the type of `aString` is resolved at runtime
 
 So it doesn't matter that you use an explicit type here. It is in particular interesting when you combine this feature
-with <<typechecking,static type checking>>, because the type checker performs type inference.
+with <<static-type-checking,static type checking>>, because the type checker performs type inference.
 
 Likewise, Groovy doesn't make it mandatory to declare the types of a parameter in a method:
 
@@ -1980,7 +1980,7 @@ discussed in a link:core-domain-specific-languages.html#section-delegatesto[spec
 
 ==== Dynamic vs static
 
-In the <<typechecking,type checking section>>, we have seen that Groovy provides optional type checking thanks to the
+In the <<static-type-checking,type checking section>>, we have seen that Groovy provides optional type checking thanks to the
 `@TypeChecked` annotation. The type checker runs at compile time and performs a static analysis of dynamic code. The
 program will behave exactly the same whether type checking has been enabled or not. This means that the `@TypeChecked`
 annotation is neutral with regards to the semantics of a program. Even though it may be necessary to add type information


[3/3] groovy git commit: GROOVY-6792: ClassFormatError if a method has dots within its name (fix impact for tests)

Posted by pa...@apache.org.
GROOVY-6792: ClassFormatError if a method has dots within its name (fix impact for tests)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/35730b7f
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/35730b7f
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/35730b7f

Branch: refs/heads/GROOVY_2_4_X
Commit: 35730b7f7d885899fb3c568118547c1cf633121e
Parents: 6aedd57
Author: paulk <pa...@asert.com.au>
Authored: Tue Mar 14 22:32:24 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Tue Mar 14 22:54:30 2017 +1000

----------------------------------------------------------------------
 security/groovy.policy | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/35730b7f/security/groovy.policy
----------------------------------------------------------------------
diff --git a/security/groovy.policy b/security/groovy.policy
index 9dc92a7..848de08 100644
--- a/security/groovy.policy
+++ b/security/groovy.policy
@@ -192,6 +192,7 @@ grant signedBy "Groovy" {
 
 grant codeBase "file:${user.dir}/src/test/groovy/bugs/BadScriptNameBug.groovy" {
     permission java.lang.RuntimePermission "createClassLoader";
+    permission java.util.PropertyPermission "groovy.compiler.strictNames", "read";
 };
 
 grant codeBase "file:${user.dir}/src/test/groovy/ClosureMethodTest.groovy" {
@@ -213,6 +214,7 @@ grant codeBase "file:${user.dir}/src/test/groovy/bugs/ConstructorBug.groovy" {
 
     // Required because GroovyCodeSource calls to File#getCanonicalPath (at least on the Windows FileSystem)
     permission java.util.PropertyPermission "user.dir", "read";
+    permission java.util.PropertyPermission "groovy.compiler.strictNames", "read";
 
     permission java.io.FilePermission "src${/}test${/}groovy${/}bugs${/}TestBase.groovy", "read";
     permission java.io.FilePermission "src${/}test${/}groovy${/}bugs${/}TestDerived.groovy", "read";