001 package AST; 002 003 import java.util.HashSet; 004 import java.io.File; 005 import java.util.*; 006 import beaver.*; 007 import java.util.ArrayList; 008 import java.util.zip.*; 009 import java.io.*; 010 import java.io.FileNotFoundException; 011 import java.util.Collection; 012 /** 013 * @ast class 014 * 015 */ 016 public class MethodDescriptor extends java.lang.Object { 017 018 private BytecodeParser p; 019 020 021 private String parameterDescriptors; 022 023 024 private String typeDescriptor; 025 026 027 028 public MethodDescriptor(BytecodeParser parser, String name) { 029 p = parser; 030 int descriptor_index = p.u2(); 031 String descriptor = ((CONSTANT_Utf8_Info) p.constantPool[descriptor_index]).string(); 032 if(BytecodeParser.VERBOSE) 033 p.println(" Method: " + name + ", " + descriptor); 034 //String[] strings = descriptor.substring(1).split("\\)"); 035 //parameterDescriptors = strings[0]; 036 //typeDescriptor = strings[1]; 037 int pos = descriptor.indexOf(')'); 038 parameterDescriptors = descriptor.substring(1, pos); 039 typeDescriptor = descriptor.substring(pos+1, descriptor.length()); 040 } 041 042 043 044 public List parameterList() { 045 TypeDescriptor d = new TypeDescriptor(p, parameterDescriptors); 046 return d.parameterList(); 047 } 048 049 050 public List parameterListSkipFirst() { 051 TypeDescriptor d = new TypeDescriptor(p, parameterDescriptors); 052 return d.parameterListSkipFirst(); 053 } 054 055 056 057 public Access type() { 058 TypeDescriptor d = new TypeDescriptor(p, typeDescriptor); 059 return d.type(); 060 } 061 062 063 }