You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2015/01/08 17:24:39 UTC

[All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
> On 01/08/2015 04:44 PM, sebb wrote:
>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>> On 01/08/2015 12:25 PM, sebb wrote:
>>> We certainly need to add animal-sniffer to our release building process
>>> to detect such things.
>>
>> Does that actually detect such things?
>
> yes, that's the intention of this tool, and there is even a maven plugin:
>
> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html

This suggests one has to create the API signature first.
Which means one has to have access to the appropriate JDK anyway.

But I now see that some sigs are already provided.

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
On 9 January 2015 at 15:22, sebb <se...@gmail.com> wrote:
> On 9 January 2015 at 10:01, Thomas Neidhart <th...@gmail.com> wrote:
>> On 01/09/2015 02:00 AM, sebb wrote:
>>> On 9 January 2015 at 00:47, Bernd Eckenfels <ec...@zusammenkunft.net> wrote:
>>>> Am Fri, 9 Jan 2015 00:38:31 +0000
>>>> schrieb sebb <se...@gmail.com>:
>>>>
>>>>> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
>>>>> new IOException(new Exception()) which is Java 1.6+
>>>>
>>>> What Java did you use to start maven? Looks like Animal sniffer itself
>>>> uses Java 7 API.
>>>
>>> Java 7, but I just tried Java 6 and that worked the same.
>>>
>>> I raised a bug about the unhelpful output.
>>>
>>> There are some bug reports which suggest that the plugin is not 100%
>>> accurate compared with a compiler.
>>>
>>> So at best the plugin can be used to detect some API violations.
>>> I think we still need to build and test with the appropriate Java version.
>>
>> There must be something wrong with your setup.
>
> Just tried again
>
> Looks like the plugin does not like Java6 on MacOS, and fails when
> trying to report the first problem.

The problem is that the plugin uses a Java 7 method, but only when
reporting API violations.

I've raised

https://jira.codehaus.org/browse/MANIMALSNIFFER-55

about this.

The cause is suprising - the sniffer plugin was compiled with Java 7.
See the JIRA issue for details.

>> I did the same test and get the following output:
>>
>> [INFO] --- animal-sniffer-maven-plugin:1.13:check (default-cli) @
>> commons-email ---
>> [INFO] Checking unresolved references to
>> org.codehaus.mojo.signature:java15:1.0
>> [ERROR]
>> /home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:75:
>> Undefined reference: double[] java.util.Arrays.copyOf(double[], int)
>> [ERROR]
>> /home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:77:
>> Undefined reference: void java.io.IOException.<init>(Throwable)
>>
>>
>> after adding the following code snippet to commons-email (also at JDK 1.5):
>>
>>         Arrays.copyOf(new double[] { 0 }, 1);
>>         if ( true ) {
>>             throw new IOException(new Exception());
>>         }
>>
>
>
>> Thomas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
On 9 January 2015 at 10:01, Thomas Neidhart <th...@gmail.com> wrote:
> On 01/09/2015 02:00 AM, sebb wrote:
>> On 9 January 2015 at 00:47, Bernd Eckenfels <ec...@zusammenkunft.net> wrote:
>>> Am Fri, 9 Jan 2015 00:38:31 +0000
>>> schrieb sebb <se...@gmail.com>:
>>>
>>>> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
>>>> new IOException(new Exception()) which is Java 1.6+
>>>
>>> What Java did you use to start maven? Looks like Animal sniffer itself
>>> uses Java 7 API.
>>
>> Java 7, but I just tried Java 6 and that worked the same.
>>
>> I raised a bug about the unhelpful output.
>>
>> There are some bug reports which suggest that the plugin is not 100%
>> accurate compared with a compiler.
>>
>> So at best the plugin can be used to detect some API violations.
>> I think we still need to build and test with the appropriate Java version.
>
> There must be something wrong with your setup.

Just tried again

Looks like the plugin does not like Java6 on MacOS, and fails when
trying to report the first problem.

> I did the same test and get the following output:
>
> [INFO] --- animal-sniffer-maven-plugin:1.13:check (default-cli) @
> commons-email ---
> [INFO] Checking unresolved references to
> org.codehaus.mojo.signature:java15:1.0
> [ERROR]
> /home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:75:
> Undefined reference: double[] java.util.Arrays.copyOf(double[], int)
> [ERROR]
> /home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:77:
> Undefined reference: void java.io.IOException.<init>(Throwable)
>
>
> after adding the following code snippet to commons-email (also at JDK 1.5):
>
>         Arrays.copyOf(new double[] { 0 }, 1);
>         if ( true ) {
>             throw new IOException(new Exception());
>         }
>


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

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Thomas Neidhart <th...@gmail.com>.
On 01/09/2015 02:00 AM, sebb wrote:
> On 9 January 2015 at 00:47, Bernd Eckenfels <ec...@zusammenkunft.net> wrote:
>> Am Fri, 9 Jan 2015 00:38:31 +0000
>> schrieb sebb <se...@gmail.com>:
>>
>>> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
>>> new IOException(new Exception()) which is Java 1.6+
>>
>> What Java did you use to start maven? Looks like Animal sniffer itself
>> uses Java 7 API.
> 
> Java 7, but I just tried Java 6 and that worked the same.
> 
> I raised a bug about the unhelpful output.
> 
> There are some bug reports which suggest that the plugin is not 100%
> accurate compared with a compiler.
> 
> So at best the plugin can be used to detect some API violations.
> I think we still need to build and test with the appropriate Java version.

There must be something wrong with your setup.
I did the same test and get the following output:

[INFO] --- animal-sniffer-maven-plugin:1.13:check (default-cli) @
commons-email ---
[INFO] Checking unresolved references to
org.codehaus.mojo.signature:java15:1.0
[ERROR]
/home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:75:
Undefined reference: double[] java.util.Arrays.copyOf(double[], int)
[ERROR]
/home/tn/workspace/apache/email/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java:77:
Undefined reference: void java.io.IOException.<init>(Throwable)


after adding the following code snippet to commons-email (also at JDK 1.5):

        Arrays.copyOf(new double[] { 0 }, 1);
        if ( true ) {
            throw new IOException(new Exception());
        }

Thomas

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Jörg Schaible <jo...@gmx.de>.
sebb wrote:

> On 9 January 2015 at 00:47, Bernd Eckenfels <ec...@zusammenkunft.net>
> wrote:
>> Am Fri, 9 Jan 2015 00:38:31 +0000
>> schrieb sebb <se...@gmail.com>:
>>
>>> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
>>> new IOException(new Exception()) which is Java 1.6+
>>
>> What Java did you use to start maven? Looks like Animal sniffer itself
>> uses Java 7 API.
> 
> Java 7, but I just tried Java 6 and that worked the same.
> 
> I raised a bug about the unhelpful output.
> 
> There are some bug reports which suggest that the plugin is not 100%
> accurate compared with a compiler.
> 
> So at best the plugin can be used to detect some API violations.
> I think we still need to build and test with the appropriate Java version.

IMHO the animal sniffer is a good thing to add to our POMs, since it will at 
least detect that there's a problem. Even if it cannot generate a completely 
useful error report, it forces you to test with the lower JDK.

Cheers,
Jörg


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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
On 9 January 2015 at 00:47, Bernd Eckenfels <ec...@zusammenkunft.net> wrote:
> Am Fri, 9 Jan 2015 00:38:31 +0000
> schrieb sebb <se...@gmail.com>:
>
>> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
>> new IOException(new Exception()) which is Java 1.6+
>
> What Java did you use to start maven? Looks like Animal sniffer itself
> uses Java 7 API.

Java 7, but I just tried Java 6 and that worked the same.

I raised a bug about the unhelpful output.

There are some bug reports which suggest that the plugin is not 100%
accurate compared with a compiler.

So at best the plugin can be used to detect some API violations.
I think we still need to build and test with the appropriate Java version.

> Gruss
> Bernd
>
>> It does detect the reference, but the error message is pretty hopeless
>> - it does not show the class or even the jar in which it is found.
>> Instead there are a load of what appear to be debug lines:
>>
>> [ERROR] Failed to execute goal
>> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check
>> (checkAPIcompat) on project commons-net: Execution checkAPIcompat of
>> goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed:
>> An API incompatibility was encountered while executing
>> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check:
>> java.lang.NoSuchMethodError:
>> java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;
>> [ERROR] -----------------------------------------------------
>> [ERROR] realm =
>> plugin>org.codehaus.mojo:animal-sniffer-maven-plugin:1.13 [ERROR]
>> plugin>strategy =
>> plugin>org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
>> [ERROR] urls[0] =
>> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer-maven-plugin/1.13/animal-sniffer-maven-plugin-1.13.jar
>> [ERROR] urls[1] =
>> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer/1.13/animal-sniffer-1.13.jar
>> [ERROR] urls[2] =
>> file:/Users/sebb/.m2/repository/org/ow2/asm/asm-all/4.0/asm-all-4.0.jar
>> [ERROR] urls[3] =
>> file:/Users/sebb/.m2/repository/org/codehaus/mojo/java-boot-classpath-detector/1.13/java-boot-classpath-detector-1.13.jar
>> [ERROR] urls[4] =
>> file:/Users/sebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.1/maven-reporting-api-2.0.1.jar
>> [ERROR] urls[5] =
>> file:/Users/sebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-6/doxia-sink-api-1.0-alpha-6.jar
>> [ERROR] urls[6] =
>> file:/Users/sebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
>> [ERROR] urls[7] =
>> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
>> [ERROR] urls[8] =
>> file:/Users/sebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
>> [ERROR] urls[9] =
>> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar
>> [ERROR] Number of foreign imports: 1
>> [ERROR] import: Entry[import  from realm ClassRealm[maven.api,
>> parent: null]] [ERROR]
>>
>> However, it does detect the error even if it does not provide any help
>> in finding it.
>>
>> On 8 January 2015 at 22:33, sebb <se...@gmail.com> wrote:
>> > On 8 January 2015 at 21:21, Thomas Neidhart
>> > <th...@gmail.com> wrote:
>> >> On 01/08/2015 07:12 PM, sebb wrote:
>> >>> On 8 January 2015 at 17:29, Benedikt Ritter
>> >>> <be...@gmail.com> wrote:
>> >>>>
>> >>>>
>> >>>> Send from my mobile device
>> >>>>
>> >>>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart
>> >>>>> <th...@gmail.com>:
>> >>>>>
>> >>>>>> On 01/08/2015 05:24 PM, sebb wrote:
>> >>>>>>> On 8 January 2015 at 16:13, Thomas Neidhart
>> >>>>>>> <th...@gmail.com> wrote:
>> >>>>>>>> On 01/08/2015 04:44 PM, sebb wrote:
>> >>>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart
>> >>>>>>>>> <th...@gmail.com> wrote: On 01/08/2015 12:25 PM,
>> >>>>>>>>> sebb wrote: We certainly need to add animal-sniffer to our
>> >>>>>>>>> release building process to detect such things.
>> >>>>>>>>
>> >>>>>>>> Does that actually detect such things?
>> >>>>>>>
>> >>>>>>> yes, that's the intention of this tool, and there is even a
>> >>>>>>> maven plugin:
>> >>>>>>>
>> >>>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>> >>>>>>
>> >>>>>> This suggests one has to create the API signature first.
>> >>>>>> Which means one has to have access to the appropriate JDK
>> >>>>>> anyway.
>> >>>>>>
>> >>>>>> But I now see that some sigs are already provided.
>> >>>>>
>> >>>>> here is an example of the usage:
>> >>>>>
>> >>>>>      <plugin>
>> >>>>>        <groupId>org.codehaus.mojo</groupId>
>> >>>>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>> >>>>>        <version>1.13</version>
>> >>>>>        ...
>> >>>>>        <configuration>
>> >>>>>          ...
>> >>>>>          <signature>
>> >>>>>            <groupId>org.codehaus.mojo.signature</groupId>
>> >>>>>            <artifactId>java15</artifactId>
>> >>>>>            <version>1.0</version>
>> >>>>>          </signature>
>> >>>>>          ...
>> >>>>>        </configuration>
>> >>>>>        ...
>> >>>>>      </plugin>
>> >>>>>
>> >>>>> signatures for the various jdk versions are already available.
>> >>>>> We could add different profiles to the parent depending on the
>> >>>>> maven.compiler.source property.
>> >>>>>
>> >>>
>> >>> A pity that the signatures are not called java1.5 etc.
>> >>> That would allow one to do:
>> >>>
>> >>> <artifactId>java${ maven.compiler.source}</artifactId>
>> >>>
>> >>> Maybe there is a way to drop the "." from the source property?
>> >>
>> >> its a pity maven does not support powerful property substitutions
>> >> like in ksh for example:
>> >>
>> >> http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml
>> >>
>> >> Is there a pending feature request for this?
>> >>
>> >> What I have found is this:
>> >>
>> >> http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html
>> >>
>> >> by using the gmaven-plugin you can create new properties based on
>> >> original ones using standard string manipulation functions.
>> >
>> > Looks like build helper can do it too:
>> >
>> > http://mojo.codehaus.org/build-helper-maven-plugin/regex-property-mojo.html
>> >
>> >>> If not, then profiles will work (but require more code).
>> >>>
>> >>>> Very nice!
>> >>>>
>> >>>>> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Am Fri, 9 Jan 2015 00:38:31 +0000
schrieb sebb <se...@gmail.com>:

> Just tried the animal sniffer on NET (Java 1.5) - I added a call to
> new IOException(new Exception()) which is Java 1.6+

What Java did you use to start maven? Looks like Animal sniffer itself
uses Java 7 API.

Gruss
Bernd

> It does detect the reference, but the error message is pretty hopeless
> - it does not show the class or even the jar in which it is found.
> Instead there are a load of what appear to be debug lines:
> 
> [ERROR] Failed to execute goal
> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check
> (checkAPIcompat) on project commons-net: Execution checkAPIcompat of
> goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed:
> An API incompatibility was encountered while executing
> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check:
> java.lang.NoSuchMethodError:
> java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;
> [ERROR] -----------------------------------------------------
> [ERROR] realm =
> plugin>org.codehaus.mojo:animal-sniffer-maven-plugin:1.13 [ERROR]
> plugin>strategy =
> plugin>org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] =
> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer-maven-plugin/1.13/animal-sniffer-maven-plugin-1.13.jar
> [ERROR] urls[1] =
> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer/1.13/animal-sniffer-1.13.jar
> [ERROR] urls[2] =
> file:/Users/sebb/.m2/repository/org/ow2/asm/asm-all/4.0/asm-all-4.0.jar
> [ERROR] urls[3] =
> file:/Users/sebb/.m2/repository/org/codehaus/mojo/java-boot-classpath-detector/1.13/java-boot-classpath-detector-1.13.jar
> [ERROR] urls[4] =
> file:/Users/sebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.1/maven-reporting-api-2.0.1.jar
> [ERROR] urls[5] =
> file:/Users/sebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-6/doxia-sink-api-1.0-alpha-6.jar
> [ERROR] urls[6] =
> file:/Users/sebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
> [ERROR] urls[7] =
> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
> [ERROR] urls[8] =
> file:/Users/sebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
> [ERROR] urls[9] =
> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar
> [ERROR] Number of foreign imports: 1
> [ERROR] import: Entry[import  from realm ClassRealm[maven.api,
> parent: null]] [ERROR]
> 
> However, it does detect the error even if it does not provide any help
> in finding it.
> 
> On 8 January 2015 at 22:33, sebb <se...@gmail.com> wrote:
> > On 8 January 2015 at 21:21, Thomas Neidhart
> > <th...@gmail.com> wrote:
> >> On 01/08/2015 07:12 PM, sebb wrote:
> >>> On 8 January 2015 at 17:29, Benedikt Ritter
> >>> <be...@gmail.com> wrote:
> >>>>
> >>>>
> >>>> Send from my mobile device
> >>>>
> >>>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart
> >>>>> <th...@gmail.com>:
> >>>>>
> >>>>>> On 01/08/2015 05:24 PM, sebb wrote:
> >>>>>>> On 8 January 2015 at 16:13, Thomas Neidhart
> >>>>>>> <th...@gmail.com> wrote:
> >>>>>>>> On 01/08/2015 04:44 PM, sebb wrote:
> >>>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart
> >>>>>>>>> <th...@gmail.com> wrote: On 01/08/2015 12:25 PM,
> >>>>>>>>> sebb wrote: We certainly need to add animal-sniffer to our
> >>>>>>>>> release building process to detect such things.
> >>>>>>>>
> >>>>>>>> Does that actually detect such things?
> >>>>>>>
> >>>>>>> yes, that's the intention of this tool, and there is even a
> >>>>>>> maven plugin:
> >>>>>>>
> >>>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
> >>>>>>
> >>>>>> This suggests one has to create the API signature first.
> >>>>>> Which means one has to have access to the appropriate JDK
> >>>>>> anyway.
> >>>>>>
> >>>>>> But I now see that some sigs are already provided.
> >>>>>
> >>>>> here is an example of the usage:
> >>>>>
> >>>>>      <plugin>
> >>>>>        <groupId>org.codehaus.mojo</groupId>
> >>>>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
> >>>>>        <version>1.13</version>
> >>>>>        ...
> >>>>>        <configuration>
> >>>>>          ...
> >>>>>          <signature>
> >>>>>            <groupId>org.codehaus.mojo.signature</groupId>
> >>>>>            <artifactId>java15</artifactId>
> >>>>>            <version>1.0</version>
> >>>>>          </signature>
> >>>>>          ...
> >>>>>        </configuration>
> >>>>>        ...
> >>>>>      </plugin>
> >>>>>
> >>>>> signatures for the various jdk versions are already available.
> >>>>> We could add different profiles to the parent depending on the
> >>>>> maven.compiler.source property.
> >>>>>
> >>>
> >>> A pity that the signatures are not called java1.5 etc.
> >>> That would allow one to do:
> >>>
> >>> <artifactId>java${ maven.compiler.source}</artifactId>
> >>>
> >>> Maybe there is a way to drop the "." from the source property?
> >>
> >> its a pity maven does not support powerful property substitutions
> >> like in ksh for example:
> >>
> >> http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml
> >>
> >> Is there a pending feature request for this?
> >>
> >> What I have found is this:
> >>
> >> http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html
> >>
> >> by using the gmaven-plugin you can create new properties based on
> >> original ones using standard string manipulation functions.
> >
> > Looks like build helper can do it too:
> >
> > http://mojo.codehaus.org/build-helper-maven-plugin/regex-property-mojo.html
> >
> >>> If not, then profiles will work (but require more code).
> >>>
> >>>> Very nice!
> >>>>
> >>>>> Thomas

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
Just tried the animal sniffer on NET (Java 1.5) - I added a call to
new IOException(new Exception()) which is Java 1.6+

