Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 1802e3198 -> 30dac3faa


Add threadsafe as a reserved keyword

(cherry picked from commit 7ebeba0)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 30dac3faa018b3188b8fef28eb26def4051ab553
Parents: 1802e31
Author: sunlan <sun...@apache.org>
Authored: Sat Aug 5 22:31:54 2017 +0800
Committer: sunlan <sun...@apache.org>
Committed: Sat Aug 5 22:32:56 2017 +0800

----------------------------------------------------------------------
 src/main/antlr/GroovyLexer.g4                   |  2 ++
 .../groovy/parser/antlr4/SyntaxErrorTest.groovy |  5 +++++
 .../test/resources/fail/ThreadSafe_01x.groovy   | 20 ++++++++++++++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/30dac3fa/src/main/antlr/GroovyLexer.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyLexer.g4 b/src/main/antlr/GroovyLexer.g4
index f9e9063..e493e9f 100644
--- a/src/main/antlr/GroovyLexer.g4
+++ b/src/main/antlr/GroovyLexer.g4
@@ -410,6 +410,8 @@ INTERFACE     : 'interface';
 fragment
 LONG          : 'long';
 
+THREADSAFE    : 'threadsafe'; // reserved keyword
+
 NATIVE        : 'native';
 NEW           : 'new';
 PACKAGE       : 'package';

http://git-wip-us.apache.org/repos/asf/groovy/blob/30dac3fa/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
----------------------------------------------------------------------
diff --git 
a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
 
b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
index 86bec8d..0905717 100644
--- 
a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
+++ 
b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy
@@ -189,6 +189,11 @@ class SyntaxErrorTest extends GroovyTestCase {
         
TestUtils.doRunAndShouldFail('fail/DuplicatedNamedParameter_02x.groovy');
     }
 
+    void "test groovy core - threadsafe"() {
+        TestUtils.doRunAndShouldFail('fail/ThreadSafe_01x.groovy');
+    }
+
+
     /**************************************/
     static unzipScriptAndShouldFail(String entryName, List ignoreClazzList, 
Map<String, String> replacementsMap=[:], boolean toCheckNewParserOnly = false) {
         ignoreClazzList.addAll(TestUtils.COMMON_IGNORE_CLASS_LIST)

http://git-wip-us.apache.org/repos/asf/groovy/blob/30dac3fa/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
----------------------------------------------------------------------
diff --git 
a/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy 
b/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
new file mode 100644
index 0000000..1285964
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/fail/ThreadSafe_01x.groovy
@@ -0,0 +1,20 @@
+/*
+ *  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.
+ */
+
+threadsafe foo() {}

Reply via email to