RFR: 8003380 - Compiler warnings in logging test code
Jim Gish
jim.gish at oracle.com
Thu Nov 15 16:07:06 UTC 2012
Well -- yes and no. The problem is the way Loggers are handled -- as
weak refs. They can get easily gc'd. Now in this code it doesn't
really make much difference, but I'm trying to be consistent. That
said, the right thing, now that I look at it again, would be to make the
declarations of logger static, to ensure they don't get gc'd. Initially
I thought that instance variables would do the trick, but I've since
learned otherwise. (There's much more behind the curtain here than I
previously thought :-( )
Thanks,
Jim
On 11/15/2012 10:52 AM, Chris Hegarty wrote:
> Jim,
>
> I'm not convinced that the use of "unused" is strictly necessary, but
> I'm not an Eclipse user. It looks like there is an easy way around
> this. For example, in
> new/test/java/util/logging/LoggingDeadlock3.java, rather than add
> @SuppressWarnings("unused"), will the follow keep the compiler happy?
>
> < Logger logger = Logger.getLogger("com.sun.Hello"+cnt/10);
> ---
> > Logger.getLogger("com.sun.Hello"+cnt/10);
>
> ... and similar for other areas?
>
> Otherwise, I'm happy with the change and can push is for you.
>
> -Chris
>
> On 14/11/2012 23:13, Jim Gish wrote:
>> I've updated the webrev with your suggestion. Here it is:
>> http://cr.openjdk.java.net/~jgish/Bug8003380-logging-test-warnings/
>> <http://cr.openjdk.java.net/%7Ejgish/Bug8003380-logging-test-warnings/>
>>
>> Could someone please push it?
>>
>> Thanks,
>> Jim
>>
>> On 11/14/2012 05:48 PM, Jim Gish wrote:
>>>
>>> On 11/14/2012 05:44 PM, Chris Hegarty wrote:
>>>> Interesting... fixing warnings in tests. A few comments.
>>> Right -- one might consider it overkill sine the warnings don't show
>>> up in normal testing, but they do show up in Eclipse. Just plain
>>> annoying.
>>>>
>>>> - LoggingMXBeanTest2.java
>>>> ListIterator<?> -> ListIterator<String> and remove redundant cast ?
>>> ok.
>>>> - @SuppressWarnings("unused") Eclipse???
>>>> Do we have precedent for adding these suppressions??
>>> Not that I know of.
>>>> - ClassLoaderLeakTest
>>>> Why the change to use toURI().toURL() ??
>>> Because directly applying .toURL() unless it is on a URI is deprecated.
>>>
>>> ...Jim
>>>> -Chris
>>>>
>>>> On 14 Nov 2012, at 21:15, Jim Gish <jim.gish at oracle.com
>>>> <mailto:jim.gish at oracle.com>> wrote:
>>>>
>>>>> Please review
>>>>> http://cr.openjdk.java.net/~jgish/Bug8003380-logging-test-warnings/
>>>>> <http://cr.openjdk.java.net/%7Ejgish/Bug8003380-logging-test-warnings/>
>>>>>
>>>>> <http://cr.openjdk.java.net/%7Ejgish/Bug8003380-logging-test-warnings/>
>>>>>
>>>>>
>>>>> These are simple changes to eliminate compiler warnings from
>>>>> java.util.logging test code.
>>>>>
>>>>> Thanks,
>>>>> Jim
>>>>>
>>>>> --
>>>>> Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
>>>>> Oracle Java Platform Group | Core Libraries Team
>>>>> 35 Network Drive
>>>>> Burlington, MA 01803
>>>>> jim.gish at oracle.com <mailto:jim.gish at oracle.com>
>>>>>
>>>
>>
>> --
>> Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
>> Oracle Java Platform Group | Core Libraries Team
>> 35 Network Drive
>> Burlington, MA 01803
>> jim.gish at oracle.com
>>
--
Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.gish at oracle.com
More information about the core-libs-dev
mailing list