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

Groovy 2.5.0 fails to compile Google Java Client sample code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0
    • Fix Version/s: 2.5.1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Ubuntu 18.04, Oracle Java 1.8.0_171-b11, Groovy 2.5.0

      Description

      I have been using Google Java Client libraries with Groovy 2.4.x successfully but now I'm getting multiple compilation errors when trying to upgrade to Groovy 2.5.0. Note that none of the classes mentioned are actually abstract although the 2.5.0 compiler clearly thinks they are.

      @Grab('com.google.apis:google-api-services-analyticsreporting:v4-rev124-1.23.0')
      import com.google.api.services.analyticsreporting.v4.AnalyticsReporting
      @Grab('com.google.apis:google-api-services-sheets:v4-rev525-1.23.0')
      import com.google.api.services.sheets.v4.Sheets
      @Grab('com.google.apis:google-api-services-drive:v3-rev120-1.23.0')
      import com.google.api.services.drive.Drive
      
      final HTTP_TRANSPORT = null
      final JSON_FACTORY = null
      def requestInitializer = null
      def credential = null
      
      def builderAnalytics = new AnalyticsReporting.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
      
      def builderSheets = new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
      
      def builderDrive = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
      
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /home/edited/bug25.groovy: 13: You cannot create an instance from the abstract class 'com.google.api.services.analyticsreporting.v4.AnalyticsReporting$Builder'.
       @ line 13, column 24.
         def builderAnalytics = new AnalyticsReporting.Builder(HTTP_TRANSPORT, JSON_FACTORY, requestInitializer)
                                ^
      
      /home/edited/bug25.groovy: 15: You cannot create an instance from the abstract class 'com.google.api.services.sheets.v4.Sheets$Builder'.
       @ line 15, column 21.
         def builderSheets = new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
                             ^
      
      /home/edited/bug25.groovy: 17: You cannot create an instance from the abstract class 'com.google.api.services.drive.Drive$Builder'.
       @ line 17, column 20.
         def builderDrive = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jwagenleitner John Wagenleitner
                Reporter:
                robokaso Robert Kasanicky
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: