Skip to content

Support analysis of Java 14+ record classes #118

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

Closed
dsahu75 opened this issue Feb 16, 2025 · 0 comments · Fixed by #121
Closed

Support analysis of Java 14+ record classes #118

dsahu75 opened this issue Feb 16, 2025 · 0 comments · Fixed by #121
Assignees
Labels
breaking Breaking Change enhancement New feature or request kind/feature Feature

Comments

@dsahu75
Copy link

dsahu75 commented Feb 16, 2025

Is your feature request related to a problem? Please describe.
codeanalyzer-java fails to generate a parse tree, symbol table, or call graph when analyzing Java code that includes record declarations. This issue affects the analysis of modern Java applications that make use of record types, introduced in Java 14 and finalized in Java 16, for immutable data structures. The missing support leads to incomplete analysis results and may cause downstream issues when performing dependency analysis or refactoring tasks.

Describe the solution you'd like
Support for record declarations should be added to codeanalyzer-java. Specifically, the tool should:

  • Properly parse record declarations into the internal representation.
  • Consider creating a new entity for the record type.
  • Ensure that record fields are properly registered in the symbol table.
  • Integrate record types with existing analyses such as type resolution and call site detection.

Describe alternatives you've considered
None. Record classes were ignored.

Additional context

  • Example code that currently fails to generate a parse tree or call graph:
    public record Person(String name, int age) {
        public String greet() {
            return "Hello, " + name;
        }
    }
  • Expected behavior:
    • The Person record should appear in the symbol table.
    • The greet method should be included in the call graph.
    • Implicitly generated methods should be accounted for.
@rahlk rahlk self-assigned this Feb 18, 2025
@rahlk rahlk changed the title Record keyword issue Support analysis of Java 14+ record classes Feb 18, 2025
@rahlk rahlk added enhancement New feature or request kind/feature Feature breaking Breaking Change labels Feb 18, 2025
@rahlk rahlk linked a pull request Feb 18, 2025 that will close this issue
9 tasks
@codellm-devkit codellm-devkit deleted a comment from rangeetpan Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking Change enhancement New feature or request kind/feature Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants