Skip to content

Commit 759c864

Browse files
committed
DartPlugin.java nits, nullability, etc
1 parent bb25862 commit 759c864

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

flutter-idea/src/io/flutter/dart/DartPlugin.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,25 @@
2222
import org.jetbrains.annotations.Nullable;
2323

2424
import java.util.Collection;
25+
import java.util.Objects;
2526

2627
/**
27-
* Provides access to the Dart Plugin.
28+
* Provides access to the Dart Plugin for IntelliJ.
2829
*/
2930
public class DartPlugin {
3031

3132
/**
3233
* Tracks the minimum required Dart Plugin version.
3334
*/
34-
private static final Version MINIMUM_VERSION = Version.parseVersion("171.3780.79");
35+
@NotNull
36+
private static final Version MINIMUM_VERSION = Objects.requireNonNull(Version.parseVersion("171.3780.79"));
3537

38+
@NotNull
3639
private static final DartPlugin INSTANCE = new DartPlugin();
3740

3841
private Version myVersion;
3942

43+
@NotNull
4044
public static DartPlugin getInstance() {
4145
return INSTANCE;
4246
}
@@ -74,43 +78,44 @@ public static void setPubActionInProgress(boolean inProgress) {
7478
DartPubActionBase.setIsInProgress(inProgress);
7579
}
7680

77-
public static boolean isDartRunConfiguration(ConfigurationType type) {
81+
public static boolean isDartRunConfiguration(@NotNull ConfigurationType type) {
7882
return type.getId().equals("DartCommandLineRunConfigurationType");
7983
}
8084

81-
public static boolean isDartTestConfiguration(ConfigurationType type) {
85+
public static boolean isDartTestConfiguration(@NotNull ConfigurationType type) {
8286
return type.getId().equals("DartTestRunConfigurationType");
8387
}
8488

8589
public static DartSdkUpdateOption doCheckForUpdates() {
8690
return DartSdkUpdateOption.getDartSdkUpdateOption();
8791
}
8892

89-
public static void setCheckForUpdates(DartSdkUpdateOption sdkUpdateOption) {
93+
public static void setCheckForUpdates(@NotNull DartSdkUpdateOption sdkUpdateOption) {
9094
DartSdkUpdateOption.setDartSdkUpdateOption(sdkUpdateOption);
9195
}
9296

9397
/**
94-
* @return the minimum required version of the Dart Plugin
98+
* Return the minimum required {@link Version} of the Dart Plugin.
9599
*/
100+
@NotNull
96101
public Version getMinimumVersion() {
97102
return MINIMUM_VERSION;
98103
}
99104

100105
/**
101-
* @return the version of the currently installed Dart Plugin
106+
* Return the {@link Version} of the currently installed Dart Plugin.
102107
*/
103108
public Version getVersion() {
104109
if (myVersion == null) {
105110
final IdeaPluginDescriptor descriptor = PluginManagerCore.getPlugin(PluginId.getId("Dart"));
106111
assert (descriptor != null);
107-
myVersion = Version.parseVersion(descriptor.getVersion());
112+
myVersion = Objects.requireNonNull(Version.parseVersion(Objects.requireNonNull(descriptor.getVersion())));
108113
}
109114
return myVersion;
110115
}
111116

112117
/**
113-
* Return the DartAnalysisServerService instance.
118+
* Return the {@link DartAnalysisServerService} instance for the passed {@link Project}.
114119
*/
115120
@Nullable
116121
public DartAnalysisServerService getAnalysisService(@NotNull final Project project) {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,7 @@ public interface Analyzer {
416416
*/
417417
@Nullable
418418
static Analyzer create(@NotNull Project project, @NotNull VirtualFile sourceLocation) {
419-
DartPlugin dartPluginInstance = DartPlugin.getInstance();
420-
if (dartPluginInstance == null) {
421-
return null;
422-
}
423-
419+
final DartPlugin dartPluginInstance = DartPlugin.getInstance();
424420
final DartAnalysisServerService dartAnalysisServerService = dartPluginInstance.getAnalysisService(project);
425421
if (dartAnalysisServerService == null) {
426422
return null;

0 commit comments

Comments
 (0)