Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-728

Unable to use 'var' keyword when a module uses aspects plugin

    XMLWordPrintable

    Details

    • Template:
      Standard Bug Write-Up Format
    • Sprint:
      CP: sprint 102
    • Story Points:
      0.5
    • Development Team:
      Core: Platform

      Description

      Overview: Module build fails with an error when I use var keyword in a module class that uses aspectj-maven-plugin plugin with <configuration><complianceLevel>1.8
      Steps to Reproduce:

      1. Open an API implementation class, e.g. org.folio.rest.impl.ServicePointsUserAPI in mod-inventory-storage;
      2. Add the var keyword somewhere in a class method, e.g. org.folio.rest.impl.ServicePointsUserAPI#deleteServicePointsUsers:
            // here I use the keyword, which should be correctly resolved to PostgresClient type
            final var pgClient = PgUtil.postgresClient(vertxContext, okapiHeaders);
            pgClient.execute(getDeleteAllQuery(okapiHeaders), mutateReply -> {...});
        

        Set <complianceLevel>1.8</complianceLevel> in the configuration section of aspectj-maven-plugin

      3. build the project using maven - mvn clean install -DskipTests

      Expected Results: Project built successfully.
      Actual Results: Build failed with following error:

      [ERROR] Failed to execute goal com.nickwongdev:aspectj-maven-plugin:1.12.6:compile (default) on project mod-inventory-storage: AJC compiler errors:
      [ERROR] error at final var pgClient = PgUtil.postgresClient(vertxContext, okapiHeaders);
      [ERROR]       
      [ERROR] D:\folio\mod-inventory-storage\src\main\java\org\folio\rest\impl\ServicePointsUserAPI.java:29:0::0 var cannot be resolved to a type
      

      Additional Information: The Java 10 keyword 'var' works as expected in tests, but doesn't in production code.
      URL:
      Interested parties: Java devs.

        TestRail: Results

          Attachments

            Activity

              People

              Assignee:
              julianladisch Julian Ladisch
              Reporter:
              bohdan-suprun Bohdan Suprun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  TestRail: Runs

                    TestRail: Cases