Skip to content

Commit d742999

Browse files
authored
[CQ] fix nullability problems for flutter/project (#8304)
Fix nullability problems in `src/io/flutter/project/`. See #8291. If we pursue #8292, we could mark `src/io/flutter/project/` as null-"clean". --- - [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 6b34f28 commit d742999

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

flutter-idea/src/io/flutter/project/FlutterIconProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
import java.util.Objects;
2828

2929
public class FlutterIconProvider extends IconProvider {
30-
private static final Icon TEST_FILE = overlayIcons(DartFileType.INSTANCE.getIcon(), AllIcons.Nodes.JunitTestMark);
30+
@SuppressWarnings("DataFlowIssue") private static final @NotNull Icon TEST_FILE =
31+
overlayIcons(DartFileType.INSTANCE.getIcon(), AllIcons.Nodes.JunitTestMark);
3132

3233
@Nullable
3334
public Icon getIcon(@NotNull PsiElement element, @IconFlags int flags) {
@@ -76,7 +77,7 @@ public Icon getIcon(@NotNull PsiElement element, @IconFlags int flags) {
7677
}
7778

7879
@NotNull
79-
private static Icon overlayIcons(@NotNull Icon... icons) {
80+
private static Icon overlayIcons(@NotNull Icon @NotNull ... icons) {
8081
final LayeredIcon result = new LayeredIcon(icons.length);
8182

8283
for (int layer = 0; layer < icons.length; layer++) {

flutter-idea/src/io/flutter/project/FlutterProjectOpenProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public Project doOpenProject(@NotNull VirtualFile file, @Nullable Project projec
7171

7272
@Nullable
7373
protected ProjectOpenProcessor getDelegateImportProvider(@NotNull VirtualFile file) {
74+
//noinspection DataFlowIssue
7475
return EXTENSION_POINT_NAME.getExtensionList().stream().filter(
7576
processor -> processor.canOpenProject(file) && !Objects.equals(processor.getName(), getName())
7677
).findFirst().orElse(null);

flutter-idea/src/io/flutter/project/ProjectWatch.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public void projectClosed(@NotNull Project project) {
4040
};
4141

4242
final ProjectManager manager = ProjectManager.getInstance();
43+
assert manager != null;
4344
manager.addProjectManagerListener(project, listener);
4445

4546
final MessageBusConnection bus = project.getMessageBus().connect();

flutter-idea/src/io/flutter/pub/PubRootCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public PubRoot getRoot(@NotNull PsiFile psiFile) {
4343
}
4444

4545
@Nullable
46-
public PubRoot getRoot(VirtualFile file) {
46+
public PubRoot getRoot(@Nullable VirtualFile file) {
4747
file = findPubspecDir(file);
4848
if (file == null) {
4949
return null;

0 commit comments

Comments
 (0)