-
Notifications
You must be signed in to change notification settings - Fork 897
Closed
Labels
Description
Environment :
- Java 17 Preview
- Gradle 7.6
- SpotLess plugin version :
id("com.diffplug.spotless") version "6.15.0"
SpotLess configuration :
spotless {
java {
googleJavaFormat("1.15.0")
}
}
Issue with complex case :
case ReachableByEmail c && (c instanceof ReachableByPhone)
public class PurchaseService {
String postPurchaseOperation(Customer customer) {
return switch (customer) {
case ReachableByEmail c && (c instanceof ReachableByPhone) ->
String.format("Send message on both email %s and phone number %s",
c.getEmail(),
((ReachableByPhone) c).getPhoneNumber());
case ReachableByEmail customerWithEmail -> "Send message to his address email : "
+ customerWithEmail.getEmail();
case ReachableByPhone customerWithPhone -> "Send message to his phone number : "
+ customerWithPhone.getPhoneNumber();
default -> "Not reachable";
};
}
}
Thrown errors
Caused by: com.google.googlejavaformat.java.FormatterException: 8:13: error: expected token: '&'; generated ( instead
and java.lang.reflect.InvocationTargetException