It does detect the reference, but the error message is pretty hopeless
- it does not show the class or even the jar in which it is found.
Instead there are a load of what appear to be debug lines:

[ERROR] Failed to execute goal
org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check
(checkAPIcompat) on project commons-net: Execution checkAPIcompat of
goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed:
An API incompatibility was encountered while executing
org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check:
java.lang.NoSuchMethodError:
java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:animal-sniffer-maven-plugin:1.13
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] =
file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer-maven-plugin/1.13/animal-sniffer-maven-plugin-1.13.jar
[ERROR] urls[1] =
file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer/1.13/animal-sniffer-1.13.jar
[ERROR] urls[2] =
file:/Users/sebb/.m2/repository/org/ow2/asm/asm-all/4.0/asm-all-4.0.jar
[ERROR] urls[3] =
file:/Users/sebb/.m2/repository/org/codehaus/mojo/java-boot-classpath-detector/1.13/java-boot-classpath-detector-1.13.jar
[ERROR] urls[4] =
file:/Users/sebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.1/maven-reporting-api-2.0.1.jar
[ERROR] urls[5] =
file:/Users/sebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-6/doxia-sink-api-1.0-alpha-6.jar
[ERROR] urls[6] =
file:/Users/sebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[7] =
file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[8] =
file:/Users/sebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
[ERROR] urls[9] =
file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]

