< prev index next >

test/com/sun/jdi/GetSetLocalTest.java

Print this page
rev 16922 : 8177507: line number sensitive tests for jdi should be unified
Reviewed-by: duke

@@ -1,10 +1,34 @@
-/** hard coded linenumbers in other tests - DO NOT CHANGE
- *  @test/nodynamiccopyright/
+/*
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * @test
  *  @bug 4300412
  *  @summary Test GetLocal* and SetLocal* functions
- *
  *  @author Serguei Spitsyn
  *
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g GetSetLocalTest.java
  *  @run driver GetSetLocalTest

@@ -33,11 +57,11 @@
     public static int staticMeth(int intArg) {
         System.out.println("staticMeth: Started");
         int result;
         {
              { boolean bool_1 = false;
-               intArg++;
+               intArg++; // START_LINE
              }
 
              boolean bool_2 = true;
              intArg++;
         }

@@ -109,11 +133,11 @@
              { Object obj_1 = new Object();
                intArg++;
              }
 
              Object obj_2 = new Object();
-             intArg++;  // <-- Last stop is at this point.
+             intArg++;  // STOP_LINE. Last stop is at this point.
                         //     Only obj_2 and intArg are valid
                         // Note: even result is not valid here!
         }
         result = 10;    // <- This is first init of result var
         System.out.println("staticMeth: Finished");

@@ -123,10 +147,12 @@
 
 
     /********** test program **********/
 
 public class GetSetLocalTest extends TestScaffold {
+    static final int START_LINE = 62;
+    static final int STOP_LINE = 138;
     ReferenceType targetClass;
     ThreadReference mainThread;
 
     GetSetLocalTest (String args[]) {
         super(args);

@@ -633,11 +659,11 @@
 
         EventRequestManager erm = vm().eventRequestManager();
         println("EventRequestManager");
         StackFrame frame = null;
 
-        for (int line = 38; line < 118; line += 4) {
+        for (int line = START_LINE; line <= STOP_LINE; line += 4) {
             println("\n resumeTo(GetSetLocalTarg, " + line + ")");
             bpe = resumeTo("GetSetLocalTarg", line);
             frame = bpe.thread().frame(0);
             printFrameVariables(frame);
             checkSetFrameVariables(frame);
< prev index next >