siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

False negatives in the presence of generics #264

Open mkr-plse opened 4 years ago

mkr-plse commented 4 years ago

See convertValue method in jackson databind (2.11) and convertValue in jackson databind-2.9.6.

The signature changed to public <T> T convertValue(Object fromValue, TypeReference<T> toValueTypeRef) from public <T> T convertValue(Object fromValue, TypeReference<?> toValueTypeRef). This is not reflected in the xml output when the two jars are compared. The output of the comparison (filtered to these methods) is as follows:

 <method binaryCompatible="true" changeStatus="UNCHANGED" name="convertValue" newLineNumber="4143" oldLineNumber="3678" sourceCompatible="true">
    <annotations/>
     <attributes>
        <attribute changeStatus="UNCHANGED" newValue="NON_SYNTHETIC" oldValue="NON_SYNTHETIC"/>
     </attributes>
     <compatibilityChanges/>
     <exceptions>
         <exception changeStatus="UNCHANGED" name="java.lang.IllegalArgumentException"/>
      </exceptions>
      <modifiers>
          <modifier changeStatus="UNCHANGED" newValue="NON_FINAL" oldValue="NON_FINAL"/>
          <modifier changeStatus="UNCHANGED" newValue="NON_STATIC" oldValue="NON_STATIC"/>
          <modifier changeStatus="UNCHANGED" newValue="PUBLIC" oldValue="PUBLIC"/>
          <modifier changeStatus="UNCHANGED" newValue="NON_ABSTRACT" oldValue="NON_ABSTRACT"/>
          <modifier changeStatus="UNCHANGED" newValue="NON_BRIDGE" oldValue="NON_BRIDGE"/>
          <modifier changeStatus="UNCHANGED" newValue="NON_SYNTHETIC" oldValue="NON_SYNTHETIC"/>
       </modifiers>
       <parameters>
            <parameter type="java.lang.Object"/>
            <parameter type="com.fasterxml.jackson.core.type.TypeReference"/>
        </parameters>
        <returnType changeStatus="UNCHANGED" newValue="java.lang.Object" oldValue="java.lang.Object"/>
 </method>

Is there any option to extract these differences too?

mkr-plse commented 4 years ago

javap -v ObjectMapper.class from the two versions mentioned above gives the following output for the convertValue method definitions:

public <T extends java.lang.Object> T convertValue(java.lang.Object, com.fasterxml.jackson.core.type.TypeReference<T>) throws java.lang.IllegalArgumentException; vs public <T extends java.lang.Object> T convertValue(java.lang.Object, com.fasterxml.jackson.core.type.TypeReference<?>) throws java.lang.IllegalArgumentException;