Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible enhanced for loop failure #72

Open
JDLogic opened this issue Jun 14, 2020 · 0 comments
Open

Possible enhanced for loop failure #72

JDLogic opened this issue Jun 14, 2020 · 0 comments

Comments

@JDLogic
Copy link
Member

JDLogic commented Jun 14, 2020

MC 1.16-pre1 BackupList.func_230753_a_

...
      try {
         JsonElement jsonelement = jsonparser.parse(p_230753_0_).getAsJsonObject().get("backups");
         if (jsonelement.isJsonArray()) {
            Iterator<JsonElement> iterator = jsonelement.getAsJsonArray().iterator();

            while(iterator.hasNext()) {
               backuplist.field_230560_a_.add(Backup.func_230750_a_(iterator.next()));
            }
         }
      } catch (Exception exception) {
         field_230561_b_.error("Could not parse BackupList: " + exception.getMessage());
      }

      return backuplist;

There are a few cases like this. The enhanced for loop fails to generate as we expect the first statement in the loop to be iterator.next() being assigned to a variable. In this case, it has already been collapsed into the following statement.

I say this is a possible failure as the iterator variable definition has the correct generic type, which suggest the method was actually written this way.

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

No branches or pull requests

1 participant