river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <craig.russ...@oracle.com>
Subject Re: API and VM compatibility verification
Date Sun, 05 Dec 2010 12:20:52 GMT
The JDO project does signature checking using reflection on a jar  
file. The expected values of reflection are stored in a file that  
looks a lot like the signature of the class itself.

Here's a snippet of the signature definition file:

public interface javax.jdo.datastore.JDOConnection {
     public Object getNativeConnection();
     public void close();
}

public interface javax.jdo.datastore.Sequence {
     public String getName();
     public Object next();
     public void allocate(int additional);
     public Object current();
     public long nextValue();
     public long currentValue();
}

The code is pretty simple and can just be taken as is in source.

http://svn.apache.org/viewcvs.cgi/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/api/SignatureTest.java

The real work is in the file org/apache/jdo/tck/util/signature/ 
SignatureVerifier.java

Craig

On Dec 5, 2010, at 3:24 AM, Sim IJskes - QCG wrote:

> On 05-12-10 02:24, Peter Firmstone wrote:
>> Sim IJskes - QCG wrote:
>>> Is there a tool that we can use to verify API compatibility? So we  
>>> can
>>> make sure we do not call methods that do not exist?
>
>> I've been pondering bytecode analysis.
>
> I think thats the only way to do it. Compile to jars and verify  
> against API specs.
>
>> We have just such a tool, have a look at in  
>> com.sun.jini.tool.classdepend
>> It needs to be extended to include method signatures, currently it  
>> just
>
> One minor detail. It only needs to be extended.
>
> If we don't go for a complete tool, we need to make profiles. The  
> profile should contain class version range (who knows where these  
> are documented? jvms only lists until 1.2) method signatures and  
> access modifiers. Whe can read the signatures from the (runtime)  
> class files, the class version we specify manually.
> To verify we would scan all the bytecode, look for method calls and  
> verify existance and access.
>
> We would basically recreate the bytecode verifier. I haven't  
> reserarched how accessible it is in the tools.jar and how easy it  
> would be to feed it profiles. I also haven't looked at harmony,  
> which also should have a verifier.
>
> I prefer a tool ready build. :-) Don't mind debugging it.
>
> Gr. Sim
>
>
> -- 
> QCG, Software voor het MKB, 071-5890970, http://www.qcg.nl
> Quality Consultancy Group b.v., Leiderdorp, Kvk Den Haag: 28088397

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@oracle.com
P.S. A good JDO? O, Gasp!


Mime
View raw message