However, it does detect the error even if it does not provide any help
in finding it.

On 8 January 2015 at 22:33, sebb <se...@gmail.com> wrote:
> On 8 January 2015 at 21:21, Thomas Neidhart <th...@gmail.com> wrote:
>> On 01/08/2015 07:12 PM, sebb wrote:
>>> On 8 January 2015 at 17:29, Benedikt Ritter <be...@gmail.com> wrote:
>>>>
>>>>
>>>> Send from my mobile device
>>>>
>>>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart <th...@gmail.com>:
>>>>>
>>>>>> On 01/08/2015 05:24 PM, sebb wrote:
>>>>>>> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>>>> On 01/08/2015 04:44 PM, sebb wrote:
>>>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>>>>>>> We certainly need to add animal-sniffer to our release building process
>>>>>>>>> to detect such things.
>>>>>>>>
>>>>>>>> Does that actually detect such things?
>>>>>>>
>>>>>>> yes, that's the intention of this tool, and there is even a maven plugin:
>>>>>>>
>>>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>>>>>>
>>>>>> This suggests one has to create the API signature first.
>>>>>> Which means one has to have access to the appropriate JDK anyway.
>>>>>>
>>>>>> But I now see that some sigs are already provided.
>>>>>
>>>>> here is an example of the usage:
>>>>>
>>>>>      <plugin>
>>>>>        <groupId>org.codehaus.mojo</groupId>
>>>>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>>>>>        <version>1.13</version>
>>>>>        ...
>>>>>        <configuration>
>>>>>          ...
>>>>>          <signature>
>>>>>            <groupId>org.codehaus.mojo.signature</groupId>
>>>>>            <artifactId>java15</artifactId>
>>>>>            <version>1.0</version>
>>>>>          </signature>
>>>>>          ...
>>>>>        </configuration>
>>>>>        ...
>>>>>      </plugin>
>>>>>
>>>>> signatures for the various jdk versions are already available. We could
>>>>> add different profiles to the parent depending on the
>>>>> maven.compiler.source property.
>>>>>
>>>
>>> A pity that the signatures are not called java1.5 etc.
>>> That would allow one to do:
>>>
>>> <artifactId>java${ maven.compiler.source}</artifactId>
>>>
>>> Maybe there is a way to drop the "." from the source property?
>>
>> its a pity maven does not support powerful property substitutions like
>> in ksh for example:
>>
>> http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml
>>
>> Is there a pending feature request for this?
>>
>> What I have found is this:
>>
>> http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html
>>
>> by using the gmaven-plugin you can create new properties based on
>> original ones using standard string manipulation functions.
>
> Looks like build helper can do it too:
>
> http://mojo.codehaus.org/build-helper-maven-plugin/regex-property-mojo.html
>
>>> If not, then profiles will work (but require more code).
>>>
>>>> Very nice!
>>>>
>>>>> Thomas
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 21:21, Thomas Neidhart <th...@gmail.com> wrote:
> On 01/08/2015 07:12 PM, sebb wrote:
>> On 8 January 2015 at 17:29, Benedikt Ritter <be...@gmail.com> wrote:
>>>
>>>
>>> Send from my mobile device
>>>
>>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart <th...@gmail.com>:
>>>>
>>>>> On 01/08/2015 05:24 PM, sebb wrote:
>>>>>> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>>> On 01/08/2015 04:44 PM, sebb wrote:
>>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>>>>>> We certainly need to add animal-sniffer to our release building process
>>>>>>>> to detect such things.
>>>>>>>
>>>>>>> Does that actually detect such things?
>>>>>>
>>>>>> yes, that's the intention of this tool, and there is even a maven plugin:
>>>>>>
>>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>>>>>
>>>>> This suggests one has to create the API signature first.
>>>>> Which means one has to have access to the appropriate JDK anyway.
>>>>>
>>>>> But I now see that some sigs are already provided.
>>>>
>>>> here is an example of the usage:
>>>>
>>>>      <plugin>
>>>>        <groupId>org.codehaus.mojo</groupId>
>>>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>>>>        <version>1.13</version>
>>>>        ...
>>>>        <configuration>
>>>>          ...
>>>>          <signature>
>>>>            <groupId>org.codehaus.mojo.signature</groupId>
>>>>            <artifactId>java15</artifactId>
>>>>            <version>1.0</version>
>>>>          </signature>
>>>>          ...
>>>>        </configuration>
>>>>        ...
>>>>      </plugin>
>>>>
>>>> signatures for the various jdk versions are already available. We could
>>>> add different profiles to the parent depending on the
>>>> maven.compiler.source property.
>>>>
>>
>> A pity that the signatures are not called java1.5 etc.
>> That would allow one to do:
>>
>> <artifactId>java${ maven.compiler.source}</artifactId>
>>
>> Maybe there is a way to drop the "." from the source property?
>
> its a pity maven does not support powerful property substitutions like
> in ksh for example:
>
> http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml
>
> Is there a pending feature request for this?
>
> What I have found is this:
>
> http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html
>
> by using the gmaven-plugin you can create new properties based on
> original ones using standard string manipulation functions.

