Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/LS24004504/Fix inStatementDataDefinition by using API directive #640

Conversation

davidepalladino-apuliasoft
Copy link
Collaborator

Description

This work concern /API directive. Is not related to vanilla RPGLE; is a feature of Jariko. For more information about this directive, read this documentation.

Technical notes

The goal of this PR is to solve Cannot find searched value for InStatementDataDefinition name=FOO when FOO is declared as D spec on main program and inline from a program imported with API directive, like this example.

Main program

     D FOO             S             10
     C                   EXSR      SUB_R
      /API QILEGEN,PROGRAM_API

Program imported

     ...
     C     SUB_R         BEGSR
     C                   IF        FOO=''
     ...
     C                   ENDIF
     C                   MOVEL     'FOO'           FOO
     ...
     C                   CALL      'MYPGM'
     C                   PARM                    FOO             10
     ...
     C                   ENDSR

To achieve this goal, thanks of suggestion of @dom-apuliasoft to investigate equals of DataDefinition, I have implemented the missed equals and hashCode methods for InStatementDataDefinition. These are extremely necessary for access to LinkedHashMap's entry: precisely, for getLocal where the searched ('data') is a InStatementDataDefinition but the founded is a DataDefinition.

Related to #LS24004504

Checklist:

  • If this feature involves RPGLE fixes or improvements, they are well-described in the summary.
  • There are tests for this feature.
  • RPGLE code used for tests is easily understandable and includes comments that clarify the purpose of this feature.
  • The code follows Kotlin conventions (run ./gradlew ktlintCheck).
  • The code passes all tests (run ./gradlew check).
  • Relevant documentation is included in the docs directory.

…ng duplicate object with same internal reference ID.
…ataDefinition`. These are required for `values` (of Symbol Table) access when the searched is a `InStatementDataDefinition` but the founded is a `DataDefinition`
Copy link
Collaborator

@lanarimarco lanarimarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very elegant solution

@lanarimarco lanarimarco merged commit 7adf72c into develop Oct 18, 2024
1 check passed
@lanarimarco lanarimarco deleted the bugfix/LS24004504/fix-inStatementDataDefinition-by-using-API branch October 18, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants