rewrite-static-analysis
rewrite-static-analysis copied to clipboard
`ReplaceLambdaWithMethodReference` should not strip out method invocations
What is the smallest, simplest way to reproduce the problem?
As seen on https://github.com/openrewrite/rewrite-analysis/pull/28
-return Parameter.viewOf(cursor).map(parameter -> (DataFlowNode) new ParameterDataFlowNode(cursor, parameter)).toOption();
+return Parameter.viewOf(cursor).map(DataFlowNode.class::cast).toOption();
While there is indeed a cast, we should not replace if the righthand side of the cast is not simply the same as the left hand side of the lambda.