mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-02 05:18:02 +07:00
The inspection must not suggest replacing a service retrieving call if this call is an initializer of a variable annotated as @Nullable. GitOrigin-RevId: f3f219dacd41f2540085bbb076779be1e742e0b7
28 lines
814 B
Java
28 lines
814 B
Java
import com.intellij.openapi.application.ApplicationManager;
|
|
import com.intellij.openapi.components.Service;
|
|
import com.intellij.openapi.project.Project;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
@Service(Service.Level.PROJECT)
|
|
final class MyProjectService {
|
|
public static MyProjectService getInstance(Project project) {
|
|
return project.getService(MyProjectService.class);
|
|
}
|
|
|
|
void test(Project project) {
|
|
@Nullable MyProjectService myProjectService = project.getService(MyProjectService.class);
|
|
}
|
|
}
|
|
|
|
@Service
|
|
final class MyAppService {
|
|
public static MyAppService getInstance() {
|
|
return ApplicationManager.getApplication().getService(MyAppService.class);
|
|
}
|
|
|
|
void test() {
|
|
@Nullable MyAppService myAppService = ApplicationManager.getApplication().getService(MyAppService.class);
|
|
}
|
|
}
|
|
|