You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by sebb <se...@gmail.com> on 2015/01/10 21:52:32 UTC

Animal sniffer Java API checking

I've been working on adding Animal Sniffer Plugin to Commons NET
(intially, maybe add to the parent eventually).

The plugin can compare the compiled code against an API signature for
a specific Java version.
It detects most incompatibilities, but should not be regarded as
fool-proof - only a test with the target JVM will really show that.

Commons has lots of components with lots of different Java targets,
and it's not always convenient/possible to use the CI builds to detect
such errors. So the plugin has its uses.

Possibly less useful here, but if it is of interest I can provide a patch.

Note: the NET pom code uses the build-helper to convert the target
(say) 1.5 to the API signature name "java15" and the sniffer is
invoked during the test phase.

Currently the sniffer is always invoked; it can be skipped by defining
animal.sniffer.skip
However it would also be possible to add the code as an optional
profile instead.

WDYT?

Sorry, I've no idea if it can be used to check the Android code.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Animal sniffer Java API checking

Posted by sebb <se...@gmail.com>.
On 11 January 2015 at 15:58, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sat, 2015-01-10 at 20:52 +0000, sebb wrote:
>> I've been working on adding Animal Sniffer Plugin to Commons NET
>> (intially, maybe add to the parent eventually).
>>
>> The plugin can compare the compiled code against an API signature for
>> a specific Java version.
>> It detects most incompatibilities, but should not be regarded as
>> fool-proof - only a test with the target JVM will really show that.
>>
>> Commons has lots of components with lots of different Java targets,
>> and it's not always convenient/possible to use the CI builds to detect
>> such errors. So the plugin has its uses.
>>
>> Possibly less useful here, but if it is of interest I can provide a patch.
>>
>> Note: the NET pom code uses the build-helper to convert the target
>> (say) 1.5 to the API signature name "java15" and the sniffer is
>> invoked during the test phase.
>>
>> Currently the sniffer is always invoked; it can be skipped by defining
>> animal.sniffer.skip
>> However it would also be possible to add the code as an optional
>> profile instead.
>>
>> WDYT?
>>
>> Sorry, I've no idea if it can be used to check the Android code.
>>
>
> Hi Sebastian
>
> It does sound useful given how often we end up breaking minimal JRE
> compatibility.

OK, I'll copy the bits I added to the Commons Parent.
Unfortunately it seems the plugin does not check the test code, but
that is less of an issue.

> I would not bother with Java 1.5 any longer though as HC
> is about to go 4.4 which is Java 1.6 based.

I just used 1.5 as an example. There are also signatures for 1.6 and
1.7 currently.

The profile uses whatever is defined as maven.compiler.target.

> Cheers
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Animal sniffer Java API checking

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2015-01-10 at 20:52 +0000, sebb wrote:
> I've been working on adding Animal Sniffer Plugin to Commons NET
> (intially, maybe add to the parent eventually).
> 
> The plugin can compare the compiled code against an API signature for
> a specific Java version.
> It detects most incompatibilities, but should not be regarded as
> fool-proof - only a test with the target JVM will really show that.
> 
> Commons has lots of components with lots of different Java targets,
> and it's not always convenient/possible to use the CI builds to detect
> such errors. So the plugin has its uses.
> 
> Possibly less useful here, but if it is of interest I can provide a patch.
> 
> Note: the NET pom code uses the build-helper to convert the target
> (say) 1.5 to the API signature name "java15" and the sniffer is
> invoked during the test phase.
> 
> Currently the sniffer is always invoked; it can be skipped by defining
> animal.sniffer.skip
> However it would also be possible to add the code as an optional
> profile instead.
> 
> WDYT?
> 
> Sorry, I've no idea if it can be used to check the Android code.
> 

Hi Sebastian

It does sound useful given how often we end up breaking minimal JRE
compatibility. I would not bother with Java 1.5 any longer though as HC
is about to go 4.4 which is Java 1.6 based.  

Cheers

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org