[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
Fix Version/s: 3.0.20

> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>Reporter: John DeRegnaucourt
>Assignee: Eric Milles
>Priority: Major
>  Labels: Generics, compiler, crash, parametize, type
> Fix For: 3.0.20, 5.0.0-alpha-3, 4.0.16
>
> Attachments: MapLong-3.groovy, 
> TestCompilerCrashOnTemplateArgCount.groovy
>
>
> When attempting to compile the code below, it causes the Groovy compiler to 
> crash with:
> {code}
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
> {code}
> The crash is caused because the GenericType parameter is missing on line 9 in 
> TestCompilerCrashOnTemplateArgCount:
> {code:groovy}
> private Map map = new MapLong<>()   // causes compiler crash
> {code}
> ...but
> {code:groovy}
> private Map map2 = new MapLong() // doest not cause 
> compiler crash
> {code}
> 1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
> {code:groovy}
> package com.x.y.z
> import groovy.transform.CompileStatic
> @CompileStatic
> class TestCompilerCrashOnTemplateArgCount
> {
> // The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
> during compilation because no type argument passed to MapLong<>()
> private Map map = new MapLong<>()
> 
> // The line below doesn't crash the compiler:
> private Map map2 = new MapLong()
> }
> {code}
> 2nd source file (MapLong.groovy):
> {code:groovy}
> package com.x.y.z
> import groovy.transform.CompileStatic
> @CompileStatic
> class MapLong implements Map
> {
> int size() { return 0  }
> boolean isEmpty() { return false }
> boolean containsKey(Object key) { return false }
> boolean containsValue(Object value) { return false }
> V get(Object key) { return null }
> V put(Long key, V value) { return null }
> V remove(Object key) { return null }
> void putAll(Map m) { }
> void clear() { }
> Set keySet() { return null }
> Collection values() { return null }
> Set> entrySet() { return null }
> }
> {code}
>  
> The compiler is expecting one argument, but a no argument array was 
> allocated.  When it attempts to access the array at element [0], the compiler 
> hits ArrayOutOfBoundsException.
>  
> This is super easy to repeat with the two tiny source files attached.



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


[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-23 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
Fix Version/s: 4.0.16

> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>Reporter: John DeRegnaucourt
>Assignee: Eric Milles
>Priority: Major
>  Labels: Generics, compiler, crash, parametize, type
> Fix For: 5.0.0-alpha-3, 4.0.16
>
> Attachments: MapLong-3.groovy, 
> TestCompilerCrashOnTemplateArgCount.groovy
>
>
> When attempting to compile the code below, it causes the Groovy compiler to 
> crash with:
> {code}
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
> {code}
> The crash is caused because the GenericType parameter is missing on line 9 in 
> TestCompilerCrashOnTemplateArgCount:
> {code:groovy}
> private Map map = new MapLong<>()   // causes compiler crash
> {code}
> ...but
> {code:groovy}
> private Map map2 = new MapLong() // doest not cause 
> compiler crash
> {code}
> 1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
> {code:groovy}
> package com.x.y.z
> import groovy.transform.CompileStatic
> @CompileStatic
> class TestCompilerCrashOnTemplateArgCount
> {
> // The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
> during compilation because no type argument passed to MapLong<>()
> private Map map = new MapLong<>()
> 
> // The line below doesn't crash the compiler:
> private Map map2 = new MapLong()
> }
> {code}
> 2nd source file (MapLong.groovy):
> {code:groovy}
> package com.x.y.z
> import groovy.transform.CompileStatic
> @CompileStatic
> class MapLong implements Map
> {
> int size() { return 0  }
> boolean isEmpty() { return false }
> boolean containsKey(Object key) { return false }
> boolean containsValue(Object value) { return false }
> V get(Object key) { return null }
> V put(Long key, V value) { return null }
> V remove(Object key) { return null }
> void putAll(Map m) { }
> void clear() { }
> Set keySet() { return null }
> Collection values() { return null }
> Set> entrySet() { return null }
> }
> {code}
>  
> The compiler is expecting one argument, but a no argument array was 
> allocated.  When it attempts to access the array at element [0], the compiler 
> hits ArrayOutOfBoundsException.
>  
> This is super easy to repeat with the two tiny source files attached.



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


[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-22 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
  Docs Text:   (was: 1st source file 
(TestCompilerCrashOnTemplateArgCount.groovy)
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}
{code}

2nd source file (MapLong.groovy):
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}
{code})
Description: 
When attempting to compile the code below, it causes the Groovy compiler to 
crash with:
{code}
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
{code}

The crash is caused because the GenericType parameter is missing on line 9 in 
TestCompilerCrashOnTemplateArgCount:
{code:groovy}
private Map map = new MapLong<>()   // causes compiler crash
{code}
...but
{code:groovy}
private Map map2 = new MapLong() // doest not cause 
compiler crash
{code}

1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}
{code}

2nd source file (MapLong.groovy):
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}
{code}

 

The compiler is expecting one argument, but a no argument array was allocated.  
When it attempts to access the array at element [0], the compiler hits 
ArrayOutOfBoundsException.

 

This is super easy to repeat with the two tiny source files attached.

  was:
When attempting to compile the code below, it causes the Groovy compiler to 
crash with:

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
        at 
org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
  

The crash is caused because the GenericType parameter is missing on line 9 in 
TestCompilerCrashOnTemplateArgCount:

