javaparser / javaparser/javaparser
MethodCallExpr.clone() loses the parent reference
- Dominant language
- Java
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 17h 36m
- Merged PRs (30d)
- 28
Description
Not sure it's a bug but when we clone MethodCallExpr JavaParser loses the parent reference.
String sample = " { System.out.println(\"\"); }";
Statement stmt = parseStatement(sample);
Optional expr = stmt.findFirst(MethodCallExpr.class);
assertTrue(expr.isPresent());
assertTrue(expr.get().getParentNode().isPresent());
assertTrue(expr.get().clone().getParentNode().isPresent()); // failed
Contributor guide
Research direction
Reproduce the issue with the provided parseStatement sample and inspect MethodCallExpr.clone() together with getParentNode(). Confirm how the cloned expression handles its parent reference, then add a regression test showing the intended behavior and run the relevant JavaParser test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100