< prev index next >

test/com/sun/jdi/LambdaBreakpointTest.java

Print this page
rev 16783 : 8176176: fix @modules in jdk_svc tests
Reviewed-by: duke


   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /********** LINE NUMBER SENSITIVE! *****************************************************************/
  25 
  26 /**
  27  *  @test
  28  *  @summary Test setting breakpoints on lambda calls
  29  *
  30  *  @author Staffan Larsen
  31  *
  32  *  @modules jdk.jdi
  33  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  34  *  @run compile -g LambdaBreakpointTest.java
  35  *  @run driver LambdaBreakpointTest
  36  */

  37 import java.util.List;
  38 
  39 import com.sun.jdi.LocalVariable;
  40 import com.sun.jdi.Location;
  41 import com.sun.jdi.Method;
  42 import com.sun.jdi.ObjectReference;
  43 import com.sun.jdi.ReferenceType;
  44 import com.sun.jdi.StackFrame;
  45 import com.sun.jdi.StringReference;
  46 import com.sun.jdi.ThreadReference;
  47 import com.sun.jdi.event.BreakpointEvent;
  48 import com.sun.jdi.event.StepEvent;
  49 
  50  /********** target program **********/
  51 
  52 class LambdaBreakpointTestTarg {
  53 
  54     static int[] breakpointLines = {
  55             63, 67, 64, 65, 66, 68
  56     };
  57 
  58     public static void main(String[] args) {
  59         test();
  60     }
  61 
  62     private static void test() {
  63         Runnable r = () -> {                          // B1: L62
  64             String from = "lambda";                   // B3: L63
  65             System.out.println("Hello from " + from); // B4: L64
  66         };                                            // B5: L65
  67         r.run();                                      // B2: L66
  68         System.out.println("Goodbye.");               // B6: L67
  69     }
  70 }
  71 
  72 
  73  /********** test program **********/
  74 
  75 public class LambdaBreakpointTest extends TestScaffold {




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 //    THIS TEST IS LINE NUMBER SENSITIVE
  25 
  26 /**
  27  * @test
  28  * @summary Test setting breakpoints on lambda calls

  29  * @author Staffan Larsen
  30  *

  31  * @run build TestScaffold VMConnection TargetListener TargetAdapter
  32  * @run compile -g LambdaBreakpointTest.java
  33  * @run driver LambdaBreakpointTest
  34  */
  35 
  36 import java.util.List;
  37 
  38 import com.sun.jdi.LocalVariable;
  39 import com.sun.jdi.Location;
  40 import com.sun.jdi.Method;
  41 import com.sun.jdi.ObjectReference;
  42 import com.sun.jdi.ReferenceType;
  43 import com.sun.jdi.StackFrame;
  44 import com.sun.jdi.StringReference;
  45 import com.sun.jdi.ThreadReference;
  46 import com.sun.jdi.event.BreakpointEvent;
  47 import com.sun.jdi.event.StepEvent;
  48 
  49  /********** target program **********/
  50 
  51 class LambdaBreakpointTestTarg {
  52 
  53     static int[] breakpointLines = {
  54             62, 66, 63, 64, 65, 67
  55     };
  56 
  57     public static void main(String[] args) {
  58         test();
  59     }
  60 
  61     private static void test() {
  62         Runnable r = () -> {                          // B1: L62
  63             String from = "lambda";                   // B3: L63
  64             System.out.println("Hello from " + from); // B4: L64
  65         };                                            // B5: L65
  66         r.run();                                      // B2: L66
  67         System.out.println("Goodbye.");               // B6: L67
  68     }
  69 }
  70 
  71 
  72  /********** test program **********/
  73 
  74 public class LambdaBreakpointTest extends TestScaffold {


< prev index next >