private Map map = new MapLong<>()   // causes compiler crash

...but

private Map map2 = new MapLong() // doest not cause 
compiler crash

 

The compiler is expecting one argument, but a no argument array was allocated.  
When it attempts to access the array at element [0], the compiler hits 
ArrayOutOfBoundsException.

 

This is super easy to repeat with the two tiny source files attached.


> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>

[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-22 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
Docs Text: 
1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}
{code}

2nd source file (MapLong.groovy):
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}
{code}

  was:
Below is the code that causes the compiler to crash during compilation.

1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}
{code}

2nd source file (MapLong.groovy):
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}
{code}


> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>Reporter: John DeRegnaucourt
>Assignee: Eric Milles
>Priority: Major
>  Labels: Generics, compiler, crash, parametize, type
> Attachments: MapLong-3.groovy, 
> TestCompilerCrashOnTemplateArgCount.groovy
>
>
> When attempting to compile the code below, it causes the Groovy compiler to 
> crash with:
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
>   
> The crash is caused because the GenericType parameter is missing on line 9 in 
> TestCompilerCrashOnTemplateArgCount:
> private Map map = new MapLong<>()   // causes compiler crash
> ...but
> private Map map2 = new MapLong() // doest not cause 
> compiler crash
>  
> The compiler is expecting one argument, but a no argument array was 
> allocated.  When it attempts to access the array at element [0], the compiler 
> hits ArrayOutOfBoundsException.
>  
> This is super easy to repeat with the two tiny source files attached.



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


[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-22 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
Docs Text: 
Below is the code that causes the compiler to crash during compilation.

1st source file (TestCompilerCrashOnTemplateArgCount.groovy)
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}
{code}

2nd source file (MapLong.groovy):
{code:groovy}
package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}
{code}

  was:
Below is the code that causes the compiler to crash during compilation.

1st source file (TestCompilerCrashOnTemplateArgCount.groovy)

package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class TestCompilerCrashOnTemplateArgCount
{
// The line below crashes Groovy Compiler with ArrayOutOfBoundsException 
during compilation because no type argument passed to MapLong<>()
private Map map = new MapLong<>()

// The line below doesn't crash the compiler:
private Map map2 = new MapLong()
}

2nd source file (MapLong.groovy):

package com.x.y.z
import groovy.transform.CompileStatic
@CompileStatic
class MapLong implements Map
{
int size() { return 0  }
boolean isEmpty() { return false }
boolean containsKey(Object key) { return false }
boolean containsValue(Object value) { return false }
V get(Object key) { return null }
V put(Long key, V value) { return null }
V remove(Object key) { return null }
void putAll(Map m) { }
void clear() { }
Set keySet() { return null }
Collection values() { return null }
Set> entrySet() { return null }
}


> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>Reporter: John DeRegnaucourt
>Assignee: Eric Milles
>Priority: Major
>  Labels: Generics, compiler, crash, parametize, type
> Attachments: MapLong-3.groovy, 
> TestCompilerCrashOnTemplateArgCount.groovy
>
>
> When attempting to compile the code below, it causes the Groovy compiler to 
> crash with:
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
>   
> The crash is caused because the GenericType parameter is missing on line 9 in 
> TestCompilerCrashOnTemplateArgCount:
> private Map map = new MapLong<>()   // causes compiler crash
> ...but
> private Map map2 = new MapLong() // doest not cause 
> compiler crash
>  
> The compiler is expecting one argument, but a no argument array was 
> allocated.  When it attempts to access the array at element [0], the compiler 
> hits ArrayOutOfBoundsException.
>  
> This is super easy to repeat with the two tiny source files attached.



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


[jira] [Updated] (GROOVY-11192) Code that causes Groovy Compiler Crash

2023-10-21 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-11192:
-
Component/s: Static Type Checker
 (was: Compiler)

> Code that causes Groovy Compiler Crash
> --
>
> Key: GROOVY-11192
> URL: https://issues.apache.org/jira/browse/GROOVY-11192
> Project: Groovy
>  Issue Type: Bug
>  Components: Static Type Checker
>Affects Versions: 4.0.15
> Environment: I am running on MacBook Pro, but I think this is a 
> probably regardless of environment. I have been able to repeat this bug for 
> Groovy versions from 3.0.10 to 4.0.15 and all in between.
>Reporter: John DeRegnaucourt
>Priority: Major
>  Labels: Generics, compiler, crash, parametize, type
> Attachments: MapLong-3.groovy, 
> TestCompilerCrashOnTemplateArgCount.groovy
>
>
> When attempting to compile the code below, it causes the Groovy compiler to 
> crash with:
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:494)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.createGenericsSpec(GenericsUtils.java:480)
>         at 
> org.codehaus.groovy.ast.tools.GenericsUtils.parameterizeType(GenericsUtils.java:293)
>   
> The crash is caused because the GenericType parameter is missing on line 9 in 
> TestCompilerCrashOnTemplateArgCount:
> private Map map = new MapLong<>()   // causes compiler crash
> ...but
> private Map map2 = new MapLong() // doest not cause 
> compiler crash
>  
> The compiler is expecting one argument, but a no argument array was 
> allocated.  When it attempts to access the array at element [0], the compiler 
> hits ArrayOutOfBoundsException.
>  
> This is super easy to repeat with the two tiny source files attached.



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