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

<clinit> being called on Class.forName and Class.getDeclaredMethod

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      (See also Comments).

      Name: mc57594 Date: 02/27/97


      I've noticed that the static class initianalisers are being called when I do a 'Class.getDeclaredMethod'. It probably happens with all the other reflective Class methods as well. Is there no way of reflecting on a class without doing a <clinit>? This could prove really anoying!

      Class c = Class.forName("Test");
      c.getDeclaredMethod("someMethod", {});
      System.out.println("Does it ever get here?");

      class Test {
          static {
              while(true) {
                  System.out.println("Stop me if you can!!!");
              }
          }
      }

      Keep up the good work!

      company - Obsolete , email - ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apalanissunw Anand Palaniswamy (Inactive)
              Reporter:
              mchamnessunw Mark Chamness (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: