Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: rmT116609 Date: 02/05/2003 DESCRIPTION OF THE PROBLEM : This request for enhancement could potentially help in a number of development efforts. In my case, it would help with serialization efforts. Basically, I'd like some way of accessing the compiler (or a compiler look alike) to get well formatted details of a class. The reasons I feel this belongs in core java functionality are: 1) the compiler ALREADY has to reliably parse classes, and it gets the most stress testing; thus one would expect it to be the "most reliable" solution 2) likewise the compiler ALREADY is storing away class information in "neat" datastructures that would be easy and logical for a programmer to access* 3) the information that one could glean from such a feature would have a myriad of uses: -reliable custom serialization: Currently if one uses a custom serialization solution (Castor, in house code...) one still has to figure out how to map the class to the serialization format in question. This shouldn't involve touching code (like xdoclets comments that are metadata for generating castor mappings "automatically") as this adds a new layer of testing and debugging, and one may want to target 3rd party code without having to rewrite it. Likewise, 3rd party solutions (like Castor itself) are easy to confuse about how classes map. -dynamic code review & tracking: By passing the parsed info to logic routines one could easily and potentially automatically identify certian issues in an evolving codebase -supporting code generation: One could use the info to automatically generate supporting code intelligently ... *Of course, the compiler is native, but all one needs is an interface that takes its parsed and packaged info, and wraps it up neatly in standard Java objects for interrogating. EXPECTED VERSUS ACTUAL BEHAVIOR : I'm not sure what would be the best way to run such an interface. One idea would be to have an API for parsedClass objects- compile a program that uses the API and then chain javac and java together like so: java logic (javac -parse newClass.java) Basically we run logic and as an argument we pass the output of "parsing" a target class. Alternately it could be a flag on java (which in turn invokes javac with the interface) (Review ID: 180884) ====================================================================== ###@###.### 2004-11-16 16:07:47 GMT
|