Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to identify a missing method (Binary Compatibility) in a JAR statically
    primarykey
    data
    text
    <p>I want to verify binary compatibility between 2 JARs. </p> <p>Following the suggestions in this <a href="https://stackoverflow.com/questions/972087/how-can-i-visualize-jar-not-plugin-dependencies/972199#972199">answer</a> I used <a href="http://www.jboss.org/tattletale" rel="nofollow noreferrer">jboss tattletale</a> but it can find only missing classes.</p> <p>How can I find if there are missing methods? Is it possible at all?</p> <p>E.g.</p> <p><strong>"Depends - on" class</strong> Foo depends on Bar (like many other middle class workers)</p> <pre><code>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 } } </code></pre> <p><strong>"Compile time" class</strong></p> <pre><code>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); } } </code></pre> <p>Now imagine an <strong>old</strong> Bar jar is accedently replacing the compiled time bar: </p> <p><strong>"Runtime time" class</strong></p> <pre><code>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); } } </code></pre> <p>Is there a way to identify the missing method without running it and getting a <code>NoSuchMethodError</code>?</p> <hr> <p><strong>Disclaimer</strong>: This is a major rephrasing of my own <a href="https://stackoverflow.com/questions/2037157/how-to-identify-a-potential-nosuchmethoderror-or-a-linkageerror-in-a-closed-jar">related question</a>, which is undeletable. I chose asking a new question because the rephrasing will render the current 2 answers as quite unrelated to the topic.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload