[jira] [Updated] (GROOVY-10697) @ToString throws an NPE for POJO with null field

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10697:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> @ToString throws an NPE for POJO with null field
> 
>
> Key: GROOVY-10697
> URL: https://issues.apache.org/jira/browse/GROOVY-10697
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.5
>
>
> {code:java}
> import groovy.transform.*
> @ToString(pojo=true)
> @CompileStatic
> class Clazz {
>     String field = null
> }
> println new Clazz() // NPE!!
> {code}



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


[jira] [Updated] (GROOVY-10699) Unable to infer type argument from the parameter type of a lambda

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10699:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Unable to infer type argument from the parameter type of a lambda
> -
>
> Key: GROOVY-10699
> URL: https://issues.apache.org/jira/browse/GROOVY-10699
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.5
>
>
> I have the following program:
> {code}
> import java.util.function.Function;
> import java.util.function.Consumer;
> import java.util.function.Supplier;
> class A {
>   A(C x) {}
> }
> class C {
>   C(T x ) {}
> }
> class B {
>   B(Consumer x) {}
> }
> class D {
>   D(Supplier x) {}
> }
> class Test {
>   void test() {
> A x = new A<>(new C<>("str")); // type inference works (type 
> inferred based on the constant "str")
> D z = new D<>(() -> "fda"); // type inference works (type 
> inferred based on the return type of the lambda)
> B y = new B<>((String e) -> {return;} ); // type inference 
> doesn't work
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 27: [Static type checking] - Expected type java.lang.Object for 
> lambda parameter: e
>  @ line 27, column 28.
>B y = new B<>((String e) -> {return;} ); // type inference 
> doesn't work
>   ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: 63bcab1bf13fb3811626fb1727c22e86528feb7f)
> **Notes**: As indicated in the accompanying test case, the compiler is unable 
> to infer the type argument of a parameterized constructor call from the 
> parameter of a lambda, although it works for any other case (including the 
> return type of a lambda).



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


[jira] [Updated] (GROOVY-10701) NullPointerException in instruction selection phase when having conditionals with lambdas and function references

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10701:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> NullPointerException in instruction selection phase when having conditionals 
> with lambdas and function references
> -
>
> Key: GROOVY-10701
> URL: https://issues.apache.org/jira/browse/GROOVY-10701
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.5
>
>
> I have the following program
> {code}
> import java.util.function.Function;
> class Test {
>  void m1(Function x) {}
> double m2(double x) {
> return x;
> }
> void m3() {
> m1((true) ? (Double x) -> x : this::m2);
> }
> }
> {code}
> This program crashes the compiler with the following stacktrace
> {code}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'test.groovy' unexpected NullPointerException
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'test.groovy' 
> unexpected NullPointerException
> at 
> org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:647)
> at 
> org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:311)
> at 
> org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:240)
> at 
> org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:165)
> at 
> org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:205)
> at 
> org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:189)
> Caused by: java.lang.NullPointerException: Cannot invoke 
> "org.codehaus.groovy.ast.ClassNode.isInterface()" because "type" is null
> at org.codehaus.groovy.ast.ClassHelper.findSAM(ClassHelper.java:563)
> at org.codehaus.groovy.ast.ClassHelper.isSAMType(ClassHelper.java:538)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkForTargetType(StaticTypeCheckingVisitor.java:4281)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitValueExpression(StaticTypeCheckingVisitor.java:4255)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitTernaryExpression(StaticTypeCheckingVisitor.java:4226)
> at 
> org.codehaus.groovy.ast.expr.TernaryExpression.visit(TernaryExpression.java:44)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2824)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3370)
> at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:420)
> at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:77)
> at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:117)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:204)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitExpressionStatement(StaticTypeCheckingVisitor.java:2205)
> at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
> at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:168)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3991)
> at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:70)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:142)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
> at 
> 

[jira] [Updated] (GROOVY-10693) Bump Spotbugs/Spotbugs annotations to 4.7.1 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10693:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump Spotbugs/Spotbugs annotations to 4.7.1 (build dependency)
> --
>
> Key: GROOVY-10693
> URL: https://issues.apache.org/jira/browse/GROOVY-10693
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>




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


[jira] [Updated] (GROOVY-10696) The DGM removeAll variants which take a closure can be refactored to use removeIf for better efficiency

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10696:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> The DGM removeAll variants which take a closure can be refactored to use 
> removeIf for better efficiency
> ---
>
> Key: GROOVY-10696
> URL: https://issues.apache.org/jira/browse/GROOVY-10696
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.5
>
>
> We'd want all of the normal variations to work unchanged:
> {code}
> def list = ['a', 'b']
> list.removeAll { it == 'b' }
> assert list == ['a']
> def m1 = [a:1, b:2]
> m1.removeAll { k,v -> k == 'b' }
> assert m1 == [a:1]
> def m2 = [a:1, b:2]
> m2.removeAll { k,v -> v == 1 }
> assert m2 == [b:2]
> def m3 = [a:1, b:2]
> m3.removeAll { e -> e.key == 'b' }
> assert m3 == [a:1]
> {code}



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


