Skip to content

Commit

Permalink
[eclipse] Do not add "extends Object" into the class's code template.
Browse files Browse the repository at this point in the history
see #991

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Mar 30, 2020
1 parent 222ea1a commit f068c6e
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -21,6 +21,7 @@

package io.sarl.eclipse.wizards.elements.oop.newclass;

import com.google.common.base.Strings;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SubMonitor;
Expand Down Expand Up @@ -84,7 +85,13 @@ protected void generateTypeContent(ISourceAppender appender, IJvmTypeProvider ty
final ScriptSourceAppender scriptBuilder = this.codeBuilderFactory.buildScript(
getPackageFragment().getElementName(), typeProvider);
final ISarlClassBuilder clazz = scriptBuilder.addSarlClass(getTypeName());
clazz.setExtends(getSuperClass());
final String superType = getSuperClass();
// Do not add the "Object" type because it is the default.
if (Strings.isNullOrEmpty(superType) || Object.class.getName().equals(superType)) {
clazz.setExtends(null);
} else {
clazz.setExtends(superType);
}
for (final String type : getSuperInterfaces()) {
clazz.addImplements(type);
}
Expand All @@ -96,7 +103,7 @@ protected void generateTypeContent(ISourceAppender appender, IJvmTypeProvider ty
true,
() -> clazz.addSarlConstructor(),
name -> clazz.addOverrideSarlAction(name),
getSuperClass(),
superType,
getSuperInterfaces());
mon.worked(2);
scriptBuilder.build(appender);
Expand Down

0 comments on commit f068c6e

Please sign in to comment.