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 /* 25 * @test 26 * @bug 8049632 27 * @summary Test ClassFileParser::copy_localvariable_table cases 28 * @library /testlibrary 29 * @modules java.base/jdk.internal.misc 30 * java.management 31 * @compile -g -XDignore.symbol.file TestLVT.java 32 * @run main TestLVT 33 */ 34 35 import jdk.test.lib.*; 36 import java.util.*; 37 38 public class TestLVT { 39 public static void main(String[] args) throws Exception { 40 test(); // Test good LVT in this test 41 42 String jarFile = System.getProperty("test.src") + "/testcase.jar"; 43 44 // java -cp $testSrc/testcase.jar DuplicateLVT 45 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-cp", jarFile, "DuplicateLVT"); 46 new OutputAnalyzer(pb.start()) 47 .shouldContain("Duplicated LocalVariableTable attribute entry for 'by' in class file DuplicateLVT") 48 .shouldHaveExitValue(1); 49 50 // java -cp $testclasses/testcase.jar DuplicateLVTT 51 pb = ProcessTools.createJavaProcessBuilder("-cp", jarFile, "DuplicateLVTT"); 52 new OutputAnalyzer(pb.start()) 53 .shouldContain("Duplicated LocalVariableTypeTable attribute entry for 'list' in class file DuplicateLVTT") 54 .shouldHaveExitValue(1); 55 | 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 /* 25 * @test 26 * @bug 8049632 27 * @summary Test ClassFileParser::copy_localvariable_table cases 28 * @library /test/lib 29 * @modules java.base/jdk.internal.misc 30 * java.management 31 * @compile -g -XDignore.symbol.file TestLVT.java 32 * @run main TestLVT 33 */ 34 35 import jdk.test.lib.process.ProcessTools; 36 import jdk.test.lib.process.OutputAnalyzer; 37 import java.util.*; 38 39 public class TestLVT { 40 public static void main(String[] args) throws Exception { 41 test(); // Test good LVT in this test 42 43 String jarFile = System.getProperty("test.src") + "/testcase.jar"; 44 45 // java -cp $testSrc/testcase.jar DuplicateLVT 46 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-cp", jarFile, "DuplicateLVT"); 47 new OutputAnalyzer(pb.start()) 48 .shouldContain("Duplicated LocalVariableTable attribute entry for 'by' in class file DuplicateLVT") 49 .shouldHaveExitValue(1); 50 51 // java -cp $testclasses/testcase.jar DuplicateLVTT 52 pb = ProcessTools.createJavaProcessBuilder("-cp", jarFile, "DuplicateLVTT"); 53 new OutputAnalyzer(pb.start()) 54 .shouldContain("Duplicated LocalVariableTypeTable attribute entry for 'list' in class file DuplicateLVTT") 55 .shouldHaveExitValue(1); 56 |