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

Stefanos Chaliasos updated GROOVY-10129:
----------------------------------------
    Description: 
I have the following Groovy program.
{code:groovy}
class A<T> {}

class B {}

@groovy.transform.TypeChecked
class C<G extends B[]> extends A<G> {} // It works if G extends B
{code}
h2. Actual Behavior

The program does not compile, and I get the following error.
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 8: unable to resolve class G
 @ line 8, column 34.
   class C<G extends B[]> extends A<G> {}
                                    ^

1 error
{code}
h2. Expected Behavior

I would expect the compiler to report a message like the one that javac reports:
{code:java}
error: unexpected type
class C<G extends B[]> extends A<G> {}
                   ^
  required: class
  found:    B[]
1 error
{code}
h2. Comment

Note that with 3.0.8, the compiler does not report any error.
h2. Affected Version

This programs have been tested with the compiler from the master (commit: 
8ea882a587ce3183c95ea1bc19dfc44367dc292e), and 4.0.0-alpha-3.

  was:
I have the following Groovy program.
{code:groovy}
class A<T> {}

class B {}

@groovy.transform.TypeChecked
class C<G extends B[]> extends A<G> {} // It works if G extends B
{code}
h2. Actual Behavior

The program does not compile, and I get the following error.
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 8: unable to resolve class G
 @ line 8, column 34.
   class C<G extends B[]> extends A<G> {}
                                    ^

1 error
{code}
h2. Expected Behavior

Compile successfully.
h2. Comment

This should be a regression bug because it works with 3.0.8.
h2. Affected Version

This programs have been tested with the compiler from the master (commit: 
8ea882a587ce3183c95ea1bc19dfc44367dc292e), and 4.0.0-alpha-3.

        Summary: Misleading report when using as a type argument a type 
parameter that extends an array type  (was: Unable to use as a type argument a 
type parameter that extends an array type)

> Misleading report when using as a type argument a type parameter that extends 
> an array type
> -------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10129
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10129
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 4.0.0-alpha-3
>            Reporter: Stefanos Chaliasos
>            Priority: Major
>
> I have the following Groovy program.
> {code:groovy}
> class A<T> {}
> class B {}
> @groovy.transform.TypeChecked
> class C<G extends B[]> extends A<G> {} // It works if G extends B
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Main.groovy: 8: unable to resolve class G
>  @ line 8, column 34.
>    class C<G extends B[]> extends A<G> {}
>                                     ^
> 1 error
> {code}
> h2. Expected Behavior
> I would expect the compiler to report a message like the one that javac 
> reports:
> {code:java}
> error: unexpected type
> class C<G extends B[]> extends A<G> {}
>                    ^
>   required: class
>   found:    B[]
> 1 error
> {code}
> h2. Comment
> Note that with 3.0.8, the compiler does not report any error.
> h2. Affected Version
> This programs have been tested with the compiler from the master (commit: 
> 8ea882a587ce3183c95ea1bc19dfc44367dc292e), and 4.0.0-alpha-3.



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

Reply via email to