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

@CompileStatic breaks with generic boxed numerics

    XMLWordPrintableJSON

Details

    Description

      class Test {
          @CompileStatic
          void fails1(Map<Integer, Closure<String>> markers, int i) {
              for (e in markers.entrySet()) {
                  print i % e.key
              }
          }
      
          @CompileStatic
          void fails2(Map<Integer, Closure<String>> markers, int i) {
              for (e in markers.entrySet()) {
                  int intKey = e.key
                  print i % intKey
              }
          }
      
          @CompileStatic
          void passes(Map<Integer, Closure<String>> markers, int i) {
              for (e in markers.entrySet()) {
                  print i % e.key.intValue()
              }
          }
      }
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            ddimitrov Dimitar Dimitrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: