Skip to content

Deprecate index-based field selection - #52

Open
Nikolay-Sitnikov wants to merge 3 commits into
masterfrom
deprecate-indexed-fields
Open

Deprecate index-based field selection#52
Nikolay-Sitnikov wants to merge 3 commits into
masterfrom
deprecate-indexed-fields

Conversation

@Nikolay-Sitnikov

Copy link
Copy Markdown

Summary

Selecting fields based on their index within getDeclaredFields() is undefined behavior. According to the documentation for getDeclaredFields(), the returned fields "are not in any particular order," which makes getting fields by their index incorrect.

Also, this method makes the code really difficult to read, since the source code doesn't contain the name of the field that the code is trying to read/write to.

This PR deprecates the two methods, so we can remove them from mods that rely on CodeChickenCore in the future.

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack - Irrelevant, annotation-only changes.
  • This PR is in compliance with the GTNH AI Policy
  • This PR requires another PR in order to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant