oh, I see what you said: From the research i've been done, it seems
that classfile will record the its imports for us.
we can get the imports information from .class file, you mean we ony
need the binary .class file and we don't have to run it?
2009/4/1 Mike :
> You can search my ideas on the mail-archiver.
> Besides dynamic tracing, I also use dot-class file parsing (The static
> approach). The dot-class file will record dependency in its
> ConstantPool.
>
> Dynamic tracing is used to cover java's reflection. so it should be ok
> for user to test their reflection code, isn't it?
>
> Yours Mike
>
> 在 2009-04-01三的 11:03 +0800，WenDong Zhang写道：
>> I think dynamic tracing the loaded classes is pretty good, the only
>> shortcoming is we need to write the test unit completely or there will
>> be some classes missing in our mimi jre.
>>
>> I still want to know are there any other ways to implement this work?
>> My first thought is use text analysis, but there are to many problems:
>> dynamic loading class, third party lib...
>>
>> 2009/4/1 Mike :
>> > 在 2009-04-01三的 00:30 +0800，Daniel Gong写道：
>> >> By saying dynamic class loading, do you mean reflection based class loading
>> >> or just class loader way?
>> >> For the former one, I don't think the dynamic trace strategy is right. In my
>> >> opinion, to do dynamic tracing we need to examine all possible running path
>> >> of the program. It is unrealistic, especially when the program must interact
>> >> with users.
>> >> The latter one may have the same problem as the former one, I guess.
>> >> In fact, there is a condition that the class name string is from the user
>> >> input. If so, I think we can ignore the class selector and offer the whole
>> >> jre. Except that, it is always possible to parse the code and generate the
>> >> dynamic loaded class name, although I still don't have a structured
>> >> algorithm...
>> >> Hehe, I find my words a bit orderless...
>> >>
>> >> Daniel
>> >
>> > 1 I think the dynamic tracing is possible. I took a look at the drlvm's
>> > source these days. It should be easy to let the drlvm leave a trace for
>> > us.
>> > 2 Dynamic tracing should be involved because it can help developers to
>> > do their tests. which means that dynamic collection is being performed
>> > when testing.
>> >
>> > Yours Mike
>> >
>> >> On Tue, Mar 31, 2009 at 12:17 PM, Xiao-Feng Li wrote:
>> >>
>> >> > One another thing is the consideration of dynamic class loading.
>> >> >
>> >> > Thanks,
>> >> > xiaofeng
>> >> >
>> >> > On Mon, Mar 30, 2009 at 11:57 PM, Jimmy,Jing Lv
>> >> > wrote:
>> >> > > Wow the plan's excellent Daniel!
>> >> > >
>> >> > > And an advanced question, as you know, the jre does not only have
>> >> > classes,
>> >> > > but also resources files, property files and etc. So do you have any
>> >> > ideas
>> >> > > on select them and merge into the customized JRE? :)
>> >> > >
>> >> > > 2009/3/30 Daniel Gong
>> >> > >
>> >> > >> Hi all,
>> >> > >> I'm a postgraduate student from Fudan University, Shanghai, China.
>> >> > >> This is my first time joining GSoC and I was not quite clear that I
>> >> > >> should exchange my ideas with possible mentors. I've submitted my
>> >> > proposal
>> >> > >> today. It's lucky that I can still modify it.
>> >> > >> Here is my proposal, any criticism and suggestions are welcome~
>> >> > >>
>> >> > >> =====================================================
>> >> > >>
>> >> > >> *Abstract:*
>> >> > >>
>> >> > >> The main idea to deal with the subject is to collect infomation from the
>> >> > >> input first and then generate smallest JRE according to the infomation
>> >> > >> collected and harmony classes dependences.
>> >> > >>
>> >> > >> *Detailed Description:*
>> >> > >>
>> >> > >> The implementation of the tool can be divided into 4 parts:
>> >> > >>
>> >> > >> 1. Infomation Collector. Automatic lexcial tool such as JLex may be
>> >> > used
>> >> > >> to analysis the input code and collect infomation including which
>> >> > classes
>> >> > >> in
>> >> > >> JRE does the project depend on.
>> >> > >> 2. Data structure design. Both project-jre class dependence and jre
>> >> > inner
>> >> > >> class dependence should be represented in an uniform way.
>> >> > >> 3. Class Lister. An algorithm should be designed to compute with the
>> >> > >> dependence and list out the classes needed in the smallest JRE.
>> >> > >> 4. JRE Builder. Build a JRE according to the class list.
>> >> > >>
>> >> > >> *Initial* *Algorithm Design*
>> >> > >>
>> >> > >> Use a, b to represent two classes, and to represent a relation
>> >> > >> between a & b, that is, a depends on b, in other words, b is refered in
>> >> > >> source code of a.
>> >> > >>
>> >> > >> 1. Given a project with its class set P, let set S = P and set M =
>> >> > empty.
>> >> > >>
>> >> > >> 2. For each class c in S, search for dependence , and for each d
>> >> > >> that exists and d is not in M, put d in S. After searching for
>> >> > > >> > >> *>, put c in M and delete it from S.
>> >> > >> 3. Loop step 2 until S is empty, return M - P.
>> >> > >>
>> >> > >> Here a project's class set includes its customized classes and classes
>> >> > in
>> >> > >> other packages that the project may link to.
>> >> > >>
>> >> > >> *Possible problems to solve*
>> >> > >>
>> >> > >> To collect the infomation, just reading the "import" part of the code is
>> >> > >> not
>> >> > >> a precise strategy. A lexicial scan of the code from begin to end is a
>> >> > >> must.
>> >> > >> Automatic lexcial tools can be used to solve the problem.
>> >> > >>
>> >> > >> JRE is not just a simple collection of classes needed. Getting familiar
>> >> > >> with
>> >> > >> the structure of Harmony JRE is a must.
>> >> > >>
>> >> > >> *Draft Timeline*
>> >> > >>
>> >> > >> - Week 1-2 Complete the design of data structure and the algorithm;
>> >> > >> - Week 3-4 Implement the module of infomation collector;
>> >> > >> - Week 5-6 Implement the algorithm to list out the classes;
>> >> > >> - Week 7-8 Implement the JRE builder;
>> >> > >> - Week 9 Debug the whole module and make necessary modifications
>> >> > >> to successfully complete the subject.
>> >> > >>
>> >> > >> *Additional Information:*
>> >> > >>
>> >> > >> I've been learning and using Java since 3 years ago. Although my
>> >> > >> experience of Harmony is not that vast, my knowledge in programming,
>> >> > >> software architecture, compiler building and algorithm can help me to
>> >> > learn
>> >> > >> fast and handle the problem.
>> >> > >>
>> >> > >> I'm 23 years old, living in Shanghai, China, attending Fudan University.
>> >> > >>
>> >> > >> =====================================================
>> >> > >>
>> >> > >
>> >> > >
>> >> > >
>> >> > > --
>> >> > >
>> >> > > Best Regards!
>> >> > >
>> >> > > Jimmy, Jing Lv
>> >> > > China Software Development Lab, IBM
>> >> > >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > http://people.apache.org/~xli
>> >> >
>> >
>> >
>>
>>
>>
>
>
--
Best Regards!
Wen Dong