mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@Nullable -> @Contract("null -> null") for StringRef
(cherry picked from commit 2d7f630992e2b72d10b078f3ff3caf4f452f5625)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.util.io;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -92,12 +93,12 @@ public class StringRef {
|
||||
return that == this || that instanceof StringRef && toString().equals(that.toString());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract("null -> null")
|
||||
public static String toString(@Nullable StringRef ref) {
|
||||
return ref != null ? ref.getString() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract("null -> null; !null -> !null")
|
||||
public static StringRef fromString(@Nullable String source) {
|
||||
return source == null ? null : new StringRef(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user