jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale E Martin" <dmar...@cliftonlabs.com>
Subject Re: Dealing with Repository class.
Date Wed, 17 Apr 2002 13:26:47 GMT
> I was thinking the ClassRepository as being analagous to the ClassLoader
> in Java.  It is helpful to have around the JavaClass, because the
> "ObjectType" and "ArrayType" need to have some visibility on the
> Repository the class was created from.
 
> (If you are staring at a Method, and run into an Exception.  The
> repository the method came from, is the only repository where you will
> find the exception.)

> Unfortunately, I've been working only on the ClassLoader side of things.
> I had not thought that JavaClasses are buildable outside of the
> Repository.
 
Perhaps this points to a need for a "SyntheticClassRepository" or something
like that that gets automatically associated with ClassGen/synthetic
classes.  Until I see the Repository interface it's hard (for me) to know
if there would be value in this.

What I would prefer to see in BCEL in a lot of these areas are interfaces
that have several realizations.  I'd like to see a "BCELClass" interface, a
"Repository" interface, an "Attribute" interface, a "ConstantPool"
interface, etc.  Then I'd like to see the various forms of these things
(read in from class, synthetically generated, etc) be different
instantiations of these interfaces.  And in general, I would design things
so that references generally only refer to these interfaces, never to
concrete implementations.  (Instantiation obviously has to happen on the
concrete classes.)  

For example, I would have JavaClass and ClassGen both implement the
"BCELClass" interface, but within BCEL's code, I would only refer to
"BCELClass" so that I'm agnostic to where the class came from.

If you're going to go to the trouble of rearchitecting some key parts of
BCEL, this is the route I would love to see it go.  Of course you could
move this direction incrementally.

> I suppose what we can do, is to create a default ClassRepository which
> handles creations of classes outside of a ClassLoader context.  This
> Repository would be accessed as a Singleton.
 
In general I think for what you're doing a Singleton is nicer than a "pure
static" class as Repository now is, I like this idea.

Take care,
     Dale
-- 
Dale E. Martin, Clifton Labs, Inc.
Senior Computer Engineer
dmartin@cliftonlabs.com
http://www.cliftonlabs.com
pgp key available

--
To unsubscribe, e-mail:   <mailto:bcel-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:bcel-dev-help@jakarta.apache.org>


Mime
View raw message