vromero@1591: /* vromero@1591: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. vromero@1591: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. vromero@1591: * vromero@1591: * This code is free software; you can redistribute it and/or modify it vromero@1591: * under the terms of the GNU General Public License version 2 only, as vromero@1591: * published by the Free Software Foundation. vromero@1591: * vromero@1591: * This code is distributed in the hope that it will be useful, but WITHOUT vromero@1591: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or vromero@1591: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License vromero@1591: * version 2 for more details (a copy is included in the LICENSE file that vromero@1591: * accompanied this code). vromero@1591: * vromero@1591: * You should have received a copy of the GNU General Public License version vromero@1591: * 2 along with this work; if not, write to the Free Software Foundation, vromero@1591: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. vromero@1591: * vromero@1591: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA vromero@1591: * or visit www.oracle.com if you need additional information or have any vromero@1591: * questions. vromero@1591: */ vromero@1591: vromero@1591: /* vromero@1591: * @test vromero@1591: * @bug 4645152 4785453 vromero@1591: * @summary javac compiler incorrectly inserts when -g is specified vromero@1591: * @run compile -g ConstDebugTest.java vromero@1591: * @run main ConstDebugTest vromero@1591: */ vromero@1819: import java.nio.file.Paths; vromero@1819: import com.sun.tools.classfile.ClassFile; vromero@1819: import com.sun.tools.classfile.Method; vromero@1591: vromero@1591: public class ConstDebugTest { vromero@1591: vromero@1591: public static final long l = 12; vromero@1591: vromero@1591: public static void main(String args[]) throws Exception { vromero@1819: ClassFile classFile = ClassFile.read(Paths.get(System.getProperty("test.classes"), vromero@1819: ConstDebugTest.class.getSimpleName() + ".class")); vromero@1819: for (Method method: classFile.methods) { vromero@1819: if (method.getName(classFile.constant_pool).equals("")) { vromero@1819: throw new AssertionError( vromero@1819: "javac should not create a method for ConstDebugTest class"); vromero@1819: } vromero@1591: } vromero@1591: } vromero@1591: vromero@1591: }