What version of OpenRewrite are you using?
I am using
- Maven plugin v6.18.0
- rewrite-migrate-java 3.18.0
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a mutli module project.
<project>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.18.0</version>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.lang.var.UseVarForGenericMethodInvocations</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>3.18.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
What is the smallest, simplest way to reproduce the problem?
class A {
private void dostuff() {
List<String> strs = Collections.synchronizedList(new ArrayList<>());
strs.forEach(this::soString);
}
public void soString(String s) {
System.out.println(s);
}
}
What did you expect to see?
class A {
private void dostuff() {
var strs = Collections.synchronizedList(new ArrayList<String>());
strs.forEach(this::soString);
}
public void soString(String s) {
System.out.println(s);
}
}
What did you see instead?
class A {
private void dostuff() {
var strs = Collections.synchronizedList(new ArrayList<>());
strs.forEach(this::soString);
}
public void soString(String s) {
System.out.println(s);
}
}
What is the full stack trace of any errors you encountered?
Compiler error: incompatible types: invalid method reference
[ERROR] incompatible types: java.lang.Object cannot be converted to java.lang.String
Sure, I'll try and create a unit test for this as a starter and see from there on
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a mutli module project.
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
Compiler error: incompatible types: invalid method reference
[ERROR] incompatible types: java.lang.Object cannot be converted to java.lang.String
Are you interested in contributing a fix to OpenRewrite?
Sure, I'll try and create a unit test for this as a starter and see from there on