[ 
https://issues.apache.org/jira/browse/GROOVY-11670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17955502#comment-17955502
 ] 

Daniel Sun edited comment on GROOVY-11670 at 6/1/25 1:24 PM:
-------------------------------------------------------------

AFAIR, more ambiguities will be introduced into grammar if we allow class name 
start with lower case letter. Some years ago, I had a try but failed.

BTW, the groovy-parser project( https://github.com/daniellansun/groovy-parser ) 
tried to maintain both new and old parsers, and checks compatibilities of 
grammar changes with groovy code from popular projects, e.g. gradle, spock, 
geb, grails and groovy 2.  It's better to test grammar changes via the project 
especially for some big changes.



was (Author: daniel_sun):
AFAIR, more ambiguities will be introduced into grammar if we allow class name 
start with lower case letter. Some years ago, I had a try but failed.

> Class names that start with lower case letters
> ----------------------------------------------
>
>                 Key: GROOVY-11670
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11670
>             Project: Groovy
>          Issue Type: Improvement
>          Components: parser-antlr4
>    Affects Versions: 5.0.0-alpha-12, 4.0.26
>            Reporter: Saravanan
>            Priority: Minor
>
> Classes that start with a lower case name cause parsing errors. I am 
> compiling this with @CompileStatic enabled in the compilerConfiguration
> {code:java}
> public class recordTesting {
>     private recordTesting someFunction() {
>         return null;
>     }
> }{code}
> Unexpected input: ';\n\npublic class recordTesting {\n\n    private static 
> recordTesting someFunction(' @ line 5, column 46.
>    tic recordTesting someFunction() {
>                                  ^
> If none of the functions returned a type with a lower case first letter, 
> things are fine. It looks like there is no issue with the lower class class 
> definition, just the use of that type in a return value. Not sure if the 
> CapitalizedIdentifier is an enforced groovy construct. Java allows this and 
> groovy causes this to fail as well, preventing use of types defined in java
> {code:java}
> public class SomeOtherClass {
>     private someClassDefinedInJava someFunction() {
>     }
> }{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to