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

java --dry-run should not cause main class be initialized

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b126
    • Verification:
      Verified

      Description

      public class Test {
         static {
             System.out.println("Hello from <clinit>");
         }
         public static void main(String[] args) {
             System.out.println("Hello from main()");
         }
      }

      ...when run with: "java -cp . Test", produces the following:

      Hello from <clinit>
      Hello from main()

      ...but when run with: "java --dry-run -cp . Test", it still produces the following:

      Hello from <clinit>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mchung Mandy Chung
                Reporter:
                mchung Mandy Chung
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: