Index: third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java |
diff --git a/third_party/protobuf/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java |
similarity index 62% |
copy from third_party/protobuf/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java |
copy to third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java |
index c1997515d0fc8ac03078aecb027c3d1246ff564f..3cd4c88492862d6e06e88a6e869e00e543ead293 100644 |
--- a/third_party/protobuf/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java |
+++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java |
@@ -30,26 +30,37 @@ |
package com.google.protobuf; |
-import java.nio.ByteBuffer; |
+import java.lang.annotation.Documented; |
+import java.lang.annotation.ElementType; |
+import java.lang.annotation.Retention; |
+import java.lang.annotation.RetentionPolicy; |
+import java.lang.annotation.Target; |
/** |
- * Provides unsafe factory methods for {@link ByteString} instances. |
+ * Indicates a public API that can change at any time, and has no guarantee of API stability and |
+ * backward-compatibility. |
* |
- * <p><strong>DISCLAIMER:</strong> The methods in this class should only be called if it is |
- * guaranteed that the the buffer backing the {@link ByteString} will never change! Mutation of a |
- * {@link ByteString} can lead to unexpected and undesirable consequences in your application, |
- * and will likely be difficult to debug. Proceed with caution! |
+ * <p>Usage guidelines: |
+ * <ol> |
+ * <li>This annotation is used only on public API. Internal interfaces should not use it.</li> |
+ * <li>This annotation should only be added to new APIs. Adding it to an existing API is |
+ * considered API-breaking.</li> |
+ * <li>Removing this annotation from an API gives it stable status.</li> |
+ * </ol> |
*/ |
-public final class UnsafeByteStrings { |
- private UnsafeByteStrings() {} |
- |
+@Retention(RetentionPolicy.SOURCE) |
+@Target({ |
+ ElementType.ANNOTATION_TYPE, |
+ ElementType.CONSTRUCTOR, |
+ ElementType.FIELD, |
+ ElementType.METHOD, |
+ ElementType.PACKAGE, |
+ ElementType.TYPE}) |
+@Documented |
+public @interface ExperimentalApi { |
/** |
- * An unsafe operation that returns a {@link ByteString} that is backed by the provided buffer. |
- * |
- * @param buffer the Java NIO buffer to be wrapped. |
- * @return a {@link ByteString} backed by the provided buffer. |
+ * Context information such as links to discussion thread, tracking issue etc. |
*/ |
- public static ByteString unsafeWrap(ByteBuffer buffer) { |
- return new NioByteString(buffer); |
- } |
+ String value() default ""; |
} |
+ |