javah issues

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Mon Jun 25 08:07:34 PDT 2007

So, javah is currently written as a combination of a javadoc Doclet  
and a wrapper around javadoc.  That's because when javah was written,  
there was no JSR 269 and no better language model API.

As an experiment, I tried rewriting it as an annotation processor.   
Mostly, it works identically to the old version, as you'd expect,  
giving the exact same text output, as far as I've tested it so far.

Until ...

I tried plugging this new version of javah into a j2se build.  The  
build gets quite a long way, then eventually fails.

It turns out that at one point in the build, there is an invocation  
of javah with an incomplete bootclasspath.  The bootclasspath  
contains a bunch of classes of interest, but only those classes, and  
not important classes, like java.lang.*.  Seems that didn't bother  
the old doclet-based javah, but it does bother an annotation  
processor based javah.

So is the old behaviour wrong enough that we have to fix it -- are  
there worse case scenarios where it could give incorrect outrput --  
or is the old behavior sufficiently enshrined that we can't use the  
new version of javah?

-- Jon G.

More information about the compiler-dev mailing list