Looks like build helper can do it too:

http://mojo.codehaus.org/build-helper-maven-plugin/regex-property-mojo.html

>> If not, then profiles will work (but require more code).
>>
>>> Very nice!
>>>
>>>> Thomas
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Thomas Neidhart <th...@gmail.com>.
On 01/08/2015 07:12 PM, sebb wrote:
> On 8 January 2015 at 17:29, Benedikt Ritter <be...@gmail.com> wrote:
>>
>>
>> Send from my mobile device
>>
>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart <th...@gmail.com>:
>>>
>>>> On 01/08/2015 05:24 PM, sebb wrote:
>>>>> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>> On 01/08/2015 04:44 PM, sebb wrote:
>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>>>>> We certainly need to add animal-sniffer to our release building process
>>>>>>> to detect such things.
>>>>>>
>>>>>> Does that actually detect such things?
>>>>>
>>>>> yes, that's the intention of this tool, and there is even a maven plugin:
>>>>>
>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>>>>
>>>> This suggests one has to create the API signature first.
>>>> Which means one has to have access to the appropriate JDK anyway.
>>>>
>>>> But I now see that some sigs are already provided.
>>>
>>> here is an example of the usage:
>>>
>>>      <plugin>
>>>        <groupId>org.codehaus.mojo</groupId>
>>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>>>        <version>1.13</version>
>>>        ...
>>>        <configuration>
>>>          ...
>>>          <signature>
>>>            <groupId>org.codehaus.mojo.signature</groupId>
>>>            <artifactId>java15</artifactId>
>>>            <version>1.0</version>
>>>          </signature>
>>>          ...
>>>        </configuration>
>>>        ...
>>>      </plugin>
>>>
>>> signatures for the various jdk versions are already available. We could
>>> add different profiles to the parent depending on the
>>> maven.compiler.source property.
>>>
> 
> A pity that the signatures are not called java1.5 etc.
> That would allow one to do:
> 
> <artifactId>java${ maven.compiler.source}</artifactId>
> 
> Maybe there is a way to drop the "." from the source property?

