1 /******************************************************************************* 2 * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Marc R. Hoffmann - initial API and implementation 10 * 11 *******************************************************************************/ 12 package org.jacoco.ant; 13 14 import java.io.FileInputStream; 15 import java.io.FileOutputStream; 16 import java.io.InputStream; 17 import java.io.OutputStream; 18 19 import org.objectweb.asm.ClassReader; 20 import org.objectweb.asm.ClassWriter; 21 22 /** 23 * Test utility to remove debug information from class files. 24 */ 25 public class RemoveDebugInfos { 26 main(String[] args)27 public static void main(String[] args) throws Exception { 28 final InputStream in = new FileInputStream(args[0]); 29 final ClassReader reader = new ClassReader(in); 30 in.close(); 31 32 final ClassWriter writer = new ClassWriter(0); 33 reader.accept(writer, ClassReader.SKIP_DEBUG); 34 35 final OutputStream out = new FileOutputStream(args[1]); 36 out.write(writer.toByteArray()); 37 out.close(); 38 } 39 40 } 41