Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: code inspection - Code style issues: Unnecessary semicolon #2226

Merged
merged 21 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
47f60e7
refactor: move Main to testclasses - second try
zielint0 Jul 12, 2018
bd7ef7a
Revert "refactor: move Main to testclasses - second try"
zielint0 Jul 12, 2018
41fd248
Merge branch 'master' of https://github.com/INRIA/spoon
zielint0 Jul 13, 2018
d7220ba
Merge branch 'master' of https://github.com/INRIA/spoon
zielint0 Jul 15, 2018
527d233
refactor: remove unnecessary semicolons from AbstractRoleHandler.java
zielint0 Jul 15, 2018
abe0ee9
refactor: remove unnecessary semicolons from CompilationUnitImpl.java
zielint0 Jul 15, 2018
6ed40c6
refactor: remove unnecessary semicolons from CtJavaDocImpl.java
zielint0 Jul 15, 2018
fb6ef5b
refactor: remove unnecessary semicolons from CtPackageImpl.java
zielint0 Jul 15, 2018
dd5df62
refactor: remove unnecessary semicolons from FactoryCompilerConfig.java
zielint0 Jul 15, 2018
4d663ad
refactor: remove unnecessary semicolons from HashcodeVisitor.java
zielint0 Jul 15, 2018
44a62f9
refactor: remove unnecessary semicolons from JDTBasedSpoonCompiler.java
zielint0 Jul 15, 2018
13e4945
refactor: remove unnecessary semicolons from ListHandler.java
zielint0 Jul 15, 2018
6a7019e
refactor: remove unnecessary semicolons from MapHandler.java
zielint0 Jul 15, 2018
997aad1
refactor: remove unnecessary semicolons from PatternParameterConfigur…
zielint0 Jul 15, 2018
1530d25
refactor: remove unnecessary semicolons from ListHandler.java
zielint0 Jul 15, 2018
fa2be31
refactor: remove unnecessary semicolons from PatternPrinter.java
zielint0 Jul 15, 2018
09073a5
refactor: remove unnecessary semicolons from SetHandler.java
zielint0 Jul 15, 2018
104611c
refactor: remove unnecessary semicolons from TemplateBuilder.java
zielint0 Jul 15, 2018
01a5099
refactor: remove unnecessary semicolons from ZipFolder.java
zielint0 Jul 15, 2018
ecfcefc
refactor: remove unnecessary semicolons ResultHolder.java
zielint0 Jul 15, 2018
1db02c6
refactor: remove unnecessary semicolons SingleHandler.java
zielint0 Jul 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/spoon/pattern/PatternParameterConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ protected void visitStringAttribute(RoleHandler roleHandler, CtElement element,
});

}
};
}
}.scan(patternBuilder.getPatternModel());
return this;
}
Expand Down Expand Up @@ -656,7 +656,7 @@ protected void visitStringAttribute(RoleHandler roleHandler, CtElement element,
return oldAttrNode;
});
}
};
}
}.scan(patternBuilder.getPatternModel());
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spoon/pattern/internal/PatternPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private boolean appendPathIn(StringBuilder sb, CtElement element, CtElement pare
return true;
}
return false;
};
}

static String getElementTypeName(CtElement element) {
String name = element.getClass().getSimpleName();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spoon/pattern/internal/ResultHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public T getResult() {
@Override
public void mapEachResult(Function<T, T> consumer) {
result = consumer.apply(result);
};
}

@Override
public List<T> getResults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected V castItemValue(Object value) {

public <W, X> void setValue(W element, X value) {
throw new SpoonException("Setting of CtRole." + role.name() + " is not supported for " + element.getClass().getSimpleName());
};
}

@Override
public Class<?> getValueClass() {
Expand All @@ -90,17 +90,17 @@ public Class<?> getValueClass() {
@Override
public <W, X> List<X> asList(W element) {
throw new SpoonException("The value of CtRole." + getRole().name() + " cannot be adapted to List for " + element.getClass().getSimpleName());
};
}

@Override
public <W, X> Set<X> asSet(W element) {
throw new SpoonException("The value of CtRole." + getRole().name() + " cannot be adapted to Set for " + element.getClass().getSimpleName());
};
}

@Override
public <W, X> Map<String, X> asMap(W element) {
throw new SpoonException("The value of CtRole." + getRole().name() + " cannot be adapted to Map for " + element.getClass().getSimpleName());
};
}

@Override
public String toString() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/spoon/reflect/meta/impl/ListHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected List<V> castValue(Object value) {
@Override
public <W, X> java.util.Collection<X> asCollection(W element) {
return asList(element);
};
}

