[jira] [Commented] (GROOVY-10139) BUG when removing optional parentheses (using CompileStatic)

2021-06-15 Thread rkrisztian (Jira)


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

rkrisztian commented on GROOVY-10139:
-

Should the IDEA behavior be reported to JetBrains' issue tracker?

> BUG when removing optional parentheses (using CompileStatic)
> 
>
> Key: GROOVY-10139
> URL: https://issues.apache.org/jira/browse/GROOVY-10139
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.8
>Reporter: rkrisztian
>Priority: Major
> Attachments: image-2021-06-15-01-29-37-333.png
>
>
> I've got a Groovy project with the following commit:
> [https://github.com/rkrisztian/search/commit/328f7faeb3642f7dc81bf798c8dcc30fb1bc87c6]
> (I will keep this branch until the issue is resolved.)
> Essentially I changed this code:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint((lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text)
>   }
> {code}
> To this one, as recommended by IntelliJ IDEA:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint (lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text
>   }
> {code}
> The bug I got:
> {noformat}
> rkrisztian@localhost:~/projects/search$ gw assemble -s
> Using gradle at '/home/rkrisztian/projects/search/gradlew' to run buildfile 
> '/home/rkrisztian/projects/search/build.gradle':
> > Task :search-app:compileJava NO-SOURCE
> > Task :search-app:compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':search-app:compileGroovy'.
> > BUG! exception in phase 'class generation' in source unit 
> > '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
> >  operand stack contains 2 elements, but we expected only 0
> * Try:
> Run with --info or --debug option to get more log output. Run with --scan to 
> get full insights.
> * Exception is:
> org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
> ':search-app:compileGroovy'.
> (...)
> Caused by: BUG! exception in phase 'class generation' in source unit 
> '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
>  operand stack contains 2 elements, but we expected only 0
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:277)
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:98)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
> at 
> org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
> at 
> org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
> at 
> org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
> at 
> org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
> at 
> org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at 
> org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
>  

[jira] [Issue Comment Deleted] (GROOVY-10139) BUG when removing optional parentheses (using CompileStatic)

2021-06-15 Thread rkrisztian (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

rkrisztian updated GROOVY-10139:

Comment: was deleted

(was: Thanks, I kind of suspected that. But:
 * IDEA disagrees.
 * It's still a bug.)

> BUG when removing optional parentheses (using CompileStatic)
> 
>
> Key: GROOVY-10139
> URL: https://issues.apache.org/jira/browse/GROOVY-10139
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.8
>Reporter: rkrisztian
>Priority: Major
> Attachments: image-2021-06-15-01-29-37-333.png
>
>
> I've got a Groovy project with the following commit:
> [https://github.com/rkrisztian/search/commit/328f7faeb3642f7dc81bf798c8dcc30fb1bc87c6]
> (I will keep this branch until the issue is resolved.)
> Essentially I changed this code:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint((lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text)
>   }
> {code}
> To this one, as recommended by IntelliJ IDEA:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint (lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text
>   }
> {code}
> The bug I got:
> {noformat}
> rkrisztian@localhost:~/projects/search$ gw assemble -s
> Using gradle at '/home/rkrisztian/projects/search/gradlew' to run buildfile 
> '/home/rkrisztian/projects/search/build.gradle':
> > Task :search-app:compileJava NO-SOURCE
> > Task :search-app:compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':search-app:compileGroovy'.
> > BUG! exception in phase 'class generation' in source unit 
> > '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
> >  operand stack contains 2 elements, but we expected only 0
> * Try:
> Run with --info or --debug option to get more log output. Run with --scan to 
> get full insights.
> * Exception is:
> org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
> ':search-app:compileGroovy'.
> (...)
> Caused by: BUG! exception in phase 'class generation' in source unit 
> '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
>  operand stack contains 2 elements, but we expected only 0
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:277)
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:98)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
> at 
> org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
> at 
> org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
> at 
> org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
> at 
> org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
> at 
> org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at 
> org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
> 

[jira] [Commented] (GROOVY-10139) BUG when removing optional parentheses (using CompileStatic)

2021-06-15 Thread rkrisztian (Jira)


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

rkrisztian commented on GROOVY-10139:
-

Thanks, I kind of suspected that. But:
 * IDEA disagrees.
 * It's still a bug.

> BUG when removing optional parentheses (using CompileStatic)
> 
>
> Key: GROOVY-10139
> URL: https://issues.apache.org/jira/browse/GROOVY-10139
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.8
>Reporter: rkrisztian
>Priority: Major
> Attachments: image-2021-06-15-01-29-37-333.png
>
>
> I've got a Groovy project with the following commit:
> [https://github.com/rkrisztian/search/commit/328f7faeb3642f7dc81bf798c8dcc30fb1bc87c6]
> (I will keep this branch until the issue is resolved.)
> Essentially I changed this code:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint((lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text)
>   }
> {code}
> To this one, as recommended by IntelliJ IDEA:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint (lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text
>   }
> {code}
> The bug I got:
> {noformat}
> rkrisztian@localhost:~/projects/search$ gw assemble -s
> Using gradle at '/home/rkrisztian/projects/search/gradlew' to run buildfile 
> '/home/rkrisztian/projects/search/build.gradle':
> > Task :search-app:compileJava NO-SOURCE
> > Task :search-app:compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':search-app:compileGroovy'.
> > BUG! exception in phase 'class generation' in source unit 
> > '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
> >  operand stack contains 2 elements, but we expected only 0
> * Try:
> Run with --info or --debug option to get more log output. Run with --scan to 
> get full insights.
> * Exception is:
> org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
> ':search-app:compileGroovy'.
> (...)
> Caused by: BUG! exception in phase 'class generation' in source unit 
> '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
>  operand stack contains 2 elements, but we expected only 0
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:277)
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:98)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
> at 
> org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
> at 
> org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
> at 
> org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
> at 
> org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
> at 
> org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at 
> 

