< prev index next >

test/langtools/tools/javap/T4975569.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 24,28 ***
  /*
   * @test
   * @bug 4975569 6622215 8034861
   * @summary javap doesn't print new flag bits
   * @modules jdk.jdeps/com.sun.tools.javap
   */
  
  import java.io.*;
  import java.util.*;
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  public class T4975569 {
      private static final String NEW_LINE = System.getProperty("line.separator");
      private static final String TEST_CLASSES = System.getProperty("test.classes", ".");
  
      public static void main(String... args) {
          new T4975569().run();
      }
  
      void run() {
          verify(Anno.class.getName(), "flags: \\(0x2600\\) ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION");
!         verify(E.class.getName(),    "flags: \\(0x4030\\) ACC_FINAL, ACC_SUPER, ACC_ENUM");
          verify(S.class.getName(),    "flags: \\(0x1040\\) ACC_BRIDGE, ACC_SYNTHETIC",
                                       "InnerClasses:\n  static [# =\\w]+; +// ");
          verify(V.class.getName(),    "void m\\(java.lang.String...\\)",
                                       "flags: \\(0x0080\\) ACC_VARARGS");
          verify(Prot.class.getName(), "InnerClasses:\n  protected [# =\\w]+; +// ");
--- 24,35 ---
  /*
   * @test
   * @bug 4975569 6622215 8034861
   * @summary javap doesn't print new flag bits
   * @modules jdk.jdeps/com.sun.tools.javap
+  * @modules java.base/jdk.internal.misc
+  * @run main/othervm --enable-preview T4975569
+  * @run main T4975569
   */
  
  import java.io.*;
  import java.util.*;
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
+ import jdk.internal.misc.PreviewFeatures;
+ 
  public class T4975569 {
      private static final String NEW_LINE = System.getProperty("line.separator");
      private static final String TEST_CLASSES = System.getProperty("test.classes", ".");
  
      public static void main(String... args) {
          new T4975569().run();
      }
  
      void run() {
          verify(Anno.class.getName(), "flags: \\(0x2600\\) ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION");
!         verify(E.class.getName(), PreviewFeatures.isEnabled()
+                 ? "flags: \\(0x4030\\) ACC_FINAL, ACC_IDENTITY, ACC_ENUM"
+                 : "flags: \\(0x4030\\) ACC_FINAL, ACC_SUPER, ACC_ENUM");
          verify(S.class.getName(),    "flags: \\(0x1040\\) ACC_BRIDGE, ACC_SYNTHETIC",
                                       "InnerClasses:\n  static [# =\\w]+; +// ");
          verify(V.class.getName(),    "void m\\(java.lang.String...\\)",
                                       "flags: \\(0x0080\\) ACC_VARARGS");
          verify(Prot.class.getName(), "InnerClasses:\n  protected [# =\\w]+; +// ");

*** 103,6 ***
      }
  
      protected class Prot { }
      private class Priv { int i; }
  }
- 
--- 110,5 ---
< prev index next >