Compiling javap against the emul package. Still need impl for our copy of Hashtable and Vector
1.1 --- a/emul/src/main/java/java/io/DataInputStream.java Sat Nov 10 17:54:30 2012 +0100
1.2 +++ b/emul/src/main/java/java/io/DataInputStream.java Sat Nov 10 19:01:28 2012 +0100
1.3 @@ -529,7 +529,7 @@
1.4 if (--room < 0) {
1.5 buf = new char[offset + 128];
1.6 room = buf.length - offset - 1;
1.7 - System.arraycopy(lineBuffer, 0, buf, 0, offset);
1.8 + arraycopy(lineBuffer, 0, buf, 0, offset);
1.9 lineBuffer = buf;
1.10 }
1.11 buf[offset++] = (char) c;
1.12 @@ -660,4 +660,9 @@
1.13 // The number of chars produced may be less than utflen
1.14 return new String(chararr, 0, chararr_count);
1.15 }
1.16 + static void arraycopy(char[] value, int srcBegin, char[] dst, int dstBegin, int count) {
1.17 + while (count-- > 0) {
1.18 + dst[dstBegin++] = value[srcBegin++];
1.19 + }
1.20 + }
1.21 }
2.1 --- a/emul/src/main/java/java/io/PushbackInputStream.java Sat Nov 10 17:54:30 2012 +0100
2.2 +++ b/emul/src/main/java/java/io/PushbackInputStream.java Sat Nov 10 19:01:28 2012 +0100
2.3 @@ -177,7 +177,7 @@
2.4 if (len < avail) {
2.5 avail = len;
2.6 }
2.7 - System.arraycopy(buf, pos, b, off, avail);
2.8 + arraycopy(buf, pos, b, off, avail);
2.9 pos += avail;
2.10 off += avail;
2.11 len -= avail;
2.12 @@ -232,7 +232,7 @@
2.13 throw new IOException("Push back buffer is full");
2.14 }
2.15 pos -= len;
2.16 - System.arraycopy(b, off, buf, pos, len);
2.17 + arraycopy(b, off, buf, pos, len);
2.18 }
2.19
2.20 /**
2.21 @@ -380,4 +380,9 @@
2.22 in = null;
2.23 buf = null;
2.24 }
2.25 + static void arraycopy(byte[] value, int srcBegin, byte[] dst, int dstBegin, int count) {
2.26 + while (count-- > 0) {
2.27 + dst[dstBegin++] = value[srcBegin++];
2.28 + }
2.29 + }
2.30 }
3.1 --- a/javap/src/main/java/sun/tools/javap/ClassData.java Sat Nov 10 17:54:30 2012 +0100
3.2 +++ b/javap/src/main/java/sun/tools/javap/ClassData.java Sat Nov 10 19:01:28 2012 +0100
3.3 @@ -65,18 +65,8 @@
3.4 /**
3.5 * Read classfile to disassemble.
3.6 */
3.7 - public ClassData(InputStream infile){
3.8 - try{
3.9 - this.read(new DataInputStream(infile));
3.10 - }catch (FileNotFoundException ee) {
3.11 - error("cant read file");
3.12 - }catch (Error ee) {
3.13 - ee.printStackTrace();
3.14 - error("fatal error");
3.15 - } catch (Exception ee) {
3.16 - ee.printStackTrace();
3.17 - error("fatal exception");
3.18 - }
3.19 + public ClassData(InputStream infile) throws IOException {
3.20 + this.read(new DataInputStream(infile));
3.21 }
3.22
3.23 /**
3.24 @@ -271,10 +261,6 @@
3.25 return toHex(val, width);
3.26 }
3.27
3.28 - public void error(String msg) {
3.29 - System.err.println("ERROR:" +msg);
3.30 - }
3.31 -
3.32 /**
3.33 * Returns the name of this class.
3.34 */
3.35 @@ -571,9 +557,9 @@
3.36 for (int k=0; k<len; k += Character.charCount(cp)) {
3.37 cp=name.codePointAt(k);
3.38 if (cc=='/') {
3.39 - if (!Character.isJavaIdentifierStart(cp)) break fullname;
3.40 + if (!isJavaIdentifierStart(cp)) break fullname;
3.41 } else if (cp!='/') {
3.42 - if (!Character.isJavaIdentifierPart(cp)) break fullname;
3.43 + if (!isJavaIdentifierPart(cp)) break fullname;
3.44 }
3.45 cc=cp;
3.46 }
3.47 @@ -660,4 +646,12 @@
3.48 public int getMajor_version(){
3.49 return major_version;
3.50 }
3.51 +
3.52 + private boolean isJavaIdentifierStart(int cp) {
3.53 + return ('a' <= cp && cp <= 'z') || ('A' <= cp && cp <= 'Z');
3.54 + }
3.55 +
3.56 + private boolean isJavaIdentifierPart(int cp) {
3.57 + return isJavaIdentifierStart(cp) || ('0' <= cp && cp <= '9');
3.58 + }
3.59 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/javap/src/main/java/sun/tools/javap/Hashtable.java Sat Nov 10 19:01:28 2012 +0100
4.3 @@ -0,0 +1,33 @@
4.4 +/*
4.5 + * To change this template, choose Tools | Templates
4.6 + * and open the template in the editor.
4.7 + */
4.8 +package sun.tools.javap;
4.9 +
4.10 +/** A JavaScript optimized replacement for Hashtable.
4.11 + *
4.12 + * @author Jaroslav Tulach <jtulach@netbeans.org>
4.13 + */
4.14 +final class Hashtable {
4.15 +
4.16 + Hashtable(int i) {
4.17 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4.18 + }
4.19 +
4.20 + Hashtable(int i, double d) {
4.21 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4.22 + }
4.23 +
4.24 + Hashtable() {
4.25 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4.26 + }
4.27 +
4.28 + void put(Object keys, Object val) {
4.29 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4.30 + }
4.31 +
4.32 + Object get(String mnem) {
4.33 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4.34 + }
4.35 +
4.36 +}
5.1 --- a/javap/src/main/java/sun/tools/javap/JavapPrinter.java Sat Nov 10 17:54:30 2012 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,40 +0,0 @@
5.4 -/*
5.5 - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
5.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5.7 - *
5.8 - * This code is free software; you can redistribute it and/or modify it
5.9 - * under the terms of the GNU General Public License version 2 only, as
5.10 - * published by the Free Software Foundation. Oracle designates this
5.11 - * particular file as subject to the "Classpath" exception as provided
5.12 - * by Oracle in the LICENSE file that accompanied this code.
5.13 - *
5.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
5.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5.17 - * version 2 for more details (a copy is included in the LICENSE file that
5.18 - * accompanied this code).
5.19 - *
5.20 - * You should have received a copy of the GNU General Public License version
5.21 - * 2 along with this work; if not, write to the Free Software Foundation,
5.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5.23 - *
5.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5.25 - * or visit www.oracle.com if you need additional information or have any
5.26 - * questions.
5.27 - */
5.28 -
5.29 -
5.30 -package sun.tools.javap;
5.31 -
5.32 -import java.util.*;
5.33 -import java.io.*;
5.34 -
5.35 -import static sun.tools.javap.RuntimeConstants.*;
5.36 -
5.37 -/**
5.38 - * Program to print information about class files
5.39 - *
5.40 - * @author Sucheta Dambalkar
5.41 - */
5.42 -public class JavapPrinter {
5.43 -}
6.1 --- a/javap/src/main/java/sun/tools/javap/StackMapData.java Sat Nov 10 17:54:30 2012 +0100
6.2 +++ b/javap/src/main/java/sun/tools/javap/StackMapData.java Sat Nov 10 19:01:28 2012 +0100
6.3 @@ -68,9 +68,4 @@
6.4 return type;
6.5 }
6.6
6.7 - void print(JavapPrinter p) {
6.8 - p.out.println(" " + offset + ":");
6.9 - p.printMap(" locals = [", locals);
6.10 - p.printMap(" stack = [", stack);
6.11 - }
6.12 }
7.1 --- a/javap/src/main/java/sun/tools/javap/StackMapTableData.java Sat Nov 10 17:54:30 2012 +0100
7.2 +++ b/javap/src/main/java/sun/tools/javap/StackMapTableData.java Sat Nov 10 19:01:28 2012 +0100
7.3 @@ -26,7 +26,6 @@
7.4
7.5 package sun.tools.javap;
7.6
7.7 -import java.util.*;
7.8 import java.io.*;
7.9
7.10 import static sun.tools.javap.RuntimeConstants.*;
7.11 @@ -41,24 +40,11 @@
7.12 this.frameType = frameType;
7.13 }
7.14
7.15 - void print(JavapPrinter p) {
7.16 - p.out.print(" frame_type = " + frameType);
7.17 - }
7.18 -
7.19 static class SameFrame extends StackMapTableData {
7.20 SameFrame(int frameType, int offsetDelta) {
7.21 super(frameType);
7.22 this.offsetDelta = offsetDelta;
7.23 }
7.24 - void print(JavapPrinter p) {
7.25 - super.print(p);
7.26 - if (frameType < SAME_FRAME_BOUND) {
7.27 - p.out.println(" /* same */");
7.28 - } else {
7.29 - p.out.println(" /* same_frame_extended */");
7.30 - p.out.println(" offset_delta = " + offsetDelta);
7.31 - }
7.32 - }
7.33 }
7.34
7.35 static class SameLocals1StackItem extends StackMapTableData {
7.36 @@ -68,16 +54,6 @@
7.37 this.offsetDelta = offsetDelta;
7.38 this.stack = stack;
7.39 }
7.40 - void print(JavapPrinter p) {
7.41 - super.print(p);
7.42 - if (frameType == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
7.43 - p.out.println(" /* same_locals_1_stack_item_frame_extended */");
7.44 - p.out.println(" offset_delta = " + offsetDelta);
7.45 - } else {
7.46 - p.out.println(" /* same_locals_1_stack_item */");
7.47 - }
7.48 - p.printMap(" stack = [", stack);
7.49 - }
7.50 }
7.51
7.52 static class ChopFrame extends StackMapTableData {
7.53 @@ -85,11 +61,6 @@
7.54 super(frameType);
7.55 this.offsetDelta = offsetDelta;
7.56 }
7.57 - void print(JavapPrinter p) {
7.58 - super.print(p);
7.59 - p.out.println(" /* chop */");
7.60 - p.out.println(" offset_delta = " + offsetDelta);
7.61 - }
7.62 }
7.63
7.64 static class AppendFrame extends StackMapTableData {
7.65 @@ -99,12 +70,6 @@
7.66 this.offsetDelta = offsetDelta;
7.67 this.locals = locals;
7.68 }
7.69 - void print(JavapPrinter p) {
7.70 - super.print(p);
7.71 - p.out.println(" /* append */");
7.72 - p.out.println(" offset_delta = " + offsetDelta);
7.73 - p.printMap(" locals = [", locals);
7.74 - }
7.75 }
7.76
7.77 static class FullFrame extends StackMapTableData {
7.78 @@ -116,13 +81,6 @@
7.79 this.locals = locals;
7.80 this.stack = stack;
7.81 }
7.82 - void print(JavapPrinter p) {
7.83 - super.print(p);
7.84 - p.out.println(" /* full_frame */");
7.85 - p.out.println(" offset_delta = " + offsetDelta);
7.86 - p.printMap(" locals = [", locals);
7.87 - p.printMap(" stack = [", stack);
7.88 - }
7.89 }
7.90
7.91 static StackMapTableData getInstance(DataInputStream in, MethodData method)
8.1 --- a/javap/src/main/java/sun/tools/javap/Tables.java Sat Nov 10 17:54:30 2012 +0100
8.2 +++ b/javap/src/main/java/sun/tools/javap/Tables.java Sat Nov 10 19:01:28 2012 +0100
8.3 @@ -26,10 +26,6 @@
8.4
8.5 package sun.tools.javap;
8.6
8.7 -import java.io.IOException;
8.8 -import java.io.InputStream;
8.9 -import java.util.Hashtable;
8.10 -import java.util.Vector;
8.11
8.12
8.13 public class Tables implements Constants {
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/javap/src/main/java/sun/tools/javap/Vector.java Sat Nov 10 19:01:28 2012 +0100
9.3 @@ -0,0 +1,45 @@
9.4 +/*
9.5 + * To change this template, choose Tools | Templates
9.6 + * and open the template in the editor.
9.7 + */
9.8 +package sun.tools.javap;
9.9 +
9.10 +/** A JavaScript ready replacement for java.util.Vector
9.11 + *
9.12 + * @author Jaroslav Tulach <jtulach@netbeans.org>
9.13 + */
9.14 +final class Vector {
9.15 + Vector() {
9.16 + }
9.17 +
9.18 + Vector(int i) {
9.19 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.20 + }
9.21 +
9.22 + void add(Object objectType) {
9.23 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.24 + }
9.25 + void addElement(Object obj) {
9.26 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.27 + }
9.28 +
9.29 + int size() {
9.30 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.31 + }
9.32 +
9.33 + void copyInto(String[] accflags) {
9.34 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.35 + }
9.36 +
9.37 + Object elementAt(int index) {
9.38 + throw new UnsupportedOperationException("Not supported yet.");
9.39 + }
9.40 +
9.41 + void setSize(int i) {
9.42 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.43 + }
9.44 +
9.45 + void setElementAt(String id, int token) {
9.46 + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
9.47 + }
9.48 +}