Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8be3e3e

Browse files
committed
fix compiler warnings
1 parent 61db8ea commit 8be3e3e

File tree

60 files changed

+154
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+154
-174
lines changed

logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
public class JaninoEventEvaluator extends JaninoEventEvaluatorBase<IAccessEvent> {
2525

26-
public final static List<String> DEFAULT_PARAM_NAME_LIST = new ArrayList<String>();
27-
public final static List<Class> DEFAULT_PARAM_TYPE_LIST = new ArrayList<Class>();
26+
public final static List<String> DEFAULT_PARAM_NAME_LIST = new ArrayList<>();
27+
public final static List<Class<?>> DEFAULT_PARAM_TYPE_LIST = new ArrayList<>();
2828

2929
static {
3030
DEFAULT_PARAM_NAME_LIST.add("event");
@@ -56,8 +56,8 @@ protected String[] getParameterNames() {
5656
}
5757

5858
@Override
59-
protected Class[] getParameterTypes() {
60-
List<Class> fullTypeList = new ArrayList<Class>();
59+
protected Class<?>[] getParameterTypes() {
60+
List<Class<?>> fullTypeList = new ArrayList<>();
6161
fullTypeList.addAll(DEFAULT_PARAM_TYPE_LIST);
6262
for (int i = 0; i < matcherList.size(); i++) {
6363
fullTypeList.add(Matcher.class);

logback-access/src/test/java/ch/qos/logback/access/jetty/JettyBasicTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@
1515

1616
import static org.junit.Assert.assertEquals;
1717
import static org.junit.Assert.assertNotNull;
18-
import static org.junit.Assert.assertTrue;
1918

2019
import java.io.OutputStreamWriter;
2120
import java.io.PrintWriter;
2221
import java.net.HttpURLConnection;
2322
import java.net.URL;
2423
import java.util.concurrent.TimeUnit;
2524

26-
import ch.qos.logback.access.spi.IAccessEvent;
2725
import org.junit.AfterClass;
2826
import org.junit.BeforeClass;
2927
import org.junit.Test;
3028

29+
import ch.qos.logback.access.spi.IAccessEvent;
3130
import ch.qos.logback.access.spi.Util;
3231
import ch.qos.logback.access.testUtil.NotifyingListAppender;
3332
import ch.qos.logback.core.testUtil.RandomUtil;

logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import ch.qos.logback.access.AccessTestConstants;
1717
import ch.qos.logback.access.spi.AccessContext;
18+
import ch.qos.logback.access.spi.IAccessEvent;
1819
import ch.qos.logback.core.ConsoleAppender;
1920
import ch.qos.logback.core.joran.spi.JoranException;
2021
import ch.qos.logback.core.read.ListAppender;
@@ -64,7 +65,7 @@ void configure(String file) throws JoranException {
6465
@Test
6566
public void conditionalConsoleApp_IF_THEN_True() throws JoranException, UnknownHostException {
6667
configure(AccessTestConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
67-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
68+
ConsoleAppender<IAccessEvent> consoleAppender = (ConsoleAppender<IAccessEvent>) context.getAppender("CON");
6869
assertNotNull(consoleAppender);
6970
assertTrue(checker.isErrorFree(0));
7071
}
@@ -74,7 +75,7 @@ public void conditionalConsoleApp_IF_THEN_False() throws JoranException, IOExcep
7475
context.putProperty("aHost", null);
7576
configure(AccessTestConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
7677

77-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
78+
ConsoleAppender<IAccessEvent> consoleAppender = (ConsoleAppender<IAccessEvent>) context.getAppender("CON");
7879
assertNull(consoleAppender);
7980

8081
StatusChecker checker = new StatusChecker(context);
@@ -84,10 +85,10 @@ public void conditionalConsoleApp_IF_THEN_False() throws JoranException, IOExcep
8485
@Test
8586
public void conditionalConsoleApp_ELSE() throws JoranException, IOException, InterruptedException {
8687
configure(AccessTestConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole_ELSE.xml");
87-
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
88+
ConsoleAppender<IAccessEvent> consoleAppender = (ConsoleAppender<IAccessEvent>) context.getAppender("CON");
8889
assertNull(consoleAppender);
8990

90-
ListAppender listAppender = (ListAppender) context.getAppender("LIST");
91+
ListAppender<IAccessEvent> listAppender = (ListAppender<IAccessEvent>) context.getAppender("LIST");
9192
assertNotNull(listAppender);
9293
assertTrue(checker.isErrorFree(0));
9394
}

logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public class JaninoEventEvaluator extends JaninoEventEvaluatorBase<ILoggingEvent
3232

3333
public final static String IMPORT_LEVEL = "import ch.qos.logback.classic.Level;\r\n";
3434

35-
public final static List<String> DEFAULT_PARAM_NAME_LIST = new ArrayList<String>();
36-
public final static List<Class> DEFAULT_PARAM_TYPE_LIST = new ArrayList<Class>();
35+
public final static List<String> DEFAULT_PARAM_NAME_LIST = new ArrayList<>();
36+
public final static List<Class<?>> DEFAULT_PARAM_TYPE_LIST = new ArrayList<>();
3737

3838
static {
3939
DEFAULT_PARAM_NAME_LIST.add("DEBUG");
@@ -95,8 +95,8 @@ protected String[] getParameterNames() {
9595
return (String[]) fullNameList.toArray(CoreConstants.EMPTY_STRING_ARRAY);
9696
}
9797

98-
protected Class[] getParameterTypes() {
99-
List<Class> fullTypeList = new ArrayList<Class>();
98+
protected Class<?>[] getParameterTypes() {
99+
List<Class<?>> fullTypeList = new ArrayList<>();
100100
fullTypeList.addAll(DEFAULT_PARAM_TYPE_LIST);
101101
for (int i = 0; i < matcherList.size(); i++) {
102102
fullTypeList.add(Matcher.class);

logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected boolean shouldStart() {
5656

5757
ServerListener<RemoteAppenderClient> listener = createServerListener(serverSocket);
5858

59-
runner = createServerRunner(listener, getContext().getExecutorService());
59+
runner = createServerRunner(listener, getContext().getScheduledExecutorService());
6060
runner.setContext(getContext());
6161
return true;
6262
} catch (Exception ex) {

logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void populateFrames(StackTraceElementProxy[] stepArray) {
8080

8181
int missfireCount = 0;
8282
for (int i = 0; i < commonFrames; i++) {
83-
Class callerClass = null;
83+
Class<?> callerClass = null;
8484
if (GET_CALLER_CLASS_METHOD_AVAILABLE) {
8585
//callerClass = Reflection.getCallerClass(localFirstCommon + i - missfireCount + 1);
8686
}
@@ -113,7 +113,7 @@ void populateUncommonFrames(int commonFrames, StackTraceElementProxy[] stepArray
113113
}
114114
}
115115

116-
private ClassPackagingData calculateByExactType(Class type) {
116+
private ClassPackagingData calculateByExactType(Class<?> type) {
117117
String className = type.getName();
118118
ClassPackagingData cpd = cache.get(className);
119119
if (cpd != null) {
@@ -132,15 +132,15 @@ private ClassPackagingData computeBySTEP(StackTraceElementProxy step, ClassLoade
132132
if (cpd != null) {
133133
return cpd;
134134
}
135-
Class type = bestEffortLoadClass(lastExactClassLoader, className);
135+
Class<?> type = bestEffortLoadClass(lastExactClassLoader, className);
136136
String version = getImplementationVersion(type);
137137
String codeLocation = getCodeLocation(type);
138138
cpd = new ClassPackagingData(codeLocation, version, false);
139139
cache.put(className, cpd);
140140
return cpd;
141141
}
142142

143-
String getImplementationVersion(Class type) {
143+
String getImplementationVersion(Class<?> type) {
144144
if (type == null) {
145145
return "na";
146146
}
@@ -157,7 +157,7 @@ String getImplementationVersion(Class type) {
157157

158158
}
159159

160-
String getCodeLocation(Class type) {
160+
String getCodeLocation(Class<?> type) {
161161
try {
162162
if (type != null) {
163163
// file:/C:/java/maven-2.0.8/repo/com/icegreen/greenmail/1.3/greenmail-1.3.jar
@@ -196,7 +196,7 @@ private boolean isFolder(int idx, String text) {
196196
return (idx != -1 && idx + 1 == text.length());
197197
}
198198

199-
private Class loadClass(ClassLoader cl, String className) {
199+
private Class<?> loadClass(ClassLoader cl, String className) {
200200
if (cl == null) {
201201
return null;
202202
}
@@ -218,8 +218,8 @@ private Class loadClass(ClassLoader cl, String className) {
218218
* @param className
219219
* @return
220220
*/
221-
private Class bestEffortLoadClass(ClassLoader lastGuaranteedClassLoader, String className) {
222-
Class result = loadClass(lastGuaranteedClassLoader, className);
221+
private Class<?> bestEffortLoadClass(ClassLoader lastGuaranteedClassLoader, String className) {
222+
Class<?> result = loadClass(lastGuaranteedClassLoader, className);
223223
if (result != null) {
224224
return result;
225225
}

logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private void updateMaskIfNecessary(long now) {
148148
// reader lock.
149149
void detachReconfigurationToNewThread() {
150150
addInfo("Detected change in [" + configurationWatchList.getCopyOfFileWatchList() + "]");
151-
context.getExecutorService().submit(new ReconfiguringThread());
151+
context.getScheduledExecutorService().submit(new ReconfiguringThread());
152152
}
153153

154154
void updateNextCheck(long now) {

logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextPerfTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
*/
1414
package ch.qos.logback.classic;
1515

16-
import ch.qos.logback.classic.corpus.CorpusModel;
17-
import ch.qos.logback.core.contention.*;
1816
import org.junit.Before;
19-
import org.junit.Ignore;
2017
import org.junit.Test;
2118

22-
import static org.junit.Assert.fail;
19+
import ch.qos.logback.classic.corpus.CorpusModel;
20+
import ch.qos.logback.core.contention.RunnableWithCounterAndDone;
21+
import ch.qos.logback.core.contention.ThreadedThroughputCalculator;
2322

2423
public class LoggerContextPerfTest {
2524

logback-classic/src/test/java/ch/qos/logback/classic/LoggerMessageFormattingTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ public void setUp() {
3939
@Test
4040
public void testFormattingOneArg() {
4141
Logger logger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
42-
logger.debug("{}", new Integer(12));
42+
logger.debug("{}", Integer.valueOf(12));
4343
ILoggingEvent event = (ILoggingEvent) listAppender.list.get(0);
4444
assertEquals("12", event.getFormattedMessage());
4545
}
4646

4747
@Test
4848
public void testFormattingTwoArg() {
4949
Logger logger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
50-
logger.debug("{}-{}", new Integer(12), new Integer(13));
50+
logger.debug("{}-{}", Integer.valueOf(12), Integer.valueOf(13));
5151
ILoggingEvent event = (ILoggingEvent) listAppender.list.get(0);
5252
assertEquals("12-13", event.getFormattedMessage());
5353
}
5454

5555
@Test
5656
public void testNoFormatting() {
5757
Logger logger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
58-
logger.debug("test", new Integer(12), new Integer(13));
58+
logger.debug("test", Integer.valueOf(12), Integer.valueOf(13));
5959
ILoggingEvent event = (ILoggingEvent) listAppender.list.get(0);
6060
assertEquals("test", event.getFormattedMessage());
6161
}

logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515

1616
import static org.junit.Assert.assertTrue;
1717

18-
import ch.qos.logback.core.testUtil.EnvUtilForTests;
1918
import org.junit.Before;
2019
import org.junit.Ignore;
2120
import org.junit.Test;
2221

2322
import ch.qos.logback.classic.spi.ILoggingEvent;
2423
import ch.qos.logback.classic.turbo.NOPTurboFilter;
25-
import ch.qos.logback.core.CoreConstants;
2624
import ch.qos.logback.core.UnsynchronizedAppenderBase;
2725
import ch.qos.logback.core.helpers.NOPAppender;
26+
import ch.qos.logback.core.testUtil.EnvUtilForTests;
2827

2928
@Ignore
3029
public class LoggerPerfTest {

0 commit comments

Comments
 (0)