its a pity maven does not support powerful property substitutions like
in ksh for example:

http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml

Is there a pending feature request for this?

What I have found is this:

http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html

by using the gmaven-plugin you can create new properties based on
original ones using standard string manipulation functions.

> If not, then profiles will work (but require more code).
> 
>> Very nice!
>>
>>> Thomas
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 17:29, Benedikt Ritter <be...@gmail.com> wrote:
>
>
> Send from my mobile device
>
>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart <th...@gmail.com>:
>>
>>> On 01/08/2015 05:24 PM, sebb wrote:
>>>> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>>>>> On 01/08/2015 04:44 PM, sebb wrote:
>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>>>> We certainly need to add animal-sniffer to our release building process
>>>>>> to detect such things.
>>>>>
>>>>> Does that actually detect such things?
>>>>
>>>> yes, that's the intention of this tool, and there is even a maven plugin:
>>>>
>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>>>
>>> This suggests one has to create the API signature first.
>>> Which means one has to have access to the appropriate JDK anyway.
>>>
>>> But I now see that some sigs are already provided.
>>
>> here is an example of the usage:
>>
>>      <plugin>
>>        <groupId>org.codehaus.mojo</groupId>
>>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>>        <version>1.13</version>
>>        ...
>>        <configuration>
>>          ...
>>          <signature>
>>            <groupId>org.codehaus.mojo.signature</groupId>
>>            <artifactId>java15</artifactId>
>>            <version>1.0</version>
>>          </signature>
>>          ...
>>        </configuration>
>>        ...
>>      </plugin>
>>
>> signatures for the various jdk versions are already available. We could
>> add different profiles to the parent depending on the
>> maven.compiler.source property.
>>