[jira] [Updated] (GROOVY-10692) Bump log4j2 version to 2.18.0 (test dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10692:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump log4j2 version to 2.18.0 (test dependency)
> ---
>
> Key: GROOVY-10692
> URL: https://issues.apache.org/jira/browse/GROOVY-10692
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>




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


[jira] [Updated] (GROOVY-10691) POJO transform applies to only top-level types

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10691:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> POJO transform applies to only top-level types
> --
>
> Key: GROOVY-10691
> URL: https://issues.apache.org/jira/browse/GROOVY-10691
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 4.0.3
>Reporter: Christopher Smith
>Assignee: Paul King
>Priority: Minor
> Fix For: 4.0.4
>
>
> The logic for the {{@POJO}} annotation is applied only to top-level classes, 
> even if the nested classes are explicitly annotated with {{@CompileStatic}}.
> {code}
> @CompileStatic @POJO
> class MetaClassExcluded {
>   @CompileStatic @POJO
>   static class StillHasMetaClass {}
> }
> {code}
>  



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


[jira] [Updated] (GROOVY-10700) STC cannot locate method specified by interface but supplied by AST transform

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10700:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC cannot locate method specified by interface but supplied by AST transform
> -
>
> Key: GROOVY-10700
> URL: https://issues.apache.org/jira/browse/GROOVY-10700
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Minor
> Fix For: 4.0.5
>
>
> Consider the following:
> {code:groovy}
> package p
> interface A {
>   String decode(String s)
> }
> class B implements A {
>   String decode(String s) { s }
> }
> class C implements A {
>   @Delegate private final B b = new B()
> }
> {code}
> {code:groovy}
> package p
> class D extends C { // implements A
>   @groovy.transform.TypeChecked
>   void test() {
> def x = decode('string')
>   }
> }
> {code}
> The class {{D}} implements {{A}} through its superclass {{C}}, which declares 
> {{decode(String)}}.  However the type-checker says "Cannot find matching 
> method D#decode(java.lang.String). Please check if the declared type is 
> correct and if the method exists."



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


[jira] [Updated] (GROOVY-10684) Support opening the Object browser from within the AST browser

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10684:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Support opening the Object browser from within the AST browser
> --
>
> Key: GROOVY-10684
> URL: https://issues.apache.org/jira/browse/GROOVY-10684
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
> Attachments: image-2022-07-08-02-08-01-765.png, screenshot-1.png, 
> screenshot-2.png
>
>
> !image-2022-07-08-02-08-01-765.png!



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


[jira] [Updated] (GROOVY-10680) GroovyConsole should display record components

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10680:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> GroovyConsole should display record components
> --
>
> Key: GROOVY-10680
> URL: https://issues.apache.org/jira/browse/GROOVY-10680
> Project: Groovy
>  Issue Type: Improvement
>  Components: Groovy Console
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
> Attachments: image-2022-07-07-00-35-37-654.png
>
>
>  !image-2022-07-07-00-35-37-654.png! 



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


[jira] [Updated] (GROOVY-10686) Add tooltips for Object/AST browser to display contents for narrow columns

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10686:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Add tooltips for Object/AST browser to display contents for narrow columns
> --
>
> Key: GROOVY-10686
> URL: https://issues.apache.org/jira/browse/GROOVY-10686
> Project: Groovy
>  Issue Type: Improvement
>  Components: Groovy Console
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
>




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


[jira] [Updated] (GROOVY-10675) Covariant override method regression

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10675:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Covariant override method regression
> 
>
> Key: GROOVY-10675
> URL: https://issues.apache.org/jira/browse/GROOVY-10675
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 5.0.0-alpha-1, 4.0.4
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.18, 3.0.12, 4.0.4
>
>
> Consider the following:
> {code:groovy}
> @FunctionalInterface
> interface A {
> O apply(I in)
> }
> interface B extends A {
> }
> class C implements B {
> @Override String apply(Number n) { '' }
> }
> {code}
> Error ""Method 'apply' from class 'C' does not override method from its 
> superclass or interfaces but is annotated with @Override."



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


[jira] [Updated] (GROOVY-10676) ErrorReporter (used by FileSystemCompiler) can throw an IOOB exception on files with CR only

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10676:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> ErrorReporter (used by FileSystemCompiler) can throw an IOOB exception on 
> files with CR only
> 
>
> Key: GROOVY-10676
> URL: https://issues.apache.org/jira/browse/GROOVY-10676
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>
> Systems using CR only aren't common but Groovy successfully parses such 
> files. This is true for the old and new parser.
> For Groovy versions prior to 3, Antlr2 counted CR as a new line. Antlr4 
> doesn't. This makes a minor difference in the reported line/column numbers in 
> error messages but otherwise isn't a huge issue.
> For places where we use {{ErrorReporter}} however, the CR counting behavior 
> causes a subsequent error.
> Here is an example:
> {code:java}
> import org.codehaus.groovy.tools.ErrorReporter
> try {
>     // error should be at column > 40, first line should be short
>     new GroovyShell().parse('/*\r * some comment\r */\r           class class 
> {}\r')
> } catch(e) {
>     Writer data = new StringWriter()
>     new ErrorReporter(e, true).write(new PrintWriter(data))
> }
> {code}
> Which throws this error:
> {noformat}
> java.lang.StringIndexOutOfBoundsException: begin 10, end 2, length 2
>   at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
>   at java.base/java.lang.String.substring(String.java:1874)
>   at org.codehaus.groovy.control.SourceUnit.getSample(SourceUnit.java:288)
>   at 
> org.codehaus.groovy.control.messages.SyntaxErrorMessage.write(SyntaxErrorMessage.java:54)
>   at 
> org.codehaus.groovy.control.ErrorCollector.write(ErrorCollector.java:306)
> {noformat}



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


[jira] [Updated] (GROOVY-10673) STC inferred type lost in nested closure

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10673:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC inferred type lost in nested closure
> 
>
> Key: GROOVY-10673
> URL: https://issues.apache.org/jira/browse/GROOVY-10673
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.3
>Reporter: Jan Hackel
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.18, 3.0.12, 4.0.4
>
>
> Groovy 4.0.3 fails to compile this code:
>  
> {code:groovy}
> @Grab('org.mockito:mockito-core:4.5.1')
> @Grab('org.junit.jupiter:junit-jupiter-api:5.8.2')
> import groovy.transform.CompileStatic
> import org.junit.jupiter.api.Test
> import org.mockito.Mockito
> import static org.mockito.ArgumentMatchers.anyString
> import static org.mockito.Mockito.when
> @CompileStatic
> class MockitoAnswerTest {
>   @Test
>   void stubbing() {
> def a = Mockito.mock(A)
> when(a.f(anyString())).thenAnswer { i ->
>   new B().tap {
> b = 'Hallo' + i.arguments[0]
>   }
> }
> assert a.f('x') != null
>   }
>   static class B {
> String b
>   }
>   interface A {
> B f(String x)
>   }
> }
> {code}
> It produces an error message like the following:
> {noformat}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> /home/jh/Code/groovy-bugs/src/test/groovy/de/jhunovis/fluentapi/MockitoAnswerTest.groovy:
>  20: [Static type checking] - No such property: arguments for class: 
> java.lang.Object
>  @ line 20, column 24.
>b = 'Hallo' + i.arguments[0]
>   ^
> /home/jh/Code/groovy-bugs/src/test/groovy/de/jhunovis/fluentapi/MockitoAnswerTest.groovy:
>  20: [Static type checking] - Cannot find matching method 
> java.lang.Object#getAt(int). Please check if the declared type is correct and 
> if the method exists.
>  @ line 20, column 23.
>b = 'Hallo' + i.arguments[0]
>  ^
> 2 errors
> {noformat}
>  
> Explicitly typing {{i}} as {{InvocationMock}} makes the code compile.



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


[jira] [Updated] (GROOVY-10690) dump() method produces errors

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10690:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> dump() method produces errors
> -
>
> Key: GROOVY-10690
> URL: https://issues.apache.org/jira/browse/GROOVY-10690
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 4.0.3
> Environment: java --version
> openjdk 17.0.3 2022-04-19
> OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
> OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, 
> sharing)
>Reporter: Alexander Veit
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
>
> Groovy GDK method {{dump()}} produces errors at least since Jave version 16.
> Example:
> {code:java}
> println(new File("foo").dump())
> {code}
> produces
> {noformat}
>  org.codehaus.groovy.runtime.DefaultGroovyMethods
>  cannot access a member of class java.io.File (in module java.base) with 
> modifiers "private final"
>  status=java.lang.IllegalAccessException: class 
> org.codehaus.groovy.runtime.DefaultGroovyMethods cannot access a
>  member of class java.io.File (in module java.base) with modifiers "private 
> transient" prefixLength=java.lang.IllegalAccessException:
>  class org.codehaus.groovy.runtime.DefaultGroovyMethods cannot access a 
> member of class java.io.File (in module java.base)
>  with modifiers "private final transient" 
> filePath=java.lang.IllegalAccessException: class 
> org.codehaus.groovy.runtime.DefaultGroovyMethods
>  cannot access a member of class java.io.File (in module java.base) with 
> modifiers "private transient volatile">
> {noformat}
> To me the best solution would be to respect Java's access modifiers.



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


[jira] [Updated] (GROOVY-10679) Annotations not being correctly placed in native records

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10679:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Annotations not being correctly placed in native records
> 
>
> Key: GROOVY-10679
> URL: https://issues.apache.org/jira/browse/GROOVY-10679
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.3
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>  Labels: annotations
> Fix For: 4.0.4
>
>
> For this code:
> {code:java}
> import java.lang.annotation.*
> import groovy.transform.TupleConstructor
> @Target([ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, 
> ElementType.PARAMETER])
> @Retention(RetentionPolicy.RUNTIME)
> public @interface MyAnno { }
> @MyAnno
> record Car(String make, @MyAnno String model) { }
> assert !Car.getAnnotation(MyAnno)
> assert Car.getMethod('model').getAnnotation(MyAnno)
> assert Car.getConstructor(String, String).getAnnotation(MyAnno)
> assert Car.getConstructor(String, 
> String).getParameterAnnotations()[1][0].annotationType() == MyAnno
> {code}
> Groovy 4 on JDK17 currently fails with:
> {noformat}
> Annotation @MyAnno is not allowed on element RECORD_COMPONENT
> {noformat}
> So, the annotation is showing up where it shouldn't.
> In addition, the annotation isn't showing up in other places where it should.
> TL;DR: We have this working for some cases but not all.



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


[jira] [Updated] (GROOVY-10689) Groovydoc for Groovy 3+ documents classes at too early a phase of compilation

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10689:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovydoc for Groovy 3+ documents classes at too early a phase of compilation
> -
>
> Key: GROOVY-10689
> URL: https://issues.apache.org/jira/browse/GROOVY-10689
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
>
> Groovydoc currently compiles to the CONVERSION phase of the compiler before 
> running the GroovydocVisitor. The visitor adds in some of the information 
> that would appear in later phases but far from all. That phase was selected 
> to align with earlier versions of the tool which don't require all mentioned 
> classes to be in the classpath during groovydoc execution.
> This improvement will move the processing to a later phase (which will 
> require more classes on the classpath) but provide a system property so that 
> the phase can be dialed back if needed for folks where the classpath 
> requirement imposes too great a burden. This improvement will be targeted 
> initially only at Groovy 4+.



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


[jira] [Updated] (GROOVY-10681) Groovysh doesn't handle multiline strings with """ or ''' correctly

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10681:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovysh doesn't handle multiline strings with """ or ''' correctly
> ---
>
> Key: GROOVY-10681
> URL: https://issues.apache.org/jira/browse/GROOVY-10681
> Project: Groovy
>  Issue Type: Bug
>  Components: Groovysh
>Affects Versions: 3.0.9, 4.0.0, 3.0.11, 4.0.3
> Environment: Mac M1
> JVM: GraalVM CE 22.1.0 (17.0.3)
> Groovy 3.0.9 / 3.0.10 / 3.0.11
>Reporter: Marcelo Javier Glezer
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>
> I've embedded a GroovySh console inside a server and using it works fine 
> except when i try to parse multiline strings like:
> a='''Hello
> World'''
> in the console it will fail as soon as i hit enter
> {code:java}
> console:000> a='''Hello
> ERROR org.apache.groovy.parser.antlr4.GroovySyntaxError:
> Unexpected character: '\'' {code}
> and it will point to the third quote on line 1
>  
> On the server side i get this exception:
> {code:java}
> DEBUG [org.apache.groovy.groovysh.CommandsMultiCompleter] Refreshing the 
> completer list
> DEBUG [org.apache.groovy.groovysh.InteractiveShellRunner] Running
> DEBUG [org.apache.groovy.groovysh.InteractiveShellRunner] Read line: 
> a='''Hello
> DEBUG [org.apache.groovy.groovysh.antlr4.RelaxedParser] Parsing:
> a='''Hello
> DEBUG [org.apache.groovy.groovysh.InteractiveShellRunner] Work failed: 
> org.apache.groovy.parser.antlr4.GroovySyntaxError: Unexpected character: '\''
> org.apache.groovy.parser.antlr4.GroovySyntaxError: Unexpected character: '\''
>     at 
> org.apache.groovy.parser.antlr4.SyntaxErrorReportable.throwSyntaxError(SyntaxErrorReportable.java:64)
>     at 
> org.apache.groovy.parser.antlr4.SyntaxErrorReportable.require(SyntaxErrorReportable.java:38)
>     at 
> org.apache.groovy.parser.antlr4.SyntaxErrorReportable.require(SyntaxErrorReportable.java:31)
>     at 
> org.apache.groovy.parser.antlr4.GroovyLexer.UNEXPECTED_CHAR_action(GroovyLexer.java:589)
>     at 
> org.apache.groovy.parser.antlr4.GroovyLexer.action(GroovyLexer.java:468)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerCustomAction.execute(LexerCustomAction.java:98)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerActionExecutor.execute(LexerActionExecutor.java:172)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerATNSimulator.accept(LexerATNSimulator.java:361)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerATNSimulator.failOrAccept(LexerATNSimulator.java:294)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerATNSimulator.execATN(LexerATNSimulator.java:229)
>     at 
> groovyjarjarantlr4.v4.runtime.atn.LexerATNSimulator.match(LexerATNSimulator.java:116)
>     at groovyjarjarantlr4.v4.runtime.Lexer.nextToken(Lexer.java:142)
>     at 
> groovyjarjarantlr4.v4.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:170)
>     at 
> groovyjarjarantlr4.v4.runtime.BufferedTokenStream.fill(BufferedTokenStream.java:488)
>     at groovyjarjarantlr4.v4.runtime.BufferedTokenStream$fill.call(Unknown 
> Source)
>     at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
>     at 
> org.apache.groovy.groovysh.antlr4.RelaxedParser.parse(RelaxedParser.groovy:50)
>     at org.apache.groovy.groovysh.Parsing$parse.call(Unknown Source)
>     at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
>     at org.apache.groovy.groovysh.Parser.parse(Parser.groovy:67)
>     at org.apache.groovy.groovysh.Parser$parse.call(Unknown Source)
>     at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
>     at org.apache.groovy.groovysh.Groovysh.execute(Groovysh.groovy:190)
>     at org.apache.groovy.groovysh.Shell.leftShift(Shell.groovy:121)
>     at org.apache.groovy.groovysh.Shell$leftShift$0.call(Unknown Source)
>     at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>     at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>     at 
> 

[jira] [Updated] (GROOVY-10671) STC fails to compile AssertJ fluent API expression

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10671:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC fails to compile AssertJ fluent API expression
> --
>
> Key: GROOVY-10671
> URL: https://issues.apache.org/jira/browse/GROOVY-10671
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.3
>Reporter: Jan Hackel
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> Groovy 4.0.3 fails to compile this class:
>  
> {code:groovy}
> @Grab('org.assertj:assertj-core:3.22.0')
> @Grab('org.junit.jupiter:junit-jupiter-api:5.8.2')
> import groovy.transform.CompileStatic
> import org.junit.jupiter.api.Test
> import static org.assertj.core.api.Assertions.assertThat
> @CompileStatic
> class AssertJSelfTypesWithCollection {
>   @Test
>   void chainWithAs() {
> def texts = someStrings()
> assertThat(texts)
>   .as('a test')
>   .containsExactlyInAnyOrderElementsOf(['a', 'b'])
>   }
>   private static Collection someStrings() {
> return ['a', 'b']
>   }
> }
> {code}
> It produces a message like
> {noformat}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> /home/jh/Code/groovy-bugs/src/test/groovy/de/jhunovis/fluentapi/AssertJSelfTypesWithCollection.groovy:
>  14: [Static type checking] - Cannot find matching method 
> SELF#containsExactlyInAnyOrderElementsOf(java.util.List). 
> Please check if the declared type is correct and if the method exists.
>  @ line 14, column 5.
>assertThat(texts)
>^
> 1 error
> {noformat}



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


[jira] [Updated] (GROOVY-10667) Wrong Type-Inference in `instanceof` block

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10667:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Wrong Type-Inference in `instanceof` block
> --
>
> Key: GROOVY-10667
> URL: https://issues.apache.org/jira/browse/GROOVY-10667
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 4.0.3
> Environment: I tried Java 8 and 17. Both from a Gradle 7.1 project.
>Reporter: Jan Hackel
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> Groovy 4.0.3 produces the error
> {{[Static type checking] - Cannot find matching method 
> de.jhunovis.instance_of.MethodArgumentTypeInferenceErrorTest#doSomethingWithException(de.jhunovis.instance_of.MethodArgumentTypeInferenceErrorTest$Tagged).
>  Please check if the declared type is correct and if the method exists.}}
> for this piece of code:
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> class MethodArgumentTypeInferenceErrorTest {
>   private static interface Tagged {
> String getTag()
>   }
>   private static class TaggedException extends RuntimeException implements 
> Tagged {
> String tag
>   }
>   void cannotFindMatchingMethod() {
> doSomethingWith(new TaggedException(tag: 'Test'))
>   }
>   private static void doSomethingWith(Exception e) {
> if (e instanceof Tagged) {
>   println e.tag
>   doSomethingWithException(e)
> }
>   }
>   private static void doSomethingWithException(Exception exception) {
>   }
> }
> {code}
> It seems the `instanceof` confuses the type-inference.



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


[jira] [Updated] (GROOVY-10654) Cannot pass enum literal to ASTTransformationCustomizer

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10654:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Cannot pass enum literal to ASTTransformationCustomizer
> ---
>
> Key: GROOVY-10654
> URL: https://issues.apache.org/jira/browse/GROOVY-10654
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 4.0.3
>Reporter: Martin Häusler
>Assignee: Eric Milles
>Priority: Major
>  Labels: compilerconfiguration, scripting
> Fix For: 2.5.18, 3.0.12, 4.0.4
>
>
> Please consider the following compiler configuration:
> {code:java}
> var config = new CompilerConfiguration();
> var extensions = new ArrayList()
> var timedInterruptParams = new HashMap()
> // this works (value is a constant):
> timedInterruptParams.put("value", 100);
> // this does not work (value is an enum literal):
> timedInterruptParams.put("unit", TimeUnit.MILLISECONDS);
> config.addCompilationCustomizers(
> new ASTTransformationCustomizer(timedInterruptParams, 
> TimedInterrupt.class)
> );
> {code}
>  According to the documentation of ASTTransformationCustomizer, it should be 
> possible to override any property from the annotation (TimedInterrupt in this 
> case) by storing it into the parameters map (with the name of the annotation 
> field as key). While this works nicely for numbers and strings, it currently 
> doesn't seem to work for enum literals. When this configuration is used to 
> compile a script, the compiler will throw a runtime exception where it claims 
> that "TimeUnit.MILLISECONDS is not a valid constant". This should be 
> adressed, as enum literals are perceived as constants by most developers.
>  
> The following line is a valid workaround for the time being:
> {code:java}
> timedInterruptParams.put("unit", propX(classX(TimeUnit.class), 
> TimeUnit.MILLISECONDS.toString()), {code}
>  



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


[jira] [Updated] (GROOVY-10661) Support launching of ObjectExplorer when property rows are double-clicked

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10661:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Support launching of ObjectExplorer when property rows are double-clicked
> -
>
> Key: GROOVY-10661
> URL: https://issues.apache.org/jira/browse/GROOVY-10661
> Project: Groovy
>  Issue Type: Improvement
>  Components: Groovy Console, Groovysh
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>
> Also includes displaying the "path" traversed to get to the currently 
> displayed object.



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


[jira] [Updated] (GROOVY-10651) STC: closure parameter type inference for raw type that is iterable over type parameter

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10651:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: closure parameter type inference for raw type that is iterable over type 
> parameter
> ---
>
> Key: GROOVY-10651
> URL: https://issues.apache.org/jira/browse/GROOVY-10651
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 2.5.17, 3.0.11, 4.0.3
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> Consider the following:
> {code:java}
> abstract class TreeNode> implements Iterable {
>   @Override
>   Iterator iterator() {
>   }
> }
> {code}
> {code:groovy}
> void proc(TreeNode node) {
>   node.eachWithIndex { child, index ->
> proc(child) // Cannot find matching method #proc(java.lang.Object)
>   }
> }
> {code}



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


[jira] [Updated] (GROOVY-10660) STC: infer closure/lambda parameter types for return expression

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10660:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: infer closure/lambda parameter types for return expression
> ---
>
> Key: GROOVY-10660
> URL: https://issues.apache.org/jira/browse/GROOVY-10660
> Project: Groovy
>  Issue Type: Improvement
>  Components: Static Type Checker
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> Consider the following:
> {code:groovy}
> import java.util.function.BiConsumer
> @groovy.transform.TypeChecked
> def BiConsumer> m() {
>   return (text, list) -> {
> // ...
>   }
> }
> {code}
> The types of "text" and "list" are not known and errors occur for String or 
> List method calls.
> https://github.com/groovy/groovy-eclipse/issues/1327
> https://github.com/groovy/groovy-eclipse/issues/1373



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


[jira] [Updated] (GROOVY-10663) PackageHelperImpl#getPackageNames unable to find package from path or jars that contains plus sign

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10663:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> PackageHelperImpl#getPackageNames unable to find package from path or jars 
> that contains plus sign
> --
>
> Key: GROOVY-10663
> URL: https://issues.apache.org/jira/browse/GROOVY-10663
> Project: Groovy
>  Issue Type: Bug
>  Components: Groovysh
>Affects Versions: 3.x, 2.5.x, 4.x, 5.x
> Environment: Linux, java8u332
>Reporter: Justin Chu
>Assignee: Paul King
>Priority: Minor
> Fix For: 2.5.18, 3.0.12, 4.0.4
>
>
> PackageHelperImpl#getPackageNames would not be able to find and return
> the package names if the package path or filename of the jar contains
> plus signs due to the behavior of URLDecoder#decode.
> URLDecoder#decode would decode the plus sign (i.e. {{{}+{}}}) as empty space, 
> causing {{{}java.io.FileNotFoundException{}}}.
>  
> To reproduce the issue, include a plus sign in the {{groovyVersion}} in the 
> {{{}gradle.properties{}}}, e.g. {{{}5.0.0+SNAPSHOT{}}}, then run the 
> {{{}PackageHelperImplTest{}}}, and {{testLoadAndGetPackagesEmpty}} would fail.
>  
> {code}
> WARN [org.apache.groovy.groovysh.util.PackageHelperImpl] Error opening jar 
> file : 
> '/home/jus/repos/apache/groovy/build/libs/groovy-raw-5.0.0+SNAPSHOT.jar' : 
> java.io.FileNotFoundException: 
> /home/jus/repos/apache/groovy/build/libs/groovy-raw-5.0.0 SNAPSHOT.jar (No 
> such file or directory)
> ...
> {code}
>  
> Proposing the fix
> Use {{Paths.get(url.toURI()).toFile()}} instead of {{{}new 
> File(URLDecoder.decode(url.file, 'UTF-8')){}}}.
>  
> Github PR: [https://github.com/apache/groovy/pull/1731]



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


[jira] [Updated] (GROOVY-10659) Parrot Parser: named arguments does not support all key expressions

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10659:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Parrot Parser: named arguments does not support all key expressions
> ---
>
> Key: GROOVY-10659
> URL: https://issues.apache.org/jira/browse/GROOVY-10659
> Project: Groovy
>  Issue Type: Bug
>  Components: parser-antlr4
>Reporter: Michal Ševčenko
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>
> This is IMO a regression (wrt. e.g. Groovy 2.4.11), the following does not 
> compile in Groovy 3.0.10.
> {code:java}
> def fun = { arg ->
>     return arg
> }
> fun (
>     x: 1,
>     [a: 1]: '2'
> ){code}
> This is the combination of the following:
>  * map literal is used as an argument of a function, without enclosing 
> brackets (I hope this  is legal)
>  * another map literal is used as a key of the outer map (I hope this is 
> legal too)
> If both these preconditions are met, the compiler complains with:
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> index.groovy: 5: Unexpected input: '(' @ line 5, column 5.
>    fun (
>        ^
> 1 error {code}
> This does compile:
> {code:java}
> def fun = { arg ->
>     return arg
> }
> fun (
>     x: 1,
>     a: '2'
> ){code}
> So does this:
> {code:java}
> def fun = { arg ->
>     return arg
> }
> fun ([
>     x: 1,
>     [a: 1]: '2'
> ]) {code}
> Is this a bug?



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


[jira] [Updated] (GROOVY-10662) Fail to substitute type variable when encountering conflicting type parameter with a bound

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10662:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Fail to substitute type variable when encountering conflicting type parameter 
> with a bound
> --
>
> Key: GROOVY-10662
> URL: https://issues.apache.org/jira/browse/GROOVY-10662
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> This might be related to GROOVY-10367 and GROOVY-10309.
> I have the following program:
> {code}
> class A {
>   A(T p1, X p2) {}
>   void foo(X x) {}
> }
> class B {
>   void test() {
> T x = (T) null;
> Character y = (Character) 'd';
> new A<>(y, x).foo((T) null);
>   }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 12: [Static type checking] - Cannot find matching method 
> A#foo(T). Please check if the declared type is correct and if the method 
> exists.
>  @ line 12, column 5.
>new A<>(y, x).foo((T) null);
>^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> **Notes:** To trigger this bug, the following conditions should be met:
>   1. The second type parameter of class A must have the same name with the 
> type parameter of class B.
>   2. We must use the diamond operator for constructing the receiver object at 
> line 12.
> Tested against master (commit: fface1c9fe7f20a1d4c50b4cb00ead62bfaa31cb)



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


[jira] [Updated] (GROOVY-10653) SC: support extension or variadic method reference with instance expression

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10653:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> SC: support extension or variadic method reference with instance expression
> ---
>
> Key: GROOVY-10653
> URL: https://issues.apache.org/jira/browse/GROOVY-10653
> Project: Groovy
>  Issue Type: Improvement
>  Components: Static compilation
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> Case #1:
> {code:groovy}
> @CompileStatic
> int test(CharSequence chars) {
> IntSupplier sizing = chars::size // from StringGroovyMethods
> return sizing.getAsInt()
> }
> {code}
> "size" is extension method (static method from another class).  Currently 
> this errors at runtime: Incorrect number of parameters for static method 
> invokeStatic 
> org.codehaus.groovy.runtime.StringGroovyMethods.size:(CharSequence)int; 0 
> captured parameters, 0 functional interface method parameters, 1 
> implementation parameters
> Case #2:
> {code:groovy}
> class C {
> List m(... args) {
> [this,*args]
> }
> }
> @CompileStatic
> void test(C c) {
> BiFunction two = c::m
> def list = two.apply(1,2)
> assert list.size() == 3
> assert list[0] == c
> assert list[1] == 1
> assert list[2] == 2
> }
> test(new C())
> {code}
> "m" requires an adapter method (in the enclosing script class), which results 
> in a static method in a different class from that of "c".



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


[jira] [Updated] (GROOVY-10665) Add some other known "internal" packages to the sanitized stacktrace list.

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10665:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Add some other known "internal" packages to the sanitized stacktrace list.
> --
>
> Key: GROOVY-10665
> URL: https://issues.apache.org/jira/browse/GROOVY-10665
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.4
>
>
> Probably jdk.internal, org.apache.groovy, groovyjarjarasm and com.sun.



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


[jira] [Updated] (GROOVY-10640) Bump findsecbugs-plugin to 1.12.0 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10640:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump findsecbugs-plugin to 1.12.0 (build dependency)
> 
>
> Key: GROOVY-10640
> URL: https://issues.apache.org/jira/browse/GROOVY-10640
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3, 3.0.12
>
>




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


[jira] [Updated] (GROOVY-10626) --enable-preview doesn't show in CLI/help for groovysh

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10626:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> --enable-preview doesn't show in CLI/help for groovysh
> --
>
> Key: GROOVY-10626
> URL: https://issues.apache.org/jira/browse/GROOVY-10626
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> The --enable-preview switch has been enabled for all command line scripts 
> which leverage startGroovy common base. This includes groovysh. But it isn't 
> reflected in the groovysh CLI, so it reports as an unknown option and also 
> doesn't show up in the help.



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


[jira] [Updated] (GROOVY-10639) Bump Spotbugs/Spotbugs annotations to 4.7.0 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10639:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump Spotbugs/Spotbugs annotations to 4.7.0 (build dependency)
> --
>
> Key: GROOVY-10639
> URL: https://issues.apache.org/jira/browse/GROOVY-10639
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>




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


[jira] [Updated] (GROOVY-10641) Bump json-unit (test dependency) to 2.35.0

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10641:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump json-unit (test dependency) to 2.35.0
> --
>
> Key: GROOVY-10641
> URL: https://issues.apache.org/jira/browse/GROOVY-10641
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>




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


[jira] [Updated] (GROOVY-10627) Bump jackson to 2.13.3

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10627:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump jackson to 2.13.3
> --
>
> Key: GROOVY-10627
> URL: https://issues.apache.org/jira/browse/GROOVY-10627
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>




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


[jira] [Updated] (GROOVY-10633) Invalid type substitution when encountering bounded type parameter and the diamond operator

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10633:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Invalid type substitution when encountering bounded type parameter and the 
> diamond operator
> ---
>
> Key: GROOVY-10633
> URL: https://issues.apache.org/jira/browse/GROOVY-10633
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.4
>
>
> This bug is a regression.
> I have the following program:
> {code}
> class A {
>   B f;
>   A(B x, T y) {}
> }
> class B {
>   void m(T x) {}
> }
> class Test {
>void test() {
> def x = new B();
> new A<>(x, "").f.m((T) null);
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 13: [Static type checking] - Cannot find matching method B#m(T). 
> Please check if the declared type is correct and if the method exists.
>  @ line 13, column 5.
>new A<>(x, "").f.m((T) null);
>^
> 1 error
> {code}
> h3. Expected behaviour 
> Compile successfully
> Tested against master (commit: a976ecdee1f17f7fafc55767de2d857c44d44697)



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


[jira] [Updated] (GROOVY-10635) Method references not working for record components in dynamic code

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10635:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Method references not working for record components in dynamic code
> ---
>
> Key: GROOVY-10635
> URL: https://issues.apache.org/jira/browse/GROOVY-10635
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>
> The following example currently fails.
> {code}
> record Bar(String name) { }
> def bars = [new Bar(name: 'A'), new Bar(name: 'B')]
> assert bars.stream().map(Bar::name).toList() == ['A', 'B']
> {code}
> The error message is:
> {noformat}
> java.lang.IllegalArgumentException: Can not set final java.lang.String field 
> Bar.name to java.lang.Class
> {noformat}
> This is because the metaclass is picking the private field as a property 
> ahead of the same-named accessor method.
> Workaround is to use @CompileStatic.



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


[jira] [Updated] (GROOVY-10637) SC: implicit-this reference to outer class super property produces access error

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10637:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> SC: implicit-this reference to outer class super property produces access 
> error
> ---
>
> Key: GROOVY-10637
> URL: https://issues.apache.org/jira/browse/GROOVY-10637
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 4.0.2
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.3
>
>
> Consider the following:
> {code:java}
> public class JavaBean {
> private T value;
> public T getValue() {
> return value;
> }
> public void setValue(T value) {
> this.value = value;
> }
> }
> {code}
> {code:groovy}
> @groovy.transform.CompileStatic
> class Outer extends groovy.transform.stc.JavaBean {
>   static class Inner {
> String string
>   }
>   def bar() {
> { -> value.string }.call() // "value" is parameterized property
>   }
> }
> def foo = new Outer(value: new Outer.Inner(string:'hello world'))
> assert foo.bar() == 'hello world'
> {code}
> "Access to T#string is forbidden"



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


[jira] [Updated] (GROOVY-10624) Nested diamond operators do not work correctly although the expected type argument is known

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10624:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Nested diamond operators do not work correctly although the expected type 
> argument is known
> ---
>
> Key: GROOVY-10624
> URL: https://issues.apache.org/jira/browse/GROOVY-10624
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> I have the following program:
> {code}
> class C {
>   C(D x) {}
> }
> class D {}
> class Test {
>   void test() {
> C x = new C<>(new D<>()); // type variables are instantiated with 
> type Float because of the left-hand side.
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 10: [Static type checking] - Incompatible generic argument 
> types. Cannot assign C to: C
>  @ line 10, column 18.
>C x = new C<>(new D<>());
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: ee12bb52381e8f0583c61fc25d43de1f55b80a87)



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


[jira] [Updated] (GROOVY-10628) Elvis assignment operator loses type information

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10628:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Elvis assignment operator loses type information
> 
>
> Key: GROOVY-10628
> URL: https://issues.apache.org/jira/browse/GROOVY-10628
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.2
>Reporter: Christopher Smith
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> This class works as expected:
> {code}
> class RoutingInfo {
>   String to
>   void hello() { this.to ?= 'alice' }
> }
> {code}
> Trying to use Elvis assignment from a class _in another file_ (it must be 
> another file) causes the STC to lose track of the type of the RHS and 
> complain that it can't assign Object to String:
> {code}
> class Other {
>   void world() {
> new RoutingInfo().to ?= 'bob'
>   }
> }
> {code}
> {code}
> Groovy:[Static type checking] - Cannot assign value of type java.lang.Object 
> to variable of type java.lang.String
> {code}



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


[jira] [Updated] (GROOVY-10610) Provide a better fallback for running without a security manager for groovysh on JDK18

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10610:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Provide a better fallback for running without a security manager for groovysh 
> on JDK18
> --
>
> Key: GROOVY-10610
> URL: https://issues.apache.org/jira/browse/GROOVY-10610
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> When running {{groovysh}} on JDK18 and above, the use of the security manager 
> to prohibit calling System.exit() needs to be explicitly enabled by setting 
> {{java.security.manager}} to {{allow}}.
> Previously, when setting that property, {{groovysh}} runs (with an expected 
> WARNING) and guards against attempts to call System.exit(). This behavior is 
> unchanged by this issue.
> Previously, when that property is not set, {{groovysh}} won't start and 
> instead fails with an UnsupportedOperationException. This issue changes the 
> behavior when the property is not set to not attempt to use the 
> NoExitSecurityManager. Instead, {{groovysh}} starts but attempts to call 
> System.exit() cause {{groovysh}} to immediately exit.



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


[jira] [Updated] (GROOVY-10618) SC: further optimize cast to bool

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10618:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> SC: further optimize cast to bool
> -
>
> Key: GROOVY-10618
> URL: https://issues.apache.org/jira/browse/GROOVY-10618
> Project: Groovy
>  Issue Type: Improvement
>  Components: Static compilation
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Minor
> Fix For: 4.0.3
>
>
> Implicit boolean conversion is currently handled by invokedynamic cast (see 
> CastSelector) unless the source type is primitive, Boolean or an effectively 
> final class.  The case for null can be handled without the need for a call 
> site / method handle.  Also, the not expression can be optimized somewhat as 
> well.



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


[jira] [Updated] (GROOVY-10612) Tweak plus operation for `Map` instance to align with Java

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10612:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Tweak plus operation for `Map` instance to align with Java
> --
>
> Key: GROOVY-10612
> URL: https://issues.apache.org/jira/browse/GROOVY-10612
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.3
>
>
> The string concatenation for {{Map}} instance of Groovy is not aligned with 
> Java, e.g. the following code can not work:
> {code:java}
> [a:1] + ' is a map'
> {code}
> Here are the error messages:
> {code:java}
> groovy.lang.MissingMethodException: No signature of method: 
> java.util.LinkedHashMap.plus() is applicable for argument types: (String) 
> values: [ is a map]
> Possible solutions: plus(java.util.Collection), plus(java.util.Map), 
> values(), values(), values(), put(java.lang.Object, java.lang.Object)
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:72)
>   at 
> org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:172)
>   at 
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
>   at ConsoleScript2.run(ConsoleScript2:1)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:268)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:374)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:353)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:179)
>   at groovy.console.ui.Console$GroovySourceType.run(Console.groovy:1189)
>   at groovy.console.ui.Console.doRun(Console.groovy:1421)
>   at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:577)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:342)
>   at 
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:63)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
>   at 
> groovy.console.ui.Console$_runScriptImpl_closure23.doCall(Console.groovy:1385)
>   at 
> groovy.console.ui.Console$_runScriptImpl_closure23.doCall(Console.groovy)
>   at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:577)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009)
>   at groovy.lang.Closure.call(Closure.java:418)
>   at groovy.lang.Closure.call(Closure.java:412)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.base/java.lang.Thread.run(Thread.java:833)
> {code}



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


[jira] [Updated] (GROOVY-10608) The default toString for emulated records has caching enabled

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10608:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> The default toString for emulated records has caching enabled
> -
>
> Key: GROOVY-10608
> URL: https://issues.apache.org/jira/browse/GROOVY-10608
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>
> Since records only provide shallow immutability, we should default to not 
> caching. Later, as a future enhancement, we could turn caching back on if we 
> can determine that all record components are indeed immutable, e.g. all 
> primitives or Strings for instance. For now, caching would be enabled using a 
> custom @ToString.



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


[jira] [Updated] (GROOVY-10611) Static fields not initialized when accessed from another class

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10611:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Static fields not initialized when accessed from another class
> --
>
> Key: GROOVY-10611
> URL: https://issues.apache.org/jira/browse/GROOVY-10611
> Project: Groovy
>  Issue Type: Bug
>  Components: Stub generator / Joint compiler
>Affects Versions: 3.0.10
>Reporter: Torbjørn G. Dahle
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> Accessing a static field in a Groovy class from a Java class stops working 
> when upgrading from 3.0.9 to 3.0.10.
> I originally encountered this in a Grails project, but I've managed to make 
> this sort of minimal reproduction here: 
> [https://github.com/torbjorn-boost/groovy-static-field]
> When using 3.0.9, I get this:
> {{{}13:55:15: Executing ':JavaFile.main()'...{}}}{{{}> Task :compileJava 
> NO-SOURCE{}}}
> {{> Task :compileGroovy}}
> {{> Task :processResources NO-SOURCE}}
> {{{}> Task :classes{}}}{{{}> Task :JavaFile.main(){}}}
> {{GroovyFile sees 123}}
> {{JavaFile sees 123}}
>  
> But if I bump to 3.0.10 in build.gradle, this happens:
> {{{}13:56:32: Executing ':JavaFile.main()'...{}}}{{{}> Task :compileJava 
> NO-SOURCE{}}}
> {{> Task :compileGroovy}}
> {{> Task :processResources NO-SOURCE}}
> {{{}> Task :classes{}}}{{{}> Task :JavaFile.main(){}}}
> {{JavaFile sees 0}}
> This happens with JREs 8, 11 and 17.



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


[jira] [Updated] (GROOVY-10622) Wrong type is inferred when involving a bounded type parameter in a parameterized method call

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10622:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Wrong type is inferred when involving a bounded type parameter in a 
> parameterized method call
> -
>
> Key: GROOVY-10622
> URL: https://issues.apache.org/jira/browse/GROOVY-10622
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.3
>
>
> I have the following program
> {code}
> class A {
>   T m() {
> return null;
>   }
> }
> class B {
>   B(byte x) {}
> }
> class C {
>   T x;
>   C(T x) {
> this.x = x;
>   }
> }
> class Test {
>   > void test() {
> C a = new C(null);
> T x = a.x;
> new B(x.m()); // should type check
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 23: [Static type checking] - Cannot find matching method 
> B#(java.lang.Object). Please check if the declared type is correct and 
> if the method exists.
>  @ line 23, column 5.
>new B(x.m());
>^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: ee12bb52381e8f0583c61fc25d43de1f55b80a87)



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


[jira] [Updated] (GROOVY-10619) STC: fix support for unbounded wildcard references to self-bounded type parameters

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10619:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: fix support for unbounded wildcard references to self-bounded type 
> parameters
> --
>
> Key: GROOVY-10619
> URL: https://issues.apache.org/jira/browse/GROOVY-10619
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.2
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
>  Labels: generics
> Fix For: 4.0.3
>
>
> {code:groovy}
> @Grab('org.springframework.boot:spring-boot-starter-webflux:2.6.7')
> import org.springframework.core.ParameterizedTypeReference
> import org.springframework.http.MediaType
> import org.springframework.web.reactive.function.client.WebClient
> import java.time.Duration
> @groovy.transform.CompileStatic
> class WebFluxFluentApiBugTest {
>   private static final ParameterizedTypeReference> TYPE_TAG
> = new ParameterizedTypeReference>() {}
>   private static final Duration MAX_DURATION = Duration.ofSeconds(8)
>   private final WebClient webClient
>   List flux() {
> def response = webClient.get()
>   .uri('/something?id={id}', 'id')
>   .accept(MediaType.APPLICATION_JSON)
>   .retrieve()
>   .toEntity(TYPE_TAG)
>   .block(MAX_DURATION)
> return response.getBody() ?: []
>   }
> }
> {code}



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


[jira] [Updated] (GROOVY-10607) Groovy 4 fails to generate imports during joint compilation

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10607:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovy 4 fails to generate imports during joint compilation
> ---
>
> Key: GROOVY-10607
> URL: https://issues.apache.org/jira/browse/GROOVY-10607
> Project: Groovy
>  Issue Type: Bug
>  Components: Stub generator / Joint compiler
>Affects Versions: 4.0.1
>Reporter: Konstantin Nisht
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.3
>
>
> [This 
> commit|https://github.com/apache/groovy/commit/36d2c3baccfcd7635806db820f7857c42175d6ab]
>  changes the logic of writing imports in stubs. Particularly, non-static 
> imports are no longer written. 
> You can see the difference in this 
> [demo|https://github.com/knisht/groovy-showcases/tree/main/GROOVY-10607] .



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


[jira] [Updated] (GROOVY-10609) The default equals and hashCode implementations for emulated records don't have the pojo flag set for generation

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10609:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> The default equals and hashCode implementations for emulated records don't 
> have the pojo flag set for generation
> 
>
> Key: GROOVY-10609
> URL: https://issues.apache.org/jira/browse/GROOVY-10609
> Project: Groovy
>  Issue Type: Bug
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.3
>
>
> We should set this to maximise the chance of the record not needing the 
> Groovy jar in the classpath.



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


[jira] [Updated] (GROOVY-10587) Groovy resolves wrong annotation type

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10587:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovy resolves wrong annotation type
> -
>
> Key: GROOVY-10587
> URL: https://issues.apache.org/jira/browse/GROOVY-10587
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.10, 4.0.1
>Reporter: Cédric Champeau
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.3
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The issue was initially reported in Micronaut, but it turns out to be a bug 
> in Groovy: [https://github.com/micronaut-projects/micronaut-core/issues/7189]
> The problem is Groovy incorrectly resolving the @Client annotation on the 
> TestClient interface to the inner interface instead of the imported 
> annotation.
> The code below illustrates the bug. It fails to compile.
> {code:java}
> @Grab("io.micronaut:micronaut-http-client-core")
> import io.micronaut.http.client.annotation.Client
> class Application {
> static interface Api {
>  static interface Client extends Api {}
> }
> 
> @Client("/")
> static interface TestClient extends Api.Client {}
> }
> println Application.TestClient.annotations
> {code}



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


[jira] [Updated] (GROOVY-10599) STC: support spread operator for list literals

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10599:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: support spread operator for list literals
> --
>
> Key: GROOVY-10599
> URL: https://issues.apache.org/jira/browse/GROOVY-10599
> Project: Groovy
>  Issue Type: Improvement
>  Components: Static compilation, Static Type Checker
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.3
>
>
> Consider the following:
> {code:groovy}
> void test(List list) { }
> List strings = ['y','z']
> test(['x', *strings])
> {code}
> STC infers wring type for "*strings" which prevents the use of spread for 
> list literals.



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


[jira] [Updated] (GROOVY-10598) BUG! exception in phase 'instruction selection' unexpected NullPointerException

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10598:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> BUG! exception in phase 'instruction selection' unexpected 
> NullPointerException
> ---
>
> Key: GROOVY-10598
> URL: https://issues.apache.org/jira/browse/GROOVY-10598
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 5.x
> Environment: Windows 10, Powershell, IntelliJ 2020.3
>Reporter: Daniel Geiselman
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.3
>
>
> I am getting this in my gradle build after upgrading Gradle to 6.9.2 and 
> Grails to 
> classpath "org.grails:grails-gradle-plugin:5.1.4"
> implementation 'org.grails:grails-dependencies:5.1.7'
> implementation 'org.grails:grails-web-boot:5.1.7'
> implementation 'org.grails:grails-gradle-plugin:5.1.4'
> implementation 'org.grails:grails-core:5.1.7'
> runtimeOnly 'org.grails.plugins:hibernate:4.3.10.7'
> implementation 'org.grails.plugins:spring-security-core:5.0.0'
> implementation group: 'org.grails.plugins', name: 'cache', version: '5.0.1'
> testImplementation 'org.grails:grails-plugin-testing:3.3.0.M2'
> testImplementation 'org.grails:grails-test-mixins:3.3.0'
> testImplementation group: 'org.grails.plugins', name: 'geb', version: '2.0.0'
> compileOnly 'org.grails:grails-console:5.1.7'
>  
> FAILURE: Build failed with an exception.
>  
>  * What went wrong:
> Execution failed for task ':compileTestGroovy'.
> > BUG! exception in phase 'instruction selection' in source unit 
> > 'C:\SVNWorkspace\wholesaler-card-utility\src\test\groovy\com\moo\wholesaler\admin\AuditLoggingControllerSpec.groovy'
> >  unexpected NullPointerException
>  
> When I try to use IntelliJ to debug the code so I can step in and find where 
> it is giving this, it gives me the same failure without hitting a break point.
>  
> Any advice will be helpful.



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


[jira] [Updated] (GROOVY-10593) Groovydoc links to wrong type

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10593:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovydoc links to wrong type
> -
>
> Key: GROOVY-10593
> URL: https://issues.apache.org/jira/browse/GROOVY-10593
> Project: Groovy
>  Issue Type: Bug
>  Components: GroovyDoc
>Affects Versions: 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.0.10, 4.0.0, 
> 4.0.1
>Reporter: Stephane Talbot
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> When I generate groovydoc for the following classes:
> {code:title=a/List.java}
> package a;
> public interface List {}
> {code}
>  
> {code:title=b/Test.groovy}
> package b
> import a.List
> public interface Test extends List {}
> {code}
> Then in the documentation of the Test interface, the _List_ interface is 
> linked with *java.util.List* instead of {*}a.List{*}.
> It was working as expected until Groovy 3.0.4



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


[jira] [Updated] (GROOVY-10596) IF-condition evaluation on the non-null object sometimes doesn't return true

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10596:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> IF-condition evaluation on the non-null object sometimes doesn't return true
> 
>
> Key: GROOVY-10596
> URL: https://issues.apache.org/jira/browse/GROOVY-10596
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.10
>Reporter: Pavel Golovenkov
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> h3. Context
> We use Java 8 (slightly different minor versions on local machines and some 
> ENVs)
> {noformat}
> java version "1.8.0_311"{noformat}
> {noformat}
> java version "1.8.0_321"{noformat}
> Issue started happening after Groovy upgrade from 3.0.9 to 3.0.10
> h3. (Case 1) Test fails when run using "mvn clean install"
> +Tested code sample:+
> {code:java}
> @CompileStatic
> class MetainfoHelper {
> public static final String SCHEMA_KEY_IN_JSON = "\$schema"
> public static final String SCHEMA_KEY_IN_DB = "_\$schema"
> public static void convertSchemaKeyForSavingIntoDB(Document document) {
> String schema = document.getString(SCHEMA_KEY_IN_JSON)
> if (schema) {
> document.remove(SCHEMA_KEY_IN_JSON)
> document.put(SCHEMA_KEY_IN_DB, schema)
> }
> }
> public static void convertSchemaKeyAfterReadingFromDB(Document document) {
> String schema = document.getString(SCHEMA_KEY_IN_DB)
> if (schema) {
> document.remove(SCHEMA_KEY_IN_DB)
> document.put(SCHEMA_KEY_IN_JSON, schema)
> }
> document.remove(ID_IN_DB)
> }
> } {code}
>  
> +Test sample:+
> {code:java}
> @CompileStatic
> @ExtendWith(MockitoExtension.class)
> class MetainfoHelperTest {
> @Test
> void convertSchemaKeyForSavingIntoDBTest() {
> Document document = new Document(MetainfoHelper.SCHEMA_KEY_IN_JSON, 
> "http://json-schema.org/draft-04/schema#;)
> MetainfoHelper.convertSchemaKeyForSavingIntoDB(document)
> assertThat(document.get(MetainfoHelper.SCHEMA_KEY_IN_JSON)).isNull()
> assertThat(document.get(MetainfoHelper.SCHEMA_KEY_IN_DB)).isNotNull()
> }
> @Test
> void convertSchemaKeyBackFromDB() {
> Document document = new Document(MetainfoHelper.SCHEMA_KEY_IN_DB, 
> "http://json-schema.org/draft-04/schema#;)
> MetainfoHelper.convertSchemaKeyAfterReadingFromDB(document)
> assertThat(document.get(MetainfoHelper.SCHEMA_KEY_IN_DB)).isNull()
> 
> assertThat(document.get(MetainfoHelper.SCHEMA_KEY_IN_JSON)).isNotNull()
> }
> } {code}
>  
> h3. (Case 2) At some point of time during the runtime the condition with 
> non-null object reference started to be evaluated as false
> +Affected code part sample:+
> {code:java}
> @CompileStatic
> class DbAcquisitionService implements IDistributedAcquisitionService {
>     @Override
>  T tryAcquire(Class clazz, Map 
> filter, String ownerKey, String ownerInstance, boolean createIfMissing = 
> false) { {
>         final updated = dao.findAndModify(query, updateOperations) as T
> systemLogger.debug("tryAcquire - find and modify completed, updated 
> is [$updated]")
> if (updated) {
> systemLogger.debug("tryAcquire - updated is true")
> return updated
> } else {
> systemLogger.debug("tryAcquire - updated is not true, can't 
> acquire")
> return null
> }
> }
> } {code}
>  
> +Logs at the time of issue:+
> {noformat}
> 2022-04-22 06:23:46.487 - DEBUG - [scheduling-pool-3][80] - 
> c.c.k.c.d.DbAcquisitionService - [] : tryAcquire - find and modify completed, 
> updated is [BpmReceivedTask(bpKey:kmc, 
> taskId:a422a3f0-d37d-4579-81bf-38d7a758ee79)]
> 2022-04-22 06:23:46.487 - DEBUG - [scheduling-pool-3][80] - 
> c.c.k.c.d.DbAcquisitionService - [] : tryAcquire - updated is not true, can't 
> acquire{noformat}
> h3. Fix we made to resolve the issue
> In both cases in order to fix the issue the next change was made:
> {code:java}
> if (object) {
> }{code}
> ==>
> {code:java}
> if (object != null) {
> }{code}
>  
>  
> Do you have any ideas or suggestions why that could happen?



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


[jira] [Updated] (GROOVY-10601) Incompatible generic argument type when combining conditionals and bounded type parameters

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10601:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Incompatible generic argument type when combining conditionals and bounded 
> type parameters
> --
>
> Key: GROOVY-10601
> URL: https://issues.apache.org/jira/browse/GROOVY-10601
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> I have the following program
> {code}
> class Foo {}
> class Test {
>   public static > T test() {
> T x = (T) null;
> T y = (true) ? x : (T) null;
> y
>   }
> }
> {code}
> h3. Actual behaviour
> The compiler rejects the program with
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 8: [Static type checking] - Incompatible generic argument types. 
> Cannot assign Foo to: T
>  @ line 8, column 5.
>y
>^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> **NOTE:** This bug occurs only when `test` and `Foo` have type parameters 
> with different names.
> Tested against master (commit: 5c468cd352f37fb5c599a3f51534ffcc55b339ed).



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


[jira] [Updated] (GROOVY-10603) LUB operation returns incorrect result

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10603:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> LUB operation returns incorrect result
> --
>
> Key: GROOVY-10603
> URL: https://issues.apache.org/jira/browse/GROOVY-10603
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> I have the following program
> {code}
> interface Foo {}
> class Bar implements Foo {}
> interface Baz extends Foo {}
> class Qux implements Baz {}
> class Test {
>   public static Foo test() {
> Qux  x = new Qux();
> return (true) ? x : (Bar) null;
> 
>   }
>   
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 13: [Static type checking] - Cannot return value of type 
> groovy.lang.GroovyObject for method returning Foo
>  @ line 13, column 12.
>return (true) ? x : (Bar) null;
>   ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master (commit: 5c468cd352f37fb5c599a3f51534ffcc55b339ed)



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


[jira] [Updated] (GROOVY-10583) Stub generator handles method type parameter bounds incorrectly

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10583:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Stub generator handles method type parameter bounds incorrectly
> ---
>
> Key: GROOVY-10583
> URL: https://issues.apache.org/jira/browse/GROOVY-10583
> Project: Groovy
>  Issue Type: Bug
>  Components: Stub generator / Joint compiler
>Reporter: Krzysztof Sierszeń
>Assignee: Eric Milles
>Priority: Minor
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> A declaration of: 
> {code:java}
> def  List $$(Collection 
> input, Class outputType = Node) {code}
> yields (package FQ names omitted for brevity): 
> {code:java}
> public  java.util.List 
> $$(java.util.Collection> input, 
> java.lang.Class outputType) { return (List)null;} {code}
> which of course doesn't compile, because {{extends SyntaxNode}} does not 
> belong to the type declaration of the method parameter. 
>  
> The issue seems to only affect constrained wildcards, note that the other 
> method parameter turns out just fine. 



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


[jira] [Updated] (GROOVY-10573) Support ASM JDK19 constants

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10573:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Support ASM JDK19 constants
> ---
>
> Key: GROOVY-10573
> URL: https://issues.apache.org/jira/browse/GROOVY-10573
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10579) Type '[I' is not assignable to reference type when using Groovy 3.0.10

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10579:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Type '[I' is not assignable to reference type when using Groovy 3.0.10
> --
>
> Key: GROOVY-10579
> URL: https://issues.apache.org/jira/browse/GROOVY-10579
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.10
>Reporter: Filip Hrisafov
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> We are having a strange problem when using static compile transformation.
> Most likely what we are doing is not the best approach. However, this was 
> working in 3.0.9 and stopped working with 3.0.10.
> If we take this main class:
> {code}
> package org.example;
> import java.util.Collections;
> import java.util.HashMap;
> import java.util.Map;
> import javax.script.Bindings;
> import javax.script.ScriptEngine;
> import javax.script.ScriptException;
> import javax.script.SimpleBindings;
> import org.codehaus.groovy.ast.ClassHelper;
> import org.codehaus.groovy.ast.ClassNode;
> import org.codehaus.groovy.control.CompilerConfiguration;
> import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer;
> import org.codehaus.groovy.jsr223.GroovyScriptEngineImpl;
> import groovy.lang.GroovyClassLoader;
> import groovy.transform.CompileStatic;
> public class GroovyProblemExample {
> public static final String VAR_TYPES = "variable.types";
> public static final ThreadLocal> COMPILE_OPTIONS = 
> new ThreadLocal<>();
> public static void main(String[] args) throws ScriptException {
> ScriptEngine scriptEngine = new 
> GroovyScriptEngineImpl(createClassLoader());
> String script = ""
> + "int sum = 0\n"
> + "for ( i in inputArray ) {\n"
> + "sum += i\n"
> + "}\n"
> + "execution.setVariable(\"sum\", sum)";
> Map input = new HashMap<>();
> TestExecution execution = new TestExecution();
> int[] inputArray = new int[] { 1, 2, 3, 4, 5 };
> input.put("inputArray", inputArray);
> input.put("execution", execution);
> Bindings bindings = createBindings(input);
> COMPILE_OPTIONS.remove();
> Map variableTypes = new HashMap<>();
> for (Map.Entry entry : bindings.entrySet()) {
> variableTypes.put(entry.getKey(),
> ClassHelper.make(entry.getValue().getClass()));
> }
> variableTypes.put("execution", ClassHelper.make(TestExecution.class));
> Map options = new HashMap<>();
> options.put(VAR_TYPES, variableTypes);
> COMPILE_OPTIONS.set(options);
> scriptEngine.eval(script, bindings);
> System.out.println(execution.getVariable("sum"));
> }
> public static Bindings createBindings(Map parameters) {
> return new SimpleBindings(parameters);
> }
> public static GroovyClassLoader createClassLoader() {
> return new 
> GroovyClassLoader(GroovyProblemExample.class.getClassLoader(), 
> createStaticConfiguration(), true);
> }
> protected static CompilerConfiguration createStaticConfiguration() {
> CompilerConfiguration compilerConfiguration = new 
> CompilerConfiguration();
> ASTTransformationCustomizer astTransformationCustomizer = new 
> ASTTransformationCustomizer(
> Collections.singletonMap("extensions", 
> Collections.singletonList("ExampleExtension.groovy")),
> CompileStatic.class, 
> "org.codehaus.groovy.transform.sc.StaticCompileTransformation");
> 
> compilerConfiguration.addCompilationCustomizers(astTransformationCustomizer);
> return compilerConfiguration;
> }
> public static class TestExecution {
> protected final Map data = new HashMap<>();
> public void setVariable(String name, Object value) {
> data.put(name, value);
> }
> public Object getVariable(String name) {
> return data.get(name);
> }
> }
> }
> {code}
> and this extension:
> {code}
> import static org.example.GroovyProblemExample.COMPILE_OPTIONS
> import static org.example.GroovyProblemExample.VAR_TYPES
> def typesOfVariables = COMPILE_OPTIONS.get()[VAR_TYPES]
> unresolvedVariable { var ->
> if (typesOfVariables[var.name]) {
> return makeDynamic(var, typesOfVariables[var.name])
> }
> }
> {code}
> Running the main class with Groovy 3.0.9 we have 15 printed out in the 
> console. However, running it with 3.0.10 we get the following error:
> {code}
> Exception in thread "main" java.lang.VerifyError: Bad type on operand stack 
> in aaload
> Exception Details:
>   Location:
>

[jira] [Updated] (GROOVY-10586) Revert: Funnel doPrivileged through VMPlugin (JEP-411)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10586:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Revert: Funnel doPrivileged through VMPlugin (JEP-411)
> --
>
> Key: GROOVY-10586
> URL: https://issues.apache.org/jira/browse/GROOVY-10586
> Project: Groovy
>  Issue Type: Sub-task
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>
> Rather than following the original work for GROOVY-10393, the plan will be to 
> implement runtime version checks instead where needed and phase out use of 
> the deprecated for removal APIs in a future Groovy version. Further 
> discussion will occur on the mailing lists. This issue will put the old code 
> back in place and suppress warnings related to the "deprecated for removal" 
> API calls.



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


[jira] [Updated] (GROOVY-10580) Conditionally initialized `final` variables considered maybe uninitialized

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10580:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Conditionally initialized `final` variables considered maybe uninitialized
> --
>
> Key: GROOVY-10580
> URL: https://issues.apache.org/jira/browse/GROOVY-10580
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.1
>Reporter: V
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Running the following in `groovyConsole`:
> {code:groovy}
> final int i
> final boolean a = true
> if (a) {
> i = 1
> } else {
> throw new IllegalStateException('a is false')
> }
> println "i = $i"
> {code}
> would give me:
> {noformat}
> 1 compilation error:
> The variable [i] may be uninitialized
> . At [9:15] at line: 9, column: 15
> {noformat}
> It seems groovyc does not take throwing an exception as a non-reachable 
> branch.
> This code is almost a verbatim copy from a java code that is working.
> This looks similar to GROOVY-8472, and a few others.



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


[jira] [Updated] (GROOVY-10585) `@AutoFinal` does not use annotation parameters when used with `ASTTransformationCustomizer`

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10585:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> `@AutoFinal` does not use annotation parameters when used with 
> `ASTTransformationCustomizer`
> 
>
> Key: GROOVY-10585
> URL: https://issues.apache.org/jira/browse/GROOVY-10585
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.1
>Reporter: V
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> When used with `ASTTransformationCustomizer` (like below) or in a 
> configscript (`ast(AutoFinal)`, which I think is also using an 
> `ASTTransformationCustomizer`), `@AutoFinal` does not seem to take the 
> annotation parameters. Applying it individually seems to be fine. A test case 
> to demonstrate this:
> {code:groovy}
> class AnnotationParameterTest {
>   private static GroovyShell getLoggerShell() {
> final CompilerConfiguration configuration = new CompilerConfiguration()
> configuration.addCompilationCustomizers(
> new ASTTransformationCustomizer(Log, value: 'logger'),
> new ASTTransformationCustomizer(AutoFinal, enabled: false))
> return new GroovyShell(configuration)
>   }
>   @Test
>   void testAnnotationParameters() {
> getLoggerShell().run('''
>   @groovy.transform.AutoFinal(enabled = false) // Removing this line 
> would fail the test.
>   class Foo {
> void testMutation(int i) {
>   i = 1
>   logger.severe("i = $i")
> }
>   }
>   new Foo().testMutation(2)''', 'Test')
>   }
> }
> {code}
> If the `AutoFinal` annotation *in the script* is removed, the test will fail. 
> In which case, `AutoFinal` is applied, but not with the annotation 
> parameters. I added a `Log` AST transformation just to make sure I used the 
> right way to apply an AST transformation with annotation parameters.
> Not so related:
> Why do I want `AutoFinal(enabled = false)` via `ASTTransformationCustomizer`? 
> I was trying to apply `AutoFinal` on all possible types. However `AutoFinal` 
> would throw an exception when applied on an interface. And I was testing 
> whether I could use `SourceAwareCustomizer` to disable `AutoFinal` for 
> interfaces.



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


[jira] [Updated] (GROOVY-10572) Bump json-unit (test dependency) to 2.33.0

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10572:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump json-unit (test dependency) to 2.33.0
> --
>
> Key: GROOVY-10572
> URL: https://issues.apache.org/jira/browse/GROOVY-10572
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10578) Groovydoc noscripts and nomainforscripts options no longer work

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10578:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovydoc noscripts and nomainforscripts options no longer work
> ---
>
> Key: GROOVY-10578
> URL: https://issues.apache.org/jira/browse/GROOVY-10578
> Project: Groovy
>  Issue Type: Bug
>  Components: GroovyDoc
>Affects Versions: 3.0.10, 4.0.1
> Environment: Linux, Java 11, Groovy 3.0.10 and 4.0.2.
>Reporter: Octavia Togami
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.12, 4.0.4
>
>
> Groovydoc used to support the {{noscripts}} option to not include scripts, 
> and {{nomainforscripts}} to exclude the script's main method from the 
> documentation. As of Groovy 3, these options no longer work, because they 
> were only part of the old parser, and never added to the new one. They should 
> either be removed from the documentation and API, or reimplemented.
> Reproduction:
> 1. Make a Script.groovy
> 2. Run {{groovydoc -noscripts --destdir=doc . Script.groovy}} under Groovy 2
> 3. Notice that the Script class is NOT in the docs.
> 4. Run {{groovydoc -noscripts --destdir=doc . Script.groovy}} under Groovy 3 
> or 4.
> 5. Notice that the Script class is now in the docs.
> A similar set of steps can be used for {{nomainforscripts}}.



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


[jira] [Updated] (GROOVY-10570) AnnotationCollector produces unspecified errors when used in Java

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10570:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> AnnotationCollector produces unspecified errors when used in Java
> -
>
> Key: GROOVY-10570
> URL: https://issues.apache.org/jira/browse/GROOVY-10570
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 4.0.1
>Reporter: Christopher Smith
>Assignee: Eric Milles
>Priority: Minor
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> I have an {{AnnotationCollector}} that refers to some Java classes (type 
> converters). The stub generator has an error generating the stub, so I tried 
> writing the annotation itself in Java. While this compiled correctly, when 
> compiling tests using that annotation I get a BUG! in the Groovy compiler:
> {code}
> BUG! exception in phase 'semantic analysis' in source unit 
> '/home/christopher/git/.../IgnoreMetaClassAttributeConverterProviderTest.groovy'
>  com.example.DynamoDbRecord.value()
> ...
> Caused by: java.lang.NoSuchMethodException: com.example.DynamoDbRecord.value()
> at java.lang.Class.getMethod (Class.java:2108)
> at 
> org.codehaus.groovy.transform.AnnotationCollectorTransform.getTargetListFromClass
>  (AnnotationCollectorTransform.java:276)
> at org.codehaus.groovy.transform.AnnotationCollectorTransform.getMeta 
> (AnnotationCollectorTransform.java:76)
> at 
> org.codehaus.groovy.transform.AnnotationCollectorTransform.getStoredTargetList
>  (AnnotationCollectorTransform.java:226)
> at 
> org.codehaus.groovy.transform.AnnotationCollectorTransform.getTargetAnnotationList
>  (AnnotationCollectorTransform.java:356)
> at org.codehaus.groovy.transform.AnnotationCollectorTransform.visit 
> (AnnotationCollectorTransform.java:383)
> at 
> org.codehaus.groovy.transform.ASTTransformationCollectorCodeVisitor.findCollectedAnnotations
>  (ASTTransformationCollectorCodeVisitor.java:207)
> at 
> org.codehaus.groovy.transform.ASTTransformationCollectorCodeVisitor.visitAnnotations
>  (ASTTransformationCollectorCodeVisitor.java:93)
> {code}
> Adding a {{String value default ""}} to the annotation produces an NPE.
> It would make sense to me to learn that using {{AnnotationCollector}} in Java 
> is unsupported, but the Groovy compiler should probably have a better error 
> report.



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


[jira] [Updated] (GROOVY-10569) Bump asm to 9.3

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10569:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump asm to 9.3
> ---
>
> Key: GROOVY-10569
> URL: https://issues.apache.org/jira/browse/GROOVY-10569
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10576) STC: map putAll fails to match "?" to "Object"

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10576:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: map putAll fails to match "?" to "Object"
> --
>
> Key: GROOVY-10576
> URL: https://issues.apache.org/jira/browse/GROOVY-10576
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> class C {
>   Map map
>   void test(Map m) {
> map.putAll(m)
>   }
> }
> {code}
> {{javac}} allows {{putAll}} in this situation.  {{groovyc}} emits an error: 
> Cannot call {{java.util.Map#putAll(java.util.Map ? extends java.lang.Object>)}} with arguments {{[java.util.Map java.lang.String, ?>]}}



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


[jira] [Updated] (GROOVY-10554) Bump javaparser to 3.24.2

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10554:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump javaparser to 3.24.2
> -
>
> Key: GROOVY-10554
> URL: https://issues.apache.org/jira/browse/GROOVY-10554
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10565) JDK 17: Sealed classes inside a package cause Exception in thread "main" java.lang.ClassFormatError: Illegal class name

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10565:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> JDK 17: Sealed classes inside a package cause Exception in thread "main" 
> java.lang.ClassFormatError: Illegal class name
> ---
>
> Key: GROOVY-10565
> URL: https://issues.apache.org/jira/browse/GROOVY-10565
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.0, 4.0.1
>Reporter: Szymon Stępniak
>Assignee: Paul King
>Priority: Critical
>  Labels: ClassFormatError
> Fix For: 4.0.2
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I have found an issue with using sealed types that are inside a package. I 
> took the example from the Groovy 4 release notes and I run it successfully - 
> all classes in this example use the default package. However, when I took the 
> same code and I put it in any package (e.g. `example` package), the execution 
> started failing with:
> {code:bash}
> Exception in thread "main" java.lang.ClassFormatError: Illegal class name 
> "example.Empty" in class file example/Tree
> at java.base/java.lang.ClassLoader.defineClass1(Native Method)
> at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
> at 
> java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
> at 
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
> at java.base/java.lang.ClassLoader.defineClass1(Native Method)
> at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
> at 
> java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
> at 
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
> at 
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
> at example.notworking.run(notworking.groovy:20)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
> at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1369)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1103)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009)
> at 
> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:610)
> at 
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:593)
> at 
> org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:413)
> at 
> org.codehaus.groovy.runtime.InvokerHelper$runScript.callStatic(Unknown Source)
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:54)
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:217)
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:240)
> at example.notworking.main(notworking.groovy)
> {code}
> Here is the code that produces this error:
> {code:groovy}
> package example
> import groovy.transform.Canonical
> sealed interface Tree {}
> @Singleton final class Empty implements Tree {
> String toString() 

[jira] [Updated] (GROOVY-10564) Bump jackson databind version to 2.13.2.2

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10564:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump jackson databind version to 2.13.2.2
> -
>
> Key: GROOVY-10564
> URL: https://issues.apache.org/jira/browse/GROOVY-10564
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10540) Inconsistent application of and checking for GroovyObject in classgen

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10540:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Inconsistent application of and checking for GroovyObject in classgen
> -
>
> Key: GROOVY-10540
> URL: https://issues.apache.org/jira/browse/GROOVY-10540
> Project: Groovy
>  Issue Type: Bug
>  Components: class generator
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
>  Labels: class-generation, platform-consistency
> Fix For: 4.0.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> {{Verifier}} adds {{GroovyObject}} to most classes near the start of the 
> classgen compile phase.  However, classgen proceeds per class node and there 
> are a number of places that check for {{GroovyObject}} and can be subject to 
> order-of-operations issues.
> Consider the following (excerpt of GROOVY-5517 test case):
> {code:groovy}
> class MyHashMap extends HashMap {
> public static int version = 123
> }
> def map = new MyHashMap()
> map['foo'] = 456
> print map.foo
> {code}
> The script class can be processed before {{MyHashMap}} and the checks in 
> {{AsmClassGenerator}} can produce different bytecode depending on detection 
> of {{GroovyObject}} on {{MyHashMap}}.  Under static compilation this means 
> the difference between {{StaticTypesCallSiteWriter#makeGetPropertySite}} and 
> {{StaticTypesCallSiteWriter#makeGroovyObjectGetPropertySite}} for "map.foo".
> https://stackoverflow.com/a/61071840/1082681
> https://github.com/groovy/groovy-eclipse/issues/1353



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


[jira] [Updated] (GROOVY-10562) Bump japicmp plugin to 0.4.0 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10562:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump japicmp plugin to 0.4.0 (build dependency)
> ---
>
> Key: GROOVY-10562
> URL: https://issues.apache.org/jira/browse/GROOVY-10562
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10541) groovysh can not launch when running on Oracle Linux 8.5(ARM)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10541:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> groovysh can not launch when running on Oracle Linux 8.5(ARM)
> -
>
> Key: GROOVY-10541
> URL: https://issues.apache.org/jira/browse/GROOVY-10541
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.1
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.2
>
>
>  
> {code}
> [root@oc3 ~]# groovysh
> java.lang.reflect.InvocationTargetException
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>   at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:568)
>   at 
> org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:112)
>   at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
> Caused by: java.lang.UnsatisfiedLinkError: Could not load library. Reasons: 
> [no jansi in java.library.path: 
> /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib, 
> /tmp/libjansi-64-14886157734275068417.so: 
> /tmp/libjansi-64-14886157734275068417.so: cannot open shared object file: No 
> such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 
> platform)]
>   at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)
>   at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)
>   at org.fusesource.jansi.internal.CLibrary.(CLibrary.java:42)
>   at 
> org.fusesource.jansi.AnsiConsole.wrapOutputStream(AnsiConsole.java:48)
>   at org.fusesource.jansi.AnsiConsole.(AnsiConsole.java:38)
>   at java.base/java.lang.Class.forName0(Native Method)
>   at java.base/java.lang.Class.forName(Class.java:467)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.lambda$createCallStaticSite$2(CallSiteArray.java:64)
>   at 
> java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
>   at org.codehaus.groovy.vmplugin.v8.Java8.doPrivileged(Java8.java:628)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:62)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:155)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:46)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
>   at org.apache.groovy.groovysh.Main.installAnsi(Main.groovy:249)
>   at org.apache.groovy.groovysh.Main.setTerminalType(Main.groovy:235)
>   at org.apache.groovy.groovysh.Main.main(Main.groovy:120)
>   ... 6 more
> {code}



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


[jira] [Updated] (GROOVY-10563) Bump gradle to 7.4.2 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10563:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump gradle to 7.4.2 (build dependency)
> ---
>
> Key: GROOVY-10563
> URL: https://issues.apache.org/jira/browse/GROOVY-10563
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10558) Wrong argument type when using static method from nested class

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10558:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Wrong argument type when using static method from nested class
> --
>
> Key: GROOVY-10558
> URL: https://issues.apache.org/jira/browse/GROOVY-10558
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.16, 3.0.10, 4.0.1
>Reporter: Leonard Brünings
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> {code:groovy}
> class Example {
>     static byte[] hash(byte[] bytes) {
>         bytes
>     }
>     static class Nested {        
>         def getCacheKey(byte[] payload) {
>             hash(payload)
>             // hash(payload as byte[]) fails as well 
>             // Example.hash(payload) works
>         }
>     }
> }
> new Example.Nested().getCacheKey("bar".bytes)
> {code}
> fails with
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: static 
> Example.hash() is applicable for argument types: (ArrayList) values: [[98, 
> 97, 114]]
> Possible solutions: hash([B), each(groovy.lang.Closure), wait(), any(), 
> wait(long), is(java.lang.Object)
>   at Example$Nested.methodMissing(Script1.groovy)
>   at Example$Nested.getCacheKey(Script1.groovy:7)
>   at Example$Nested$getCacheKey.call(Unknown Source)
>   at Script1.run(Script1.groovy:14)
> {noformat}



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


[jira] [Updated] (GROOVY-10560) Provide additional XmlUtil variants for more options when disabling doctypes

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10560:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Provide additional XmlUtil variants for more options when disabling doctypes
> 
>
> Key: GROOVY-10560
> URL: https://issues.apache.org/jira/browse/GROOVY-10560
> Project: Groovy
>  Issue Type: Task
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>  Labels: breaking
> Fix For: 4.0.2
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The main XML processing methods in Groovy default to using secure XML 
> processing. Some less widely used methods don't have that default. This 
> change will incorporate that security measure. For users not using doctype 
> processing, no change should be observed but processing will be more secure. 
> It is a breaking change for anyone explicitly using doctype processing. Such 
> users should use the new variant of each related method that is now provided 
> which allows such processing to be switched back on. These have the same 
> parameters as the existing method but an additional boolean.
> Affected methods:
> {code}
> XmlUtil#serialize(Element)
> XmlUtil#serialize(Element, OutputStream)
> XmlUtil#serialize(Element, Writer)
> XmlUtil#serialize(String)
> XmlUtil#serialize(String, OutputStream)
> XmlUtil#serialize(String, Writer)
> XmlUtil#newSAXParser(String, boolean, boolean, Source...)
> XmlUtil#newSAXParser(String, Source...)
> XmlUtil#newSAXParser(String, boolean, boolean, File)
> XmlUtil#newSAXParser(String, File)
> XmlUtil#newSAXParser(String, boolean, boolean, URL)
> XmlUtil#newSAXParser(String, URL)
> {code}



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


[jira] [Updated] (GROOVY-10556) TypeChecked/CompileStatic index out of bounds

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10556:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> TypeChecked/CompileStatic index out of bounds
> -
>
> Key: GROOVY-10556
> URL: https://issues.apache.org/jira/browse/GROOVY-10556
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation, Static Type Checker
>Affects Versions: 2.5.16, 3.0.10, 4.0.1
>Reporter: Leonard Brünings
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>
> The latest patch release changed something in the type checker that broke the 
> following code. The thing that breaks is the cast {{(B)  this}} if that is 
> replaced with {{this as B}} it works.
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> abstract class Example,  R> {    
>     B fluentMethod() {
>        (B)  this
>     }
> }
>  {code}
> Try it in the [Groovy Web 
> Console|https://gwc-experiment.appspot.com/?g=groovy_3_0=eJxVjkEKwjAQRfc5xSxbKD2BiFTElRt7gphObSDJhMxYWkrvbgwI-hYf5vE_jPWRksAzEc1rK0kHHin59kw-Woe9aLFGqdP_rR-cq0bAOM0Ml0X76PDQAS6CYfgxDdyPDeSADTLqEx2M7oVBbigTDVUNW9GZqqsBZLJcxK52pWKyQVyAa_mwX1nQtzMmthTUd1d4A5E3P54]
>  (as long as the version is still 3.0.10)
> Fails with
> {noformat}
> General error during canonicalization: Index 1 out of bounds for length 1
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
> at 
> org.codehaus.groovy.ast.GenericsType.compareGenericsWithBound(GenericsType.java:369)
> at 
> org.codehaus.groovy.ast.GenericsType.checkGenerics(GenericsType.java:296)
> at 
> org.codehaus.groovy.ast.GenericsType.isCompatibleWith(GenericsType.java:222)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignableTo(StaticTypeCheckingSupport.java:468)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkCast(StaticTypeCheckingVisitor.java:4174)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitCastExpression(StaticTypeCheckingVisitor.java:4141)
> at 
> org.codehaus.groovy.ast.expr.CastExpression.visit(CastExpression.java:90)
> at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:117)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:200)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitExpressionStatement(StaticTypeCheckingVisitor.java:2154)
> at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
> at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:164)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3960)
> at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:2143)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2576)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2539)
> at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitConstructorOrMethod(StaticCompilationVisitor.java:236)
> at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:251)
> at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1100)
> at 
> org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1093)
> at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
> at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:414)
> at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:197)
> at 
> org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:67)
> at 
> 

[jira] [Updated] (GROOVY-10552) @AutoImplement for method with type parameter(s)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10552:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> @AutoImplement for method with type parameter(s)
> 
>
> Key: GROOVY-10552
> URL: https://issues.apache.org/jira/browse/GROOVY-10552
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.15, 3.0.10, 4.0.1
> Environment: Ubuntu 20.04 / Groovy 4.0.1 / OpenJDK 8
>Reporter: Peter Giles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 2.5.17, 3.0.11, 4.0.2
>
>
> I have tried a few permutations of Groovy versions and Java versions, and I 
> can't get this to work with anything I've tried that is above Groovy version 
> 2.5.12:
> {code:java}
> import groovy.transform.AutoImplement
> public class AutoImplementExample {
>     public static void main(String ... args) {
>         def c = new DummyConnection()
>         c.commit()
>     }
> }
> @AutoImplement
> class DummyConnection implements java.sql.Connection {}
> // Name this file AutoImplementExample.groovy and try to compile and run{code}
>  
> For example, with Groovy 4.0.1, JDK 8, and my GROOVY_HOME, PATH, and 
> JAVA_HOME set up as instructed in the installation page for Groovy:
> {noformat}
> ~/groovy-autoimplement$ groovy -version
> Groovy Version: 4.0.1 JVM: 1.8.0_312 Vendor: Private Build OS: Linux
> ~/groovy-autoimplement$ java -version
> openjdk version "1.8.0_312"
> OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)
> OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
> ~/groovy-autoimplement$ groovyc ./AutoImplementExample.groovy
> ~/groovy-autoimplement$ groovy AutoImplementExample
> Caught: java.lang.NullPointerException
> java.lang.NullPointerException
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:203)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:169)
>     at com.sun.beans.TypeResolver.resolve(TypeResolver.java:218)
>     at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:96)
>     at AutoImplementExample.main(AutoImplementExample.groovy:5)
> ~/groovy-autoimplement$ {noformat}
>  
> This stacktrace looks similar to the error I see with other Groovy versions 
> and JDK 8.  The trace looks slightly longer with JDK 11, but everything from 
> AutoImplementExample.groovy:5 and above looks the same, right down to the 
> line numbers.
> I've also run this with *java* (after compiling with {*}groovyc{*}) to make 
> sure there is nothing funny going on when running directly with *groovy* that 
> could be sullying the results.  That's a bit messier to run in that I have to 
> construct a long classpath for all the groovy jars, and for that effort I 
> just get a longer stack trace with the same bits at the top.



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


[jira] [Updated] (GROOVY-10561) @NamedVariant self referential default values are not correctly resolved

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10561:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> @NamedVariant self referential default values are not correctly resolved
> 
>
> Key: GROOVY-10561
> URL: https://issues.apache.org/jira/browse/GROOVY-10561
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.16, 3.0.10, 4.0.1
>Reporter: Leonard Brünings
>Assignee: Paul King
>Priority: Major
>  Labels: named-parameters
> Fix For: 4.0.2
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> If a default parameter refers to another parameter ( {{String language = 
> 'java', String extension = language}} ) it will fail, when the named variant 
> is used.
> {code:groovy}
> import groovy.transform.NamedVariant
> import spock.lang.Specification
> class Demo {
> @NamedVariant
> String fileInSourceSet(String language = 'java', String extension = 
> language) {
> return "$language -> .$extension"
> }
> 
> def test() {
>   assert fileInSourceSet() == 'java -> .java'
>   assert fileInSourceSet('groovy') == 'groovy -> .groovy'
>   assert fileInSourceSet(language: 'kotlin', extension: 'kt') == 
> 'kotlin -> .kt'
> // fails
>   assert fileInSourceSet(language: 'groovy') == 'groovy -> 
> .groovy'
> }
> 
> static main(args) {
> new Demo().test() 
> }
> }
> {code}
> See on 
> [WebConsole|https://gwc-experiment.appspot.com/?g=groovy_3_0=eJyNUU1rwzAMPTe_QpRCEujS-6Bjh1126SWwu0iV4C2Wh610G6P_ff5KWAtl00HgJ72nJ1npd2MFBmvM6asRi-x6Y3VzQE3HF7QKWYqiG9E5eCJt4LsAH48X9YC0YhUP0KuRnrk1k-2oJakyPCIPEw4Eeyhf8YTldibQpxA7ZdiX5q46TwlhSSbLsN4sEncP0GwW2jp2nmOO6Ug9CDmpgspq5Y2TX_DaVw37bCXqRU-3u8t0nzKx0iPyMn6bObu-h_LNyKjYb754D6Bk0VSNoh5b1t_toEc1un9N-Mvl1aWcoKgONCqu0A7u99lDMH3EP6_qJh80KUSBc1FcNP8AgUKxrg]
>  (as long as deployed version is 3.0.10)
> {noformat}
> groovy.lang.MissingPropertyException: No such property: language for class: 
> Demo
>   at Demo.fileInSourceSet(Script1.groovy)
>   at Demo$fileInSourceSet$2.callCurrent(Unknown Source)
>   at Demo.test(Script1.groovy:14)
>   at Demo$test.call(Unknown Source)
>   at Demo.main(Script1.groovy:18)
> {noformat}
> It generates
> {code:java}
> @groovy.transform.Generated
>     public java.lang.String 
> fileInSourceSet(@groovy.transform.NamedParams(value = 
> [@groovy.transform.NamedParam(value = 'language', type = java.lang.String, 
> required = false), @groovy.transform.NamedParam(value = 'extension', type = 
> java.lang.String, required = false)]) java.util.Map namedArgs) {
>         if ( namedArgs == null) {
>             throw new java.lang.IllegalArgumentException('Named parameter map 
> cannot be null')
>         }
>         for (java.lang.String namedArgKey : namedArgs.keySet()) {
>             assert ['language', 'extension'].contains( namedArgKey ) : 
> 'Unrecognized namedArgKey: ' + namedArgKey }
>         return this.fileInSourceSet(namedArgs.containsKey('language') ? 
> namedArgs.language : 'java', namedArgs.containsKey('extension') ? 
> namedArgs.extension : language )
>     }{code}
> The problematic line is {{namedArgs.containsKey('extension') ? 
> namedArgs.extension : language which either would have to duplicate the logic 
> for {{language or use a local variable for it.
> Relates to GROOVY-10261



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


[jira] [Updated] (GROOVY-10553) Regression: Annotation on trait field is illegally duplicated

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10553:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Regression: Annotation on trait field is illegally duplicated
> -
>
> Key: GROOVY-10553
> URL: https://issues.apache.org/jira/browse/GROOVY-10553
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 4.0.1
>Reporter: Christopher Smith
>Assignee: Eric Milles
>Priority: Critical
> Fix For: 4.0.2
>
>
> I have the following types:
> {code}
> trait ShipmentRelated {
>   @NotBlank
>   String shipmentId
> }
> class ShipmentLocationRequest extends Base implements ShipmentRelated {}
> {code}
> In Groovy 3, this compiles correctly:
> {code}
>   private java.lang.String com_example_logistics_ShipmentRelated__shipmentId;
>     descriptor: Ljava/lang/String;
>     flags: (0x0002) ACC_PRIVATE
>     RuntimeVisibleAnnotations:
>   0: #17()    javax.validation.constraints.NotBlank
> {code}
> In Groovy 4 with identical source, I get duplicate annotations (annotation 
> sections?):
> {code}
>   private java.lang.String com_example_logistics_ShipmentRelated__shipmentId;
>     descriptor: Ljava/lang/String;
>     flags: (0x0002) ACC_PRIVATE
>     RuntimeVisibleAnnotations:
>   0: #17()    javax.validation.constraints.NotBlank
>     RuntimeVisibleTypeAnnotations:
>   0: #17(): FIELD    javax.validation.constraints.NotBlank
> {code}
> This causes an {{AnnotationFormatError}} at runtime.



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


[jira] [Updated] (GROOVY-10548) Static compiler allows property access on records but uses wrong method names

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10548:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Static compiler allows property access on records but uses wrong method names
> -
>
> Key: GROOVY-10548
> URL: https://issues.apache.org/jira/browse/GROOVY-10548
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 4.0.1
>Reporter: Christopher Smith
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.2
>
>
> When using the new {{record}} feature, Groovy creates methods that _exactly_ 
> match the property name (without the traditional get/is prefix): 
> {{person.email()}}. In static code, the compiler permits traditional 
> property-style access: {{person.email}}. However, in this case it generates a 
> method call to {{Person.getEmail()}}, and this causes a {{NoSuchMethodError}} 
> at runtime.
> Either the static compiler should error out because there's no visible 
> JavaBean property, or it should generate code calling the record-style 
> accessor.



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


[jira] [Updated] (GROOVY-10539) Bump Spotbugs/Spotbugs annotations to 4.6.0 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10539:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump Spotbugs/Spotbugs annotations to 4.6.0 (build dependency)
> --
>
> Key: GROOVY-10539
> URL: https://issues.apache.org/jira/browse/GROOVY-10539
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10533) Bump jackson to 2.13.2

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10533:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump jackson to 2.13.2
> --
>
> Key: GROOVY-10533
> URL: https://issues.apache.org/jira/browse/GROOVY-10533
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10536) Bump jqwik to 1.6.5 (test dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10536:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump jqwik to 1.6.5 (test dependency)
> -
>
> Key: GROOVY-10536
> URL: https://issues.apache.org/jira/browse/GROOVY-10536
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10537) Bump logback to 1.2.11 (test dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10537:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump logback to 1.2.11 (test dependency)
> 
>
> Key: GROOVY-10537
> URL: https://issues.apache.org/jira/browse/GROOVY-10537
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10520) Incorrect line numbers for Closure classes in AstNode

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10520:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Incorrect line numbers for Closure classes in AstNode
> -
>
> Key: GROOVY-10520
> URL: https://issues.apache.org/jira/browse/GROOVY-10520
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.10
>Reporter: John Engelman
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
> Attachments: GroovyConsole2.5.15_BlockStatement.png, 
> GroovyConsole2.5.15_ClosureExpression.png, 
> GroovyConsole3.0.9_BlockStatement.png, 
> GroovyConsole3.0.9_ClosureExpression.png, image-2022-03-03-19-48-26-005.png
>
>
> The line number recorded in the compiled class for {{Closure}} is incorrect 
> in certain circumstances.
>  
> {noformat}
> 1. void doThing(Closure c) {
> 2.   c.class()
> 3. }
> 4.
> 5. void go() {
> 6.   doThing { // This is a comment
> 7. // And there is no body
> 8.   }
> 9. }{noformat}
> When grabbing the {{lineNumber}} (using javassist and loading the {{doCall}} 
> method from the {{CtClass}} for the {{{}Closure{}}}), it is reported as line 
> 8, where in Groovy 2.5.x it was reported as line 6. Removing the comments but 
> leaving just a new line between the {{{}} and {{}}} (an empty block) has the 
> same result.
> The expected outcome here should be line 6 as that's the start of the closure.
> If you modify the closure like so:
>  
> {noformat}
> 1. void doThing(Closure c) {
> 2.   c.class()
> 3. }
> 4.
> 5. void go() {
> 6.   doThing { // This is a comment
> 7. println "hi"
> 8.   }
> 9. }{noformat}
> The line is reported as line 7. This is also incorrect as that would be the 
> {{BlockStatement}} inside the {{Closure.}}
> Trying to debug the parser, I ended up in {{GroovyParse.blockStatementOpts}} 
> which appears to be setting the {{startLine}} value incorrectly (The below 
> screen shot is from compilation of a similar class where a closure contains 
> only comments). Notice that {{start}} is marked as a line number after 
> {{end}} which can't really be true.
> !image-2022-03-03-19-48-26-005.png!
>  
>  



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


[jira] [Updated] (GROOVY-10538) Bump log4j2 version to 2.17.2 (test dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10538:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump log4j2 version to 2.17.2 (test dependency)
> ---
>
> Key: GROOVY-10538
> URL: https://issues.apache.org/jira/browse/GROOVY-10538
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10535) IF condition on empty Collection has different behavior than null Collection

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10535:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> IF condition on empty Collection has different behavior than null Collection
> 
>
> Key: GROOVY-10535
> URL: https://issues.apache.org/jira/browse/GROOVY-10535
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.10
> Environment: Groovy 3.0.10/OpenJDK 17.0.2 - Ubuntu 21.10
>Reporter: Rodolfo Yanke
>Assignee: Eric Milles
>Priority: Major
> Fix For: 3.0.11, 4.0.3
>
>
> I believe this code should print "something" but doesn't work:
> {code:java}
> @CompileStatic
> class NotWorkingExample {
>   static void main(String[] args) {
> Collection values = null
> for (i in 0..<200_000) {
>   printSomethingIfNotEmpty(values)
> }
> //never printed but it should
> values = ['A']
> printSomethingIfNotEmpty(values)
>   }
>   static printSomethingIfNotEmpty(Collection values) {
> if(values) {
>   println 'something'
> }
>   }
> }
> {code}
> This one does print "something" because we pass an empty collection [] 
> instead of null:
> {code:java}
> @CompileStatic
> class ItWorks {
>   static void main(String[] args) {
>   Collection values = []
>   for (i in 0..<200_000) {
> printSomethingIfNotEmpty(values)
>   }
> //it works because [] was passed in the previous 200k calls
> values = ['A']
> printSomethingIfNotEmpty(values)
>   }
>   static printSomethingIfNotEmpty(Collection values) {
> if(values) {
>   println 'something'
> }
>   }
> }{code}
> Some optimization is done differently when the condition is skipped too many 
> times. Both classes should output "something" on the last method call.
> Thank you for the support.



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


[jira] [Updated] (GROOVY-10519) v9 ClassFinder closes existing FileSystems that it doesn't own

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10519:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> v9 ClassFinder closes existing FileSystems that it doesn't own
> --
>
> Key: GROOVY-10519
> URL: https://issues.apache.org/jira/browse/GROOVY-10519
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 3.0.10, 4.0.0
>Reporter: John Engelman
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.1, 3.0.11
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {noformat}
> org.codehaus.groovy.vmplugin.v9.ClassFinder
> private static FileSystem newFileSystem(URI uri) throws IOException { 
>  
>   try {
> return FileSystems.newFileSystem(uri, Collections.emptyMap());
>   } catch (FileSystemAlreadyExistsException e) {
> return FileSystems.getFileSystem(uri);
>   }
> }
> private static Map> find(URI uri, String prefix, String 
> packageName, boolean recursive) {
>   boolean wfs = "file".equals(uri.getScheme());
>   if (wfs) prefix = prefix.replace("/", File.separator);
>   
>   final String sepPatten = Pattern.quote(wfs ? File.separator : "/"); 
>  
>   final int prefixElemCnt = prefix.trim().isEmpty() ? 0 : 
> prefix.split(sepPatten).length;
>   
>   Map> result = new LinkedHashMap<>();
>   try (FileSystem fs = newFileSystem(uri)) {
> //...
>   }
>   //...
> }{noformat}
> The current implementation of {{ClassFinder}} will close a {{FileSystem}} 
> that was opened prior to loading Groovy classes. Specifically, if an 
> application opens a {{FileSystem}} for a JAR on the classpath that contains 
> Groovy classes and then subsequently loads a Groovy class contained within, 
> then the underlying {{ZipFileSystem}} is closed by {{ClassFinder}} and the 
> original application receives a {{java.nio.file.ClosedFileSystemException}} 
> on subsequent operations.



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


[jira] [Updated] (GROOVY-10534) Bump gradle to 7.4.1 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10534:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump gradle to 7.4.1 (build dependency)
> ---
>
> Key: GROOVY-10534
> URL: https://issues.apache.org/jira/browse/GROOVY-10534
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10528) STC: NPE for raw type instanceof followed by parameterized extension method

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10528:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> STC: NPE for raw type instanceof followed by parameterized extension method
> ---
>
> Key: GROOVY-10528
> URL: https://issues.apache.org/jira/browse/GROOVY-10528
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.1
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.2
>
>
> Consider the following:
> {code:groovy}
> void test(... args) {
> args.each { object ->
> if (object instanceof Iterable) {
> object.each { test(it) }
> }
> }
> }
> test(1,[2,3])
> {code}
> The inferred type of "it" is causing NullPointerException at 
> StaticTypeCheckingSupport.isAssignableTo(StaticTypeCheckingSupport.java:489)



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


[jira] [Updated] (GROOVY-10532) Bump Codenarc to 3.0.0 (build dependency)

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10532:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Bump Codenarc to 3.0.0 (build dependency)
> -
>
> Key: GROOVY-10532
> URL: https://issues.apache.org/jira/browse/GROOVY-10532
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>




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


[jira] [Updated] (GROOVY-10508) DefaultGroovyMethods.get() unexpectedly puts the default value into the origin map

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10508:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> DefaultGroovyMethods.get() unexpectedly puts the default value into the 
> origin map
> --
>
> Key: GROOVY-10508
> URL: https://issues.apache.org/jira/browse/GROOVY-10508
> Project: Groovy
>  Issue Type: Documentation
>Reporter: Shi Tailong
>Assignee: Paul King
>Priority: Minor
> Fix For: 4.0.1
>
>
>  
> {code:java}
> public static  V get(Map map, K key, V defaultValue) {
> if (!map.containsKey(key)) {
> map.put(key, defaultValue);
> }
> return map.get(key);
> } {code}
> Above there's the get() method for ALL maps if there's more than one 
> arguments for this. You can find that it will put the defaultValue into the 
> map if the key doesn't hit.
>  
> It seems not to be an obvious choice for programmers, as the origin map would 
> be CHANGED when the programmer may just want a default value.
> Meanwhile, some of the implements of Map have some restrictions for the 
> values. For example, Redisson doesn't allow null values for its RMap class. 
> So when you're using Redisson in Groovy like this,
>  
> {code:java}
> RMapCache map = redissonClient.getMapCache(SOME_KEY)
> String cachedValue = map.getOrDefault(key, null) {code}
> it will return a NullPointerError like "map value can't be null".
>  



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


[jira] [Updated] (GROOVY-10502) NamedVariant: improve consistency of default value treatment

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10502:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> NamedVariant: improve consistency of default value treatment
> 
>
> Key: GROOVY-10502
> URL: https://issues.apache.org/jira/browse/GROOVY-10502
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.0
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>  Labels: named-parameters
> Fix For: 3.0.10, 4.0.1
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> When adjusting NamedVariant to cater for its use (under the covers) for 
> records, a few anomalies were introduced. The first is fixed in GROOVY-10497. 
> This one covers a left over case for null.
> For this method:
> {code:groovy}
> def x(int one, int two = 42) { "$one $two" }
> {code}
> Calling any of the following will fail with a MissingMethodException:
> {code:groovy}
> x(null)
> x(null, 3)
> x(3, null)
> {code}
> When NamedVariant is applied, e.g.
> {code:groovy}
> @groovy.transform.NamedVariant
> def m(int one, int two = 42) { "$one $two" }
> {code}
> Then all of the following succeed:
> {code:groovy}
> m(one:null) // 0 42
> m(one:null, two:null) // 0 42
> m(one:32, two:null) // 32 42
> m(one:null, two:52) // 0 52
> {code}
> When null is encountered, we supply either the explicit or implicit default 
> value. The purpose of this issue is to revert the behavior of this edge case 
> to more traditional behavior, so the previous calls would all give a 
> MissingMethodException.



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


[jira] [Updated] (GROOVY-10499) Incomplete type variable substitution when using wildcard type and diamond operator

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10499:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Incomplete type variable substitution when using wildcard type and diamond 
> operator
> ---
>
> Key: GROOVY-10499
> URL: https://issues.apache.org/jira/browse/GROOVY-10499
> Project: Groovy
>  Issue Type: Bug
>Reporter: Thodoris Sotiropoulos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.2
>
>
> I have the following groovy program
> {code:java}
> class Foo {
>   Foo(T x) {}
> }
> class Bar {
>   Bar(Foo foo, T p) {
>   }
>   T m(T x) {
> return null;
>   }
> }
> public class Test  {
>   void test() {
> T x = null;
> new Bar<>(new Foo(x), x).m(x);
>   }  
> }
> {code}
> h3. Actual behaviour
> groovyc rejects the program by raising
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 20: [Static type checking] - Cannot find matching method 
> Bar#m(T). Please check if the declared type is correct and if the method 
> exists.
>  @ line 20, column 5.
>new Bar<>(new Foo(x), x).m(x);
>^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully.
> The bug happens when:
> * The constructor of `Bar` expects a parameterized type containing a wildcard 
> type (i.e., `Foo`
> * The constructor of `Bar` expects something of type `T` (i.e., `T p`).
> Tested against master (commit: 85676f1855bbe751bac897ea3fdd900fbbe74ecb).



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


[jira] [Updated] (GROOVY-10512) groovy.sql.Sql : provide a way to get the SQLWarning of a Statement

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10512:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> groovy.sql.Sql : provide a way to get the SQLWarning of a Statement
> ---
>
> Key: GROOVY-10512
> URL: https://issues.apache.org/jira/browse/GROOVY-10512
> Project: Groovy
>  Issue Type: New Feature
>  Components: SQL processing
>Affects Versions: 3.0.9
>Reporter: Philippe Gaudin
>Assignee: Paul King
>Priority: Minor
> Fix For: 4.0.1
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I need a way to be able to retrieve the possible *{{java.sql.SQLWarning}}* on 
> a {{Statement}}, {{Connection}} and {{ResultSet}}.



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


[jira] [Updated] (GROOVY-10497) NamedVariant: default value overrides supplied value if it's falsy

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10497:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> NamedVariant: default value overrides supplied value if it's falsy
> --
>
> Key: GROOVY-10497
> URL: https://issues.apache.org/jira/browse/GROOVY-10497
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.16, 3.0.10, 4.0.0
>Reporter: Eric Milles
>Assignee: Eric Milles
>Priority: Major
>  Labels: named-parameters
> Fix For: 2.5.16, 3.0.10, 4.0.1
>
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> @groovy.transform.NamedVariant
> def m(int one, int two = 42) {
> "$one $two"
> }
> String result = m(one:0, two:0)
> assert result == '0 0' // fails
> {code}



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


[jira] [Updated] (GROOVY-10495) Invalid newlines generated by XmlTemplateEngine

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10495:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Invalid newlines generated by XmlTemplateEngine
> ---
>
> Key: GROOVY-10495
> URL: https://issues.apache.org/jira/browse/GROOVY-10495
> Project: Groovy
>  Issue Type: Bug
>Reporter: Daniel Sun
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.11, 4.0.2
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> In our recent project, we found a formatting bug of {{{}XmlTemplateEngine{}}}:
> We expect the following test pass:
> {code:java}
> XmlTemplateEngine xmlTemplateEngine = new XmlTemplateEngine();
> String xmlScript = "\n"
>  + "  Daniel\n"
>  + "";
> Template template = xmlTemplateEngine.createTemplate(xmlScript);
> 
> assertTrue(template.make().toString().contains("Daniel")); // no 
> newlines
> {code}
> But we get(see the newlines around {{{}Daniel{}}}):
> {code:xml}
> 
>   
> Daniel
>   
> 
> {code}
> As a result, we will get additional newlines if we parse the generated xml 
> and fetch the text of {{name}} element.



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


[jira] [Updated] (GROOVY-10505) TraitComposer should mark generated methods as @Generated

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10505:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> TraitComposer should mark generated methods as @Generated
> -
>
> Key: GROOVY-10505
> URL: https://issues.apache.org/jira/browse/GROOVY-10505
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler
>Affects Versions: 2.5.14
>Reporter: Alar Aule
>Assignee: Paul King
>Priority: Minor
> Fix For: 2.5.16, 3.0.10, 4.0.1
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> I have been marking Grails generated methods as Generated, but there are 
> still open cases and those should be resolved in groovy. 
> [https://github.com/grails/grails-core/issues/11318]
> In Grails with Controllers there is heavy use of Traits and
> {{org.codehaus.groovy.transform.trait.TraitComposer}} class doesn't mark all 
> its generated methods as Generated.
> Example of trait composition:
> {code:java}
> trait TraitA {
> private String variableA
> 
> @groovy.transform.Generated
> String methodA() { "method" }
> }
> trait TraitB {
> private String variableB
> 
> @groovy.transform.Generated
> String methodB() { "i'm method too" }
> }
> trait TraitComposeAB implements TraitA, TraitB {
> 
> }
> class ClassUnderTest implements TraitComposeAB {
> 
> }
> {code}
> For ClassUnderTest the TraitComposer will add methods for traits variables:
> {noformat}
> "public java.lang.String ClassUnderTest.TraitB__variableB$get()"
> "public java.lang.String ClassUnderTest.TraitA__variableA$get()"
> "public java.lang.String 
> ClassUnderTest.TraitA__variableA$set(java.lang.String)"
> "public java.lang.String 
> ClassUnderTest.TraitB__variableB$set(java.lang.String)"
> {noformat}
> and for methods:
> {noformat}
> "public java.lang.String ClassUnderTest.TraitAtrait$super$methodA()"
> "public java.lang.String ClassUnderTest.TraitBtrait$super$methodB()"
> {noformat}
> Those methods I think should be marked as Generated.
> Will provide pull-request soon.



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


[jira] [Updated] (GROOVY-10496) Wrong IntRange.by(...) behaviour for left-open ranges

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10496:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Wrong IntRange.by(...) behaviour for left-open ranges
> -
>
> Key: GROOVY-10496
> URL: https://issues.apache.org/jira/browse/GROOVY-10496
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.0
>Reporter: Timofey Ananyev
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.1
>
>
> Call {{by}} on {{IntRange}} results in loss of information about inclusion of 
> the left border, because {{inclusiveLeft}} flag is not passed into 
> {{NumberRange}} constructor.
> For example, {{5 in (5<..20)}} gives {{false}} when {{5 in (5<..20).by(2)}} 
> gives {{true}}.
> While with {{NumberRange}} {{5 in (5L<..20)}} and {{5 in (5L<..20).by(2)}} 
> both gives {{false}}.
> Also with {{@CompileStatic}} even {{5 in (5<..20)}} gives {{true}}, because 
> new parameter lost in {{RangeExpressionTransformer}}.



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


[jira] [Updated] (GROOVY-10494) Groovy 4 can not compile super.foo with generic interface (or trait) method

2022-07-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10494:
-
Fix Version/s: (was: 5.0.0-alpha-1)

> Groovy 4 can not compile super.foo with generic interface (or trait) method
> ---
>
> Key: GROOVY-10494
> URL: https://issues.apache.org/jira/browse/GROOVY-10494
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 4.0.0
>Reporter: Xiaoguang Wang
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.2
>
> Attachments: image-2022-02-17-10-53-45-797.png, 
> image-2022-02-17-10-56-36-832.png
>
>
> {code:java}
> package com.company.test
> import groovy.transform.CompileStatic
> @CompileStatic
> interface IService {
> default void save(T entity) {
> System.out.println(entity);
> }
> }
> @CompileStatic
> interface IServiceString {
> default void save(String entity) {
> System.out.println(entity);
> }
> }
> @CompileStatic
> class TestGenericGroovy implements IService {
> void save(String entity) {
> // IService.super.save(entity) // works
> super.save(entity) // doesn't work: Groovyc: [Static type checking] - 
> Abstract method save(T) cannot be called directly
> }
> static void main(String[] args) {
> new TestGenericGroovy().save("test")
> }
> }
>  {code}



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


  1   2   >