Re: Dealing with Repository class.
David Dixon-Peugh <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <[email protected]> |
Markus,
Unfortunately, I can't handle the task as
a subclass of the Repository. (All methods
are static on the Repository, making subclassing
impossible.)
What I am thinking about doing is:
STEP 1 --
---------
Create a new class
"org.apache.bcel.util.ClassRepository"
Modify JavaClass objects to hold reference
to ClassRepository
ClassRepository -
Looks up & Defines "JavaClass" objects
from resources. All JavaClass objects
known by the Repository point back.
Define a default ClassRepository which is
based on the System Classloader.
STEP 2 --
---------
Deprecate ClassPath class.
Deprecate Repository class.
Rewrite Repository class to use the default
ClassRepository.
Move the following methods to JavaClass:
getSuperClasses
getInterfaces
instanceOf
implementationOf
Reimplement those methods with the stored
ClassRepository
Step 3 and beyond -
-------------------
Modify ClassLoader to use the new ClassRepository.
Ensure ObjectType and ArrayType are aware of
the ClassRepository.
Identify areas of BCEL which currently use the
deprecated methods, and fix.
--- DDP
--- [email protected] wrote:
> Hi,
>
> > First, the problem I ran into. There are several
> > instances in the BCEL code (and in the Quilt code)
> > which refers to static methods on the Repository
> > for finding information about a class:
> > getSuperClasses
> > getInterfaces
> > instanceOf
> > implementationOf
> >
> > These methods all use the system classpath.
> (Whereas
> > the ClassLoader I was developing used the
> > AntClassLoader.)
> >
> > What I would like to do, is two fold:
> > Part 1 - Move those four methods onto the
> JavaClass
> > object. In most circumstances, at least one
> > JavaClass is available, and can be used for the
> > query.
>
> That would be nice in that it would be more
> "object-oriented", however,
> the information needs to be gathered somewhere ...
>
> > Part 2 - Remove the staticness of the Repository
> > class, such that more than one Repository can
> exist.
> > This will enable two BCEL programs to operate in
> > the same JVM, which could be helpful as BCEL
> tasks
> > end up in Ant scripts.
>
> That would be OK, but I think that a lot of code is
> relying on the
> "old" repository. I'd rather make it deprecated and
> replicate its
> code in a subclassable new repository.
>
> Cheers
> Markus
>
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/