Fix minor warnings:

remove unnecessary generic type for collections,
replace Charset.forName on StandartCharset
This commit is contained in:
Andrei Arlou 2019-08-12 22:20:53 +03:00 committed by Filip Hrisafov
parent dbe761e738
commit 59a5182dab
4 changed files with 13 additions and 16 deletions

View File

@ -111,7 +111,7 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
private List<ProcessorTestCase> initializeTestCases(ProcessorSuite suite,
Constructor<? extends CommandLineEnhancer> cliEnhancerConstructor) {
List<ProcessorType> types = new ArrayList<ProcessorType>();
List<ProcessorType> types = new ArrayList<>();
for ( ProcessorType compiler : suite.processorTypes() ) {
if ( compiler.getIncluded().length > 0 ) {
@ -190,7 +190,7 @@ public class ProcessorSuiteRunner extends ParentRunner<ProcessorTestCase> {
verifier = new Verifier( destination.getCanonicalPath() );
}
List<String> goals = new ArrayList<String>( 3 );
List<String> goals = new ArrayList<>( 3 );
goals.add( "clean" );

View File

@ -51,7 +51,7 @@ public abstract class HelperMethod implements Method {
* @return the types used by this method for which import statements need to be generated
*/
public Set<Type> getImportTypes() {
return Collections.<Type>emptySet();
return Collections.emptySet();
}
/**

View File

@ -153,12 +153,12 @@ public class Strings {
}
int c = 1;
String seperator = Character.isDigit( name.charAt( name.length() - 1 ) ) ? "_" : "";
while ( conflictingNames.contains( name + seperator + c ) ) {
String separator = Character.isDigit( name.charAt( name.length() - 1 ) ) ? "_" : "";
while ( conflictingNames.contains( name + separator + c ) ) {
c++;
}
return name + seperator + c;
return name + separator + c;
}
/**

View File

@ -12,7 +12,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@ -62,16 +62,13 @@ public class ModelWriter {
}
public void writeModel(FileObject sourceFile, Writable model) {
try {
BufferedWriter writer = new BufferedWriter( new IndentationCorrectingWriter( sourceFile.openWriter() ) );
try ( BufferedWriter writer = new BufferedWriter( new IndentationCorrectingWriter( sourceFile.openWriter() ))) {
Map<Class<?>, Object> values = new HashMap<>();
values.put( Configuration.class, CONFIGURATION );
Map<Class<?>, Object> values = new HashMap<>();
values.put( Configuration.class, CONFIGURATION );
model.write( new DefaultModelElementWriterContext( values ), writer );
model.write( new DefaultModelElementWriterContext( values ), writer );
writer.flush();
writer.close();
writer.flush();
}
catch ( RuntimeException e ) {
throw e;
@ -100,7 +97,7 @@ public class ModelWriter {
InputStream is = connection.getInputStream();
return new InputStreamReader( is, Charset.forName( "UTF-8" ) );
return new InputStreamReader( is, StandardCharsets.UTF_8 );
}
@Override