skpal / jarjar

Automatically exported from code.google.com/p/jarjar
0 stars 0 forks source link

Can JarJar handle hardcoded string references to some of their class names? #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Some libraries we use in our current project, like JDom, has hard-coded
string references to some of their class names. 

Or for some reason, a library may construct class names programmatically, like 

String[] beanNames = new String[]{"SMTPServer", "Repository"};

for (String bean: beanNames)
{
 ..
 Class.forName("com.x.y." + beanName + "MBean")
}

Can JarJar handle such cases (automatically repacking these libraries)?

Original issue reported on code.google.com by songg...@gmail.com on 29 Jan 2008 at 2:22

GoogleCodeExporter commented 8 years ago
Given that the package name is in a single string literal, jarjar probably would
handle this case correctly.

In a future release I'd like to add an option to make the resource remapping 
happen
at runtime (by intercepting forName calls, etc.)

Original comment by chris.no...@gmail.com on 7 Feb 2008 at 1:30

GoogleCodeExporter commented 8 years ago
I second that: it would be very useful if JarJar could handle hard-coded 
strings. A typical example is to have 
dynamic loading of classes. Currently, JarJar won't see the dependencies 
between classes, which makes it less 
easy to shrink a Jar.

Original comment by julien.p...@gmail.com on 19 Apr 2008 at 10:05

GoogleCodeExporter commented 8 years ago
Will jarjar handle String references to Classes in properties files?

Original comment by npel...@gmail.com on 29 Apr 2008 at 7:39

GoogleCodeExporter commented 8 years ago
JarJar does not modify the contents of any non-classfiles.

Original comment by chris.no...@gmail.com on 11 Jan 2009 at 4:29

GoogleCodeExporter commented 8 years ago
It would be good if it were possible to detect and fix strings like like this, 
which is a constant in the Rhino library:

    static final java.lang.String FUNCTION_INIT_SIGNATURE = "(Lorg/mozilla/javascript/Context;Lorg/mozilla/javascript/Scriptable;)V";

Original comment by nickhowes on 7 Jul 2011 at 1:34