Skip to content

Commit

Permalink
#28 Infinite loop on documentation generation
Browse files Browse the repository at this point in the history
ObjectHelpers.getFileName(EObject) enters an infinite loop during
documentation generation.
Fixed by relying on a PlatformSwitch implementation returing calls to
the correct getFileName implementations depending on the type of the
element.

Change-Id: I0000000000000000000000000000000000000000
Signed-off-by: Arnaud Dieumegard <[email protected]>
  • Loading branch information
arnauddieumegard committed Dec 21, 2021
1 parent 949fd10 commit 3c0797c
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import org.polarsys.kitalpha.pdt.metamodel.model.platform.Extension;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.ExtensionPoint;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.Feature;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.Package;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.Plugin;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.Repository;
import org.polarsys.kitalpha.pdt.metamodel.model.platform.util.PlatformSwitch;

/**
*
Expand Down Expand Up @@ -113,10 +115,49 @@ public String getFileName(EclipseModel eObject) {

@Override
public String getFileName(EObject eObject) {
String result = getFileName(eObject);
FileNameSwitch fileNameSwitch = new FileNameSwitch();
String result = fileNameSwitch.doSwitch(eObject);
if (result == null) {
result = "Object not found";
}
return result;
}

class FileNameSwitch extends PlatformSwitch<String> {

@Override
public String casePlugin(Plugin object) {
return getFileName(object);
}

@Override
public String caseFeature(Feature object) {
return getFileName(object);
}

@Override
public String caseExtensionPoint(ExtensionPoint object) {
return getFileName(object);
}

@Override
public String caseExtension(Extension object) {
return getFileName(object);
}

@Override
public String casePackage(Package object) {
return getFileName(object);
}

@Override
public String caseRepository(Repository object) {
return getFileName(object);
}

@Override
public String caseEclipseModel(EclipseModel object) {
return getFileName(object);
}
}
}

0 comments on commit 3c0797c

Please sign in to comment.