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

Compile error in GString when there is a "." in Map key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-1
    • 1.0-JSR-2
    • parser
    • None
    • Mandrake Linux 10.1
      JDK1.5.0_03

    Description

      Example:
      Map map = new HashMap();
      map.put("table1.first_name", "John");
      map.put("table1.last_name", "Zoetebier");

      Now the following syntax is working:
      String firstName = map.get("table1.first_name");
      println("First name = ${firstName}");

      Each of the following statements throw a compiler error:
      println("First name = ${map.get("table1.first_name")}");
      println("First name = ${map."table1.first_name"}");
      println("First name = ${map["table1.first_name"]}");

      There may be other legal statements as well, but the only working statement is that of the standard Java syntax.

      Attachments

        Issue Links

          Activity

            People

              jstrachan James Strachan
              johnzoet John Zoetebier
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: