PMD optimizations.

This commit is contained in:
Erik C. Thauvin 2016-01-25 11:57:18 -08:00
parent 4c66bf6299
commit 5683ff853c
8 changed files with 70 additions and 18 deletions

View file

@ -69,7 +69,7 @@ bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['MyPublication']
dryRun = false
dryRun = true
pkg {
repo = 'maven'
name = mavenName

View file

@ -19,7 +19,7 @@
<orderEntry type="library" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Gradle: net.thauvin.erik:semver:0.9.0-beta" level="project" />
<orderEntry type="library" name="Gradle: net.thauvin.erik:semver:0.9.1-beta" level="project" />
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">

View file

@ -13,7 +13,7 @@ import java.util.Date;
*/
public final class GeneratedVersion {
private final static String buildmeta = "";
private final static Date date = new Date(1453601787705L);
private final static Date date = new Date(1453751280926L);
private final static int major = 3;
private final static int minor = 1;
private final static int patch = 37;
@ -30,12 +30,28 @@ public final class GeneratedVersion {
}
/**
* Returns the full version.
* Returns the full version string.
* <p>
* Formatted as:
* <blockquote>
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code>
* </blockquote>
* <p>
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*
* @return The full version string.
* @return The version string.
*/
public static String getVersion() {
return "" + getMajor() + '.' + getMinor() + '.' + getPatch() + getPreRelease() + getBuildMetadata();
return Integer.toString(getMajor()) + '.'
+ Integer.toString(getMinor()) + '.'
+ Integer.toString(getPatch())
+ getPreRelease() + getBuildMetadata();
}
/**
@ -99,4 +115,14 @@ public final class GeneratedVersion {
return "";
}
/**
* Disables the default constructor.
*
* @throws UnsupportedOperationException if the constructor is called.
*/
private GeneratedVersion()
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}

View file

@ -357,13 +357,13 @@
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/2b8c4b3035e45520ef42033e823c7d33e4b4402c/commons-lang-2.4-sources.jar!/" />
</SOURCES>
</library>
<library name="Gradle: net.thauvin.erik:semver:0.9.0-beta">
<library name="Gradle: net.thauvin.erik:semver:0.9.1-beta">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.0-beta/semver-0.9.0-beta.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.1-beta/semver-0.9.1-beta.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.0-beta/semver-0.9.0-beta-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.1-beta/semver-0.9.1-beta-sources.jar!/" />
</SOURCES>
</library>
<library name="Gradle: org.apache.velocity:velocity:1.7">

View file

@ -108,7 +108,7 @@ public final class Constants
/**
* Disables the default constructor.
*
* @throws UnsupportedOperationException if an error occurred. if the constructor is called.
* @throws UnsupportedOperationException if the constructor is called.
*/
private Constants()
throws UnsupportedOperationException

View file

@ -207,7 +207,7 @@ public class VersionInfo
*
* @param project The new project name.
*/
public void setProject(String project)
public void setProject(final String project)
{
this.project = project;
}
@ -230,7 +230,7 @@ public class VersionInfo
*/
public String getVersion()
{
return "" + major + '.' + minor + '.' + patch + (prerelease.length() > 0 ? '-' + prerelease : "") + (
buildmeta.length() > 0 ? '+' + buildmeta : "");
return Integer.toString(major) + '.' + Integer.toString(minor) + '.' + Integer.toString(patch) + (
prerelease.length() > 0 ? '-' + prerelease : "") + (buildmeta.length() > 0 ? '+' + buildmeta : "");
}
}

View file

@ -170,7 +170,7 @@ public class VersionProcessor extends AbstractProcessor
}
catch (IOException e)
{
error("IOException occurred while running annotation processor", e);
error("IOException occurred while running the annotation processor", e);
}
}
}
@ -192,7 +192,7 @@ public class VersionProcessor extends AbstractProcessor
{
try
{
return Integer.parseInt(p.getProperty(property, "" + defaultValue));
return Integer.parseInt(p.getProperty(property, Integer.toString(defaultValue)));
}
catch (NumberFormatException ignore)
{

View file

@ -30,12 +30,28 @@ public final class ${className} {
}
/**
* Returns the full version.
* Returns the full version string.
* <p>
* Formatted as:
* <blockquote>
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code>
* </blockquote>
* <p>
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*
* @return The full version string.
* @return The version string.
*/
public static String getVersion() {
return "" + getMajor() + '.' + getMinor() + '.' + getPatch() + getPreRelease() + getBuildMetadata();
return Integer.toString(getMajor()) + '.'
+ Integer.toString(getMinor()) + '.'
+ Integer.toString(getPatch())
+ getPreRelease() + getBuildMetadata();
}
/**
@ -99,4 +115,14 @@ public final class ${className} {
return "";
}
/**
* Disables the default constructor.
*
* @throws UnsupportedOperationException if the constructor is called.
*/
private ${className}()
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}