Resolve unnecessary else warnings

Signed-off-by: Titouan Vervack <titouan.vervack@sigasi.com>
This commit is contained in:
Titouan Vervack 2018-11-21 11:31:29 +01:00
parent a911cd76bb
commit 4aed451630
4 changed files with 47 additions and 41 deletions
org.eclipse.xtext/src/org/eclipse/xtext

View file

@ -216,9 +216,10 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
if (ruleName.startsWith("ML"))
return new MultilineCommentReplacer(comment, '*');
if (ruleName.startsWith("SL")) {
if (comment.getLineRegions().get(0).getIndentation().getLength() > 0)
if (comment.getLineRegions().get(0).getIndentation().getLength() > 0) {
return new SinglelineDocCommentReplacer(comment, "//");
else
}
return new SinglelineCodeCommentReplacer(comment, "//");
}
}

View file

@ -48,7 +48,8 @@ public abstract class AbstractHiddenRegion extends AbstractTextSegment implement
List<IHiddenRegionPart> parts = getParts();
if (parts.isEmpty()) {
return Collections.<ITextSegment>singletonList(this);
} else {
}
ITextSegment lastWhitespace = null;
List<ITextSegment> result = Lists.newArrayList();
for (IHiddenRegionPart part : parts) {
@ -72,12 +73,12 @@ public abstract class AbstractHiddenRegion extends AbstractTextSegment implement
}
}
}
if (lastWhitespace == null) {
result.add(new TextSegment(access, getEndOffset(), 0));
}
return ImmutableList.copyOf(result);
}
}
@Override
public boolean containsComment() {
@ -119,12 +120,13 @@ public abstract class AbstractHiddenRegion extends AbstractTextSegment implement
@Override
public int getOffset() {
if (hiddens.isEmpty()) {
if (previous != null)
if (previous != null) {
return previous.getOffset() + previous.getLength();
return 0;
} else {
return hiddens.get(0).getOffset();
}
return 0;
}
return hiddens.get(0).getOffset();
}
@Override

View file

@ -74,9 +74,9 @@ public abstract class AbstractFileSystemAccess implements IFileSystemAccess, IFi
public String apply(OutputConfiguration from) {
if (currentSource == null) {
return from.getOutputDirectory();
} else {
return from.getOutputDirectory(currentSource);
}
return from.getOutputDirectory(currentSource);
}
});
}
@ -119,9 +119,10 @@ public abstract class AbstractFileSystemAccess implements IFileSystemAccess, IFi
* @since 2.3
*/
protected CharSequence postProcess(String fileName, String outputConfiguration, CharSequence content) {
if (postProcessor != null)
if (postProcessor != null) {
return postProcessor.postProcess(getURI(fileName, outputConfiguration), content);
else
}
return content;
}
@ -131,7 +132,8 @@ public abstract class AbstractFileSystemAccess implements IFileSystemAccess, IFi
protected CharSequence postProcess(String fileName, String outputConfiguration, CharSequence content, String charset) {
if (postProcessor instanceof IFilePostProcessorExtension) {
return ((IFilePostProcessorExtension)postProcessor).postProcess(getURI(fileName, outputConfiguration), content, Charset.forName(charset));
} else
}
return postProcess(fileName, outputConfiguration, content);
}

View file

@ -79,7 +79,8 @@ public abstract class AbstractGenericModule implements Module {
properties.load(in);
Names.bindProperties(binder, properties);
return properties;
} else
}
return null;
} catch (IOException e) {
return null;