openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.23k stars 332 forks source link

Asses the affects of TypeTree.build and apply a solution that sets the correct types. #2492

Open traceyyoshima opened 1 year ago

traceyyoshima commented 1 year ago

Problem: Multiple issues have been reported related to unexpected changes caused by incorrect type attribution, which were isolated to TypeTree.build. The most notable recipes so far are ChangeType and AddImport, which are used frequently in composite recipes.

Based on previous discussions, we need to assess the effects of using TypeTree.build and replace the builder with an appropriate utility.

traceyyoshima commented 1 year ago

Unassigning myself because I'm focused on other higher-priority work.

tkvangorder commented 1 year ago

Closing this issue after Sam and Tyler reviewed it. We need to have a deeper design discussion around this topic.

traceyyoshima commented 1 year ago

This was already discussed, and we need the means to track the work to look into the uses of TypeTree (used a lot in ChangeType) and the effects on type attribution.

We've had a handful of issues reported related to incorrect results by recipes that were tracked down to type attribution and TypeTree.

The most common type attribution issue has been related to ChangeType and static imports. The issue is essential due to the effects on composite recipes, which make the type attribution challenging to track down.