Skip to content

Commit c3177fb

Browse files
Update Java gencode base class documentation to clarify that it is not supported to extend them.
This was already the intended state, but our javadoc didn't say it clearly. PiperOrigin-RevId: 774919403
1 parent 6a6ba52 commit c3177fb

File tree

8 files changed

+41
-2
lines changed

8 files changed

+41
-2
lines changed

‎java/core/src/main/java/com/google/protobuf/AbstractMessage.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
* A partial implementation of the {@link Message} interface which implements as many methods of
2525
* that interface as possible in terms of other methods.
2626
*
27+
* <p>Users should generally ignore this class and use the Message interface instead.
28+
*
29+
* <p>This class is intended to only be extended by protoc created gencode. It is not intended or
30+
* supported to extend this class, and any protected methods may be removed without it being
31+
* considered a breaking change as long as all supported gencode does not depend on the changed
32+
* methods.
33+
*
2734
* @author kenton@google.com Kenton Varda
2835
*/
2936
public abstract class AbstractMessage

‎java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
* A partial implementation of the {@link MessageLite} interface which implements as many methods of
2323
* that interface as possible in terms of other methods.
2424
*
25+
* <p>Users should generally ignore this class and use the MessageLite interface instead.
26+
*
27+
* <p>This class is intended to only be extended by protoc created gencode. It is not intended or
28+
* supported to extend this class, and any protected methods may be removed without it being
29+
* considered a breaking change as long as all supported gencode does not depend on the changed
30+
* methods.
31+
*
2532
* @author kenton@google.com Kenton Varda
2633
*/
2734
public abstract class AbstractMessageLite<

‎java/core/src/main/java/com/google/protobuf/GeneratedMessage.java‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838

3939
/**
4040
* All generated protocol message classes extend this class. This class implements most of the
41-
* Message and Builder interfaces using Java reflection. Users can ignore this class and pretend
42-
* that generated messages implement the Message interface directly.
41+
* Message and Builder interfaces using Java reflection.
42+
*
43+
* <p>Users should generally ignore this class and use the Message interface instead.
44+
*
45+
* <p>This class is intended to only be extended by protoc created gencode. It is not intended or
46+
* supported to extend this class, and any protected methods may be removed without it being
47+
* considered a breaking change as long as all supported gencode does not depend on the changed
48+
* methods.
4349
*
4450
* @author kenton@google.com Kenton Varda
4551
*/

‎java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
/**
3232
* Lite version of {@link GeneratedMessage}.
3333
*
34+
* <p>Users should generally ignore this class and use the MessageLite interface instead.
35+
*
36+
* <p>This class is intended to only be extended by protoc created gencode. It is not intended or
37+
* supported to extend this class, and any protected methods may be removed without it being
38+
* considered a breaking change as long as all supported gencode does not depend on the changed
39+
* methods.
40+
*
3441
* @author kenton@google.com Kenton Varda
3542
*/
3643
public abstract class GeneratedMessageLite<

‎java/core/src/main/java/com/google/protobuf/Message.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
/**
1515
* Abstract interface implemented by Protocol Message objects.
1616
*
17+
* <p>This interface is intended to only be implemented by protoc created gencode. It is not
18+
* intended or supported to implement this interface manually.
19+
*
1720
* <p>See also {@link MessageLite}, which defines most of the methods that typical users care about.
1821
* {@link Message} adds methods that are not available in the "lite" runtime. The biggest added
1922
* features are introspection and reflection; that is, getting descriptors for the message type and

‎java/core/src/main/java/com/google/protobuf/MessageLite.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
/**
1515
* Abstract interface implemented by Protocol Message objects.
1616
*
17+
* <p>This interface is intended to only be implemented by protoc created gencode. It is not
18+
* intended or supported to implement this interface manually.
19+
*
1720
* <p>This interface is implemented by all protocol message objects. Non-lite messages additionally
1821
* implement the Message interface, which is a subclass of MessageLite. Use MessageLite instead when
1922
* you only need the subset of features which it supports -- namely, nothing that uses descriptors

‎java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* Base interface for methods common to {@link MessageLite} and {@link MessageLite.Builder} to
1212
* provide type equivalency.
1313
*
14+
* <p>This interface is intended to only be implemented by protoc created gencode. It is not
15+
* intended or supported to implement this interface manually.
16+
*
1417
* @author jonp@google.com (Jon Perlow)
1518
*/
1619
@CheckReturnValue

‎java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* Base interface for methods common to {@link Message} and {@link Message.Builder} to provide type
1515
* equivalency.
1616
*
17+
* <p>This interface is intended to only be implemented by protoc created gencode. It is not
18+
* intended or supported to implement this interface manually.
19+
*
1720
* @author jonp@google.com (Jon Perlow)
1821
*/
1922
@CheckReturnValue

0 commit comments

Comments
 (0)