Skip to content

Commit 529e4cf

Browse files
authored
[CQ] Language migration: use pattern variables (#8104)
Java 16 introduces [pattern matching](https://dev.java/learn/pattern-matching/) which allows us to cleanup some unnecessary casts. --- - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent 8ea3b61 commit 529e4cf

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

flutter-idea/src/io/flutter/run/LaunchState.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,11 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
137137
device.bringToFront();
138138

139139
// Check for and display any analysis errors when we launch an app.
140-
if (env.getRunProfile() instanceof SdkRunConfig) {
140+
if (env.getRunProfile() instanceof SdkRunConfig config) {
141141
final Class dartExecutionHelper = classForName("com.jetbrains.lang.dart.ide.runner.DartExecutionHelper");
142142
if (dartExecutionHelper != null) {
143143
final String message = ("<a href='open.dart.analysis'>Analysis issues</a> may affect " +
144144
"the execution of '" + env.getRunProfile().getName() + "'.");
145-
final SdkRunConfig config = (SdkRunConfig)env.getRunProfile();
146145
final SdkFields sdkFields = config.getFields();
147146
final MainFile mainFile = MainFile.verify(sdkFields.getFilePath(), env.getProject()).get();
148147

flutter-idea/src/io/flutter/run/test/FlutterTestRunner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
7070
return false;
7171
}
7272

73-
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(((TestConfig)profile).getProject());
73+
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(config.getProject());
7474
if (sdk == null) {
7575
return false;
7676
}

0 commit comments

Comments
 (0)