mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
PY-78236 Rename PyTypeVisitor#visitPyType to just #visit, add javadoc
Similarly to PyRecursiveTypeVisitor#traverse and PyCloningTypeVisitor#clone. GitOrigin-RevId: 285537e4b7f9326ded81dcd648fa510572c0aba3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7fd8018705
commit
d5e40b4ad4
@@ -75,7 +75,7 @@ public interface PyType {
|
||||
void assertValid(String message);
|
||||
|
||||
/**
|
||||
* For nullable {@code PyType} instance use {@link PyTypeVisitor#visitPyType(PyType, PyTypeVisitor)}
|
||||
* For nullable {@code PyType} instance use {@link PyTypeVisitor#visit(PyType, PyTypeVisitor)}
|
||||
* to visit {@code null} values with {@link PyTypeVisitor#visitUnknownType()}.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
|
||||
@@ -21,12 +21,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see PyRecursiveTypeVisitor
|
||||
* @see PyCloningTypeVisitor
|
||||
* @see PyType#acceptTypeVisitor(PyTypeVisitor)
|
||||
* @see #visitPyType(PyType, PyTypeVisitor)
|
||||
* @see #visit(PyType, PyTypeVisitor)
|
||||
* @see #visitUnknownType()
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public abstract class PyTypeVisitor<T> {
|
||||
public static <T> T visitPyType(@Nullable PyType type, @NotNull PyTypeVisitor<T> visitor) {
|
||||
/**
|
||||
* Use this method instead of {@link PyType#acceptTypeVisitor(PyTypeVisitor)} to take into account
|
||||
* "unknown" {@code null} types, for which {@link #visitUnknownType()} should be called.
|
||||
*/
|
||||
public static <T> T visit(@Nullable PyType type, @NotNull PyTypeVisitor<T> visitor) {
|
||||
return type == null ? visitor.visitUnknownType() : type.acceptTypeVisitor(visitor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user