(keitai-l) Re: Maybe OT: Java Link & Load Q

From: Jason Pollard <jasonpollard_at_yahoo.com>
Date: 09/17/01
Message-ID: <20010917191255.56213.qmail@web14601.mail.yahoo.com>
> Removing unused methods shouldn't be too difficult for an automated tool
> to do, assuming you're not using reflection. Removing unused classes
> is rather tougher, because it's really quite hard to tell if a class
> is unused. Just because you never explicitly instantiate a class does
> not mean that it doesn't get instantiated though something you do,
> or because of the settings of various system properties and whatnot.
> 
> (For example, anybody who can set the system properties for a VM can
> make the JDBC code instantiate arbitrary JDBC drivers, and perhaps other
> things too, if you're malicious.)
> 
> cjs

I think JODE advertised that it removed unused methods, but I wasn't able to
get it to work.  Anybody with information on that....

Regarding system properties for a CLDC device, AFAIK, the CLDC api only offers
a 'getProperty()' and no setProperty, so we don't have to worry about other
i-applis messing anything up for us.  (The scratchpad would make a viable
alternative, however)  I got started on this because I was going to try to make
a full mini SAX implementation, but realized that since I couldn't use
setProperty(), I couldn't dynamically generate a Parser class via the
ParserFactory (which gets the property and creates the class for you).  I then
started wondering if the compiler or something would link up only the classes
that I actually used in my project (since I wouldn't be able to use the
ParserFactory), or if I would have to do it manually.  In the case of SAX, it
should be no problem to do it manually, but for a large 3rd party jar, you
could conceivably get lots of 'artifacts' weighing down your own jar
considerably.

The Dasho Optimizer looks great, but is a bit pricey for my budget.  I've been
using 1stBarrier (http://www.jproof.com), which is primarily an obfuscator and
makes no mention of removing unused methods or classes.  Anybody using an open
source/freeware/shareware app that can do this?

One further question.  Does the manifest info (META-INF) in a jar file need to
be there in order for an i-appli to run?  For my jars, it adds up to
300-400bytes, which is not insignificant.  I'm in the US, so I can't test this
myself.

--Jason


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
Received on Mon Sep 17 22:01:45 2001