error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

Refaster: support method invocation type argument inlining

Open rickie opened this issue 4 years ago • 6 comments

rickie avatar Nov 23 '21 20:11 rickie

Within de Picnic codebase we found more situations where "losing" type arguments during a rewrite can lead to non-compilable code. In the example below the explicit type arguments in ImmutableMap.<K, V>builder() currently don't have any effect, as Refaster currently does not support inlining such type arguments for method invocations.

static final class ImmutableMapBuilder<K, V> {
  @BeforeTemplate
  ImmutableMap.Builder<K, V> before() {
    return new ImmutableMap.Builder<>();
  }

  @AfterTemplate
  ImmutableMap.Builder<K, V> after() {
    return ImmutableMap.<K, V>builder();
  }
}

The changes in this PR resolve this issue. If desired we can update the test in this PR to use the above example instead of the existing ExecutorService#submit example. @cushon if any other changes are required let us know :).

rickie avatar Jan 13 '22 12:01 rickie

Rebased and squashed the two commits, as I'll cherry-pick the changes of this PR to our fork. That said: still interested in seeing this included in mainline Error Prone :upside_down_face:.

Stephan202 avatar Jan 26 '22 17:01 Stephan202

Rebased. Still curious, could this change still get into mainline Error Prone 😄?

rickie avatar Apr 15 '22 07:04 rickie

Rebased and added a commit.

rickie avatar Apr 26 '22 13:04 rickie

Rebased. Is it possible to get this change into mainline Error Prone :smile:?

rickie avatar Jul 07 '22 07:07 rickie

Rebased.

rickie avatar Sep 26 '22 10:09 rickie