How to solve the Invalid method Code length issue?

How to solve the Invalid method Code length issue?

This issues is b/c  the Java code Hit Java limit, which human is impossible to hit but generator hits, this is Java limitation that does not exist in RPG, here is the information you will need in order to solve the issue in the specific functions but also the general solutions if you found this issue in other functions.

The Cause 
  1. So many column in entity (M3 Pattern generate code to support 2E behavior using meta variable loop, if there are too many fields in a variable the generated code may hit the Java limit).
  2. Too much code in the Edit Point.

The general solutions for this are:
  1. Split when possible the Action Diagram code.
  2. Remove unused fields from variables to keep the generated code at minimum.

Example of functions with problems:
Solution 1
Split the next code in subroutines so that the method does not exceed the Java limit.
In the sample below the multiple case statement create a Sub Routine that exceeds the java limit, so split in multiple Sub Routines
      

Solution 2
The problem with this is the M3 meta generates code for each field in the in the variable to support 2E behavior.
In this example the DTL variable, 95+ fields in it but not all of them are used, so you can create a view with only the needed fields and replace the view so that the when Plex generates the Java sources, it only generate code for the used fields.            

NOTE: This is not just for display field, is for any variable, that b/c of the 2E behavior, the M3 patterns needs to gen code for each of field, so is not as simple as figure it out if the field are input capable or not, b/c this can be a Grid or a local variable or even a view, any variable in the function can create this problem.
This is not something you will need to do for all the functions only the ones that you identify with this problem.




    • Related Articles

    • How to submit a code scanning issue

      For issues that are suspected to be related to the code scanning component, please provide the following information attached to the support ticket. Logged output from Standard Output/Standard Error for the scanner XML Output from the scanner (if ...
    • How to prevent/resolve invalid registration license errors

      The machine system id used by the scanner licenses can change in the event of computer hardware configuration changes. If a hardware changes occurs, you will see the following in the scanner log: Invalid Registration for "CAScanner 1": Not registered ...
    • Running the Source Code Scanner

      After an application subdirectory has been loaded into the scanning directory with a valid app.properties file, it will be entered into the source code scanner as a job with pending status. With a web browser on the scanning server, navigate ...
    • Provide a Method to Calculate Values for Derived Attributes

      Plex This example will use the entity OrderDetail where a derived field will be added. Enter the following triple: OrderProcessing.OrderDetail has a derived FLD LineTotal. Generate Changes. On the test Model there is an OrderProcessingbuildObjects ...
    • How to Terminate a WebClient Session Via a Source Code

      Create a source code object called “CloseSession” and add this code: javax.servlet.http.HttpServletRequest req =  (javax.servlet.http.HttpServletRequest) getApp().getFromUserStorage("javax.servlet.http.HttpServletRequest" ); if (req != null) { ...