A pity that the signatures are not called java1.5 etc.
That would allow one to do:

<artifactId>java${ maven.compiler.source}</artifactId>

Maybe there is a way to drop the "." from the source property?

If not, then profiles will work (but require more code).

> Very nice!
>
>> Thomas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Benedikt Ritter <be...@gmail.com>.

Send from my mobile device

> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart <th...@gmail.com>:
> 
>> On 01/08/2015 05:24 PM, sebb wrote:
>>> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>>>> On 01/08/2015 04:44 PM, sebb wrote:
>>>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>>> We certainly need to add animal-sniffer to our release building process
>>>>> to detect such things.
>>>> 
>>>> Does that actually detect such things?
>>> 
>>> yes, that's the intention of this tool, and there is even a maven plugin:
>>> 
>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
>> 
>> This suggests one has to create the API signature first.
>> Which means one has to have access to the appropriate JDK anyway.
>> 
>> But I now see that some sigs are already provided.
> 
> here is an example of the usage:
> 
>      <plugin>
>        <groupId>org.codehaus.mojo</groupId>
>        <artifactId>animal-sniffer-maven-plugin</artifactId>
>        <version>1.13</version>
>        ...
>        <configuration>
>          ...
>          <signature>
>            <groupId>org.codehaus.mojo.signature</groupId>
>            <artifactId>java15</artifactId>
>            <version>1.0</version>
>          </signature>
>          ...
>        </configuration>
>        ...
>      </plugin>
> 
> signatures for the various jdk versions are already available. We could
> add different profiles to the parent depending on the
> maven.compiler.source property.
> 

