MethodType changed

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@490 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 0585583c26
commit 15b9ad802a
  1. 11
      jode/jode/bytecode/MethodInfo.java
  2. 38
      jode/jode/decompiler/MethodAnalyzer.java

@ -1,4 +1,4 @@
/* jode.bytecode.MethodInfo Copyright (C) 1997-1998 Jochen Hoenicke. /* MethodInfo Copyright (C) 1998-1999 Jochen Hoenicke.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,6 +16,7 @@
* *
* $Id$ * $Id$
*/ */
package jode.bytecode; package jode.bytecode;
import jode.MethodType; import jode.MethodType;
import java.io.*; import java.io.*;
@ -31,8 +32,7 @@ public class MethodInfo extends BinaryInfo {
DataInputStream input, int howMuch) throws IOException { DataInputStream input, int howMuch) throws IOException {
modifier = input.readUnsignedShort(); modifier = input.readUnsignedShort();
name = constantPool.getUTF8(input.readUnsignedShort()); name = constantPool.getUTF8(input.readUnsignedShort());
type = new MethodType(Modifier.isStatic(modifier), type = new MethodType(constantPool.getUTF8(input.readUnsignedShort()));
constantPool.getUTF8(input.readUnsignedShort()));
readAttributes(constantPool, input, howMuch); readAttributes(constantPool, input, howMuch);
} }
@ -44,6 +44,10 @@ public class MethodInfo extends BinaryInfo {
return type; return type;
} }
public boolean isStatic() {
return Modifier.isStatic(modifier);
}
public int getModifiers() { public int getModifiers() {
return modifier; return modifier;
} }
@ -53,3 +57,4 @@ public class MethodInfo extends BinaryInfo {
type.toString()+" "+name; type.toString()+" "+name;
} }
} }

@ -1,18 +1,18 @@
/* /* MethodAnalyzer Copyright (C) 1998-1999 Jochen Hoenicke.
* MethodAnalyzer (c) 1998 Jochen Hoenicke
* *
* You may distribute under the terms of the GNU General Public License. * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* *
* IN NO EVENT SHALL JOCHEN HOENICKE BE LIABLE TO ANY PARTY FOR DIRECT, * This program is distributed in the hope that it will be useful,
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF * but WITHOUT ANY WARRANTY; without even the implied warranty of
* THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JOCHEN HOENICKE * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * GNU General Public License for more details.
* *
* JOCHEN HOENICKE SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * You should have received a copy of the GNU General Public License
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * along with this program; see the file COPYING. If not, write to
* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* BASIS, AND JOCHEN HOENICKE HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
* *
* $Id$ * $Id$
*/ */
@ -30,6 +30,7 @@ public class MethodAnalyzer implements Analyzer {
CodeAnalyzer code = null; CodeAnalyzer code = null;
ClassAnalyzer classAnalyzer; ClassAnalyzer classAnalyzer;
boolean isConstructor; boolean isConstructor;
boolean isStatic;
boolean isSynthetic; boolean isSynthetic;
boolean isDeprecated; boolean isDeprecated;
SyntheticAnalyzer synth; SyntheticAnalyzer synth;
@ -45,6 +46,7 @@ public class MethodAnalyzer implements Analyzer {
this.modifiers = minfo.getModifiers(); this.modifiers = minfo.getModifiers();
this.methodType = minfo.getType(); this.methodType = minfo.getType();
this.methodName = minfo.getName(); this.methodName = minfo.getName();
this.isStatic = minfo.isStatic();
this.isConstructor = this.isConstructor =
methodName.equals("<init>") || methodName.equals("<clinit>"); methodName.equals("<init>") || methodName.equals("<clinit>");
this.isSynthetic = (minfo.findAttribute("Synthetic") != null); this.isSynthetic = (minfo.findAttribute("Synthetic") != null);
@ -91,19 +93,19 @@ public class MethodAnalyzer implements Analyzer {
return code; return code;
} }
public boolean isConstructor() { public final boolean isConstructor() {
return isConstructor; return isConstructor;
} }
public boolean isStatic() { public final boolean isStatic() {
return methodType.isStatic(); return isStatic;
} }
public boolean isSynthetic() { public final boolean isSynthetic() {
return isSynthetic; return isSynthetic;
} }
public boolean isGetClass() { public final boolean isGetClass() {
return synth.type == SyntheticAnalyzer.GETCLASS; return synth.type == SyntheticAnalyzer.GETCLASS;
} }
@ -209,7 +211,7 @@ public class MethodAnalyzer implements Analyzer {
+ " " + methodName); + " " + methodName);
writer.print("("); writer.print("(");
Type[] paramTypes = methodType.getParameterTypes(); Type[] paramTypes = methodType.getParameterTypes();
int offset = methodType.isStatic()?0:1; int offset = isStatic()?0:1;
for (int i=0; i<paramTypes.length; i++) { for (int i=0; i<paramTypes.length; i++) {
if (i>0) if (i>0)
writer.print(", "); writer.print(", ");

Loading…
Cancel
Save