You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/09/02 05:25:07 UTC

[GitHub] [ignite-3] yoxinon opened a new pull request, #1050: change check first to check have

yoxinon opened a new pull request, #1050:
URL: https://github.com/apache/ignite-3/pull/1050

   It is specified that the field in a polymorphic configuration schema must contain @interface PolymorphicId (specified in org.apache.ignite.configuration.annotation).
   Also, getDeclaredFields() is used to get all fields of a class and check the first one.
   In ConfigurationRegistry.java, line 427
   ```Java
   Field typeIdField = schemaFields(schemaClass).get(0);
   if (!isPolymorphicId(typeIdField)) {
       throw new IllegalArgumentException(String.format(
               "First field in a polymorphic configuration schema must contain @%s: %s",
               PolymorphicId.class,
               schemaClass.getName()
       ));
   }
   ```
   The `schemaFields()` just uses getDeclaredFields() if you look into it.
   The problem is that the order of fields of getDeclaredFields is nondeterministic.
   > The elements in the returned array are not sorted and are not in any particular order.
   Therefore we cannot use this method to check the first field of a class.
   However, I didn't find a suitable way to get the very first field. I am also wondering about the necessity of requiring that field to be the first. Why don't we just require the existence of that field?
   So my fix actually changes the intended design of the interface. I know it is not good to do this, but I feel it is reasonable. I am not very familiar with the structure of a class in java. So I am willing to alter the way I fix it if there is a necessity to keep that field as the first one.
   
   Also, the flaky test still failed after this fix, which means I did not fix this flaky test entirely yet. Because there seem to be other issues. And the error log gives so little information that I cannot locate it. But I feel my fix should solve most part of this problem.
   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [ignite-3] yoxinon closed pull request #1050: change check first to check have

Posted by GitBox <gi...@apache.org>.
yoxinon closed pull request #1050: change check first to check have
URL: https://github.com/apache/ignite-3/pull/1050


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org