final variables and parameters

seeing some methods it does actually help to enforce the parameters
This commit is contained in:
thatsIch
2015-09-25 23:10:56 +02:00
parent e52400bf26
commit 410d2f1e0d
819 changed files with 9390 additions and 9396 deletions
@@ -20,7 +20,7 @@ public abstract class BaseVersion implements Version
*
* @throws AssertionError if assertion are enabled and revision or build are not natural numbers
*/
public BaseVersion( int revision, Channel channel, int build )
public BaseVersion( final int revision, final Channel channel, final int build )
{
assert revision >= 0;
assert build >= 0;
@@ -64,7 +64,7 @@ public abstract class BaseVersion implements Version
}
@Override
public final boolean equals( Object o )
public final boolean equals( final Object o )
{
if( this == o )
{
@@ -75,7 +75,7 @@ public abstract class BaseVersion implements Version
return false;
}
Version that = (Version) o;
final Version that = (Version) o;
if( this.revision != that.revision() )
{
@@ -13,13 +13,13 @@ public final class DefaultVersion extends BaseVersion
* @param channel either alpha, beta or release
* @param build natural number
*/
public DefaultVersion( int revision, Channel channel, int build )
public DefaultVersion( final int revision, final Channel channel, final int build )
{
super( revision, channel, build );
}
@Override
public boolean isNewerAs( Version maybeOlder )
public boolean isNewerAs( final Version maybeOlder )
{
if( this.revision() > maybeOlder.revision() )
{
@@ -30,7 +30,7 @@ public final class DoNotCheckVersion extends BaseVersion
}
@Override
public boolean isNewerAs( Version maybeOlder )
public boolean isNewerAs( final Version maybeOlder )
{
return true;
}
@@ -18,7 +18,7 @@ public final class MissingVersion extends BaseVersion
* @return false
*/
@Override
public boolean isNewerAs( Version maybeOlder )
public boolean isNewerAs( final Version maybeOlder )
{
return false;
}
@@ -12,7 +12,7 @@ public final class ModVersionFetcher implements VersionFetcher
private final String rawModVersion;
private final VersionParser parser;
public ModVersionFetcher( String rawModVersion, VersionParser parser )
public ModVersionFetcher( final String rawModVersion, final VersionParser parser )
{
this.rawModVersion = rawModVersion;
this.parser = parser;
@@ -49,7 +49,7 @@ public final class VersionCheckerConfig
/**
* @param file requires fully qualified file in which the config is saved
*/
public VersionCheckerConfig( File file )
public VersionCheckerConfig( final File file )
{
this.config = new Configuration( file );
@@ -44,7 +44,7 @@ public final class VersionParser
*
* @throws AssertionError if raw String does not match pattern of a {@link Version}
*/
public Version parse( String raw )
public Version parse( final String raw )
{
final String transformed = this.transformDelimiter( raw );
final String[] split = transformed.split( "_" );
@@ -59,7 +59,7 @@ public final class VersionParser
*
* @return transformed raw, where "." and "-" are replaced by "_"
*/
private String transformDelimiter( String raw )
private String transformDelimiter( final String raw )
{
assert raw.contains( "." ) || raw.contains( "-" );
@@ -78,7 +78,7 @@ public final class VersionParser
*
* @return {@link Version} represented by the splitRaw
*/
private Version parseVersion( String[] splitRaw )
private Version parseVersion( final String[] splitRaw )
{
assert splitRaw.length == 3;
@@ -100,7 +100,7 @@ public final class VersionParser
*
* @return revision number
*/
private int parseRevision( String rawRevision )
private int parseRevision( final String rawRevision )
{
assert PATTERN_VALID_REVISION.matcher( rawRevision ).matches();
@@ -120,11 +120,11 @@ public final class VersionParser
*
* @return matching {@link Channel} to the String
*/
private Channel parseChannel( String rawChannel )
private Channel parseChannel( final String rawChannel )
{
assert rawChannel.equalsIgnoreCase( Channel.Alpha.name() ) || rawChannel.equalsIgnoreCase( Channel.Beta.name() ) || rawChannel.equalsIgnoreCase( Channel.Stable.name() );
for( Channel channel : Channel.values() )
for( final Channel channel : Channel.values() )
{
if( channel.name().equalsIgnoreCase( rawChannel ) )
{
@@ -142,7 +142,7 @@ public final class VersionParser
*
* @return build number
*/
private int parseBuild( String rawBuild )
private int parseBuild( final String rawBuild )
{
assert PATTERN_NATURAL.matcher( rawBuild ).matches();
@@ -13,7 +13,7 @@ public final class DefaultFormattedRelease implements FormattedRelease
private final Version version;
private final String changelog;
public DefaultFormattedRelease( Version version, String changelog )
public DefaultFormattedRelease( final Version version, final String changelog )
{
this.version = version;
this.changelog = changelog;
@@ -27,7 +27,7 @@ public final class ReleaseFetcher
private final VersionCheckerConfig config;
private final VersionParser parser;
public ReleaseFetcher( VersionCheckerConfig config, VersionParser parser )
public ReleaseFetcher( final VersionCheckerConfig config, final VersionParser parser )
{
this.config = config;
this.parser = parser;
@@ -50,7 +50,7 @@ public final class ReleaseFetcher
return latestFitRelease;
}
catch( Exception e )
catch( final Exception e )
{
AELog.error( e );
@@ -58,18 +58,18 @@ public final class ReleaseFetcher
}
}
private String getRawReleases( URL url ) throws IOException
private String getRawReleases( final URL url ) throws IOException
{
return IOUtils.toString( url );
}
private FormattedRelease getLatestFitRelease( Iterable<Release> releases )
private FormattedRelease getLatestFitRelease( final Iterable<Release> releases )
{
final String levelInConfig = this.config.level();
final Channel level = Channel.valueOf( levelInConfig );
final int levelOrdinal = level.ordinal();
for( Release release : releases )
for( final Release release : releases )
{
final String rawVersion = release.tag_name;
final String changelog = release.body;