< prev index next >

test/jdk/jdk/jfr/api/event/TestAbstractEvent.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.event;
  27 
  28 import java.io.IOException;
  29 
  30 import jdk.jfr.Event;
  31 import jdk.jfr.EventType;
  32 import jdk.jfr.Experimental;
  33 import jdk.jfr.FlightRecorder;
  34 import jdk.jfr.Recording;
  35 import jdk.jfr.consumer.RecordedEvent;
  36 import jdk.jfr.consumer.RecordingFile;
  37 import jdk.test.lib.Asserts;
  38 import jdk.test.lib.jfr.Events;
  39 
  40 /*
  41  * @test
  42  * @summary Tests that abstract events are not part of metadata
  43  * @key jfr

  44  * @library /test/lib
  45  * @run main/othervm jdk.jfr.api.event.TestAbstractEvent
  46  */
  47 public class TestAbstractEvent {
  48 
  49     // Should not be included in metadata
  50     @Experimental
  51     static abstract class BaseEvent extends Event {
  52     }
  53 
  54     // Should be included
  55     static class ConcreteEvent extends BaseEvent {
  56     }
  57 
  58     public static void main(String... args) throws IOException {
  59         try {
  60             EventType.getEventType(BaseEvent.class);
  61             Asserts.fail("Should not accept abstract event classes");
  62         } catch (IllegalArgumentException iae) {
  63             // OK, as expected




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.event;
  27 
  28 import java.io.IOException;
  29 
  30 import jdk.jfr.Event;
  31 import jdk.jfr.EventType;
  32 import jdk.jfr.Experimental;
  33 import jdk.jfr.FlightRecorder;
  34 import jdk.jfr.Recording;
  35 import jdk.jfr.consumer.RecordedEvent;
  36 import jdk.jfr.consumer.RecordingFile;
  37 import jdk.test.lib.Asserts;
  38 import jdk.test.lib.jfr.Events;
  39 
  40 /**
  41  * @test
  42  * @summary Tests that abstract events are not part of metadata
  43  * @key jfr
  44  * @requires vm.hasJFR
  45  * @library /test/lib
  46  * @run main/othervm jdk.jfr.api.event.TestAbstractEvent
  47  */
  48 public class TestAbstractEvent {
  49 
  50     // Should not be included in metadata
  51     @Experimental
  52     static abstract class BaseEvent extends Event {
  53     }
  54 
  55     // Should be included
  56     static class ConcreteEvent extends BaseEvent {
  57     }
  58 
  59     public static void main(String... args) throws IOException {
  60         try {
  61             EventType.getEventType(BaseEvent.class);
  62             Asserts.fail("Should not accept abstract event classes");
  63         } catch (IllegalArgumentException iae) {
  64             // OK, as expected


< prev index next >