< prev index next >

test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfImplicitThis.java

Print this page




  45         }
  46         
  47         X getX(Integer xVal, int xi) {
  48             X xl = __MakeDefault X();
  49             xl = __WithField(x, xi);
  50             xl = __WithField(x, xVal);
  51             return xl;
  52         }
  53     }
  54 
  55     public static void main(String[] args) {
  56         new WithFieldOfImplicitThis().run();
  57     }
  58 
  59     void run() {
  60         String [] params = new String [] { "-v",
  61                                             Paths.get(System.getProperty("test.classes"),
  62                                                 "WithFieldOfImplicitThis$X.class").toString() };
  63         runCheck(params, new String [] {
  64 
  65          "0: defaultvalue  #4                  // class WithFieldOfImplicitThis$X",
  66          "3: astore_3",
  67          "4: aload_0",
  68          "5: iload_2",
  69          "6: withfield     #3                  // Field x:I",
  70          "9: astore_3",
  71         "10: aload_0",
  72         "11: aload_1",
  73         "12: invokevirtual #5                  // Method java/lang/Integer.intValue:()I",
  74         "15: withfield     #3                  // Field x:I",
  75         "18: astore_3",
  76         "19: aload_3",
  77         "20: areturn"
  78          });
  79      }
  80 
  81      void runCheck(String [] params, String [] expectedOut) {
  82         StringWriter s;
  83         String out;
  84 
  85         try (PrintWriter pw = new PrintWriter(s = new StringWriter())) {
  86             com.sun.tools.javap.Main.run(params, pw);
  87             out = s.toString();
  88         }
  89         int errors = 0;
  90         for (String eo: expectedOut) {
  91             if (!out.contains(eo)) {
  92                 System.err.println("Match not found for string: " + eo);
  93                 errors++;


  45         }
  46         
  47         X getX(Integer xVal, int xi) {
  48             X xl = __MakeDefault X();
  49             xl = __WithField(x, xi);
  50             xl = __WithField(x, xVal);
  51             return xl;
  52         }
  53     }
  54 
  55     public static void main(String[] args) {
  56         new WithFieldOfImplicitThis().run();
  57     }
  58 
  59     void run() {
  60         String [] params = new String [] { "-v",
  61                                             Paths.get(System.getProperty("test.classes"),
  62                                                 "WithFieldOfImplicitThis$X.class").toString() };
  63         runCheck(params, new String [] {
  64 
  65          "0: defaultvalue  #2                  // class WithFieldOfImplicitThis$X",
  66          "3: astore_3",
  67          "4: aload_0",
  68          "5: iload_2",
  69          "6: withfield     #3                  // Field x:I",
  70          "9: astore_3",
  71         "10: aload_0",
  72         "11: aload_1",
  73         "12: invokevirtual #4                  // Method java/lang/Integer.intValue:()I",
  74         "15: withfield     #3                  // Field x:I",
  75         "18: astore_3",
  76         "19: aload_3",
  77         "20: areturn"
  78          });
  79      }
  80 
  81      void runCheck(String [] params, String [] expectedOut) {
  82         StringWriter s;
  83         String out;
  84 
  85         try (PrintWriter pw = new PrintWriter(s = new StringWriter())) {
  86             com.sun.tools.javap.Main.run(params, pw);
  87             out = s.toString();
  88         }
  89         int errors = 0;
  90         for (String eo: expectedOut) {
  91             if (!out.contains(eo)) {
  92                 System.err.println("Match not found for string: " + eo);
  93                 errors++;
< prev index next >