< prev index next >

test/com/sun/jdi/LineNumberOnBraceTest.java

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

























   1 /**
   2  *  @test/nodynamiccopyright/
   3  *  @bug 4952629 4870514
   4  *  @summary REGRESSION: javac generates a spurious line number entry on } else {
   5  *
   6  *  @author jjh
   7  *
   8  *  @run build VMConnection TargetListener TargetAdapter
   9  *  @run compile -g LineNumberOnBraceTest.java
  10  *  @run driver LineNumberOnBraceTest
  11  */
  12 import com.sun.jdi.*;
  13 import com.sun.jdi.event.*;
  14 import com.sun.jdi.request.*;
  15 
  16 import java.util.*;
  17 
  18     /********** LINE NUMBER SENSITIVE! *****************************************************************/
  19 class LineNumberOnBraceTarg {
  20 
  21     public final static int stopLine = 29;   // THIS MUST BE THE LINE NUMBER OF THE // stopline LINE
  22     public final static int stopLine2 = 35;  // THIS MUST BE THE LINE NUMBER OF THE // stopline2 LINE
  23 
  24 
  25     public static void main(String[] args){
  26         System.out.println("Howdy!");
  27         if (args.length == 0) {
  28             System.out.println("No args to debuggee");             // stopLine
  29         } else {
  30             System.out.println("Some args to debuggee");
  31         }
  32         if (args.length == 0) {
  33             boolean b1 = false;
  34             if (b1) {                                              // stopLine2
  35                 System.out.println("In 2nd else");                 // bug 4870514 is that we stop here.
  36             }
  37         } else {
  38             System.out.println("In 2nd else");
  39         }
  40         System.out.println("Goodbye from LineNumberOnBraceTarg!");  // stopLine2 + 6
  41     }
  42 
  43     // This isn't part of the test; it is just here


   1 /*
   2  * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   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  *  @bug 4952629 4870514
  29  *  @summary REGRESSION: javac generates a spurious line number entry on } else {

  30  *  @author jjh
  31  *
  32  *  @run build VMConnection TargetListener TargetAdapter
  33  *  @run compile -g LineNumberOnBraceTest.java
  34  *  @run driver LineNumberOnBraceTest
  35  */
  36 import com.sun.jdi.*;
  37 import com.sun.jdi.event.*;
  38 import com.sun.jdi.request.*;
  39 
  40 import java.util.*;
  41 

  42 class LineNumberOnBraceTarg {
  43 
  44     public final static int stopLine = 50;   // THIS MUST BE THE LINE NUMBER OF THE // stopline LINE
  45     public final static int stopLine2 = 56;  // THIS MUST BE THE LINE NUMBER OF THE // stopline2 LINE

  46 
  47     public static void main(String[] args){
  48         System.out.println("Howdy!");
  49         if (args.length == 0) {
  50             System.out.println("No args to debuggee");             // stopLine
  51         } else {
  52             System.out.println("Some args to debuggee");
  53         }
  54         if (args.length == 0) {
  55             boolean b1 = false;
  56             if (b1) {                                              // stopLine2
  57                 System.out.println("In 2nd else");                 // bug 4870514 is that we stop here.
  58             }
  59         } else {
  60             System.out.println("In 2nd else");
  61         }
  62         System.out.println("Goodbye from LineNumberOnBraceTarg!");  // stopLine2 + 6
  63     }
  64 
  65     // This isn't part of the test; it is just here


< prev index next >