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

error in constructor in java.text.DictionaryBasedBreakIterator.Builder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • None
    • 1.4.2
    • core-libs
    • None
    • generic
    • solaris_8

    Description

      We are in the process of fixing a compiler bug (4635044) that exposes a bug
      in the constructor for java.text.DictionaryBasedBreakIterator.Builder. The
      relevant portions of all participating classes are

           1 package java.text;
           2
           3 class RuleBasedBreakIterator {
           4 protected class Builder {
           5 public Builder() {
           6 }
           7 }
           8 }
           9
          10 class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
          11 protected class Builder extends RuleBasedBreakIterator.Builder {
          12 public Builder() {
          13
          14 }
          15 }
          16 }

      The constructor on line 12 is implicitly the same (by JLS2 8.8.5) as

      public Builder() {
      super();
      }

      Since the superclass is an inner member class, by 8.8.5.1, (about a third
      of the way down page 195) it is a compile-time error if the superclass is
      not a member of a lexically enclosing class. The superclass,
      RuleBasedBreakIterator.Builder, is not a member of the lexically enclosing
      class, DictionaryBasedBreakIterator, because it is HIDDEN in that class
      by the declaration of the member DictionaryBasedBreakIterator.Builder.
      Therefore the compiler is required to reject this code.

      The code can easily be corrected by adding the following in line 13:

      DictionaryBasedBreakIterator.this.super();

      I am doing that in my own copy of the code so that I can proceed with
      my compiler bug fixes, but I'd like your blessing (please) on the
      correctness of this change in the java.text package. If you approve then
      please assign this bug to me (gafter) and
      I will put this correction back with my compiler changes.

      Attachments

        Issue Links

          Activity

            People

              gafter Neal Gafter
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: