Disabled SpotBugs for now.

Updated dependencies and copyright
This commit is contained in:
Erik C. Thauvin 2023-07-14 19:27:07 -07:00
parent 2ce19a215f
commit d7d641f207
38 changed files with 253 additions and 166 deletions

View file

@ -1,7 +1,7 @@
/*
* Constants.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* Version.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* VersionInfo.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* VersionProcessor.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +36,6 @@ import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory;
import com.github.mustachejava.MustacheNotFoundException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
@ -75,7 +74,6 @@ public class VersionProcessor extends AbstractProcessor {
log(Diagnostic.Kind.ERROR, t != null ? t.toString() : s);
}
@SuppressFBWarnings({"PATH_TRAVERSAL_IN"})
private VersionInfo findValues(final Version version) throws IOException {
final VersionInfo versionInfo = new VersionInfo(version);
@ -125,7 +123,6 @@ public class VersionProcessor extends AbstractProcessor {
return versionInfo;
}
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
private File getLocalFile(final String fileName) {
if (processingEnv != null) { // null when testing.
final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
@ -227,25 +224,17 @@ public class VersionProcessor extends AbstractProcessor {
log(Diagnostic.Kind.WARNING, s);
}
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
private void writeTemplate(final String type, final VersionInfo versionInfo, final String template)
throws IOException {
final File dir = getLocalFile("");
final MustacheFactory mf = new DefaultMustacheFactory(dir);
final Mustache mustache = mf.compile(template);
final String templateName;
switch (mustache.getName()) {
case Constants.DEFAULT_JAVA_TEMPLATE:
templateName = "default (Java)";
break;
case Constants.DEFAULT_KOTLIN_TEMPLATE:
templateName = "default (Kotlin)";
break;
default:
templateName = mustache.getName() + " (" + dir.getAbsolutePath() + ')';
break;
}
final String templateName = switch (mustache.getName()) {
case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)";
case Constants.DEFAULT_KOTLIN_TEMPLATE -> "default (Kotlin)";
default -> mustache.getName() + " (" + dir.getAbsolutePath() + ')';
};
note("Loaded template: " + templateName);
final String fileName = versionInfo.getClassName() + '.' + type;

View file

@ -1,7 +1,7 @@
/*
* ConstantsTest.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* VersionInfoTest.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,7 +32,6 @@
package net.thauvin.erik.semver;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.Assert;
import org.testng.annotations.Test;
@ -47,7 +46,6 @@ import static org.testng.Assert.assertEquals;
* @created 2016-02-03
* @since 1.0
*/
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
public class VersionInfoTest {
private VersionInfo versionInfo = new VersionInfo();

View file

@ -1,7 +1,7 @@
/*
* VersionProcessorTest.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,7 +32,6 @@
package net.thauvin.erik.semver;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.annotations.Test;
import java.lang.reflect.InvocationTargetException;
@ -52,7 +51,6 @@ public class VersionProcessorTest {
private final VersionProcessor processor = new VersionProcessor();
private final Version version = new VersionTest();
@SuppressFBWarnings("RFI_SET_ACCESSIBLE")
@SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test
public void testFindValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
@ -64,7 +62,6 @@ public class VersionProcessorTest {
assertEquals(versionInfo.getProject(), "James Bond", "getProject(James Bond)");
}
@SuppressFBWarnings("RFI_SET_ACCESSIBLE")
@SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test
public void testParseIntProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

View file

@ -1,7 +1,7 @@
/*
* VersionTest.java
*
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,7 @@ import java.lang.annotation.Annotation;
* @created 2019-04-02
* @since 1.2.0
*/
@SuppressWarnings({"ClassExplicitlyAnnotation", "SameReturnValue", "java:S2187"})
@SuppressWarnings({"ClassExplicitlyAnnotation", "SameReturnValue", "java:S2187", "PMD.TestClassWithoutTestCases"})
class VersionTest implements Version {
@Override
public Class<? extends Annotation> annotationType() {