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

@TypeChecked error when calling Standard Java Methods (i.e StringBuilder.append)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.1.0
    • None
    • JDK 1.6u39, IntelliJ IDEA 12.0.3

    Description

      When I call standard (plain simple) Java methods from within a Groovy script, which is annotated by @TypeChecked it seems that I always get back Java Object instances, which causes static type checking errors.

      An example:

      for(String output : RuntimeUtil.getErrOutput()) {
         recordExecutionStep("STDERR", output, "", true);
      }

      Method definitions (written in standard JAVA):

      java.util.List<java.lang.String> getErrOutput();
      void recordExecutionStep(java.lang.String a, java.lang.String b, java.lang.String c, boolean bSuccess)
      

      Error:

      [ERROR] GroovyScript.groovy: 61: [Static type checking] - Cannot find matching method scripts.profile.GroovyScript#recordExecutionStep(java.lang.String, java.lang.Object, java.lang.String, boolean)
      

      So the output String variable is recogniced as a plain Object instance, which causes the error.

      Attachments

        Activity

          People

            melix Cédric Champeau
            stefan_leo Stefan Leonhartsberger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: