Details
-
Bug
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
31.0.0, 31.1.5
-
CP: sprint 102
-
0.5
-
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:
- Open an API implementation class, e.g. org.folio.rest.impl.ServicePointsUserAPI in mod-inventory-storage;
- 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
- 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.