升级第三方jar时需要重新编译我的应用程序吗? [英] Do I have to recompile my application when I upgrade a third party jar?

查看:70
本文介绍了升级第三方jar时需要重新编译我的应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用某些第三方API的Java应用程序.由于存在各种修补程序,第三方jar文件的更改相当频繁,但是API本身并不经常更改.

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 change that often.

每次第三方jar更改时,我都必须重新编译我的应用程序吗?

Do I have to recompile my application every time the third party jar changes?

推荐答案

如果API发生更改,即使您不需要在源代码中进行任何更改,也应重新编译.如果API尚未更改,则无需重新编译.

If the API changes, you should recompile even if you don't need to make any changes in your source code. If the API hasn't changed, you don't need to recompile.

即使您不需要进行任何更改"的原因也在于,某些与源兼容的更改可能与二进制不兼容.例如,假设您当前正在通话:

The reason for the "even if you don't need to make any changes" is that some source-compatible changes may not be binary compatible. For instance, suppose you are currently calling:

public void foo(String x)

,在更高版本中,该名称更改为:

and in a later version this is changed to:

public void foo(Object x)

很显然,您的代码仍会编译,但是它将解析调用的方法将更改.

Obviously your code will still compile, but the method it resolves the call to will change.

当然,这有点极端.基本上,只要您知道API何时更改,就可以了.

This is a bit of an edge case, of course. Basically, so long as you know when the API changes, you should be okay.

这篇关于升级第三方jar时需要重新编译我的应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