@Override
public <W, X> java.util.List<X> asList(W e) {
Expand Down Expand Up @@ -138,5 +138,5 @@ protected int size(T element) {

protected Iterator<V> iterator(T element) {
return this.<T, List<V>>getValue(element).iterator();
};
}
}
2 changes: 1 addition & 1 deletion src/main/java/spoon/reflect/meta/impl/MapHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected Map<String, V> castValue(Object value) {
@SuppressWarnings({ "unchecked", "rawtypes" })
public <W, X> java.util.Collection<X> asCollection(W element) {
return (Collection) asMap(element).values();
};
}

@Override
public <W, X> Map<String, X> asMap(W e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spoon/reflect/meta/impl/SetHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected Set<V> castValue(Object value) {
@Override
public <W, X> Collection<X> asCollection(W element) {
return asSet(element);
};
}

@Override
public <W, X> Set<X> asSet(W e) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/spoon/reflect/meta/impl/SingleHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ContainerKind getContainerKind() {

public <W, X> java.util.Collection<X> asCollection(W element) {
return asList(element);
};
}

public <W, X> java.util.List<X> asList(W e) {
// return Collections.<X>singletonList(getValue(element));
Expand Down Expand Up @@ -121,9 +121,9 @@ private boolean equals(Object v1, Object v2) {
return v1.equals(v2);
}
};
};
}

public <W, X> java.util.Set<X> asSet(W element) {
return Collections.<X>singleton(getValue(element));
};
}
}
6 changes: 3 additions & 3 deletions src/main/java/spoon/support/compiler/ZipFolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public List<SpoonFile> getFiles() {
// Indexing content
if (files == null) {
files = new ArrayList<>();
try (ZipInputStream zipInput = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)));) {
try (ZipInputStream zipInput = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)))) {
ZipEntry entry;
while ((entry = zipInput.getNextEntry()) != null) {
// deflate in buffer
Expand Down Expand Up @@ -169,7 +169,7 @@ public void addFolder(SpoonFolder source) {

/** physically extracts on disk all files of this zip file in the destinationDir `destDir` */
public void extract(File destDir) {
try (ZipInputStream zipInput = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)));) {
try (ZipInputStream zipInput = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)))) {
ZipEntry entry;
while ((entry = zipInput.getNextEntry()) != null) {
File f = new File(destDir + File.separator + entry.getName());
Expand All @@ -182,7 +182,7 @@ public void extract(File destDir) {
// Force parent directory creation, sometimes directory was not yet handled
f.getParentFile().mkdirs();
// in the zip entry iteration
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(f));) {
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(f))) {
int count;
byte data[] = new byte[buffer];
while ((count = zipInput.read(data, 0, buffer)) != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FactoryCompilerConfig implements SpoonModelBuilder.InputType {

//avoid direct instantiation. But somebody can inherit
protected FactoryCompilerConfig() {
};
}

/**
* returns the compilation units corresponding to the types in the factory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ protected void generateProcessedSourceFilesUsingCUs() {

// the path must be given relatively to to the working directory
try (InputStream is = getCompilationUnitInputStream(cu.getFile().getPath());
FileOutputStream outFile = new FileOutputStream(file);) {
FileOutputStream outFile = new FileOutputStream(file)) {

IOUtils.copy(is, outFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected CtRole getRole() {
protected int getDefaultCapacity() {
return 2;
}
};;
};

public CtJavaDocImpl() {
super(CommentType.JAVADOC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public List<File> getBinaryFiles() {
public String getOriginalSourceCode() {

if (originalSourceCode == null) {
try (FileInputStream s = new FileInputStream(getFile());) {
try (FileInputStream s = new FileInputStream(getFile())) {
byte[] elementBytes = new byte[s.available()];
s.read(elementBytes);
originalSourceCode = new String(elementBytes, this.getFactory().getEnvironment().getEncoding());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean add(CtPackage pack) {
}
}
return super.add(pack);
};
}
};

@MetamodelPropertyField(role = CONTAINED_TYPE)
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/spoon/support/visitor/HashcodeVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ public void visitCtImport(CtImport e) {
@Override
public void scan(CtElement element) {
hashCode += 1;
super.scan(element);;
super.scan(element);
}

public int getHasCode() {
return hashCode;
}

}
2 changes: 1 addition & 1 deletion src/main/java/spoon/template/TemplateBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static TemplateBuilder createPattern(CtElement templateRoot, CtClass<?> t
});
//remove `... extends Template`, which doesn't have to be part of pattern model
tv.removeSuperClass();
};
}
pb = new PatternBuilder(tv.getPatternElements());
} else {
pb = new PatternBuilder(Collections.singletonList(templateRoot));
Expand Down