mchernyakov commented on code in PR #3021:
URL: https://github.com/apache/fory/pull/3021#discussion_r2616489918


##########
java/fory-core/src/main/java/org/apache/fory/meta/ClassDef.java:
##########
@@ -247,17 +248,37 @@ public List<Descriptor> getDescriptors(TypeResolver 
resolver, Class<?> cls) {
       SortedMap<Member, Descriptor> allDescriptorsMap =
           resolver.getFory().getClassResolver().getAllDescriptorsMap(cls, 
true);
       Map<String, Descriptor> descriptorsMap = new HashMap<>();
+      Map<Short, Descriptor> tagToDescriptorMap = new HashMap<>();
+
+      // Build maps for both name-based and tag-based lookups
       for (Map.Entry<Member, Descriptor> e : allDescriptorsMap.entrySet()) {
-        if (descriptorsMap.put(
-                e.getKey().getDeclaringClass().getName() + "." + 
e.getKey().getName(), e.getValue())
-            != null) {
+        String fullName = e.getKey().getDeclaringClass().getName() + "." + 
e.getKey().getName();
+        Descriptor desc = e.getValue();
+        if (descriptorsMap.put(fullName, desc) != null) {
           throw new IllegalStateException("Duplicate key");
         }
+
+        // If the field has @ForyField annotation with tag ID, index by tag ID
+        if (desc.getForyField() != null) {
+          int tagId = desc.getForyField().id();

Review Comment:
   yeah, thanks for pointing on that, done in 
https://github.com/apache/fory/pull/3021/commits/a4155a975a7af8fcdfded89d8ebf1be74bbe35e0



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to