feat[protocol]: protocol registration no longer requires transient

This commit is contained in:
godotg
2022-12-11 19:52:12 +08:00
parent 949cee885c
commit fb0728d204
3 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ your protocol number a little more compactly, so that your protocol number will
```
public class SimpleObject implements IPacket {
public static final transient short PROTOCOL_ID = 104;
public static final short PROTOCOL_ID = 104;
public int c;
+1 -1
View File
@@ -131,7 +131,7 @@ cpu i9900k
```
public class SimpleObject implements IPacket {
public static final transient short PROTOCOL_ID = 104;
public static final short PROTOCOL_ID = 104;
public int c;
@@ -556,7 +556,6 @@ public class ProtocolAnalysis {
AssertionUtils.isTrue(Modifier.isPublic(protocolIdField.getModifiers()), "[class:{}]协议序列号[{}]没有被public修饰", clazz.getCanonicalName(), PROTOCOL_ID);
AssertionUtils.isTrue(Modifier.isStatic(protocolIdField.getModifiers()), "[class:{}]协议序列号[{}]没有被static修饰", clazz.getCanonicalName(), PROTOCOL_ID);
AssertionUtils.isTrue(Modifier.isFinal(protocolIdField.getModifiers()), "[class:{}]协议序列号[{}]没有被final修饰", clazz.getCanonicalName(), PROTOCOL_ID);
AssertionUtils.isTrue(Modifier.isTransient(protocolIdField.getModifiers()), "[class:{}]协议序列号[{}]没有被transient修饰", clazz.getCanonicalName(), PROTOCOL_ID);
AssertionUtils.isTrue(clazz.getSimpleName().matches("[a-zA-Z0-9_]*"), "[class:{}]的命名只能包含字母,数字,下划线", clazz.getCanonicalName(), PROTOCOL_ID);
ReflectionUtils.makeAccessible(protocolIdField);