Support Article
Compilation Error while saving existing Rule Utility Function
SA-36270
Summary
Different versions of the same Rule Utility Function (RUF) has been created leveraging a third party jar imported using a custom codeset.
To comply with changed occurred to the external library a new version of the third party jar has been imported using an updated codeset version.
After this step is not possible anymore to perform a save as of the existing RUF to update the java code of the function.
Error Messages
The following error message is shown on screen:
Error(s) detected while generating java. Compiler reported:
1. ERROR in /com/pegarules/generated/test_myRUF_070321_tF_RRoTOLKesr5IMVF8_Ww.java (at line x)
com.foo.Bar myVariable = new com.foo.Baz();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
com.foo.Baz cannot be resolved to a type
Steps to Reproduce
- Create a code-set with some Java libraries. Version 01-01-01.
- Create a function (ruleset version 01-01-01) that uses this code-set version.
- Save as the function in a different ruleset version (01-01-02)
- Import new versions of Java libraries in code-set. Version 01-01-02.
- Make code-set version 01-01-02 active.
- Create new version of the function (ruleset version 01-01-03).
- Observe the error reported on screen.
Root Cause
A software use or operation error: Previous versions of the function doesn't compile anymore with the new codeset version hence the library cannot be generated correctly.
This is blocking because the previous versions of the same RUF still exists and can be invoked legitimately by applications referencing that particular ruleset version to which the function belongs.
In such cases those applications will break when invoking the function.
Resolution
Perform the following local-changes:
- Temporarily re-enable previous codeset version
- Disable compilation of pre-existing RUFs.
- Activate new codeset version
- Save as the existing RUF into a new version
Published May 11, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.