1
0
mirror of https://github.com/i-net-software/JWebAssembly.git synced 2025-03-25 23:47:51 +01:00

add getDeclaringClassFile()

This commit is contained in:
Volker Berlin 2018-03-20 20:30:57 +01:00
parent f2efc5aafd
commit 0803c290c5
2 changed files with 229 additions and 221 deletions
src/de/inetsoftware/classparser

@ -182,7 +182,7 @@ public class ClassFile {
private MethodInfo[] readMethods() throws IOException { private MethodInfo[] readMethods() throws IOException {
MethodInfo[] methods = new MethodInfo[input.readUnsignedShort()]; MethodInfo[] methods = new MethodInfo[input.readUnsignedShort()];
for( int i = 0; i < methods.length; i++ ) { for( int i = 0; i < methods.length; i++ ) {
methods[i] = new MethodInfo( input, constantPool ); methods[i] = new MethodInfo( input, constantPool, this );
} }
return methods; return methods;
} }

@ -40,6 +40,8 @@ public class MethodInfo {
private Exceptions exceptions; private Exceptions exceptions;
private ClassFile classFile;
/** /**
* Read the method_info structure * Read the method_info structure
* http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6 * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6
@ -47,14 +49,20 @@ public class MethodInfo {
* *
* @param input * @param input
* @param constantPool * @param constantPool
* @param classFile the declaring class file
* @throws IOException * @throws IOException
*/ */
MethodInfo( DataInputStream input, ConstantPool constantPool ) throws IOException { MethodInfo( DataInputStream input, ConstantPool constantPool, ClassFile classFile ) throws IOException {
this.accessFlags = input.readUnsignedShort(); this.accessFlags = input.readUnsignedShort();
this.name = (String)constantPool.get( input.readUnsignedShort() ); this.name = (String)constantPool.get( input.readUnsignedShort() );
this.description = (String)constantPool.get( input.readUnsignedShort() ); this.description = (String)constantPool.get( input.readUnsignedShort() );
this.constantPool = constantPool; this.constantPool = constantPool;
this.attributes = new Attributes( input, constantPool ); this.attributes = new Attributes( input, constantPool );
this.classFile = classFile;
}
public ClassFile getDeclaringClassFile() {
return classFile;
} }
/** /**