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

Compiler infinite loop in JDK 1.1.5J

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 1.1.5
    • Fix Version/s: 1.1.5
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.5
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Not verified

      Description



      Name: chT40241 Date: 11/20/97


      I have narrowed it down to the following trivial piece of code. This compiles fine in 1.1.4FCS. In 1.1.5J, the compiler goes off into an infinite loop because it constructs a circular list that points to itself; see below.

      **** start BugDialog.java *****
      public class BugDialog extends GenericDialog {
          class CRButtonListener extends ButtonListener {
              protected void buttonPress(Object e) { }
          }
      }

      class GenericDialog {
          protected class ButtonListener {
              protected void buttonPressed(Object e) { }
          }
      }
      **** end BugDialog.java *****

      In fact, the compiler will not tell you if you have any syntax errors after it parses CRButtonListener because it's off in an infinite loop.

      Using jdb, I find that the LocalField list 'f' is circular.

      D:\Temp>jdb sun.tools.javac.Main BugDialog2.java
      Initializing jdb...
      0xfaa330:class(sun.tools.javac.Main)
      > run
      run sun.tools.javac.Main BugDialog2.java
      running ...
      main[1] where
        [1] sun.tools.tree.Context.getLocalField (Context:126)
        [2] sun.tools.tree.Context.getThisNumber (Context:743)
        [3] sun.tools.javac.SourceField.check (SourceField:391)
        [4] sun.tools.javac.SourceClass.checkFields (SourceClass:915)
        [5] sun.tools.javac.SourceClass.checkInternal (SourceClass:618)
        [6] sun.tools.javac.SourceClass.check (SourceClass:569)
        [7] sun.tools.javac.SourceClass.maybeCheck (SourceClass:581)
        [8] sun.tools.javac.SourceClass.checkFields (SourceClass:936)
        [9] sun.tools.javac.SourceClass.checkInternal (SourceClass:618)
        [10] sun.tools.javac.SourceClass.check (SourceClass:569)
        [11] sun.tools.javac.Main.compile (Main:318)
        [12] sun.tools.javac.Main.main (Main:473)
        [13] sun.tools.debug.MainThread.run (MainThread:55)
      main[1] list
      122 */
      123 public
      124 LocalField getLocalField(Identifier name) {
      125 for (LocalField f = locals ; f != null ; f = f.prev) {
      126 => if (name.equals(f.getName())) {
      127 return f;
      128 }
      129 }
      130 return null;
      main[1] print f
      f = BugDialog2 this$0
      main[1] print f.prev
      f.prev = BugDialog2 this$0

      f.prev points to itself!



      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            wmaddoxsunw William Maddox (Inactive)
            Reporter:
            chickeysunw Chuck Hickey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: