You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Greg Brown <gr...@oracle.com> on 2012/03/13 14:12:26 UTC
task
Hi all,
The other day I noticed that, when run under Java 6, the <javah> task only produces headers for explicitly named classes. However, under Java 7, <javah> generates headers for the named classes as well as any nested or inner classes defined by those classes, regardless of whether the nested classes actually define any native methods.
Was this change intentional? I personally prefer the Java 6 behavior and I'm wondering if there might be a way to re-enable it in Java 7.
Thanks,
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: task
Posted by Greg Brown <gr...@oracle.com>.
Just to close the loop - here is the answer (from Jonathan Gibbons, author of javah):
> I looked at the Ant <javah> task, and it's a simple enough wrapper around whatever impl of javah it can find.
>
> The fundamental problem is that back in JDK 5, javah was rewritten for the first time, but the old code remained available via the -Xold switch. But, it wasn't a very good rewrite, so in the JDK 6/7 timeframe, I rewrote parts of it, and because there were already two versions of javah in JDK, and I was about to add a third, I got rid of the other two, and eliminated the undocumented -Xold option.
>
> So, you can probably figure out the rest of the story.
>
> The change in behavior that you came across was introduced round about JDK 5, but it was masked by Ant using the -Xold switch to get at the old code. When I did my rewrite, I removed -Xold, thus forcing the Ant task to move to a later version of javah, thus getting the additional header files.
>
> For my part, when I did my rewrite back in JDK 6/7, I retained fidelity with the standard command line version of javah in use at the time, so I wrote it so that it continued to generate headers for nested classes.
Greg
On Mar 13, 2012, at 1:28 PM, Greg Brown wrote:
>> The implementation of Ant's javah task doesn't even check which version
>> of Java you are using. If this is a change, it is within the JDK, not
>> Ant.
>
> That was my first thought as well:
>
> http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-March/003554.html
>
>> If you run Ant -verbose it should give you the literal command line it
>> passes to javah. I wouldn't expect it to contain your nested classes.
>
> I'll try that and let you know what I find out.
>
> Thanks!
> Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: task
Posted by Greg Brown <gr...@oracle.com>.
> The implementation of Ant's javah task doesn't even check which version
> of Java you are using. If this is a change, it is within the JDK, not
> Ant.
That was my first thought as well:
http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-March/003554.html
> If you run Ant -verbose it should give you the literal command line it
> passes to javah. I wouldn't expect it to contain your nested classes.
I'll try that and let you know what I find out.
Thanks!
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: task
Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-03-13, Greg Brown wrote:
> The other day I noticed that, when run under Java 6, the <javah> task
> only produces headers for explicitly named classes. However, under
> Java 7, <javah> generates headers for the named classes as well as any
> nested or inner classes defined by those classes, regardless of
> whether the nested classes actually define any native methods.
> Was this change intentional?
The implementation of Ant's javah task doesn't even check which version
of Java you are using. If this is a change, it is within the JDK, not
Ant. I can't seem to find any reference to that change, though.
If you run Ant -verbose it should give you the literal command line it
passes to javah. I wouldn't expect it to contain your nested classes.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org