You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Svetlin Zarev <sv...@gmail.com> on 2017/07/04 07:38:21 UTC

AutoConfig - IllegalArgumentException: Comparison method violates its general contract!

Hi,

I found a nasty bug in AutoConfig:2077. The comparator does not work
correctly with java 8.
In older java versions (older than 8), Collections.sort() always creates an
array from the list content, while starting with java 8 -> it delegates to
the sort() method implemented in the concrete list implementation.  The
implementation of ArrayList, works directly on the inner array, which
violates the assumption of the current comparator that the arraylist'
sbacking array is not modified in real time.

I'll create a jira bug shortly and attach a reproducible test case.

Kind regards,
Svetlin

Re: AutoConfig - IllegalArgumentException: Comparison method violates its general contract!

Posted by Svetlin Zarev <sv...@gmail.com>.
Created TomEE-2085 and https://github.com/apache/tomee/pull/84

What do you think ?

2017-07-04 10:41 GMT+03:00 Romain Manni-Bucau <rm...@gmail.com>:

> +1, the indexOf was supposed to be done on getResourceIds(appResources,
> type, required) not the copy (which is sorted)
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-07-04 9:38 GMT+02:00 Svetlin Zarev <sv...@gmail.com>:
>
> > Hi,
> >
> > I found a nasty bug in AutoConfig:2077. The comparator does not work
> > correctly with java 8.
> > In older java versions (older than 8), Collections.sort() always creates
> an
> > array from the list content, while starting with java 8 -> it delegates
> to
> > the sort() method implemented in the concrete list implementation.  The
> > implementation of ArrayList, works directly on the inner array, which
> > violates the assumption of the current comparator that the arraylist'
> > sbacking array is not modified in real time.
> >
> > I'll create a jira bug shortly and attach a reproducible test case.
> >
> > Kind regards,
> > Svetlin
> >
>

Re: AutoConfig - IllegalArgumentException: Comparison method violates its general contract!

Posted by Romain Manni-Bucau <rm...@gmail.com>.
+1, the indexOf was supposed to be done on getResourceIds(appResources,
type, required) not the copy (which is sorted)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-07-04 9:38 GMT+02:00 Svetlin Zarev <sv...@gmail.com>:

> Hi,
>
> I found a nasty bug in AutoConfig:2077. The comparator does not work
> correctly with java 8.
> In older java versions (older than 8), Collections.sort() always creates an
> array from the list content, while starting with java 8 -> it delegates to
> the sort() method implemented in the concrete list implementation.  The
> implementation of ArrayList, works directly on the inner array, which
> violates the assumption of the current comparator that the arraylist'
> sbacking array is not modified in real time.
>
> I'll create a jira bug shortly and attach a reproducible test case.
>
> Kind regards,
> Svetlin
>