diff options
author | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
commit | 9f606f95f03a75961498803e24bee6799a7c0885 (patch) | |
tree | a45f4d74feda9b76277a0c9ced55ad15d82248a1 /src/proguard/OutputWriter.java | |
parent | cfead78069f3dc32998dc118ee08cab3867acea2 (diff) | |
download | external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.tar.gz external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.tar.bz2 external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.zip |
Revert "Upgrade from Progaurd 4.4 to 4.7."android-sdk-support_r11android-cts-4.2_r2android-cts-4.1_r4android-cts-4.1_r2android-cts-4.1_r1
This reverts commit cfead78069f3dc32998dc118ee08cab3867acea2.
Bug: 6079915
Diffstat (limited to 'src/proguard/OutputWriter.java')
-rw-r--r-- | src/proguard/OutputWriter.java | 66 |
1 files changed, 13 insertions, 53 deletions
diff --git a/src/proguard/OutputWriter.java b/src/proguard/OutputWriter.java index 39dd1ad..10c18fb 100644 --- a/src/proguard/OutputWriter.java +++ b/src/proguard/OutputWriter.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 @@ -63,12 +63,13 @@ public class OutputWriter "] must be specified after an input jar, or it will be empty."); } - // Check if the first of two subsequent the output jars has a filter. + // Perform some checks on the output jars. for (int index = 0; index < programJars.size() - 1; index++) { ClassPathEntry entry = programJars.get(index); if (entry.isOutput()) { + // Check if all but the last output jars have filters. if (entry.getFilter() == null && entry.getJarFilter() == null && entry.getWarFilter() == null && @@ -77,17 +78,10 @@ public class OutputWriter programJars.get(index + 1).isOutput()) { throw new IOException("The output jar [" + entry.getName() + - "] must have a filter, or all subsequent output jars will be empty."); + "] must have a filter, or all subsequent jars will be empty."); } - } - } - // Check if the output jar names are different from the input jar names. - for (int outIndex = 0; outIndex < programJars.size() - 1; outIndex++) - { - ClassPathEntry entry = programJars.get(outIndex); - if (entry.isOutput()) - { + // Check if the output jar name is different from the input jar names. for (int inIndex = 0; inIndex < programJars.size(); inIndex++) { ClassPathEntry otherEntry = programJars.get(inIndex); @@ -102,40 +96,6 @@ public class OutputWriter } } - // Check for potential problems with mixed-case class names on - // case-insensitive file systems. - if (configuration.obfuscate && - configuration.useMixedCaseClassNames && - configuration.classObfuscationDictionary == null && - (configuration.note == null || - !configuration.note.isEmpty())) - { - String os = System.getProperty("os.name").toLowerCase(); - if (os.startsWith("windows") || - os.startsWith("mac os")) - { - // Go over all program class path entries. - for (int index = 0; index < programJars.size(); index++) - { - // Is it an output directory? - ClassPathEntry entry = programJars.get(index); - if (entry.isOutput() && - !entry.isJar() && - !entry.isWar() && - !entry.isEar() && - !entry.isZip()) - { - System.out.println("Note: you're writing the processed class files to a directory [" + entry.getName() +"]."); - System.out.println(" This will likely cause problems with obfuscated mixed-case class names."); - System.out.println(" You should consider writing the output to a jar file, or otherwise"); - System.out.println(" specify '-dontusemixedclassnames'."); - - break; - } - } - } - } - int firstInputIndex = 0; int lastInputIndex = 0; @@ -206,7 +166,7 @@ public class OutputWriter { resourceRewriter = new NameFilter(configuration.adaptResourceFileContents, - new NameFilter("META-INF/MANIFEST.MF,META-INF/*.SF", + new NameFilter("META-INF/**", new ManifestRewriter(programClassPool, writer), new DataEntryRewriter(programClassPool, writer)), resourceRewriter); @@ -261,7 +221,7 @@ public class OutputWriter } catch (IOException ex) { - throw (IOException)new IOException("Can't write [" + classPath.get(fromOutputIndex).getName() + "] (" + ex.getMessage() + ")").initCause(ex); + throw new IOException("Can't write [" + classPath.get(fromOutputIndex).getName() + "] (" + ex.getMessage() + ")"); } } @@ -272,25 +232,25 @@ public class OutputWriter */ private static Map createPackagePrefixMap(ClassPool classPool) { - Map packagePrefixMap = new HashMap(); + Map PackagePrefixMap = new HashMap(); Iterator iterator = classPool.classNames(); while (iterator.hasNext()) { String className = (String)iterator.next(); - String packagePrefix = ClassUtil.internalPackagePrefix(className); + String PackagePrefix = ClassUtil.internalPackagePrefix(className); - String mappedNewPackagePrefix = (String)packagePrefixMap.get(packagePrefix); + String mappedNewPackagePrefix = (String)PackagePrefixMap.get(PackagePrefix); if (mappedNewPackagePrefix == null || - !mappedNewPackagePrefix.equals(packagePrefix)) + !mappedNewPackagePrefix.equals(PackagePrefix)) { String newClassName = classPool.getClass(className).getName(); String newPackagePrefix = ClassUtil.internalPackagePrefix(newClassName); - packagePrefixMap.put(packagePrefix, newPackagePrefix); + PackagePrefixMap.put(PackagePrefix, newPackagePrefix); } } - return packagePrefixMap; + return PackagePrefixMap; } } |