diff options
Diffstat (limited to 'src/proguard/classfile/ProgramClass.java')
-rw-r--r-- | src/proguard/classfile/ProgramClass.java | 92 |
1 files changed, 7 insertions, 85 deletions
diff --git a/src/proguard/classfile/ProgramClass.java b/src/proguard/classfile/ProgramClass.java index e3caddb..9d0fc0c 100644 --- a/src/proguard/classfile/ProgramClass.java +++ b/src/proguard/classfile/ProgramClass.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) * * 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 @@ -117,7 +117,8 @@ public class ProgramClass implements Clazz } catch (ClassCastException ex) { - throw ((IllegalStateException)new IllegalStateException("Expected Utf8Constant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); + new ClassPrinter().visitProgramClass(this); + throw new ClassCastException("Expected Utf8Constant at index ["+constantIndex+"] in class ["+getName()+"], found ["+ex.getMessage()+"]"); } } @@ -129,7 +130,7 @@ public class ProgramClass implements Clazz } catch (ClassCastException ex) { - throw ((IllegalStateException)new IllegalStateException("Expected StringConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); + throw new ClassCastException("Expected StringConstant at index ["+constantIndex+"] in class ["+getName()+"], found ["+ex.getMessage()+"]"); } } @@ -141,7 +142,7 @@ public class ProgramClass implements Clazz } catch (ClassCastException ex) { - throw ((IllegalStateException)new IllegalStateException("Expected ClassConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); + throw new ClassCastException("Expected ClassConstant at index ["+constantIndex+"] in class ["+getName()+"], found ["+ex.getMessage()+"]"); } } @@ -153,7 +154,7 @@ public class ProgramClass implements Clazz } catch (ClassCastException ex) { - throw ((IllegalStateException)new IllegalStateException("Expected NameAndTypeConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); + throw new ClassCastException("Expected NameAndTypeConstant at index ["+constantIndex+"] in class ["+getName()+"], found ["+ex.getMessage()+"]"); } } @@ -165,32 +166,7 @@ public class ProgramClass implements Clazz } catch (ClassCastException ex) { - throw ((IllegalStateException)new IllegalStateException("Expected NameAndTypeConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); - } - } - - - public String getRefName(int constantIndex) - { - try - { - return ((RefConstant)constantPool[constantIndex]).getName(this); - } - catch (ClassCastException ex) - { - throw ((IllegalStateException)new IllegalStateException("Expected RefConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); - } - } - - public String getRefType(int constantIndex) - { - try - { - return ((RefConstant)constantPool[constantIndex]).getType(this); - } - catch (ClassCastException ex) - { - throw ((IllegalStateException)new IllegalStateException("Expected RefConstant at index ["+constantIndex+"] in class ["+getName()+"]").initCause(ex)); + throw new ClassCastException("Expected NameAndTypeConstant at index ["+constantIndex+"] in class ["+getName()+"], found ["+ex.getMessage()+"]"); } } @@ -240,19 +216,6 @@ public class ProgramClass implements Clazz } - public boolean extends_(String className) - { - if (getName().equals(className)) - { - return true; - } - - Clazz superClass = getSuperClass(); - return superClass != null && - superClass.extends_(className); - } - - public boolean extendsOrImplements(Clazz clazz) { if (this.equals(clazz)) @@ -281,34 +244,6 @@ public class ProgramClass implements Clazz } - public boolean extendsOrImplements(String className) - { - if (getName().equals(className)) - { - return true; - } - - Clazz superClass = getSuperClass(); - if (superClass != null && - superClass.extendsOrImplements(className)) - { - return true; - } - - for (int index = 0; index < u2interfacesCount; index++) - { - Clazz interfaceClass = getInterface(index); - if (interfaceClass != null && - interfaceClass.extendsOrImplements(className)) - { - return true; - } - } - - return false; - } - - public Field findField(String name, String descriptor) { for (int index = 0; index < u2fieldsCount; index++) @@ -537,19 +472,6 @@ public class ProgramClass implements Clazz } - public void attributeAccept(String name, AttributeVisitor attributeVisitor) - { - for (int index = 0; index < u2attributesCount; index++) - { - Attribute attribute = attributes[index]; - if (attribute.getAttributeName(this).equals(name)) - { - attribute.accept(this, attributeVisitor); - } - } - } - - // Implementations for VisitorAccepter. public Object getVisitorInfo() |