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 2020/03/21 12:47:06 UTC
[groovy] branch GROOVY_3_0_X updated (5e4283b -> b10fe52)
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.
from 5e4283b split groovyc Ant task doco into separate file
new b037bfb Eliminate duplication in JavaLetter[OrDigit]InGString
new 70fc502 minor edits
new 6e86a75 fix method names
new 25a4ff9 Add JDK 14 build to travis CI
new 9fc8df6 GroovyLexer: parse error for control and format characters(closes #1198)
new 500373c Fix some potential issue caused by invalid method name
new b10fe52 Ignore the tests only existing in the groovy-parser project
The 7 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:
.travis.yml | 4 +
gradle.properties | 2 +-
gradle/wrapper/gradle-wrapper.jar | Bin 58695 -> 58702 bytes
gradle/wrapper/gradle-wrapper.properties | 2 +-
gradlew.bat | 3 -
src/antlr/GroovyLexer.g4 | 42 +-
src/test/gls/annotations/AnnotationTest.groovy | 10 +-
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 437 ++++++++++++---------
.../antlr4/util/ASTComparatorCategory.groovy | 92 ++---
9 files changed, 319 insertions(+), 273 deletions(-)
[groovy] 07/07: Ignore the tests only existing in the groovy-parser
project
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit b10fe528a51fd64e1e08d351d3cc0675d8d40e33
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Mar 21 20:10:41 2020 +0800
Ignore the tests only existing in the groovy-parser project
(cherry picked from commit 75d9a9ab9112b850c116672e6acd00ff19ba5651)
---
.../groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy | 5 +++++
1 file changed, 5 insertions(+)
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 9fbb5f3..0b789db 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
@@ -418,22 +418,27 @@ final class SyntaxErrorTest extends GroovyTestCase {
|'''.stripMargin()
}
+ @NotYetImplemented
void 'test CompilerErrorTest_001'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_001.groovy', [])
}
+ @NotYetImplemented
void 'test CompilerErrorTest_002'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_002.groovy', [])
}
+ @NotYetImplemented
void 'test DifferencesFromJavaTest_002'() {
unzipScriptAndShouldFail('scripts/DifferencesFromJavaTest_002.groovy', [])
}
+ @NotYetImplemented
void 'test Groovy5212Bug_001'() {
unzipScriptAndShouldFail('scripts/Groovy5212Bug_001.groovy', [])
}
+ @NotYetImplemented
void 'test GStringEndTest_001'() {
unzipScriptAndShouldFail('scripts/GStringEndTest_001.groovy', [])
}
[groovy] 02/07: minor edits
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 70fc5024ae35a7a078bf8e47fb40d9f08b8ec15f
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Mar 20 10:22:49 2020 -0500
minor edits
(cherry picked from commit 89a2dab34dd47167060254368b3d2a1443f66ea5)
---
src/antlr/GroovyLexer.g4 | 6 +-
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 399 +++++++++++----------
.../antlr4/util/ASTComparatorCategory.groovy | 92 ++---
3 files changed, 252 insertions(+), 245 deletions(-)
diff --git a/src/antlr/GroovyLexer.g4 b/src/antlr/GroovyLexer.g4
index dc3d37f..a6c7e72 100644
--- a/src/antlr/GroovyLexer.g4
+++ b/src/antlr/GroovyLexer.g4
@@ -894,7 +894,7 @@ JavaLetter
{ Character.isJavaIdentifierStart(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
- { Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))) }?
+ { Character.isJavaIdentifierStart(Character.toCodePoint((char) _input.LA(-2), (char) _input.LA(-1))) }?
;
fragment
@@ -910,7 +910,7 @@ JavaLetterOrDigit
{ Character.isJavaIdentifierPart(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
- { Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))) }?
+ { Character.isJavaIdentifierPart(Character.toCodePoint((char) _input.LA(-2), (char) _input.LA(-1))) }?
;
fragment
@@ -935,7 +935,7 @@ WS : ([ \t\u000C]+ | LineEscape+) -> skip
NL : LineTerminator { this.ignoreTokenInsideParens(); }
;
-// Multiple-line comments(including groovydoc comments)
+// Multiple-line comments (including groovydoc comments)
ML_COMMENT
: '/*' .*? '*/' { this.ignoreMultiLineCommentConditionally(); } -> type(NL)
;
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 ce37a69..6d15e98 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
@@ -20,97 +20,80 @@ package org.apache.groovy.parser.antlr4
import groovy.test.GroovyTestCase
import groovy.test.NotYetImplemented
-import org.apache.groovy.parser.antlr4.util.ASTComparatorCategory
+import groovy.transform.AutoFinal
import org.codehaus.groovy.control.CompilationUnit
import org.codehaus.groovy.control.Phases
+import static org.apache.groovy.parser.antlr4.util.ASTComparatorCategory.LOCATION_IGNORE_LIST
+
/**
* Some syntax error test cases for the new parser.
*/
+@AutoFinal
final class SyntaxErrorTest extends GroovyTestCase {
- void "test groovy core - List"() {
+ void 'test groovy core - List'() {
TestUtils.shouldFail('fail/List_01.groovy')
}
-
- void "test groovy core - Expression"() {
+
+ void 'test groovy core - Expression'() {
TestUtils.shouldFail('fail/Expression_01.groovy')
TestUtils.shouldFail('fail/Expression_02.groovy')
TestUtils.shouldFail('fail/Expression_03.groovy')
-// TestUtils.shouldFail('fail/Expression_04.groovy')
-// TestUtils.shouldFail('fail/Expression_05.groovy')
+ //TestUtils.shouldFail('fail/Expression_04.groovy')
+ //TestUtils.shouldFail('fail/Expression_05.groovy')
TestUtils.shouldFail('fail/Expression_06.groovy')
TestUtils.shouldFail('fail/Expression_07.groovy')
TestUtils.shouldFail('fail/Expression_08.groovy')
TestUtils.shouldFail('fail/Expression_09.groovy')
}
- void "test groovy core - CommandExpression"() {
+ void 'test groovy core - CommandExpression'() {
TestUtils.doRunAndShouldFail('fail/CommandExpression_01x.groovy')
}
- void "test groovy core - Switch"() {
+ void 'test groovy core - Switch'() {
TestUtils.shouldFail('fail/Switch_01.groovy')
}
@NotYetImplemented
- void "test groovy core - LocalVariableDeclaration"() {
+ void 'test groovy core - LocalVariableDeclaration'() {
TestUtils.shouldFail('fail/LocalVariableDeclaration_01.groovy')
}
- void "test groovy core - Continue"() {
+ void 'test groovy core - Continue'() {
TestUtils.doRunAndShouldFail('fail/Continue_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Continue_02x.groovy')
}
- void "test groovy core - Break"() {
+ void 'test groovy core - Break'() {
TestUtils.doRunAndShouldFail('fail/Break_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Break_02x.groovy')
}
- void "test groovy core - UnexpectedCharacter"() {
+ void 'test groovy core - UnexpectedCharacter 1'() {
TestUtils.doRunAndShouldFail('fail/UnexpectedCharacter_01x.groovy')
}
- /*void "test CompilerErrorTest_001.groovy"() {
- unzipScriptAndShouldFail("scripts/CompilerErrorTest_001.groovy", [])
- }
-
- void "test CompilerErrorTest_002.groovy"() {
- unzipScriptAndShouldFail("scripts/CompilerErrorTest_002.groovy", [])
- }
-
- void "test DifferencesFromJavaTest_002.groovy"() {
- unzipScriptAndShouldFail("scripts/DifferencesFromJavaTest_002.groovy", [])
- }
-
- void "test Groovy5212Bug_001.groovy"() {
- unzipScriptAndShouldFail("scripts/Groovy5212Bug_001.groovy", [])
- }
-
- void "test GStringEndTest_001.groovy"() {
- unzipScriptAndShouldFail("scripts/GStringEndTest_001.groovy", [])
- }*/
-
- void "test groovy core - ParExpression"() {
+ void 'test groovy core - ParExpression'() {
TestUtils.doRunAndShouldFail('fail/ParExpression_01x.groovy')
TestUtils.doRunAndShouldFail('fail/ParExpression_02x.groovy')
TestUtils.doRunAndShouldFail('fail/ParExpression_03x.groovy')
}
- void "test groovy core - Parentheses"() {
+ void 'test groovy core - Parentheses'() {
TestUtils.shouldFail('fail/Parentheses_01.groovy')
}
- void "test groovy core - This"() {
+ void 'test groovy core - This'() {
TestUtils.doRunAndShouldFail('fail/This_01x.groovy')
}
- void "test groovy core - Super"() {
+ void 'test groovy core - Super'() {
TestUtils.doRunAndShouldFail('fail/Super_01x.groovy')
}
- void "test groovy core - AbstractMethod"() {
+ void 'test groovy core - AbstractMethod'() {
TestUtils.doRunAndShouldFail('fail/AbstractMethod_01x.groovy')
TestUtils.doRunAndShouldFail('fail/AbstractMethod_02x.groovy')
TestUtils.doRunAndShouldFail('fail/AbstractMethod_03x.groovy')
@@ -119,22 +102,22 @@ final class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/AbstractMethod_06x.groovy')
}
- void "test groovy core - BUGs"() {
+ void 'test groovy core - BUGs'() {
TestUtils.doRunAndShouldFail('bugs/BUG-GROOVY-5318.groovy')
TestUtils.doRunAndShouldFail('bugs/BUG-GROOVY-8150.groovy')
TestUtils.doRunAndShouldFail('bugs/BUG-GROOVY-8216.groovy')
}
- void "test groovy core - DoWhile"() {
+ void 'test groovy core - DoWhile'() {
TestUtils.doRunAndShouldFail('fail/DoWhile_01x.groovy')
}
- void "test groovy core - For"() {
+ void 'test groovy core - For'() {
TestUtils.shouldFail('fail/For_01.groovy')
TestUtils.shouldFail('fail/For_02.groovy')
}
- void "test groovy core - Modifier"() {
+ void 'test groovy core - Modifier'() {
TestUtils.doRunAndShouldFail('fail/Modifier_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Modifier_02x.groovy')
TestUtils.doRunAndShouldFail('fail/Modifier_03x.groovy')
@@ -143,15 +126,105 @@ final class SyntaxErrorTest extends GroovyTestCase {
TestUtils.shouldFail('fail/Modifier_07.groovy')
}
- void "test groovy core - ClassDeclaration"() {
+ void 'test groovy core - ClassDeclaration 1'() {
TestUtils.doRunAndShouldFail('fail/ClassDeclaration_02x.groovy')
}
- void "test groovy core - AnnotationDeclaration"() {
+ void 'test groovy core - ClassDeclaration 2'() {
+ def err = expectParseError '''\
+ |class C extends Object, Number {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: Cannot extend multiple classes @ line 1, column 9.
+ | class C extends Object, Number {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - EnumDeclaration 1'() {
+ def err = expectParseError '''\
+ |enum E<T> {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: enum declaration cannot have type parameters @ line 1, column 7.
+ | enum E<T> {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - EnumDeclaration 2'() {
+ def err = expectParseError '''\
+ |enum E extends Object {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: No extends clause allowed for enum declaration @ line 1, column 8.
+ | enum E extends Object {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - AnnotationDeclaration 1'() {
TestUtils.doRunAndShouldFail('fail/AnnotationDeclaration_01x.groovy');
}
- void "test groovy core - MethodDeclaration"() {
+ void 'test groovy core - AnnotationDeclaration 2'() {
+ def err = expectParseError '''\
+ |@interface A<T> {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: annotation declaration cannot have type parameters @ line 1, column 13.
+ | @interface A<T> {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - AnnotationDeclaration 3'() {
+ def err = expectParseError '''\
+ |@interface A extends Object {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: No extends clause allowed for annotation declaration @ line 1, column 14.
+ | @interface A extends Object {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - AnnotationDeclaration 4'() {
+ def err = expectParseError '''\
+ |@interface A implements Serializable {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: No implements clause allowed for annotation declaration @ line 1, column 14.
+ | @interface A implements Serializable {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - MethodDeclaration'() {
TestUtils.shouldFail('fail/MethodDeclaration_01.groovy')
TestUtils.doRunAndShouldFail('fail/MethodDeclaration_02x.groovy')
TestUtils.doRunAndShouldFail('fail/MethodDeclaration_03x.groovy')
@@ -159,51 +232,66 @@ final class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/MethodDeclaration_05x.groovy')
}
- void "test groovy core - ConstructorDeclaration"() {
+ void 'test groovy core - ConstructorDeclaration'() {
TestUtils.shouldFail('fail/ConstructorDeclaration_01.groovy')
}
- void "test groovy core - ClosureListExpression"() {
+ void 'test groovy core - ClosureListExpression'() {
TestUtils.shouldFail('fail/ClosureListExpression_01.groovy')
TestUtils.shouldFail('fail/ClosureListExpression_02.groovy')
TestUtils.shouldFail('fail/ClosureListExpression_03.groovy')
TestUtils.shouldFail('fail/ClosureListExpression_04.groovy')
}
- void "test groovy core - InterfaceDeclaration"() {
+ void 'test groovy core - InterfaceDeclaration 1'() {
TestUtils.shouldFail('fail/InterfaceDeclaration_01.groovy')
}
- void "test groovy core - void"() {
+ void 'test groovy core - InterfaceDeclaration 2'() {
+ def err = expectParseError '''\
+ |interface I implements Serializable {}
+ |'''.stripMargin()
+
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: No implements clause allowed for interface declaration @ line 1, column 13.
+ | interface I implements Serializable {}
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test groovy core - void'() {
TestUtils.doRunAndShouldFail('fail/Void_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Void_02x.groovy')
}
- void "test groovy core - FieldDeclaration"() {
+ void 'test groovy core - FieldDeclaration'() {
TestUtils.doRunAndShouldFail('fail/FieldDeclaration_01x.groovy')
TestUtils.doRunAndShouldFail('fail/FieldDeclaration_02x.groovy')
TestUtils.doRunAndShouldFail('fail/FieldDeclaration_03x.groovy')
TestUtils.doRunAndShouldFail('fail/FieldDeclaration_04x.groovy')
}
- void "test groovy core - Assert"() {
+ void 'test groovy core - Assert'() {
TestUtils.doRunAndShouldFail('fail/Assert_01x.groovy')
}
- void "test groovy core - DuplicatedNamedParameter"() {
+ void 'test groovy core - DuplicatedNamedParameter'() {
TestUtils.doRunAndShouldFail('fail/DuplicatedNamedParameter_01x.groovy')
TestUtils.doRunAndShouldFail('fail/DuplicatedNamedParameter_02x.groovy')
}
- void "test groovy core - threadsafe"() {
+ void 'test groovy core - threadsafe'() {
TestUtils.doRunAndShouldFail('fail/ThreadSafe_01x.groovy')
}
- void "test groovy core - VarArgParameter"() {
+ void 'test groovy core - VarArgParameter'() {
TestUtils.doRunAndShouldFail('fail/VarArgParameter_01x.groovy')
}
- void "test groovy core - Number"() {
+ void 'test groovy core - Number'() {
TestUtils.doRunAndShouldFail('fail/Number_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Number_02x.groovy')
TestUtils.doRunAndShouldFail('fail/Number_03x.groovy')
@@ -211,204 +299,123 @@ final class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/Number_05x.groovy')
}
- void "test groovy core - MethodCall"() {
+ void 'test groovy core - MethodCall'() {
TestUtils.doRunAndShouldFail('fail/MethodCall_01x.groovy')
}
- void "test groovy core - var"() {
+ void 'test groovy core - var'() {
TestUtils.doRunAndShouldFail('fail/Var_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Var_02x.groovy')
}
- void "test groovy core - String"() {
+ void 'test groovy core - String'() {
TestUtils.doRunAndShouldFail('fail/String_01x.groovy')
TestUtils.doRunAndShouldFail('fail/String_02x.groovy')
TestUtils.shouldFail('fail/String_03.groovy')
TestUtils.shouldFail('fail/String_04.groovy')
}
- void "test groovy core - NonStaticClass"() {
+ void 'test groovy core - NonStaticClass'() {
TestUtils.doRunAndShouldFail('fail/NonStaticClass_01x.groovy')
}
- void "test groovy core - Import"() {
+ void 'test groovy core - Import'() {
TestUtils.doRunAndShouldFail('fail/Import_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Import_02x.groovy')
}
- void "test groovy core - UnaryOperator"() {
+ void 'test groovy core - UnaryOperator'() {
TestUtils.doRunAndShouldFail('fail/UnaryOperator_01x.groovy')
TestUtils.doRunAndShouldFail('fail/UnaryOperator_02x.groovy')
}
- void "test groovy core - Trait"() {
+ void 'test groovy core - Trait'() {
TestUtils.shouldFail('fail/Trait_01.groovy')
}
- void "test groovy core - Array"() {
+ void 'test groovy core - Array'() {
TestUtils.doRunAndShouldFail('fail/Array_01x.groovy')
TestUtils.doRunAndShouldFail('fail/Array_02x.groovy')
}
-
- void "test error alternative - Missing ')' 1"() {
- def err = expectFail '''\
-println ((int 123)
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: Missing ')' @ line 1, column 14.
- println ((int 123)
- ^
-
-1 error
-'''
- }
-
- void "test error alternative - Missing ')' 2"() {
- def err = expectFail '''\
-def x() {
- println((int) 123
-}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 2: Missing ')' @ line 2, column 22.
- println((int) 123
- ^
-
-1 error
-'''
- }
-
-
- void "test groovy core - AnnotationDeclaration 1"() {
- def err = expectFail '''\
-@interface A<T> {}
- '''
+ void 'test error alternative - Missing ")" 1'() {
+ def err = expectParseError '''\
+ |println ((int 123)
+ |'''.stripMargin()
assert err == '''\
-startup failed:
-test.groovy: 1: annotation declaration cannot have type parameters @ line 1, column 13.
- @interface A<T> {}
- ^
-
-1 error
-'''
- }
-
- void "test groovy core - AnnotationDeclaration 2"() {
- def err = expectFail '''\
-@interface A extends Object {}
- '''
+ |startup failed:
+ |test.groovy: 1: Missing ')' @ line 1, column 14.
+ | println ((int 123)
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
+ void 'test error alternative - Missing ")" 2'() {
+ def err = expectParseError '''\
+ |def x() {
+ | println((int) 123
+ |}
+ |'''.stripMargin()
assert err == '''\
-startup failed:
-test.groovy: 1: No extends clause allowed for annotation declaration @ line 1, column 14.
- @interface A extends Object {}
- ^
-
-1 error
-'''
+ |startup failed:
+ |test.groovy: 2: Missing ')' @ line 2, column 22.
+ | println((int) 123
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
}
- void "test groovy core - AnnotationDeclaration 3"() {
- def err = expectFail '''\
-@interface A implements Serializable {}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: No implements clause allowed for annotation declaration @ line 1, column 14.
- @interface A implements Serializable {}
- ^
-
-1 error
-'''
+ @NotYetImplemented
+ void 'test CompilerErrorTest_001.groovy'() {
+ unzipScriptAndShouldFail('scripts/CompilerErrorTest_001.groovy', [])
}
- void "test groovy core - EnumDeclaration 1"() {
- def err = expectFail '''\
-enum E<T> {}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: enum declaration cannot have type parameters @ line 1, column 7.
- enum E<T> {}
- ^
-
-1 error
-'''
+ @NotYetImplemented
+ void 'test CompilerErrorTest_002.groovy'() {
+ unzipScriptAndShouldFail('scripts/CompilerErrorTest_002.groovy', [])
}
- void "test groovy core - EnumDeclaration 2"() {
- def err = expectFail '''\
-enum E extends Object {}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: No extends clause allowed for enum declaration @ line 1, column 8.
- enum E extends Object {}
- ^
-
-1 error
-'''
+ @NotYetImplemented
+ void 'test DifferencesFromJavaTest_002.groovy'() {
+ unzipScriptAndShouldFail('scripts/DifferencesFromJavaTest_002.groovy', [])
}
- void "test groovy core - InterfaceDeclaration 1"() {
- def err = expectFail '''\
-interface I implements Serializable {}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: No implements clause allowed for interface declaration @ line 1, column 13.
- interface I implements Serializable {}
- ^
-
-1 error
-'''
+ @NotYetImplemented
+ void 'test Groovy5212Bug_001.groovy'() {
+ unzipScriptAndShouldFail('scripts/Groovy5212Bug_001.groovy', [])
}
- void "test test groovy core - ClassDeclaration 1"() {
- def err = expectFail '''\
-class C extends Object, Number {}
- '''
-
- assert err == '''\
-startup failed:
-test.groovy: 1: Cannot extend multiple classes @ line 1, column 9.
- class C extends Object, Number {}
- ^
-
-1 error
-'''
+ @NotYetImplemented
+ void 'test GStringEndTest_001.groovy'() {
+ unzipScriptAndShouldFail('scripts/GStringEndTest_001.groovy', [])
}
-
//--------------------------------------------------------------------------
- def expectFail(String code) {
+
+ private static String expectParseError(String source) {
try {
- def ast = new CompilationUnit().tap {
- addSource 'test.groovy', code
- compile Phases.CONVERSION
- }.getAST()
+ new CompilationUnit().with {
+ addSource('test.groovy', source)
+ compile(Phases.CONVERSION)
+ getAST()
+ }
- fail("should fail")
+ fail('expected parse to fail')
} catch (e) {
- return e.message.replaceAll('\r\n', '\n')
+ return e.message.replace('\r\n', '\n')
}
}
- private static unzipScriptAndShouldFail(String entryName, List ignoreClazzList, Map<String, String> replacementsMap=[:], boolean toCheckNewParserOnly = false) {
+ private static unzipScriptAndShouldFail(String entryName, List ignoreClazzList, Map<String, String> replacementsMap = [:], boolean toCheckNewParserOnly = false) {
ignoreClazzList.addAll(TestUtils.COMMON_IGNORE_CLASS_LIST)
- TestUtils.unzipAndFail(SCRIPT_ZIP_PATH, entryName, TestUtils.addIgnore(ignoreClazzList, ASTComparatorCategory.LOCATION_IGNORE_LIST), replacementsMap, toCheckNewParserOnly)
+ TestUtils.unzipAndFail(SCRIPT_ZIP_PATH, entryName, TestUtils.addIgnore(ignoreClazzList, LOCATION_IGNORE_LIST), replacementsMap, toCheckNewParserOnly)
}
- private static final String SCRIPT_ZIP_PATH = "$TestUtils.RESOURCES_PATH/groovy-2.5.0/groovy-2.5.0-SNAPSHOT-20160921-allscripts.zip"
+ private static final String SCRIPT_ZIP_PATH = "${TestUtils.RESOURCES_PATH}/groovy-2.5.0/groovy-2.5.0-SNAPSHOT-20160921-allscripts.zip"
}
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy
index 0480004..9b85163 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/ASTComparatorCategory.groovy
@@ -101,58 +101,50 @@ import org.codehaus.groovy.syntax.Token
import java.util.logging.Level
-@CompileStatic
-@Log @SuppressWarnings("GroovyUnusedDeclaration")
+@CompileStatic @Log @SuppressWarnings('GroovyUnusedDeclaration')
class ASTComparatorCategory {
static { log.level = Level.WARNING }
- static List<String> LOCATION_IGNORE_LIST = ["columnNumber", "lineNumber", "lastColumnNumber", "lastLineNumber", "startLine"]
- static private List<String> EXPRESSION_IGNORE_LIST = ["text"] + LOCATION_IGNORE_LIST
+ public static final List<String> LOCATION_IGNORE_LIST = ['columnNumber', 'lineNumber', 'lastColumnNumber', 'lastLineNumber', 'startLine'].asUnmodifiable()
+ private static final List<String> EXPRESSION_IGNORE_LIST = (['text'] + LOCATION_IGNORE_LIST).asUnmodifiable()
- /**
- * Keeps all checked object pairs and their comparison result.
- * Will be cleared at {@link #apply(groovy.lang.Closure)} method }
- */
- static Map<List<Object>, Boolean> objects = [:] as Map<List<Object>, Boolean>
- static String lastName
-
- static Map<Class, List<String>> DEFAULT_CONFIGURATION = [
- (ClassNode) : (['module', "declaredMethodsMap", "plainNodeReference", "typeClass", "allInterfaces", "orAddStaticConstructorNode", "allDeclaredMethods", "unresolvedSuperClass", "innerClasses" ] + LOCATION_IGNORE_LIST) as List<String>,
+ public static final Map<Class, List<String>> DEFAULT_CONFIGURATION = [
+ (ClassNode) : ['module', 'declaredMethodsMap', 'plainNodeReference', 'typeClass', 'allInterfaces', 'orAddStaticConstructorNode', 'allDeclaredMethods', 'unresolvedSuperClass', 'innerClasses' ] + LOCATION_IGNORE_LIST,
(ConstructorNode) : ['declaringClass'],
(DynamicVariable) : [],
- (EnumConstantClassNode) : ["typeClass"],
- (FieldNode) : ["owner", "declaringClass", "initialValueExpression", "assignToken"],
+ (EnumConstantClassNode) : ['typeClass'],
+ (FieldNode) : ['owner', 'declaringClass', 'initialValueExpression', 'assignToken'],
(GenericsType) : [],
(ImportNode) : LOCATION_IGNORE_LIST,
- (InnerClassNode) : (['module', "declaredMethodsMap", "plainNodeReference", "typeClass", "allInterfaces", "orAddStaticConstructorNode", "allDeclaredMethods", "unresolvedSuperClass", "innerClasses" ] + LOCATION_IGNORE_LIST) as List<String>,
+ (InnerClassNode) : ['module', 'declaredMethodsMap', 'plainNodeReference', 'typeClass', 'allInterfaces', 'orAddStaticConstructorNode', 'allDeclaredMethods', 'unresolvedSuperClass', 'innerClasses' ] + LOCATION_IGNORE_LIST,
(InterfaceHelperClassNode) : [],
- (MethodNode) : ["text", "declaringClass"],
+ (MethodNode) : ['text', 'declaringClass'],
(MixinNode) : [],
- (ModuleNode) : ["context"],
+ (ModuleNode) : ['context'],
(PackageNode) : [],
(Parameter) : [],
- (PropertyNode) : ['declaringClass', 'initialValueExpression', "assignToken"],
+ (PropertyNode) : ['declaringClass', 'initialValueExpression', 'assignToken'],
(Variable) : [],
- (VariableScope) : ["clazzScope", "parent", "declaredVariablesIterator"],
- (Token) : ["root", "startColumn"],
- (AnnotationNode) : (["text"] + LOCATION_IGNORE_LIST) as List<String>,
- (AssertStatement) : ["text"],
- (BlockStatement) : ["columnNumber", "lineNumber", "lastColumnNumber", "lastLineNumber", "text"],
- (BreakStatement) : ["text"],
- (CaseStatement) : ["text"],
- (CatchStatement) : (["text"] + LOCATION_IGNORE_LIST) as List<String>,
- (ContinueStatement) : ["text"],
- (DoWhileStatement) : ["text"],
- (EmptyStatement) : ["text"],
- (ExpressionStatement) : ["text"],
- (ForStatement) : ["text"],
- (IfStatement) : ["text"],
- (LoopingStatement) : ["text"],
- (ReturnStatement) : ["text"],
- (SwitchStatement) : ["columnNumber", "lineNumber", "lastColumnNumber", "lastLineNumber", "text"],
- (SynchronizedStatement) : ["text"],
- (ThrowStatement) : ["text"],
- (TryCatchStatement) : (["text"] + LOCATION_IGNORE_LIST) as List<String>,
- (WhileStatement) : ["text"],
+ (VariableScope) : ['clazzScope', 'parent', 'declaredVariablesIterator'],
+ (Token) : ['root', 'startColumn'],
+ (AnnotationNode) : (['text'] + LOCATION_IGNORE_LIST),
+ (AssertStatement) : ['text'],
+ (BlockStatement) : ['columnNumber', 'lineNumber', 'lastColumnNumber', 'lastLineNumber', 'text'],
+ (BreakStatement) : ['text'],
+ (CaseStatement) : ['text'],
+ (CatchStatement) : ['text'] + LOCATION_IGNORE_LIST,
+ (ContinueStatement) : ['text'],
+ (DoWhileStatement) : ['text'],
+ (EmptyStatement) : ['text'],
+ (ExpressionStatement) : ['text'],
+ (ForStatement) : ['text'],
+ (IfStatement) : ['text'],
+ (LoopingStatement) : ['text'],
+ (ReturnStatement) : ['text'],
+ (SwitchStatement) : ['columnNumber', 'lineNumber', 'lastColumnNumber', 'lastLineNumber', 'text'],
+ (SynchronizedStatement) : ['text'],
+ (ThrowStatement) : ['text'],
+ (TryCatchStatement) : ['text'] + LOCATION_IGNORE_LIST,
+ (WhileStatement) : ['text'],
(AnnotationConstantExpression): EXPRESSION_IGNORE_LIST,
(ArgumentListExpression) : EXPRESSION_IGNORE_LIST,
(ArrayExpression) : EXPRESSION_IGNORE_LIST,
@@ -166,7 +158,7 @@ class ASTComparatorCategory {
(ClosureListExpression) : EXPRESSION_IGNORE_LIST,
(ConstantExpression) : EXPRESSION_IGNORE_LIST,
(ConstructorCallExpression) : EXPRESSION_IGNORE_LIST,
- (DeclarationExpression) : ["text", "columnNumber", "lineNumber", "lastColumnNumber", "lastLineNumber"],
+ (DeclarationExpression) : ['text', 'columnNumber', 'lineNumber', 'lastColumnNumber', 'lastLineNumber'],
(ElvisOperatorExpression) : EXPRESSION_IGNORE_LIST,
(EmptyExpression) : EXPRESSION_IGNORE_LIST,
(ExpressionTransformer) : EXPRESSION_IGNORE_LIST,
@@ -192,13 +184,21 @@ class ASTComparatorCategory {
(UnaryMinusExpression) : EXPRESSION_IGNORE_LIST,
(UnaryPlusExpression) : EXPRESSION_IGNORE_LIST,
(VariableExpression) : EXPRESSION_IGNORE_LIST,
- ] as Map<Class, List<String>>
+ ].asUnmodifiable()
+
+ public static final Map<Class, List<String>> COLLECTION_PROPERTY_CONFIGURATION = [
+ (ModuleNode): ['classes', 'name']
+ ].asUnmodifiable()
- static Map<Class, List<String>> COLLECTION_PROPERTY_CONFIGURATION = [
- (ModuleNode): ["classes", "name"]
- ] as Map<Class, List<String>>
+ public static Map<Class, List<String>> configuration = DEFAULT_CONFIGURATION
- static Map<Class, List<String>> configuration = DEFAULT_CONFIGURATION;
+ /**
+ * Keeps all checked object pairs and their comparison result.
+ * Will be cleared at {@link #apply(groovy.lang.Closure)} method }
+ */
+ public static final Map<List<Object>, Boolean> objects = [:]
+
+ static String lastName
@CompileDynamic
static void apply(config = DEFAULT_CONFIGURATION, Closure cl) {
[groovy] 06/07: Fix some potential issue caused by invalid method
name
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 500373c12599092e04c74c3fb5243d983bb755a3
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Mar 21 19:10:03 2020 +0800
Fix some potential issue caused by invalid method name
(cherry picked from commit a1c10ea84c10fa70f0668e03369164d2a5db4b9c)
---
.../groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy | 5 -----
1 file changed, 5 deletions(-)
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 0b789db..9fbb5f3 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
@@ -418,27 +418,22 @@ final class SyntaxErrorTest extends GroovyTestCase {
|'''.stripMargin()
}
- @NotYetImplemented
void 'test CompilerErrorTest_001'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_001.groovy', [])
}
- @NotYetImplemented
void 'test CompilerErrorTest_002'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_002.groovy', [])
}
- @NotYetImplemented
void 'test DifferencesFromJavaTest_002'() {
unzipScriptAndShouldFail('scripts/DifferencesFromJavaTest_002.groovy', [])
}
- @NotYetImplemented
void 'test Groovy5212Bug_001'() {
unzipScriptAndShouldFail('scripts/Groovy5212Bug_001.groovy', [])
}
- @NotYetImplemented
void 'test GStringEndTest_001'() {
unzipScriptAndShouldFail('scripts/GStringEndTest_001.groovy', [])
}
[groovy] 01/07: Eliminate duplication in
JavaLetter[OrDigit]InGString
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit b037bfbca5a5debdd8fcf09f08e06f4f39874ed1
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Mon Mar 16 13:29:52 2020 -0500
Eliminate duplication in JavaLetter[OrDigit]InGString
Define them in terms of JavaLetter[OrDigit] with semantic predicate
(cherry picked from commit 4d3ecf5690a0330c7277ca83c3bd62641a2e27e7)
---
src/antlr/GroovyLexer.g4 | 40 +++++++++++++---------------------------
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/src/antlr/GroovyLexer.g4 b/src/antlr/GroovyLexer.g4
index 411c366..dc3d37f 100644
--- a/src/antlr/GroovyLexer.g4
+++ b/src/antlr/GroovyLexer.g4
@@ -887,48 +887,35 @@ IdentifierInGString
;
fragment
-JavaLetterInGString
- : [a-zA-Z_] // these are the "java letters" below 0x7F, except for $
+JavaLetter
+ : [a-zA-Z$_] // these are the "java letters" below 0x7F
| // covers all characters above 0x7F which are not a surrogate
~[\u0000-\u007F\uD800-\uDBFF]
- {Character.isJavaIdentifierStart(_input.LA(-1))}?
+ { Character.isJavaIdentifierStart(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
- {Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
+ { Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))) }?
;
fragment
-JavaLetterOrDigitInGString
- : [a-zA-Z0-9_] // these are the "java letters or digits" below 0x7F, except for $
- | // covers all characters above 0x7F which are not a surrogate
- ~[\u0000-\u007F\uD800-\uDBFF]
- {Character.isJavaIdentifierPart(_input.LA(-1))}?
- | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
- [\uD800-\uDBFF] [\uDC00-\uDFFF]
- {Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
+JavaLetterInGString
+ : JavaLetter { _input.LA(-1) != '$' }?
;
-
fragment
-JavaLetter
- : [a-zA-Z$_] // these are the "java letters" below 0x7F
+JavaLetterOrDigit
+ : [a-zA-Z0-9$_] // these are the "java letters or digits" below 0x7F
| // covers all characters above 0x7F which are not a surrogate
~[\u0000-\u007F\uD800-\uDBFF]
- {Character.isJavaIdentifierStart(_input.LA(-1))}?
+ { Character.isJavaIdentifierPart(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
- {Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
+ { Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))) }?
;
fragment
-JavaLetterOrDigit
- : [a-zA-Z0-9$_] // these are the "java letters or digits" below 0x7F
- | // covers all characters above 0x7F which are not a surrogate
- ~[\u0000-\u007F\uD800-\uDBFF]
- {Character.isJavaIdentifierPart(_input.LA(-1))}?
- | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
- [\uD800-\uDBFF] [\uDC00-\uDFFF]
- {Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}?
+JavaLetterOrDigitInGString
+ : JavaLetterOrDigit { _input.LA(-1) != '$' }?
;
//
@@ -941,10 +928,9 @@ ELLIPSIS : '...';
//
// Whitespace, line escape and comments
//
-WS : ([ \t\u000C]+ | LineEscape+) -> skip
+WS : ([ \t\u000C]+ | LineEscape+) -> skip
;
-
// Inside (...) and [...] but not {...}, ignore newlines.
NL : LineTerminator { this.ignoreTokenInsideParens(); }
;
[groovy] 03/07: fix method names
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 6e86a759ba7746f7003c4cf72855e61d425a480c
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Mar 20 11:11:36 2020 -0500
fix method names
(cherry picked from commit 7d02aad969328713b490fde9e2f755928ac02a32)
---
.../org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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 6d15e98..54de385 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
@@ -371,27 +371,27 @@ final class SyntaxErrorTest extends GroovyTestCase {
}
@NotYetImplemented
- void 'test CompilerErrorTest_001.groovy'() {
+ void 'test CompilerErrorTest_001'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_001.groovy', [])
}
@NotYetImplemented
- void 'test CompilerErrorTest_002.groovy'() {
+ void 'test CompilerErrorTest_002'() {
unzipScriptAndShouldFail('scripts/CompilerErrorTest_002.groovy', [])
}
@NotYetImplemented
- void 'test DifferencesFromJavaTest_002.groovy'() {
+ void 'test DifferencesFromJavaTest_002'() {
unzipScriptAndShouldFail('scripts/DifferencesFromJavaTest_002.groovy', [])
}
@NotYetImplemented
- void 'test Groovy5212Bug_001.groovy'() {
+ void 'test Groovy5212Bug_001'() {
unzipScriptAndShouldFail('scripts/Groovy5212Bug_001.groovy', [])
}
@NotYetImplemented
- void 'test GStringEndTest_001.groovy'() {
+ void 'test GStringEndTest_001'() {
unzipScriptAndShouldFail('scripts/GStringEndTest_001.groovy', [])
}
[groovy] 05/07: GroovyLexer: parse error for control and format
characters(closes #1198)
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 9fc8df6cf80e3296de08c8c3c875c9ef2d0cbe91
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Mar 20 11:08:29 2020 -0500
GroovyLexer: parse error for control and format characters(closes #1198)
Inspired by: https://stackoverflow.com/a/59984875
See also: https://github.com/groovy/groovy-eclipse/issues/1060
(cherry picked from commit 7fe8352476df4ab7642d12de3debef2e5952da1e)
---
src/antlr/GroovyLexer.g4 | 6 +--
.../groovy/parser/antlr4/SyntaxErrorTest.groovy | 48 ++++++++++++++++++++++
2 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/src/antlr/GroovyLexer.g4 b/src/antlr/GroovyLexer.g4
index a6c7e72..9348ef4 100644
--- a/src/antlr/GroovyLexer.g4
+++ b/src/antlr/GroovyLexer.g4
@@ -891,7 +891,7 @@ JavaLetter
: [a-zA-Z$_] // these are the "java letters" below 0x7F
| // covers all characters above 0x7F which are not a surrogate
~[\u0000-\u007F\uD800-\uDBFF]
- { Character.isJavaIdentifierStart(_input.LA(-1)) }?
+ { Character.isJavaIdentifierStart(_input.LA(-1)) && !Character.isIdentifierIgnorable(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{ Character.isJavaIdentifierStart(Character.toCodePoint((char) _input.LA(-2), (char) _input.LA(-1))) }?
@@ -907,7 +907,7 @@ JavaLetterOrDigit
: [a-zA-Z0-9$_] // these are the "java letters or digits" below 0x7F
| // covers all characters above 0x7F which are not a surrogate
~[\u0000-\u007F\uD800-\uDBFF]
- { Character.isJavaIdentifierPart(_input.LA(-1)) }?
+ { Character.isJavaIdentifierPart(_input.LA(-1)) && !Character.isIdentifierIgnorable(_input.LA(-1)) }?
| // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
[\uD800-\uDBFF] [\uDC00-\uDFFF]
{ Character.isJavaIdentifierPart(Character.toCodePoint((char) _input.LA(-2), (char) _input.LA(-1))) }?
@@ -928,7 +928,7 @@ ELLIPSIS : '...';
//
// Whitespace, line escape and comments
//
-WS : ([ \t\u000C]+ | LineEscape+) -> skip
+WS : ([ \t]+ | LineEscape+) -> skip
;
// Inside (...) and [...] but not {...}, ignore newlines.
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 54de385..0b789db 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
@@ -75,6 +75,54 @@ final class SyntaxErrorTest extends GroovyTestCase {
TestUtils.doRunAndShouldFail('fail/UnexpectedCharacter_01x.groovy')
}
+ void 'test groovy core - UnexpectedCharacter 2'() {
+ def err = expectParseError '''\
+ |def \u200Bname = null
+ |'''.stripMargin()
+
+ // TODO: Could the character be escaped in the error message?
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: Unexpected input: 'def \u200B' @ line 1, column 5.
+ | def \u200Bname = null
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+
+ //
+
+ err = expectParseError '''\
+ |def na\u200Bme = null
+ |'''.stripMargin()
+
+ // TODO: Could the character be escaped in the error message?
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: Unexpected input: '\u200B'; Expecting <EOF> @ line 1, column 7.
+ | def na\u200Bme = null
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+
+ //
+
+ err = expectParseError '''\
+ |def na\u000Cme = null
+ |'''.stripMargin()
+
+ // TODO: Could the character be escaped in the error message?
+ assert err == '''\
+ |startup failed:
+ |test.groovy: 1: Unexpected input: '\u000C'; Expecting <EOF> @ line 1, column 7.
+ | def na\u000Cme = null
+ | ^
+ |
+ |1 error
+ |'''.stripMargin()
+ }
+
void 'test groovy core - ParExpression'() {
TestUtils.doRunAndShouldFail('fail/ParExpression_01x.groovy')
TestUtils.doRunAndShouldFail('fail/ParExpression_02x.groovy')
[groovy] 04/07: Add JDK 14 build to travis CI
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 25a4ff9235deb9c33db32c452541c7b1be7030ec
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Mar 21 13:24:21 2020 +0800
Add JDK 14 build to travis CI
(cherry picked from commit 85d9b9a8e1f99fc84a74a6fab352fc9992fa313a)
---
.travis.yml | 4 ++++
gradle.properties | 2 +-
gradle/wrapper/gradle-wrapper.jar | Bin 58695 -> 58702 bytes
gradle/wrapper/gradle-wrapper.properties | 2 +-
gradlew.bat | 3 ---
src/test/gls/annotations/AnnotationTest.groovy | 10 +++++++---
6 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1f0ba25a..a75e5ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,8 @@ install: true
matrix:
include:
- env: BC='legacy'
+ jdk: openjdk14
+ - env: BC='legacy'
jdk: openjdk13
- env: BC='legacy'
jdk: openjdk12
@@ -37,6 +39,8 @@ matrix:
jdk: oraclejdk8
- env: BC='indy'
+ jdk: openjdk14
+ - env: BC='indy'
jdk: openjdk13
- env: BC='indy'
jdk: openjdk12
diff --git a/gradle.properties b/gradle.properties
index b9cba3c..45a518d 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,7 +17,7 @@ groovyVersion = 3.0.3-SNAPSHOT
# bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits)
groovyBundleVersion = 3.0.3.SNAPSHOT
-gradle_version=6.2.2
+gradle_version=6.3-rc-4
groovyJUnit_ms=512m
groovyJUnit_mx=2g
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f3d88b1..cc4fdc2 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a2bf131..b43cc6e 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-rc-4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew.bat b/gradlew.bat
index 9109989..24467a1 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -29,9 +29,6 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
diff --git a/src/test/gls/annotations/AnnotationTest.groovy b/src/test/gls/annotations/AnnotationTest.groovy
index bd58bb0..e28948f 100644
--- a/src/test/gls/annotations/AnnotationTest.groovy
+++ b/src/test/gls/annotations/AnnotationTest.groovy
@@ -641,7 +641,9 @@ final class AnnotationTest extends CompilableTestSupport {
def string = getClass().getMethod('method').getAnnotation(Foo).toString()[5..-2].tokenize(', ').sort().join('|')
assert string == 'b=6|c1=A|c2=B|c3=C|c4=D|d1=2.0|d2=2.1|d3=2.2|d4=2.3|f1=1.0|f2=1.1|f3=1.2|f4=1.3|i1=0|i2=1|s1=2|s2=3|s3=4|s4=5' ||
// changed in some jdk9 versions
- string == "b=6|c1='A'|c2='B'|c3='C'|c4='D'|d1=2.0|d2=2.1|d3=2.2|d4=2.3|f1=1.0f|f2=1.1f|f3=1.2f|f4=1.3f|i1=0|i2=1|s1=2|s2=3|s3=4|s4=5"
+ string == "b=6|c1='A'|c2='B'|c3='C'|c4='D'|d1=2.0|d2=2.1|d3=2.2|d4=2.3|f1=1.0f|f2=1.1f|f3=1.2f|f4=1.3f|i1=0|i2=1|s1=2|s2=3|s3=4|s4=5" ||
+ // changed in some jdk14 versions
+ string == "b=(byte)0x06|c1='A'|c2='B'|c3='C'|c4='D'|d1=2.0|d2=2.1|d3=2.2|d4=2.3|f1=1.0f|f2=1.1f|f3=1.2f|f4=1.3f|i1=0|i2=1|s1=2|s2=3|s3=4|s4=5"
'''
}
@@ -713,7 +715,8 @@ final class AnnotationTest extends CompilableTestSupport {
// TODO confirm the JDK9 behavior is what we expect
private static final List<String> expected = [
'@MyAnnotationArray(value=[@MyAnnotation(value=val1), @MyAnnotation(value=val2)])', // JDK5-8
- '@MyAnnotationArray(value={@MyAnnotation(value="val1"), @MyAnnotation(value="val2")})' // JDK9
+ '@MyAnnotationArray(value={@MyAnnotation(value="val1"), @MyAnnotation(value="val2")})', // JDK9
+ '@MyAnnotationArray({@MyAnnotation("val1"), @MyAnnotation("val2")})' // JDK14
]
// control
@@ -891,7 +894,8 @@ final class AnnotationTest extends CompilableTestSupport {
// TODO confirm the JDK9 behavior is what we expect
private static final List<String> expected = [
'@gls.annotations.Requires(value=[@gls.annotations.Require(value=val1), @gls.annotations.Require(value=val2)])', // JDK5-8
- '@gls.annotations.Requires(value={@gls.annotations.Require(value="val1"), @gls.annotations.Require(value="val2")})' // JDK9
+ '@gls.annotations.Requires(value={@gls.annotations.Require(value="val1"), @gls.annotations.Require(value="val2")})', // JDK9
+ '@gls.annotations.Requires({@gls.annotations.Require("val1"), @gls.annotations.Require("val2")})' // JDK14
]
// control