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

Java Frontend: Multi-Field declaration statements omit all but their first declaration #1548

Closed
robinmaisch opened this issue Apr 27, 2024 · 0 comments · Fixed by #1558
Closed
Labels
bug Something isn't working java Related to Java language parsing

Comments

@robinmaisch
Copy link
Contributor

In de.fraunhofer.aisec.cpg.frontends.java.DeclarationHandler::242:

// TODO: can field have more than one variable?

The answer is yes :)
Multi-variable declarations are wrapped in a DeclarationStatement, but statements only live inside of methods, so I guess multi-field declarations should be mapped to multiple independent FieldDeclarations. However, the most important thing is that the field declaration appears in the target RecordDeclaration.

Example:

public class Point {
    int x, y;
    ...
}

results in RecordDeclaration with only one field x.
Any access to y will be mapped to a placeholder field declaration.

@KuechA KuechA added java Related to Java language parsing bug Something isn't working labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working java Related to Java language parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants