# HG changeset patch # User Jaroslav Tulach # Date 1352570488 -3600 # Node ID 32653a09f0db4ff886d8a4c26fccab61f8535e60 # Parent 191185e006ac03b765a04e1270f9e154b017526f Compiling javap against the emul package. Still need impl for our copy of Hashtable and Vector diff -r 191185e006ac -r 32653a09f0db emul/src/main/java/java/io/DataInputStream.java --- a/emul/src/main/java/java/io/DataInputStream.java Sat Nov 10 17:54:30 2012 +0100 +++ b/emul/src/main/java/java/io/DataInputStream.java Sat Nov 10 19:01:28 2012 +0100 @@ -529,7 +529,7 @@ if (--room < 0) { buf = new char[offset + 128]; room = buf.length - offset - 1; - System.arraycopy(lineBuffer, 0, buf, 0, offset); + arraycopy(lineBuffer, 0, buf, 0, offset); lineBuffer = buf; } buf[offset++] = (char) c; @@ -660,4 +660,9 @@ // The number of chars produced may be less than utflen return new String(chararr, 0, chararr_count); } + static void arraycopy(char[] value, int srcBegin, char[] dst, int dstBegin, int count) { + while (count-- > 0) { + dst[dstBegin++] = value[srcBegin++]; + } + } } diff -r 191185e006ac -r 32653a09f0db emul/src/main/java/java/io/PushbackInputStream.java --- a/emul/src/main/java/java/io/PushbackInputStream.java Sat Nov 10 17:54:30 2012 +0100 +++ b/emul/src/main/java/java/io/PushbackInputStream.java Sat Nov 10 19:01:28 2012 +0100 @@ -177,7 +177,7 @@ if (len < avail) { avail = len; } - System.arraycopy(buf, pos, b, off, avail); + arraycopy(buf, pos, b, off, avail); pos += avail; off += avail; len -= avail; @@ -232,7 +232,7 @@ throw new IOException("Push back buffer is full"); } pos -= len; - System.arraycopy(b, off, buf, pos, len); + arraycopy(b, off, buf, pos, len); } /** @@ -380,4 +380,9 @@ in = null; buf = null; } + static void arraycopy(byte[] value, int srcBegin, byte[] dst, int dstBegin, int count) { + while (count-- > 0) { + dst[dstBegin++] = value[srcBegin++]; + } + } } diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/ClassData.java --- a/javap/src/main/java/sun/tools/javap/ClassData.java Sat Nov 10 17:54:30 2012 +0100 +++ b/javap/src/main/java/sun/tools/javap/ClassData.java Sat Nov 10 19:01:28 2012 +0100 @@ -65,18 +65,8 @@ /** * Read classfile to disassemble. */ - public ClassData(InputStream infile){ - try{ - this.read(new DataInputStream(infile)); - }catch (FileNotFoundException ee) { - error("cant read file"); - }catch (Error ee) { - ee.printStackTrace(); - error("fatal error"); - } catch (Exception ee) { - ee.printStackTrace(); - error("fatal exception"); - } + public ClassData(InputStream infile) throws IOException { + this.read(new DataInputStream(infile)); } /** @@ -271,10 +261,6 @@ return toHex(val, width); } - public void error(String msg) { - System.err.println("ERROR:" +msg); - } - /** * Returns the name of this class. */ @@ -571,9 +557,9 @@ for (int k=0; k + */ +final class Hashtable { + + Hashtable(int i) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + Hashtable(int i, double d) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + Hashtable() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + void put(Object keys, Object val) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + Object get(String mnem) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/JavapPrinter.java --- a/javap/src/main/java/sun/tools/javap/JavapPrinter.java Sat Nov 10 17:54:30 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - - -package sun.tools.javap; - -import java.util.*; -import java.io.*; - -import static sun.tools.javap.RuntimeConstants.*; - -/** - * Program to print information about class files - * - * @author Sucheta Dambalkar - */ -public class JavapPrinter { -} diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/StackMapData.java --- a/javap/src/main/java/sun/tools/javap/StackMapData.java Sat Nov 10 17:54:30 2012 +0100 +++ b/javap/src/main/java/sun/tools/javap/StackMapData.java Sat Nov 10 19:01:28 2012 +0100 @@ -68,9 +68,4 @@ return type; } - void print(JavapPrinter p) { - p.out.println(" " + offset + ":"); - p.printMap(" locals = [", locals); - p.printMap(" stack = [", stack); - } } diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/StackMapTableData.java --- a/javap/src/main/java/sun/tools/javap/StackMapTableData.java Sat Nov 10 17:54:30 2012 +0100 +++ b/javap/src/main/java/sun/tools/javap/StackMapTableData.java Sat Nov 10 19:01:28 2012 +0100 @@ -26,7 +26,6 @@ package sun.tools.javap; -import java.util.*; import java.io.*; import static sun.tools.javap.RuntimeConstants.*; @@ -41,24 +40,11 @@ this.frameType = frameType; } - void print(JavapPrinter p) { - p.out.print(" frame_type = " + frameType); - } - static class SameFrame extends StackMapTableData { SameFrame(int frameType, int offsetDelta) { super(frameType); this.offsetDelta = offsetDelta; } - void print(JavapPrinter p) { - super.print(p); - if (frameType < SAME_FRAME_BOUND) { - p.out.println(" /* same */"); - } else { - p.out.println(" /* same_frame_extended */"); - p.out.println(" offset_delta = " + offsetDelta); - } - } } static class SameLocals1StackItem extends StackMapTableData { @@ -68,16 +54,6 @@ this.offsetDelta = offsetDelta; this.stack = stack; } - void print(JavapPrinter p) { - super.print(p); - if (frameType == SAME_LOCALS_1_STACK_ITEM_EXTENDED) { - p.out.println(" /* same_locals_1_stack_item_frame_extended */"); - p.out.println(" offset_delta = " + offsetDelta); - } else { - p.out.println(" /* same_locals_1_stack_item */"); - } - p.printMap(" stack = [", stack); - } } static class ChopFrame extends StackMapTableData { @@ -85,11 +61,6 @@ super(frameType); this.offsetDelta = offsetDelta; } - void print(JavapPrinter p) { - super.print(p); - p.out.println(" /* chop */"); - p.out.println(" offset_delta = " + offsetDelta); - } } static class AppendFrame extends StackMapTableData { @@ -99,12 +70,6 @@ this.offsetDelta = offsetDelta; this.locals = locals; } - void print(JavapPrinter p) { - super.print(p); - p.out.println(" /* append */"); - p.out.println(" offset_delta = " + offsetDelta); - p.printMap(" locals = [", locals); - } } static class FullFrame extends StackMapTableData { @@ -116,13 +81,6 @@ this.locals = locals; this.stack = stack; } - void print(JavapPrinter p) { - super.print(p); - p.out.println(" /* full_frame */"); - p.out.println(" offset_delta = " + offsetDelta); - p.printMap(" locals = [", locals); - p.printMap(" stack = [", stack); - } } static StackMapTableData getInstance(DataInputStream in, MethodData method) diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/Tables.java --- a/javap/src/main/java/sun/tools/javap/Tables.java Sat Nov 10 17:54:30 2012 +0100 +++ b/javap/src/main/java/sun/tools/javap/Tables.java Sat Nov 10 19:01:28 2012 +0100 @@ -26,10 +26,6 @@ package sun.tools.javap; -import java.io.IOException; -import java.io.InputStream; -import java.util.Hashtable; -import java.util.Vector; public class Tables implements Constants { diff -r 191185e006ac -r 32653a09f0db javap/src/main/java/sun/tools/javap/Vector.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javap/src/main/java/sun/tools/javap/Vector.java Sat Nov 10 19:01:28 2012 +0100 @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package sun.tools.javap; + +/** A JavaScript ready replacement for java.util.Vector + * + * @author Jaroslav Tulach + */ +final class Vector { + Vector() { + } + + Vector(int i) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + void add(Object objectType) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + void addElement(Object obj) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + int size() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + void copyInto(String[] accflags) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + Object elementAt(int index) { + throw new UnsupportedOperationException("Not supported yet."); + } + + void setSize(int i) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + void setElementAt(String id, int token) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } +}