Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Suggestion for optimized compilation of Anonymous inner classes
Suggestion for optimized compilation of Anonymous inner classes [message #88512] Sat, 23 August 2003 07:46 Go to next message
Eclipse UserFriend
Hello,

As Outlined in the section "Application footprint" of
http://java.sun.com/docs/white/delegates.html
a optimzed class format may reduce the size of the JAR-archive.

Usually the class of AL (see below) is compiled to a classfile
Class$1 (for example):

class Class {
ActionListener AL = new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
}
}

My suggestion is to achieve the "optimzed class format" with an compiler switch,
which compiles the class above as (pseudo code):

class Class {
ActionListener AL = (ActionListener)syntheticMethod$0("....CompressedClassFile.... ");
ActionListener syntheticMethod$0(final String sCompressedClassFile) {
try {
final byte[] byClassFile = uncompressClassFile(sCompressedClassFile)
return (ActionListener)getClass().getClassLoader().defineClass(byCl assFile).newInstance();
} catch(Exception e) {
throw new ClassNotFoundException(e);
}
}
byte[] uncompressClassFile$0(String sClassfile) {
// Short uncompression algorithm
}
}

or in words:

The compiler generates a compressed class file for an (not nessesary) anoymoues inner class,
and exactly one decompression method (identical in each toplevel class); and finally it replaces
the new-statement with a call to an decompression method.

Possible Problems:

[1] Keep Obfucuraters working
[2] Don't use more space then without the compiler switch
[3] Constant Pool Access for the decompression method

I think all this problems are solveable, and in most cases the compiled classes are
much smaller and class loading of inner classes may become much faster.

If such a technic exists allready: please let me know where I can read about it.

Kind Regards


mle
Forget it: Suggestion for optimized compilation of Anonymous inner classes [message #88558 is a reply to message #88512] Sat, 23 August 2003 14:24 Go to previous message
Eclipse UserFriend
Please excuse that message:

I made a big mistake,

Sorry again

mle
Previous Topic:-> Strange icon behaviour in jface TreeViewer
Next Topic:using eclipse with java 1.4.2
Goto Forum:
  


Current Time: Sat May 10 20:33:18 EDT 2025

Powered by FUDForum. Page generated in 0.03887 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top