1
0

Remove variable assignment just before returning it

Use final
This commit is contained in:
Gary Gregory
2024-02-04 13:57:53 -05:00
parent 98f576cd33
commit 3ca327b7c2
9 changed files with 32 additions and 38 deletions

View File

@@ -317,8 +317,7 @@ public class PathableClassLoader extends URLClassLoader {
final String prefix = (String) entry.getKey();
if (name.startsWith(prefix)) {
final ClassLoader loader = (ClassLoader) entry.getValue();
final Class clazz = Class.forName(name, resolve, loader);
return clazz;
return Class.forName(name, resolve, loader);
}
}
}

View File

@@ -36,8 +36,6 @@ public class AvalonLoggerTestCase extends AbstractLogTest {
@Override
public Log getLogObject() {
// Output does not seem to be used, so don't display it.
final Log log = new AvalonLogger(new NullLogger());
return log;
return new AvalonLogger(new NullLogger());
}
}

View File

@@ -82,8 +82,7 @@ public class SecurityForbiddenTestCase extends TestCase {
private Object loadClass(final String name, final ClassLoader classLoader) {
try {
final Class clazz = classLoader.loadClass(name);
final Object obj = clazz.getConstructor().newInstance();
return obj;
return clazz.getConstructor().newInstance();
} catch (final Exception e) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);

View File

@@ -60,7 +60,7 @@ public class CallerInformationTestCase extends TestCase {
appender.clearAllFilters();
appender.addFilter(new Filter<ILoggingEvent>() {
@Override
public FilterReply decide(ILoggingEvent event) {
public FilterReply decide(final ILoggingEvent event) {
// Force the registration of caller data
event.getCallerData();
return FilterReply.NEUTRAL;

View File

@@ -32,8 +32,7 @@ public class BadTCCLTestCase extends TestCase {
public static Test suite() throws Exception {
final PathableClassLoader contextClassLoader = new PathableClassLoader(null);
contextClassLoader.useExplicitLoader("junit.", Test.class.getClassLoader());
final PathableTestSuite suite = new PathableTestSuite(BadTCCLTestCase.class, contextClassLoader);
return suite;
return new PathableTestSuite(BadTCCLTestCase.class, contextClassLoader);
}
// test methods

View File

@@ -29,8 +29,7 @@ import junit.framework.TestCase;
public class NullTCCLTestCase extends TestCase {
public static Test suite() throws Exception {
final PathableTestSuite suite = new PathableTestSuite(NullTCCLTestCase.class, null);
return suite;
return new PathableTestSuite(NullTCCLTestCase.class, null);
}
// test methods