From 78eb752b083d733674deae14772adfc28050b8cb Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 27 Apr 1999 18:08:35 +0000 Subject: [PATCH] attribute handling in bytecode git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@631 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/decompiler/LocalVariableTable.java | 47 +++++--------------- jode/jode/decompiler/MethodAnalyzer.java | 32 ++++--------- 2 files changed, 19 insertions(+), 60 deletions(-) diff --git a/jode/jode/decompiler/LocalVariableTable.java b/jode/jode/decompiler/LocalVariableTable.java index 7b45d25..232ea5a 100644 --- a/jode/jode/decompiler/LocalVariableTable.java +++ b/jode/jode/decompiler/LocalVariableTable.java @@ -21,49 +21,22 @@ package jode.decompiler; import java.io.*; import jode.Decompiler; import jode.type.Type; -import jode.bytecode.AttributeInfo; -import jode.bytecode.ConstantPool; +import jode.bytecode.LocalVariableInfo; public class LocalVariableTable { LocalVariableRangeList[] locals; - public LocalVariableTable(int size, ConstantPool constantPool, - AttributeInfo attr) { - - locals = new LocalVariableRangeList[size]; - for (int i=0; i") || methodName.equals(""); - this.isSynthetic = (minfo.findAttribute("Synthetic") != null); - this.isDeprecated = (minfo.findAttribute("Deprecated") != null); + this.isSynthetic = minfo.isSynthetic(); + this.isDeprecated = minfo.isDeprecated(); - AttributeInfo codeattr = minfo.findAttribute("Code"); - if (codeattr != null) { - code = new CodeAnalyzer(this, minfo, codeattr, imports); - } - - AttributeInfo excattr = minfo.findAttribute("Exceptions"); + code = new CodeAnalyzer(this, minfo, imports); + String[] excattr = minfo.getExceptions(); if (excattr == null) { exceptions = new Type[0]; } else { - DataInputStream stream = new DataInputStream - (new ByteArrayInputStream(excattr.getContents())); - try { - int throwCount = stream.readUnsignedShort(); - this.exceptions = new Type[throwCount]; - for (int t=0; t< throwCount; t++) { - int idx = stream.readUnsignedShort(); - exceptions[t] = Type.tClass(classAnalyzer.getConstantPool() - .getClassName(idx)); - } - } catch (IOException ex) { - throw new AssertError("exception attribute too long?"); - } + int excCount = excattr.length; + this.exceptions = new Type[excCount]; + for (int i=0; i< excCount; i++) + exceptions[i] = Type.tClass(excattr[i]); } }