客户端在更改Java接口后是否必须重新编译? [英] Do clients have to recompile after changing a Java interface?

查看:181
本文介绍了客户端在更改Java接口后是否必须重新编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在API中有一个包含单个方法的Java接口:

I have a Java interface in an API that contains a single method:

public interface MyInterface
{
    public void foo();
}

如果我向这个界面添加一个方法,如下所示:

If I add a method to that interface like this:

public interface MyInterface
{
    public void foo();
    public void bar();
}

使用API​​的客户端是否需要重新编译,或者他们是否可以使用新的JAR作为是因为我没有更改签名或现有方法或删除方法?

Do clients using the API need to recompile or can they use the new JAR as is because I didn't change the signature or an existing method or remove a method?

推荐答案

简答:可以使用没有重新编译的新API。

Short answer: The can use the new API without recompiling.

这是一个 LINK 可能有助于您了解Java如何运行字节码以及它如何进行动态链接。

Here's a LINK that might help you understand how Java runs bytecode and how it does dynamic linking.

这篇关于客户端在更改Java接口后是否必须重新编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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