INRIA / INRIA/spoon

SniperJavaPrettyPrinter is omitting ']' while transforming multi dimensional array with size parameter

Open
#4,181 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

Input :
`private java.util.StringJoiner[][] metrics_B = new java.util.StringJoiner[10][10];`
Expected output :
`private abc.xyz.StringJoiner[][] metrics_B = new abc.xyz.StringJoiner[10][10];`
Actual Output :
`private java.util.StringJoiner[][] metrics_B = new java.util.StringJoiner[10][10;`

Code used for this transformation :
`@Override
public void process(CtArrayTypeReference element) {
CtTypeReference newType = getFactory().Core().createTypeReference();
newType.setSimpleName("abc.xyz.StringJoiner");
element.setComponentType(newType);
}`

Spoon print config :
`launcher.getEnvironment().setPrettyPrinterCreator(() -> new SniperJavaPrettyPrinter(launcher.getEnvironment()));`

Spoon version : 9.1.0-beta-10

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.