[GitHub] [groovy] eric-milles commented on a change in pull request #1599: GROOVY-9382, GROOVY-10133: prefer isName() over getName() for boolean

2021-06-15 Thread GitBox


eric-milles commented on a change in pull request #1599:
URL: https://github.com/apache/groovy/pull/1599#discussion_r652012377



##
File path: src/test/groovy/CategoryTest.groovy
##
@@ -68,8 +68,21 @@ final class CategoryTest extends GroovyTestCase {
 }
 }
 
-// GROOVY-5245
+// GROOVY-10133
 void testCategoryDefinedProperties2() {
+assertScript '''
+class Cat {
+static boolean isAbc(self) { true }
+static boolean getAbc(self) { true }

Review comment:
   Fixed, thanks.  I also tested with the methods defined in the reverse 
order to be sure that wasn't a factor.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [groovy] eric-milles commented on pull request #1597: GROOVY-10133: prefer getPropName() over isPropName() when both available

2021-06-15 Thread GitBox


eric-milles commented on pull request #1597:
URL: https://github.com/apache/groovy/pull/1597#issuecomment-861700522


   I'd prefer to see Boolean have the same treatment as boolean or have the 
same treatment as say Object.  My original tickets were along these lines.  
Adding special rules for Boolean that do not apply to any other types requires 
more checks in the compiler and IDE.  To have it work like boolean only 
requires the method return value checks to include both types.  This would be 
inconsistent with Apache BeanUtils, but would be more compatible with the 
historic support for Boolean properties in Groovy.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (GROOVY-10139) BUG when removing optional parentheses (using CompileStatic)

2021-06-15 Thread Eric Milles (Jira)


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

Eric Milles commented on GROOVY-10139:
--

The parens are required in this scenario because you have a parenthesized 
expression at the start of your first argument.

> BUG when removing optional parentheses (using CompileStatic)
> 
>
> Key: GROOVY-10139
> URL: https://issues.apache.org/jira/browse/GROOVY-10139
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.8
>Reporter: rkrisztian
>Priority: Major
> Attachments: image-2021-06-15-01-29-37-333.png
>
>
> I've got a Groovy project with the following commit:
> [https://github.com/rkrisztian/search/commit/328f7faeb3642f7dc81bf798c8dcc30fb1bc87c6]
> (I will keep this branch until the issue is resolved.)
> Essentially I changed this code:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint((lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text)
>   }
> {code}
> To this one, as recommended by IntelliJ IDEA:
> {code:groovy}
>   partitioner.partition(foundLine.line).each { lp ->
>   log.rawPrint (lp.colorType) ? 
> colors.format(lp.colorType, lp.text) : lp.text
>   }
> {code}
> The bug I got:
> {noformat}
> rkrisztian@localhost:~/projects/search$ gw assemble -s
> Using gradle at '/home/rkrisztian/projects/search/gradlew' to run buildfile 
> '/home/rkrisztian/projects/search/build.gradle':
> > Task :search-app:compileJava NO-SOURCE
> > Task :search-app:compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':search-app:compileGroovy'.
> > BUG! exception in phase 'class generation' in source unit 
> > '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
> >  operand stack contains 2 elements, but we expected only 0
> * Try:
> Run with --info or --debug option to get more log output. Run with --scan to 
> get full insights.
> * Exception is:
> org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
> ':search-app:compileGroovy'.
> (...)
> Caused by: BUG! exception in phase 'class generation' in source unit 
> '/home/rkrisztian/projects/search/search-app/src/main/groovy/search/resultsprinter/ConsoleResultsPrinter.groovy'
>  operand stack contains 2 elements, but we expected only 0
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:277)
> at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:98)
> at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
> at 
> org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
> at 
> org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
> at 
> org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
> at 
> org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
> at 
> org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
> at 
> org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
> at 
> org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
> at 
> org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at 
> 

[jira] [Updated] (GROOVY-10140) No compiler error for invalid method modifiers

2021-06-15 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10140:
-
Description: 
Consider the following:
{code:groovy}
class C {
  transient void m() {
println 'should not compile'
  }
}
new C().m()
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier bit for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".

  was:
Consider the following:
{code:groovy}
class C {
  transient void m() {
println 'should not compile'
  }
}
new C().m()
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".


> No compiler error for invalid method modifiers
> --
>
> Key: GROOVY-10140
> URL: https://issues.apache.org/jira/browse/GROOVY-10140
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3
>Reporter: Eric Milles
>Priority: Major
>
> Consider the following:
> {code:groovy}
> class C {
>   transient void m() {
> println 'should not compile'
>   }
> }
> new C().m()
> {code}
> Groovy happily compiles and executes this code.  It should emit and error for 
> the invalid modifier "transient" on the method declaration.  Similar code in 
> Java produces the following error:
> {code}
> Illegal modifier for the method m; only public, protected, private, abstract, 
> static, final, synchronized, native & strictfp are permitted
> {code}
> transient overlaps the modifier bit for varargs so this can cause 
> difficulties in joint compilation scenarios.  Also the modifier printing code 
> leveraged from {{MethodNode#getText}} does not consider the method context 
> and prints "transient" for "def foo(... args) {}".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-10140) No compiler error for invalid method modifiers

2021-06-15 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10140:
-
Description: 
Consider the following:
{code:groovy}
class C {
  transient void m() {
println 'should not compile'
  }
}
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".

  was:
Consider the following:
{code:groovy}
class C {
  void transient m() {
println 'should not compile'
  }
}
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".


> No compiler error for invalid method modifiers
> --
>
> Key: GROOVY-10140
> URL: https://issues.apache.org/jira/browse/GROOVY-10140
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3
>Reporter: Eric Milles
>Priority: Major
>
> Consider the following:
> {code:groovy}
> class C {
>   transient void m() {
> println 'should not compile'
>   }
> }
> {code}
> Groovy happily compiles and executes this code.  It should emit and error for 
> the invalid modifier "transient" on the method declaration.  Similar code in 
> Java produces the following error:
> {code}
> Illegal modifier for the method m; only public, protected, private, abstract, 
> static, final, synchronized, native & strictfp are permitted
> {code}
> transient overlaps the modifier but for varargs so this can cause 
> difficulties in joint compilation scenarios.  Also the modifier printing code 
> leveraged from {{MethodNode#getText}} does not consider the method context 
> and prints "transient" for "def foo(... args) {}".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (GROOVY-10140) No compiler error for invalid method modifiers

2021-06-15 Thread Eric Milles (Jira)
Eric Milles created GROOVY-10140:


 Summary: No compiler error for invalid method modifiers
 Key: GROOVY-10140
 URL: https://issues.apache.org/jira/browse/GROOVY-10140
 Project: Groovy
  Issue Type: Bug
Affects Versions: 4.0.0-alpha-3, 3.0.8, 2.5.14
Reporter: Eric Milles


Consider the following:
{code:groovy}
class C {
  void transient m() {
println 'should not compile'
  }
}
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-10140) No compiler error for invalid method modifiers

2021-06-15 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10140:
-
Description: 
Consider the following:
{code:groovy}
class C {
  transient void m() {
println 'should not compile'
  }
}
new C().m()
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".

  was:
Consider the following:
{code:groovy}
class C {
  transient void m() {
println 'should not compile'
  }
}
{code}

Groovy happily compiles and executes this code.  It should emit and error for 
the invalid modifier "transient" on the method declaration.  Similar code in 
Java produces the following error:
{code}
Illegal modifier for the method m; only public, protected, private, abstract, 
static, final, synchronized, native & strictfp are permitted
{code}

transient overlaps the modifier but for varargs so this can cause difficulties 
in joint compilation scenarios.  Also the modifier printing code leveraged from 
{{MethodNode#getText}} does not consider the method context and prints 
"transient" for "def foo(... args) {}".


> No compiler error for invalid method modifiers
> --
>
> Key: GROOVY-10140
> URL: https://issues.apache.org/jira/browse/GROOVY-10140
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3
>Reporter: Eric Milles
>Priority: Major
>
> Consider the following:
> {code:groovy}
> class C {
>   transient void m() {
> println 'should not compile'
>   }
> }
> new C().m()
> {code}
> Groovy happily compiles and executes this code.  It should emit and error for 
> the invalid modifier "transient" on the method declaration.  Similar code in 
> Java produces the following error:
> {code}
> Illegal modifier for the method m; only public, protected, private, abstract, 
> static, final, synchronized, native & strictfp are permitted
> {code}
> transient overlaps the modifier but for varargs so this can cause 
> difficulties in joint compilation scenarios.  Also the modifier printing code 
> leveraged from {{MethodNode#getText}} does not consider the method context 
> and prints "transient" for "def foo(... args) {}".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-8660) Unexpected MethodSelectionException with implicit null argument

2021-06-15 Thread Eric Milles (Jira)


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

Eric Milles commented on GROOVY-8660:
-

That said, I think the method selection is working as intended.  Are you 
looking for a change in one of the cases?

> Unexpected MethodSelectionException with implicit null argument
> ---
>
> Key: GROOVY-8660
> URL: https://issues.apache.org/jira/browse/GROOVY-8660
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.0-alpha-2, 2.4.15, 2.5.0
>Reporter: Daniil Ovchinnikov
>Priority: Major
>
> {code:groovy}
> class OnlySingle {
> def foo(a) { "single param: $a" }
> }
> println new OnlySingle().foo()
> // as expected: 'single param: null'
> class OnlyVararg {
> def foo(a, ... b) { "vararg param: $a, $b" }
> }
> println new OnlyVararg().foo()
> // as expected: 'MME: No signature of method: OnlyVararg.foo() is applicable 
> for argument types: () values: []'
> class Both {
> def foo(a) { "single param: $a" }
> def foo(a, ... b) { "vararg param: $a, $b" }
> }
> println new Both().foo()
> // unexpected:
> // MethodSelectionException: Could not find which method foo() to invoke from 
> this list:
> //  public java.lang.Object Both#foo(java.lang.Object)
> //  public transient java.lang.Object Both#foo(java.lang.Object, 
> [Ljava.lang.Object;)
> {code}
> If the exception is expected then {{OnlyVararg}} case should work too.
> If the exception is unexpected then {{Both#foo(Object)}} should be selected.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-8660) Unexpected MethodSelectionException with implicit null argument

2021-06-15 Thread Eric Milles (Jira)


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

Eric Milles commented on GROOVY-8660:
-

The implicit null selection only works when there is a single method with one 
non-primitive parameter.  It is the last case in 
{{org.codehaus.groovy.reflection.ParameterTypes#isValidMethod}}:
{code:java}
public boolean isValidMethod(Class[] arguments) {
if (arguments == null) return true;
final int size = arguments.length;
CachedClass[] pt = getParameterTypes();
final int paramMinus1 = pt.length - 1;
if (isVargsMethod && size >= paramMinus1)
return isValidVarargsMethod(arguments, size, pt, paramMinus1);
else if (pt.length == size)
return isValidExactMethod(arguments, pt);
else if (pt.length == 1 && size == 0 && !pt[0].isPrimitive) // here
return true;
return false;
}
{code}

When there are multiple methods available and no arguments, selection goes 
through {{MetaClassHelper.chooseEmptyMethodParams}} in 
{{groovy.lang.MetaClassImpl#chooseMethodInternal}}, which just tries to execute 
a no-arg method instead of a varargs method if both are declared.

> Unexpected MethodSelectionException with implicit null argument
> ---
>
> Key: GROOVY-8660
> URL: https://issues.apache.org/jira/browse/GROOVY-8660
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.0-alpha-2, 2.4.15, 2.5.0
>Reporter: Daniil Ovchinnikov
>Priority: Major
>
> {code:groovy}
> class OnlySingle {
> def foo(a) { "single param: $a" }
> }
> println new OnlySingle().foo()
> // as expected: 'single param: null'
> class OnlyVararg {
> def foo(a, ... b) { "vararg param: $a, $b" }
> }
> println new OnlyVararg().foo()
> // as expected: 'MME: No signature of method: OnlyVararg.foo() is applicable 
> for argument types: () values: []'
> class Both {
> def foo(a) { "single param: $a" }
> def foo(a, ... b) { "vararg param: $a, $b" }
> }
> println new Both().foo()
> // unexpected:
> // MethodSelectionException: Could not find which method foo() to invoke from 
> this list:
> //  public java.lang.Object Both#foo(java.lang.Object)
> //  public transient java.lang.Object Both#foo(java.lang.Object, 
> [Ljava.lang.Object;)
> {code}
> If the exception is expected then {{OnlyVararg}} case should work too.
> If the exception is unexpected then {{Both#foo(Object)}} should be selected.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)