Warnings Cleanup in java.util.<various>
Michael Barker
mikeb01 at gmail.com
Thu Dec 1 22:37:24 PST 2011
Hi Stuart,
Thanks, we were happy with the results we got. About 6 or so of the
people there got the JDK build up and running and a few writing code
in about 2 hours. We are going to do some more of these evenings and
build a little momentum in the community.
I have attached a second patch with just a the wildcard to the
Enumeration instead of using an Iterator. We did have a discussion
over that one. Both options are available, I'll let whoever it doing
the merge decide.
Mike.
On Fri, Dec 2, 2011 at 3:40 AM, Stuart Marks <stuart.marks at oracle.com> wrote:
> Hi Mike,
>
> Thanks for pulling together the London JUG on short notice to bring up folks
> on building OpenJDK to the point of being able to generate patches! That's a
> great accomplishment.
>
> Sorry for the trouble with the attachments. As you notice, most everything
> except text attachments is stripped (though I believe some of the OpenJDK
> lists will pass zip attachments).
>
> I've filed bug 7117249 to track these changes. David Holmes mentioned that
> he thought the change in LogManager from Enumeration to Iterator might be
> out of scope for warnings cleanup. He might be right. I saw some questions
> from Martijn about other aspects of this code as well. I'll bring in
> somebody who's more familiar with the logging area to look this over, and
> then we'll figure out what to do.
>
> Thanks again.
>
> s'marks
>
>
> On 12/1/11 4:11 PM, Michael Barker wrote:
>>
>> Trying once more with a .txt extension. If that fails I'll inline the
>> patch.
>>
>> Mike.
>>
>> On Fri, Dec 2, 2011 at 12:06 AM, Michael Barker<mikeb01 at gmail.com> wrote:
>>>
>>> Looks like the list software has stripped off the attachments from my
>>> previous mail (my outbox shows them attached).
>>>
>>> Here's a second attempt.
>>>
>>> On Thu, Dec 1, 2011 at 11:58 PM, Michael Barker<mikeb01 at gmail.com>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Here is the output of our (unfortunately short) hack session. There
>>>> are warnings fixed in 4 files. A patch is included in each. Mostly
>>>> just generics and deprecation warnings.
>>>>
>>>> Regards,
>>>> Michael Barker.
>>>> Contributor/UserId: mikeb2701
-------------- next part --------------
diff -r 43a630f11af6 src/share/classes/java/util/logging/LogManager.java
--- a/src/share/classes/java/util/logging/LogManager.java Wed Nov 30 13:11:16 2011 -0800
+++ b/src/share/classes/java/util/logging/LogManager.java Fri Dec 02 06:31:37 2011 +0000
@@ -179,10 +179,10 @@
cname = System.getProperty("java.util.logging.manager");
if (cname != null) {
try {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(cname);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
manager = (LogManager) clz.newInstance();
} catch (ClassNotFoundException ex) {
- Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
+ Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
manager = (LogManager) clz.newInstance();
}
}
@@ -200,8 +200,8 @@
// Adding the global Logger. Doing so in the Logger.<clinit>
// would deadlock with the LogManager.<clinit>.
- Logger.global.setLogManager(manager);
- manager.addLogger(Logger.global);
+ Logger.getGlobal().setLogManager(manager);
+ manager.addLogger(Logger.getGlobal());
// We don't call readConfiguration() here, as we may be running
// very early in the JVM startup sequence. Instead readConfiguration
@@ -415,7 +415,7 @@
for (int i = 0; i < names.length; i++) {
String word = names[i];
try {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(word);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
Handler hdl = (Handler) clz.newInstance();
try {
// Check if there is a property defining the
@@ -782,11 +782,11 @@
// responsibility to initialize the logging configuration, by
// calling readConfiguration(InputStream) with a suitable stream.
try {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(cname);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
clz.newInstance();
return;
} catch (ClassNotFoundException ex) {
- Class clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
+ Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname);
clz.newInstance();
return;
}
@@ -837,9 +837,9 @@
// the global handlers, if they haven't been initialized yet.
initializedGlobalHandlers = true;
}
- Enumeration enum_ = getLoggerNames();
+ Enumeration<String> enum_ = getLoggerNames();
while (enum_.hasMoreElements()) {
- String name = (String)enum_.nextElement();
+ String name = enum_.nextElement();
resetLogger(name);
}
}
@@ -926,7 +926,7 @@
for (int i = 0; i < names.length; i++) {
String word = names[i];
try {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(word);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
clz.newInstance();
} catch (Exception ex) {
System.err.println("Can't load config class \"" + word + "\"");
@@ -1024,7 +1024,7 @@
String val = getProperty(name);
try {
if (val != null) {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(val);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
return (Filter) clz.newInstance();
}
} catch (Exception ex) {
@@ -1045,7 +1045,7 @@
String val = getProperty(name);
try {
if (val != null) {
- Class clz = ClassLoader.getSystemClassLoader().loadClass(val);
+ Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(val);
return (Formatter) clz.newInstance();
}
} catch (Exception ex) {
@@ -1163,7 +1163,7 @@
// Private method to be called when the configuration has
// changed to apply any level settings to any pre-existing loggers.
synchronized private void setLevelsOnExistingLoggers() {
- Enumeration enum_ = props.propertyNames();
+ Enumeration<?> enum_ = props.propertyNames();
while (enum_.hasMoreElements()) {
String key = (String)enum_.nextElement();
if (!key.endsWith(".level")) {
More information about the jdk8-dev
mailing list