![]() |
![]() |
xalan-2.7.116:54:46.173 INFO jd.cli.Main - Decompiling xalan-2.7.1.jar package java_cup.runtime; import java.io.PrintStream; import java.util.Stack; import java.util.Vector; public abstract class lr_parser { protected static final int _error_sync_size = 3; public lr_parser(Scanner paramScanner) { this(); setScanner(paramScanner); } protected int error_sync_size() { return 3; } protected boolean _done_parsing = false; protected int tos; protected Symbol cur_token; public void done_parsing() { _done_parsing = true; } protected Stack stack = new Stack(); protected short[][] production_tab; protected short[][] action_tab; protected short[][] reduce_tab; private Scanner _scanner; protected Symbol[] lookahead; protected int lookahead_pos; public void setScanner(Scanner paramScanner) { _scanner = paramScanner; } public Scanner getScanner() { return _scanner; } public Symbol scan() throws Exception { Symbol localSymbol = getScanner().next_token(); return localSymbol != null ? localSymbol : new Symbol(EOF_sym()); } public void report_fatal_error(String paramString, Object paramObject) throws Exception { done_parsing(); report_error(paramString, paramObject); throw new Exception("Can't recover from previous error(s)"); } public void report_error(String paramString, Object paramObject) { System.err.print(paramString); if ((paramObject instanceof Symbol)) { if (left != -1) { System.err.println(" at character " + left + " of input"); } else { System.err.println(""); } } else { System.err.println(""); } } public void syntax_error(Symbol paramSymbol) { report_error("Syntax error", paramSymbol); } public void unrecovered_syntax_error(Symbol paramSymbol) throws Exception { report_fatal_error("Couldn't repair and continue parse", paramSymbol); } protected final short get_action(int paramInt1, int paramInt2) { short[] arrayOfShort = action_tab[paramInt1]; int m; if (arrayOfShort.length < 20) { for (m = 0; m < arrayOfShort.length; m++) { int i = arrayOfShort[(m++)]; if ((i == paramInt2) || (i == -1)) { return arrayOfShort[m]; } } } else { int j = 0; int k = (arrayOfShort.length - 1) / 2 - 1; while (j <= k) { m = (j + k) / 2; if (paramInt2 == arrayOfShort[(m * 2)]) { return arrayOfShort[(m * 2 + 1)]; } if (paramInt2 > arrayOfShort[(m * 2)]) { j = m + 1; } else { k = m - 1; } } return arrayOfShort[(arrayOfShort.length - 1)]; } return 0; } protected final short get_reduce(int paramInt1, int paramInt2) { short[] arrayOfShort = reduce_tab[paramInt1]; if (arrayOfShort == null) { return -1; } for (int j = 0; j < arrayOfShort.length; j++) { int i = arrayOfShort[(j++)]; if ((i == paramInt2) || (i == -1)) { return arrayOfShort[j]; } } return -1; } public Symbol parse() throws Exception { Symbol localSymbol = null; production_tab = production_table(); action_tab = action_table(); reduce_tab = reduce_table(); init_actions(); user_init(); cur_token = scan(); stack.removeAllElements(); stack.push(new Symbol(0, start_state())); tos = 0; for (_done_parsing = false; !_done_parsing;) { if (cur_token.used_by_parser) { throw new Error("Symbol recycling detected (fix your scanner)."); } int i = get_action(stack.peek()).parse_state, cur_token.sym); if (i > 0) { cur_token.parse_state = (i - 1); cur_token.used_by_parser = true; stack.push(cur_token); tos += 1; cur_token = scan(); } else if (i < 0) { localSymbol = do_action(-i - 1, this, stack, tos); int k = production_tab[(-i - 1)][0]; int j = production_tab[(-i - 1)][1]; for (int m = 0; m < j; m++) { stack.pop(); tos -= 1; } i = get_reduce(stack.peek()).parse_state, k); parse_state = i; used_by_parser = true; stack.push(localSymbol); tos += 1; } else if (i == 0) { syntax_error(cur_token); if (!error_recovery(false)) { unrecovered_syntax_error(cur_token); done_parsing(); } else { localSymbol = (Symbol)stack.peek(); } } } return localSymbol; } public void debug_message(String paramString) { System.err.println(paramString); } public void dump_stack() { if (stack == null) { debug_message("# Stack dump requested, but stack is null"); return; } debug_message("============ Parse Stack Dump ============"); for (int i = 0; i < stack.size(); i++) { debug_message("Symbol: " + stack.elementAt(i)).sym + " State: " + stack.elementAt(i)).parse_state); } debug_message("=========================================="); } public void debug_reduce(int paramInt1, int paramInt2, int paramInt3) { debug_message("# Reduce with prod #" + paramInt1 + " [NT=" + paramInt2 + ", " + "SZ=" + paramInt3 + "]"); } public void debug_shift(Symbol paramSymbol) { debug_message("# Shift under term #" + sym + " to state #" + parse_state); } public void debug_stack() { StringBuffer localStringBuffer = new StringBuffer("## STACK:"); for (int i = 0; i < stack.size(); i++) { Symbol localSymbol = (Symbol)stack.elementAt(i); localStringBuffer.append(" <state " + parse_state + ", sym " + sym + ">"); if ((i % 3 == 2) || (i == stack.size() - 1)) { debug_message(localStringBuffer.toString()); localStringBuffer = new StringBuffer(" "); } } } public Symbol debug_parse() throws Exception { Symbol localSymbol = null; production_tab = production_table(); action_tab = action_table(); reduce_tab = reduce_table(); debug_message("# Initializing parser"); init_actions(); user_init(); cur_token = scan(); debug_message("# Current Symbol is #" + cur_token.sym); stack.removeAllElements(); stack.push(new Symbol(0, start_state())); tos = 0; for (_done_parsing = false; !_done_parsing;) { if (cur_token.used_by_parser) { throw new Error("Symbol recycling detected (fix your scanner)."); } int i = get_action(stack.peek()).parse_state, cur_token.sym); if (i > 0) { cur_token.parse_state = (i - 1); cur_token.used_by_parser = true; debug_shift(cur_token); stack.push(cur_token); tos += 1; cur_token = scan(); debug_message("# Current token is " + cur_token); } else if (i < 0) { localSymbol = do_action(-i - 1, this, stack, tos); int k = production_tab[(-i - 1)][0]; int j = production_tab[(-i - 1)][1]; debug_reduce(-i - 1, k, j); for (int m = 0; m < j; m++) { stack.pop(); tos -= 1; } i = get_reduce(stack.peek()).parse_state, k); debug_message("# Reduce rule: top state " + stack.peek()).parse_state + ", lhs sym " + k + " -> state " + i); parse_state = i; used_by_parser = true; stack.push(localSymbol); tos += 1; debug_message("# Goto state #" + i); } else if (i == 0) { syntax_error(cur_token); if (!error_recovery(true)) { unrecovered_syntax_error(cur_token); done_parsing(); } else { localSymbol = (Symbol)stack.peek(); } } } return localSymbol; } protected boolean error_recovery(boolean paramBoolean) throws Exception { if (paramBoolean) { debug_message("# Attempting error recovery"); } if (!find_recovery_config(paramBoolean)) { if (paramBoolean) { debug_message("# Error recovery fails"); } return false; } read_lookahead(); for (;;) { if (paramBoolean) { debug_message("# Trying to parse ahead"); } if (try_parse_ahead(paramBoolean)) { break; } if (lookahead[0].sym == EOF_sym()) { if (paramBoolean) { debug_message("# Error recovery fails at EOF"); } return false; } if (paramBoolean) { debug_message("# Consuming Symbol #" + lookahead[0].sym); } restart_lookahead(); } if (paramBoolean) { debug_message("# Parse-ahead ok, going back to normal parse"); } parse_lookahead(paramBoolean); return true; } protected boolean shift_under_error() { return get_action(stack.peek()).parse_state, error_sym()) > 0; } protected boolean find_recovery_config(boolean paramBoolean) { if (paramBoolean) { debug_message("# Finding recovery state on stack"); } int j = stack.peek()).right; int k = stack.peek()).left; while (!shift_under_error()) { if (paramBoolean) { debug_message("# Pop stack by one, state was # " + stack.peek()).parse_state); } k = stack.pop()).left; tos -= 1; if (stack.empty()) { if (paramBoolean) { debug_message("# No recovery state found on stack"); } return false; } } int i = get_action(stack.peek()).parse_state, error_sym()); if (paramBoolean) { debug_message("# Recover state found (#" + stack.peek()).parse_state + ")"); debug_message("# Shifting on error to state #" + (i - 1)); } Symbol localSymbol = new Symbol(error_sym(), k, j); parse_state = (i - 1); used_by_parser = true; stack.push(localSymbol); tos += 1; return true; } protected void read_lookahead() throws Exception { lookahead = new Symbol[error_sync_size()]; for (int i = 0; i < error_sync_size(); i++) { lookahead[i] = cur_token; cur_token = scan(); } lookahead_pos = 0; } protected Symbol cur_err_token() { return lookahead[lookahead_pos]; } protected boolean advance_lookahead() { lookahead_pos += 1; return lookahead_pos < error_sync_size(); } protected void restart_lookahead() throws Exception { for (int i = 1; i < error_sync_size(); i++) { lookahead[(i - 1)] = lookahead[i]; } lookahead[(error_sync_size() - 1)] = cur_token; cur_token = scan(); lookahead_pos = 0; } protected boolean try_parse_ahead(boolean paramBoolean) throws Exception { virtual_parse_stack localvirtual_parse_stack = new virtual_parse_stack(stack); for (;;) { int i = get_action(localvirtual_parse_stack.top(), cur_err_tokensym); if (i == 0) { return false; } if (i > 0) { localvirtual_parse_stack.push(i - 1); if (paramBoolean) { debug_message("# Parse-ahead shifts Symbol #" + cur_err_tokensym + " into state #" + (i - 1)); } if (!advance_lookahead()) { return true; } } else { if (-i - 1 == start_production()) { if (paramBoolean) { debug_message("# Parse-ahead accepts"); } return true; } int j = production_tab[(-i - 1)][0]; int k = production_tab[(-i - 1)][1]; for (int m = 0; m < k; m++) { localvirtual_parse_stack.pop(); } if (paramBoolean) { debug_message("# Parse-ahead reduces: handle size = " + k + " lhs = #" + j + " from state #" + localvirtual_parse_stack.top()); } localvirtual_parse_stack.push(get_reduce(localvirtual_parse_stack.top(), j)); if (paramBoolean) { debug_message("# Goto state #" + localvirtual_parse_stack.top()); } } } } protected void parse_lookahead(boolean paramBoolean) throws Exception { Symbol localSymbol = null; lookahead_pos = 0; if (paramBoolean) { debug_message("# Reparsing saved input with actions"); debug_message("# Current Symbol is #" + cur_err_tokensym); debug_message("# Current state is #" + stack.peek()).parse_state); } while (!_done_parsing) { int i = get_action(stack.peek()).parse_state, cur_err_tokensym); if (i > 0) { cur_err_tokenparse_state = (i - 1); cur_err_tokenused_by_parser = true; if (paramBoolean) { debug_shift(cur_err_token()); } stack.push(cur_err_token()); tos += 1; if (!advance_lookahead()) { if (paramBoolean) { debug_message("# Completed reparse"); } return; } if (paramBoolean) { debug_message("# Current Symbol is #" + cur_err_tokensym); } } else if (i < 0) { localSymbol = do_action(-i - 1, this, stack, tos); int k = production_tab[(-i - 1)][0]; int j = production_tab[(-i - 1)][1]; if (paramBoolean) { debug_reduce(-i - 1, k, j); } for (int m = 0; m < j; m++) { stack.pop(); tos -= 1; } i = get_reduce(stack.peek()).parse_state, k); parse_state = i; used_by_parser = true; stack.push(localSymbol); tos += 1; if (paramBoolean) { debug_message("# Goto state #" + i); } } else if (i == 0) { report_fatal_error("Syntax error", localSymbol); return; } } } protected static short[][] unpackFromStrings(String[] paramArrayOfString) { StringBuffer localStringBuffer = new StringBuffer(paramArrayOfString[0]); for (int i = 1; i < paramArrayOfString.length; i++) { localStringBuffer.append(paramArrayOfString[i]); } int j = 0; int k = localStringBuffer.charAt(j) << '\020' | localStringBuffer.charAt(j + 1);j += 2; short[][] arrayOfShort = new short[k][]; for (int m = 0; m < k; m++) { int n = localStringBuffer.charAt(j) << '\020' | localStringBuffer.charAt(j + 1);j += 2; arrayOfShort[m] = new short[n]; for (int i1 = 0; i1 < n; i1++) { arrayOfShort[m][i1] = ((short)(localStringBuffer.charAt(j++) - '\002')); } } return arrayOfShort; } public lr_parser() {} public abstract int EOF_sym(); public abstract short[][] action_table(); public abstract Symbol do_action(int paramInt1, lr_parser paramlr_parser, Stack paramStack, int paramInt2) throws Exception; public abstract int error_sym(); protected abstract void init_actions() throws Exception; public abstract short[][] production_table(); public abstract short[][] reduce_table(); public abstract int start_production(); public abstract int start_state(); public void user_init() throws Exception {} } /* Location: * Qualified Name: java_cup.runtime.lr_parser * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package java_cup.runtime; public abstract interface Scanner { public abstract Symbol next_token() throws Exception; } /* Location: * Qualified Name: java_cup.runtime.Scanner * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package java_cup.runtime; public class Symbol { public int sym; public int parse_state; public Symbol(int paramInt1, int paramInt2, int paramInt3, Object paramObject) { this(paramInt1); left = paramInt2; right = paramInt3; value = paramObject; } public Symbol(int paramInt, Object paramObject) { this(paramInt, -1, -1, paramObject); } public Symbol(int paramInt1, int paramInt2, int paramInt3) { this(paramInt1, paramInt2, paramInt3, null); } public Symbol(int paramInt) { this(paramInt, -1); left = -1; right = -1; value = null; } Symbol(int paramInt1, int paramInt2) { sym = paramInt1; parse_state = paramInt2; } boolean used_by_parser = false; public int left; public int right; public Object value; public String toString() { return "#" + sym; } } /* Location: * Qualified Name: java_cup.runtime.Symbol * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package java_cup.runtime; import java.util.Stack; import java.util.Vector; public class virtual_parse_stack { protected Stack real_stack; protected int real_next; protected Stack vstack; public virtual_parse_stack(Stack paramStack) throws Exception { if (paramStack == null) { throw new Exception( "Internal parser error: attempt to create null virtual stack"); } real_stack = paramStack; vstack = new Stack(); real_next = 0; get_from_real(); } protected void get_from_real() { if (real_next >= real_stack.size()) { return; } Symbol localSymbol = (Symbol)real_stack.elementAt(real_stack.size() - 1 - real_next); real_next += 1; vstack.push(new Integer(parse_state)); } public boolean empty() { return vstack.empty(); } public int top() throws Exception { if (vstack.empty()) { throw new Exception( "Internal parser error: top() called on empty virtual stack"); } return ((Integer)vstack.peek()).intValue(); } public void pop() throws Exception { if (vstack.empty()) { throw new Exception( "Internal parser error: pop from empty virtual stack"); } vstack.pop(); if (vstack.empty()) { get_from_real(); } } public void push(int paramInt) { vstack.push(new Integer(paramInt)); } } /* Location: * Qualified Name: java_cup.runtime.virtual_parse_stack * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; public abstract class AccessFlags { protected int access_flags; public AccessFlags() {} public AccessFlags(int a) { access_flags = a; } public final int getAccessFlags() { return access_flags; } public final void setAccessFlags(int access_flags) { this.access_flags = access_flags; } private final void setFlag(int flag, boolean set) { if ((access_flags & flag) != 0) { if (!set) { access_flags ^= flag; } } else if (set) { access_flags |= flag; } } public final void isPublic(boolean flag) { setFlag(1, flag); } public final boolean isPublic() { return (access_flags & 0x1) != 0; } public final void isPrivate(boolean flag) { setFlag(2, flag); } public final boolean isPrivate() { return (access_flags & 0x2) != 0; } public final void isProtected(boolean flag) { setFlag(4, flag); } public final boolean isProtected() { return (access_flags & 0x4) != 0; } public final void isStatic(boolean flag) { setFlag(8, flag); } public final boolean isStatic() { return (access_flags & 0x8) != 0; } public final void isFinal(boolean flag) { setFlag(16, flag); } public final boolean isFinal() { return (access_flags & 0x10) != 0; } public final void isSynchronized(boolean flag) { setFlag(32, flag); } public final boolean isSynchronized() { return (access_flags & 0x20) != 0; } public final void isVolatile(boolean flag) { setFlag(64, flag); } public final boolean isVolatile() { return (access_flags & 0x40) != 0; } public final void isTransient(boolean flag) { setFlag(128, flag); } public final boolean isTransient() { return (access_flags & 0x80) != 0; } public final void isNative(boolean flag) { setFlag(256, flag); } public final boolean isNative() { return (access_flags & 0x100) != 0; } public final void isInterface(boolean flag) { setFlag(512, flag); } public final boolean isInterface() { return (access_flags & 0x200) != 0; } public final void isAbstract(boolean flag) { setFlag(1024, flag); } public final boolean isAbstract() { return (access_flags & 0x400) != 0; } public final void isStrictfp(boolean flag) { setFlag(2048, flag); } public final boolean isStrictfp() { return (access_flags & 0x800) != 0; } } /* Location: * Qualified Name: org.apache.bcel.classfile.AccessFlags * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.HashMap; public abstract class Attribute implements Cloneable, Node { protected int name_index; protected int length; protected byte tag; protected ConstantPool constant_pool; Attribute(byte tag, int name_index, int length, ConstantPool constant_pool) { this.tag = tag; this.name_index = name_index; this.length = length; this.constant_pool = constant_pool; } public abstract void accept(Visitor paramVisitor); public void dump(DataOutputStream file) throws IOException { file.writeShort(name_index); file.writeInt(length); } private static HashMap readers = new HashMap(); public static void addAttributeReader(String name, AttributeReader r) { readers.put(name, r); } public static void removeAttributeReader(String name) { readers.remove(name); } static final Attribute readAttribute(DataInputStream file, ConstantPool constant_pool) throws IOException, ClassFormatError, InternalError { byte tag = -1; int name_index = file.readUnsignedShort(); ConstantUtf8 c = (ConstantUtf8)constant_pool.getConstant(name_index, (byte)1); String name = c.getBytes(); int length = file.readInt(); for (byte i = 0; i < 12; i = (byte)(i + 1)) { if (name.equals(org.apache.bcel.Constants.ATTRIBUTE_NAMES[i])) { tag = i; break; } } switch (tag) { case -1: AttributeReader r = (AttributeReader)readers.get(name); if (r != null) { return r.createAttribute(name_index, length, file, constant_pool); } return new Unknown(name_index, length, file, constant_pool); case 1: return new ConstantValue(name_index, length, file, constant_pool); case 0: return new SourceFile(name_index, length, file, constant_pool); case 2: return new Code(name_index, length, file, constant_pool); case 3: return new ExceptionTable(name_index, length, file, constant_pool); case 4: return new LineNumberTable(name_index, length, file, constant_pool); case 5: return new LocalVariableTable(name_index, length, file, constant_pool); case 6: return new InnerClasses(name_index, length, file, constant_pool); case 7: return new Synthetic(name_index, length, file, constant_pool); case 8: return new Deprecated(name_index, length, file, constant_pool); case 9: return new PMGClass(name_index, length, file, constant_pool); case 10: return new Signature(name_index, length, file, constant_pool); case 11: return new StackMap(name_index, length, file, constant_pool); } throw new InternalError("Ooops! default case reached."); } public final int getLength() { return length; } public final void setLength(int length) { this.length = length; } public final void setNameIndex(int name_index) { this.name_index = name_index; } public final int getNameIndex() { return name_index; } public final byte getTag() { return tag; } public final ConstantPool getConstantPool() { return constant_pool; } public final void setConstantPool(ConstantPool constant_pool) { this.constant_pool = constant_pool; } public Object clone() { Object o = null; try { o = super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return o; } public abstract Attribute copy(ConstantPool paramConstantPool); public String toString() { return org.apache.bcel.Constants.ATTRIBUTE_NAMES[tag]; } } /* Location: * Qualified Name: org.apache.bcel.classfile.Attribute * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.DataInputStream; public abstract interface AttributeReader { public abstract Attribute createAttribute(int paramInt1, int paramInt2, DataInputStream paramDataInputStream, ConstantPool paramConstantPool); } /* Location: * Qualified Name: org.apache.bcel.classfile.AttributeReader * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; public final class ClassParser { private DataInputStream file; private ZipFile zip; private String file_name; private int class_name_index; private int superclass_name_index; private int major; private int minor; private int access_flags; private int[] interfaces; private ConstantPool constant_pool; private Field[] fields; private Method[] methods; private Attribute[] attributes; private boolean is_zip; private static final int BUFSIZE = 8192; public ClassParser(InputStream file, String file_name) { this.file_name = file_name; String clazz = file.getClass().getName(); is_zip = ((clazz.startsWith("java.util.zip.")) || (clazz.startsWith("java.util.jar."))); if ((file instanceof DataInputStream)) { this.file = ((DataInputStream)file); } else { this.file = new DataInputStream(new BufferedInputStream(file, 8192)); } } public ClassParser(String file_name) throws IOException { is_zip = false; this.file_name = file_name; file = new DataInputStream(new BufferedInputStream(new FileInputStream(file_name), 8192)); } public ClassParser(String zip_file, String file_name) throws IOException { is_zip = true; zip = new ZipFile(zip_file); ZipEntry entry = zip.getEntry(file_name); this.file_name = file_name; file = new DataInputStream(new BufferedInputStream(zip.getInputStream(entry), 8192)); } public JavaClass parse() throws IOException, ClassFormatError { readID(); readVersion(); readConstantPool(); readClassInfo(); readInterfaces(); readFields(); readMethods(); readAttributes(); file.close(); if (zip != null) { zip.close(); } return new JavaClass(class_name_index, superclass_name_index, file_name, major, minor, access_flags, constant_pool, interfaces, fields, methods, attributes, (byte)(is_zip ? 3 : 2)); } private final void readAttributes() throws IOException, ClassFormatError { int attributes_count = file.readUnsignedShort(); attributes = new Attribute[attributes_count]; for (int i = 0; i < attributes_count; i++) { attributes[i] = Attribute.readAttribute(file, constant_pool); } } private final void readClassInfo() throws IOException, ClassFormatError { access_flags = file.readUnsignedShort(); if ((access_flags & 0x200) != 0) { access_flags |= 0x400; } if (((access_flags & 0x400) != 0) && ((access_flags & 0x10) != 0)) { throw new ClassFormatError("Class can't be both final and abstract"); } class_name_index = file.readUnsignedShort(); superclass_name_index = file.readUnsignedShort(); } private final void readConstantPool() throws IOException, ClassFormatError { constant_pool = new ConstantPool(file); } private final void readFields() throws IOException, ClassFormatError { int fields_count = file.readUnsignedShort(); fields = new Field[fields_count]; for (int i = 0; i < fields_count; i++) { fields[i] = new Field(file, constant_pool); } } private final void readID() throws IOException, ClassFormatError { int magic = -889275714; if (file.readInt() != magic) { throw new ClassFormatError(file_name + " is not a Java .class file"); } } private final void readInterfaces() throws IOException, ClassFormatError { int interfaces_count = file.readUnsignedShort(); interfaces = new int[interfaces_count]; for (int i = 0; i < interfaces_count; i++) { interfaces[i] = file.readUnsignedShort(); } } private final void readMethods() throws IOException, ClassFormatError { int methods_count = file.readUnsignedShort(); methods = new Method[methods_count]; for (int i = 0; i < methods_count; i++) { methods[i] = new Method(file, constant_pool); } } private final void readVersion() throws IOException, ClassFormatError { minor = file.readUnsignedShort(); major = file.readUnsignedShort(); } } /* Location: * Qualified Name: org.apache.bcel.classfile.ClassParser * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public final class Code extends Attribute { private int max_stack; private int max_locals; private int code_length; private byte[] code; private int exception_table_length; private CodeException[] exception_table; private int attributes_count; private Attribute[] attributes; public Code(Code c) { this(c.getNameIndex(), c.getLength(), c.getMaxStack(), c.getMaxLocals(), c.getCode(), c.getExceptionTable(), c.getAttributes(), c.getConstantPool()); } Code(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException { this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(), (byte[])null, (CodeException[])null, (Attribute[])null, constant_pool); code_length = file.readInt(); code = new byte[code_length]; file.readFully(code); exception_table_length = file.readUnsignedShort(); exception_table = new CodeException[exception_table_length]; for (int i = 0; i < exception_table_length; i++) { exception_table[i] = new CodeException(file); } attributes_count = file.readUnsignedShort(); attributes = new Attribute[attributes_count]; for (int i = 0; i < attributes_count; i++) { attributes[i] = Attribute.readAttribute(file, constant_pool); } this.length = length; } public Code(int name_index, int length, int max_stack, int max_locals, byte[] code, CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool) { super((byte)2, name_index, length, constant_pool); this.max_stack = max_stack; this.max_locals = max_locals; setCode(code); setExceptionTable(exception_table); setAttributes(attributes); } public void accept(Visitor v) { v.visitCode(this); } public final void dump(DataOutputStream file) throws IOException { super.dump(file); file.writeShort(max_stack); file.writeShort(max_locals); file.writeInt(code_length); file.write(code, 0, code_length); file.writeShort(exception_table_length); for (int i = 0; i < exception_table_length; i++) { exception_table[i].dump(file); } file.writeShort(attributes_count); for (int i = 0; i < attributes_count; i++) { attributes[i].dump(file); } } public final Attribute[] getAttributes() { return attributes; } public LineNumberTable getLineNumberTable() { for (int i = 0; i < attributes_count; i++) { if ((attributes[i] instanceof LineNumberTable)) { return (LineNumberTable)attributes[i]; } } return null; } public LocalVariableTable getLocalVariableTable() { for (int i = 0; i < attributes_count; i++) { if ((attributes[i] instanceof LocalVariableTable)) { return (LocalVariableTable)attributes[i]; } } return null; } public final byte[] getCode() { return code; } public final CodeException[] getExceptionTable() { return exception_table; } public final int getMaxLocals() { return max_locals; } public final int getMaxStack() { return max_stack; } private final int getInternalLength() { return 8 + code_length + 2 + 8 * exception_table_length + 2; } private final int calculateLength() { int len = 0; for (int i = 0; i < attributes_count; i++) { len += attributes[i].length + 6; } return len + getInternalLength(); } public final void setAttributes(Attribute[] attributes) { this.attributes = attributes; attributes_count = (attributes == null ? 0 : attributes.length); length = calculateLength(); } public final void setCode(byte[] code) { this.code = code; code_length = (code == null ? 0 : code.length); } public final void setExceptionTable(CodeException[] exception_table) { this.exception_table = exception_table; exception_table_length = (exception_table == null ? 0 : exception_table.length); } public final void setMaxLocals(int max_locals) { this.max_locals = max_locals; } public final void setMaxStack(int max_stack) { this.max_stack = max_stack; } public final String toString(boolean verbose) { StringBuffer buf = new StringBuffer("Code(max_stack = " + max_stack + ", max_locals = " + max_locals + ", code_length = " + code_length + ")\n" + Utility.codeToString(code, constant_pool, 0, -1, verbose)); if (exception_table_length > 0) { buf.append("\nException handler(s) = \nFrom\tTo\tHandler\tType\n"); for (int i = 0; i < exception_table_length; i++) { buf.append(exception_table[i].toString(constant_pool, verbose) + "\n"); } } if (attributes_count > 0) { buf.append("\nAttribute(s) = \n"); for (int i = 0; i < attributes_count; i++) { buf.append(attributes[i].toString() + "\n"); } } return buf.toString(); } public final String toString() { return toString(true); } public Attribute copy(ConstantPool constant_pool) { Code c = (Code)clone(); code = ((byte[])code.clone()); constant_pool = constant_pool; exception_table = new CodeException[exception_table_length]; for (int i = 0; i < exception_table_length; i++) { exception_table[i] = exception_table[i].copy(); } attributes = new Attribute[attributes_count]; for (int i = 0; i < attributes_count; i++) { attributes[i] = attributes[i].copy(constant_pool); } return c; } } /* Location: * Qualified Name: org.apache.bcel.classfile.Code * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.bcel.Constants; public final class CodeException implements Cloneable, Constants, Node { private int start_pc; private int end_pc; private int handler_pc; private int catch_type; public CodeException(CodeException c) { this(c.getStartPC(), c.getEndPC(), c.getHandlerPC(), c.getCatchType()); } CodeException(DataInputStream file) throws IOException { this(file.readUnsignedShort(), file.readUnsignedShort(), file.readUnsignedShort(), file.readUnsignedShort()); } public CodeException(int start_pc, int end_pc, int handler_pc, int catch_type) { this.start_pc = start_pc; this.end_pc = end_pc; this.handler_pc = handler_pc; this.catch_type = catch_type; } public void accept(Visitor v) { v.visitCodeException(this); } public final void dump(DataOutputStream file) throws IOException { file.writeShort(start_pc); file.writeShort(end_pc); file.writeShort(handler_pc); file.writeShort(catch_type); } public final int getCatchType() { return catch_type; } public final int getEndPC() { return end_pc; } public final int getHandlerPC() { return handler_pc; } public final int getStartPC() { return start_pc; } public final void setCatchType(int catch_type) { this.catch_type = catch_type; } public final void setEndPC(int end_pc) { this.end_pc = end_pc; } public final void setHandlerPC(int handler_pc) { this.handler_pc = handler_pc; } public final void setStartPC(int start_pc) { this.start_pc = start_pc; } public final String toString() { return "CodeException(start_pc = " + start_pc + ", end_pc = " + end_pc + ", handler_pc = " + handler_pc + ", catch_type = " + catch_type + ")"; } public final String toString(ConstantPool cp, boolean verbose) { String str; if (catch_type == 0) { str = "<Any exception>(0)"; } else { str = Utility.compactClassName(cp.getConstantString(catch_type, (byte)7), false) + (verbose ? "(" + catch_type + ")" : ""); } return start_pc + "\t" + end_pc + "\t" + handler_pc + "\t" + str; } public final String toString(ConstantPool cp) { return toString(cp, true); } public CodeException copy() { try { return (CodeException)clone(); } catch (CloneNotSupportedException e) {} return null; } } /* Location: * Qualified Name: org.apache.bcel.classfile.CodeException * Java Class Version: 1.1 (45.3) * JD-Core Version: 0.7.1 */ package org.apache.bcel.classfile; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public abstract class Constant implements Cloneable, Node { protected byte tag; Constant(byte tag) { this.tag = tag; } public abstract void accept(Visitor paramVisitor); public abstract void dump(DataOutputStream paramDataOutputStream) throws IOException; public final byte getTag() { return tag; } public String toString() { return org.apache.bcel.Constants.CONSTANT_NAMES[tag] + "[" + tag + "]"; } public Constant copy() { try { return (Constant)super.clone(); } catch (CloneNotSupportedException e) {} return null; } public Object clone() throws CloneNotSupportedException { return super.clone(); } static final Constant readConstant(DataInputStream file) throws IOException, ClassFormatError { byte b = file.readByte(); switch (b) { case 7: return new ConstantClass(file); case 9: return new ConstantFieldref(file); case 10: return new ConstantMethodref(file); case 11: return new ConstantInterfaceMethodref(file); case 8: return new Con Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|