我想验证2个JAR之间的二进制兼容性。如何在JAR中静态识别缺少的方法(二进制兼容性)
按照answer的建议,我使用了jboss tattletale,但它只能找到缺失的类。
我怎样才能找到是否有缺失的方法?它有可能吗?
E.g.
“依赖 - 在”美孚取决于栏(像其他许多中产阶级工人)类
import org.overlyusedclassnames.Bar
public class Foo{
public void someMethod(){
Bar tender = new Bar();
tender.getJohnnyRedLabel();
tender.getJohnnyBlueLabel(); //this method is new in the Bar class
}
}
“编译时间” 类
package org.overlyusedclassnames;
/**
* @Since 1992
* Changes: added blue and gold Johnny Walker labels
*/
public class Bar {
public Drink getJohnnyRedLabel(){
return new JohnyWalkerFactory.get(RedLabel.class);
}
public Drink getJohnnyBlackLabel(){
return new JohnyWalkerFactory.get(BlackLabel.class);
}
public Drink getJohnnyGoldLabel(){
return new JohnyWalkerFactory.get(GoldLabel.class);
}
public Drink getJohnnyBlueLabel(){
return new JohnyWalkerFactory.get(BlueLabel.class);
}
}
现在想象一下,一个老酒吧瓶正在取代编译的时间条:
“运行时间”类
package org.overlyusedclassnames;
/**
* @Since 1909
* Changes: added red and black Johnny Walker labels
*/
public class Bar {
public Drink getJohnnyRedLabel(){
return new JohnyWalkerFactory.get(RedLabel.class);
}
public Drink getJohnnyBlackLabel(){
return new JohnyWalkerFactory.get(BlackLabel.class);
}
}
有没有一种方法,以确定失踪的法不运行它,并得到一个NoSuchMethodError
?
免责声明:这是我自己related question的重大的改写,这是不可删除。我选择提出一个新的问题,因为重新安排会使当前的2个答案与主题无关。
您可以对其他应该关闭的问题发表评论,并且超级用户可以为你关闭 – Yoni 2010-01-11 09:47:21
@Yoni - 已经做到了 – 2010-01-11 11:03:17
“没有运行”==“静态”(在问题标题中) – aponomarenko 2011-01-19 00:06:22