Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8178843

A bug in an inner loop in MethodGenerator's getLocals method

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      In recent snapshot of OpenJDK 9, there is an potential buggy code in dev/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/MethodGenerator.java

      Code:
      ====
      501 for (int i = 0; i < slotCount; i++) {
       502 Object slotEntries = _variables.get(i);
       503 if (slotEntries != null) {
       504 if (slotEntries instanceof ArrayList) {
       505 ArrayList slotList = (ArrayList) slotEntries;
       506
       507 for (int j = 0; j < slotList.size(); j++) {
       508 allVarsEverDeclared.add(slotList.get(i));
       509 }
       510 } else {
       511 allVarsEverDeclared.add(slotEntries);
       512 }
       513 }
       514 }
      ====

      In Line 508, should the indexer, i, of slotList.get(i) be j as i is the inner loop iterates by slotList.size()? It might be a trivial issue but wanted to report just in case. Thanks!


      REPRODUCIBILITY :
      This bug can be reproduced rarely.

        Attachments

          Activity

            People

            Assignee:
            joehw Joe Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: