Don't fail the build on "elementNowParameterized" incompatibilities

At Don't break the build on source incompatibilities - #3 by acotiuga we discussed about not breaking in source incompatibilities.

Here’s an example of changes I did in xwiki-commons that raised it:

[ERROR] java.generics.elementNowParameterized: method <T> java.util.List<org.xwiki.component.descriptor.ComponentDescriptor<T>> org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class<? extends T>, java.lang.Class<?>): Element now defines formal type parameters.
[ERROR] java.generics.elementNowParameterized: method <T> java.util.List<org.xwiki.component.descriptor.ComponentDescriptor<T>> org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class<? extends T>, java.lang.reflect.Type): Element now defines formal type parameters.

Or in full XML syntax:

<item>
  <code>java.generics.elementNowParameterized</code>
  <old>method java.util.List&lt;org.xwiki.component.descriptor.ComponentDescriptor&gt; org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class&lt;?&gt;, java.lang.Class&lt;?&gt;)</old>
  <new>method &lt;T&gt; java.util.List&lt;org.xwiki.component.descriptor.ComponentDescriptor&lt;T&gt;&gt; org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class&lt;? extends T&gt;, java.lang.Class&lt;?&gt;)</new>
  <justification>ADD YOUR EXPLANATION FOR THE NECESSITY OF THIS CHANGE</justification>
</item><item>
  <code>java.generics.elementNowParameterized</code>
  <old>method java.util.List&lt;org.xwiki.component.descriptor.ComponentDescriptor&gt; org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class&lt;?&gt;, java.lang.reflect.Type)</old>
  <new>method &lt;T&gt; java.util.List&lt;org.xwiki.component.descriptor.ComponentDescriptor&lt;T&gt;&gt; org.xwiki.component.annotation.ComponentDescriptorFactory::createComponentDescriptors(java.lang.Class&lt;? extends T&gt;, java.lang.reflect.Type)</new>
  <justification>ADD YOUR EXPLANATION FOR THE NECESSITY OF THIS CHANGE</justification>
</item>

Basically it was missing the generic in the returned ComponentDescriptor and the relationship between the type of the returned ComponentDescriptor and the passed Class type.

WDYT?

Thanks

AFAICS on List of API Differences :: Revapi this is not a source incompatibility.

I guess my question back then was more whether we wanted to ignore “potentially breaking” semantic incompatibilities or not.

The doc says:

In and of itself, this is a compatible change but may cause semantic confusion if the user code compiled against the old API wasn’t honoring the new semantics introduced with the generic type parameter (e.g. old code was using raw List and the new version of the API parameterized the list to List<E> . The old code used to insert variety of types into the list but the new version of the API suggests it is not possible. Everything will still work correctly, but new user code might start assuming uniform types in the list).

I don’t have a strong opinion anymore so we could leave this for now. I’ll mark the thread as solved for now but feel free to let me know if you think we should add an ignore for this.