commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Florey" <>
Subject AW: AW: AW: [proposal] avoiding jar version nightmares
Date Tue, 21 Dec 2004 13:12:11 GMT
In order to find an appropriate solution to this issue, I'd like to identify
the different problems that we need to address.
Version: What does a version number mean?
I'll make a proposal for how to use minor/major version number to have a
basis on which we can identify the issues.
Major version numbers indicate that some public API methods have been
changed in semantics or have been removed. So an application using
component-1.x might not work with component-2.x
Minor version numbers indicate that the component remains backward
compatible, but new methods may have been introduced.
So an application using component-1.x will work with component-1.y if y>0,
but an application component-1.y might fail when using component 1.x
A build number might indicate that private methods have changed without
affecting the public api.
So an application using component 1.x.a will work with component 1.x.b and
an application using 1.x.b will work with component 1.x.a
Does this sound reasonable? Missed something?

So when declaring a jar metafile (don't know either if we can the MANIFEST
for this) it should at least contain something like this:

	<provides name="commons-i18n" version="1.1.3" />
	<requires name="commons-digester" version="2.0" />
	<requires name="commons-transaction" version="1.1" />

This one would indicate that the describe jar can be referenced by the name
"commons-i18n" and has the version number 1.1.3.
It requires any version of commons-digester higher than 2.0 and
commons-transaction with version newer or equal 1.1

This could be the basis to implement a commons component managing the
dependencies the way you described.
I'd prefer to keep the "jar" naming as introducing "assembly" would cause
some confusion.
If anyone would be interested I could put a simple proposal to the sandbox.

This approach will not address the trouble that may be caused by
applications not using this package. So finally I think that it is required
that this feature (or something comparable) will make it into Java 1.6.
Up to then I still think it's a very simple but easy way to add the version
number to the package names to avoid at least the very big problems
concerning incompatible jars in the same classloader.


> -----Urspr√ľngliche Nachricht-----
> Von:
> []
> Im Auftrag von Matt Sgarlata
> Gesendet: Dienstag, 21. Dezember 2004 13:04
> An:
> Betreff: Re: AW: AW: [proposal] avoiding jar version nightmares
> Chris Lambrou wrote:
> > Matt Sgarlata wrote:
> >
> >> Does this mean .NET doesn't have reflection?  That's such a killer
> >> feature of Java; I can't believe they wouldn't have ported it to .NET.
> >> Any .NET developers out there that can tell us how .NET deals with
> >> reflection when you have multiple versions of the same class?
> >
> >
> > Since the class name alone is insufficient to fully identify a specific
> > version of a class, to my knowledge there is no equivalent to
> > Class.forName(String classname) in .NET. Instead, .NET has the Assembly
> > class. An Assembly is roughly akin to a java jar file, and is typically
> > a single DLL that contains one or more classes. Assembly has a
> > non-static getType(String typeName) method, that performs the same job
> > as the static Class.forName(String classname) method in java, but for a
> > specific Assembly instance. There is never any ambiguity over which
> > version of the named Type that is returned, since an Assembly can only
> > contain one version of any given class. Support for multiple versions of
> > a class at runtime is achieved by storing those multiple class versions
> > in separate Assemblies.
> Thanks for the info, Chris!  This definitely sounds like a good
> approach.  Now my question is, can we simulate this in a new commons
> component? :)
> Here are the steps I would imagine to be involved:
> 1) Define our own JAR sub-type to mirror the .NET assembly notion.
> Include some type of a plain-text file that describes the versions of
> the software required to perform certain tasks.  It would be nice to do
> this in an existing structure like MANIFEST.MF, but I don't know... are
> you allowed to add arbitrary information to that file?  In any case, we
> wouldn't use the existing dependency descriptors because that would
> prevent multiple versions of the same class from being loaded.
> 2) Call org.apache.commons.assembler.Assembler.getType(String
> assembledPackage, String className).  The Assembler would then go to the
> assemblyPackage path on the classpath and search the plain-text file
> from step #1 which would list the versions of classes that are required
> by the given assembledPackage.  For example, if assembledPackage was the
> Digester, which required collections 3, the assembledPackage would be
> org.apache.commons.digester.  A dynamic proxy or generated bytecode
> would be loaded that fulfilled the given contract and that would be
> returned to the client.  Any existing code that is just calling
> Class.forName would have classes looked up in the normal way, so we
> would need to make sure that this dynamic proxy doesn't get loaded into
> the JVM in the same way as Class.forName (this is where the dynamic
> proxy and/or bytecode generation comes in)
> What do you guys think?  Does this sound feasible?  I'd rather spin this
> as a commons component than a J2SE 1.6 enhancement request, because the
> later will take years to come to fruition.
> > Chris
> Matt
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message