diff options
| author | 2014-09-18 22:41:25 -0400 | |
|---|---|---|
| committer | 2014-09-18 22:41:25 -0400 | |
| commit | a628fb9396d10cfbeb03c88cb1c2c119ae202a21 (patch) | |
| tree | 808f6f29790840c37b6c25163c00f0d03a2f3809 /src | |
| parent | added better error handling for source export (diff) | |
| download | enigma-a628fb9396d10cfbeb03c88cb1c2c119ae202a21.tar.gz enigma-a628fb9396d10cfbeb03c88cb1c2c119ae202a21.tar.xz enigma-a628fb9396d10cfbeb03c88cb1c2c119ae202a21.zip | |
fixed crash with jar loading
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuchaz/enigma/bytecode/ClassRenamer.java | 20 | ||||
| -rw-r--r-- | src/cuchaz/enigma/mapping/ClassEntry.java | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/cuchaz/enigma/bytecode/ClassRenamer.java b/src/cuchaz/enigma/bytecode/ClassRenamer.java index efe22a18..86a0433b 100644 --- a/src/cuchaz/enigma/bytecode/ClassRenamer.java +++ b/src/cuchaz/enigma/bytecode/ClassRenamer.java | |||
| @@ -74,7 +74,7 @@ public class ClassRenamer | |||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | public static Set<ClassEntry> getAllClassEntries( CtClass c ) | 77 | public static Set<ClassEntry> getAllClassEntries( final CtClass c ) |
| 78 | { | 78 | { |
| 79 | // get the classes that javassist knows about | 79 | // get the classes that javassist knows about |
| 80 | final Set<ClassEntry> entries = Sets.newHashSet(); | 80 | final Set<ClassEntry> entries = Sets.newHashSet(); |
| @@ -85,7 +85,23 @@ public class ClassRenamer | |||
| 85 | { | 85 | { |
| 86 | if( obj instanceof String ) | 86 | if( obj instanceof String ) |
| 87 | { | 87 | { |
| 88 | entries.add( new ClassEntry( (String)obj ) ); | 88 | String str = (String)obj; |
| 89 | |||
| 90 | // javassist throws a lot of weird things at this map | ||
| 91 | // I either have to implement my on class scanner, or just try to filter out the weirdness | ||
| 92 | // I'm opting to filter out the weirdness for now | ||
| 93 | |||
| 94 | // skip anything with generic arguments | ||
| 95 | if( str.indexOf( '<' ) >= 0 || str.indexOf( '>' ) >= 0 || str.indexOf( ';' ) >= 0 ) | ||
| 96 | { | ||
| 97 | return null; | ||
| 98 | } | ||
| 99 | |||
| 100 | // convert path/to/class.inner to path/to/class$inner | ||
| 101 | str = str.replace( '.', '$' ); | ||
| 102 | |||
| 103 | // remember everything else | ||
| 104 | entries.add( new ClassEntry( str ) ); | ||
| 89 | } | 105 | } |
| 90 | return null; | 106 | return null; |
| 91 | } | 107 | } |
diff --git a/src/cuchaz/enigma/mapping/ClassEntry.java b/src/cuchaz/enigma/mapping/ClassEntry.java index f8477c92..c6faa506 100644 --- a/src/cuchaz/enigma/mapping/ClassEntry.java +++ b/src/cuchaz/enigma/mapping/ClassEntry.java | |||
| @@ -27,14 +27,14 @@ public class ClassEntry implements Entry, Serializable | |||
| 27 | } | 27 | } |
| 28 | if( className.indexOf( '.' ) >= 0 ) | 28 | if( className.indexOf( '.' ) >= 0 ) |
| 29 | { | 29 | { |
| 30 | throw new IllegalArgumentException( "Class name must be in JVM format. ie, path/to/package/class$inner" ); | 30 | throw new IllegalArgumentException( "Class name must be in JVM format. ie, path/to/package/class$inner : " + className ); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | m_name = className; | 33 | m_name = className; |
| 34 | 34 | ||
| 35 | if( isInnerClass() && getInnerClassName().indexOf( '/' ) >= 0 ) | 35 | if( isInnerClass() && getInnerClassName().indexOf( '/' ) >= 0 ) |
| 36 | { | 36 | { |
| 37 | throw new IllegalArgumentException( "Inner class must not have a package: " + getInnerClassName() ); | 37 | throw new IllegalArgumentException( "Inner class must not have a package: " + className ); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||