You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2023/08/25 05:01:56 UTC

Wicket 9.x versions are NOT backward compatible

Hello All,

I've just noticed subj during wicketstuff testing :(

In wicket 9.8.0+ we have added
org.apache.wicket.util.string.Strings.isEmpty(final String string)
Which is used by WicketFilter

So if (for whatever reason) we do have
wicket-core 9.8.0+
AND
wicket-util 9.7.0-

In class path WebApplication will fail to start with

java.lang.NoSuchMethodError: 'boolean
org.apache.wicket.util.string.Strings.isEmpty(java.lang.String)'
    at org.apache.wicket.protocol.http.WicketFilter.initIgnorePaths
(WicketFilter.java:824)
    at org.apache.wicket.protocol.http.WicketFilter.init (WicketFilter.java:384)
    at org.apache.wicket.protocol.http.WicketFilter.init (WicketFilter.java:365)
    at org.eclipse.jetty.servlet.FilterHolder.initialize (FilterHolder.java:140)
    at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0
(ServletHandler.java:750)


Not sure what can be done here :(

-- 
Best regards,
Maxim

Re: Wicket 9.x versions are NOT backward compatible

Posted by Richard Eckart de Castilho <re...@apache.org>.
> On 30. Aug 2023, at 17:20, Maxim Solodovnik <so...@gmail.com> wrote:
> 
> So we have conflict :(
> 
> Maybe it worth to add some redundancy to our dependency:tree and add
> `wicket-util` as direct dependency of `wicket-core`?

You can use the maven-dependency-plugin to scan Java classes in a module for
uses of classes from dependencies. It is a good practice to have explicit
dependencies in the POM for any classes that are used in the current module
instead of relying on transitive dependencies to provision a compatible version.

https://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html

Using the maven-dependency-plugin "analyze" mojo and sticking to its recommendations
usually helps avoiding this type of problem.

Note that the analysis is not perfect (it uses the class files, not the source files
as input, so some things it cannot detect which may lead to wrong recommendations)
- but it is quite a useful approximation.

Cheers,

-- Richard


Re: Wicket 9.x versions are NOT backward compatible

Posted by Richard Eckart de Castilho <re...@apache.org>.
> On 31. Aug 2023, at 09:06, Emond Papegaaij <em...@gmail.com> wrote:
> 
> We could publish a wicket-bom with all wicket modules to make it easier to
> manage all wicket modules at once.

That would be great :) +1

-- Richard



Re: Wicket 9.x versions are NOT backward compatible

Posted by Emond Papegaaij <em...@gmail.com>.
Op wo 30 aug 2023 om 17:20 schreef Maxim Solodovnik <so...@gmail.com>:

> Hello Emond,
>
> On Fri, 25 Aug 2023 at 14:38, Emond Papegaaij <em...@gmail.com>
> wrote:
> >
> > Op vr 25 aug 2023 om 07:02 schreef Maxim Solodovnik <
> solomax666@gmail.com>:
> >
> > > So if (for whatever reason) we do have
> > > wicket-core 9.8.0+ AND wicket-util 9.7.0-
> > >
> > > In class path WebApplication will fail to start with
> > > java.lang.NoSuchMethodError
> > >
> >
> > This is perfectly fine. Semver only is about Wicket as a whole, so you
> > should not be mixing different versions of parts of Wicket.
> >
> here is it's <partial> dependency tree:
>
> [INFO] +-
> de.agilecoders.wicket:wicket-bootstrap-extensions:jar:4.0.4:compile
> [INFO] |  +- de.agilecoders.wicket:jquery-selectors:jar:3.0.3:compile
> [INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile
> [INFO] |  |  \-
> com.fasterxml.jackson.core:jackson-databind:jar:2.15.1:compile
> [INFO] |  |     \-
> com.fasterxml.jackson.core:jackson-annotations:jar:2.15.1:compile
> [INFO] |  +- org.apache.wicket:wicket-extensions:jar:9.14.0:compile
> [INFO] |  +- org.apache.wicket:wicket-util:jar:9.3.0:compile
> [INFO] |  |  +- commons-fileupload:commons-fileupload:jar:1.4:compile
> [INFO] |  |  +- commons-io:commons-io:jar:2.12.0:compile
> [INFO] |  |  \- org.apache.commons:commons-collections4:jar:4.4:compile
>
> [INFO] \- org.apache.wicket:wicket-core:jar:9.14.0:compile
> [INFO]    +- com.github.openjson:openjson:jar:1.0.12:compile
> [INFO]    +- org.apache.wicket:wicket-request:jar:9.14.0:compile
> [INFO]    \- org.danekja:jdk-serializable-functional:jar:1.9.0:compile
>
> As you can see it directly depends on
> `org.apache.wicket:wicket-core:jar:9.14.0:compile`
> BUT it has no direct dependency on wicket-util :(
>
> The other (very much old) library
> wicket-bootstrap-extensions:jar:4.0.4 has it's dependency
>
> So we have conflict :(
>
> Maybe it worth to add some redundancy to our dependency:tree and add
> `wicket-util` as direct dependency of `wicket-core`?
>

wicket-core already has a dependency on wicket-util. As far as I know,
Maven does not give any guarantees on which version it resolves in
situations like this. This is why you should always use something like the
maven-enforcer to enforce dependency convergence. Actually, at Topicus, we
use even more strict rules: all dependencies, direct or indirect, should
have a managed version.

We could publish a wicket-bom with all wicket modules to make it easier to
manage all wicket modules at once.

Best regards,
Emond

Re: Wicket 9.x versions are NOT backward compatible

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello Emond,

On Fri, 25 Aug 2023 at 14:38, Emond Papegaaij <em...@gmail.com> wrote:
>
> Op vr 25 aug 2023 om 07:02 schreef Maxim Solodovnik <so...@gmail.com>:
>
> > So if (for whatever reason) we do have
> > wicket-core 9.8.0+ AND wicket-util 9.7.0-
> >
> > In class path WebApplication will fail to start with
> > java.lang.NoSuchMethodError
> >
>
> This is perfectly fine. Semver only is about Wicket as a whole, so you
> should not be mixing different versions of parts of Wicket.
>
> Also, the problem you are describing is about forward compatibility (if
> were to be an external piece of code using this new method): you are using
> code that is compiled against a newer version of Wicket and use it with an
> older version. Semver does guarantee forward compatibility on any level.
>
> Finally, in minor releases you are allowed to add new functionality, this
> is by definition not forward compatible. You cannot build something that
> uses this new functionality in a piece of code and then expect it to work
> with a version of Wicket where this functionality did not yet exist.

Let me explain the situation I found during debugging :)

I was testing org.wicketstuff:openlayers3-examples:war:9.14.0

here is it's <partial> dependency tree:

[INFO] +- de.agilecoders.wicket:wicket-bootstrap-extensions:jar:4.0.4:compile
[INFO] |  +- de.agilecoders.wicket:jquery-selectors:jar:3.0.3:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.15.1:compile
[INFO] |  |     \-
com.fasterxml.jackson.core:jackson-annotations:jar:2.15.1:compile
[INFO] |  +- org.apache.wicket:wicket-extensions:jar:9.14.0:compile
[INFO] |  +- org.apache.wicket:wicket-util:jar:9.3.0:compile
[INFO] |  |  +- commons-fileupload:commons-fileupload:jar:1.4:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.12.0:compile
[INFO] |  |  \- org.apache.commons:commons-collections4:jar:4.4:compile

[INFO] \- org.apache.wicket:wicket-core:jar:9.14.0:compile
[INFO]    +- com.github.openjson:openjson:jar:1.0.12:compile
[INFO]    +- org.apache.wicket:wicket-request:jar:9.14.0:compile
[INFO]    \- org.danekja:jdk-serializable-functional:jar:1.9.0:compile

As you can see it directly depends on
`org.apache.wicket:wicket-core:jar:9.14.0:compile`
BUT it has no direct dependency on wicket-util :(

The other (very much old) library
wicket-bootstrap-extensions:jar:4.0.4 has it's dependency

So we have conflict :(

Maybe it worth to add some redundancy to our dependency:tree and add
`wicket-util` as direct dependency of `wicket-core`?

>
> Best regards,
> Emond



-- 
Best regards,
Maxim

Re: Wicket 9.x versions are NOT backward compatible

Posted by Emond Papegaaij <em...@gmail.com>.
Op vr 25 aug 2023 om 07:02 schreef Maxim Solodovnik <so...@gmail.com>:

> So if (for whatever reason) we do have
> wicket-core 9.8.0+ AND wicket-util 9.7.0-
>
> In class path WebApplication will fail to start with
> java.lang.NoSuchMethodError
>

This is perfectly fine. Semver only is about Wicket as a whole, so you
should not be mixing different versions of parts of Wicket.

Also, the problem you are describing is about forward compatibility (if
were to be an external piece of code using this new method): you are using
code that is compiled against a newer version of Wicket and use it with an
older version. Semver does guarantee forward compatibility on any level.

Finally, in minor releases you are allowed to add new functionality, this
is by definition not forward compatible. You cannot build something that
uses this new functionality in a piece of code and then expect it to work
with a version of Wicket where this functionality did not yet exist.

Best regards,
Emond