Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8990

No compiler error for mismatched generics when using &

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.16, 3.0.0-alpha-4, 2.5.6
    • Fix Version/s: 3.0.0-beta-1, 2.5.7
    • Component/s: Compiler
    • Labels:
      None

      Description

      Consider the following:

      interface I {}
      class C<T extends Number & I> { T meth() {} }
      
      class X extends C<Integer> {} // should produce error "The type Integer is not a valid substitute for the bounded parameter <T extends java.lang.Number & I>"
      
      new C<Integer>() // should produce error "The type Integer is not a valid substitute for the bounded parameter <T extends java.lang.Number & I>"
      

      If the type bound Number is not satisfied, an error is produced. However, failure to satisfy the additional interface(s) does not produce a compiler error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                emilles Eric Milles
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m