Source:
<code>private Set<SpecificHaxeClassReference> getCompatibleTypesInternal() { final Stack<HaxeClass> stack = processedElements.get(); final HaxeClassModel model = getHaxeClassModel(); final HaxeGenericResolver genericResolver = getGenericResolver(); final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (model == null) return list; if (stack.contains(model.haxeClass)) return list; stack.push(model.haxeClass); if (!model.isAbstract()) { if (model.haxeClass instanceof HaxeTypedefDeclaration) { SpecificHaxeClassReference type = ((AbstractHaxeTypeDefImpl)model.haxeClass).getTargetClass(genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypes()); <START> } <END> } else for (HaxeType extendsType : model.haxeClass.getHaxeExtendsList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { if (model.isInterface()) list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } final List<HaxeClassReferenceModel> interfaces = model.getImplementingInterfaces(); for (HaxeClassReferenceModel interfaceReference : interfaces) { SpecificHaxeClassReference type = propagateGenericsToType(interfaceReference.getPsi(), genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } else { for (HaxeType extendsType : model.getAbstractFromList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } return list; }</code><technical_language>Lines 221 225 duplicated 4 times. more DRY</technical_language>

Target:
private Set<SpecificHaxeClassReference> getCompatibleTypesInternal() { final Stack<HaxeClass> stack = processedElements.get(); final HaxeClassModel model = getHaxeClassModel(); final HaxeGenericResolver genericResolver = getGenericResolver(); final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (model == null) return list; if (stack.contains(model.haxeClass)) return list; stack.push(model.haxeClass); if (!model.isAbstract()) { if (model.haxeClass instanceof HaxeTypedefDeclaration) { SpecificHaxeClassReference type = ((AbstractHaxeTypeDefImpl)model.haxeClass).getTargetClass(genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } else for (HaxeType extendsType : model.haxeClass.getHaxeExtendsList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { if (model.isInterface()) list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } final List<HaxeClassReferenceModel> interfaces = model.getImplementingInterfaces(); for (HaxeClassReferenceModel interfaceReference : interfaces) { SpecificHaxeClassReference type = propagateGenericsToType(interfaceReference.getPsi(), genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } else { for (HaxeType extendsType : model.getAbstractFromList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } return list; }