Skip to content

Commit

Permalink
Handle null function returned from CLion code
Browse files Browse the repository at this point in the history
method is declared as @nullable in CLion SDK
though sdkcompat ignores this hint. fixes bazelbuild#5247.
  • Loading branch information
ujohnny committed Aug 15, 2023
1 parent dd0b5a5 commit d5fa54c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.cpp.cmake.workspace.CMakeNotificationProvider;

import javax.annotation.Nullable;
import javax.swing.*;

// #api223
Expand All @@ -16,7 +17,13 @@ public CMakeNotificationProviderWrapper(){
this.value = new CMakeNotificationProvider();
}

@Nullable
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
return this.value.collectNotificationData(project, virtualFile).apply(fileEditor);
var notificationProducer = this.value.collectNotificationData(project, virtualFile);
if (notificationProducer != null) {
return notificationProducer.apply(fileEditor);
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.cpp.cmake.workspace.CMakeNotificationProvider;

import javax.annotation.Nullable;
import javax.swing.*;

// #api223
Expand All @@ -16,7 +17,13 @@ public CMakeNotificationProviderWrapper(){
this.value = new CMakeNotificationProvider();
}

@Nullable
public JComponent createNotificationPanel(VirtualFile virtualFile, FileEditor fileEditor, Project project) {
return this.value.collectNotificationData(project, virtualFile).apply(fileEditor);
var notificationProducer = this.value.collectNotificationData(project, virtualFile);
if (notificationProducer != null) {
return notificationProducer.apply(fileEditor);
}

return null;
}
}

0 comments on commit d5fa54c

Please sign in to comment.