Very nice!

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

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


Re: [All] Animal sniffer (was: [math] Arrays.copyOf is Java 1.6+)

Posted by Thomas Neidhart <th...@gmail.com>.
On 01/08/2015 05:24 PM, sebb wrote:
> On 8 January 2015 at 16:13, Thomas Neidhart <th...@gmail.com> wrote:
>> On 01/08/2015 04:44 PM, sebb wrote:
>>> On 8 January 2015 at 11:45, Thomas Neidhart <th...@gmail.com> wrote:
>>>> On 01/08/2015 12:25 PM, sebb wrote:
>>>> We certainly need to add animal-sniffer to our release building process
>>>> to detect such things.
>>>
>>> Does that actually detect such things?
>>
>> yes, that's the intention of this tool, and there is even a maven plugin:
>>
>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html
> 
> This suggests one has to create the API signature first.
> Which means one has to have access to the appropriate JDK anyway.
> 
> But I now see that some sigs are already provided.

here is an example of the usage:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>1.13</version>
        ...
        <configuration>
          ...
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java15</artifactId>
            <version>1.0</version>
          </signature>
          ...
        </configuration>
        ...
      </plugin>

signatures for the various jdk versions are already available. We could
add different profiles to the parent depending on the
maven.compiler.source property.

Thomas

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