Do I have to recompile my application when I upgrade a third party jar?

后端 未结 5 1120
深忆病人
深忆病人 2020-12-19 21:38

I have a java application that uses some third party API. The third party jar files change fairly frequently because of all kinds of patches, but the API itself does not cha

5条回答
  •  佛祖请我去吃肉
    2020-12-19 22:31

    Generally no, if the third party is well designed.

    However, in the (horrible) case where the API change a method signature, or remove a method / class, then you will need a modification and a recompilation of your own code.

    For example, if you have doSomething(String value); that became doSomething(int value); (or String doSomething() becoming int doSomething()) then the code of your application that calls doSomething(...) will not work anymore. So a modification of your code is required (and then a recompilation).

    However, you have to know that this case is extremely rare (except if you are using a pre-alpha dependency for example). Generally, to ensure backwards compatibility, APIs never remove classes or methods. The @Deprecated annotation is used instead, to force developer to use another method / class...

提交回复
热议问题