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

The compiler falls into an infinite loop instead of giving an error.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1, 1.1.3, 1.1.4, 1.2.0
    • tools
    • None
    • x86, sparc
    • solaris_2.5, solaris_2.5.1, windows_95, windows_nt



      Name: diC59631 Date: 08/22/97


      Run the following code which uses cyclic inheritance.

      The compiler falls into an infinite loop when you
      compile the following code. But if you remove the constructor,
      the compiler gives the correct error message.

      import java.awt.*;

      public class New extends New
      {
              public New(String t)
              {
                      super(t);
              }
      }
      company - NCR Corp. , email - ###@###.###

      ======================================================================
      Another report:

      I tried a simple example and everything was fine -
      the compiler reported cyclic inheritance. But
      when I use the source code below, JDK1.1.4 compiler
      goes into an infinite loop, and performance pack
      1.1.4 compiler complains that I have found a bug.

      -----------------------------

      package amm.util;

      /**
       * This interface defines a physical address, including telephone and e-mail.
       * @version 1.1.0
       * @brief An address
       * @author Aaron Mulder
       * @author ###@###.###
       * @author http://www.princeton.edu/~ammulder/java11.html
       */
      public interface HomeAddress {
        /**
         * Sets someone's street address. This should have two lines, though
         * one can be blank.
         * @param add The address to set.
         */
        public void setStreet(String add[]);

        /**
         * Gets someone's street address. This has two lines, though one may be
         * blank.
         */
        public String[] getStreet();

        /**
         * Sets someone's home city.
         * @param city The city to set.
         */
        public void setCity(String city);

        /**
         * Gets someone's city.
         */
        public String getCity();

        /**
         * Sets someone's home state.
         * @param state The state to set.
         */
        public void setState(String state);

        /**
         * Gets someone's home state.
         */
        public String getState();

        /**
         * Sets someone's Zip Code.
         * @param zip The Zip Code to set.
         */
        public void setZipCode(int zip);

        /**
         * Gets someone's Zip Code.
         */
        public int getZipCode();

        /**
         * Sets someone's telephone number. This can be any number of digits, up
         * to the maximum value of a long.
         * @see java.lang.Long#MAX_VALUE
         * @param telNumber The number to set.
         */
        public void setTelephone(long telNumber);

        /**
         * Gets someone's telephone number. This can be any number of digits, up
         * to the maximum value of a long.
         * @see java.lang.Long#MAX_VALUE
         */
        public long getTelephone();

        /**
         * Sets someone's e-mail address.
         * @param newEMail The address to set.
         */
        public void setEMail(String newEMail);

        /**
         * Gets someone's e-mail address.
         */
        public String getEMail();

        /**
         * Sets someone's WWW address.
         * @param newPage The address to set.
         */
        public void setHomePage(String newPage);

        /**
         * Gets someone's WWW address.
         */
        public String getHomePage();
      }


      -----------------------------------------------

      package amm.rpg;

      import amm.util.HomeAddress;
      import java.io.DataInput;
      import java.io.DataOutput;
      import java.io.IOException;

      /**
       * This class defines a physical address.
       * @version 1.1.0
       * @brief An address
       * @author Aaron Mulder
       * @author ###@###.###
       * @author http://www.princeton.edu/~ammulder/java11.html
       */
      public class HomeAddressBin extends HomeAddressBin implements HomeAddress {
        private String add1,add2;
        private String city;
        private String state;
        private int zip;
        private long phone;
        private String email,www;

        protected HomeAddressBin() {
          add1 = "";
          add2 = "";
          city = "";
          state = "";
          zip = 0;
          phone = 0;
          email = "";
          www = "";
        }

        /**
         * Sets someone's street address. This should have two lines, though
         * one can be blank.
         * @param add The address to set.
         * @exception java.lang.IllegalArgumentException
         * Occurs when there are not two lines in the address.
         */
        public void setStreet(String add[]) {
          if(add.length != 2) throw new IllegalArgumentException("Street address must have two lines!");
          add1 = add[0];
          add2 = add[1];
        }

        /**
         * Gets someone's street address. This has two lines, though one may be
         * blank.
         */
        public String[] getStreet() {
          String add[] = new String[2];
          add[0] = add1;
          add[1] = add2;
          return add;
        }

        /**
         * Sets someone's home city.
         * @param city The city to set.
         */
        public void setCity(String city) {
          this.city = city;
        }

        /**
         * Gets someone's city.
         */
        public String getCity() {
          return city;
        }

        /**
         * Sets someone's home state.
         * @param state The state to set.
         */
        public void setState(String state) {
          this.state = state;
        }

        /**
         * Gets someone's home state.
         */
        public String getState() {
          return state;
        }

        /**
         * Sets someone's Zip Code.
         * @param zip The Zip Code to set.
         */
        public void setZipCode(int zip) {
          this.zip = zip;
        }

        /**
         * Gets someone's Zip Code.
         */
        public int getZipCode() {
          return zip;
        }

        /**
         * Sets someone's telephone number. This can be any number of digits, up
         * to the maximum value of a long.
         * @see java.lang.Long#MAX_VALUE
         * @param telNumber The number to set.
         */
        public void setTelephone(long telNumber) {
          phone = telNumber;
        }

        /**
         * Gets someone's telephone number. This can be any number of digits, up
         * to the maximum value of a long.
         * @see java.lang.Long#MAX_VALUE
         */
        public long getTelephone() {
          return phone;
        }

        /**
         * Sets someone's e-mail address.
         * @param newEMail The address to set.
         */
        public void setEMail(String newEMail) {
          email = newEMail;
        }

        /**
         * Gets someone's e-mail address.
         */
        public String getEMail() {
          return email;
        }

        /**
         * Sets someone's WWW address.
         * @param newPage The address to set.
         */
        public void setHomePage(String newPage) {
          www = newPage;
        }

        /**
         * Gets someone's WWW address.
         */
        public String getHomePage() {
          return www;
        }

        /**
         * Loads a HomeAddressBin.
         */
        protected static Object load(StorageBin sb,long targetID) throws IOException {
          HomeAddressBin hb = new HomeAddressBin();
          hb.setID(targetID);
          sb.load(hb);
          return hb;
        }

        /**
         * Reloads an HomeAddressBin.
         */
        protected void reload(DataInput in) throws IOException {
          add1 = in.readUTF();
          add2 = in.readUTF();
          city = in.readUTF();
          state = in.readUTF();
          zip = in.readInt();
          phone = in.readLong();
          email = in.readUTF();
          www = in.readUTF();
        }

        /**
         * Saves an HomeAddressBin.
         */
        protected void save(DataOutput out) throws IOException {
          out.writeUTF(add1);
          out.writeUTF(add2);
          out.writeUTF(city);
          out.writeUTF(state);
          out.writeInt(zip);
          out.writeLong(phone);
          out.writeUTF(email);
          out.writeUTF(www);
        }
      }
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: