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

Problems to compile inherited inner classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.1_02
    • tools
    • generic
    • generic

      :

      Name: sk89920 Date: 06/04/99


      Solaris_JDK_1.2.1_02/bin/javac fails to compile the
      following class. The source looks ok to me:

      ---
      public class Test
      {
         private abstract class UserTreeNode
         {
            // remove "protected" here and it compiles
            protected class BIStates
            {
            }
            protected abstract String treeLabel();
         }

         private class Block_TreeNode
            extends UserTreeNode
         {
            // move this class def behind treeLabel() and it compiles
            protected class BlockBIStates extends BIStates
            {
            }
            protected String treeLabel()
            {
               return "";
            }
         }
      }
      --

      Javac reports:

      # Solaris_JDK_1.2.1_02/bin/javac Test.java
      Test.java:19: The method String treeLabel() declared in inner class Test. Block_TreeNode cannot override the method of the same signature declared in inner class Test. UserTreeNode. They must have the same return type.
            protected String treeLabel()
                             ^
      1 error
      Exit 1
      (Review ID: 83356)
      ======================================================================

            iris Iris Clark
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: