japicmp.model.JApiBehavior Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of japicmp Show documentation
Show all versions of japicmp Show documentation
japicmp is a library that computes the differences between two
versions of a jar file/artifact in order to ease the API documentation for clients/customers.
The newest version!
package japicmp.model;
import japicmp.cmp.JarArchiveComparator;
import japicmp.cmp.JarArchiveComparatorOptions;
import japicmp.util.Optional;
import japicmp.util.*;
import javassist.CtBehavior;
import javassist.CtConstructor;
import javassist.CtMethod;
import javassist.Modifier;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ExceptionsAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlTransient;
import java.util.*;
public abstract class JApiBehavior implements JApiHasModifiers, JApiHasChangeStatus, JApiHasAccessModifier, JApiHasStaticModifier,
JApiHasFinalModifier, JApiHasAbstractModifier, JApiCompatibility, JApiHasAnnotations, JApiHasBridgeModifier,
JApiCanBeSynthetic, JApiHasLineNumber, JApiHasGenericTemplates {
protected final JApiClass jApiClass;
private final String name;
private final JarArchiveComparator jarArchiveComparator;
private final List parameters = new LinkedList<>();
private final List annotations = new LinkedList<>();
private final JApiModifier accessModifier;
private final JApiModifier finalModifier;
private final JApiModifier staticModifier;
private final JApiModifier abstractModifier;
private final JApiModifier bridgeModifier;
private final JApiModifier syntheticModifier;
private final JApiAttribute syntheticAttribute;
private final JApiModifier varargsModifier;
private final List exceptions;
protected JApiChangeStatus changeStatus;
private final Optional oldLineNumber;
private final Optional newLineNumber;
private final List compatibilityChanges = new ArrayList<>();
private final List genericTemplates;
public JApiBehavior(JApiClass jApiClass, String name, Optional extends CtBehavior> oldBehavior, Optional extends CtBehavior> newBehavior, JApiChangeStatus changeStatus, JarArchiveComparator jarArchiveComparator) {
this.jApiClass = jApiClass;
this.name = name;
this.jarArchiveComparator = jarArchiveComparator;
computeAnnotationChanges(annotations, oldBehavior, newBehavior, jarArchiveComparator.getJarArchiveComparatorOptions());
this.genericTemplates = computeGenericTemplateChanges(oldBehavior, newBehavior);
this.accessModifier = extractAccessModifier(oldBehavior, newBehavior);
this.finalModifier = extractFinalModifier(oldBehavior, newBehavior);
this.staticModifier = extractStaticModifier(oldBehavior, newBehavior);
this.abstractModifier = extractAbstractModifier(oldBehavior, newBehavior);
this.bridgeModifier = extractBridgeModifier(oldBehavior, newBehavior);
this.syntheticModifier = extractSyntheticModifier(oldBehavior, newBehavior);
this.syntheticAttribute = extractSyntheticAttribute(oldBehavior, newBehavior);
this.varargsModifier = extractVarargsModifier(oldBehavior, newBehavior);
this.exceptions = computeExceptionChanges(oldBehavior, newBehavior);
this.changeStatus = evaluateChangeStatus(changeStatus);
this.oldLineNumber = getLineNumber(oldBehavior);
this.newLineNumber = getLineNumber(newBehavior);
}
public void setChangeStatus(JApiChangeStatus changeStatus) {
this.changeStatus = changeStatus;
}
private List computeGenericTemplateChanges(Optional extends CtBehavior> oldBehavior, Optional extends CtBehavior> newBehavior) {
return GenericTemplateHelper.computeGenericTemplateChanges(new GenericTemplateHelper.SignatureParserCallback() {
@Override
public boolean isOldAndNewPresent() {
return oldBehavior.isPresent() && newBehavior.isPresent();
}
@Override
public boolean isOldPresent() {
return oldBehavior.isPresent();
}
@Override
public boolean isNewPresent() {
return newBehavior.isPresent();
}
@Override
public SignatureParser oldSignatureParser() {
SignatureParser signatureParser = new SignatureParser();
signatureParser.parse(oldBehavior.get().getGenericSignature());
return signatureParser;
}
@Override
public SignatureParser newSignatureParser() {
SignatureParser signatureParser = new SignatureParser();
signatureParser.parse(newBehavior.get().getGenericSignature());
return signatureParser;
}
});
}
private List computeExceptionChanges(Optional extends CtBehavior> oldMethodOptional, Optional extends CtBehavior> newMethodOptional) {
List exceptionList = new ArrayList<>();
if (oldMethodOptional.isPresent() && newMethodOptional.isPresent()) {
List oldExceptions = extractExceptions(oldMethodOptional);
List newExceptions = extractExceptions(newMethodOptional);
for (String oldException : oldExceptions) {
if (newExceptions.contains(oldException)) {
exceptionList.add(new JApiException(jarArchiveComparator, oldException, jarArchiveComparator.loadClass(JarArchiveComparator.ArchiveType.NEW, oldException), JApiChangeStatus.UNCHANGED));
newExceptions.remove(oldException);
} else {
exceptionList.add(new JApiException(jarArchiveComparator, oldException, jarArchiveComparator.loadClass(JarArchiveComparator.ArchiveType.OLD, oldException), JApiChangeStatus.REMOVED));
}
}
for (String newException : newExceptions) {
exceptionList.add(new JApiException(jarArchiveComparator, newException, jarArchiveComparator.loadClass(JarArchiveComparator.ArchiveType.NEW, newException), JApiChangeStatus.NEW));
}
} else if (oldMethodOptional.isPresent()) {
List exceptions = extractExceptions(oldMethodOptional);
for (String exception : exceptions) {
exceptionList.add(new JApiException(jarArchiveComparator, exception, jarArchiveComparator.loadClass(JarArchiveComparator.ArchiveType.OLD, exception), JApiChangeStatus.REMOVED));
}
} else if (newMethodOptional.isPresent()) {
List exceptions = extractExceptions(newMethodOptional);
for (String exception : exceptions) {
exceptionList.add(new JApiException(jarArchiveComparator, exception, jarArchiveComparator.loadClass(JarArchiveComparator.ArchiveType.NEW, exception), JApiChangeStatus.NEW));
}
}
return exceptionList;
}
private List extractExceptions(Optional extends CtBehavior> methodOptional) {
if (methodOptional.isPresent()) {
ExceptionsAttribute exceptionsAttribute = null;
try {
exceptionsAttribute = methodOptional.get().getMethodInfo().getExceptionsAttribute();
} catch (NullPointerException ex) {
return Collections.emptyList();
}
String[] exceptions;
if (exceptionsAttribute != null && exceptionsAttribute.getExceptions() != null) {
exceptions = exceptionsAttribute.getExceptions();
} else {
exceptions = new String[0];
}
List list = new ArrayList<>(exceptions.length);
Collections.addAll(list, exceptions);
return list;
} else {
return Collections.emptyList();
}
}
private Optional getLineNumber(Optional extends CtBehavior> methodOptional) {
Optional lineNumberOptional = Optional.absent();
if (methodOptional.isPresent()) {
CtBehavior ctMethod = methodOptional.get();
int lineNumber = ctMethod.getMethodInfo().getLineNumber(0);
if (lineNumber >= 0) {
lineNumberOptional = Optional.of(lineNumber);
}
}
return lineNumberOptional;
}
@SuppressWarnings("unchecked")
private void computeAnnotationChanges(List annotations, Optional extends CtBehavior> oldBehavior, Optional extends CtBehavior> newBehavior, JarArchiveComparatorOptions options) {
if (oldBehavior.isPresent()) {
CtBehavior ctBehavior = oldBehavior.get();
if (ctBehavior instanceof CtMethod) {
computeAnnotationChangesMethod(annotations, (Optional) oldBehavior, (Optional) newBehavior, options);
} else if (ctBehavior instanceof CtConstructor) {
computeAnnotationChangesConstructor(annotations, (Optional) oldBehavior, (Optional) newBehavior, options);
}
} else if (newBehavior.isPresent()) {
CtBehavior ctBehavior = newBehavior.get();
if (ctBehavior instanceof CtMethod) {
computeAnnotationChangesMethod(annotations, (Optional) oldBehavior, (Optional) newBehavior, options);
} else if (ctBehavior instanceof CtConstructor) {
computeAnnotationChangesConstructor(annotations, (Optional) oldBehavior, (Optional) newBehavior, options);
}
}
}
private void computeAnnotationChangesMethod(List annotations, Optional oldBehavior, Optional newBehavior, JarArchiveComparatorOptions options) {
AnnotationHelper.computeAnnotationChanges(annotations, oldBehavior, newBehavior, options, new AnnotationHelper.AnnotationsAttributeCallback() {
@Override
public AnnotationsAttribute getAnnotationsAttribute(CtMethod method) {
return (AnnotationsAttribute) method.getMethodInfo().getAttribute(AnnotationsAttribute.visibleTag);
}
});
}
private void computeAnnotationChangesConstructor(List annotations, Optional oldBehavior, Optional newBehavior, JarArchiveComparatorOptions options) {
AnnotationHelper.computeAnnotationChanges(annotations, oldBehavior, newBehavior, options, new AnnotationHelper.AnnotationsAttributeCallback() {
@Override
public AnnotationsAttribute getAnnotationsAttribute(CtConstructor method) {
return (AnnotationsAttribute) method.getMethodInfo().getAttribute(AnnotationsAttribute.visibleTag);
}
});
}
private JApiChangeStatus evaluateChangeStatus(JApiChangeStatus changeStatus) {
if (changeStatus == JApiChangeStatus.UNCHANGED) {
if (this.staticModifier.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
if (this.finalModifier.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
if (this.accessModifier.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
if (this.abstractModifier.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
if (this.syntheticAttribute.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
if (this.varargsModifier.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
for (JApiException jApiException : exceptions) {
if (jApiException.getChangeStatus() == JApiChangeStatus.NEW || jApiException.getChangeStatus() == JApiChangeStatus.REMOVED) {
changeStatus = JApiChangeStatus.MODIFIED;
}
}
}
return changeStatus;
}
protected JApiAttribute extractSyntheticAttribute(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
JApiAttribute jApiAttribute = new JApiAttribute<>(JApiChangeStatus.UNCHANGED, Optional.of(SyntheticAttribute.SYNTHETIC), Optional.of(SyntheticAttribute.SYNTHETIC));
if (oldBehaviorOptional.isPresent() && newBehaviorOptional.isPresent()) {
CtBehavior oldBehavior = oldBehaviorOptional.get();
CtBehavior newBehavior = newBehaviorOptional.get();
byte[] attributeOldBehavior = oldBehavior.getAttribute(Constants.JAVA_CONSTPOOL_ATTRIBUTE_SYNTHETIC);
byte[] attributeNewBehavior = newBehavior.getAttribute(Constants.JAVA_CONSTPOOL_ATTRIBUTE_SYNTHETIC);
if (attributeOldBehavior != null && attributeNewBehavior != null) {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.UNCHANGED, Optional.of(SyntheticAttribute.SYNTHETIC), Optional.of(SyntheticAttribute.SYNTHETIC));
} else if (attributeOldBehavior != null) {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.MODIFIED, Optional.of(SyntheticAttribute.SYNTHETIC), Optional.of(SyntheticAttribute.NON_SYNTHETIC));
} else if (attributeNewBehavior != null) {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.MODIFIED, Optional.of(SyntheticAttribute.NON_SYNTHETIC), Optional.of(SyntheticAttribute.SYNTHETIC));
} else {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.UNCHANGED, Optional.of(SyntheticAttribute.NON_SYNTHETIC), Optional.of(SyntheticAttribute.NON_SYNTHETIC));
}
} else {
if (oldBehaviorOptional.isPresent()) {
CtBehavior ctBehavior = oldBehaviorOptional.get();
byte[] attribute = ctBehavior.getAttribute(Constants.JAVA_CONSTPOOL_ATTRIBUTE_SYNTHETIC);
if (attribute != null) {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.REMOVED, Optional.of(SyntheticAttribute.SYNTHETIC), Optional.absent());
} else {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.REMOVED, Optional.of(SyntheticAttribute.NON_SYNTHETIC), Optional.absent());
}
}
if (newBehaviorOptional.isPresent()) {
CtBehavior ctBehavior = newBehaviorOptional.get();
byte[] attribute = ctBehavior.getAttribute(Constants.JAVA_CONSTPOOL_ATTRIBUTE_SYNTHETIC);
if (attribute != null) {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.NEW, Optional.absent(), Optional.of(SyntheticAttribute.SYNTHETIC));
} else {
jApiAttribute = new JApiAttribute<>(JApiChangeStatus.NEW, Optional.absent(), Optional.of(SyntheticAttribute.NON_SYNTHETIC));
}
}
}
return jApiAttribute;
}
public boolean hasSameParameter(JApiMethod method) {
boolean hasSameParameter = true;
List parameters1 = getParameters();
List parameters2 = method.getParameters();
if (parameters1.size() != parameters2.size()) {
hasSameParameter = false;
}
if (hasSameParameter) {
for (int i = 0; i < parameters1.size(); i++) {
if (!parameters1.get(i).getType().equals(parameters2.get(i).getType())) {
hasSameParameter = false;
}
}
}
return hasSameParameter;
}
private JApiModifier extractStaticModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public StaticModifier getModifierForOld(CtBehavior oldBehavior) {
return Modifier.isStatic(oldBehavior.getModifiers()) ? StaticModifier.STATIC : StaticModifier.NON_STATIC;
}
@Override
public StaticModifier getModifierForNew(CtBehavior newBehavior) {
return Modifier.isStatic(newBehavior.getModifiers()) ? StaticModifier.STATIC : StaticModifier.NON_STATIC;
}
});
}
private JApiModifier extractFinalModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public FinalModifier getModifierForOld(CtBehavior oldBehavior) {
return Modifier.isFinal(oldBehavior.getModifiers()) ? FinalModifier.FINAL : FinalModifier.NON_FINAL;
}
@Override
public FinalModifier getModifierForNew(CtBehavior newBehavior) {
return Modifier.isFinal(newBehavior.getModifiers()) ? FinalModifier.FINAL : FinalModifier.NON_FINAL;
}
});
}
private JApiModifier extractAccessModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public AccessModifier getModifierForOld(CtBehavior oldBehavior) {
return ModifierHelper.translateToModifierLevel(oldBehavior.getModifiers());
}
@Override
public AccessModifier getModifierForNew(CtBehavior newBehavior) {
return ModifierHelper.translateToModifierLevel(newBehavior.getModifiers());
}
});
}
private JApiModifier extractAbstractModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public AbstractModifier getModifierForOld(CtBehavior oldBehavior) {
return Modifier.isAbstract(oldBehavior.getModifiers()) ? AbstractModifier.ABSTRACT : AbstractModifier.NON_ABSTRACT;
}
@Override
public AbstractModifier getModifierForNew(CtBehavior newBehavior) {
return Modifier.isAbstract(newBehavior.getModifiers()) ? AbstractModifier.ABSTRACT : AbstractModifier.NON_ABSTRACT;
}
});
}
private JApiModifier extractBridgeModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public BridgeModifier getModifierForOld(CtBehavior oldBehavior) {
return ModifierHelper.isBridge(oldBehavior.getModifiers()) ? BridgeModifier.BRIDGE : BridgeModifier.NON_BRIDGE;
}
@Override
public BridgeModifier getModifierForNew(CtBehavior newBehavior) {
return ModifierHelper.isBridge(newBehavior.getModifiers()) ? BridgeModifier.BRIDGE : BridgeModifier.NON_BRIDGE;
}
});
}
private JApiModifier extractSyntheticModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
@Override
public SyntheticModifier getModifierForOld(CtBehavior oldBehavior) {
return ModifierHelper.isSynthetic(oldBehavior.getModifiers()) ? SyntheticModifier.SYNTHETIC : SyntheticModifier.NON_SYNTHETIC;
}
@Override
public SyntheticModifier getModifierForNew(CtBehavior newBehavior) {
return ModifierHelper.isSynthetic(newBehavior.getModifiers()) ? SyntheticModifier.SYNTHETIC : SyntheticModifier.NON_SYNTHETIC;
}
});
}
private JApiModifier extractVarargsModifier(Optional extends CtBehavior> oldBehaviorOptional, Optional extends CtBehavior> newBehaviorOptional) {
return ModifierHelper.extractModifierFromBehavior(oldBehaviorOptional, newBehaviorOptional, new ModifierHelper.ExtractModifierFromBehaviorCallback() {
private VarargsModifier getModifier(CtBehavior behavior) {
return Modifier.isVarArgs(behavior.getModifiers()) ? VarargsModifier.VARARGS : VarargsModifier.NON_VARARGS;
}
@Override
public VarargsModifier getModifierForOld(CtBehavior oldBehavior) {
return getModifier(oldBehavior);
}
@Override
public VarargsModifier getModifierForNew(CtBehavior newBehavior) {
return getModifier(newBehavior);
}
});
}
@Override
@XmlElementWrapper(name = "modifiers")
@XmlElement(name = "modifier")
public List extends JApiModifier extends Enum extends Enum>>>> getModifiers() {
return Arrays.asList(this.finalModifier, this.staticModifier, this.accessModifier, this.abstractModifier, this.bridgeModifier, this.syntheticModifier);
}
@XmlAttribute
public String getName() {
return name;
}
@XmlAttribute
@Override
public JApiChangeStatus getChangeStatus() {
return changeStatus;
}
@XmlElementWrapper(name = "parameters")
@XmlElement(name = "parameter")
public List getParameters() {
return parameters;
}
public void addParameter(JApiParameter jApiParameter) {
parameters.add(jApiParameter);
}
@XmlTransient
@Override
public JApiModifier getAccessModifier() {
return accessModifier;
}
@XmlTransient
@Override
public JApiModifier getFinalModifier() {
return finalModifier;
}
@XmlTransient
@Override
public JApiModifier getStaticModifier() {
return staticModifier;
}
@Override
public JApiModifier getAbstractModifier() {
return this.abstractModifier;
}
@XmlElementWrapper(name = "attributes")
@XmlElement(name = "attribute")
public List>> getAttributes() {
List>> list = new ArrayList<>();
list.add(this.syntheticAttribute);
return list;
}
@XmlTransient
@Override
public JApiModifier getBridgeModifier() {
return this.bridgeModifier;
}
@XmlTransient
@Override
public JApiModifier getSyntheticModifier() {
return this.syntheticModifier;
}
@XmlTransient
@Override
public JApiAttribute getSyntheticAttribute() {
return syntheticAttribute;
}
@XmlTransient
public JApiModifier getVarargsModifier() {
return varargsModifier;
}
@Override
@XmlAttribute
public boolean isBinaryCompatible() {
boolean binaryCompatible = true;
for (JApiCompatibilityChange compatibilityChange : compatibilityChanges) {
if (!compatibilityChange.isBinaryCompatible()) {
binaryCompatible = false;
break;
}
}
return binaryCompatible;
}
@Override
@XmlAttribute
public boolean isSourceCompatible() {
boolean sourceCompatible = true;
for (JApiCompatibilityChange compatibilityChange : compatibilityChanges) {
if (!compatibilityChange.isSourceCompatible()) {
sourceCompatible = false;
break;
}
}
for (JApiParameter jApiParameter : getParameters()) {
for (JApiCompatibilityChange compatibilityChange : jApiParameter.getCompatibilityChanges()) {
if (!compatibilityChange.isSourceCompatible()) {
sourceCompatible = false;
break;
}
}
}
return sourceCompatible;
}
@XmlElementWrapper(name = "compatibilityChanges")
@XmlElement(name = "compatibilityChange")
@Override
public List getCompatibilityChanges() {
return compatibilityChanges;
}
@XmlElementWrapper(name = "annotations")
@XmlElement(name = "annotation")
@Override
public List getAnnotations() {
return annotations;
}
@Override
public Optional getOldLineNumber() {
return this.oldLineNumber;
}
@Override
public Optional geNewLineNumber() {
return this.newLineNumber;
}
@XmlAttribute(name = "oldLineNumber")
public String getOldLineNumberAsString() {
return OptionalHelper.optionalToString(this.oldLineNumber);
}
@XmlAttribute(name = "newLineNumber")
public String getNewLineNumberAsString() {
return OptionalHelper.optionalToString(this.newLineNumber);
}
@XmlElementWrapper(name = "exceptions")
@XmlElement(name = "exception")
public List getExceptions() {
return exceptions;
}
@XmlTransient
public JApiClass getjApiClass() {
return this.jApiClass;
}
@XmlElementWrapper(name = "genericTemplates")
@XmlElement(name = "genericTemplate")
public List getGenericTemplates() {
return genericTemplates;
}
public abstract void enhanceGenericTypeToParameters();
protected void enhanceGenericTypeToParameters(JApiClass jApiClass, Optional extends CtBehavior> oldBehavior, Optional extends CtBehavior> newBehavior) {
if (oldBehavior.isPresent() && oldBehavior.get().getGenericSignature() != null) {
String genericSignature = oldBehavior.get().getGenericSignature();
SignatureParser signatureParser = new SignatureParser();
signatureParser.parse(genericSignature);
List jApiParameters = signatureParser.getJApiParameters(jApiClass, SignatureParser.DiffType.OLD_PARAMS);
if (jApiParameters.size() == this.getParameters().size()) {
for (int i = 0; i < getParameters().size(); i++) {
getParameters().get(i).setTemplateName(jApiParameters.get(i).getTemplateNameOptional());
getParameters().get(i).getOldGenericTypes().clear();
getParameters().get(i).getOldGenericTypes().addAll(jApiParameters.get(i).getOldGenericTypes());
}
}
}
if (newBehavior.isPresent() && newBehavior.get().getGenericSignature() != null) {
String genericSignature = newBehavior.get().getGenericSignature();
SignatureParser signatureParser = new SignatureParser();
signatureParser.parse(genericSignature);
List jApiParameters = signatureParser.getJApiParameters(jApiClass, SignatureParser.DiffType.NEW_PARAMS);
if (jApiParameters.size() == this.getParameters().size()) {
for (int i = 0; i < getParameters().size(); i++) {
getParameters().get(i).setTemplateName(jApiParameters.get(i).getTemplateNameOptional());
getParameters().get(i).getNewGenericTypes().clear();
getParameters().get(i).getNewGenericTypes().addAll(jApiParameters.get(i).getNewGenericTypes());
}
}
}
}
}