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

Stub generator unescapes escaped backslashes in String annotation values

    XMLWordPrintableJSON

Details

    Description

      This is very similar to GROOVY-4604 and GROOVY-4601.

      Groovy code:

      import javax.ws.rs.GET
      import javax.ws.rs.Path
      
      @Path('/')
      class GroovyService {
          @GET
          @Path('{id:[^.]\\.[^.]}')
          String getIt(String id) {
              return id;
          }
      }
      

      Results in stub:

      import java.lang.*;
      import java.io.*;
      import java.net.*;
      import java.util.*;
      import groovy.lang.*;
      import groovy.util.*;
      
      @javax.ws.rs.Path(value="/") public class GroovyService
        extends java.lang.Object  implements
          groovy.lang.GroovyObject {
      ;
      public  groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;}
      public  void setMetaClass(groovy.lang.MetaClass mc) { }
      public  java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;}
      public  java.lang.Object getProperty(java.lang.String property) { return null;}
      public  void setProperty(java.lang.String property, java.lang.Object value) { }
      @javax.ws.rs.GET() @javax.ws.rs.Path(value="{id:[^.]\.[^.]}") public  java.lang.String getIt(java.lang.String id) { return (java.lang.String)null;}
      }
      

      Which results in error:

      GroovyService.java:[17,53] error: illegal escape character
      

      Attachments

        Activity

          People

            paulk Paul King
            svella Shon Vella
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: