1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   4  */
   5 
   6 package myPkg2;
   7 
   8 import myPkg1.SuperClazz;
   9 
  10 public class SubClass extends SuperClazz {
  11     public static void main(String[] args) {
  12         System.out.println("SubClass: entering main()");
  13         test();
  14     }
  15 
  16     public static void test() {
  17         // The line below will be used to check for successful class transformation
  18         System.out.println("child-transform-check: this-should-be-transformed");
  19         (new SubClass()).callParent();
  20 
  21         // Get the system packages, which should contain myPkg1 and myPkag2
  22         Package[] pkgs = Package.getPackages();
  23         for (int i = 0; i < pkgs.length; i++) {
  24             if (pkgs[i].getName().equals("myPkg1")) {
  25                 for (int j = 0; j < pkgs.length; j++) {
  26                     if (pkgs[j].getName().equals("myPkg2")) {
  27                         return; // found myPkg1 & myPkg1
  28                     }
  29                 }
  30             }
  31         }
  32         throw new RuntimeException("Missing system package");
  33     }
  34 
  35     private void callParent() {
  36         super.testParent();
  37     }
  38 }