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

(reflect) Methods to distinguish implicitly vs. explicitly final methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.1.6
    • core-libs



      Name: dbT83986 Date: 02/03/99


      in a final class, all methods are implicitly
      final, yet reflection does not label them as such.

      i was of the understanding (and i think it's in
      JLS somewhere) that specifying a method as final
      in a final class has no effect. however, this prints
      out false

      public final class p {
        public void thing() { }
        public static void main(String[] args) throws Throwable {
          System.out.println(java.lang.reflect.Modifier.isFinal(
               p.class.getMethod("thing", new Class[0]).getModifiers()
          ));
        }
      }

      whereas declaring thing() to be final causes the
      output to be "true". Is this as intended?
      (Review ID: 39440)
      ======================================================================

            Unassigned Unassigned
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: