Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sync with latest jarjar support code

  • Loading branch information...
commit 47fa08b3dd4537ed554cff0a45cb43203102bfb6 1 parent 8d907ed
@mcculls mcculls authored
View
2  src/main/java/com/tonicsystems/jarjar/MainProcessor.java
@@ -54,7 +54,7 @@ public MainProcessor(List<PatternElement> patterns, boolean verbose, boolean ski
processors.add(new ZapProcessor(zapList));
processors.add(new JarTransformerChain(new ClassTransformer[]{ new RemappingClassTransformer(pr) }));
processors.add(new ResourceProcessor(pr));
- chain = new JarProcessorChain((JarProcessor[])processors.toArray(new JarProcessor[processors.size()]));
+ chain = new JarProcessorChain(processors.toArray(new JarProcessor[processors.size()]));
}
public void strip(File file) throws IOException {
View
6 src/main/java/com/tonicsystems/jarjar/Wildcard.java
@@ -116,6 +116,12 @@ private Matcher getMatcher(String value) {
}
private static boolean checkIdentifierChars(String expr, String extra) {
+ // package-info violates the spec for Java Identifiers.
+ // Nevertheless, expressions that end with this string are still legal.
+ // See 7.4.1.1 of the Java language spec for discussion.
+ if (expr.endsWith("package-info")) {
+ expr = expr.substring(0, expr.length() - "package-info".length());
+ }
for (int i = 0, len = expr.length(); i < len; i++) {
char c = expr.charAt(i);
if (extra.indexOf(c) >= 0)
View
9 src/main/java/com/tonicsystems/jarjar/util/JarProcessorChain.java
@@ -23,14 +23,15 @@
private final JarProcessor[] chain;
public JarProcessorChain(JarProcessor[] chain) {
- this.chain = (JarProcessor[])chain.clone();
+ this.chain = chain.clone();
}
public boolean process(EntryStruct struct) throws IOException {
- for (int i = 0; i < chain.length; i++) {
- if (!chain[i].process(struct))
- return false;
+ for (JarProcessor aChain : chain) {
+ if (!aChain.process(struct)) {
+ return false;
}
+ }
return true;
}
}
View
4 src/main/java/com/tonicsystems/jarjar/util/JarTransformerChain.java
@@ -16,8 +16,6 @@
package com.tonicsystems.jarjar.util;
-import java.util.*;
-import java.io.IOException;
import org.objectweb.asm.ClassVisitor;
public class JarTransformerChain extends JarTransformer
@@ -25,7 +23,7 @@
private final ClassTransformer[] chain;
public JarTransformerChain(ClassTransformer[] chain) {
- this.chain = (ClassTransformer[])chain.clone();
+ this.chain = chain.clone();
for (int i = chain.length - 1; i > 0; i--) {
chain[i - 1].setTarget(chain[i]);
}
View
4 src/test/java/com/tonicsystems/jarjar/PackageRemapperTest.java
@@ -47,6 +47,10 @@ public void testMapValue() {
assertEquals("foo.example.Object", remapper.mapValue("org.example.Object"));
assertEquals("foo/example/Object", remapper.mapValue("org/example/Object"));
assertEquals("foo/example.Object", remapper.mapValue("org/example.Object")); // path match
+
+ assertEquals("foo.example.package-info", remapper.mapValue("org.example.package-info"));
+ assertEquals("foo/example/package-info", remapper.mapValue("org/example/package-info"));
+ assertEquals("foo/example.package-info", remapper.mapValue("org/example.package-info"));
}
private void assertUnchangedValue(String value) {
Please sign in to comment.
Something went wrong with that request. Please try again.