From f184ef9b97d9816aebeccf87224a50de7a8e4013 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 1 Apr 1999 10:49:43 +0000 Subject: [PATCH] match method and fields with wildcards git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@513 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/obfuscator/ClassIdentifier.java | 49 ++++++++++++++--------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/jode/jode/obfuscator/ClassIdentifier.java b/jode/jode/obfuscator/ClassIdentifier.java index ef48ce7..09342ef 100644 --- a/jode/jode/obfuscator/ClassIdentifier.java +++ b/jode/jode/obfuscator/ClassIdentifier.java @@ -1,18 +1,18 @@ -/* - * ClassIdentifier (c) 1998 Jochen Hoenicke +/* ClassIdentifier Copyright (C) 1999 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, - * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF - * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JOCHEN HOENICKE - * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * JOCHEN HOENICKE SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND JOCHEN HOENICKE HAS NO OBLIGATION TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id$ */ @@ -59,9 +59,9 @@ public class ClassIdentifier extends Identifier { public void preserveIdentifier(String name, String typeSig) { for (int i=0; i< identifiers.length; i++) { - if (identifiers[i].getName().equals(name) + if (WildCard.matches(name, identifiers[i].getName()) && (typeSig == null - || identifiers[i].getType().equals(typeSig))) + || WildCard.matches(typeSig, identifiers[i].getType()))) identifiers[i].setPreserved(); } } @@ -77,12 +77,15 @@ public class ClassIdentifier extends Identifier { public void reachableIdentifier(String name, String typeSig, boolean isVirtual) { - for (int i=0; i < identifiers.length; i++) { - if (identifiers[i].getName().equals(name) - && (typeSig == null - || identifiers[i] .getType().equals(typeSig))) - identifiers[i].setReachable(); - } +// if (!isVirtual || (info.getModifiers() & Modifier.ABSTRACT) == 0) { + for (int i=0; i< identifiers.length; i++) { + if (WildCard.matches(name, identifiers[i].getName()) + && (typeSig == null + || WildCard.matches(typeSig, + identifiers[i].getType()))) + identifiers[i].setReachable(); + } +// } if (isVirtual) { Enumeration enum = knownSubClasses.elements(); while (enum.hasMoreElements()) @@ -174,6 +177,10 @@ public class ClassIdentifier extends Identifier { public void setSingleReachable() { super.setSingleReachable(); + bundle.analyzeIdentifier(this); + } + + public void analyze() { if (Obfuscator.isVerbose) Obfuscator.err.println("Reachable: "+this); reachableIdentifier("", "()V", false); @@ -313,6 +320,8 @@ public class ClassIdentifier extends Identifier { } public void storeClass(DataOutputStream out) throws IOException { + if (Obfuscator.isVerbose) + Obfuscator.err.println("Writing "+this); GrowableConstantPool gcp = new GrowableConstantPool(); for (int i=fieldCount; i < identifiers.length; i++)