< prev index next >

test/runtime/ClassFile/UnsupportedClassFileVersion.java

Print this page




   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 /*
  25  * @test
  26  * @library /testlibrary

  27  * @compile -XDignore.symbol.file UnsupportedClassFileVersion.java
  28  * @run main UnsupportedClassFileVersion
  29  */
  30 
  31 import java.io.File;
  32 import java.io.FileOutputStream;
  33 import jdk.internal.org.objectweb.asm.ClassWriter;
  34 import jdk.internal.org.objectweb.asm.MethodVisitor;
  35 import jdk.internal.org.objectweb.asm.Opcodes;
  36 import com.oracle.java.testlibrary.*;
  37 
  38 public class UnsupportedClassFileVersion implements Opcodes {
  39     public static void main(String... args) throws Exception {
  40         writeClassFile();
  41         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".",  "ClassFile");
  42         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  43         output.shouldContain("ClassFile has been compiled by a more recent version of the " +
  44                             "Java Runtime (class file version 99.0), this version of " +
  45                             "the Java Runtime only recognizes class file versions up to " +
  46                             System.getProperty("java.class.version"));




   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 /*
  25  * @test
  26  * @library /testlibrary
  27  * @build com.oracle.java.testlibrary.*
  28  * @compile -XDignore.symbol.file UnsupportedClassFileVersion.java
  29  * @run main UnsupportedClassFileVersion
  30  */
  31 
  32 import java.io.File;
  33 import java.io.FileOutputStream;
  34 import jdk.internal.org.objectweb.asm.ClassWriter;
  35 import jdk.internal.org.objectweb.asm.MethodVisitor;
  36 import jdk.internal.org.objectweb.asm.Opcodes;
  37 import com.oracle.java.testlibrary.*;
  38 
  39 public class UnsupportedClassFileVersion implements Opcodes {
  40     public static void main(String... args) throws Exception {
  41         writeClassFile();
  42         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".",  "ClassFile");
  43         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  44         output.shouldContain("ClassFile has been compiled by a more recent version of the " +
  45                             "Java Runtime (class file version 99.0), this version of " +
  46                             "the Java Runtime only recognizes class file versions up to " +
  47                             System.getProperty("java.class.version"));


< prev index next >