|
|
@ -1,18 +1,18 @@ |
|
|
|
/* |
|
|
|
/* ClassIdentifier Copyright (C) 1999 Jochen Hoenicke. |
|
|
|
* ClassIdentifier (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$ |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -59,9 +59,9 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public void preserveIdentifier(String name, String typeSig) { |
|
|
|
public void preserveIdentifier(String name, String typeSig) { |
|
|
|
for (int i=0; i< identifiers.length; i++) { |
|
|
|
for (int i=0; i< identifiers.length; i++) { |
|
|
|
if (identifiers[i].getName().equals(name) |
|
|
|
if (WildCard.matches(name, identifiers[i].getName()) |
|
|
|
&& (typeSig == null |
|
|
|
&& (typeSig == null |
|
|
|
|| identifiers[i].getType().equals(typeSig))) |
|
|
|
|| WildCard.matches(typeSig, identifiers[i].getType()))) |
|
|
|
identifiers[i].setPreserved(); |
|
|
|
identifiers[i].setPreserved(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -77,12 +77,15 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public void reachableIdentifier(String name, String typeSig, |
|
|
|
public void reachableIdentifier(String name, String typeSig, |
|
|
|
boolean isVirtual) { |
|
|
|
boolean isVirtual) { |
|
|
|
for (int i=0; i < identifiers.length; i++) { |
|
|
|
// if (!isVirtual || (info.getModifiers() & Modifier.ABSTRACT) == 0) {
|
|
|
|
if (identifiers[i].getName().equals(name) |
|
|
|
for (int i=0; i< identifiers.length; i++) { |
|
|
|
|
|
|
|
if (WildCard.matches(name, identifiers[i].getName()) |
|
|
|
&& (typeSig == null |
|
|
|
&& (typeSig == null |
|
|
|
|| identifiers[i] .getType().equals(typeSig))) |
|
|
|
|| WildCard.matches(typeSig, |
|
|
|
|
|
|
|
identifiers[i].getType()))) |
|
|
|
identifiers[i].setReachable(); |
|
|
|
identifiers[i].setReachable(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// }
|
|
|
|
if (isVirtual) { |
|
|
|
if (isVirtual) { |
|
|
|
Enumeration enum = knownSubClasses.elements(); |
|
|
|
Enumeration enum = knownSubClasses.elements(); |
|
|
|
while (enum.hasMoreElements()) |
|
|
|
while (enum.hasMoreElements()) |
|
|
@ -174,6 +177,10 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public void setSingleReachable() { |
|
|
|
public void setSingleReachable() { |
|
|
|
super.setSingleReachable(); |
|
|
|
super.setSingleReachable(); |
|
|
|
|
|
|
|
bundle.analyzeIdentifier(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void analyze() { |
|
|
|
if (Obfuscator.isVerbose) |
|
|
|
if (Obfuscator.isVerbose) |
|
|
|
Obfuscator.err.println("Reachable: "+this); |
|
|
|
Obfuscator.err.println("Reachable: "+this); |
|
|
|
reachableIdentifier("<clinit>", "()V", false); |
|
|
|
reachableIdentifier("<clinit>", "()V", false); |
|
|
@ -313,6 +320,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void storeClass(DataOutputStream out) throws IOException { |
|
|
|
public void storeClass(DataOutputStream out) throws IOException { |
|
|
|
|
|
|
|
if (Obfuscator.isVerbose) |
|
|
|
|
|
|
|
Obfuscator.err.println("Writing "+this); |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) |
|
|
|