|
|
|
@ -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("<clinit>", "()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++) |
|
|
|
|