From Lance.Andersen at oracle.com Thu Dec 1 01:46:33 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Wed, 30 Nov 2011 20:46:33 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4ED698ED.3050304@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> Message-ID: <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> Here is another round of diffs as I found more warnings after I changed lint levels http://cr.openjdk.java.net/~lancea/7116445/webrev.02/ For SQLOutputImpl.java, as I found no easy way to avoid the errors without changing the constructor generic types, I went the route of suppressing the warnings in each of the methods. This class is not used much if at all so I am not sure it is worth any more cycles currently. Thanks for your time on the reviews... Best Lance On Nov 30, 2011, at 3:58 PM, Stuart Marks wrote: > > > On 11/30/11 10:43 AM, Lance Andersen - Oracle wrote: >> Hi Stuart, >> >> Thanks for the feedback. > > Great, thanks for the updates. Further comments below. > >>> * In CachedRowSetWriter.java, cols is changed from Vector to Vector. >>> This is fine but there's now a redundant cast (Integer)cols.get(i) at line >>> 752 that might generate another warning. >> >> I removed it now. btw, there was no warning generated with cast there which is >> why I did not make the change initially. > > I'm not sure what the default compiler flags are for this portion of the build. I had done a full build of the jdk repo with your patch applied, using the following command, > > make JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL= OTHER_JAVACFLAGS="-Xmaxwarns 10000" > > and I did see that some redundant cast warnings were introduced. > >>> * WebRowSetXmlWriter.java, XmlReaderContentHandler.java, SQLInputImpl.java, >>> and SyncFactory.java similar removals of redundant casts can be performed for >>> types that have been converted to generics. >> >> I did not see the changes you were suggesting in SyncFactory but maybe I have >> not had enough coffee :-), was there something specific you saw as I did not >> see an obvious change to get rid of the couple of casts to the type that was >> converted to use generics > > Oh yes, the SyncFactory one is different. Usually generifying a type will introduce redundant casts near calls to things like get(). The "implementations" field was generified, and I saw this: > > ProviderImpl impl = (ProviderImpl) implementations.get(providerID); > > which looked like a redundant cast. But the declared type is now Hashtable which means the cast isn't redundant, but it does raise a different set of questions. The "impl" local is only tested for being null so maybe its type should be SyncProvider instead. Oddly it doesn't appear to be used if it's non-null. Hm, this code has other issues as well... (A null return from Class.forName is handled, which AFAIK cannot occur; c.newInstance() is cast to SyncProvider but ClassCastException isn't handled.) > > Despite this I don't actually see any compiler warnings from this code. Since this is warnings cleanup day maybe we're done. :-) Perhaps further cleanups in this area can be deferred. > >>> You might also consider using diamond where new generic instances are >>> created, though it's a matter of style whether to use diamond in an >>> assignment statement (as opposed to in a declaration's initializer). >> >> Do we have a preference going forward? I used diamond as you suggested. > > My recommendation is to use diamond in field and local initializers and in simple assignment statements. I avoid diamond in parameters to method calls and within ternary (?:) expressions. > > Some people don't want to use diamond in assignment statements, since the redundancy isn't as obvious, and they think that having the type arguments in the constructor is helpful there. But I don't see it. > >> The updated webrev is at: http://cr.openjdk.java.net/~lancea/7116445/webrev.01/ > > Oh... one more thing. Sorry I missed this in my previous review. > > In SQLOutputImpl the constructor parameters got changed from Vector to Vector and from Map to Map>. This looks like a public constructor to a public API class. (At least, I see this in the javadoc.) This change might actually be correct (though perhaps not strictly compatible) but I don't think we want to be making such changes as part of warnings cleanup, even if it does end up removing warnings. > > s'marks > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From david.holmes at oracle.com Thu Dec 1 02:52:25 2011 From: david.holmes at oracle.com (David Holmes) Date: Thu, 01 Dec 2011 12:52:25 +1000 Subject: Code Review Request for Bug #7069190 In-Reply-To: <4ED6BAF4.6020403@oracle.com> References: <4ED6AB44.5040108@oracle.com> <4ED6ACD0.1020300@oracle.com> <4ED6BAF4.6020403@oracle.com> Message-ID: <4ED6EBE9.2050103@oracle.com> On 1/12/2011 9:23 AM, Xueming Shen wrote: > (1) you might need to consider the use scenario of an unset HOME env > (2) it appears to be an in-compatible change if the values from getpwuid > and > from HOME are different (understood this is what you want to address), > in which > I think might need a CCC review (for the possible in-compatible change > of behavior) Yes at a minimum this should go to CCC to assess whether it should be changed (there's been some side-channel email on this). There are a lot of potential issues with this proposed change. David > > -Sherman > > On 11/30/2011 2:23 PM, Darryl Mocek wrote: >> Wrong webrev link. Here's the correct one: >> http://cr.openjdk.java.net/~dmocek/7069190/webrev.00 >> >> Darryl >> >> On 11/30/2011 02:16 PM, Darryl Mocek wrote: >>> Hello. Please review this patch to fix the getting of the user's home >>> setting using System.getProperty("user.home") on UNIX's. The previous >>> implementation used getpwuid, which didn't allow the user to set the >>> value in the environment. >>> >>> Webrev, can be found here: >>> http://cr.openjdk.java.net/~darryl/7069190/webrev.00 >>> >>> Thanks, >>> Darryl From Lance.Andersen at oracle.com Thu Dec 1 02:56:55 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Wed, 30 Nov 2011 21:56:55 -0500 Subject: 7116722: Miscellaneous warnings sun.misc ( and related classes ) In-Reply-To: <4ED6AF69.9020605@oracle.com> References: <4ED65AEB.60200@oracle.com> <8B0B8C27-FBF0-4461-9FEC-E41C94682D04@oracle.com> <4ED6AF69.9020605@oracle.com> Message-ID: <4EED8009-947C-481F-B6CC-5BD8675E6795@oracle.com> looks OK to me On Nov 30, 2011, at 5:34 PM, chris hegarty wrote: > Thanks for all the feedback. > > changes: > - use diamond in JarIndex (style issue) > - sun.misc.Service -> java.util.ServiceLoader > in InetAddress and HttpServerProvider > - ExtensionDependency: suppress unchecked on declaration/assignment > > http://cr.openjdk.java.net/~chegar/7116722/webrev.01/webrev/ > > -Chris. > > On 30/11/2011 19:02, Lance Andersen - Oracle wrote: >> Hi Chris, >> >> Do you want to use diamond reference on lines 81, 82 of jarindex.java? >> >> In Signal.java, line 203, i do not think you need new Integer() any longer? >> >> Other than that it looks good >> >> Best >> Lance >> >> >> On Nov 30, 2011, at 11:33 AM, Chris Hegarty wrote: >> >>> I started to look at the reason why we suppressed unchecked warning >>> for sun.misc.Service in a few places, and this lead me into some other >>> sun.misc classes. Here's a change that fixes a few warnings in this area. >>> >>> http://cr.openjdk.java.net/~chegar/7116722/webrev.00/webrev/ >>> >>> -Chris. >> >> >> Lance Andersen| >> Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From sebastian.sickelmann at gmx.de Thu Dec 1 04:33:30 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Thu, 01 Dec 2011 05:33:30 +0100 Subject: Request for Review (Warning Cleanup java.io) Message-ID: <4ED7039A.2080903@gmx.de> Hi, i have a webrev[0] that contains some warning cleanup for java.io It is based on rev 7795c41ed54c http://hg.openjdk.java.net/jdk8/tl/jdk/ Some comments to the changes: ExpiringCache.java: Changed anonymous inner class to inner class with the intention to put serialversion inside of it. But serialver doesn't want to give my the serialver. I also think that ExpiringCache is not serializable but the warning was clear: the anonymous inner class is seriallizable and has no explicit serialversionuid. FilePermission.java: I have starred at the code between line 453 and 547 for over an hour, because i thought that there is a bug within the expression "i >= matchlen" in line 530 and the both "i != -1" in lines 457 and 461. But there is no bug. But i wanted to left this code slightly more readable. I introduced the method skipBeforePreviousComma to make it possible to work-around the fallthought warning with an return statement. This code-change need's some more review attention. Maybe we should split this up for another cleanup. I think the whole method needs some rewrite. Some classes had no change at all. Maybe webrev created them because there where changes in my history/branches. There were some patches from alan i saw to late. Maybe webrev is confused of the multiple merges. Can someone please create a CR for this and [0] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html From Alan.Bateman at oracle.com Thu Dec 1 09:07:18 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 09:07:18 +0000 Subject: Code Review Request for Bug #7069190 In-Reply-To: <4ED6ACD0.1020300@oracle.com> References: <4ED6AB44.5040108@oracle.com> <4ED6ACD0.1020300@oracle.com> Message-ID: <4ED743C6.8070609@oracle.com> On 30/11/2011 22:23, Darryl Mocek wrote: > Wrong webrev link. Here's the correct one: > http://cr.openjdk.java.net/~dmocek/7069190/webrev.00 As Sherman and David said, we need to think through any potential compatibility issues (it may be the right thing to do but is there any potential to break something?). Also should we be looking at LOGNAME or USER to get the value of the user.name property and so avoid looking up the password entry? We've had issues with folks with odd configurations where the value of the user.name or user.home properties defaults "?" when then run with a 32-bit JDK on a 64-bit system. One other thing is that we should try to include a test with all changes if possible. I think it should be possible here. -Alan. From stuart.marks at oracle.com Thu Dec 1 09:16:29 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 01:16:29 -0800 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7039A.2080903@gmx.de> References: <4ED7039A.2080903@gmx.de> Message-ID: <4ED745ED.6080409@oracle.com> Hi Sebastian, Thanks for submitting this patch! I've filed bug 7116890 to cover this set of changes. Regarding webrev, it probably does get confused by merges in the history. By default it tries to show differences between the tip of the target repository and tip + uncommitted changes in your local repository. This isn't always the right thing. One thing you might try is to use the -r option to specify a particular revision in the history against which to generate the diffs. But, having a few extra files isn't a big deal. On to your changes. Most of them are really good and are exactly the kind of simple change we're looking for, as I posted a little while ago. [1] The ExpiringCache.java case is an interesting one. I think it's possible to add a static serialVersionUID field within the anonymous class. It's hard to run serialver over an anonymous class (actually it might be possible to run the checksum algorithm on the loaded class) but if in practice it's never serialized, who cares what the "correct" value is? You could just use a value of 0L. An alternative would also be to use @SuppressWarnings("serial"). Since the constructor is so short, you could just put it on the constructor. Actually I prefer @SuppressWarnings, since adding serialVersionUID adds to the system's footprint. If it's never used, we shouldn't bother defining it. Given these alternatives, it's not necessary to create a static CacheHashMapImpl class. Regarding the FilePermission.java change, yes, I see that the skipBeforePreviousComma() change is problematic. I puzzled over it for a while too. I wish I had sent out the Coding Guideline [1] earlier; it might have saved you an hour. :-) Sorry about that. A cleanup/rewrite of this code would indeed be better done separate from Warnings Cleanup Day. But I think there might be a simple way to get rid of the warning without doing a cleanup or refactoring. The warning message in question is at line 535 of the original code, about falling through to the next case. But the next case doesn't actually do anything but break. Could we just change the /*FALLTHROUGH*/ comment to a break statement? I think that would fix the warning without changing the logic at all. s'marks [1] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: > Hi, > > i have a webrev[0] that contains some warning cleanup for java.io > It is based on rev 7795c41ed54c http://hg.openjdk.java.net/jdk8/tl/jdk/ > > Some comments to the changes: > > ExpiringCache.java: Changed anonymous inner class to inner class with the > intention to put serialversion inside of it. But serialver doesn't want to give > my the serialver. I also think that ExpiringCache is not serializable but the > warning was clear: the anonymous inner class is seriallizable and has no > explicit serialversionuid. > > FilePermission.java: I have starred at the code between line 453 and 547 for > over an hour, because i thought that there is a bug within the expression "i >= > matchlen" in line 530 and the both "i != -1" in lines 457 and 461. But there is > no bug. But i wanted to left this code slightly more readable. I introduced the > method skipBeforePreviousComma to make it possible to work-around the > fallthought warning with an return statement. This code-change need's some more > review attention. Maybe we should split this up for another cleanup. I think > the whole method needs some rewrite. > > Some classes had no change at all. Maybe webrev created them because there > where changes in my history/branches. There were some patches from alan i saw > to late. Maybe webrev is confused of the multiple merges. > > Can someone please create a CR for this and > > [0] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html > > From Alan.Bateman at oracle.com Thu Dec 1 10:20:39 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 10:20:39 +0000 Subject: 7116722: Miscellaneous warnings sun.misc ( and related classes ) In-Reply-To: <4ED6AF69.9020605@oracle.com> References: <4ED65AEB.60200@oracle.com> <8B0B8C27-FBF0-4461-9FEC-E41C94682D04@oracle.com> <4ED6AF69.9020605@oracle.com> Message-ID: <4ED754F7.5050606@oracle.com> On 30/11/2011 22:34, chris hegarty wrote: > Thanks for all the feedback. > > changes: > - use diamond in JarIndex (style issue) > - sun.misc.Service -> java.util.ServiceLoader > in InetAddress and HttpServerProvider > - ExtensionDependency: suppress unchecked on declaration/assignment > > http://cr.openjdk.java.net/~chegar/7116722/webrev.01/webrev/ Thanks for changing InetAddress and other place to use ServiceLoader (I realize this is straying outside of the simple warnings area but it's the right thing to do). Now I wonder if we should deprecate sun.misc.Service, looks like there are only two remaining usages in the JDK and nobody outside of the JDK should be using it. -Alan. From chris.hegarty at oracle.com Thu Dec 1 10:29:35 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 10:29:35 +0000 Subject: 7116722: Miscellaneous warnings sun.misc ( and related classes ) In-Reply-To: <4ED754F7.5050606@oracle.com> References: <4ED65AEB.60200@oracle.com> <8B0B8C27-FBF0-4461-9FEC-E41C94682D04@oracle.com> <4ED6AF69.9020605@oracle.com> <4ED754F7.5050606@oracle.com> Message-ID: <4ED7570F.6070705@oracle.com> On 01/12/2011 10:20, Alan Bateman wrote: > On 30/11/2011 22:34, chris hegarty wrote: >> Thanks for all the feedback. >> >> changes: >> - use diamond in JarIndex (style issue) >> - sun.misc.Service -> java.util.ServiceLoader >> in InetAddress and HttpServerProvider >> - ExtensionDependency: suppress unchecked on declaration/assignment >> >> http://cr.openjdk.java.net/~chegar/7116722/webrev.01/webrev/ > Thanks for changing InetAddress and other place to use ServiceLoader (I > realize this is straying outside of the simple warnings area but it's > the right thing to do). Now I wonder if we should deprecate > sun.misc.Service, looks like there are only two remaining usages in the > JDK and nobody outside of the JDK should be using it. Yes, I was thinking the same. Would you be ok if I push what I have in this webrev and work on moving the other usages of sun.misc.Service to ServiceLoader before possibly deprecating it? I'd like to get these changes in so others fixing warnings in sun.misc can sync up. -Chris. > > -Alan. From Alan.Bateman at oracle.com Thu Dec 1 10:46:33 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 10:46:33 +0000 Subject: 7116722: Miscellaneous warnings sun.misc ( and related classes ) In-Reply-To: <4ED7570F.6070705@oracle.com> References: <4ED65AEB.60200@oracle.com> <8B0B8C27-FBF0-4461-9FEC-E41C94682D04@oracle.com> <4ED6AF69.9020605@oracle.com> <4ED754F7.5050606@oracle.com> <4ED7570F.6070705@oracle.com> Message-ID: <4ED75B09.1060602@oracle.com> On 01/12/2011 10:29, Chris Hegarty wrote: > > Yes, I was thinking the same. Would you be ok if I push what I have in > this webrev and work on moving the other usages of sun.misc.Service to > ServiceLoader before possibly deprecating it? > > I'd like to get these changes in so others fixing warnings in sun.misc > can sync up. I think that's fine but I think we should remember to sort out these remaining sun.misc.Service usages and deprecate it in jdk8. On JavaUtilJarAccess then I assume this will be re-examined by whoever sorts out the warnings in java.util.jar. -Alan PS: Looks like 6514998 is someone asking for InetAddress to be changed to use ServiceLoader so that can probably be closed. From chris.hegarty at oracle.com Thu Dec 1 11:04:12 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 11:04:12 +0000 Subject: 7116722: Miscellaneous warnings sun.misc ( and related classes ) In-Reply-To: <4ED75B09.1060602@oracle.com> References: <4ED65AEB.60200@oracle.com> <8B0B8C27-FBF0-4461-9FEC-E41C94682D04@oracle.com> <4ED6AF69.9020605@oracle.com> <4ED754F7.5050606@oracle.com> <4ED7570F.6070705@oracle.com> <4ED75B09.1060602@oracle.com> Message-ID: <4ED75F2C.9040109@oracle.com> On 01/12/2011 10:46, Alan Bateman wrote: > On 01/12/2011 10:29, Chris Hegarty wrote: >> >> Yes, I was thinking the same. Would you be ok if I push what I have in >> this webrev and work on moving the other usages of sun.misc.Service to >> ServiceLoader before possibly deprecating it? >> >> I'd like to get these changes in so others fixing warnings in sun.misc >> can sync up. > I think that's fine but I think we should remember to sort out these > remaining sun.misc.Service usages and deprecate it in jdk8. On I filed CR 7116912: "Replace usage of sun.misc.Service with j.u.ServiceLoader and deprecate Service", for this. > JavaUtilJarAccess then I assume this will be re-examined by whoever > sorts out the warnings in java.util.jar. You mean List -> List, right? I think this is the generic type, rather than just giving it Object to keep it quiet! I followed it back SignatureFileVerifier.process(). Or did I miss something? > -Alan > > PS: Looks like 6514998 is someone asking for InetAddress to be changed > to use ServiceLoader so that can probably be closed. Great, this is a nice side effect. Thanks for finding this bug. -Chris. From chris.hegarty at oracle.com Thu Dec 1 13:02:25 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Thu, 01 Dec 2011 13:02:25 +0000 Subject: hg: jdk8/tl/jdk: 7116722: Miscellaneous warnings sun.misc ( and related classes ) Message-ID: <20111201130235.EF2FA474E1@hg.openjdk.java.net> Changeset: 3b8186aee592 Author: chegar Date: 2011-12-01 11:09 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3b8186aee592 7116722: Miscellaneous warnings sun.misc ( and related classes ) Reviewed-by: alanb, darcy, forax, hawtin, lancea ! src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java ! src/share/classes/java/net/InetAddress.java ! src/share/classes/java/util/jar/JarVerifier.java ! src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java ! src/share/classes/javax/script/ScriptEngineManager.java ! src/share/classes/sun/misc/BASE64Decoder.java ! src/share/classes/sun/misc/ExtensionDependency.java ! src/share/classes/sun/misc/JarIndex.java ! src/share/classes/sun/misc/JavaUtilJarAccess.java ! src/share/classes/sun/misc/ProxyGenerator.java ! src/share/classes/sun/misc/Service.java ! src/share/classes/sun/misc/Signal.java ! test/sun/misc/JarIndex/metaInfFilenames/Basic.java From chris.hegarty at oracle.com Thu Dec 1 15:07:45 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 15:07:45 +0000 Subject: 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers Message-ID: <4ED79841.9030307@oracle.com> This is a follow up to an issue that came up during discussion of another fix. Essentially, ScriptEngineManager should use j.u.ServiceLoader rather than sun.misc.Service. http://cr.openjdk.java.net/~chegar/7116957/webrev.00/webrev/ -Chris. P.S. and fix up imports in HttpServerProvider From maurizio.cimadamore at oracle.com Thu Dec 1 15:07:48 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Thu, 01 Dec 2011 15:07:48 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context Message-ID: <4ED79844.9050707@oracle.com> Hi, I tried to cleanup as many warnings as possible in java.beans/java.beans.context [1]. There were a few places (esp. in java.beans.context) in which I had to suppress rawtypes warnings as the raw types were in method signatures of what looked like public API. Feedback welcome. [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.0/ Maurizio From sean.mullan at oracle.com Thu Dec 1 15:12:22 2011 From: sean.mullan at oracle.com (Sean Mullan) Date: Thu, 01 Dec 2011 10:12:22 -0500 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4ECC7A87.1030604@gmx.de> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> Message-ID: <4ED79956.4020101@oracle.com> On 11/22/2011 11:45 PM, Sebastian Sickelmann wrote: > It's been a long time ago. > Had someone had the time to think about this: > > Am 29.10.2011 13:17, schrieb Sebastian Sickelmann: >> Sorry i linked the wrong webrev for Solution 3. >> >> Am 27.10.2011 16:50, schrieb Sebastian Sickelmann: >>> Some time ago (see below) i ask what would be the right solution to >>> refactor >>> exception initialization to? >>> >>> Solution 1: Disallow calls to initCause after creation, if there was an >>> exception-cause-functionality in this class before it was introduced >>> to Throwable. >>> Solution 2: Disallow calls to initCause after creation with in ctor >>> which has a cause parameter. >>> Solution 3: Disallow calls to initCause after creation, if and only >>> if there are ctors >>> that allows us to specify the cause at creation time. >>> >>> >>> If i investigated it right:: >>> * Solution 1 is used by in the Exceptions in core-libs. >>> * Exceptions that had no cause-chain prior to Throwable's-cause-chain >>> uses Solution 2. >>> * Personally i found Solution 3 is the most intuitive for the users >>> >>> javax/xml/security- Exceptions had cause-chaining prio to Throwable >>> introduces them. jx/x/s-Exceptions are actually not refactored to >>> solution 2 like the other exceptions in core-libs that had >>> cause-chaining prior to Throwable. >>> >>> Before my change-request for jx/x/s-Exceptions i changed some in >>> core-libs (InternalError and VirtualMachineError) to provide >>> exception-chaining. These use Solution 2 like all other exceptions >>> that provided exception-chaining after it where introduced by Throwable. >>> >>> My personal view of this is that i think it may be valueable to >>> change all to Solution 3 or at least merge all Solutions to one >>> Solution(maybe Solution 2) and get rid of Solution 1. >>> I created a webrev[0] for jx/x/s-Exceptions that implements Solution >>> 2 (this can be used for all those Exceptions that used Solution 1 too). webrev[0] looks like it is using Solution 1. Looking at the diffs for KeySelectorException, the ctors that don't supply cause parameters are still forbidden from subsequently calling initCause. >>> The problem with Solution 3 is that bahavoir compatibility is not given >>> and some code may break. Can you please explain what you think the compatibility issues are in more detail? I would also like to see the diffs for solution 2 before I give you my opinion. --Sean >>> And I created a webrev[1] for jx/x/s-Exceptions that implement >>> Solution 3 for comparision. >>> >>> [0] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>> >>> >> [1] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html >> > From Alan.Bateman at oracle.com Thu Dec 1 15:41:12 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 15:41:12 +0000 Subject: 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers In-Reply-To: <4ED79841.9030307@oracle.com> References: <4ED79841.9030307@oracle.com> Message-ID: <4ED7A018.800@oracle.com> On 01/12/2011 15:07, Chris Hegarty wrote: > This is a follow up to an issue that came up during discussion of > another fix. Essentially, ScriptEngineManager should use > j.u.ServiceLoader rather than sun.misc.Service. > > http://cr.openjdk.java.net/~chegar/7116957/webrev.00/webrev/ > > -Chris. > > P.S. and fix up imports in HttpServerProvider Looks fine to me. From Alan.Bateman at oracle.com Thu Dec 1 15:51:04 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 15:51:04 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED79844.9050707@oracle.com> References: <4ED79844.9050707@oracle.com> Message-ID: <4ED7A268.2040805@oracle.com> On 01/12/2011 15:07, Maurizio Cimadamore wrote: > Hi, > I tried to cleanup as many warnings as possible in > java.beans/java.beans.context [1]. There were a few places (esp. in > java.beans.context) in which I had to suppress rawtypes warnings as > the raw types were in method signatures of what looked like public > API. Feedback welcome. > > [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.0/ > > > Maurizio I don't know this area but I skimmed through the changes and don't see anything obviously wrong. The @SuppressWarnings("rawtypes") on java.beans.beancontext.BeanContext is a bit of a shock but as you say, this is the API. Can the scope of the suppressed unchecked in Introspector.getBeanInfo be reduced by using a temporary variable? -Alan From chris.hegarty at oracle.com Thu Dec 1 16:03:02 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 16:03:02 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED79844.9050707@oracle.com> References: <4ED79844.9050707@oracle.com> Message-ID: <4ED7A536.4070804@oracle.com> Looks good. Trivially, - NameGenerator.java L108 'size' could be an Integer and avoid subsequent cast. - SimpleBeanInfo.java L121, < PrivilegedAction --- > PrivilegedAction -Chris. On 01/12/2011 15:07, Maurizio Cimadamore wrote: > Hi, > I tried to cleanup as many warnings as possible in > java.beans/java.beans.context [1]. There were a few places (esp. in > java.beans.context) in which I had to suppress rawtypes warnings as the > raw types were in method signatures of what looked like public API. > Feedback welcome. > > [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.0/ > > > Maurizio From chris.hegarty at oracle.com Thu Dec 1 16:09:58 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 16:09:58 +0000 Subject: RFR 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers Message-ID: <4ED7A6D6.50905@oracle.com> This is a follow up to an issue that came up during discussion of another fix. Essentially, JDK classes should use j.u.ServiceLoader rather than sun.misc.Service. http://cr.openjdk.java.net/~chegar/7116946/webrev.00/webrev/ And a few warning cleanups, given the date that's in it ;-) Since getProviders is package private I assume it is ok to "generify". -Chris From Lance.Andersen at oracle.com Thu Dec 1 16:10:44 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Thu, 1 Dec 2011 11:10:44 -0500 Subject: RFR 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers In-Reply-To: <4ED7A6D6.50905@oracle.com> References: <4ED7A6D6.50905@oracle.com> Message-ID: Looks fine Chris On Dec 1, 2011, at 11:09 AM, Chris Hegarty wrote: > > This is a follow up to an issue that came up during discussion of another fix. Essentially, JDK classes should use j.u.ServiceLoader rather than sun.misc.Service. > > http://cr.openjdk.java.net/~chegar/7116946/webrev.00/webrev/ > > And a few warning cleanups, given the date that's in it ;-) Since getProviders is package private I assume it is ok to "generify". > > -Chris Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From chris.hegarty at oracle.com Thu Dec 1 16:17:35 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 16:17:35 +0000 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> Message-ID: <4ED7A89F.8000504@oracle.com> Skimming over this, I think it looks fine. -Chris. On 01/12/2011 01:46, Lance Andersen - Oracle wrote: > Here is another round of diffs as I found more warnings after I changed lint levels > > > http://cr.openjdk.java.net/~lancea/7116445/webrev.02/ > > For SQLOutputImpl.java, as I found no easy way to avoid the errors without changing the constructor generic types, I went the route of suppressing the warnings in each of the methods. This class is not used much if at all so I am not sure it is worth any more cycles currently. > > > Thanks for your time on the reviews... > > > Best > Lance > On Nov 30, 2011, at 3:58 PM, Stuart Marks wrote: > >> >> >> On 11/30/11 10:43 AM, Lance Andersen - Oracle wrote: >>> Hi Stuart, >>> >>> Thanks for the feedback. >> >> Great, thanks for the updates. Further comments below. >> >>>> * In CachedRowSetWriter.java, cols is changed from Vector to Vector. >>>> This is fine but there's now a redundant cast (Integer)cols.get(i) at line >>>> 752 that might generate another warning. >>> >>> I removed it now. btw, there was no warning generated with cast there which is >>> why I did not make the change initially. >> >> I'm not sure what the default compiler flags are for this portion of the build. I had done a full build of the jdk repo with your patch applied, using the following command, >> >> make JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL= OTHER_JAVACFLAGS="-Xmaxwarns 10000" >> >> and I did see that some redundant cast warnings were introduced. >> >>>> * WebRowSetXmlWriter.java, XmlReaderContentHandler.java, SQLInputImpl.java, >>>> and SyncFactory.java similar removals of redundant casts can be performed for >>>> types that have been converted to generics. >>> >>> I did not see the changes you were suggesting in SyncFactory but maybe I have >>> not had enough coffee :-), was there something specific you saw as I did not >>> see an obvious change to get rid of the couple of casts to the type that was >>> converted to use generics >> >> Oh yes, the SyncFactory one is different. Usually generifying a type will introduce redundant casts near calls to things like get(). The "implementations" field was generified, and I saw this: >> >> ProviderImpl impl = (ProviderImpl) implementations.get(providerID); >> >> which looked like a redundant cast. But the declared type is now Hashtable which means the cast isn't redundant, but it does raise a different set of questions. The "impl" local is only tested for being null so maybe its type should be SyncProvider instead. Oddly it doesn't appear to be used if it's non-null. Hm, this code has other issues as well... (A null return from Class.forName is handled, which AFAIK cannot occur; c.newInstance() is cast to SyncProvider but ClassCastException isn't handled.) >> >> Despite this I don't actually see any compiler warnings from this code. Since this is warnings cleanup day maybe we're done. :-) Perhaps further cleanups in this area can be deferred. >> >>>> You might also consider using diamond where new generic instances are >>>> created, though it's a matter of style whether to use diamond in an >>>> assignment statement (as opposed to in a declaration's initializer). >>> >>> Do we have a preference going forward? I used diamond as you suggested. >> >> My recommendation is to use diamond in field and local initializers and in simple assignment statements. I avoid diamond in parameters to method calls and within ternary (?:) expressions. >> >> Some people don't want to use diamond in assignment statements, since the redundancy isn't as obvious, and they think that having the type arguments in the constructor is helpful there. But I don't see it. >> >>> The updated webrev is at: http://cr.openjdk.java.net/~lancea/7116445/webrev.01/ >> >> Oh... one more thing. Sorry I missed this in my previous review. >> >> In SQLOutputImpl the constructor parameters got changed from Vector to Vector and from Map to Map>. This looks like a public constructor to a public API class. (At least, I see this in the javadoc.) This change might actually be correct (though perhaps not strictly compatible) but I don't think we want to be making such changes as part of warnings cleanup, even if it does end up removing warnings. >> >> s'marks >> > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > From sebastian.sickelmann at gmx.de Thu Dec 1 16:27:47 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Thu, 01 Dec 2011 17:27:47 +0100 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED745ED.6080409@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> Message-ID: <4ED7AB03.6000006@gmx.de> Am 01.12.2011 10:16, schrieb Stuart Marks: > Hi Sebastian, > > Thanks for submitting this patch! I've filed bug 7116890 to cover this > set of changes. > > Regarding webrev, it probably does get confused by merges in the > history. By default it tries to show differences between the tip of > the target repository and tip + uncommitted changes in your local > repository. This isn't always the right thing. One thing you might try > is to use the -r option to specify a particular revision in the > history against which to generate the diffs. But, having a few extra > files isn't a big deal. > > On to your changes. > > Most of them are really good and are exactly the kind of simple change > we're looking for, as I posted a little while ago. [1] > > The ExpiringCache.java case is an interesting one. I think it's > possible to add a static serialVersionUID field within the anonymous > class. It's hard to run serialver over an anonymous class (actually it > might be possible to run the checksum algorithm on the loaded class) > but if in practice it's never serialized, who cares what the "correct" > value is? You could just use a value of 0L. > > An alternative would also be to use @SuppressWarnings("serial"). Since > the constructor is so short, you could just put it on the constructor. > > Actually I prefer @SuppressWarnings, since adding serialVersionUID > adds to the system's footprint. If it's never used, we shouldn't > bother defining it. > > Given these alternatives, it's not necessary to create a static > CacheHashMapImpl class. > > Regarding the FilePermission.java change, yes, I see that the > skipBeforePreviousComma() change is problematic. I puzzled over it for > a while too. I wish I had sent out the Coding Guideline [1] earlier; > it might have saved you an hour. :-) Sorry about that. > > A cleanup/rewrite of this code would indeed be better done separate > from Warnings Cleanup Day. But I think there might be a simple way to > get rid of the warning without doing a cleanup or refactoring. The > warning message in question is at line 535 of the original code, about > falling through to the next case. But the next case doesn't actually > do anything but break. Could we just change the /*FALLTHROUGH*/ > comment to a break statement? I think that would fix the warning > without changing the logic at all. > > s'marks > > [1] > http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html > > > On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: >> Hi, >> >> i have a webrev[0] that contains some warning cleanup for java.io >> It is based on rev 7795c41ed54c http://hg.openjdk.java.net/jdk8/tl/jdk/ >> >> Some comments to the changes: >> >> ExpiringCache.java: Changed anonymous inner class to inner class with >> the >> intention to put serialversion inside of it. But serialver doesn't >> want to give >> my the serialver. I also think that ExpiringCache is not serializable >> but the >> warning was clear: the anonymous inner class is seriallizable and has no >> explicit serialversionuid. >> >> FilePermission.java: I have starred at the code between line 453 and >> 547 for >> over an hour, because i thought that there is a bug within the >> expression "i >= >> matchlen" in line 530 and the both "i != -1" in lines 457 and 461. >> But there is >> no bug. But i wanted to left this code slightly more readable. I >> introduced the >> method skipBeforePreviousComma to make it possible to work-around the >> fallthought warning with an return statement. This code-change need's >> some more >> review attention. Maybe we should split this up for another cleanup. >> I think >> the whole method needs some rewrite. >> >> Some classes had no change at all. Maybe webrev created them because >> there >> where changes in my history/branches. There were some patches from >> alan i saw >> to late. Maybe webrev is confused of the multiple merges. >> >> Can someone please create a CR for this and >> >> [0] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html >> >> >> Thanks for the good feedback. I splitted my change to the trivial part and will start discussion of FilePermission change on core-libs-dev after the cleanup event. I created a new webrev with the suggested changes here[2] [2] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html -- Sebastian From maurizio.cimadamore at oracle.com Thu Dec 1 16:33:07 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Thu, 01 Dec 2011 16:33:07 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED7A536.4070804@oracle.com> References: <4ED79844.9050707@oracle.com> <4ED7A536.4070804@oracle.com> Message-ID: <4ED7AC43.7040501@oracle.com> Updated version [1]. Changes: *) Beans.java:184 - generified PrivilegedAction *) Beans.java:284 - generified PrivilegedAction *) NameGenerator.java:108 - changed Object to Integer and removed following cast *) Introspector.java: added new fake local variable to reduce scope of @SuppressWarnings [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.1/ Maurizio On 01/12/11 16:03, Chris Hegarty wrote: > Looks good. > > Trivially, > - NameGenerator.java L108 > 'size' could be an Integer and avoid subsequent cast. > > - SimpleBeanInfo.java L121, > < PrivilegedAction > --- > > PrivilegedAction > > -Chris. > > On 01/12/2011 15:07, Maurizio Cimadamore wrote: >> Hi, >> I tried to cleanup as many warnings as possible in >> java.beans/java.beans.context [1]. There were a few places (esp. in >> java.beans.context) in which I had to suppress rawtypes warnings as the >> raw types were in method signatures of what looked like public API. >> Feedback welcome. >> >> [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.0/ >> >> >> Maurizio From chris.hegarty at oracle.com Thu Dec 1 16:39:58 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 01 Dec 2011 16:39:58 +0000 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7AB03.6000006@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> Message-ID: <4ED7ADDE.8000602@oracle.com> On 01/12/2011 16:27, Sebastian Sickelmann wrote: > .... > Thanks for the good feedback. > > I splitted my change to the trivial part and will start discussion of > FilePermission change on core-libs-dev after the cleanup event. > I created a new webrev with the suggested changes here[2] > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html Looks fine to me. -Chris. > > > -- Sebastian From Alan.Bateman at oracle.com Thu Dec 1 17:04:49 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 17:04:49 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED7AC43.7040501@oracle.com> References: <4ED79844.9050707@oracle.com> <4ED7A536.4070804@oracle.com> <4ED7AC43.7040501@oracle.com> Message-ID: <4ED7B3B1.3010909@oracle.com> On 01/12/2011 16:33, Maurizio Cimadamore wrote: > Updated version [1]. > > Changes: > > *) Beans.java:184 - generified PrivilegedAction > *) Beans.java:284 - generified PrivilegedAction > *) NameGenerator.java:108 - changed Object to Integer and removed > following cast > *) Introspector.java: added new fake local variable to reduce scope of > @SuppressWarnings > > [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.1/ > These changes look fine to me. Now the question is where to push this, jdk8/tl or jdk8/awt? My guess is that the beans activity these days is very low these days so if jdk8/awt doesn't see it for weeks then it wouldn't matter. Hopefully Sergey Malenkov will chime. -Alan From Alan.Bateman at oracle.com Thu Dec 1 17:15:11 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 17:15:11 +0000 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7AB03.6000006@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> Message-ID: <4ED7B61F.4050408@oracle.com> On 01/12/2011 16:27, Sebastian Sickelmann wrote: > : > Thanks for the good feedback. > > I splitted my change to the trivial part and will start discussion of > FilePermission change on core-libs-dev after the cleanup event. > I created a new webrev with the suggested changes here[2] > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html > > -- Sebastian In ExpiringCache L67-68 it looks like you are missing the type parameters. Also I assume we can change L119-120 to be for(String key: keySet) { ... } (I realize this is not strictly a warnings change). Otherwise I think it's okay. -Alan. From maurizio.cimadamore at oracle.com Thu Dec 1 17:24:24 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Thu, 01 Dec 2011 17:24:24 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED7B5B8.6000008@oracle.com> References: <4ED79844.9050707@oracle.com> <4ED7A536.4070804@oracle.com> <4ED7AC43.7040501@oracle.com> <4ED7B3B1.3010909@oracle.com> <4ED7B5B8.6000008@oracle.com> Message-ID: <4ED7B848.3020305@oracle.com> On 01/12/11 17:13, Andrey Pikalev wrote: > Typically JavaBeans changes went into Swing (now AWT) gate. I don't > think this really matter where to push this time assuming the changes > will be propagated to AWT repo in a few weeks. I'm thinking to push the changeset to TL - if you feel otherwise please let me know. Thanks Maurizio > > Thanks, > Andrey. > > On 12/1/2011 9:04 PM, Alan Bateman wrote: >> On 01/12/2011 16:33, Maurizio Cimadamore wrote: >>> Updated version [1]. >>> >>> Changes: >>> >>> *) Beans.java:184 - generified PrivilegedAction >>> *) Beans.java:284 - generified PrivilegedAction >>> *) NameGenerator.java:108 - changed Object to Integer and removed >>> following cast >>> *) Introspector.java: added new fake local variable to reduce scope of >>> @SuppressWarnings >>> >>> [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.1/ >>> >> These changes look fine to me. >> >> Now the question is where to push this, jdk8/tl or jdk8/awt? My guess is >> that the beans activity these days is very low these days so if jdk8/awt >> doesn't see it for weeks then it wouldn't matter. Hopefully Sergey >> Malenkov will chime. >> >> -Alan From philip.race at oracle.com Thu Dec 1 17:39:34 2011 From: philip.race at oracle.com (Phil Race) Date: Thu, 01 Dec 2011 09:39:34 -0800 Subject: [OpenJDK 2D-Dev] RFR 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers In-Reply-To: <4ED7A6D6.50905@oracle.com> References: <4ED7A6D6.50905@oracle.com> Message-ID: <4ED7BBD6.6090902@oracle.com> Looks good to me. I thought we'd squished all the uses of this internal class a long time ago. -phil. On 12/1/11 8:09 AM, Chris Hegarty wrote: > > This is a follow up to an issue that came up during discussion of > another fix. Essentially, JDK classes should use j.u.ServiceLoader > rather than sun.misc.Service. > > http://cr.openjdk.java.net/~chegar/7116946/webrev.00/webrev/ > > And a few warning cleanups, given the date that's in it ;-) Since > getProviders is package private I assume it is ok to "generify". > > -Chris From maurizio.cimadamore at oracle.com Thu Dec 1 18:35:55 2011 From: maurizio.cimadamore at oracle.com (maurizio.cimadamore at oracle.com) Date: Thu, 01 Dec 2011 18:35:55 +0000 Subject: hg: jdk8/tl/jdk: 7116954: Misc warnings in java.beans/java.beans.context Message-ID: <20111201183605.0D411474E9@hg.openjdk.java.net> Changeset: 89130611b178 Author: mcimadamore Date: 2011-12-01 18:34 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/89130611b178 7116954: Misc warnings in java.beans/java.beans.context Summary: Remove generic warnings form java.beans and java.beans.context Reviewed-by: alanb, chegar ! src/share/classes/java/beans/BeanDescriptor.java ! src/share/classes/java/beans/Beans.java ! src/share/classes/java/beans/ChangeListenerMap.java ! src/share/classes/java/beans/DefaultPersistenceDelegate.java ! src/share/classes/java/beans/Encoder.java ! src/share/classes/java/beans/EventHandler.java ! src/share/classes/java/beans/EventSetDescriptor.java ! src/share/classes/java/beans/FeatureDescriptor.java ! src/share/classes/java/beans/IndexedPropertyDescriptor.java ! src/share/classes/java/beans/Introspector.java ! src/share/classes/java/beans/MetaData.java ! src/share/classes/java/beans/MethodDescriptor.java ! src/share/classes/java/beans/NameGenerator.java ! src/share/classes/java/beans/PersistenceDelegate.java ! src/share/classes/java/beans/PropertyChangeSupport.java ! src/share/classes/java/beans/PropertyDescriptor.java ! src/share/classes/java/beans/PropertyEditorSupport.java ! src/share/classes/java/beans/ReflectionUtils.java ! src/share/classes/java/beans/SimpleBeanInfo.java ! src/share/classes/java/beans/Statement.java ! src/share/classes/java/beans/VetoableChangeSupport.java ! src/share/classes/java/beans/XMLEncoder.java ! src/share/classes/java/beans/beancontext/BeanContext.java ! src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java From sebastian.sickelmann at gmx.de Thu Dec 1 18:35:23 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Thu, 01 Dec 2011 19:35:23 +0100 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7B61F.4050408@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> Message-ID: <4ED7C8EB.4050103@gmx.de> Am 01.12.2011 18:15, schrieb Alan Bateman: > On 01/12/2011 16:27, Sebastian Sickelmann wrote: >> : >> Thanks for the good feedback. >> >> I splitted my change to the trivial part and will start discussion of >> FilePermission change on core-libs-dev after the cleanup event. >> I created a new webrev with the suggested changes here[2] >> >> [2] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html >> >> -- Sebastian > In ExpiringCache L67-68 it looks like you are missing the type > parameters. Also I assume we can change L119-120 to be for(String key: > keySet) { ... } (I realize this is not strictly a warnings change). > > Otherwise I think it's okay. > > -Alan. > > > Thanks Alan, L67-68 was a backporting (from a more complex solution to a small warning cleanup) issue. I missed the type parameters here. I changed L119-120 also. New webrev is here: http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html -- Sebastian From Lance.Andersen at oracle.com Thu Dec 1 19:52:39 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Thu, 1 Dec 2011 14:52:39 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4ED7A89F.8000504@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> Message-ID: Thank you for the review Chris. Once I hear back from Stuart, I will push these changes back. Best Lance On Dec 1, 2011, at 11:17 AM, Chris Hegarty wrote: > Skimming over this, I think it looks fine. > > -Chris. > > On 01/12/2011 01:46, Lance Andersen - Oracle wrote: >> Here is another round of diffs as I found more warnings after I changed lint levels >> >> >> http://cr.openjdk.java.net/~lancea/7116445/webrev.02/ >> >> For SQLOutputImpl.java, as I found no easy way to avoid the errors without changing the constructor generic types, I went the route of suppressing the warnings in each of the methods. This class is not used much if at all so I am not sure it is worth any more cycles currently. >> >> >> Thanks for your time on the reviews... >> >> >> Best >> Lance >> On Nov 30, 2011, at 3:58 PM, Stuart Marks wrote: >> >>> >>> >>> On 11/30/11 10:43 AM, Lance Andersen - Oracle wrote: >>>> Hi Stuart, >>>> >>>> Thanks for the feedback. >>> >>> Great, thanks for the updates. Further comments below. >>> >>>>> * In CachedRowSetWriter.java, cols is changed from Vector to Vector. >>>>> This is fine but there's now a redundant cast (Integer)cols.get(i) at line >>>>> 752 that might generate another warning. >>>> >>>> I removed it now. btw, there was no warning generated with cast there which is >>>> why I did not make the change initially. >>> >>> I'm not sure what the default compiler flags are for this portion of the build. I had done a full build of the jdk repo with your patch applied, using the following command, >>> >>> make JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL= OTHER_JAVACFLAGS="-Xmaxwarns 10000" >>> >>> and I did see that some redundant cast warnings were introduced. >>> >>>>> * WebRowSetXmlWriter.java, XmlReaderContentHandler.java, SQLInputImpl.java, >>>>> and SyncFactory.java similar removals of redundant casts can be performed for >>>>> types that have been converted to generics. >>>> >>>> I did not see the changes you were suggesting in SyncFactory but maybe I have >>>> not had enough coffee :-), was there something specific you saw as I did not >>>> see an obvious change to get rid of the couple of casts to the type that was >>>> converted to use generics >>> >>> Oh yes, the SyncFactory one is different. Usually generifying a type will introduce redundant casts near calls to things like get(). The "implementations" field was generified, and I saw this: >>> >>> ProviderImpl impl = (ProviderImpl) implementations.get(providerID); >>> >>> which looked like a redundant cast. But the declared type is now Hashtable which means the cast isn't redundant, but it does raise a different set of questions. The "impl" local is only tested for being null so maybe its type should be SyncProvider instead. Oddly it doesn't appear to be used if it's non-null. Hm, this code has other issues as well... (A null return from Class.forName is handled, which AFAIK cannot occur; c.newInstance() is cast to SyncProvider but ClassCastException isn't handled.) >>> >>> Despite this I don't actually see any compiler warnings from this code. Since this is warnings cleanup day maybe we're done. :-) Perhaps further cleanups in this area can be deferred. >>> >>>>> You might also consider using diamond where new generic instances are >>>>> created, though it's a matter of style whether to use diamond in an >>>>> assignment statement (as opposed to in a declaration's initializer). >>>> >>>> Do we have a preference going forward? I used diamond as you suggested. >>> >>> My recommendation is to use diamond in field and local initializers and in simple assignment statements. I avoid diamond in parameters to method calls and within ternary (?:) expressions. >>> >>> Some people don't want to use diamond in assignment statements, since the redundancy isn't as obvious, and they think that having the type arguments in the constructor is helpful there. But I don't see it. >>> >>>> The updated webrev is at: http://cr.openjdk.java.net/~lancea/7116445/webrev.01/ >>> >>> Oh... one more thing. Sorry I missed this in my previous review. >>> >>> In SQLOutputImpl the constructor parameters got changed from Vector to Vector and from Map to Map>. This looks like a public constructor to a public API class. (At least, I see this in the javadoc.) This change might actually be correct (though perhaps not strictly compatible) but I don't think we want to be making such changes as part of warnings cleanup, even if it does end up removing warnings. >>> >>> s'marks >>> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Alan.Bateman at oracle.com Thu Dec 1 20:38:14 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 01 Dec 2011 20:38:14 +0000 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7C8EB.4050103@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> <4ED7C8EB.4050103@gmx.de> Message-ID: <4ED7E5B6.7060004@oracle.com> On 01/12/2011 18:35, Sebastian Sickelmann wrote: > : > Thanks Alan, > L67-68 was a backporting (from a more complex solution to a small > warning cleanup) issue. I missed the type parameters here. > I changed L119-120 also. > > New webrev is here: > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html > Looks fine to me. -Alan. From stuart.marks at oracle.com Thu Dec 1 21:10:58 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 13:10:58 -0800 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> Message-ID: <4ED7ED62.6010203@oracle.com> Hi Lance, Thanks for your patience. I was doing a lot of organizing this morning and I'm finally getting back to reviewing. Overall the changeset looks fine. I have just a few questions. You might or might not want to make further changes, but in any case I'm OK if you were to go ahead and push. Items as follows: * CachedRowSetImpl.java line 4007: can unboxing be used here to replace "Integer.valueOf(0)" with simply "0"? This is done below at 4174. * Similar unboxing question at line 401 of CachedRowSetWriter.java * JdbcRowSetImpl.java and CachedRowSetReader.java: you added "break" in some switch statements here. This actually changes the behavior of the program and (probably) fixes a bug, in addition to removing warnings. I guess this is a bit out of bounds for Warnings Cleanup Day, but I think you have the prerogative to do this since you're the primary maintainer of this code. * Row.java has a change to use System.arraycopy(): again a bit much for warnings day but you have prerogative as the maintainer of this area. Thanks! s'marks On 12/1/11 11:52 AM, Lance Andersen - Oracle wrote: > Thank you for the review Chris. Once I hear back from Stuart, I will push these changes back. > > Best > Lance > On Dec 1, 2011, at 11:17 AM, Chris Hegarty wrote: > >> Skimming over this, I think it looks fine. >> >> -Chris. >> >> On 01/12/2011 01:46, Lance Andersen - Oracle wrote: >>> Here is another round of diffs as I found more warnings after I changed lint levels >>> >>> >>> http://cr.openjdk.java.net/~lancea/7116445/webrev.02/ >>> >>> For SQLOutputImpl.java, as I found no easy way to avoid the errors without changing the constructor generic types, I went the route of suppressing the warnings in each of the methods. This class is not used much if at all so I am not sure it is worth any more cycles currently. >>> >>> >>> Thanks for your time on the reviews... >>> >>> >>> Best >>> Lance >>> On Nov 30, 2011, at 3:58 PM, Stuart Marks wrote: >>> >>>> >>>> >>>> On 11/30/11 10:43 AM, Lance Andersen - Oracle wrote: >>>>> Hi Stuart, >>>>> >>>>> Thanks for the feedback. >>>> >>>> Great, thanks for the updates. Further comments below. >>>> >>>>>> * In CachedRowSetWriter.java, cols is changed from Vector to Vector. >>>>>> This is fine but there's now a redundant cast (Integer)cols.get(i) at line >>>>>> 752 that might generate another warning. >>>>> >>>>> I removed it now. btw, there was no warning generated with cast there which is >>>>> why I did not make the change initially. >>>> >>>> I'm not sure what the default compiler flags are for this portion of the build. I had done a full build of the jdk repo with your patch applied, using the following command, >>>> >>>> make JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL= OTHER_JAVACFLAGS="-Xmaxwarns 10000" >>>> >>>> and I did see that some redundant cast warnings were introduced. >>>> >>>>>> * WebRowSetXmlWriter.java, XmlReaderContentHandler.java, SQLInputImpl.java, >>>>>> and SyncFactory.java similar removals of redundant casts can be performed for >>>>>> types that have been converted to generics. >>>>> >>>>> I did not see the changes you were suggesting in SyncFactory but maybe I have >>>>> not had enough coffee :-), was there something specific you saw as I did not >>>>> see an obvious change to get rid of the couple of casts to the type that was >>>>> converted to use generics >>>> >>>> Oh yes, the SyncFactory one is different. Usually generifying a type will introduce redundant casts near calls to things like get(). The "implementations" field was generified, and I saw this: >>>> >>>> ProviderImpl impl = (ProviderImpl) implementations.get(providerID); >>>> >>>> which looked like a redundant cast. But the declared type is now Hashtable which means the cast isn't redundant, but it does raise a different set of questions. The "impl" local is only tested for being null so maybe its type should be SyncProvider instead. Oddly it doesn't appear to be used if it's non-null. Hm, this code has other issues as well... (A null return from Class.forName is handled, which AFAIK cannot occur; c.newInstance() is cast to SyncProvider but ClassCastException isn't handled.) >>>> >>>> Despite this I don't actually see any compiler warnings from this code. Since this is warnings cleanup day maybe we're done. :-) Perhaps further cleanups in this area can be deferred. >>>> >>>>>> You might also consider using diamond where new generic instances are >>>>>> created, though it's a matter of style whether to use diamond in an >>>>>> assignment statement (as opposed to in a declaration's initializer). >>>>> >>>>> Do we have a preference going forward? I used diamond as you suggested. >>>> >>>> My recommendation is to use diamond in field and local initializers and in simple assignment statements. I avoid diamond in parameters to method calls and within ternary (?:) expressions. >>>> >>>> Some people don't want to use diamond in assignment statements, since the redundancy isn't as obvious, and they think that having the type arguments in the constructor is helpful there. But I don't see it. >>>> >>>>> The updated webrev is at: http://cr.openjdk.java.net/~lancea/7116445/webrev.01/ >>>> >>>> Oh... one more thing. Sorry I missed this in my previous review. >>>> >>>> In SQLOutputImpl the constructor parameters got changed from Vector to Vector and from Map to Map>. This looks like a public constructor to a public API class. (At least, I see this in the javadoc.) This change might actually be correct (though perhaps not strictly compatible) but I don't think we want to be making such changes as part of warnings cleanup, even if it does end up removing warnings. >>>> >>>> s'marks >>>> >>> >>> >>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>> Oracle Java Engineering >>> 1 Network Drive >>> Burlington, MA 01803 >>> Lance.Andersen at oracle.com >>> > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > From brandon.passanisi at oracle.com Thu Dec 1 21:18:22 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Thu, 01 Dec 2011 13:18:22 -0800 Subject: Review Request for 7116997 (warning cleanup java.util.PropertyPermission) Message-ID: <4ED7EF1E.2050003@oracle.com> I have a webrev pertaining to the warning cleanup changes for java.util.PropertyPermission ready for review. Here's the info: Bug: 7116997 Webrev: http://cr.openjdk.java.net/~dmocek/bpassanisi/7116997/webrev.00/ Thanks. -- Oracle Brandon Passanisi | Principle Member of Technical Staff Oracle Java Standards Conformance Green Oracle Oracle is committed to developing practices and products that help protect the environment From Lance.Andersen at oracle.com Thu Dec 1 21:21:19 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Thu, 1 Dec 2011 16:21:19 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4ED7ED62.6010203@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> Message-ID: <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> Hi Stuart, On Dec 1, 2011, at 4:10 PM, Stuart Marks wrote: > Hi Lance, > > Thanks for your patience. I was doing a lot of organizing this morning and I'm finally getting back to reviewing. Totally understand. I appreciate your time on this as while some of this seems simple, it is a lot of files that are being touched :-) > > Overall the changeset looks fine. I have just a few questions. You might or might not want to make further changes, but in any case I'm OK if you were to go ahead and push. > > Items as follows: > > * CachedRowSetImpl.java line 4007: can unboxing be used here to replace "Integer.valueOf(0)" with simply "0"? This is done below at 4174. Yes it should be able to, i saw this after I hit send (too many passes through this last night. > > * Similar unboxing question at line 401 of CachedRowSetWriter.java Yes I saw this. > > * JdbcRowSetImpl.java and CachedRowSetReader.java: you added "break" in some switch statements here. This actually changes the behavior of the program and (probably) fixes a bug, in addition to removing warnings. I guess this is a bit out of bounds for Warnings Cleanup Day, but I think you have the prerogative to do this since you're the primary maintainer of this code. I got this as a warning and findbugs was also barking at me about this. The previous code was indeed buggy so I thought I would address it. > > * Row.java has a change to use System.arraycopy(): again a bit much for warnings day but you have prerogative as the maintainer of this area. Netbeans was gently suggesting this change and I was OK with it so I would prefer to leave it. I will make the couple changes above for the unboxing and generate 1 last webrev and then push it once I get the final green light... Best Lance > > Thanks! > > s'marks > > > > > > On 12/1/11 11:52 AM, Lance Andersen - Oracle wrote: >> Thank you for the review Chris. Once I hear back from Stuart, I will push these changes back. >> >> Best >> Lance >> On Dec 1, 2011, at 11:17 AM, Chris Hegarty wrote: >> >>> Skimming over this, I think it looks fine. >>> >>> -Chris. >>> >>> On 01/12/2011 01:46, Lance Andersen - Oracle wrote: >>>> Here is another round of diffs as I found more warnings after I changed lint levels >>>> >>>> >>>> http://cr.openjdk.java.net/~lancea/7116445/webrev.02/ >>>> >>>> For SQLOutputImpl.java, as I found no easy way to avoid the errors without changing the constructor generic types, I went the route of suppressing the warnings in each of the methods. This class is not used much if at all so I am not sure it is worth any more cycles currently. >>>> >>>> >>>> Thanks for your time on the reviews... >>>> >>>> >>>> Best >>>> Lance >>>> On Nov 30, 2011, at 3:58 PM, Stuart Marks wrote: >>>> >>>>> >>>>> >>>>> On 11/30/11 10:43 AM, Lance Andersen - Oracle wrote: >>>>>> Hi Stuart, >>>>>> >>>>>> Thanks for the feedback. >>>>> >>>>> Great, thanks for the updates. Further comments below. >>>>> >>>>>>> * In CachedRowSetWriter.java, cols is changed from Vector to Vector. >>>>>>> This is fine but there's now a redundant cast (Integer)cols.get(i) at line >>>>>>> 752 that might generate another warning. >>>>>> >>>>>> I removed it now. btw, there was no warning generated with cast there which is >>>>>> why I did not make the change initially. >>>>> >>>>> I'm not sure what the default compiler flags are for this portion of the build. I had done a full build of the jdk repo with your patch applied, using the following command, >>>>> >>>>> make JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL= OTHER_JAVACFLAGS="-Xmaxwarns 10000" >>>>> >>>>> and I did see that some redundant cast warnings were introduced. >>>>> >>>>>>> * WebRowSetXmlWriter.java, XmlReaderContentHandler.java, SQLInputImpl.java, >>>>>>> and SyncFactory.java similar removals of redundant casts can be performed for >>>>>>> types that have been converted to generics. >>>>>> >>>>>> I did not see the changes you were suggesting in SyncFactory but maybe I have >>>>>> not had enough coffee :-), was there something specific you saw as I did not >>>>>> see an obvious change to get rid of the couple of casts to the type that was >>>>>> converted to use generics >>>>> >>>>> Oh yes, the SyncFactory one is different. Usually generifying a type will introduce redundant casts near calls to things like get(). The "implementations" field was generified, and I saw this: >>>>> >>>>> ProviderImpl impl = (ProviderImpl) implementations.get(providerID); >>>>> >>>>> which looked like a redundant cast. But the declared type is now Hashtable which means the cast isn't redundant, but it does raise a different set of questions. The "impl" local is only tested for being null so maybe its type should be SyncProvider instead. Oddly it doesn't appear to be used if it's non-null. Hm, this code has other issues as well... (A null return from Class.forName is handled, which AFAIK cannot occur; c.newInstance() is cast to SyncProvider but ClassCastException isn't handled.) >>>>> >>>>> Despite this I don't actually see any compiler warnings from this code. Since this is warnings cleanup day maybe we're done. :-) Perhaps further cleanups in this area can be deferred. >>>>> >>>>>>> You might also consider using diamond where new generic instances are >>>>>>> created, though it's a matter of style whether to use diamond in an >>>>>>> assignment statement (as opposed to in a declaration's initializer). >>>>>> >>>>>> Do we have a preference going forward? I used diamond as you suggested. >>>>> >>>>> My recommendation is to use diamond in field and local initializers and in simple assignment statements. I avoid diamond in parameters to method calls and within ternary (?:) expressions. >>>>> >>>>> Some people don't want to use diamond in assignment statements, since the redundancy isn't as obvious, and they think that having the type arguments in the constructor is helpful there. But I don't see it. >>>>> >>>>>> The updated webrev is at: http://cr.openjdk.java.net/~lancea/7116445/webrev.01/ >>>>> >>>>> Oh... one more thing. Sorry I missed this in my previous review. >>>>> >>>>> In SQLOutputImpl the constructor parameters got changed from Vector to Vector and from Map to Map>. This looks like a public constructor to a public API class. (At least, I see this in the javadoc.) This change might actually be correct (though perhaps not strictly compatible) but I don't think we want to be making such changes as part of warnings cleanup, even if it does end up removing warnings. >>>>> >>>>> s'marks >>>>> >>>> >>>> >>>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>>> Oracle Java Engineering >>>> 1 Network Drive >>>> Burlington, MA 01803 >>>> Lance.Andersen at oracle.com >>>> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From stuart.marks at oracle.com Thu Dec 1 21:28:15 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 13:28:15 -0800 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> Message-ID: <4ED7F16F.9040205@oracle.com> On 12/1/11 1:21 PM, Lance Andersen - Oracle wrote: > I will make the couple changes above for the unboxing and generate 1 last > webrev and then push it once I get the final green light... Leaving in the breaks and the arraycopy is probably the right thing to do. I don't think you need to generate another webrev just for the unboxing changes. Or, if you do, don't wait for me to review it, just go ahead and push... I have enough other reviews to take care of today. Thanks again. s'marks From xueming.shen at oracle.com Thu Dec 1 21:47:30 2011 From: xueming.shen at oracle.com (Xueming Shen) Date: Thu, 01 Dec 2011 13:47:30 -0800 Subject: Code review request: 6907367 extcheck should skip non-jar files Message-ID: <4ED7F5F2.1040708@oracle.com> Please help review the change at http://cr.openjdk.java.net/~sherman/6907367/webrev The proposed change does not include the test case I was originally planed as showed at http://cr.openjdk.java.net/~sherman/6907367/webrev.00/test/com/sun/tools/extcheck/TestExtcheckArgs.java.sdiff.html The test case will failed if run against the current jdk8 build image because all those jar files still have their "specification-version" listed as "1.7", as ----------------------------------- Manifest-Version: 1.0 Implementation-Vendor: Oracle Corporation Implementation-Title: Java Runtime Environment Implementation-Version: 1.8.0-internal Specification-Vendor: Oracle Corporation Created-By: 1.7.0 (Oracle Corporation) Specification-Title: Java Platform API Specification Specification-Version: 1.7 ------------------------------------ in which case the test case fails when comparing the version. While I should be able to figure out "where and how" in those release makefiles to fix this, it appears all system jar files will be replaced bye "modules" in jdk8 anyway, the extcheck on system jar files will become much less relevant (as Alan suggested). So I decided to leave the test case out (I did run the test case manually to verify the fix). Thanks, Sherman From stuart.marks at oracle.com Thu Dec 1 22:13:47 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 14:13:47 -0800 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7E5B6.7060004@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> <4ED7C8EB.4050103@gmx.de> <4ED7E5B6.7060004@oracle.com> Message-ID: <4ED7FC1B.4090400@oracle.com> On 12/1/11 12:38 PM, Alan Bateman wrote: > On 01/12/2011 18:35, Sebastian Sickelmann wrote: >> : >> Thanks Alan, >> L67-68 was a backporting (from a more complex solution to a small warning >> cleanup) issue. I missed the type parameters here. >> I changed L119-120 also. >> >> New webrev is here: >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html >> > Looks fine to me. Hi Sebastian! The change looks fine to me too. I'll apply the patch, build it, and push it in. Thanks for your contribution! s'marks From brandon.passanisi at oracle.com Thu Dec 1 22:42:05 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Thu, 01 Dec 2011 14:42:05 -0800 Subject: Code Review Request for Bug #4802647 In-Reply-To: References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> Message-ID: <4ED802BD.3030407@oracle.com> Hi Jason. Thanks for your response. I was thinking about how I can improve the test using your suggestion. I could possibly do the following: 1. Find all of the subclasses of AbstractCollection which override removeAll(Collection) and which also contain the spec language which specifies that NullPointerException is thrown if the specified collection is null. 2. Find all of the subclasses of AbstractCollection which override retainAll(Collection) and which also contain the spec language which specifies that NullPointerException is thrown if the specified collection is null. 3. Add the classes found in #1 and #2 to the test. 4. If any of the new classes added because of #3 result in a test failure, it might be a good idea to file a new bug as Bug #4802647 specifically mentions subclasses of AbstractCollection which do not override remainAll, retainAll. 5. The public subclasses of AbstractCollection which do not override removeAll, retainAll (probably) shouldn't be included in the test as the currently existing NewAbstractCollection represents this scenario. What do you think? Thanks. On 11/30/2011 2:04 PM, Jason Mehrens wrote: > Brandon, > > > Are there any opinions on this from other Collections experts? > > >>>> http://cr.openjdk.java.net/~mduigou/4802647/0/webrev/ > > > Shouldn't the test include all collections included with the JDK? Any > override of these methods could repeat the same (bad) behavior. > > Jason -- Oracle Brandon Passanisi | Principle Member of Technical Staff Oracle Java Standards Conformance Green Oracle Oracle is committed to developing practices and products that help protect the environment From brandon.passanisi at oracle.com Thu Dec 1 22:54:19 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Thu, 01 Dec 2011 14:54:19 -0800 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7AB03.6000006@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> Message-ID: <4ED8059B.8040805@oracle.com> Hi Sebastian. I was speaking with Stuart Marks earlier today and he mentioned that the "fallthrough" code in FilePermission.java also exists in java.util.PropertyPermission.java. Maybe the code author had done some copy/paste when working on these files. Stuart had said that you might be planning on doing some work on this after the warnings cleanup work. If/when you do this work, maybe you can let me know so that I can sync the same changes you apply to FilePermission.java to PropertyPermission.java? Or, maybe you can apply the same changes yourself to PropertyPermission.java? Thanks. On 12/1/2011 8:27 AM, Sebastian Sickelmann wrote: > Am 01.12.2011 10:16, schrieb Stuart Marks: >> Hi Sebastian, >> >> Thanks for submitting this patch! I've filed bug 7116890 to cover >> this set of changes. >> >> Regarding webrev, it probably does get confused by merges in the >> history. By default it tries to show differences between the tip of >> the target repository and tip + uncommitted changes in your local >> repository. This isn't always the right thing. One thing you might >> try is to use the -r option to specify a particular revision in the >> history against which to generate the diffs. But, having a few extra >> files isn't a big deal. >> >> On to your changes. >> >> Most of them are really good and are exactly the kind of simple >> change we're looking for, as I posted a little while ago. [1] >> >> The ExpiringCache.java case is an interesting one. I think it's >> possible to add a static serialVersionUID field within the anonymous >> class. It's hard to run serialver over an anonymous class (actually >> it might be possible to run the checksum algorithm on the loaded >> class) but if in practice it's never serialized, who cares what the >> "correct" value is? You could just use a value of 0L. >> >> An alternative would also be to use @SuppressWarnings("serial"). >> Since the constructor is so short, you could just put it on the >> constructor. >> >> Actually I prefer @SuppressWarnings, since adding serialVersionUID >> adds to the system's footprint. If it's never used, we shouldn't >> bother defining it. >> >> Given these alternatives, it's not necessary to create a static >> CacheHashMapImpl class. >> >> Regarding the FilePermission.java change, yes, I see that the >> skipBeforePreviousComma() change is problematic. I puzzled over it >> for a while too. I wish I had sent out the Coding Guideline [1] >> earlier; it might have saved you an hour. :-) Sorry about that. >> >> A cleanup/rewrite of this code would indeed be better done separate >> from Warnings Cleanup Day. But I think there might be a simple way to >> get rid of the warning without doing a cleanup or refactoring. The >> warning message in question is at line 535 of the original code, >> about falling through to the next case. But the next case doesn't >> actually do anything but break. Could we just change the >> /*FALLTHROUGH*/ comment to a break statement? I think that would fix >> the warning without changing the logic at all. >> >> s'marks >> >> [1] >> http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html >> >> >> On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: >>> Hi, >>> >>> i have a webrev[0] that contains some warning cleanup for java.io >>> It is based on rev 7795c41ed54c http://hg.openjdk.java.net/jdk8/tl/jdk/ >>> >>> Some comments to the changes: >>> >>> ExpiringCache.java: Changed anonymous inner class to inner class >>> with the >>> intention to put serialversion inside of it. But serialver doesn't >>> want to give >>> my the serialver. I also think that ExpiringCache is not >>> serializable but the >>> warning was clear: the anonymous inner class is seriallizable and >>> has no >>> explicit serialversionuid. >>> >>> FilePermission.java: I have starred at the code between line 453 and >>> 547 for >>> over an hour, because i thought that there is a bug within the >>> expression "i >= >>> matchlen" in line 530 and the both "i != -1" in lines 457 and 461. >>> But there is >>> no bug. But i wanted to left this code slightly more readable. I >>> introduced the >>> method skipBeforePreviousComma to make it possible to work-around the >>> fallthought warning with an return statement. This code-change >>> need's some more >>> review attention. Maybe we should split this up for another cleanup. >>> I think >>> the whole method needs some rewrite. >>> >>> Some classes had no change at all. Maybe webrev created them because >>> there >>> where changes in my history/branches. There were some patches from >>> alan i saw >>> to late. Maybe webrev is confused of the multiple merges. >>> >>> Can someone please create a CR for this and >>> >>> [0] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html >>> >>> >>> > Thanks for the good feedback. > > I splitted my change to the trivial part and will start discussion of > FilePermission change on core-libs-dev after the cleanup event. > I created a new webrev with the suggested changes here[2] > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html > > -- Sebastian -- Oracle Brandon Passanisi | Principle Member of Technical Staff Oracle Java Standards Conformance Green Oracle Oracle is committed to developing practices and products that help protect the environment From stuart.marks at oracle.com Fri Dec 2 00:06:53 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 16:06:53 -0800 Subject: Review Request for 7116997 (warning cleanup java.util.PropertyPermission) In-Reply-To: <4ED7EF1E.2050003@oracle.com> References: <4ED7EF1E.2050003@oracle.com> Message-ID: <4ED8169D.7010605@oracle.com> On 12/1/11 1:18 PM, Brandon Passanisi wrote: > I have a webrev pertaining to the warning cleanup changes for > java.util.PropertyPermission ready for review. Here's the info: > > Bug: 7116997 > Webrev: > http://cr.openjdk.java.net/~dmocek/bpassanisi/7116997/webrev.00/ > Hi Brandon, Can you take out the @SuppressWarnings from the getMask() method, and change the /*FALLTHROUGH*/ comment at line 309 to "break" instead? I think this is equivalent code, and it will get rid of the warning message without having to suppress warnings. thanks. s'marks From stuart.marks at oracle.com Fri Dec 2 00:14:10 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Fri, 02 Dec 2011 00:14:10 +0000 Subject: hg: jdk8/tl/jdk: 7116890: additional warnings fixes for java.io Message-ID: <20111202001420.0DAB8474F8@hg.openjdk.java.net> Changeset: 0e3f706741ca Author: smarks Date: 2011-12-01 16:14 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/0e3f706741ca 7116890: additional warnings fixes for java.io Reviewed-by: alanb, smarks Contributed-by: Sebastian Sickelmann ! src/share/classes/java/io/ExpiringCache.java ! src/share/classes/java/io/LineNumberInputStream.java ! src/share/classes/java/io/LineNumberReader.java ! src/share/classes/java/io/ObjectOutputStream.java ! src/share/classes/java/io/RandomAccessFile.java From stuart.marks at oracle.com Fri Dec 2 00:22:58 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 01 Dec 2011 16:22:58 -0800 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED7FC1B.4090400@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> <4ED7C8EB.4050103@gmx.de> <4ED7E5B6.7060004@oracle.com> <4ED7FC1B.4090400@oracle.com> Message-ID: <4ED81A62.2080006@oracle.com> On 12/1/11 2:13 PM, Stuart Marks wrote: > On 12/1/11 12:38 PM, Alan Bateman wrote: >> On 01/12/2011 18:35, Sebastian Sickelmann wrote: >>> : >>> Thanks Alan, >>> L67-68 was a backporting (from a more complex solution to a small warning >>> cleanup) issue. I missed the type parameters here. >>> I changed L119-120 also. >>> >>> New webrev is here: >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html >>> >>> >> Looks fine to me. > > Hi Sebastian! > > The change looks fine to me too. I'll apply the patch, build it, and push it in. > > Thanks for your contribution! Well, turns out this patch had an error in it. :-( In ExpiringCache.java the constructor that takes a long parameter has code that looks like this: map = new LinkedHashMap<>() { ... } It turns out that it's illegal to use diamond in the construction of an anonymous class! Didn't you compile the code, Sebastian? :-) To be fair, neither of us reviewers caught this either. The compiler is the ultimate reviewer in this case. I've taken the liberty of expanding the type parameters to map = new LinkedHashMap() { ... } and I've gone ahead and pushed the changeset. Again, thanks for your contribution. s'marks From joe.darcy at oracle.com Fri Dec 2 00:42:36 2011 From: joe.darcy at oracle.com (Joseph Darcy) Date: Thu, 01 Dec 2011 16:42:36 -0800 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED81A62.2080006@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> <4ED7C8EB.4050103@gmx.de> <4ED7E5B6.7060004@oracle.com> <4ED7FC1B.4090400@oracle.com> <4ED81A62.2080006@oracle.com> Message-ID: <4ED81EFC.3010702@oracle.com> On 12/1/2011 4:22 PM, Stuart Marks wrote: > On 12/1/11 2:13 PM, Stuart Marks wrote: >> On 12/1/11 12:38 PM, Alan Bateman wrote: >>> On 01/12/2011 18:35, Sebastian Sickelmann wrote: >>>> : >>>> Thanks Alan, >>>> L67-68 was a backporting (from a more complex solution to a small >>>> warning >>>> cleanup) issue. I missed the type parameters here. >>>> I changed L119-120 also. >>>> >>>> New webrev is here: >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html >>>> >>>> >>>> >>> Looks fine to me. >> >> Hi Sebastian! >> >> The change looks fine to me too. I'll apply the patch, build it, and >> push it in. >> >> Thanks for your contribution! > > Well, turns out this patch had an error in it. :-( In > ExpiringCache.java the constructor that takes a long parameter has > code that looks like this: > > map = new LinkedHashMap<>() { ... } > > It turns out that it's illegal to use diamond in the construction of > an anonymous class! Didn't you compile the code, Sebastian? :-) To be > fair, neither of us reviewers caught this either. The compiler is the > ultimate reviewer in this case. FYI, the reason diamond cannot be used for anonymous class constructors is that doing so would require a change the the JVM signature attribute, a de factor JVM change that was out of scope for Project Coin. -Joe From joe.darcy at oracle.com Fri Dec 2 00:56:48 2011 From: joe.darcy at oracle.com (Joseph Darcy) Date: Thu, 01 Dec 2011 16:56:48 -0800 Subject: Request for Review: 7094995: test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java causes continuous GC in agentvm mode In-Reply-To: <1322133328.31325.33.camel@chalkhill> References: <1321962703.7372.22.camel@chalkhill> <4ECC8B63.8070000@oracle.com> <4ECD204B.2090208@oracle.com> <4ECD9C38.5090603@oracle.com> <1322133328.31325.33.camel@chalkhill> Message-ID: <4ED82250.5060204@oracle.com> On 11/24/2011 3:15 AM, Neil Richards wrote: > On Thu, 2011-11-24 at 11:22 +1000, David Holmes wrote: >> Hi Joe, >> >> On 24/11/2011 2:33 AM, Joe Darcy wrote: >>> On 11/22/2011 9:57 PM, David Holmes wrote: >>>> On 22/11/2011 9:51 PM, Neil Richards wrote: >>>>> I've also converted the testcase's use of ZipFile, ZipOutputStream& >>>>> FileOutputStream to use ARM (for greater clarity). >>>> I think proper use of ARM requires that this: >>>> >>>> 66 try (ZipOutputStream zos = >>>> 67 new ZipOutputStream(new FileOutputStream(tempZipFile))) { >>>> >>>> be written as: >>>> >>>> try (FileOutputStream fos = new FileOutputStream(tempZipFile); >>>> ZipOutputStream zos = new ZipOutputStream(fos)) { >>>> >>> The more conservative approach is to define one resource variable per >>> logical resource even if the one resource is "wrapped" by the second >>> one, as in the second example. This does close the small window of >>> vulnerability between when the first constructor call ends and the >>> second one completes. However, if that pattern is used, it is important >>> for the close method of the inner resource to be idempotent, as required >>> by the java.io.Closeable type but *not* required by >>> java.lang.AutoCloseable. >> Sorry but I couldn't quite tell what you were recommending there. Is the >> original code or my change the preferred approach? As I understood it >> the original code would not close the FileOutputStream if the >> ZipOutputStream constructor threw an exception. >> >> Thanks, >> David > In this instance, I think separating the allocations out into separate > statements in the ARM's try is fine, because both FileOutputStream and > ZipOutputStream are Closeable, and therefore have idempotent [1] close() > methods. (They're obviously also both AutoCloseable, to be used by ARM > in the first place). > > ----- > > Consider, however, if FileOutputStream were not Closeable, and therefore > didn't guarantee the idempotency of its close(). > > (It might then do something like throw an Exception if close() is called > for a second time.) > > Then the decision to have it auto-closed by ARM would hinge upon whether > the call to ZipOutputStream's close() causes a close() call to be made > to the (File)OutputStream it holds. > > If it does, one would not want to use ARM to (also) call the > (non-Closeable) FileOutputStream's close(), as it would run the risk of > seeing non-idempotent behaviour (eg. an Exception thrown). > > ----- > > However, coming back to reality, both objects _are_ Closeable, and so > _do_ have idempotent close() methods. > > Therefore it's both safe to have them both handled by ARM, and (I'd > argue) clearer to do so, as it's then clear both objects _do_ get > closed, without having to consider the finer details of > ZipOutputStream.close(). > > I believe Joe was defining the considerations needed when making such a > modification in the general case. > > (Joe, please correct me if I misinterpreted this). That is correct; I was noting some subtle considerations for the more general case. When both resources are java.io.Closeable, the most robust pattern is to have one resource variable declared for each resource. -Joe From david.holmes at oracle.com Fri Dec 2 02:03:06 2011 From: david.holmes at oracle.com (David Holmes) Date: Fri, 02 Dec 2011 12:03:06 +1000 Subject: webrevs.2 for macosx changes to jdk7u-osx In-Reply-To: <4ED82A36.7030400@oracle.com> References: <4ED77C17.8060003@oracle.com> <4ED7B560.1010606@oracle.com> <4ED7F3D0.2050106@oracle.com> <4ED824DA.2000600@oracle.com> <4ED82A36.7030400@oracle.com> Message-ID: <4ED831DA.8090609@oracle.com> On 2/12/2011 11:30 AM, Paul Hohensee wrote: > I agree. Be a good idea to ask for review from all the affected teams. > I _think_ core libs is the only one we missed, though. My concern is that there are a number of platform specific changes being made to java.* and javax.* classes (there are changes to sun.* as well but that is less of a concern). http://cr.openjdk.java.net/~michaelm/7113349/4/jdk7u-osx/modified/ I would hope that we could find a way to not have to make platform specific changes to such classes, and we need to be sure that the proposed changes do not impact other platforms either in terms of functionality or performance. Thanks, David > Paul > > On 12/1/11 8:07 PM, David Holmes wrote: >> On 2/12/2011 7:38 AM, Dalibor Topic wrote: >>> On 12/1/11 6:12 PM, Michael McMahon wrote: >>>> Kelly, >>>> >>>> Yes, that is correct. This push is initially just for jdk7u-osx, which >>>> is a development forest. I'm not sure exactly what the procedure >>>> will be yet >>>> for the push into jdk7u-dev. >>> >>> There is no special procedure for pushing into jdk7u-osx that's >>> different from >>> the one for jdk7u-dev. You need to submit a bulk change request for >>> approval first, >>> someone (i.e. either me or Edvard) needs to approve it, then the push >>> can happen >>> - regardless whether that's jdk7u-dev or jdk7u-osx. >> >> All the osx porting work is being discussed on the macosx-port-dev >> mailing list. Most core-libs subscribers will not be on that list >> (including me - which means my cc to that list will either bounce or >> get held up). There are proposed changes to core Java classes that >> should be explicitly reviewed and approved by the core-libs folk in my >> opinion. >> >> David From Lance.Andersen at oracle.com Fri Dec 2 03:08:57 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Thu, 1 Dec 2011 22:08:57 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4ED7F16F.9040205@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> Message-ID: <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> Sadly, once i start digging, i found more changes :-( Here are the latest revisions with the additions/changes since the last review, http://cr.openjdk.java.net/~lancea/7116445/webrev.03: The modified files since the last diff: src/share/classes/com/sun/rowset: CachedRowSetImpl.java JdbcRowSetResourceBundle.java FilteredRowSetImpl.java JoinRowSetImpl.java WebRowSetImpl.java src/share/classes/com/sun/rowset: CachedRowSetWriter.java WebRowSetXmlWriter.java XmlReaderContentHandler.java SyncResolverImpl.java src/javax/sql/rowset/spi: RowSetMetaDataImpl.java RowSetProvider.java SQLInputImpl.java ---- SQLOutputImpl.java src/javax/sql/rowset/: StatementEvent.java BaseRowSet.java src/javax/sql/rowset/spi: SyncFactory.java Best, Lance On Dec 1, 2011, at 4:28 PM, Stuart Marks wrote: > On 12/1/11 1:21 PM, Lance Andersen - Oracle wrote: >> I will make the couple changes above for the unboxing and generate 1 last >> webrev and then push it once I get the final green light... > > Leaving in the breaks and the arraycopy is probably the right thing to do. > > I don't think you need to generate another webrev just for the unboxing changes. Or, if you do, don't wait for me to review it, just go ahead and push... I have enough other reviews to take care of today. > > Thanks again. > > s'marks Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From sebastian.sickelmann at gmx.de Fri Dec 2 05:54:25 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Fri, 02 Dec 2011 06:54:25 +0100 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4ED79956.4020101@oracle.com> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> Message-ID: <4ED86811.4090804@gmx.de> Am 01.12.2011 16:12, schrieb Sean Mullan: > On 11/22/2011 11:45 PM, Sebastian Sickelmann wrote: >> It's been a long time ago. >> Had someone had the time to think about this: >> >> Am 29.10.2011 13:17, schrieb Sebastian Sickelmann: >>> Sorry i linked the wrong webrev for Solution 3. >>> >>> Am 27.10.2011 16:50, schrieb Sebastian Sickelmann: >>>> Some time ago (see below) i ask what would be the right solution to >>>> refactor >>>> exception initialization to? >>>> >>>> Solution 1: Disallow calls to initCause after creation, if there >>>> was an >>>> exception-cause-functionality in this class before it was introduced >>>> to Throwable. >>>> Solution 2: Disallow calls to initCause after creation with in ctor >>>> which has a cause parameter. >>>> Solution 3: Disallow calls to initCause after creation, if and only >>>> if there are ctors >>>> that allows us to specify the cause at creation time. >>>> >>>> >>>> If i investigated it right:: >>>> * Solution 1 is used by in the Exceptions in core-libs. >>>> * Exceptions that had no cause-chain prior to Throwable's-cause-chain >>>> uses Solution 2. >>>> * Personally i found Solution 3 is the most intuitive for the users >>>> >>>> javax/xml/security- Exceptions had cause-chaining prio to Throwable >>>> introduces them. jx/x/s-Exceptions are actually not refactored to >>>> solution 2 like the other exceptions in core-libs that had >>>> cause-chaining prior to Throwable. >>>> >>>> Before my change-request for jx/x/s-Exceptions i changed some in >>>> core-libs (InternalError and VirtualMachineError) to provide >>>> exception-chaining. These use Solution 2 like all other exceptions >>>> that provided exception-chaining after it where introduced by >>>> Throwable. >>>> >>>> My personal view of this is that i think it may be valueable to >>>> change all to Solution 3 or at least merge all Solutions to one >>>> Solution(maybe Solution 2) and get rid of Solution 1. >>>> I created a webrev[0] for jx/x/s-Exceptions that implements Solution >>>> 2 (this can be used for all those Exceptions that used Solution 1 >>>> too). > > webrev[0] looks like it is using Solution 1. Looking at the diffs for > KeySelectorException, the ctors that don't supply cause parameters are > still forbidden from subsequently calling initCause. > > >>> The problem with Solution 3 is that bahavoir compatibility is not > given > >>> and some code may break. > > Can you please explain what you think the compatibility issues are in > more detail? > > I would also like to see the diffs for solution 2 before I give you my > opinion. > > --Sean > > > >>>> And I created a webrev[1] for jx/x/s-Exceptions that implement >>>> Solution 3 for comparision. >>>> >>>> [0] >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>>> >>>> >>>> >>> [1] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html >>> >>> >> > The 3 solutions I mentioned are solutions that can be commonly discussed for a solution choosing for all Exceptions in OpenJDK. Webrev[0] shows solution 1 for jx/x/s-Exceptions. From the users perspective (outside view) solution 1 and 3 are completely similar. Solution 2 are used widely in jdk codebase in Exceptions that had no chaining before it was introduced globally throught java/lang/Throwable. An Example for Solution2 is java/lang/RuntimeException. An webrev that show this jx/x/s-Exception is webrev[1] Solution 3 is actually not used by any Exception in JDK (or I haven't found them) The problem i see is that we now have 2 ways exception-chaining might work. * Solution 1 disallows chaining after creation. * Solution 2 disallows chaining only after creation with an ctors that supports it or after a call to initCause. We should only support one solution. If we introduce the commonly used exception-ctors for every class (which i actually try) we can switch over to an solutions that is consistent for the user. I think every Exception that gives the user the choice to use exception-chaining via a ctor-variant that supports chaining should disallow changes of the exception-chain via initCause even when the exception is created with an ctor that doesn't had chaining parameters. This is what i call Solution 3. Unfortunately Solution 3 introduces an behavior-incompatibility. In JDK every think is fine and we can make all the changes that are needed to do (replace all initCause calls with the right ctor-choice). But in the outside world there maybe users that rely on the feature of plumbing up the exception chain after creation. Those will get an Exception when they call initCause. Maybe we can warn them to not use initCause anymore through marking initCause deprecated. And switch over to solution 3 over several releases (maybe OpenJDK9 or 10) Sorry for the misleading webrev-mappings in my previous mails. Hope to cleared thinks up now (with my wired english ;-) ). -- Sebastian [0] Solution 1 http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html [1] Solution 2 http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html From yuka.kamiya at oracle.com Fri Dec 2 07:10:52 2011 From: yuka.kamiya at oracle.com (yuka.kamiya at oracle.com) Date: Fri, 02 Dec 2011 07:10:52 +0000 Subject: hg: jdk8/tl/jdk: 7056472: Speed up test/java/util/ResourceBundle/Control/ExpirationTest.sh Message-ID: <20111202071112.F40AC47513@hg.openjdk.java.net> Changeset: b03da32c3186 Author: peytoia Date: 2011-12-02 16:09 +0900 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/b03da32c3186 7056472: Speed up test/java/util/ResourceBundle/Control/ExpirationTest.sh Reviewed-by: okutsu - test/java/util/ResourceBundle/Control/ExpirationTest.java - test/java/util/ResourceBundle/Control/ExpirationTest.sh From david.holmes at oracle.com Fri Dec 2 07:13:40 2011 From: david.holmes at oracle.com (David Holmes) Date: Fri, 02 Dec 2011 17:13:40 +1000 Subject: webrevs.2 for macosx changes to jdk7u-osx In-Reply-To: References: <4ED77C17.8060003@oracle.com> <4ED7B560.1010606@oracle.com> <4ED7F3D0.2050106@oracle.com> <4ED824DA.2000600@oracle.com> <4ED82A36.7030400@oracle.com> <4ED831DA.8090609@oracle.com> Message-ID: <4ED87AA4.3030500@oracle.com> On 2/12/2011 4:56 PM, Henri Gomez wrote: > Where is the Mercurial URL for jdk7u-osx ? Same place as all the other repos :) http://hg.openjdk.java.net/jdk7u/jdk7u-osx/ David > 2011/12/2 David Holmes: >> >> >> >> On 2/12/2011 11:30 AM, Paul Hohensee wrote: >>> >>> I agree. Be a good idea to ask for review from all the affected teams. >>> I _think_ core libs is the only one we missed, though. >> >> >> My concern is that there are a number of platform specific changes being >> made to java.* and javax.* classes (there are changes to sun.* as well but >> that is less of a concern). >> >> http://cr.openjdk.java.net/~michaelm/7113349/4/jdk7u-osx/modified/ >> >> I would hope that we could find a way to not have to make platform specific >> changes to such classes, and we need to be sure that the proposed changes do >> not impact other platforms either in terms of functionality or performance. >> >> Thanks, >> David >> >> >>> Paul >>> >>> On 12/1/11 8:07 PM, David Holmes wrote: >>>> >>>> On 2/12/2011 7:38 AM, Dalibor Topic wrote: >>>>> >>>>> On 12/1/11 6:12 PM, Michael McMahon wrote: >>>>>> >>>>>> Kelly, >>>>>> >>>>>> Yes, that is correct. This push is initially just for jdk7u-osx, which >>>>>> is a development forest. I'm not sure exactly what the procedure >>>>>> will be yet >>>>>> for the push into jdk7u-dev. >>>>> >>>>> >>>>> There is no special procedure for pushing into jdk7u-osx that's >>>>> different from >>>>> the one for jdk7u-dev. You need to submit a bulk change request for >>>>> approval first, >>>>> someone (i.e. either me or Edvard) needs to approve it, then the push >>>>> can happen >>>>> - regardless whether that's jdk7u-dev or jdk7u-osx. >>>> >>>> >>>> All the osx porting work is being discussed on the macosx-port-dev >>>> mailing list. Most core-libs subscribers will not be on that list >>>> (including me - which means my cc to that list will either bounce or >>>> get held up). There are proposed changes to core Java classes that >>>> should be explicitly reviewed and approved by the core-libs folk in my >>>> opinion. >>>> >>>> David From yuka.kamiya at oracle.com Fri Dec 2 07:51:22 2011 From: yuka.kamiya at oracle.com (Yuka Kamiya) Date: Fri, 02 Dec 2011 16:51:22 +0900 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) Message-ID: <4ED8837A.1030300@oracle.com> Hello, Could someone please review this fix? http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ Some warnings are still issued even after this fix, and that's intentional. I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. The original number of warnings in this area was 70. Now 16. Thanks, -- Yuka Kamiya From Alan.Bateman at oracle.com Fri Dec 2 09:37:44 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 02 Dec 2011 09:37:44 +0000 Subject: webrevs.2 for macosx changes to jdk7u-osx In-Reply-To: <4ED831DA.8090609@oracle.com> References: <4ED77C17.8060003@oracle.com> <4ED7B560.1010606@oracle.com> <4ED7F3D0.2050106@oracle.com> <4ED824DA.2000600@oracle.com> <4ED82A36.7030400@oracle.com> <4ED831DA.8090609@oracle.com> Message-ID: <4ED89C68.8020707@oracle.com> On 02/12/2011 02:03, David Holmes wrote: > : > My concern is that there are a number of platform specific changes > being made to java.* and javax.* classes (there are changes to sun.* > as well but that is less of a concern). > > http://cr.openjdk.java.net/~michaelm/7113349/4/jdk7u-osx/modified/ > > I would hope that we could find a way to not have to make platform > specific changes to such classes, and we need to be sure that the > proposed changes do not impact other platforms either in terms of > functionality or performance. I agree and I mentioned a couple of these in a recent mail [1]. However, jdk7u/jdk7u-osx is just an integration forest so they can be worked on there before the port is pushed up to jdk7u/jdk7u. -Alan. [1] http://mail.openjdk.java.net/pipermail/macosx-port-dev/2011-November/001498.html From Alan.Bateman at oracle.com Fri Dec 2 10:34:08 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 02 Dec 2011 10:34:08 +0000 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4ED802BD.3030407@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> <4ED802BD.3030407@oracle.com> Message-ID: <4ED8A9A0.3000808@oracle.com> On 01/12/2011 22:42, Brandon Passanisi wrote: > Hi Jason. Thanks for your response. I was thinking about how I can > improve the test using your suggestion. I could possibly do the > following: > > 1. Find all of the subclasses of AbstractCollection which override > removeAll(Collection) and which also contain the spec language > which specifies that NullPointerException is thrown if the specified > collection is null. > > 2. Find all of the subclasses of AbstractCollection which override > retainAll(Collection) and which also contain the spec language > which specifies that NullPointerException is thrown if the specified > collection is null. > > 3. Add the classes found in #1 and #2 to the test. > > 4. If any of the new classes added because of #3 result in a test > failure, it might be a good idea to file a new bug as Bug #4802647 > specifically mentions subclasses of AbstractCollection which do not > override remainAll, retainAll. > > 5. The public subclasses of AbstractCollection which do not override > removeAll, retainAll (probably) shouldn't be included in the test as > the currently existing NewAbstractCollection represents this scenario. > > What do you think? > Brandon - it's probably worth getting familiar with the existing tests, in in particular Martin's "Mother Of All Test" (Collection/MOAT.java). -Alan. From maurizio.cimadamore at oracle.com Fri Dec 2 10:58:09 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Fri, 02 Dec 2011 10:58:09 +0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED8A905.70006@oracle.com> References: <4ED79844.9050707@oracle.com> <4ED7A536.4070804@oracle.com> <4ED7AC43.7040501@oracle.com> <4ED7B3B1.3010909@oracle.com> <4ED7B5B8.6000008@oracle.com> <4ED8A905.70006@oracle.com> Message-ID: <4ED8AF41.3070608@oracle.com> On 02/12/11 10:31, Sergey Malenkov wrote: > I approve changes with a small update. > > java/beans/VetoableChangeSupport.java: > > - Hashtable children = > (Hashtable) fields.get("children", null); > + @SuppressWarnings("unchecked") > + Hashtable children = > (Hashtable)fields.get("children", null); > > There is not necessary to remove a space because of the Java code > conventions: > http://www.oracle.com/technetwork/java/codeconventions-141388.html#682 > > It is preferable to use the jdk8/awt ws, because the jdk8/swing one is > not supported anymore. I think that the jdk8/tl ws is also fine to push. I already pushed the changeset as it was - if you'd like me to go back and fix the whitespace issue, let me know. Thanks Maurizio > > Thanks, > SAM > > On 01.12.2011 21:13, Andrey Pikalev wrote: >> Typically JavaBeans changes went into Swing (now AWT) gate. I don't >> think this really matter where to push this time assuming the changes >> will be propagated to AWT repo in a few weeks. >> >> Thanks, >> Andrey. >> >> On 12/1/2011 9:04 PM, Alan Bateman wrote: >>> On 01/12/2011 16:33, Maurizio Cimadamore wrote: >>>> Updated version [1]. >>>> >>>> Changes: >>>> >>>> *) Beans.java:184 - generified PrivilegedAction >>>> *) Beans.java:284 - generified PrivilegedAction >>>> *) NameGenerator.java:108 - changed Object to Integer and removed >>>> following cast >>>> *) Introspector.java: added new fake local variable to reduce scope of >>>> @SuppressWarnings >>>> >>>> [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.1/ >>>> >>> These changes look fine to me. >>> >>> Now the question is where to push this, jdk8/tl or jdk8/awt? My >>> guess is >>> that the beans activity these days is very low these days so if >>> jdk8/awt >>> doesn't see it for weeks then it wouldn't matter. Hopefully Sergey >>> Malenkov will chime. >>> >>> -Alan From schlosna at gmail.com Fri Dec 2 11:12:07 2011 From: schlosna at gmail.com (David Schlosnagle) Date: Fri, 2 Dec 2011 06:12:07 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> Message-ID: On Thu, Dec 1, 2011 at 10:08 PM, Lance Andersen - Oracle wrote:> Sadly, ?once i start digging, i found more changes :-(>> Here are the latest revisions with the additions/changes since the last review, http://cr.openjdk.java.net/~lancea/7116445/webrev.03: Lance, I'd suggest also including the attached changes [1] to your current webrev to remove the remaining warnings from java.sql.*. [1]: http://dl.dropbox.com/u/23832908/openjdk/7116445-additions.patch Thanks, Dave -------------- next part -------------- # HG changeset patch # Parent e8ad82e077de465ef90b928868796006db38d2b5 diff --git a/src/share/classes/java/sql/CallableStatement.java b/src/share/classes/java/sql/CallableStatement.java --- a/src/share/classes/java/sql/CallableStatement.java +++ b/src/share/classes/java/sql/CallableStatement.java @@ -295,6 +295,7 @@ * or getBigDecimal(String parameterName) * @see #setBigDecimal */ + @Deprecated BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException; diff --git a/src/share/classes/java/sql/Date.java b/src/share/classes/java/sql/Date.java --- a/src/share/classes/java/sql/Date.java +++ b/src/share/classes/java/sql/Date.java @@ -51,6 +51,7 @@ * @param day 1 to 31 * @deprecated instead use the constructor Date(long date) */ + @Deprecated public Date(int year, int month, int day) { super(year, month, day); } @@ -179,6 +180,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #setHours */ + @Deprecated public int getHours() { throw new java.lang.IllegalArgumentException(); } @@ -191,6 +193,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #setMinutes */ + @Deprecated public int getMinutes() { throw new java.lang.IllegalArgumentException(); } @@ -203,6 +206,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #setSeconds */ + @Deprecated public int getSeconds() { throw new java.lang.IllegalArgumentException(); } @@ -215,6 +219,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #getHours */ + @Deprecated public void setHours(int i) { throw new java.lang.IllegalArgumentException(); } @@ -227,6 +232,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #getMinutes */ + @Deprecated public void setMinutes(int i) { throw new java.lang.IllegalArgumentException(); } @@ -239,6 +245,7 @@ * @exception java.lang.IllegalArgumentException if this method is invoked * @see #getSeconds */ + @Deprecated public void setSeconds(int i) { throw new java.lang.IllegalArgumentException(); } diff --git a/src/share/classes/java/sql/DriverManager.java b/src/share/classes/java/sql/DriverManager.java --- a/src/share/classes/java/sql/DriverManager.java +++ b/src/share/classes/java/sql/DriverManager.java @@ -80,7 +80,7 @@ // List of registered JDBC drivers - private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); + private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList<>(); private static volatile int loginTimeout = 0; private static volatile java.io.PrintWriter logWriter = null; private static volatile java.io.PrintStream logStream = null; @@ -357,7 +357,7 @@ * @return the list of JDBC Drivers loaded by the caller's class loader */ public static java.util.Enumeration getDrivers() { - java.util.Vector result = new java.util.Vector(); + java.util.Vector result = new java.util.Vector<>(); // Gets the classloader of the code that called this method, may // be null. @@ -418,6 +418,7 @@ * @see SecurityManager#checkPermission * @see #getLogStream */ + @Deprecated public static void setLogStream(java.io.PrintStream out) { SecurityManager sec = System.getSecurityManager(); @@ -440,6 +441,7 @@ * @deprecated * @see #setLogStream */ + @Deprecated public static java.io.PrintStream getLogStream() { return logStream; } @@ -484,6 +486,7 @@ String drivers; try { drivers = AccessController.doPrivileged(new PrivilegedAction() { + @Override public String run() { return System.getProperty("jdbc.drivers"); } @@ -497,10 +500,11 @@ // ServiceLoader.load() replaces the sun.misc.Providers() AccessController.doPrivileged(new PrivilegedAction() { + @Override public Void run() { ServiceLoader loadedDrivers = ServiceLoader.load(Driver.class); - Iterator driversIterator = loadedDrivers.iterator(); + Iterator driversIterator = loadedDrivers.iterator(); /* Load these drivers, so that they can be instantiated. * It may be the case that the driver class may not be there @@ -621,15 +625,18 @@ this.driver = driver; } + @Override public boolean equals(Object other) { return (other instanceof DriverInfo) && this.driver == ((DriverInfo) other).driver; } + @Override public int hashCode() { return driver.hashCode(); } + @Override public String toString() { return ("driver[className=" + driver + "]"); } diff --git a/src/share/classes/java/sql/PreparedStatement.java b/src/share/classes/java/sql/PreparedStatement.java --- a/src/share/classes/java/sql/PreparedStatement.java +++ b/src/share/classes/java/sql/PreparedStatement.java @@ -344,6 +344,7 @@ * this method * @deprecated */ + @Deprecated void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException; diff --git a/src/share/classes/java/sql/ResultSet.java b/src/share/classes/java/sql/ResultSet.java --- a/src/share/classes/java/sql/ResultSet.java +++ b/src/share/classes/java/sql/ResultSet.java @@ -358,6 +358,7 @@ * this method * @deprecated */ + @Deprecated BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; /** @@ -477,6 +478,7 @@ * @deprecated use getCharacterStream in place of * getUnicodeStream */ + @Deprecated java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException; /** @@ -643,6 +645,7 @@ * this method * @deprecated */ + @Deprecated BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException; /** @@ -760,6 +763,7 @@ * this method * @deprecated use getCharacterStream instead */ + @Deprecated java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException; /** From chris.hegarty at oracle.com Fri Dec 2 11:30:42 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 02 Dec 2011 11:30:42 +0000 Subject: 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers In-Reply-To: <4ED7A018.800@oracle.com> References: <4ED79841.9030307@oracle.com> <4ED7A018.800@oracle.com> Message-ID: <4ED8B6E2.2050504@oracle.com> Alan, Would you mind taking a quick look at the updated webrev? Trivially, I fixed a few style issues in HttpServerProvider (a nit of mine) and updated the commented code in FtpClientProvider (in case it ever gets enabled ). Let's remove any possibility of sun.misc.Service every reappearing ;-) http://cr.openjdk.java.net/~chegar/7116957/webrev.01/webrev/ -Chris. On 01/12/2011 15:41, Alan Bateman wrote: > On 01/12/2011 15:07, Chris Hegarty wrote: >> This is a follow up to an issue that came up during discussion of >> another fix. Essentially, ScriptEngineManager should use >> j.u.ServiceLoader rather than sun.misc.Service. >> >> http://cr.openjdk.java.net/~chegar/7116957/webrev.00/webrev/ >> >> -Chris. >> >> P.S. and fix up imports in HttpServerProvider > Looks fine to me. From Alan.Bateman at oracle.com Fri Dec 2 12:18:41 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 02 Dec 2011 12:18:41 +0000 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: References: Message-ID: <4ED8C221.7070603@oracle.com> cc'ing core-libs-dev as that is the place to discuss these changes. I see on the sign-up sheet [1] that omajid has signed up for java.lang, maybe you are working together? I'll leave it to Stuart to say whether he wants to refactor/other changes separated from the warnings changes. One thing I'm curious about is @SuppressWarnings("BooleanConstructorCall") as it suggests that some other compiler, or maybe an extension in the NetBeans javac? -Alan [1] http://wikis.sun.com/display/OpenJDK/JDK8+warning+cleanup+day+%282011-12-01%29 On 02/12/2011 11:06, David Schlosnagle wrote: > I didn't have a chance to sign-up or submit during the official > warnings cleanup day, but I'm hoping that you'll still accept patches. > I do not have a bug number for this change. > > The webrev [1] below should resolve 208 warnings in the java.lang.* > and java.util.** packages. I tried to stick to fixing warnings, but > OCD kicked in while editing in NetBeans, so there are a few additional > IDE warnings fixed as well for the modified files. For example, adding > @Override on the relevant methods, removals of dead stores, conversion > to Strings in switch, StringBuffer -> StringBuilder where localized (I > realize lock elision in HotSpot and JRockit should make them > practically equivalent, but NetBeans still complains and I assume > there is still some unnecessary synchronization overhead). > ConditionalSpecialCasing.java also has some slight refactoring to > utilize the updated parameterized types. > > Additionally, there was one change to > java.util.regex.Pattern#subFlag() that I'd like someone to review more > carefully as it was previously falling through the last case, but I > believe the last case should have had a break; to properly handle > other flags. > > *** 3006,3015 **** > --- 3014,3024 ---- > case 'x': > flags&= ~COMMENTS; > break; > case 'U': > flags&= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE); > + break; > default: > return; > } > > If you want any of the additional cleanup removed from the patch or > other changes, please let me know. > > [1]: http://dl.dropbox.com/u/23832908/openjdk/2011-12-01/index.html > > Files modified: > java/lang/Boolean.java > java/lang/Byte.java > java/lang/Character.java > java/lang/Class.java > java/lang/ConditionalSpecialCasing.java > java/lang/Double.java > java/lang/Float.java > java/lang/Integer.java > java/lang/Long.java > java/lang/Short.java > java/lang/System.java > java/lang/ThreadLocal.java > java/lang/Void.java > java/util/IllegalFormatConversionException.java > java/util/Locale.java > java/util/regex/Matcher.java > java/util/regex/Pattern.java > java/util/regex/PatternSyntaxException.java > java/util/regex/UnicodeProp.java > > Thanks, > Dave From Lance.Andersen at oracle.com Fri Dec 2 13:19:03 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Fri, 2 Dec 2011 08:19:03 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> Message-ID: <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> Hi Dave, thanks for the feedback. Adding @Deprecated changes the signatures so I need to coordinate any changes as it will result in TCK signature failures. This is something I will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a chance for input. There are several places in RowSet that also require the use of @Deprecated: --------------------------------------------------- /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/javax/sql/rowset/BaseRowSet.java:2393: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2043: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2378: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2647: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2778: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:361: warning: [dep-ann] deprecated item is not annotated with @Deprecated BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:480: warning: [dep-ann] deprecated item is not annotated with @Deprecated java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException; /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:646: warning: [dep-ann] deprecated item is not annotated with @Deprecated BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException; /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:763: warning: [dep-ann] deprecated item is not annotated with @Deprecated java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException; /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:54: warning: [dep-ann] deprecated item is not annotated with @Deprecated public Date(int year, int month, int day) { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:182: warning: [dep-ann] deprecated item is not annotated with @Deprecated public int getHours() { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:194: warning: [dep-ann] deprecated item is not annotated with @Deprecated public int getMinutes() { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:206: warning: [dep-ann] deprecated item is not annotated with @Deprecated public int getSeconds() { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:218: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void setHours(int i) { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:230: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void setMinutes(int i) { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:242: warning: [dep-ann] deprecated item is not annotated with @Deprecated public void setSeconds(int i) { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/PreparedStatement.java:347: warning: [dep-ann] deprecated item is not annotated with @Deprecated void setUnicodeStream(int parameterIndex, java.io.InputStream x, /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/CallableStatement.java:298: warning: [dep-ann] deprecated item is not annotated with @Deprecated BigDecimal getBigDecimal(int parameterIndex, int scale) /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1039: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1177: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1359: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1484: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1156: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1267: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1439: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1555: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1291: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1427: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1656: warning: [dep-ann] deprecated item is not annotated with @Deprecated public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1787: warning: [dep-ann] deprecated item is not annotated with @Deprecated public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/DriverManager.java:433: warning: [dep-ann] deprecated item is not annotated with @Deprecated public static void setLogStream(java.io.PrintStream out) { /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/DriverManager.java:455: warning: [dep-ann] deprecated item is not annotated with @Deprecated public static java.io.PrintStream getLogStream() { --------------------------------------------------- I could probably add the annotations to the com/sun/rowset/* classes now as they are the RowSet RI, not public facing interfaces. Alan, Stuart your thoughts? I can add the @Override in DriverManager while I am there, but do not want to make a pass through the rest of the code as part of this putback to do it elsewhere as I would like to get these back. Again, thank you for your feedback. Best Lance On Dec 2, 2011, at 6:12 AM, David Schlosnagle wrote: > On Thu, Dec 1, 2011 at 10:08 PM, Lance Andersen - Oracle > wrote:> Sadly, once i start digging, i > found more changes :-(>> Here are the latest revisions with the > additions/changes since the last review, > http://cr.openjdk.java.net/~lancea/7116445/webrev.03: > Lance, > > I'd suggest also including the attached changes [1] to your current > webrev to remove the remaining warnings from java.sql.*. > > [1]: http://dl.dropbox.com/u/23832908/openjdk/7116445-additions.patch > > Thanks, > Dave Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From chris.hegarty at oracle.com Fri Dec 2 13:34:11 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Fri, 02 Dec 2011 13:34:11 +0000 Subject: hg: jdk8/tl/jdk: 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers Message-ID: <20111202133429.9FDB84751A@hg.openjdk.java.net> Changeset: f615db07991e Author: chegar Date: 2011-12-02 11:39 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f615db07991e 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers Reviewed-by: prr ! src/share/classes/com/sun/media/sound/JSSecurityManager.java From Alan.Bateman at oracle.com Fri Dec 2 13:42:25 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 02 Dec 2011 13:42:25 +0000 Subject: 7117357: Warnings in sun.instrument, tools and other sun.* classes Message-ID: <4ED8D5C1.7050207@oracle.com> I'm down on the sign-up sheet for warnings in a couple of arcane areas. The following webrev fixes the warnings in sun.instrument.*, several serviceability tools, serialver, and some residual warnings left in sun.net.**. I've run all the tests for all these areas with the changes. http://cr.openjdk.java.net/~alanb/7117357/webrev/ Thanks, Alan. From Lance.Andersen at oracle.com Fri Dec 2 13:49:48 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Fri, 2 Dec 2011 08:49:48 -0500 Subject: 7117357: Warnings in sun.instrument, tools and other sun.* classes In-Reply-To: <4ED8D5C1.7050207@oracle.com> References: <4ED8D5C1.7050207@oracle.com> Message-ID: <6E7665D1-EC7A-45AA-9CDB-F28C0A1F5039@oracle.com> Looks good to me Best Lance On Dec 2, 2011, at 8:42 AM, Alan Bateman wrote: > > I'm down on the sign-up sheet for warnings in a couple of arcane areas. The following webrev fixes the warnings in sun.instrument.*, several serviceability tools, serialver, and some residual warnings left in sun.net.**. I've run all the tests for all these areas with the changes. > > http://cr.openjdk.java.net/~alanb/7117357/webrev/ > > Thanks, > Alan. Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Alan.Bateman at oracle.com Fri Dec 2 13:54:18 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 02 Dec 2011 13:54:18 +0000 Subject: 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers In-Reply-To: <4ED8B6E2.2050504@oracle.com> References: <4ED79841.9030307@oracle.com> <4ED7A018.800@oracle.com> <4ED8B6E2.2050504@oracle.com> Message-ID: <4ED8D88A.4080802@oracle.com> On 02/12/2011 11:30, Chris Hegarty wrote: > Alan, > > Would you mind taking a quick look at the updated webrev? > > Trivially, I fixed a few style issues in HttpServerProvider (a nit of > mine) and updated the commented code in FtpClientProvider (in case it > ever gets enabled ). Let's remove any possibility of sun.misc.Service > every reappearing ;-) > > http://cr.openjdk.java.net/~chegar/7116957/webrev.01/webrev/ > > -Chris. Loos fine to me. In FtpClientProvider.java I would probably have just removed this code. -Alan From chris.hegarty at oracle.com Fri Dec 2 13:59:57 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 02 Dec 2011 13:59:57 +0000 Subject: 7117357: Warnings in sun.instrument, tools and other sun.* classes In-Reply-To: <6E7665D1-EC7A-45AA-9CDB-F28C0A1F5039@oracle.com> References: <4ED8D5C1.7050207@oracle.com> <6E7665D1-EC7A-45AA-9CDB-F28C0A1F5039@oracle.com> Message-ID: <4ED8D9DD.8060207@oracle.com> On 02/12/2011 13:49, Lance Andersen - Oracle wrote: > Looks good to me Thumbs up from me too. -Chris. > > Best > Lance > On Dec 2, 2011, at 8:42 AM, Alan Bateman wrote: > >> >> I'm down on the sign-up sheet for warnings in a couple of arcane areas. The following webrev fixes the warnings in sun.instrument.*, several serviceability tools, serialver, and some residual warnings left in sun.net.**. I've run all the tests for all these areas with the changes. >> >> http://cr.openjdk.java.net/~alanb/7117357/webrev/ >> >> Thanks, >> Alan. > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > From frederic.parain at oracle.com Fri Dec 2 13:57:14 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Fri, 02 Dec 2011 14:57:14 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework Message-ID: <4ED8D93A.5050600@oracle.com> Hi All, [Posting to serviceability-dev, runtime-dev and core-libs-dev because changes are pretty big and touch all these areas] Here's a framework for issuing diagnostics commands to the JVM. Diagnostic commands are actions executed inside the JVM mainly for monitoring or management purpose. This work has two parts. The first part is in the hotspot repository and contains the framework itself with two diagnostic commands. The second part is in the JDK repository and contains the command line utility to invoke diagnostic commands as well as the HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean extensions allow a remote client to discover and invoke diagnostic commands using a JMX connection. This changeset only contains two diagnostic commands, more commands will be added in the future, as a standalone effort to improve the monitoring and management services of the JVM, or as part of other projects. Webrevs are here: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ Here's a technical description of this work: 1 - The Diagnostic Command Framework 1-1 Overview The diagnostic command framework is fully implemented in native code and relies on the HotSpot's internal exception mechanism. The rational of a pure native implementation is to be able to execute diagnostic commands even in critical situations like an OutOfMemory error. All diagnostic commands are registered in a single list, and two flags control the way a user can interact with them. The "hidden" flag prevents a diagnostic command from appearing in the list of available commands returned by the "help" command. However, it's still possible to get the detailed help message for a hidden command with the "help " syntax (but it requires to know the name of the hidden command). The second flag is "enabled" and it controls if a command can be invoked or not. When listed with the "help" commands, disabled commands appear with a "[disabled]" label in their description. If the user tries to invoke a disabled command, an error message is returned and the command is not run. This error message can be customized on a per command base. The framework just provides these two flags with their semantic, it doesn't provide any policy or mechanism to set or modify these flags. These actions will be delegated to the JVM or special diagnostic commands. 1-2 Implementation All diagnostic commands are implemented as subclasses of the DCmd class defined in services/diagnosticFramework.hpp. Here's the layout of the DCmd class and the list of methods that a new command has to define or overwrite: class DCmd { DCmd(outputStream *output); static const char *get_name(); static const char *get_description(); static const char *get_disabled_message(); static const char *get_impact(); static int get_num_arguments(); virtual void print_help(outputStream* out); virtual void parse(CmdLine* line, char delim, TRAPS); virtual void execute(TRAPS); virtual void reset(TRAPS); virtual void cleanup(); virtual GrowableArray* get_argument_name_array(); virtual GrowableArray* get_argument_info_array(); } A diagnostic command is always instantiated with an outputStream in parameter. This outputStream can point either to a file, a buffer or a socket (see the ostream.hpp file). The get_name() method returns the string that will identify the command (i.e. the string to put on the command line to invoke it). The get_description() methods returns the global description of the command. The get_disabled_message() returns the customized message to return when the command is disabled, without having to instantiate the command. The get_impact() returns a description of the intrusiveness of the diagnostic command on the Java Virtual Machine behavior. The rational for this method is that some diagnostic commands can seriously disrupt the behavior of the Java Virtual Machine (for instance a Thread Dump for an application with several tens of thousands of threads, or a Head Dump with a 40GB+ heap size) and other diagnostic commands have no serious impact on the JVM (for instance, getting the command line arguments or the JVM version). The recommended format for the description is : [longer description], where the impact level is selected among this list: {low, medium, high}. The optional longer description can provide more specific details like the fact that Thread Dump impact depends on the heap size. The get_num_arguments() returns the number of options/arguments recognized by the diagnostic command. This method is only used by the JMX interface support (see below). The print_help() methods prints a detailed help on the outputStream passed in argument. The detailed help contains the list of all supported options with their type and description. The parse() method is in charge of parsing the command arguments. Each command is free to implement its own argument parser. However, an argument parser framework is provided (see section 1-3) to ease the implementation, but its use is optional. The parse method takes a delimiter character in argument, which is used to mark the limit between two arguments (typically invocation from jcmd will use a space character as a delimiter while invocation from the JVM command line parsing code will use a comma as a delimiter). The execute() method is naturally the one to invoke to get the diagnostic command executed. The parse() and the execute() methods are dissociated, so it's a possible perform the argument parsing in one thread, and delegate the execution to another thread, as long as the diagnostic command doesn't reference thread local variables. The framework allows several instances of the same diagnostic command to be executed in parallel. If for some reasons concurrent executions should not be allowed for a given diagnostic command, this is the responsibility of the diagnostic command implementor to enforce this rule, for instance by protecting the body of the execute() method with a global lock. The reset() method is used to initialize the internal fields of the diagnostic command or to reset the internal fields to their initial value to be able to re-use an already allocated diagnostic command instance. The cleanup() method is used to perform perform cleanup (like freeing of all memory allocated to store internal data). The DCmd extends the ResourceObj class, so when allocated in a ResourceArea, destructors cannot be used to perform cleanup. To ensure that cleanup is performed in all cases, it is recommended to create a DCmdMark instance for each DCmd instance. DCmdMark is a stack allocated object with a pointer to a DCmd instance. When the DCmdMark is destroyed, its destructor calls the cleanup() method of the DCmd instance it points to. If the DCmd instance has been allocated on the C-Heap, the DCmdMark will also free the memory allocated to store the DCmd instance. The get_argument_name_array() and get_argument_info_array() are related to the JMX interface of the diagnostic command framework, so they are described in section 3. 1-3 DCmdParser framework The DCmdParser class is an optional framework to help development of argument parsers. It provides many features required by the diagnostic command framework (generation of the help message or the argument descriptions for the JMX interface) but all these features can easily be re-implemented if a developer decides not to use the DCmdParser framework. The DCmdParser class is relying on the DCmdArgument template. This template must be used to define the different types of argument the parser will have to handle. When a new specialization of the template is done, three methods have to be provided: void parse_value(const char *str,size_t len,TRAPS); void init_value(TRAPS); void destroy_value(); The parse_value() method is used to convert a string into an argument value. The print_value() method is used to display the default value (support for the detailed help message). The init_value() method is used to initialize or reset the argument value. The destroy_value() method is a clean-up method (useful when the argument has allocated some C-Heap memory to store its value and this memory has to be freed before destroying the DCmdArgument instance). The DCmdParser makes a distinction between options and arguments. Options are identified by a key name that must appear on the command line, while argument are identified just by the position of the argument on the command line. Options use the = syntax. In case of boolean options, the '=' part of the syntax can be omitted to set the option to true. Arguments are just sequences characters delimited by a separator character. This separator can be specified at runtime when invoking the diagnostic command framework. If an argument contain a character that could be used as a delimiter, it's possible to enclose the argument between single or double quotes. Options are arguments are instantiated using the same DCmdArgument class but they're registered differently to the DCmdParser. The way to use the DCmdParser is to declare the parser and the option/arguments as fields of the diagnostic command class (which is itself a sub-class of the DCmd class), like this: class EchoDCmd : public DCmd { protected: DCmdParser _dcmdparser; DCmdArgument _required; DCmdArgument _intval; DCmdArgument _boolval; DCmdArgument _stringval; DCmdArgument _first_arg; DCmdArgument _second_arg; DCmdArgument _optional_arg; } The parser and the options/arguments must be initialized before the diagnostic command class, and the options/arguments have to be registered to the parser like this: EchoDCmd(outputStream *output) : DCmd(output), _stringval("-strval","a string argument","STRING",false), _boolval("-boolval","a boolean argument","BOOLEAN",false), _intval("-intval","an integer argument","INTEGER",false), _required("-req","a mandatory integer argument","INTEGER",true), _fist_arg("first argument","a string argument","STRING",true), _second_arg("second argument,"an integer argument,"INTEGER",true), _optional_arg("optional argument","an optional string argument","STRING","false") { _dcmdparser.add_dcmd_option(&_stringval) _dcmdparser.add_dcmd_option(&_boolval); _dcmdparser.add_dcmd_option(&_intval); _dcmdparser.add_dcmd_option(&_required); _dcmdparser.add_argument(&_first_arg); _dcmdparser.add_argument(&_second_arg); _dcmdparser.add_argument(&_optional_arg); }; The add_dcmd_argument()/ add_dcmd_option() method is used to add an argument/option to the parser. The option/argument constructor takes the name of the option/argument, its description, a string describing its type and a boolean to specify if the option/argument is mandatory or not. The parser doesn't support option/argument duplicates (having the same name) but the code currently doesn't check for duplicates.The order used to register options has no impact on the parser. However, the order used to register arguments is critical because the parser will use the same order to parse the command line. In the example above, the parser expects to have a first argument of type STRING (parsed using _first_arg), then a second argument of type INTEGER (parsed using _second_arg) and optionally a third parameter of type STRING (parsed using _optional_arg). A mandatory option or argument has to be specify every time the command is invoked. If it is missing, an exception is thrown at the end of the parsing. Optional arguments have to be registered after mandatory arguments. An optional argument will be considered for parsing only if all arguments before it (mandatory or not) have already been used to parse the command line. The DCmdParser and its DCmdArgument instances are embedded in the DCmd instance. The rational for this design is to limit the number of C-heap allocations but also to be able to pre-allocate diagnostic command instances for critical situations. If the process is running out of C-heap space, it's not possible to instantiate new diagnostic commands to troubleshoot the situation. By pre-allocating some diagnostic commands, it will be possible to run them even in this critical situation. Of course, the diagnostic command itself should not try to allocate memory during its execution, this prevents the diagnostic command to use variable length arguments like strings. By nature, pre-allocated diagnostic commands aim to be re-usable, this is the purpose of the reset() method which restores the default status of all arguments. 1-4 Internal invocation Using a diagnostic command from the JVM itself is pretty easy: instantiate the class and invoke the parse() method then the execute() method. A diagnostic command can be instantiated from inside the JVM even it is not registered. This is a difference with the external invocations (from jcmd or JMX) that require the command to be registered. 2 - The JCmd interface Diagnostic commands can also be invoked from outside the JVM process, using the new 'jcmd' utility. The jcmd program uses the attach API to connect to the JVM, send requests and receive results. The jcmd utility must be launched on the same machine than the one running the JVM (its a local tool). Launched without arguments, jcmd displays a list of all JVMs running on the machine. The jcmd source code is in the jdk repository like other existing j* tools. To execute a diagnostic command in a particular JVM, the generic syntax is: jcmd [arguments] The attachListener has been modified to recognized the jcmd requests. When a jcmd request is identified, it is parsed to extract the command name. The JVM performs a look up of this command in a list of registered commands. To be executable by an external request, a diagnostic command has to be registered. The registration is performed with the DCmdFactory class (see services/management.cpp). 3 - The JMX interface The framework provides a JMX based interface to the diagnostic commands. This interface allows remote invocation of diagnostic commands through a JMX connection. 3-1 The interface The information related to the diagnostic commands are accessible through new methods added to the com.sun.management.HotspotDiagnosticMXBean: public List getDiagnosticCommands(); public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); public List getDiagnosticCommandInfo(List command); public List getDiagnosticCommandInfo(); public String execute(String commandLine) throws IllegalArgumentException ; public String execute(String cmd, String... arguments) throws IllegalArgumentException; The getDiagnosticCommands() method returns an array containing the names of the not-hidden registered diagnostic commands. The three getDiagnosticCommandInfo() methods return one or several diagnostic command descriptions using the DiagnosticCommandInfo class. The two execute() methods allow the user the invoke a diagnostic command in different ways. The DiagnosticCommandInfo class is describing a diagnostic command with the following information: public class DiagnosticCommandInfo { public String getName(); public String getDescription(); public String getImpact(); public boolean isEnabled(); public List getArgumentsInfo(); } The getName() method returns the name of the diagnostic command. This name is the one to use in execute() methods to invoke the diagnostic command. The getDescription() method returns a general description of the diagnostic command. The getImpact() method returns a description of the intrusiveness of diagnostic command. The isEnabled() method returns true if the method is enabled, false if it is disabled. A disabled method cannot be executed. The getArgumentsInfo() returns a list of descriptions for the options or arguments recognized by the diagnostic command. Each option/argument is described by a DiagnosticCommandArgumentInfo instance: public class DiagnosticCommandArgumentInfo { public String getName(); public String getDescription(); public String getType(); public String getDefault(); public boolean isMandatory(); public boolean isOption(); public int getPosition(); } If the DiagnosticCommandArgumentInfo instance describes an option, isOption() returns true and getPosition() returns -1. Otherwise, when the DiagnosticCommandArgumentInfo instance describes an argument, isOption() returns false and getPosition() returns the expected position for this argument. The position of an argument is defined relatively to all arguments passed on the command line, options are not considered when defining an argument position. The getDefault() method returns the default value of the argument if a default has been defined, otherwise it returns null. 3-2 The implementation The framework has been designed in a way that prevents diagnostic command developers to worry about the JMX interface. In addition to the methods described in section 1-2, a diagnostic command developer has to provide three methods: int get_num_arguments() which returns the number of option and arguments supported by the command. GrowableArray* get_argument_name_array() which provides the name of the arguments supported by the command. GrowableyArray* get_argument_info_array() which provides the description of each argument with a DCmdArgumentInfo instance. DCmdArgumentInfo is a C++ class used by the framework to generate the sun.com.management.DcmdArgumentInfo instances. This is done automatically and the diagnostic command developer doesn't need to know how to create Java objects from the runtime. 4 - The Diagnostic Commands To avoid name collisions between diagnostic commands coming from different projects, use of a flat name space should be avoided and a more structured organization is recommended. The framework itself doesn't depend on this organization, so it will be a set of rules defining a convention in the way commands are named. Diagnostic commands can easily organized in a hierarchical way, so the template for a command name can be: .[sub-domain.] This template can be extended with sub-sub-domains and so on. A special set of commands without domain will be reserved for the commands related to the diagnostic framework itself, like the "help" command. Thanks, Fred -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at oracle.com From sebastian.sickelmann at gmx.de Fri Dec 2 06:15:36 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Fri, 02 Dec 2011 07:15:36 +0100 Subject: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED81A62.2080006@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED7B61F.4050408@oracle.com> <4ED7C8EB.4050103@gmx.de> <4ED7E5B6.7060004@oracle.com> <4ED7FC1B.4090400@oracle.com> <4ED81A62.2080006@oracle.com> Message-ID: <4ED86D08.40302@gmx.de> Am 02.12.2011 01:22, schrieb Stuart Marks: > On 12/1/11 2:13 PM, Stuart Marks wrote: >> On 12/1/11 12:38 PM, Alan Bateman wrote: >>> On 01/12/2011 18:35, Sebastian Sickelmann wrote: >>>> : >>>> Thanks Alan, >>>> L67-68 was a backporting (from a more complex solution to a small >>>> warning >>>> cleanup) issue. I missed the type parameters here. >>>> I changed L119-120 also. >>>> >>>> New webrev is here: >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_1/index.html >>>> >>>> >>>> >>> Looks fine to me. >> >> Hi Sebastian! >> >> The change looks fine to me too. I'll apply the patch, build it, and >> push it in. >> >> Thanks for your contribution! > > Well, turns out this patch had an error in it. :-( In > ExpiringCache.java the constructor that takes a long parameter has > code that looks like this: > > map = new LinkedHashMap<>() { ... } > > It turns out that it's illegal to use diamond in the construction of > an anonymous class! Didn't you compile the code, Sebastian? :-) To be > fair, neither of us reviewers caught this either. The compiler is the > ultimate reviewer in this case. > > I've taken the liberty of expanding the type parameters to > > map = new LinkedHashMap() { ... } > > and I've gone ahead and pushed the changeset. > > Again, thanks for your contribution. > > s'marks Oh, i am sorry about that. I thought i had compiled it. But it looks like i have not. Again, thanks for the nice cleanup event. -- Sebastian From sebastian.sickelmann at gmx.de Fri Dec 2 06:18:11 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Fri, 02 Dec 2011 07:18:11 +0100 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED8059B.8040805@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> Message-ID: <4ED86DA3.3050205@gmx.de> Hi Brandon, i will try to work out a fix for both and cc the review request to you. -- Sebastian Am 01.12.2011 23:54, schrieb Brandon Passanisi: > Hi Sebastian. I was speaking with Stuart Marks earlier today and he > mentioned that the "fallthrough" code in FilePermission.java also > exists in java.util.PropertyPermission.java. Maybe the code author > had done some copy/paste when working on these files. Stuart had said > that you might be planning on doing some work on this after the > warnings cleanup work. If/when you do this work, maybe you can let me > know so that I can sync the same changes you apply to > FilePermission.java to PropertyPermission.java? Or, maybe you can > apply the same changes yourself to PropertyPermission.java? > > Thanks. > > On 12/1/2011 8:27 AM, Sebastian Sickelmann wrote: >> Am 01.12.2011 10:16, schrieb Stuart Marks: >>> Hi Sebastian, >>> >>> Thanks for submitting this patch! I've filed bug 7116890 to cover >>> this set of changes. >>> >>> Regarding webrev, it probably does get confused by merges in the >>> history. By default it tries to show differences between the tip of >>> the target repository and tip + uncommitted changes in your local >>> repository. This isn't always the right thing. One thing you might >>> try is to use the -r option to specify a particular revision in the >>> history against which to generate the diffs. But, having a few extra >>> files isn't a big deal. >>> >>> On to your changes. >>> >>> Most of them are really good and are exactly the kind of simple >>> change we're looking for, as I posted a little while ago. [1] >>> >>> The ExpiringCache.java case is an interesting one. I think it's >>> possible to add a static serialVersionUID field within the anonymous >>> class. It's hard to run serialver over an anonymous class (actually >>> it might be possible to run the checksum algorithm on the loaded >>> class) but if in practice it's never serialized, who cares what the >>> "correct" value is? You could just use a value of 0L. >>> >>> An alternative would also be to use @SuppressWarnings("serial"). >>> Since the constructor is so short, you could just put it on the >>> constructor. >>> >>> Actually I prefer @SuppressWarnings, since adding serialVersionUID >>> adds to the system's footprint. If it's never used, we shouldn't >>> bother defining it. >>> >>> Given these alternatives, it's not necessary to create a static >>> CacheHashMapImpl class. >>> >>> Regarding the FilePermission.java change, yes, I see that the >>> skipBeforePreviousComma() change is problematic. I puzzled over it >>> for a while too. I wish I had sent out the Coding Guideline [1] >>> earlier; it might have saved you an hour. :-) Sorry about that. >>> >>> A cleanup/rewrite of this code would indeed be better done separate >>> from Warnings Cleanup Day. But I think there might be a simple way >>> to get rid of the warning without doing a cleanup or refactoring. >>> The warning message in question is at line 535 of the original code, >>> about falling through to the next case. But the next case doesn't >>> actually do anything but break. Could we just change the >>> /*FALLTHROUGH*/ comment to a break statement? I think that would fix >>> the warning without changing the logic at all. >>> >>> s'marks >>> >>> [1] >>> http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html >>> >>> >>> On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: >>>> Hi, >>>> >>>> i have a webrev[0] that contains some warning cleanup for java.io >>>> It is based on rev 7795c41ed54c >>>> http://hg.openjdk.java.net/jdk8/tl/jdk/ >>>> >>>> Some comments to the changes: >>>> >>>> ExpiringCache.java: Changed anonymous inner class to inner class >>>> with the >>>> intention to put serialversion inside of it. But serialver doesn't >>>> want to give >>>> my the serialver. I also think that ExpiringCache is not >>>> serializable but the >>>> warning was clear: the anonymous inner class is seriallizable and >>>> has no >>>> explicit serialversionuid. >>>> >>>> FilePermission.java: I have starred at the code between line 453 >>>> and 547 for >>>> over an hour, because i thought that there is a bug within the >>>> expression "i >= >>>> matchlen" in line 530 and the both "i != -1" in lines 457 and 461. >>>> But there is >>>> no bug. But i wanted to left this code slightly more readable. I >>>> introduced the >>>> method skipBeforePreviousComma to make it possible to work-around the >>>> fallthought warning with an return statement. This code-change >>>> need's some more >>>> review attention. Maybe we should split this up for another >>>> cleanup. I think >>>> the whole method needs some rewrite. >>>> >>>> Some classes had no change at all. Maybe webrev created them >>>> because there >>>> where changes in my history/branches. There were some patches from >>>> alan i saw >>>> to late. Maybe webrev is confused of the multiple merges. >>>> >>>> Can someone please create a CR for this and >>>> >>>> [0] >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html >>>> >>>> >>>> >> Thanks for the good feedback. >> >> I splitted my change to the trivial part and will start discussion of >> FilePermission change on core-libs-dev after the cleanup event. >> I created a new webrev with the suggested changes here[2] >> >> [2] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html >> >> -- Sebastian > > -- > Oracle > Brandon Passanisi | Principle Member of Technical Staff > > Oracle Java Standards Conformance > > Green Oracle Oracle is committed to > developing practices and products that help protect the environment From Lance.Andersen at oracle.com Fri Dec 2 14:14:11 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Fri, 2 Dec 2011 09:14:11 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> Message-ID: <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> Here is the diff for DriverManager, I won't be pushing another webrev unless the word is to go ahead and add @Deprecated to the com/* classes of the RowSet RI or there is another change requested that is more detailed: dhcp-adc-twvpn-2-vpnpool-10-154-44-9:sql lanceandersen$ hg diff DriverManager.java diff -r 43a630f11af6 src/share/classes/java/sql/DriverManager.java --- a/src/share/classes/java/sql/DriverManager.java Wed Nov 30 13:11:16 2011 -0800 +++ b/src/share/classes/java/sql/DriverManager.java Fri Dec 02 09:12:21 2011 -0500 @@ -80,7 +80,7 @@ // List of registered JDBC drivers - private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); + private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList<>(); private static volatile int loginTimeout = 0; private static volatile java.io.PrintWriter logWriter = null; private static volatile java.io.PrintStream logStream = null; @@ -357,7 +357,7 @@ * @return the list of JDBC Drivers loaded by the caller's class loader */ public static java.util.Enumeration getDrivers() { - java.util.Vector result = new java.util.Vector(); + java.util.Vector result = new java.util.Vector<>(); // Gets the classloader of the code that called this method, may // be null. @@ -621,15 +621,18 @@ this.driver = driver; } + @Override public boolean equals(Object other) { return (other instanceof DriverInfo) && this.driver == ((DriverInfo) other).driver; } + @Override public int hashCode() { return driver.hashCode(); } + @Override public String toString() { return ("driver[className=" + driver + "]"); } On Dec 2, 2011, at 8:19 AM, Lance Andersen - Oracle wrote: > Hi Dave, > > thanks for the feedback. Adding @Deprecated changes the signatures so I need to coordinate any changes as it will result in TCK signature failures. This is something I will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a chance for input. > > There are several places in RowSet that also require the use of @Deprecated: > > --------------------------------------------------- > > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/javax/sql/rowset/BaseRowSet.java:2393: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2043: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2378: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2647: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/CachedRowSetImpl.java:2778: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:361: warning: [dep-ann] deprecated item is not annotated with @Deprecated > BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:480: warning: [dep-ann] deprecated item is not annotated with @Deprecated > java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException; > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:646: warning: [dep-ann] deprecated item is not annotated with @Deprecated > BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException; > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/ResultSet.java:763: warning: [dep-ann] deprecated item is not annotated with @Deprecated > java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException; > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:54: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public Date(int year, int month, int day) { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:182: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public int getHours() { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:194: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public int getMinutes() { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:206: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public int getSeconds() { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:218: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public void setHours(int i) { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:230: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public void setMinutes(int i) { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/Date.java:242: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public void setSeconds(int i) { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/PreparedStatement.java:347: warning: [dep-ann] deprecated item is not annotated with @Deprecated > void setUnicodeStream(int parameterIndex, java.io.InputStream x, > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/CallableStatement.java:298: warning: [dep-ann] deprecated item is not annotated with @Deprecated > BigDecimal getBigDecimal(int parameterIndex, int scale) > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1039: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1177: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1359: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JdbcRowSetImpl.java:1484: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1156: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1267: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1439: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/JoinRowSetImpl.java:1555: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1291: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1427: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1656: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/com/sun/rowset/internal/SyncResolverImpl.java:1787: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/DriverManager.java:433: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public static void setLogStream(java.io.PrintStream out) { > /Users/lanceandersen/NetBeansProjects/JDBC4.2/jdbc4.0/src/java/sql/DriverManager.java:455: warning: [dep-ann] deprecated item is not annotated with @Deprecated > public static java.io.PrintStream getLogStream() { > > --------------------------------------------------- > > I could probably add the annotations to the com/sun/rowset/* classes now as they are the RowSet RI, not public facing interfaces. Alan, Stuart your thoughts? > > I can add the @Override in DriverManager while I am there, but do not want to make a pass through the rest of the code as part of this putback to do it elsewhere as I would like to get these back. > > Again, thank you for your feedback. > > Best > Lance > On Dec 2, 2011, at 6:12 AM, David Schlosnagle wrote: > >> On Thu, Dec 1, 2011 at 10:08 PM, Lance Andersen - Oracle >> wrote:> Sadly, once i start digging, i >> found more changes :-(>> Here are the latest revisions with the >> additions/changes since the last review, >> http://cr.openjdk.java.net/~lancea/7116445/webrev.03: >> Lance, >> >> I'd suggest also including the attached changes [1] to your current >> webrev to remove the remaining warnings from java.sql.*. >> >> [1]: http://dl.dropbox.com/u/23832908/openjdk/7116445-additions.patch >> >> Thanks, >> Dave > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From chris.hegarty at oracle.com Fri Dec 2 14:25:19 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 02 Dec 2011 14:25:19 +0000 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package Message-ID: <4ED8DFCF.9050609@oracle.com> Cleanup compiler warnings in the java.util.concurrent.atomic package. This is a sync up with the raw type warning fixes in Doug's CVS, along with some minor style cleanup. With this change there are still 2 outstanding unchecked casts in AtomicReferenceArray and AtomicReferenceFieldUpdater. Will contact Doug separately about suppressing these. http://cr.openjdk.java.net/~chegar/7117360/webrev/ -Chris. P.S. I have already review this, and the contribution is of course from Doug. From chris.hegarty at oracle.com Fri Dec 2 14:30:09 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 02 Dec 2011 14:30:09 +0000 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package In-Reply-To: <4ED8DFCF.9050609@oracle.com> References: <4ED8DFCF.9050609@oracle.com> Message-ID: <4ED8E0F1.10200@oracle.com> Oh, AtomicBoolean.java and AtomicReference.java show no differences in the webrev, but there is a correction to the indentation in the static initializer. And just to point out, along with raw type warning fixes there is a removal of a redundant cast ;-) -Chris. On 02/12/2011 14:25, Chris Hegarty wrote: > Cleanup compiler warnings in the java.util.concurrent.atomic package. > > This is a sync up with the raw type warning fixes in Doug's CVS, along > with some minor style cleanup. > > With this change there are still 2 outstanding unchecked casts in > AtomicReferenceArray and AtomicReferenceFieldUpdater. Will contact Doug > separately about suppressing these. > > http://cr.openjdk.java.net/~chegar/7117360/webrev/ > > -Chris. > > P.S. I have already review this, and the contribution is of course from > Doug. From brandon.passanisi at oracle.com Fri Dec 2 15:27:34 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Fri, 02 Dec 2011 07:27:34 -0800 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED86DA3.3050205@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> Message-ID: <4ED8EE66.7020502@oracle.com> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks regarding this, but Stuart was able to find more instances of the similar block of "fallthrough" code. I can volunteer to apply your upcoming change to FilePermission to the other files if you wish. Or, you can try applying the change to the other files, but if you don't have time I don't mind doing it. Here's the section of Stuart's e-mail on this topic: ------------------------------------------------------------------------------------- (Incidentally, this is the third time I've reviewed code today that looks exactly like this. The other cases are in java.io.FilePermission and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ into a set of cases that do nothing but break; and they have similar ("ackbarfaccept") comments. It would be nice if these chunks of code could be unified, but they differ in a number of fiddly details.) (The string "ackbarfaccept" occurs in the following files: 1. java/io/FilePermission.java 2. java/net/SocketPermission.java 3. java/util/PropertyPermission.java 4. javax/management/MBeanPermission.java 5. javax/security/auth/kerberos/ServicePermission.java Hmmm.) ------------------------------------------------------------------------------------- Thanks. On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: > Hi Brandon, > > i will try to work out a fix for both and cc the review request to you. > > -- Sebastian > > Am 01.12.2011 23:54, schrieb Brandon Passanisi: >> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >> mentioned that the "fallthrough" code in FilePermission.java also >> exists in java.util.PropertyPermission.java. Maybe the code author >> had done some copy/paste when working on these files. Stuart had >> said that you might be planning on doing some work on this after the >> warnings cleanup work. If/when you do this work, maybe you can let >> me know so that I can sync the same changes you apply to >> FilePermission.java to PropertyPermission.java? Or, maybe you can >> apply the same changes yourself to PropertyPermission.java? >> >> Thanks. >> >> On 12/1/2011 8:27 AM, Sebastian Sickelmann wrote: >>> Am 01.12.2011 10:16, schrieb Stuart Marks: >>>> Hi Sebastian, >>>> >>>> Thanks for submitting this patch! I've filed bug 7116890 to cover >>>> this set of changes. >>>> >>>> Regarding webrev, it probably does get confused by merges in the >>>> history. By default it tries to show differences between the tip of >>>> the target repository and tip + uncommitted changes in your local >>>> repository. This isn't always the right thing. One thing you might >>>> try is to use the -r option to specify a particular revision in the >>>> history against which to generate the diffs. But, having a few >>>> extra files isn't a big deal. >>>> >>>> On to your changes. >>>> >>>> Most of them are really good and are exactly the kind of simple >>>> change we're looking for, as I posted a little while ago. [1] >>>> >>>> The ExpiringCache.java case is an interesting one. I think it's >>>> possible to add a static serialVersionUID field within the >>>> anonymous class. It's hard to run serialver over an anonymous class >>>> (actually it might be possible to run the checksum algorithm on the >>>> loaded class) but if in practice it's never serialized, who cares >>>> what the "correct" value is? You could just use a value of 0L. >>>> >>>> An alternative would also be to use @SuppressWarnings("serial"). >>>> Since the constructor is so short, you could just put it on the >>>> constructor. >>>> >>>> Actually I prefer @SuppressWarnings, since adding serialVersionUID >>>> adds to the system's footprint. If it's never used, we shouldn't >>>> bother defining it. >>>> >>>> Given these alternatives, it's not necessary to create a static >>>> CacheHashMapImpl class. >>>> >>>> Regarding the FilePermission.java change, yes, I see that the >>>> skipBeforePreviousComma() change is problematic. I puzzled over it >>>> for a while too. I wish I had sent out the Coding Guideline [1] >>>> earlier; it might have saved you an hour. :-) Sorry about that. >>>> >>>> A cleanup/rewrite of this code would indeed be better done separate >>>> from Warnings Cleanup Day. But I think there might be a simple way >>>> to get rid of the warning without doing a cleanup or refactoring. >>>> The warning message in question is at line 535 of the original >>>> code, about falling through to the next case. But the next case >>>> doesn't actually do anything but break. Could we just change the >>>> /*FALLTHROUGH*/ comment to a break statement? I think that would >>>> fix the warning without changing the logic at all. >>>> >>>> s'marks >>>> >>>> [1] >>>> http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html >>>> >>>> >>>> On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: >>>>> Hi, >>>>> >>>>> i have a webrev[0] that contains some warning cleanup for java.io >>>>> It is based on rev 7795c41ed54c >>>>> http://hg.openjdk.java.net/jdk8/tl/jdk/ >>>>> >>>>> Some comments to the changes: >>>>> >>>>> ExpiringCache.java: Changed anonymous inner class to inner class >>>>> with the >>>>> intention to put serialversion inside of it. But serialver doesn't >>>>> want to give >>>>> my the serialver. I also think that ExpiringCache is not >>>>> serializable but the >>>>> warning was clear: the anonymous inner class is seriallizable and >>>>> has no >>>>> explicit serialversionuid. >>>>> >>>>> FilePermission.java: I have starred at the code between line 453 >>>>> and 547 for >>>>> over an hour, because i thought that there is a bug within the >>>>> expression "i >= >>>>> matchlen" in line 530 and the both "i != -1" in lines 457 and 461. >>>>> But there is >>>>> no bug. But i wanted to left this code slightly more readable. I >>>>> introduced the >>>>> method skipBeforePreviousComma to make it possible to work-around the >>>>> fallthought warning with an return statement. This code-change >>>>> need's some more >>>>> review attention. Maybe we should split this up for another >>>>> cleanup. I think >>>>> the whole method needs some rewrite. >>>>> >>>>> Some classes had no change at all. Maybe webrev created them >>>>> because there >>>>> where changes in my history/branches. There were some patches from >>>>> alan i saw >>>>> to late. Maybe webrev is confused of the multiple merges. >>>>> >>>>> Can someone please create a CR for this and >>>>> >>>>> [0] >>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html >>>>> >>>>> >>>>> >>> Thanks for the good feedback. >>> >>> I splitted my change to the trivial part and will start discussion >>> of FilePermission change on core-libs-dev after the cleanup event. >>> I created a new webrev with the suggested changes here[2] >>> >>> [2] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html >>> >>> -- Sebastian >> >> -- >> Oracle >> Brandon Passanisi | Principle Member of Technical Staff >> >> Oracle Java Standards Conformance >> >> Green Oracle Oracle is committed >> to developing practices and products that help protect the environment > From schlosna at gmail.com Fri Dec 2 15:54:04 2011 From: schlosna at gmail.com (David Schlosnagle) Date: Fri, 2 Dec 2011 10:54:04 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> Message-ID: On Fri, Dec 2, 2011 at 8:19 AM, Lance Andersen - Oracle < Lance.Andersen at oracle.com> wrote: > Adding @Deprecated changes the signatures so I need to coordinate any > changes as it will result in TCK signature failures. This is something I > will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a > chance for input. > Lance, I figured it was worth a shot to try and piggy back on your changes to cleanup the rest of java.sql.* :) I assume it is the @Deprecated annotation's retention runtime value that introduces TCK signature compatibility issues, is that correct? If so, that is an interesting catch-22 when the idea behind @Deprecated is to maintain a backward compatible API for some period to be determined to the API provider. It seems like this might be worthwhile mentioning in the deprecation guide [1], and maybe even additions to Joe Darcy's excellent treatises on compatibility [2] [3]. I completely understand wanting to wait for the appropriate approvals to move forward with the remaining cleanup. On Fri, Dec 2, 2011 at 9:14 AM, Lance Andersen - Oracle < Lance.Andersen at oracle.com> wrote: > Here is the diff for DriverManager, I won't be pushing another webrev > unless the word is to go ahead and add @Deprecated to the com/* classes of > the RowSet RI or there is another change requested that is more detailed: > That looks good to me, unfortunately I don't think I can be used as a reviewer. Thanks, Dave [1]: http://docs.oracle.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html [2]: http://blogs.oracle.com/darcy/entry/kinds_of_compatibility [3]: http://blogs.oracle.com/darcy/entry/release_types_compatibility_regions From sean.mullan at oracle.com Fri Dec 2 16:02:28 2011 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 02 Dec 2011 11:02:28 -0500 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4ED86811.4090804@gmx.de> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> Message-ID: <4ED8F694.8010705@oracle.com> On 12/2/11 12:54 AM, Sebastian Sickelmann wrote: > The 3 solutions I mentioned are solutions that can be commonly discussed > for a solution choosing for all Exceptions in OpenJDK. > > Webrev[0] shows solution 1 for jx/x/s-Exceptions. From the users > perspective (outside view) solution 1 and 3 are completely similar. > > Solution 2 are used widely in jdk codebase in Exceptions that had no > chaining before it was introduced globally throught java/lang/Throwable. > An Example for Solution2 is java/lang/RuntimeException. > An webrev that show this jx/x/s-Exception is webrev[1] > > Solution 3 is actually not used by any Exception in JDK (or I haven't > found them) > > The problem i see is that we now have 2 ways exception-chaining might work. > > * Solution 1 disallows chaining after creation. > * Solution 2 disallows chaining only after creation with an ctors that > supports it or after a call to initCause. > > We should only support one solution. > If we introduce the commonly used exception-ctors for every class (which > i actually try) we can switch over to an solutions that is consistent > for the user. I think every Exception that gives the user the choice to > use exception-chaining via a ctor-variant that supports chaining should > disallow changes of the exception-chain via initCause even when the > exception is created with an ctor that doesn't had chaining parameters. > This is what i call Solution 3. > > Unfortunately Solution 3 introduces an behavior-incompatibility. In JDK > every think is fine and we can make all the changes that are needed to > do (replace all initCause calls with the right ctor-choice). But in the > outside world there maybe users that rely on the feature of plumbing up > the exception chain after creation. Right, and I think some of those cases are legitimate. I have seen exception handling code which performs cleanup in a finally block, and if an exception is thrown in the finally block, it catches that exception, but sets the cause of the exception to the original exception. This would not be possible with solution 3 if there was already a ctor that had a cause parameter. For example, I have seen code like this: Throwable t = null; try { ... } catch (Exception x) { t = x; } finally { try { ... } catch (FooException e) { if (t != null) e.initCause(t); throw e; } } > Those will get an Exception when > they call initCause. Maybe we can warn them to not use initCause anymore > through marking initCause deprecated. And switch over to solution 3 over > several releases (maybe OpenJDK9 or 10) My opinion is that the potential compatibility issues, as well as having awkward workarounds for the case above outweigh the advantages of making this change. So I am not in favor of solution 3. But that's just my opinion, others may feel differently. > Sorry for the misleading webrev-mappings in my previous mails. Hope to > cleared thinks up now (with my wired english ;-) ). Ok, so I think we're down to 2 solutions. Give me some more time to look them over more carefully and get back to you. --Sean > > -- Sebastian > > > [0] Solution 1 > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html > [1] Solution 2 > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html From Lance.Andersen at oracle.com Fri Dec 2 16:06:39 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Fri, 2 Dec 2011 11:06:39 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> Message-ID: <3F0C2667-DE7E-4830-85A1-22A5CDE1547F@oracle.com> On Dec 2, 2011, at 10:54 AM, David Schlosnagle wrote: > On Fri, Dec 2, 2011 at 8:19 AM, Lance Andersen - Oracle wrote: > Adding @Deprecated changes the signatures so I need to coordinate any changes as it will result in TCK signature failures. This is something I will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a chance for input. > > Lance, > > I figured it was worth a shot to try and piggy back on your changes to cleanup the rest of java.sql.* :) Appreciate the suggestion. > > I assume it is the @Deprecated annotation's retention runtime value that introduces TCK signature compatibility issues, is that correct? Yes, here is the reason why: @Documented @Retention(value=RUNTIME) @Target(value={CONSTRUCTOR,FIELD,LOCAL_VARIABLE,METHOD,PACKAGE,PARAMETER,TYPE}) public @interface Deprecated why Here is @Documented @Documented @Retention(value=RUNTIME) @Target(value=ANNOTATION_TYPE) public @interface Documented Indicates that annotations with a type are to be documented by javadoc and similar tools by default. This type should be used to annotate the declarations of types whose annotations affect the use of annotated elements by their clients. If a type declaration is annotated with Documented, its annotations become part of the public API of the annotated elements. Since: 1.5 As you can see this results in an API change which would result in the signatures changing. This type of change would be flagged by the signature tests so we would not want to do this in say JDK 7. It would be OK for JDK 8 but I would not want to do it as part of the cleanup changes. It is interesting that the behavior is different between @Deprecated vs @deprecated(javadoc mark up) and I have had previous discussions on this as one vendor made this innocent change in a standalone technology and then could not pass the signature tests for a given TCK. Again, my desire is to do this soon, and might for the com.* classes assuming Alan/Stuart see no issue as part of this push Many thanks for your time Best Lance > If so, that is an interesting catch-22 when the idea behind @Deprecated is to maintain a backward compatible API for some period to be determined to the API provider. It seems like this might be worthwhile mentioning in the deprecation guide [1], and maybe even additions to Joe Darcy's excellent treatises on compatibility [2] [3]. I completely understand wanting to wait for the appropriate approvals to move forward with the remaining cleanup. > > > On Fri, Dec 2, 2011 at 9:14 AM, Lance Andersen - Oracle wrote: > Here is the diff for DriverManager, I won't be pushing another webrev unless the word is to go ahead and add @Deprecated to the com/* classes of the RowSet RI or there is another change requested that is more detailed: > > That looks good to me, unfortunately I don't think I can be used as a reviewer. > > Thanks, > Dave > > [1]: http://docs.oracle.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html > [2]: http://blogs.oracle.com/darcy/entry/kinds_of_compatibility > [3]: http://blogs.oracle.com/darcy/entry/release_types_compatibility_regions > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From chris.hegarty at oracle.com Fri Dec 2 16:11:19 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Fri, 02 Dec 2011 16:11:19 +0000 Subject: hg: jdk8/tl/jdk: 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers Message-ID: <20111202161129.210C34751E@hg.openjdk.java.net> Changeset: 37f6e294759f Author: chegar Date: 2011-12-02 14:17 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/37f6e294759f 7116957: javax.script.ScriptEngineManager should use java.util.ServiceLoader to lookup service providers Reviewed-by: alanb, lancea ! src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java ! src/share/classes/javax/script/ScriptEngineManager.java ! src/share/classes/sun/net/ftp/FtpClientProvider.java From dl at cs.oswego.edu Fri Dec 2 16:22:19 2011 From: dl at cs.oswego.edu (Doug Lea) Date: Fri, 02 Dec 2011 11:22:19 -0500 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package In-Reply-To: <4ED8DFCF.9050609@oracle.com> References: <4ED8DFCF.9050609@oracle.com> Message-ID: <4ED8FB3B.5040804@cs.oswego.edu> On 12/02/11 09:25, Chris Hegarty wrote: > Cleanup compiler warnings in the java.util.concurrent.atomic package. > > This is a sync up with the raw type warning fixes in Doug's CVS, along with some > minor style cleanup. > > With this change there are still 2 outstanding unchecked casts in > AtomicReferenceArray and AtomicReferenceFieldUpdater. Will contact Doug > separately about suppressing these. We just went through these and others, and believe that everything is now warning free. -Doug From omajid at redhat.com Fri Dec 2 17:00:29 2011 From: omajid at redhat.com (Omair Majid) Date: Fri, 02 Dec 2011 12:00:29 -0500 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <4ED8C221.7070603@oracle.com> References: <4ED8C221.7070603@oracle.com> Message-ID: <4ED9042D.3000307@redhat.com> Hi, On 12/02/2011 07:18 AM, Alan Bateman wrote: > > cc'ing core-libs-dev as that is the place to discuss these changes. I > see on the sign-up sheet [1] that omajid has signed up for java.lang, > maybe you are working together? Unfortunately, David and I were not working together :( Anyway, here is my webrev for java.lang.* http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ Sorry about the delay, building and testing this took longer than I had expected it to. Also, this patch only addresses the warnings pointed out by javac. The classes java.lang.ThreadLocal and java.lang.ClassValue are not included in the webrev. The fixes for ThreadLocal were basically sprinkling @SuppressWarnings("unchecked") throughout and the fixes for ClassValue looked slightly more complex when I tried to reduce the use of rawtypes. I will post a separate webrev for those later. Cheers, Omair From sebastian.sickelmann at gmx.de Fri Dec 2 17:02:58 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Fri, 02 Dec 2011 18:02:58 +0100 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED8EE66.7020502@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> Message-ID: <4ED904C2.7060803@gmx.de> Am 02.12.2011 16:27, schrieb Brandon Passanisi: > Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart > Marks regarding this, but Stuart was able to find more instances of > the similar block of "fallthrough" code. I can volunteer to apply > your upcoming change to FilePermission to the other files if you > wish. Or, you can try applying the change to the other files, but if > you don't have time I don't mind doing it. Here's the section of > Stuart's e-mail on this topic: > > ------------------------------------------------------------------------------------- > (Incidentally, this is the third time I've reviewed code today that > looks exactly like this. The other cases are in > java.io.FilePermission > and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ > into a set of cases that do nothing but break; and they have similar > ("ackbarfaccept") comments. It would be nice if these chunks of code > could be unified, but they differ in a number of fiddly details.) > > (The string "ackbarfaccept" occurs in the following files: > 1. java/io/FilePermission.java > 2. java/net/SocketPermission.java > 3. java/util/PropertyPermission.java > 4. javax/management/MBeanPermission.java > 5. javax/security/auth/kerberos/ServicePermission.java > Hmmm.) > ------------------------------------------------------------------------------------- > > Thanks. Hi Brandon, Hi Stuart, i had a look at all those classes and it seems to be the same algorithm. In an normal project (not the jdk) i would suggest to completely refactor it and make some code de-duplication cleanup. But if i thinks on projects like jigsaw this can easily get a real problem. What do you think, should we try to cleanup them all. Or should we try to make some de-duplication/code-reuse refactoring. -- Sebastian > > On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >> Hi Brandon, >> >> i will try to work out a fix for both and cc the review request to you. >> >> -- Sebastian >> >> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>> mentioned that the "fallthrough" code in FilePermission.java also >>> exists in java.util.PropertyPermission.java. Maybe the code author >>> had done some copy/paste when working on these files. Stuart had >>> said that you might be planning on doing some work on this after the >>> warnings cleanup work. If/when you do this work, maybe you can let >>> me know so that I can sync the same changes you apply to >>> FilePermission.java to PropertyPermission.java? Or, maybe you can >>> apply the same changes yourself to PropertyPermission.java? >>> >>> Thanks. >>> >>> On 12/1/2011 8:27 AM, Sebastian Sickelmann wrote: >>>> Am 01.12.2011 10:16, schrieb Stuart Marks: >>>>> Hi Sebastian, >>>>> >>>>> Thanks for submitting this patch! I've filed bug 7116890 to cover >>>>> this set of changes. >>>>> >>>>> Regarding webrev, it probably does get confused by merges in the >>>>> history. By default it tries to show differences between the tip >>>>> of the target repository and tip + uncommitted changes in your >>>>> local repository. This isn't always the right thing. One thing you >>>>> might try is to use the -r option to specify a particular revision >>>>> in the history against which to generate the diffs. But, having a >>>>> few extra files isn't a big deal. >>>>> >>>>> On to your changes. >>>>> >>>>> Most of them are really good and are exactly the kind of simple >>>>> change we're looking for, as I posted a little while ago. [1] >>>>> >>>>> The ExpiringCache.java case is an interesting one. I think it's >>>>> possible to add a static serialVersionUID field within the >>>>> anonymous class. It's hard to run serialver over an anonymous >>>>> class (actually it might be possible to run the checksum algorithm >>>>> on the loaded class) but if in practice it's never serialized, who >>>>> cares what the "correct" value is? You could just use a value of 0L. >>>>> >>>>> An alternative would also be to use @SuppressWarnings("serial"). >>>>> Since the constructor is so short, you could just put it on the >>>>> constructor. >>>>> >>>>> Actually I prefer @SuppressWarnings, since adding serialVersionUID >>>>> adds to the system's footprint. If it's never used, we shouldn't >>>>> bother defining it. >>>>> >>>>> Given these alternatives, it's not necessary to create a static >>>>> CacheHashMapImpl class. >>>>> >>>>> Regarding the FilePermission.java change, yes, I see that the >>>>> skipBeforePreviousComma() change is problematic. I puzzled over it >>>>> for a while too. I wish I had sent out the Coding Guideline [1] >>>>> earlier; it might have saved you an hour. :-) Sorry about that. >>>>> >>>>> A cleanup/rewrite of this code would indeed be better done >>>>> separate from Warnings Cleanup Day. But I think there might be a >>>>> simple way to get rid of the warning without doing a cleanup or >>>>> refactoring. The warning message in question is at line 535 of the >>>>> original code, about falling through to the next case. But the >>>>> next case doesn't actually do anything but break. Could we just >>>>> change the /*FALLTHROUGH*/ comment to a break statement? I think >>>>> that would fix the warning without changing the logic at all. >>>>> >>>>> s'marks >>>>> >>>>> [1] >>>>> http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html >>>>> >>>>> >>>>> On 11/30/11 8:33 PM, Sebastian Sickelmann wrote: >>>>>> Hi, >>>>>> >>>>>> i have a webrev[0] that contains some warning cleanup for java.io >>>>>> It is based on rev 7795c41ed54c >>>>>> http://hg.openjdk.java.net/jdk8/tl/jdk/ >>>>>> >>>>>> Some comments to the changes: >>>>>> >>>>>> ExpiringCache.java: Changed anonymous inner class to inner class >>>>>> with the >>>>>> intention to put serialversion inside of it. But serialver >>>>>> doesn't want to give >>>>>> my the serialver. I also think that ExpiringCache is not >>>>>> serializable but the >>>>>> warning was clear: the anonymous inner class is seriallizable and >>>>>> has no >>>>>> explicit serialversionuid. >>>>>> >>>>>> FilePermission.java: I have starred at the code between line 453 >>>>>> and 547 for >>>>>> over an hour, because i thought that there is a bug within the >>>>>> expression "i >= >>>>>> matchlen" in line 530 and the both "i != -1" in lines 457 and >>>>>> 461. But there is >>>>>> no bug. But i wanted to left this code slightly more readable. I >>>>>> introduced the >>>>>> method skipBeforePreviousComma to make it possible to work-around >>>>>> the >>>>>> fallthought warning with an return statement. This code-change >>>>>> need's some more >>>>>> review attention. Maybe we should split this up for another >>>>>> cleanup. I think >>>>>> the whole method needs some rewrite. >>>>>> >>>>>> Some classes had no change at all. Maybe webrev created them >>>>>> because there >>>>>> where changes in my history/branches. There were some patches >>>>>> from alan i saw >>>>>> to late. Maybe webrev is confused of the multiple merges. >>>>>> >>>>>> Can someone please create a CR for this and >>>>>> >>>>>> [0] >>>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/webrev0_based_on_7795c41ed54c/index.html >>>>>> >>>>>> >>>>>> >>>> Thanks for the good feedback. >>>> >>>> I splitted my change to the trivial part and will start discussion >>>> of FilePermission change on core-libs-dev after the cleanup event. >>>> I created a new webrev with the suggested changes here[2] >>>> >>>> [2] >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/Warning_Cleanup_Java_io/CR7116890_0/index.html >>>> >>>> -- Sebastian >>> >>> -- >>> Oracle >>> Brandon Passanisi | Principle Member of Technical Staff >>> >>> Oracle Java Standards Conformance >>> >>> Green Oracle Oracle is committed >>> to developing practices and products that help protect the environment >> From chris.hegarty at oracle.com Fri Dec 2 17:18:42 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 02 Dec 2011 17:18:42 +0000 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package In-Reply-To: <4ED8FB3B.5040804@cs.oswego.edu> References: <4ED8DFCF.9050609@oracle.com> <4ED8FB3B.5040804@cs.oswego.edu> Message-ID: <4ED90872.2070909@oracle.com> On 12/ 2/11 04:22 PM, Doug Lea wrote: > .... > We just went through these and others, and believe that everything > is now warning free. Thanks Doug, Wow you guys are quick! I pulled in these specific changes (atomic) and updated the webrev: http://cr.openjdk.java.net/~chegar/7117360/webrev.01/webrev/ I'm slowly working through the j.u.c.* classes and hope to have a webrev out next week. -Chris. > > -Doug > From alan.bateman at oracle.com Fri Dec 2 17:48:39 2011 From: alan.bateman at oracle.com (alan.bateman at oracle.com) Date: Fri, 02 Dec 2011 17:48:39 +0000 Subject: hg: jdk8/tl/jdk: 7117357: Warnings in sun.instrument, tools and other sun.* classes Message-ID: <20111202174849.7CBD147520@hg.openjdk.java.net> Changeset: 9950e2c9f3b5 Author: alanb Date: 2011-12-02 17:37 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/9950e2c9f3b5 7117357: Warnings in sun.instrument, tools and other sun.* classes Reviewed-by: lancea, chegar ! src/share/classes/sun/instrument/InstrumentationImpl.java ! src/share/classes/sun/instrument/TransformerManager.java ! src/share/classes/sun/launcher/LauncherHelper.java ! src/share/classes/sun/management/counter/perf/PerfInstrumentation.java ! src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java ! src/share/classes/sun/net/RegisteredDomain.java ! src/share/classes/sun/net/www/protocol/jar/Handler.java ! src/share/classes/sun/tools/attach/HotSpotAttachProvider.java ! src/share/classes/sun/tools/jinfo/JInfo.java ! src/share/classes/sun/tools/jmap/JMap.java ! src/share/classes/sun/tools/jps/Jps.java ! src/share/classes/sun/tools/jstack/JStack.java ! src/share/classes/sun/tools/serialver/SerialVer.java From mike.duigou at oracle.com Fri Dec 2 20:25:26 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Fri, 2 Dec 2011 12:25:26 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4ED8837A.1030300@oracle.com> References: <4ED8837A.1030300@oracle.com> Message-ID: Looks good. In NormalizerImpl.java: - The parens are probably not needed around 'length=(srcIndex-prevSrc);' UnicodeSet.java: - I confirmed, just to be sure, that the added 'break;' statements have no effect. On Dec 1 2011, at 23:51 , Yuka Kamiya wrote: > Hello, > > Could someone please review this fix? > > http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ > > Some warnings are still issued even after this fix, and that's intentional. > I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. > > The original number of warnings in this area was 70. Now 16. > > Thanks, > -- > Yuka Kamiya From stuart.marks at oracle.com Fri Dec 2 20:45:15 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Fri, 02 Dec 2011 12:45:15 -0800 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <3F0C2667-DE7E-4830-85A1-22A5CDE1547F@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> <3F0C2667-DE7E-4830-85A1-22A5CDE1547F@oracle.com> Message-ID: <4ED938DB.20409@oracle.com> Hi Lance, I'm OK with postponing the @Deprecated work, and doing a separate pass for @Deprecated, including the com.sun.* stuff at that time. There's enough stuff in this changeset already. I think we're better off getting it in now than putting more stuff in and getting it reviewed again. I think you've done this to yourself on this review twice already. :-) Comments on webrev.03 follow. CachedRowSetImpl.java -- 451 @SuppressWarnings("rawtypes") 452 public CachedRowSetImpl(Hashtable env) throws SQLException { The warning suppression covers the entire constructor. You could do this... public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) Ugh. As you said earlier, probably not worth spending more cycles on this. 5710 Class c = (Class)map.get(s.getSQLTypeName()); The cast to (Class) is probably unnecessary since the values in the map are already Class. JoinRowSetImpl.java -- 932 (vecRowSetsInJOIN.get(i)).getMatchColumnNames()[0]); 4179 Integer i = (vecJoinType.get(vecJoinType.size()-1)); Can probably remove extra set of parens that were necessary when the cast was there. CachedRowSetWriter.java -- 576 c = (Class)map.get(s.getSQLTypeName()); Redundant cast to (Class). BaseRowSet.java -- 622 for (Iterator i = listeners.iterator(); i.hasNext(); ) { 623 ((RowSetListener)i.next()).cursorMoved(event); 624 } Hm, listeners is Vector so some casts could be removed, 622 for (Iterator i = listeners.iterator(); i.hasNext(); ) { 623 (i.next()).cursorMoved(event); 624 } or even changed to 622 for (RowSetListener rsl : listeners) { 623 rsl.cursorMoved(event); 624 } There are several other cases in this file where you used Iterator. You might check them to see if similar simplifications could be done there as well. (There is also Iterator used in CachedRowSetImpl.java but this is used to iterate over rvh, a Vector, but then the elements are cast to Row. This begs the question of why rvh isn't Vector but this is beyond the scope of warnings cleanup.) SerialArray.java -- 290 default: 291 ; I'm surprised you didn't remove these lines as you had done above. ******* With the exception of changing Iterator to use a for-each loop in BaseRowSet.java, all of these comments are just little tweaks, so I don't think we need another webrev for them. It's up to you whether to proceed with the BaseRowSet changes I recommend. Regardless, I don't want to see another webrev of this code. Check it in!! :-) s'marks On 12/2/11 8:06 AM, Lance Andersen - Oracle wrote: > > On Dec 2, 2011, at 10:54 AM, David Schlosnagle wrote: > >> On Fri, Dec 2, 2011 at 8:19 AM, Lance Andersen - Oracle wrote: >> Adding @Deprecated changes the signatures so I need to coordinate any changes as it will result in TCK signature failures. This is something I will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a chance for input. >> >> Lance, >> >> I figured it was worth a shot to try and piggy back on your changes to cleanup the rest of java.sql.* :) > > Appreciate the suggestion. > >> >> I assume it is the @Deprecated annotation's retention runtime value that introduces TCK signature compatibility issues, is that correct? > > Yes, here is the reason why: > > > @Documented > @Retention(value=RUNTIME) > @Target(value={CONSTRUCTOR,FIELD,LOCAL_VARIABLE,METHOD,PACKAGE,PARAMETER,TYPE}) > public @interface Deprecated > > why Here is @Documented > > > @Documented > @Retention(value=RUNTIME) > @Target(value=ANNOTATION_TYPE) > public @interface Documented > Indicates that annotations with a type are to be documented by javadoc and similar tools by default. This type should be used to annotate the declarations of types whose annotations affect the use of annotated elements by their clients. If a type declaration is annotated with Documented, its annotations become part of the public API of the annotated elements. > Since: > 1.5 > > As you can see this results in an API change which would result in the signatures changing. This type of change would be flagged by the signature tests so we would not want to do this in say JDK 7. It would be OK for JDK 8 but I would not want to do it as part of the cleanup changes. > > It is interesting that the behavior is different between @Deprecated vs @deprecated(javadoc mark up) and I have had previous discussions on this as one vendor made this innocent change in a standalone technology and then could not pass the signature tests for a given TCK. > > Again, my desire is to do this soon, and might for the com.* classes assuming Alan/Stuart see no issue as part of this push > > Many thanks for your time > > Best > Lance >> If so, that is an interesting catch-22 when the idea behind @Deprecated is to maintain a backward compatible API for some period to be determined to the API provider. It seems like this might be worthwhile mentioning in the deprecation guide [1], and maybe even additions to Joe Darcy's excellent treatises on compatibility [2] [3]. I completely understand wanting to wait for the appropriate approvals to move forward with the remaining cleanup. >> >> >> On Fri, Dec 2, 2011 at 9:14 AM, Lance Andersen - Oracle wrote: >> Here is the diff for DriverManager, I won't be pushing another webrev unless the word is to go ahead and add @Deprecated to the com/* classes of the RowSet RI or there is another change requested that is more detailed: >> >> That looks good to me, unfortunately I don't think I can be used as a reviewer. >> >> Thanks, >> Dave >> >> [1]: http://docs.oracle.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html >> [2]: http://blogs.oracle.com/darcy/entry/kinds_of_compatibility >> [3]: http://blogs.oracle.com/darcy/entry/release_types_compatibility_regions >> > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > From stuart.marks at oracle.com Fri Dec 2 21:53:01 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Fri, 02 Dec 2011 13:53:01 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4ED8837A.1030300@oracle.com> References: <4ED8837A.1030300@oracle.com> Message-ID: <4ED948BD.5030005@oracle.com> On 12/1/11 11:51 PM, Yuka Kamiya wrote: > Hello, > > Could someone please review this fix? > > http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ > > Some warnings are still issued even after this fix, and that's intentional. > I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. > > The original number of warnings in this area was 70. Now 16. Hi Yuka, I wanted to ask about this bit of code in BidiBase.java: 3492 return new AttributedCharacterIterator.Attribute(name) { 3493 static final long serialVersionUID = -4899048055171307694L; 3494 }; This is defining a serialVersionUID for an anonymous inner class. Serialization of anonymous classes is quite problematic. Among the problems is that anonymous classes have generated names that aren't specified. In this case the name is sun.text.bidi.BidiBase$TextAttributeConstants$1 which appears to be where you got the UID value. Unfortunately a different compiler might assign a different name. Or if this file is modified to use another anonymous class, this class might get a suffix of $2 (even if the same compiler is used). This means that it's pretty much impossible to guarantee serialization compatibility of anonymous classes. (Thanks to Joe Darcy, who explained this to me just yesterday.) You probably added a serialVersionUID because the compiler issued a warning about the lack of one. :-) In this case I think what makes the most sense is simply to suppress the warning. Actually the original code is a little odd, as it returns an instance of an anonymous subclass of AttributedCharacterIterator.Attribute, instead of an instance of AttributedCharacterIterator.Attribute itself. I don't if this is right or wrong. s'marks From stuart.marks at oracle.com Fri Dec 2 22:04:17 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Fri, 02 Dec 2011 14:04:17 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: References: <4ED8837A.1030300@oracle.com> Message-ID: <4ED94B61.2010402@oracle.com> On 12/2/11 12:25 PM, Mike Duigou wrote: > UnicodeSet.java: > - I confirmed, just to be sure, that the added 'break;' statements have no effect. A stylistic comment, not directly relevant to warnings fixes. The compiler warns about possible fall-through to the next case, but the locations where "break" appears to be missing all follow calls to the syntaxError() method. Turns out this method always throws an exception, but the compiler isn't as smart as Mike :-) and so it doesn't realize that control can never return to the switch statement to fall through to the next case. Adding a break statement shuts up the compiler but the statement is in fact unreachable. Another point is that, to the programmer's eye, it really does look like there is a missing break statement. An alternative way to structure this is to have syntaxError() return an exception instead of throwing it, relying on the caller to do the throw. This is a bit unusual, but it makes things read much better: switch (something) { case 1: ... throw syntaxError(...); case 2: ... } This makes it clear to the compiler and the programmer that there is no fall through. (Hat tip to Tom Hawtin for this.) s'marks From stuart.marks at oracle.com Fri Dec 2 22:12:28 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Fri, 02 Dec 2011 14:12:28 -0800 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED904C2.7060803@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> Message-ID: <4ED94D4C.8000107@oracle.com> I'm adding Weijun (Max) Wang to this thread. The same "ackbarfaccept" code had come up a third time when I was reviewing some of Max's changes. The code in question all has to do with permissions, and Max is in the security group, so he might have a better insight whether doing a refactoring is appropriate and how to approach doing it. Some searching around reveals that "ackbarfaccept" appears in the PlayerPermission class of the Java ME Mobile Media API (not in any of the OpenJDK repositories) so it looks like the code has been copied even more times than are visible here. Perhaps a public permissions parsing utility method is called for. s'marks On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: > Am 02.12.2011 16:27, schrieb Brandon Passanisi: >> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks >> regarding this, but Stuart was able to find more instances of the similar >> block of "fallthrough" code. I can volunteer to apply your upcoming change >> to FilePermission to the other files if you wish. Or, you can try applying >> the change to the other files, but if you don't have time I don't mind doing >> it. Here's the section of Stuart's e-mail on this topic: >> >> ------------------------------------------------------------------------------------- >> (Incidentally, this is the third time I've reviewed code today that >> looks exactly like this. The other cases are in java.io.FilePermission >> and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ >> into a set of cases that do nothing but break; and they have similar >> ("ackbarfaccept") comments. It would be nice if these chunks of code >> could be unified, but they differ in a number of fiddly details.) >> >> (The string "ackbarfaccept" occurs in the following files: >> 1. java/io/FilePermission.java >> 2. java/net/SocketPermission.java >> 3. java/util/PropertyPermission.java >> 4. javax/management/MBeanPermission.java >> 5. javax/security/auth/kerberos/ServicePermission.java >> Hmmm.) >> ------------------------------------------------------------------------------------- >> >> Thanks. > > Hi Brandon, > Hi Stuart, > > i had a look at all those classes and it seems to be the same algorithm. In an > normal project (not the jdk) i would suggest to completely refactor it and make > some code de-duplication cleanup. But if i thinks on projects like jigsaw this > can easily get a real problem. What do you think, should we try to cleanup them > all. Or should we try to make some de-duplication/code-reuse refactoring. > > > -- Sebastian >> >> On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >>> Hi Brandon, >>> >>> i will try to work out a fix for both and cc the review request to you. >>> >>> -- Sebastian >>> >>> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>>> mentioned that the "fallthrough" code in FilePermission.java also exists in >>>> java.util.PropertyPermission.java. Maybe the code author had done some >>>> copy/paste when working on these files. Stuart had said that you might be >>>> planning on doing some work on this after the warnings cleanup work. >>>> If/when you do this work, maybe you can let me know so that I can sync the >>>> same changes you apply to FilePermission.java to PropertyPermission.java? >>>> Or, maybe you can apply the same changes yourself to PropertyPermission.java? From Lance.Andersen at oracle.com Fri Dec 2 23:02:13 2011 From: Lance.Andersen at oracle.com (Lance Andersen - Oracle) Date: Fri, 2 Dec 2011 18:02:13 -0500 Subject: 7116445: Miscellaneous warnings in the JDBC/RowSet classes In-Reply-To: <4ED938DB.20409@oracle.com> References: <4ED57954.6040601@oracle.com> <5C0D27F9-3942-452A-9380-B7C4CB475F07@oracle.com> <4ED698ED.3050304@oracle.com> <769A3337-D245-4570-9F81-D5FAF7309E70@oracle.com> <4ED7A89F.8000504@oracle.com> <4ED7ED62.6010203@oracle.com> <5D47B97C-4142-45EC-BB8A-3E0EFBF97BBA@oracle.com> <4ED7F16F.9040205@oracle.com> <29C72AF1-24D6-46E8-A7E7-FC955F2310C2@oracle.com> <04B908A4-C884-4462-85CD-D510FBD9ED77@oracle.com> <4D08E432-10BB-48E7-9263-4AD3F9B0B2CA@oracle.com> <3F0C2667-DE7E-4830-85A1-22A5CDE1547F@oracle.com> <4ED938DB.20409@oracle.com> Message-ID: Hi Stuart, On Dec 2, 2011, at 3:45 PM, Stuart Marks wrote: > Hi Lance, > > I'm OK with postponing the @Deprecated work, and doing a separate pass for @Deprecated, including the com.sun.* stuff at that time. OK, will do that separately > > There's enough stuff in this changeset already. I think we're better off getting it in now than putting more stuff in and getting it reviewed again. I think you've done this to yourself on this review twice already. :-) Probably, but this code has been the gift that keeps on giving :-) > > Comments on webrev.03 follow. > > CachedRowSetImpl.java -- > > 451 @SuppressWarnings("rawtypes") > 452 public CachedRowSetImpl(Hashtable env) throws SQLException { > > The warning suppression covers the entire constructor. You could do this... > > public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) I can make that change sure and done > > Ugh. As you said earlier, probably not worth spending more cycles on this. > > 5710 Class c = (Class)map.get(s.getSQLTypeName()); > > The cast to (Class) is probably unnecessary since the values in the map are already Class. agree done > > JoinRowSetImpl.java -- > > 932 (vecRowSetsInJOIN.get(i)).getMatchColumnNames()[0]); > 4179 Integer i = (vecJoinType.get(vecJoinType.size()-1)); > > Can probably remove extra set of parens that were necessary when the cast was there. done > > CachedRowSetWriter.java -- > > 576 c = (Class)map.get(s.getSQLTypeName()); > > Redundant cast to (Class). > done > BaseRowSet.java -- > > 622 for (Iterator i = listeners.iterator(); i.hasNext(); ) { > 623 ((RowSetListener)i.next()).cursorMoved(event); > 624 } > > Hm, listeners is Vector so some casts could be removed, > > 622 for (Iterator i = listeners.iterator(); i.hasNext(); ) { > 623 (i.next()).cursorMoved(event); > 624 } > > or even changed to > > 622 for (RowSetListener rsl : listeners) { > 623 rsl.cursorMoved(event); > 624 } > > There are several other cases in this file where you used Iterator. You might check them to see if similar simplifications could be done there as well. I thought about making the change as part of this changeset, but thought it might be too much. Here is the change: dhcp-adc-twvpn-2-vpnpool-10-154-44-9:rowset lanceandersen$ !hg hg diff BaseRowSet.java diff -r 43a630f11af6 src/share/classes/javax/sql/rowset/BaseRowSet.java --- a/src/share/classes/javax/sql/rowset/BaseRowSet.java Wed Nov 30 13:11:16 2011 -0800 +++ b/src/share/classes/javax/sql/rowset/BaseRowSet.java Fri Dec 02 17:19:53 2011 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -619,8 +619,8 @@ checkforRowSetInterface(); if (listeners.isEmpty() == false) { RowSetEvent event = new RowSetEvent((RowSet)this); - for (Iterator i = listeners.iterator(); i.hasNext(); ) { - ((RowSetListener)i.next()).cursorMoved(event); + for (RowSetListener rsl : listeners) { + rsl.cursorMoved(event); } } } @@ -644,8 +644,8 @@ checkforRowSetInterface(); if (listeners.isEmpty() == false) { RowSetEvent event = new RowSetEvent((RowSet)this); - for (Iterator i = listeners.iterator(); i.hasNext(); ) { - ((RowSetListener)i.next()).rowChanged(event); + for (RowSetListener rsl : listeners) { + rsl.rowChanged(event); } } } @@ -669,8 +669,8 @@ checkforRowSetInterface(); if (listeners.isEmpty() == false) { RowSetEvent event = new RowSetEvent((RowSet)this); - for (Iterator i = listeners.iterator(); i.hasNext(); ) { - ((RowSetListener)i.next()).rowSetChanged(event); + for (RowSetListener rsl : listeners) { + rsl.rowSetChanged(event); } } } dhcp-adc-twvpn-2-vpnpool-10-154-44-9:rowset lanceandersen$ > > (There is also Iterator used in CachedRowSetImpl.java but this is used to iterate over rvh, a Vector, but then the elements are cast to Row. This begs the question of why rvh isn't Vector but this is beyond the scope of warnings cleanup.) > > SerialArray.java -- > > 290 default: > 291 ; > > I'm surprised you didn't remove these lines as you had done above. I thought I got this, but looks like i missed it... got it now :-) > > ******* > > With the exception of changing Iterator to use a for-each loop in BaseRowSet.java, all of these comments are just little tweaks, so I don't think we need another webrev for them. It's up to you whether to proceed with the BaseRowSet changes I recommend. Regardless, I don't want to see another webrev of this code. Check it in!! :-) I made them, thank you... Ran the RowSet TCK and all still passes for me for completeness, I did generate a new webrev http://cr.openjdk.java.net/~lancea/7116445/webrev.04, but will push back if tonight Thank you for your help and reviews through all of these modules Best Lance > > s'marks > > > On 12/2/11 8:06 AM, Lance Andersen - Oracle wrote: >> >> On Dec 2, 2011, at 10:54 AM, David Schlosnagle wrote: >> >>> On Fri, Dec 2, 2011 at 8:19 AM, Lance Andersen - Oracle wrote: >>> Adding @Deprecated changes the signatures so I need to coordinate any changes as it will result in TCK signature failures. This is something I will most likely do as part of the JDBC 4.2 work after giving the JDBC EG a chance for input. >>> >>> Lance, >>> >>> I figured it was worth a shot to try and piggy back on your changes to cleanup the rest of java.sql.* :) >> >> Appreciate the suggestion. >> >>> >>> I assume it is the @Deprecated annotation's retention runtime value that introduces TCK signature compatibility issues, is that correct? >> >> Yes, here is the reason why: >> >> >> @Documented >> @Retention(value=RUNTIME) >> @Target(value={CONSTRUCTOR,FIELD,LOCAL_VARIABLE,METHOD,PACKAGE,PARAMETER,TYPE}) >> public @interface Deprecated >> >> why Here is @Documented >> >> >> @Documented >> @Retention(value=RUNTIME) >> @Target(value=ANNOTATION_TYPE) >> public @interface Documented >> Indicates that annotations with a type are to be documented by javadoc and similar tools by default. This type should be used to annotate the declarations of types whose annotations affect the use of annotated elements by their clients. If a type declaration is annotated with Documented, its annotations become part of the public API of the annotated elements. >> Since: >> 1.5 >> >> As you can see this results in an API change which would result in the signatures changing. This type of change would be flagged by the signature tests so we would not want to do this in say JDK 7. It would be OK for JDK 8 but I would not want to do it as part of the cleanup changes. >> >> It is interesting that the behavior is different between @Deprecated vs @deprecated(javadoc mark up) and I have had previous discussions on this as one vendor made this innocent change in a standalone technology and then could not pass the signature tests for a given TCK. >> >> Again, my desire is to do this soon, and might for the com.* classes assuming Alan/Stuart see no issue as part of this push >> >> Many thanks for your time >> >> Best >> Lance >>> If so, that is an interesting catch-22 when the idea behind @Deprecated is to maintain a backward compatible API for some period to be determined to the API provider. It seems like this might be worthwhile mentioning in the deprecation guide [1], and maybe even additions to Joe Darcy's excellent treatises on compatibility [2] [3]. I completely understand wanting to wait for the appropriate approvals to move forward with the remaining cleanup. >>> >>> >>> On Fri, Dec 2, 2011 at 9:14 AM, Lance Andersen - Oracle wrote: >>> Here is the diff for DriverManager, I won't be pushing another webrev unless the word is to go ahead and add @Deprecated to the com/* classes of the RowSet RI or there is another change requested that is more detailed: >>> >>> That looks good to me, unfortunately I don't think I can be used as a reviewer. >>> >>> Thanks, >>> Dave >>> >>> [1]: http://docs.oracle.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html >>> [2]: http://blogs.oracle.com/darcy/entry/kinds_of_compatibility >>> [3]: http://blogs.oracle.com/darcy/entry/release_types_compatibility_regions >>> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From brandon.passanisi at oracle.com Fri Dec 2 23:58:19 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Fri, 02 Dec 2011 15:58:19 -0800 Subject: Review Request for 7116997 (warning cleanup java.util.PropertyPermission) In-Reply-To: <4ED8169D.7010605@oracle.com> References: <4ED7EF1E.2050003@oracle.com> <4ED8169D.7010605@oracle.com> Message-ID: <4ED9661B.4040308@oracle.com> Thanks for the review Stuart. Here is a another webrev for review containing your suggested change: http://cr.openjdk.java.net/~dmocek/bpassanisi/7116997/webrev.01/ On 12/1/2011 4:06 PM, Stuart Marks wrote: > > On 12/1/11 1:18 PM, Brandon Passanisi wrote: >> I have a webrev pertaining to the warning cleanup changes for >> java.util.PropertyPermission ready for review. Here's the info: >> >> Bug: 7116997 >> Webrev: >> http://cr.openjdk.java.net/~dmocek/bpassanisi/7116997/webrev.00/ >> > > Hi Brandon, > > Can you take out the @SuppressWarnings from the getMask() method, and > change the /*FALLTHROUGH*/ comment at line 309 to "break" instead? I > think this is equivalent code, and it will get rid of the warning > message without having to suppress warnings. > > thanks. > > s'marks -- Oracle Brandon Passanisi | Principle Member of Technical Staff Oracle Java Standards Conformance Green Oracle Oracle is committed to developing practices and products that help protect the environment From brandon.passanisi at oracle.com Fri Dec 2 23:59:36 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Fri, 02 Dec 2011 15:59:36 -0800 Subject: Review request for bug #5063455 Message-ID: <4ED96668.3050808@oracle.com> Hello core-libs-dev. I was wondering if somebody could review the following proposed fix and test case for bug #5063455. Here's the info: Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5063455 Webrev: http://cr.openjdk.java.net/~sherman/5063455/webrev/ Thanks. -- Oracle Brandon Passanisi | Principle Member of Technical Staff Oracle Java Standards Conformance Green Oracle Oracle is committed to developing practices and products that help protect the environment From naoto.sato at oracle.com Sat Dec 3 00:05:06 2011 From: naoto.sato at oracle.com (naoto.sato at oracle.com) Date: Sat, 03 Dec 2011 00:05:06 +0000 Subject: hg: jdk8/tl/jdk: 7117465: Warning cleanup for IMF classes Message-ID: <20111203000516.221AD47548@hg.openjdk.java.net> Changeset: 42532a097816 Author: naoto Date: 2011-12-02 16:04 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/42532a097816 7117465: Warning cleanup for IMF classes Reviewed-by: okutsu ! src/share/classes/java/awt/im/InputMethodHighlight.java ! src/share/classes/sun/awt/im/CompositionArea.java ! src/share/classes/sun/awt/im/CompositionAreaHandler.java ! src/share/classes/sun/awt/im/InputContext.java ! src/share/classes/sun/awt/im/InputMethodContext.java ! src/share/classes/sun/awt/im/InputMethodJFrame.java ! src/share/classes/sun/awt/im/InputMethodManager.java ! src/share/classes/sun/awt/im/SimpleInputMethodWindow.java From xueming.shen at oracle.com Sat Dec 3 00:24:22 2011 From: xueming.shen at oracle.com (xueming.shen at oracle.com) Date: Sat, 03 Dec 2011 00:24:22 +0000 Subject: hg: jdk8/tl/jdk: 5035850: (str) String.CASE_INSENSITIVE_ORDER should override readResolve() Message-ID: <20111203002432.0B18C47549@hg.openjdk.java.net> Changeset: 1d7037df65ed Author: sherman Date: 2011-12-02 16:25 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/1d7037df65ed 5035850: (str) String.CASE_INSENSITIVE_ORDER should override readResolve() Summary: Fix to ensure singleton property of String.CaseInsensitiveComparator is maintained through de/serialization. Reviewed-by: alanb, forax, smarks, dholmes Contributed-by: darryl.mocek at oracle.com ! src/share/classes/java/lang/String.java + test/java/lang/String/CaseInsensitiveComparator.java From mandy.chung at oracle.com Sat Dec 3 00:29:33 2011 From: mandy.chung at oracle.com (mandy.chung at oracle.com) Date: Sat, 03 Dec 2011 00:29:33 +0000 Subject: hg: jdk8/tl/jdk: 7117585: Eliminate java.lang.instrument, java.lang.management warnings Message-ID: <20111203002943.4A5AC4754A@hg.openjdk.java.net> Changeset: 98502d7a3f98 Author: mchung Date: 2011-12-02 16:29 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/98502d7a3f98 7117585: Eliminate java.lang.instrument, java.lang.management warnings Reviewed-by: mchung Contributed-by: Jon VanAlten ! src/share/classes/java/lang/instrument/ClassDefinition.java ! src/share/classes/java/lang/management/ManagementFactory.java ! src/share/classes/java/lang/management/PlatformComponent.java From lance.andersen at oracle.com Sat Dec 3 00:34:59 2011 From: lance.andersen at oracle.com (lance.andersen at oracle.com) Date: Sat, 03 Dec 2011 00:34:59 +0000 Subject: hg: jdk8/tl/jdk: 7116445: Miscellaneous warnings in the JDBC/RowSet classes Message-ID: <20111203003509.5C3374754B@hg.openjdk.java.net> Changeset: 3c524deb8431 Author: lancea Date: 2011-12-02 19:33 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3c524deb8431 7116445: Miscellaneous warnings in the JDBC/RowSet classes Reviewed-by: smarks, chegar ! src/share/classes/com/sun/rowset/CachedRowSetImpl.java ! src/share/classes/com/sun/rowset/FilteredRowSetImpl.java ! src/share/classes/com/sun/rowset/JdbcRowSetImpl.java ! src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java ! src/share/classes/com/sun/rowset/JoinRowSetImpl.java ! src/share/classes/com/sun/rowset/WebRowSetImpl.java ! src/share/classes/com/sun/rowset/internal/CachedRowSetReader.java ! src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java ! src/share/classes/com/sun/rowset/internal/Row.java ! src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java ! src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java ! src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java ! src/share/classes/java/sql/Date.java ! src/share/classes/java/sql/DriverManager.java ! src/share/classes/java/sql/Time.java ! src/share/classes/java/sql/Timestamp.java ! src/share/classes/javax/sql/StatementEvent.java ! src/share/classes/javax/sql/rowset/BaseRowSet.java ! src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java ! src/share/classes/javax/sql/rowset/RowSetProvider.java ! src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java ! src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java ! src/share/classes/javax/sql/rowset/serial/SerialArray.java ! src/share/classes/javax/sql/rowset/serial/SerialBlob.java ! src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java ! src/share/classes/javax/sql/rowset/serial/SerialRef.java ! src/share/classes/javax/sql/rowset/serial/SerialStruct.java ! src/share/classes/javax/sql/rowset/spi/SyncFactory.java From masayoshi.okutsu at oracle.com Sat Dec 3 02:19:05 2011 From: masayoshi.okutsu at oracle.com (masayoshi.okutsu at oracle.com) Date: Sat, 03 Dec 2011 02:19:05 +0000 Subject: hg: jdk8/tl/jdk: 7117487: Warnings Cleanup: some i18n classes in java.util and sun.util Message-ID: <20111203021915.6E3C04754D@hg.openjdk.java.net> Changeset: f2a5d0001f15 Author: okutsu Date: 2011-12-03 10:58 +0900 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f2a5d0001f15 7117487: Warnings Cleanup: some i18n classes in java.util and sun.util Reviewed-by: lancea, naoto ! src/share/classes/java/util/Date.java ! src/share/classes/java/util/GregorianCalendar.java ! src/share/classes/java/util/JapaneseImperialCalendar.java ! src/share/classes/java/util/ResourceBundle.java ! src/share/classes/sun/util/calendar/BaseCalendar.java ! src/share/classes/sun/util/calendar/CalendarSystem.java ! src/share/classes/sun/util/calendar/LocalGregorianCalendar.java ! src/share/classes/sun/util/calendar/ZoneInfo.java ! src/share/classes/sun/util/calendar/ZoneInfoFile.java ! src/share/classes/sun/util/resources/OpenListResourceBundle.java ! src/share/classes/sun/util/resources/TimeZoneNamesBundle.java From forax at univ-mlv.fr Sat Dec 3 15:12:28 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Sat, 03 Dec 2011 16:12:28 +0100 Subject: Collections.enumeration() WAS Warning Cleanup Day In-Reply-To: <4EDA331E.6040800@oracle.com> References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> Message-ID: <4EDA3C5C.6070404@univ-mlv.fr> On 12/03/2011 03:33 PM, Alan Bateman wrote: > On 03/12/2011 12:37, R?mi Forax wrote: >> I've started to remove warnings from java.util >> and I'm not able to cleanly retrofit java.util.PropertyPermission >> because java.util.Collections.enumeration is wrongly typed. >> > R?mi - you might want to sync up with Mike Duigou as I believe he has > been working on the java.util area including collections. Also best to > move any discussions on collections/util area to core-libs-dev too. > > -Alan too late :) Here is a webrev that remove most of the unchecked cast/raw generics warnings http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ R?mi From mike.duigou at oracle.com Sat Dec 3 16:21:00 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Sat, 3 Dec 2011 08:21:00 -0800 Subject: Collections.enumeration() WAS Warning Cleanup Day In-Reply-To: <4EDA3C5C.6070404@univ-mlv.fr> References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> Message-ID: On Dec 3 2011, at 07:12 , R?mi Forax wrote: > On 12/03/2011 03:33 PM, Alan Bateman wrote: >> On 03/12/2011 12:37, R?mi Forax wrote: >>> I've started to remove warnings from java.util >>> and I'm not able to cleanly retrofit java.util.PropertyPermission >>> because java.util.Collections.enumeration is wrongly typed. >>> >> R?mi - you might want to sync up with Mike Duigou as I believe he has been working on the java.util area including collections. Also best to move any discussions on collections/util area to core-libs-dev too. >> >> -Alan > > too late :) > > Here is a webrev that remove most of the unchecked cast/raw generics warnings > http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ > > R?mi > I have changes in about 15 files. I will compare them against yours. I actually believe that doing the same work independently and then comparing the results is a stronger validation than inspection review. Thanks for submitting these fixes. Mike From forax at univ-mlv.fr Sat Dec 3 19:37:13 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Sat, 03 Dec 2011 20:37:13 +0100 Subject: Collections.enumeration() WAS Warning Cleanup Day In-Reply-To: References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> Message-ID: <4EDA7A69.1040109@univ-mlv.fr> On 12/03/2011 05:21 PM, Mike Duigou wrote: > On Dec 3 2011, at 07:12 , R?mi Forax wrote: > >> On 12/03/2011 03:33 PM, Alan Bateman wrote: >>> On 03/12/2011 12:37, R?mi Forax wrote: >>>> I've started to remove warnings from java.util >>>> and I'm not able to cleanly retrofit java.util.PropertyPermission >>>> because java.util.Collections.enumeration is wrongly typed. >>>> >>> R?mi - you might want to sync up with Mike Duigou as I believe he has been working on the java.util area including collections. Also best to move any discussions on collections/util area to core-libs-dev too. >>> >>> -Alan >> too late :) >> >> Here is a webrev that remove most of the unchecked cast/raw generics warnings >> http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ >> >> R?mi >> > I have changes in about 15 files. I will compare them against yours. I actually believe that doing the same work independently and then comparing the results is a stronger validation than inspection review. yes. > > Thanks for submitting these fixes. > > Mike Mike, there is a raw type I was not able to remove in Collections line 1408, I understand the problem but was not able to come with a solution. The current fix is not good because it equivalent to say f*** you wildcards ! R?mi From stuart.marks at oracle.com Sat Dec 3 20:59:56 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sat, 03 Dec 2011 12:59:56 -0800 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker Message-ID: <4EDA8DCC.6040503@oracle.com> [bcc to jdk8-dev; subsequent reviews/comments should go to core-libs-dev] Hi Mike, all, I've collected all the patches together, filed bug 7117249 to cover them, and have started this new review thread on core-libs-dev for it. I've also posted a webrev for the collected patches: http://cr.openjdk.java.net/~smarks/reviews/7117249/webrev.0/ It looks like we have the following patches from your group so far: - java/util/jar/JarFile.java - java/util/jar/Manifest.java [patch4] - java/util/logging/LogManager.java [patch2] - java/util/prefs/Preferences.java - java/util/prefs/XmlSupport.java - java/util/zip/ZipEntry.java [patch2] Did I get everything? I think you've addressed all the review comments that have come in so far. (Other reviewers, please recheck the webrev!) In addition, I have the following comments: JarFile.java -- 242 ZipEntry ze = (ZipEntry)enum_.nextElement(); 621 ZipEntry ze = (ZipEntry) enum_.nextElement(); 676 ZipEntry e = (ZipEntry) entries.nextElement(); I think these are all unnecessary casts now, since at 242 and 621 the return type from nextElement is and at 676 it's JarEntry, and JarEntry is a subclass of ZipEntry. So, these casts can probably be removed even though they don't generate warnings. An alternative would be to change the type of e at 676 to JarEntry; not sure if this would be better. LogManager.java -- 203 Logger.getGlobal().setLogManager(manager); 204 manager.addLogger(Logger.getGlobal()); The doc recommends replacing mentions of the global field with a call to getGlobal(), and this was done here, however sometimes what's in the doc doesn't necessarily apply to library code. Can someone who's more familiar with logging verify this change is correct? 418 Class clz = ClassLoader.getSystemClassLoader().loadClass(word); 419 Handler hdl = (Handler) clz.newInstance(); Minor nit: extra space was before 'clz' in the original code, I think, to make it line up with 'hdl'. Maybe spacing needs to be rearranged to keep them lined up. (I see this a couple other places in the file, but it's not too prevalent.) The alternative is to have a single space between the type and the variable name. ******* Mike, if you end up needing to update this patch further, it might be easiest if you just sent all the changes in a single patch file, i.e. the output of 'hg diff'. I can then apply it to the tip and generate a webrev quite easily. Thanks. s'marks From Alan.Bateman at oracle.com Sat Dec 3 21:45:10 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 03 Dec 2011 21:45:10 +0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDA8DCC.6040503@oracle.com> References: <4EDA8DCC.6040503@oracle.com> Message-ID: <4EDA9866.4080708@oracle.com> On 03/12/2011 20:59, Stuart Marks wrote: > [bcc to jdk8-dev; subsequent reviews/comments should go to core-libs-dev] > > Hi Mike, all, > > I've collected all the patches together, filed bug 7117249 to cover > them, and have started this new review thread on core-libs-dev for it. > I've also posted a webrev for the collected patches: > > http://cr.openjdk.java.net/~smarks/reviews/7117249/webrev.0/ > > It looks like we have the following patches from your group so far: > > - java/util/jar/JarFile.java > - java/util/jar/Manifest.java [patch4] > - java/util/logging/LogManager.java [patch2] > - java/util/prefs/Preferences.java > - java/util/prefs/XmlSupport.java > - java/util/zip/ZipEntry.java [patch2] > > Did I get everything? I think you've addressed all the review comments > that have come in so far. (Other reviewers, please recheck the webrev!) Stuart - I don't know if you're looking for another reviewer but I did quick scan of the webrev. There are still a couple of raw type warnings in JarFile and several more in other classes in these packages so it's possible you don't have everything (I wasn't following that thread closely on jdk8-dev). I'm not an expert on the logging API but I saw your comment asking about s/global/getGlobal()/ and that looks okay to me. One odd thing is the comments added to the suppression of the deprecation warning in ZipEntry dosToJavaTime/javaToDosTime. That seems to be warning future maintainers not to change the implementation to use calendar whereas that seems like a comment for inside the methods. The comment on the @SuppressWarning could just method the Date methods being deprecated. -Alan. From Alan.Bateman at oracle.com Sat Dec 3 22:07:38 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 03 Dec 2011 22:07:38 +0000 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4ED948BD.5030005@oracle.com> References: <4ED8837A.1030300@oracle.com> <4ED948BD.5030005@oracle.com> Message-ID: <4EDA9DAA.9050403@oracle.com> On 02/12/2011 21:53, Stuart Marks wrote: > Actually the original code is a little odd, as it returns an instance > of an anonymous subclass of AttributedCharacterIterator.Attribute, > instead of an instance of AttributedCharacterIterator.Attribute > itself. I don't if this is right or wrong. s'marks AttributedCharacterIterator.Attribute's ctor is protected. As background, the reason for this part of the code is to allow for the possibility of modularized JDK where the "desktop" module (think AWT/Swing and friends) is not installed. Even in that case I don't think you can get a reference to these "fake" attributes so the serialVersionUID shouldn't matter. -Alan. From stuart.marks at oracle.com Sun Dec 4 03:04:56 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sat, 03 Dec 2011 19:04:56 -0800 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> Message-ID: <4EDAE358.4080908@oracle.com> On 12/3/11 2:32 PM, Michael Barker wrote: >> Mike, if you end up needing to update this patch further, it might be >> easiest if you just sent all the changes in a single patch file, i.e. the >> output of 'hg diff'. I can then apply it to the tip and generate a webrev >> quite easily. > > No problem. I'll drop a new patch in tomorrow. No hurry. In fact you might want to wait a little bit. I've asked around for additional reviews of some of the questions, and they probably won't occur until Monday. s'marks From john.r.rose at oracle.com Sun Dec 4 03:59:25 2011 From: john.r.rose at oracle.com (John Rose) Date: Sat, 3 Dec 2011 19:59:25 -0800 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> Message-ID: <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> The caching ClassValue is still under review. I took the opportunity to remove -Xlint warnings (adding type parameters) and refactor for better readability. Also, Mike Duigou pointed out that there was still a dependency on ClassValue.equals == Object.equals, which could create a side-channel between independent CVs. I removed this by replacing ClassValue with ClassValue.Identity as the hash table key. The cache access is racy, for speed, but all races are (thought to be) benign. For cache hits, end-user values are obtained from non-racing accesses. All cache state changes happen either under a per-class lock or during GC (nulling of weak references). Could I have a re-review? Thanks, -- John On Sep 20, 2011, at 4:10 PM, John Rose wrote: > On Sep 19, 2011, at 2:58 PM, John Rose wrote: > >> http://cr.openjdk.java.net/~jrose/7030453/webrev.00 > > After some comments from David Holmes (thanks David!) I added internal comments about race conditions. > > I refreshed the webrev with the additional comments. I also changed one variable to be volatile, with a paragraph of comments explaining why. > > (The change to volatile will inhibit CSE of ClassValue.get calls, but I think such CSE was unlikely anyway. There should be no other performance effects.) > > -- John From joe.darcy at oracle.com Sun Dec 4 19:38:23 2011 From: joe.darcy at oracle.com (Joe Darcy) Date: Sun, 04 Dec 2011 11:38:23 -0800 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> Message-ID: <4EDBCC2F.7030907@oracle.com> Hi John, Are there alternatives to adding two new fields to java.lang.Class? I assume most Class'es won't have ClassValue information associated with them. -Joe On 12/3/2011 7:59 PM, John Rose wrote: > The caching ClassValue is still under review. I took the opportunity to remove -Xlint warnings (adding type parameters) and refactor for better readability. > > Also, Mike Duigou pointed out that there was still a dependency on ClassValue.equals == Object.equals, which could create a side-channel between independent CVs. I removed this by replacing ClassValue with ClassValue.Identity as the hash table key. > > The cache access is racy, for speed, but all races are (thought to be) benign. For cache hits, end-user values are obtained from non-racing accesses. All cache state changes happen either under a per-class lock or during GC (nulling of weak references). > > Could I have a re-review? > > Thanks, > -- John > > On Sep 20, 2011, at 4:10 PM, John Rose wrote: > >> On Sep 19, 2011, at 2:58 PM, John Rose wrote: >> >>> http://cr.openjdk.java.net/~jrose/7030453/webrev.00 >> After some comments from David Holmes (thanks David!) I added internal comments about race conditions. >> >> I refreshed the webrev with the additional comments. I also changed one variable to be volatile, with a paragraph of comments explaining why. >> >> (The change to volatile will inhibit CSE of ClassValue.get calls, but I think such CSE was unlikely anyway. There should be no other performance effects.) >> >> -- John From masayoshi.okutsu at oracle.com Sun Dec 4 20:47:30 2011 From: masayoshi.okutsu at oracle.com (Masayoshi Okutsu) Date: Sun, 04 Dec 2011 12:47:30 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4ED948BD.5030005@oracle.com> References: <4ED8837A.1030300@oracle.com> <4ED948BD.5030005@oracle.com> Message-ID: <4EDBDC62.1010506@oracle.com> We know serialVersionUID is useless for this case. But we decided to add it, which is the standard fix, in order to eliminate the warning message. I think serialization compatibility of anonymous inner classes is another issue. Thanks, Masayoshi On 2011/12/02 13:53, Stuart Marks wrote: > On 12/1/11 11:51 PM, Yuka Kamiya wrote: >> Hello, >> >> Could someone please review this fix? >> >> http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ >> >> Some warnings are still issued even after this fix, and that's intentional. >> I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. >> >> The original number of warnings in this area was 70. Now 16. > Hi Yuka, > > I wanted to ask about this bit of code in BidiBase.java: > > 3492 return new AttributedCharacterIterator.Attribute(name) { > 3493 static final long serialVersionUID = -4899048055171307694L; > 3494 }; > > This is defining a serialVersionUID for an anonymous inner class. Serialization > of anonymous classes is quite problematic. Among the problems is that anonymous > classes have generated names that aren't specified. In this case the name is > sun.text.bidi.BidiBase$TextAttributeConstants$1 which appears to be where you > got the UID value. Unfortunately a different compiler might assign a different > name. Or if this file is modified to use another anonymous class, this class > might get a suffix of $2 (even if the same compiler is used). This means that > it's pretty much impossible to guarantee serialization compatibility of > anonymous classes. > > (Thanks to Joe Darcy, who explained this to me just yesterday.) > > You probably added a serialVersionUID because the compiler issued a warning > about the lack of one. :-) In this case I think what makes the most sense is > simply to suppress the warning. > > Actually the original code is a little odd, as it returns an instance of an > anonymous subclass of AttributedCharacterIterator.Attribute, instead of an > instance of AttributedCharacterIterator.Attribute itself. I don't if this is > right or wrong. > > s'marks > From forax at univ-mlv.fr Sun Dec 4 22:13:39 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Sun, 04 Dec 2011 23:13:39 +0100 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <4EDBCC2F.7030907@oracle.com> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> Message-ID: <4EDBF093.1000801@univ-mlv.fr> On 12/04/2011 08:38 PM, Joe Darcy wrote: > Hi John, > > Are there alternatives to adding two new fields to java.lang.Class? I > assume most Class'es won't have ClassValue information associated with > them. > > -Joe If you use Groovy, JRuby or Nashorn in your code, all visible classes will use this two fields. Any alternative will slow down the access to the class value. BTW, if we had to remove some fields, I vote for moving all fields related to the reflection in a delegate class. Looking up for members is slow so most of the code that call reflection methods use their own cache, so the performance impact will be small in my opinion (I have no data to prove that :) R?mi From stuart.marks at oracle.com Mon Dec 5 00:17:23 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sun, 04 Dec 2011 16:17:23 -0800 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <4ED9042D.3000307@redhat.com> References: <4ED8C221.7070603@oracle.com> <4ED9042D.3000307@redhat.com> Message-ID: <4EDC0D93.7000608@oracle.com> On 12/2/11 9:00 AM, Omair Majid wrote: > On 12/02/2011 07:18 AM, Alan Bateman wrote: >> cc'ing core-libs-dev as that is the place to discuss these changes. I >> see on the sign-up sheet [1] that omajid has signed up for java.lang, >> maybe you are working together? > > Unfortunately, David and I were not working together :( > > Anyway, here is my webrev for java.lang.* > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > Sorry about the delay, building and testing this took longer than I had > expected it to. Also, this patch only addresses the warnings pointed out by javac. > > The classes java.lang.ThreadLocal and java.lang.ClassValue are not included in > the webrev. The fixes for ThreadLocal were basically sprinkling > @SuppressWarnings("unchecked") throughout and the fixes for ClassValue looked > slightly more complex when I tried to reduce the use of rawtypes. I will post a > separate webrev for those later. I've been mulling over what to do with these two patches for the past couple days. Initially I was thinking of merging the patches and generating a new one combining the best of both. But after I looked over both of them, I felt that we should go with Omair's patch, for the following reasons. First, he had signed up to do this area already, and second, his patch stayed will within the guideline of "simple, minimal, and risk-free warnings fixes" that I had posted in kicking off the WCD [1]. The bugid for this change is 7117612. I'll kick off a separate review thread for this on core-libs-dev shortly. Omair, regarding other changes you mentioned you might work on, please be advised that John Rose is doing some other work on ClassValue [2], and he has indicated that he's doing some warnings cleanup in there as well. You might take a look at his webrev. On ThreadLocal, it looks like there are a bunch of rawtypes warnings there too, so some judicious application of generic type parameters seems called for in those cases. Let us know what you intend to do in these areas. See you on the other thread. s'marks [1] http://mail.openjdk.java.net/pipermail/jdk8-dev/2011-December/000380.html [2] http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008541.html From joe.darcy at oracle.com Mon Dec 5 00:27:42 2011 From: joe.darcy at oracle.com (Joe Darcy) Date: Sun, 04 Dec 2011 16:27:42 -0800 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <4EDBF093.1000801@univ-mlv.fr> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> Message-ID: <4EDC0FFE.2080805@oracle.com> On 12/4/2011 2:13 PM, R?mi Forax wrote: > On 12/04/2011 08:38 PM, Joe Darcy wrote: >> Hi John, >> >> Are there alternatives to adding two new fields to java.lang.Class? >> I assume most Class'es won't have ClassValue information associated >> with them. >> >> -Joe > > If you use Groovy, JRuby or Nashorn in your code, all visible classes > will use this two fields. > > Any alternative will slow down the access to the class value. In the mean time, all the non-Groovy, non-JRuby, non-Nashorn, etc. uses of class Class and all the classes not visible in those environments when they are being used will be larger. Adding the fields may be the right time/space trade-off, but I think the point merits some discussion given how many Class objects get created and the relative proportion of Java executions where ClassValue is currently used. The more reasonable time/space trade-off can change over time of course. -Joe From stuart.marks at oracle.com Mon Dec 5 01:02:46 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sun, 04 Dec 2011 17:02:46 -0800 Subject: please review 7117612: warnings fixes in java.lang Message-ID: <4EDC1836.7070106@oracle.com> Please review the following webrev submitted by Omair Majid, consisting of warnings fixes for a variety of files in java.lang. http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ It looks pretty clean, but it would be good to get another pair of eyes on this since there is sometimes great subtlety in java.lang. My comments below. AutoCloseable.java -- java/lang/AutoCloseable.java:34: warning: [try] auto-closeable resource AutoCloseable has a member method close() that could throw InterruptedException The warning here is kind of silly. The intent is to warn implementors of AutoCloseable not to throw InterruptedException. But this is an interface, not an implementation, and it's the AutoCloseable interface itself! We may want to rethink when the compiler emits this warning, instead of suppressing the warning in source code. Joe, what do you think about this? CharacterName.java -- Consider narrowing the scope of @SuppressWarnings by using a local variable. Thanks, s'marks From forax at univ-mlv.fr Mon Dec 5 01:03:13 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Mon, 05 Dec 2011 02:03:13 +0100 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <4EDC0FFE.2080805@oracle.com> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> <4EDC0FFE.2080805@oracle.com> Message-ID: <4EDC1851.4060508@univ-mlv.fr> On 12/05/2011 01:27 AM, Joe Darcy wrote: > On 12/4/2011 2:13 PM, R?mi Forax wrote: >> On 12/04/2011 08:38 PM, Joe Darcy wrote: >>> Hi John, >>> >>> Are there alternatives to adding two new fields to java.lang.Class? >>> I assume most Class'es won't have ClassValue information associated >>> with them. >>> >>> -Joe >> >> If you use Groovy, JRuby or Nashorn in your code, all visible classes >> will use this two fields. >> >> Any alternative will slow down the access to the class value. > > In the mean time, all the non-Groovy, non-JRuby, non-Nashorn, etc. > uses of class Class and all the classes not visible in those > environments when they are being used will be larger. > > Adding the fields may be the right time/space trade-off, but I think > the point merits some discussion given how many Class objects get > created and the relative proportion of Java executions where > ClassValue is currently used. > > The more reasonable time/space trade-off can change over time of course. > > -Joe > I agree but as I said, in that case, I think it's better to take a look to the big picture and see if not only class values fields but also annotations related fields or reflection related fields can be moved. Also, if we don't provide a fast ClassValue, people will create their own concurrent weak hash map using class as key that will be worst because it seems that only few people knows how to do that right. Personally, I don't. R?mi From david.holmes at oracle.com Mon Dec 5 01:39:37 2011 From: david.holmes at oracle.com (David Holmes) Date: Mon, 05 Dec 2011 11:39:37 +1000 Subject: Collections.enumeration() WAS Warning Cleanup Day In-Reply-To: <4EDA7A69.1040109@univ-mlv.fr> References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> <4EDA7A69.1040109@univ-mlv.fr> Message-ID: <4EDC20D9.9080304@oracle.com> On 4/12/2011 5:37 AM, R?mi Forax wrote: > On 12/03/2011 05:21 PM, Mike Duigou wrote: >> On Dec 3 2011, at 07:12 , R?mi Forax wrote: >> >>> On 12/03/2011 03:33 PM, Alan Bateman wrote: >>>> On 03/12/2011 12:37, R?mi Forax wrote: >>>>> I've started to remove warnings from java.util >>>>> and I'm not able to cleanly retrofit java.util.PropertyPermission >>>>> because java.util.Collections.enumeration is wrongly typed. >>>>> >>>> R?mi - you might want to sync up with Mike Duigou as I believe he >>>> has been working on the java.util area including collections. Also >>>> best to move any discussions on collections/util area to >>>> core-libs-dev too. >>>> >>>> -Alan >>> too late :) >>> >>> Here is a webrev that remove most of the unchecked cast/raw generics >>> warnings >>> http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ >>> >>> R?mi >>> >> I have changes in about 15 files. I will compare them against yours. I >> actually believe that doing the same work independently and then >> comparing the results is a stronger validation than inspection review. > > yes. > >> >> Thanks for submitting these fixes. >> >> Mike > > Mike, there is a raw type I was not able to remove in Collections line > 1408, > I understand the problem but was not able to come with a solution. > The current fix is not good because it equivalent to say f*** you > wildcards ! So the obvious fix is: @SuppressWarnings({ "unchecked" }) UnmodifiableEntrySet(Set> s) { super((Set>)s); } Why doesn't it work? David From david.holmes at oracle.com Mon Dec 5 02:04:39 2011 From: david.holmes at oracle.com (David Holmes) Date: Mon, 05 Dec 2011 12:04:39 +1000 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC1836.7070106@oracle.com> References: <4EDC1836.7070106@oracle.com> Message-ID: <4EDC26B7.60504@oracle.com> Are the signature changes in src/share/classes/java/lang/EnumConstantNotPresentException.java permitted? Otherwise looks okay to me. David On 5/12/2011 11:02 AM, Stuart Marks wrote: > Please review the following webrev submitted by Omair Majid, consisting > of warnings fixes for a variety of files in java.lang. > > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > It looks pretty clean, but it would be good to get another pair of eyes > on this since there is sometimes great subtlety in java.lang. > > My comments below. > > AutoCloseable.java -- > > java/lang/AutoCloseable.java:34: warning: [try] auto-closeable > resource AutoCloseable has a member method close() that could > throw InterruptedException > > The warning here is kind of silly. The intent is to warn implementors of > AutoCloseable not to throw InterruptedException. But this is an > interface, not an implementation, and it's the AutoCloseable interface > itself! We may want to rethink when the compiler emits this warning, > instead of suppressing the warning in source code. Joe, what do you > think about this? > > CharacterName.java -- > > Consider narrowing the scope of @SuppressWarnings by using a local > variable. > > Thanks, > > s'marks From weijun.wang at oracle.com Mon Dec 5 02:19:51 2011 From: weijun.wang at oracle.com (weijun.wang at oracle.com) Date: Mon, 05 Dec 2011 02:19:51 +0000 Subject: hg: jdk8/tl/jdk: 7116857: Warnings in javax.security and some sun.misc Message-ID: <20111205022009.5BF384755E@hg.openjdk.java.net> Changeset: 2ae848ea980a Author: weijun Date: 2011-12-05 10:19 +0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2ae848ea980a 7116857: Warnings in javax.security and some sun.misc Reviewed-by: smarks ! src/share/classes/javax/security/auth/kerberos/ServicePermission.java ! src/share/classes/sun/misc/CEFormatException.java ! src/share/classes/sun/misc/CEStreamExhausted.java ! src/share/classes/sun/misc/ClassLoaderUtil.java ! src/share/classes/sun/misc/CompoundEnumeration.java ! src/share/classes/sun/misc/ExtensionInstallationException.java ! src/share/classes/sun/misc/FloatingDecimal.java ! src/share/classes/sun/misc/FormattedFloatingDecimal.java ! src/share/classes/sun/misc/InvalidJarIndexException.java ! src/share/classes/sun/misc/LRUCache.java ! src/share/classes/sun/misc/Queue.java ! src/share/classes/sun/misc/RequestProcessor.java ! src/share/classes/sun/misc/ServiceConfigurationError.java ! src/share/classes/sun/misc/URLClassPath.java From david.holmes at oracle.com Mon Dec 5 02:25:28 2011 From: david.holmes at oracle.com (David Holmes) Date: Mon, 05 Dec 2011 12:25:28 +1000 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <4EDC1851.4060508@univ-mlv.fr> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> <4EDC0FFE.2080805@oracle.com> <4EDC1851.4060508@univ-mlv.fr> Message-ID: <4EDC2B98.6020101@oracle.com> On 5/12/2011 11:03 AM, R?mi Forax wrote: > On 12/05/2011 01:27 AM, Joe Darcy wrote: >> On 12/4/2011 2:13 PM, R?mi Forax wrote: >>> On 12/04/2011 08:38 PM, Joe Darcy wrote: >>>> >>>> Are there alternatives to adding two new fields to java.lang.Class? >>>> I assume most Class'es won't have ClassValue information associated >>>> with them. >>> >>> If you use Groovy, JRuby or Nashorn in your code, all visible classes >>> will use this two fields. >>> >>> Any alternative will slow down the access to the class value. >> >> In the mean time, all the non-Groovy, non-JRuby, non-Nashorn, etc. >> uses of class Class and all the classes not visible in those >> environments when they are being used will be larger. >> >> Adding the fields may be the right time/space trade-off, but I think >> the point merits some discussion given how many Class objects get >> created and the relative proportion of Java executions where >> ClassValue is currently used. >> >> The more reasonable time/space trade-off can change over time of course. >> > > I agree but as I said, in that case, I think it's better to take a look > to the big picture > and see if not only class values fields but also annotations related > fields or reflection related fields can be moved. This is currently being looked at with a general aim of reducing the size of Class instances. So adding back some size would need strong justification. David ----- > Also, if we don't provide a fast ClassValue, people will create their > own concurrent weak hash map > using class as key that will be worst because it seems that only few > people knows > how to do that right. Personally, I don't. > > R?mi > From david.holmes at oracle.com Mon Dec 5 02:36:41 2011 From: david.holmes at oracle.com (David Holmes) Date: Mon, 05 Dec 2011 12:36:41 +1000 Subject: Review request for bug #5063455 In-Reply-To: <4ED96668.3050808@oracle.com> References: <4ED96668.3050808@oracle.com> Message-ID: <4EDC2E39.2010708@oracle.com> Hi Brandon, On 3/12/2011 9:59 AM, Brandon Passanisi wrote: > Hello core-libs-dev. I was wondering if somebody could review the > following proposed fix and test case for bug #5063455. Here's the info: > > Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5063455 > Webrev: http://cr.openjdk.java.net/~sherman/5063455/webrev/ While I occasionally enjoy puzzles, when I'm pressed for time it is nice to have a summary of the bug and the fix ;-) In this case I presume the "new StringBuilder('%') actually invokes the StringBuilder(int) constructor to set the initial capacity to the value of '%' instead of creating a StringBuffer with % as the first character. Seems like a good candidate for JB's next edition of Java Puzzlers :) Fix looks good to me. Cheers, David From david.holmes at oracle.com Mon Dec 5 02:52:07 2011 From: david.holmes at oracle.com (David Holmes) Date: Mon, 05 Dec 2011 12:52:07 +1000 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package In-Reply-To: <4ED90872.2070909@oracle.com> References: <4ED8DFCF.9050609@oracle.com> <4ED8FB3B.5040804@cs.oswego.edu> <4ED90872.2070909@oracle.com> Message-ID: <4EDC31D7.2000709@oracle.com> Thanks Chris and Doug et al. These fixups look good to me too. One minor nit: src/share/classes/java/util/concurrent/atomic/AtomicLong.java The javadoc changes on longValue() changed actual text not just formatting. It changes it to be consistent with other methods, but is a change none-the-less. Not saying we can't do it, just pointing it out. David On 3/12/2011 3:18 AM, Chris Hegarty wrote: > > On 12/ 2/11 04:22 PM, Doug Lea wrote: >> .... >> We just went through these and others, and believe that everything >> is now warning free. > > Thanks Doug, Wow you guys are quick! > > I pulled in these specific changes (atomic) and updated the webrev: > > http://cr.openjdk.java.net/~chegar/7117360/webrev.01/webrev/ > > I'm slowly working through the j.u.c.* classes and hope to have a webrev > out next week. > > -Chris. > >> >> -Doug >> From schlosna at gmail.com Mon Dec 5 03:10:46 2011 From: schlosna at gmail.com (David Schlosnagle) Date: Sun, 4 Dec 2011 22:10:46 -0500 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <4EDC0D93.7000608@oracle.com> References: <4ED8C221.7070603@oracle.com> <4ED9042D.3000307@redhat.com> <4EDC0D93.7000608@oracle.com> Message-ID: <5B1E1FC6-518A-452A-BB67-46153B52CD79@gmail.com> On Dec 4, 2011, at 7:17 PM, Stuart Marks wrote: > I've been mulling over what to do with these two patches for the past couple days. Initially I was thinking of merging the patches and generating a new one combining the best of both. But after I looked over both of them, I felt that we should go with Omair's patch, for the following reasons. First, he had signed up to do this area already, and second, his patch stayed will within the guideline of "simple, minimal, and risk-free warnings fixes" that I had posted in kicking off the WCD [1]. Stuart, That's fine with me, I realize I missed the sign up window. I hope there is another cleanup feat soon. Thanks, Dave From yuka.kamiya at oracle.com Mon Dec 5 03:24:34 2011 From: yuka.kamiya at oracle.com (Yuka Kamiya) Date: Mon, 05 Dec 2011 12:24:34 +0900 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4ED8837A.1030300@oracle.com> References: <4ED8837A.1030300@oracle.com> Message-ID: <4EDC3972.7020908@oracle.com> Hi, Mike, Stuart, Alan, and Masayoshi: Thank you for your comments. If no one has any objections, I'd like to fix only > - The parens are probably not needed around 'length=(srcIndex-prevSrc);' pointed out by Mike. Both the serialVersionUID of AttributedCharacterIterator.Attribute and breaks in UnicodeSet.java seem harmless. I like Stuart's suggestion > case 1: > ... > throw syntaxError(...); but we have a local maintenance policy about these files imported from the third party. As long as the code works correctly (and doesn't issue a warning), smaller change is better. (The policy may change in the future, though.) Thanks, -- Yuka (11/12/02 16:51), Yuka Kamiya wrote: > Hello, > > Could someone please review this fix? > > http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ > > Some warnings are still issued even after this fix, and that's intentional. > I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. > > The original number of warnings in this area was 70. Now 16. > > Thanks, > -- > Yuka Kamiya From stuart.marks at oracle.com Mon Dec 5 06:34:19 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sun, 04 Dec 2011 22:34:19 -0800 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <5B1E1FC6-518A-452A-BB67-46153B52CD79@gmail.com> References: <4ED8C221.7070603@oracle.com> <4ED9042D.3000307@redhat.com> <4EDC0D93.7000608@oracle.com> <5B1E1FC6-518A-452A-BB67-46153B52CD79@gmail.com> Message-ID: <4EDC65EB.20201@oracle.com> On 12/4/11 7:10 PM, David Schlosnagle wrote: > On Dec 4, 2011, at 7:17 PM, Stuart Marks wrote: > >> I've been mulling over what to do with these two patches for the past couple days. Initially I was thinking of merging the patches and generating a new one combining the best of both. But after I looked over both of them, I felt that we should go with Omair's patch, for the following reasons. First, he had signed up to do this area already, and second, his patch stayed will within the guideline of "simple, minimal, and risk-free warnings fixes" that I had posted in kicking off the WCD [1]. > > Stuart, > > That's fine with me, I realize I missed the sign up window. I hope there is another cleanup feat soon. > > Thanks, > Dave Great, thanks for understanding. Yes, there will be other opportunities. s'marks From stuart.marks at oracle.com Mon Dec 5 06:35:44 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sun, 04 Dec 2011 22:35:44 -0800 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC26B7.60504@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDC26B7.60504@oracle.com> Message-ID: <4EDC6640.9090809@oracle.com> Whoops, good catch. Those changes are indeed not permitted. We'll have to use @SuppressWarnings("rawtypes") or some such instead. s'marks On 12/4/11 6:04 PM, David Holmes wrote: > Are the signature changes in > > src/share/classes/java/lang/EnumConstantNotPresentException.java > > permitted? > > Otherwise looks okay to me. > > David > > On 5/12/2011 11:02 AM, Stuart Marks wrote: >> Please review the following webrev submitted by Omair Majid, consisting >> of warnings fixes for a variety of files in java.lang. >> >> http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ >> >> It looks pretty clean, but it would be good to get another pair of eyes >> on this since there is sometimes great subtlety in java.lang. >> >> My comments below. >> >> AutoCloseable.java -- >> >> java/lang/AutoCloseable.java:34: warning: [try] auto-closeable >> resource AutoCloseable has a member method close() that could >> throw InterruptedException >> >> The warning here is kind of silly. The intent is to warn implementors of >> AutoCloseable not to throw InterruptedException. But this is an >> interface, not an implementation, and it's the AutoCloseable interface >> itself! We may want to rethink when the compiler emits this warning, >> instead of suppressing the warning in source code. Joe, what do you >> think about this? >> >> CharacterName.java -- >> >> Consider narrowing the scope of @SuppressWarnings by using a local >> variable. >> >> Thanks, >> >> s'marks From stuart.marks at oracle.com Mon Dec 5 06:39:53 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Sun, 04 Dec 2011 22:39:53 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4EDC3972.7020908@oracle.com> References: <4ED8837A.1030300@oracle.com> <4EDC3972.7020908@oracle.com> Message-ID: <4EDC6739.2040602@oracle.com> I guess we agree that the only use of serialVersionUID would be to remove the warning, as it's not useful for serialization compatibility. Wouldn't it be better just to suppress the warning instead? Regarding the "throw syntaxError()" change, yes that would be a bit too much of a refactoring to perform in the context of warnings cleanup. s'marks On 12/4/11 7:24 PM, Yuka Kamiya wrote: > Hi, > > Mike, Stuart, Alan, and Masayoshi: > Thank you for your comments. > > If no one has any objections, I'd like to fix only > > - The parens are probably not needed around 'length=(srcIndex-prevSrc);' > pointed out by Mike. > > Both the serialVersionUID of AttributedCharacterIterator.Attribute and breaks in UnicodeSet.java seem harmless. > > I like Stuart's suggestion > > case 1: > > ... > > throw syntaxError(...); > but we have a local maintenance policy about these files imported from the third party. > As long as the code works correctly (and doesn't issue a warning), smaller change is better. > (The policy may change in the future, though.) > > Thanks, > -- > Yuka > > > (11/12/02 16:51), Yuka Kamiya wrote: >> Hello, >> >> Could someone please review this fix? >> >> http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ >> >> Some warnings are still issued even after this fix, and that's intentional. >> I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. >> >> The original number of warnings in this area was 70. Now 16. >> >> Thanks, >> -- >> Yuka Kamiya From Alan.Bateman at oracle.com Mon Dec 5 10:01:22 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 05 Dec 2011 10:01:22 +0000 Subject: Code review request: 6907367 extcheck should skip non-jar files In-Reply-To: <4ED7F5F2.1040708@oracle.com> References: <4ED7F5F2.1040708@oracle.com> Message-ID: <4EDC9672.8030902@oracle.com> On 01/12/2011 21:47, Xueming Shen wrote: > Please help review the change at > > http://cr.openjdk.java.net/~sherman/6907367/webrev > > The proposed change does not include the test case I was originally > planed > as showed at > http://cr.openjdk.java.net/~sherman/6907367/webrev.00/test/com/sun/tools/extcheck/TestExtcheckArgs.java.sdiff.html > > > The test case will failed if run against the current jdk8 build image > because > all those jar files still have their "specification-version" listed as > "1.7", as > > ----------------------------------- > Manifest-Version: 1.0 > Implementation-Vendor: Oracle Corporation > Implementation-Title: Java Runtime Environment > Implementation-Version: 1.8.0-internal > Specification-Vendor: Oracle Corporation > Created-By: 1.7.0 (Oracle Corporation) > Specification-Title: Java Platform API Specification > Specification-Version: 1.7 > ------------------------------------ > > in which case the test case fails when comparing the version. > > While I should be able to figure out "where and how" in those release > makefiles to fix > this, it appears all system jar files will be replaced bye "modules" > in jdk8 anyway, the > extcheck on system jar files will become much less relevant (as Alan > suggested). So > I decided to leave the test case out (I did run the test case manually > to verify the fix). The manifest that is used is make/tools/manifest.mf, it just hasn't been updated to 1.8 yet. The proposed change is fine and I think it's better to hold off on a test until it becomes clear how the extensions mechanism is going to work in jdk8. As you mentioned, modules are coming, and the extensions mechanism will only make sense in legacy mode. -Alan. From Alan.Bateman at oracle.com Mon Dec 5 10:12:55 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 05 Dec 2011 10:12:55 +0000 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC1836.7070106@oracle.com> References: <4EDC1836.7070106@oracle.com> Message-ID: <4EDC9927.8080902@oracle.com> On 05/12/2011 01:02, Stuart Marks wrote: > Please review the following webrev submitted by Omair Majid, > consisting of warnings fixes for a variety of files in java.lang. > > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > It looks pretty clean, but it would be good to get another pair of > eyes on this since there is sometimes great subtlety in java.lang. > > My comments below. > > AutoCloseable.java -- > > java/lang/AutoCloseable.java:34: warning: [try] auto-closeable > resource AutoCloseable has a member method close() that could > throw InterruptedException > > The warning here is kind of silly. The intent is to warn implementors > of AutoCloseable not to throw InterruptedException. But this is an > interface, not an implementation, and it's the AutoCloseable interface > itself! We may want to rethink when the compiler emits this warning, > instead of suppressing the warning in source code. Joe, what do you > think about this? > > CharacterName.java -- > > Consider narrowing the scope of @SuppressWarnings by using a local > variable. > > Thanks, > > s'marks I see this fixes a warning in src/solaris/classes/java/lang/ProcessEnvironment.java, there are also a couple of warnings in src/windows/classes/java/lang/ProcessEnvironment.java. Otherwise looks like to me (except for EnumConstantNotPresentException that David has already pointed out). I also agree suppressing the try warning in AutoCloseable, maybe it has to be special cased in the compiler. -Alan From forax at univ-mlv.fr Mon Dec 5 10:20:11 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Mon, 05 Dec 2011 11:20:11 +0100 Subject: java.util and anonymous class Message-ID: <4EDC9ADB.1000304@univ-mlv.fr> While removing generics warnings in java.util, I've seen that some anonymous classes are coded in a way that make javac to generate too much fields. This code: final List list = Arrays.asList(args); Iterator iterator = new Iterator() { private Iterator it = list.iterator(); ... } }; generates an anonymous class with two fields: final class Foo$1 implements java.util.Iterator { java.util.Iterator it; final java.util.List val$list; FinalCaptureTooBig$1(java.util.List); ... while this code: List list = Arrays.asList(args); final Iterator it = list.iterator(); Iterator iterator = new Iterator() { ... generates an anonymous class with only one field: final class FinalCaptureTooBig$1 implements java.util.Iterator { final java.util.Iterator val$it; FinalCaptureTooBig$1(java.util.Iterator); ... If javac was smart, it should generate only one field because the variable 'list' is only use in the initializer of a field, so 'list' has to be passed as parameter of the constructor but don't need to be stored as a field. Note that this change in javac may break the serialization compatibility, so may be it's not a good idea to change javac. Or we can say that we don't care because there is an item in Effective Java that says that you should not use an anonynous class. Should we change the code of java.util or javac ? cheers, R?mi From maurizio.cimadamore at oracle.com Mon Dec 5 10:37:03 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 05 Dec 2011 10:37:03 +0000 Subject: java.util and anonymous class In-Reply-To: <4EDC9ADB.1000304@univ-mlv.fr> References: <4EDC9ADB.1000304@univ-mlv.fr> Message-ID: <4EDC9ECF.40803@oracle.com> On 05/12/11 10:20, R?mi Forax wrote: > While removing generics warnings in java.util, > I've seen that some anonymous classes are coded in a way that > make javac to generate too much fields. > > This code: > final List list = Arrays.asList(args); > Iterator iterator = new Iterator() { > private Iterator it = list.iterator(); > > ... > } > }; > > generates an anonymous class with two fields: > final class Foo$1 implements java.util.Iterator { > java.util.Iterator it; > final java.util.List val$list; > FinalCaptureTooBig$1(java.util.List); > ... > > while this code: > List list = Arrays.asList(args); > final Iterator it = list.iterator(); > Iterator iterator = new Iterator() { > ... > > generates an anonymous class with only one field: > final class FinalCaptureTooBig$1 implements > java.util.Iterator { > final java.util.Iterator val$it; > FinalCaptureTooBig$1(java.util.Iterator); > ... > > If javac was smart, it should generate only one field because the > variable 'list' is only > use in the initializer of a field, so 'list' has to be passed as > parameter of the constructor > but don't need to be stored as a field. > > Note that this change in javac may break the serialization compatibility, > so may be it's not a good idea to change javac. Or we can say that we > don't care > because there is an item in Effective Java that says that you should > not use > an anonynous class. > > Should we change the code of java.util or javac ? My 0.02$ is that it is potentially a risky change (as you point out) to do in the compiler, and not such a straightforward one as well (javac currently does not distinguish as to whether a variable is accessed from a variable initializer w.r.t. form inside a method body). Of course, it could be done - but I think it'd be wiser to invest time on making lambda better so that people will be less and less forced to use inner classes ;-) Maurizio > > cheers, > R?mi > > > > From forax at univ-mlv.fr Mon Dec 5 10:43:15 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Mon, 05 Dec 2011 11:43:15 +0100 Subject: java.util and anonymous class In-Reply-To: <4EDC9ECF.40803@oracle.com> References: <4EDC9ADB.1000304@univ-mlv.fr> <4EDC9ECF.40803@oracle.com> Message-ID: <4EDCA043.2080800@univ-mlv.fr> On 12/05/2011 11:37 AM, Maurizio Cimadamore wrote: > On 05/12/11 10:20, R?mi Forax wrote: >> While removing generics warnings in java.util, >> I've seen that some anonymous classes are coded in a way that >> make javac to generate too much fields. >> >> This code: >> final List list = Arrays.asList(args); >> Iterator iterator = new Iterator() { >> private Iterator it = list.iterator(); >> >> ... >> } >> }; >> >> generates an anonymous class with two fields: >> final class Foo$1 implements java.util.Iterator { >> java.util.Iterator it; >> final java.util.List val$list; >> FinalCaptureTooBig$1(java.util.List); >> ... >> >> while this code: >> List list = Arrays.asList(args); >> final Iterator it = list.iterator(); >> Iterator iterator = new Iterator() { >> ... >> >> generates an anonymous class with only one field: >> final class FinalCaptureTooBig$1 implements >> java.util.Iterator { >> final java.util.Iterator val$it; >> FinalCaptureTooBig$1(java.util.Iterator); >> ... >> >> If javac was smart, it should generate only one field because the >> variable 'list' is only >> use in the initializer of a field, so 'list' has to be passed as >> parameter of the constructor >> but don't need to be stored as a field. >> >> Note that this change in javac may break the serialization >> compatibility, >> so may be it's not a good idea to change javac. Or we can say that we >> don't care >> because there is an item in Effective Java that says that you should >> not use >> an anonynous class. >> >> Should we change the code of java.util or javac ? > My 0.02$ is that it is potentially a risky change (as you point out) > to do in the compiler, and not such a straightforward one as well > (javac currently does not distinguish as to whether a variable is > accessed from a variable initializer w.r.t. form inside a method > body). Of course, it could be done - but I think it'd be wiser to > invest time on making lambda better so that people will be less and > less forced to use inner classes ;-) But defining an Iterator as a lambda is only possible if we support generators and we currently don't :( > > Maurizio R?mi From yuka.kamiya at oracle.com Mon Dec 5 11:05:58 2011 From: yuka.kamiya at oracle.com (Yuka Kamiya) Date: Mon, 05 Dec 2011 20:05:58 +0900 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4EDC6739.2040602@oracle.com> References: <4ED8837A.1030300@oracle.com> <4EDC3972.7020908@oracle.com> <4EDC6739.2040602@oracle.com> Message-ID: <4EDCA596.2020807@oracle.com> Hi Stuart, All right. Here's a new webrev which includes two changes: - 'length=(srcIndex-prevSrc);' in normalizer/NormalizerImpl.java - @SuppressWarnings("serial") in bidi/BidiBase.java http://cr.openjdk.java.net/~peytoia/7116914/webrev.01/ Could you please review it? Thanks, -- Yuka (11/12/05 15:39), Stuart Marks wrote: > I guess we agree that the only use of serialVersionUID would be to remove the > warning, as it's not useful for serialization compatibility. Wouldn't it be > better just to suppress the warning instead? > > Regarding the "throw syntaxError()" change, yes that would be a bit too much of > a refactoring to perform in the context of warnings cleanup. > > s'marks > > On 12/4/11 7:24 PM, Yuka Kamiya wrote: >> Hi, >> >> Mike, Stuart, Alan, and Masayoshi: >> Thank you for your comments. >> >> If no one has any objections, I'd like to fix only >> > - The parens are probably not needed around 'length=(srcIndex-prevSrc);' >> pointed out by Mike. >> >> Both the serialVersionUID of AttributedCharacterIterator.Attribute and breaks in UnicodeSet.java seem harmless. >> >> I like Stuart's suggestion >> > case 1: >> > ... >> > throw syntaxError(...); >> but we have a local maintenance policy about these files imported from the third party. >> As long as the code works correctly (and doesn't issue a warning), smaller change is better. >> (The policy may change in the future, though.) >> >> Thanks, >> -- >> Yuka >> >> >> (11/12/02 16:51), Yuka Kamiya wrote: >>> Hello, >>> >>> Could someone please review this fix? >>> >>> http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ >>> >>> Some warnings are still issued even after this fix, and that's intentional. >>> I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. >>> >>> The original number of warnings in this area was 70. Now 16. >>> >>> Thanks, >>> -- >>> Yuka Kamiya From chris.hegarty at oracle.com Mon Dec 5 11:45:29 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 05 Dec 2011 11:45:29 +0000 Subject: RFR 7117360: Warnings in java.util.concurrent.atomic package In-Reply-To: <4EDC31D7.2000709@oracle.com> References: <4ED8DFCF.9050609@oracle.com> <4ED8FB3B.5040804@cs.oswego.edu> <4ED90872.2070909@oracle.com> <4EDC31D7.2000709@oracle.com> Message-ID: <4EDCAED9.70103@oracle.com> On 05/12/2011 02:52, David Holmes wrote: > Thanks Chris and Doug et al. These fixups look good to me too. > > One minor nit: > > src/share/classes/java/util/concurrent/atomic/AtomicLong.java > > The javadoc changes on longValue() changed actual text not just > formatting. It changes it to be consistent with other methods, but is a > change none-the-less. Not saying we can't do it, just pointing it out. Right, since it didn't change the meaning and is more consistent I with other methods it should fine. But I should have highlighted it in the review mail. I'm not sticking strictly to Stuarts rules I know, just trying to make life a little easier in the future ;-) Thanks for the review, -Chris. > > David > > On 3/12/2011 3:18 AM, Chris Hegarty wrote: >> >> On 12/ 2/11 04:22 PM, Doug Lea wrote: >>> .... >>> We just went through these and others, and believe that everything >>> is now warning free. >> >> Thanks Doug, Wow you guys are quick! >> >> I pulled in these specific changes (atomic) and updated the webrev: >> >> http://cr.openjdk.java.net/~chegar/7117360/webrev.01/webrev/ >> >> I'm slowly working through the j.u.c.* classes and hope to have a webrev >> out next week. >> >> -Chris. >> >>> >>> -Doug >>> From Alan.Bateman at oracle.com Mon Dec 5 11:48:51 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 05 Dec 2011 11:48:51 +0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> Message-ID: <4EDCAFA3.30104@oracle.com> On 04/12/2011 08:56, Michael Barker wrote: > Hi, > >> scan of the webrev. There are still a couple of raw type warnings in JarFile >> and several more in other classes in these packages so it's possible you >> don't have everything (I wasn't following that thread closely on jdk8-dev). > Question on a rawtypes fix. In one case there is method defined as: > > public List getManifestDigests() { > if (jv != null) { > return jv.getManifestDigests(); > } > return new ArrayList(); > } > > There is a rawtypes warning on the "new ArrayList()". I can put a > specific type as the return value should match > "jv.getManifestDigests()", which is public so shouldn't be changed. I > can define it as "new ArrayList()" or add > "@SuppressWarnings("rawtypes") // Need raw type to match public > signature definition". Which would be the preferred approach? > > Mike. I suspect you just need to pull the latest changes because as part of 7116722 [1], Chris has fixed JarVerifier's getManifestDigests to return List. This should mean that JarFile.getManfiestDigest can be changed to: List getManifestDigests() { ensureInitialization(); if (jv != null) { return jv.getManifestDigests(); } return new ArrayList(); } -Alan. [1] http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3b8186aee592 From weijun.wang at oracle.com Mon Dec 5 11:53:14 2011 From: weijun.wang at oracle.com (Weijun Wang) Date: Mon, 05 Dec 2011 19:53:14 +0800 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4ED94D4C.8000107@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> <4ED94D4C.8000107@oracle.com> Message-ID: <4EDCB0AA.4040603@oracle.com> On 12/03/2011 06:12 AM, Stuart Marks wrote: > I'm adding Weijun (Max) Wang to this thread. > > The same "ackbarfaccept" code had come up a third time when I was > reviewing some of Max's changes. The code in question all has to do with > permissions, and Max is in the security group, so he might have a better > insight whether doing a refactoring is appropriate and how to approach > doing it. Maybe we can group all permissions with a target and a predefined set of actions under a new abstract class. -Max > > Some searching around reveals that "ackbarfaccept" appears in the > PlayerPermission class of the Java ME Mobile Media API (not in any of > the OpenJDK repositories) so it looks like the code has been copied even > more times than are visible here. Perhaps a public permissions parsing > utility method is called for. > > s'marks > > On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: >> Am 02.12.2011 16:27, schrieb Brandon Passanisi: >>> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks >>> regarding this, but Stuart was able to find more instances of the >>> similar >>> block of "fallthrough" code. I can volunteer to apply your upcoming >>> change >>> to FilePermission to the other files if you wish. Or, you can try >>> applying >>> the change to the other files, but if you don't have time I don't >>> mind doing >>> it. Here's the section of Stuart's e-mail on this topic: >>> >>> ------------------------------------------------------------------------------------- >>> >>> (Incidentally, this is the third time I've reviewed code today that >>> looks exactly like this. The other cases are in java.io.FilePermission >>> and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ >>> into a set of cases that do nothing but break; and they have similar >>> ("ackbarfaccept") comments. It would be nice if these chunks of code >>> could be unified, but they differ in a number of fiddly details.) >>> >>> (The string "ackbarfaccept" occurs in the following files: >>> 1. java/io/FilePermission.java >>> 2. java/net/SocketPermission.java >>> 3. java/util/PropertyPermission.java >>> 4. javax/management/MBeanPermission.java >>> 5. javax/security/auth/kerberos/ServicePermission.java >>> Hmmm.) >>> ------------------------------------------------------------------------------------- >>> >>> >>> Thanks. >> >> Hi Brandon, >> Hi Stuart, >> >> i had a look at all those classes and it seems to be the same >> algorithm. In an >> normal project (not the jdk) i would suggest to completely refactor it >> and make >> some code de-duplication cleanup. But if i thinks on projects like >> jigsaw this >> can easily get a real problem. What do you think, should we try to >> cleanup them >> all. Or should we try to make some de-duplication/code-reuse refactoring. >> >> >> -- Sebastian >>> >>> On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >>>> Hi Brandon, >>>> >>>> i will try to work out a fix for both and cc the review request to you. >>>> >>>> -- Sebastian >>>> >>>> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>>>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>>>> mentioned that the "fallthrough" code in FilePermission.java also >>>>> exists in >>>>> java.util.PropertyPermission.java. Maybe the code author had done some >>>>> copy/paste when working on these files. Stuart had said that you >>>>> might be >>>>> planning on doing some work on this after the warnings cleanup work. >>>>> If/when you do this work, maybe you can let me know so that I can >>>>> sync the >>>>> same changes you apply to FilePermission.java to >>>>> PropertyPermission.java? >>>>> Or, maybe you can apply the same changes yourself to >>>>> PropertyPermission.java? From alan.bateman at oracle.com Mon Dec 5 12:28:02 2011 From: alan.bateman at oracle.com (alan.bateman at oracle.com) Date: Mon, 05 Dec 2011 12:28:02 +0000 Subject: hg: jdk8/tl/jdk: 2 new changesets Message-ID: <20111205122831.CED8A47562@hg.openjdk.java.net> Changeset: 053cb321467a Author: alanb Date: 2011-12-05 12:23 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/053cb321467a 7117717: (aio) Tests failing due to implementation bug 7052549 Reviewed-by: weijun, chegar ! test/ProblemList.txt ! test/java/nio/channels/AsynchronousSocketChannel/Basic.java Changeset: da28826c5672 Author: alanb Date: 2011-12-05 12:24 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/da28826c5672 Merge From chris.hegarty at oracle.com Mon Dec 5 15:36:20 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 05 Dec 2011 15:36:20 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4ED8E0F1.10200@oracle.com> References: <4ED8E0F1.10200@oracle.com> Message-ID: <4EDCE4F4.6060002@oracle.com> Cleanup warnings in the j.u.c. package. This is a sync up with the warning fixes in Doug's CVS. There are also a few style cleanups, import fixes, trivial local variable renaming, typos, etc. But nothing too surprising! http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ -Chris. P.S. I have already reviewed this, and the contribution is of course from Doug. From sebastian.sickelmann at gmx.de Mon Dec 5 15:45:26 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Mon, 05 Dec 2011 16:45:26 +0100 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4EDCB0AA.4040603@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> <4ED94D4C.8000107@oracle.com> <4EDCB0AA.4040603@oracle.com> Message-ID: <4EDCE716.1000404@gmx.de> Am 05.12.2011 12:53, schrieb Weijun Wang: > > > On 12/03/2011 06:12 AM, Stuart Marks wrote: >> I'm adding Weijun (Max) Wang to this thread. >> >> The same "ackbarfaccept" code had come up a third time when I was >> reviewing some of Max's changes. The code in question all has to do with >> permissions, and Max is in the security group, so he might have a better >> insight whether doing a refactoring is appropriate and how to approach >> doing it. > > Maybe we can group all permissions with a target and a predefined set > of actions under a new abstract class. This sounds like the best idea from the implementors point of view. I would prepare a patch as suggestion for this. Regarding to my own question i would say that there isn't any additional jigsaw related problem here by introducing a common abstract class. They all rely on java.security.Permission, so java.security seems the correct package for the new abstract class. Any suggestions for the name? PermissionWithActions???? AbstractPermission?? If i see it right there is the following class hierarchy: j.s.Permission implements Serializable +j.i.FilePermission +j.n.SocketPermission +jx.m.MBeanPermission +jx.s.a.k.ServicePermission +j.s.BasicPermission +j.u.PropertyPermission What happens to serialization when the new hierarchy would look like this: j.s.Permission implements Serializable +j.s.AbstractPermission +j.i.FilePermission +j.n.SocketPermission +jx.m.MBeanPermission +jx.s.a.k.ServicePermission +j.s.BasicPermission +j.u.PropertyPermission All the classes have a serialVerionUID so i think serialisation is no problem, or is there a problem i i don't see here? -- Sebastian > -Max > >> >> Some searching around reveals that "ackbarfaccept" appears in the >> PlayerPermission class of the Java ME Mobile Media API (not in any of >> the OpenJDK repositories) so it looks like the code has been copied even >> more times than are visible here. Perhaps a public permissions parsing >> utility method is called for. >> >> s'marks >> >> On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: >>> Am 02.12.2011 16:27, schrieb Brandon Passanisi: >>>> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart >>>> Marks >>>> regarding this, but Stuart was able to find more instances of the >>>> similar >>>> block of "fallthrough" code. I can volunteer to apply your upcoming >>>> change >>>> to FilePermission to the other files if you wish. Or, you can try >>>> applying >>>> the change to the other files, but if you don't have time I don't >>>> mind doing >>>> it. Here's the section of Stuart's e-mail on this topic: >>>> >>>> ------------------------------------------------------------------------------------- >>>> >>>> >>>> (Incidentally, this is the third time I've reviewed code today that >>>> looks exactly like this. The other cases are in java.io.FilePermission >>>> and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ >>>> into a set of cases that do nothing but break; and they have similar >>>> ("ackbarfaccept") comments. It would be nice if these chunks of code >>>> could be unified, but they differ in a number of fiddly details.) >>>> >>>> (The string "ackbarfaccept" occurs in the following files: >>>> 1. java/io/FilePermission.java >>>> 2. java/net/SocketPermission.java >>>> 3. java/util/PropertyPermission.java >>>> 4. javax/management/MBeanPermission.java >>>> 5. javax/security/auth/kerberos/ServicePermission.java >>>> Hmmm.) >>>> ------------------------------------------------------------------------------------- >>>> >>>> >>>> >>>> Thanks. >>> >>> Hi Brandon, >>> Hi Stuart, >>> >>> i had a look at all those classes and it seems to be the same >>> algorithm. In an >>> normal project (not the jdk) i would suggest to completely refactor it >>> and make >>> some code de-duplication cleanup. But if i thinks on projects like >>> jigsaw this >>> can easily get a real problem. What do you think, should we try to >>> cleanup them >>> all. Or should we try to make some de-duplication/code-reuse >>> refactoring. >>> >>> >>> -- Sebastian >>>> >>>> On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >>>>> Hi Brandon, >>>>> >>>>> i will try to work out a fix for both and cc the review request to >>>>> you. >>>>> >>>>> -- Sebastian >>>>> >>>>> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>>>>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>>>>> mentioned that the "fallthrough" code in FilePermission.java also >>>>>> exists in >>>>>> java.util.PropertyPermission.java. Maybe the code author had done >>>>>> some >>>>>> copy/paste when working on these files. Stuart had said that you >>>>>> might be >>>>>> planning on doing some work on this after the warnings cleanup work. >>>>>> If/when you do this work, maybe you can let me know so that I can >>>>>> sync the >>>>>> same changes you apply to FilePermission.java to >>>>>> PropertyPermission.java? >>>>>> Or, maybe you can apply the same changes yourself to >>>>>> PropertyPermission.java? From omajid at redhat.com Mon Dec 5 16:14:24 2011 From: omajid at redhat.com (Omair Majid) Date: Mon, 05 Dec 2011 11:14:24 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC6640.9090809@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDC26B7.60504@oracle.com> <4EDC6640.9090809@oracle.com> Message-ID: <4EDCEDE0.2030303@redhat.com> On 12/05/2011 01:35 AM, Stuart Marks wrote: > Whoops, good catch. Those changes are indeed not permitted. We'll have > to use @SuppressWarnings("rawtypes") or some such instead. > Thanks for the comments. I have an updated webrev available at: http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/02/ Changes: AutoClosable.java - Removed @SuppressWarnings("try") CharacterName.java - @SuppressWarnings has a smaller scope in CharacterName.java EnumConstantsNotPresentException.java - Use @SuppressWarnings("rawtypes") instead of Enum src/windows/classes/java/lang/ProcessEnvironment.java: - Added a serialVersionUID. Unfortunately, I don't have a windows box so I cant identify the previous serialVersionUID value for this class. Can someone with a windows build handy help me out? - Added 2 SuppressWarnings. Thanks, Omair > On 12/4/11 6:04 PM, David Holmes wrote: >> Are the signature changes in >> >> src/share/classes/java/lang/EnumConstantNotPresentException.java >> >> permitted? >> >> Otherwise looks okay to me. >> >> David >> >> On 5/12/2011 11:02 AM, Stuart Marks wrote: >>> Please review the following webrev submitted by Omair Majid, consisting >>> of warnings fixes for a variety of files in java.lang. >>> >>> http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ >>> >>> It looks pretty clean, but it would be good to get another pair of eyes >>> on this since there is sometimes great subtlety in java.lang. >>> >>> My comments below. >>> >>> AutoCloseable.java -- >>> >>> java/lang/AutoCloseable.java:34: warning: [try] auto-closeable >>> resource AutoCloseable has a member method close() that could >>> throw InterruptedException >>> >>> The warning here is kind of silly. The intent is to warn implementors of >>> AutoCloseable not to throw InterruptedException. But this is an >>> interface, not an implementation, and it's the AutoCloseable interface >>> itself! We may want to rethink when the compiler emits this warning, >>> instead of suppressing the warning in source code. Joe, what do you >>> think about this? >>> >>> CharacterName.java -- >>> >>> Consider narrowing the scope of @SuppressWarnings by using a local >>> variable. >>> >>> Thanks, >>> >>> s'marks From omajid at redhat.com Mon Dec 5 16:43:36 2011 From: omajid at redhat.com (Omair Majid) Date: Mon, 05 Dec 2011 11:43:36 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDCF123.50008@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDC26B7.60504@oracle.com> <4EDC6640.9090809@oracle.com> <4EDCEDE0.2030303@redhat.com> <4EDCF123.50008@oracle.com> Message-ID: <4EDCF4B8.8070607@redhat.com> On 12/05/2011 11:28 AM, Alan Bateman wrote: > On 05/12/2011 16:14, Omair Majid wrote: >> >> >> src/windows/classes/java/lang/ProcessEnvironment.java: >> - Added a serialVersionUID. Unfortunately, I don't have a windows box >> so I cant identify the previous serialVersionUID value for this class. >> Can someone with a windows build handy help me out? >> > I just checked and it's currently: > > static final long serialVersionUID = -8017839552603542824L; > Thanks! I have updated the webrev. Cheers, Omair From joe.darcy at oracle.com Mon Dec 5 17:17:55 2011 From: joe.darcy at oracle.com (Joe Darcy) Date: Mon, 05 Dec 2011 09:17:55 -0800 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC1836.7070106@oracle.com> References: <4EDC1836.7070106@oracle.com> Message-ID: <4EDCFCC3.90609@oracle.com> On 12/4/2011 5:02 PM, Stuart Marks wrote: > Please review the following webrev submitted by Omair Majid, > consisting of warnings fixes for a variety of files in java.lang. > > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > It looks pretty clean, but it would be good to get another pair of > eyes on this since there is sometimes great subtlety in java.lang. > > My comments below. > > AutoCloseable.java -- > > java/lang/AutoCloseable.java:34: warning: [try] auto-closeable > resource AutoCloseable has a member method close() that could > throw InterruptedException > > The warning here is kind of silly. The intent is to warn implementors > of AutoCloseable not to throw InterruptedException. But this is an > interface, not an implementation, and it's the AutoCloseable interface > itself! We may want to rethink when the compiler emits this warning, > instead of suppressing the warning in source code. Joe, what do you > think about this? Yes, I think the better technical approach is to have javac check to see if its compiling AutoCloseable. -Joe From chris.hegarty at oracle.com Mon Dec 5 17:35:42 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Mon, 05 Dec 2011 17:35:42 +0000 Subject: hg: jdk8/tl/jdk: 7117360: Warnings in java.util.concurrent.atomic package Message-ID: <20111205173606.A46904758B@hg.openjdk.java.net> Changeset: f352dd3cdff8 Author: dl Date: 2011-12-05 13:58 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f352dd3cdff8 7117360: Warnings in java.util.concurrent.atomic package Reviewed-by: chegar, dholmes ! src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java ! src/share/classes/java/util/concurrent/atomic/AtomicInteger.java ! src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java ! src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java ! src/share/classes/java/util/concurrent/atomic/AtomicLong.java ! src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java ! src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java ! src/share/classes/java/util/concurrent/atomic/AtomicReference.java ! src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java ! src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java ! src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java From maurizio.cimadamore at oracle.com Mon Dec 5 17:54:19 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 05 Dec 2011 17:54:19 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDCE4F4.6060002@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> Message-ID: <4EDD054B.2080309@oracle.com> On 05/12/11 15:36, Chris Hegarty wrote: > > Cleanup warnings in the j.u.c. package. > > This is a sync up with the warning fixes in Doug's CVS. There are also > a few style cleanups, import fixes, trivial local variable renaming, > typos, etc. But nothing too surprising! > > http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ > > -Chris. > > P.S. I have already reviewed this, and the contribution is of course > from Doug. Nice work! Some comments below: *) ArrayBlockingQueue: would it make sense to change the declared type of 'items' to be E[] instead of Object[] ? This will create one unchecked warnings for sure (when the variable is initialized) - but all remaining unchecked cast can go away. *) SynchronousQueue: it seems that if the class SNode was generified, it would be possible to get rid of the warnings in the 'transfer' method without adding a global @SuppressWarnings. Maurizio From sean.mullan at oracle.com Mon Dec 5 18:06:38 2011 From: sean.mullan at oracle.com (Sean Mullan) Date: Mon, 05 Dec 2011 13:06:38 -0500 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4ED8F694.8010705@oracle.com> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> <4ED8F694.8010705@oracle.com> Message-ID: <4EDD082E.7060803@oracle.com> On 12/2/11 11:02 AM, Sean Mullan wrote: >> [0] Solution 1 >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >> [1] Solution 2 >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html I definitely prefer solution 2. Just a few minor comments: - Use the javadoc @inheritDoc tag instead of copying the javadoc for the initCause method. - PreventOverridingOfChaining lines 68, 71: what do these comments mean? one additional test that would be useful to add would be to call initCause twice for those ctors that don't have a Throwable parameter, and make sure initCause throws IllegalStateExc. --Sean From darryl.mocek at oracle.com Mon Dec 5 18:18:30 2011 From: darryl.mocek at oracle.com (Darryl Mocek) Date: Mon, 05 Dec 2011 10:18:30 -0800 Subject: Code Review Request for Bug #7069190 In-Reply-To: <4ED6AB44.5040108@oracle.com> References: <4ED6AB44.5040108@oracle.com> Message-ID: <4EDD0AF6.3010206@oracle.com> I am withdrawing this request for code review. Thanks, Darryl On Wed 30 Nov 2011 02:16:36 PM PST, Darryl Mocek wrote: > Hello. Please review this patch to fix the getting of the user's home > setting using System.getProperty("user.home") on UNIX's. The previous > implementation used getpwuid, which didn't allow the user to set the > value in the environment. > > Webrev, can be found here: > http://cr.openjdk.java.net/~darryl/7069190/webrev.00 > > Thanks, > Darryl From dl at cs.oswego.edu Mon Dec 5 18:32:14 2011 From: dl at cs.oswego.edu (Doug Lea) Date: Mon, 05 Dec 2011 13:32:14 -0500 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDD054B.2080309@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD054B.2080309@oracle.com> Message-ID: <4EDD0E2E.2090708@cs.oswego.edu> On 12/05/11 12:54, Maurizio Cimadamore wrote: >> http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ >> >> -Chris. >> >> P.S. I have already reviewed this, and the contribution is of course from Doug. > Nice work! Some comments below: Thanks for looking at this! In both cases, reducing warnings would clash with other conventions we use in j.u.c: > > *) ArrayBlockingQueue: would it make sense to change the declared type of > 'items' to be E[] instead of Object[] ? This will create one unchecked warnings > for sure (when the variable is initialized) - but all remaining unchecked cast > can go away. After some vacillation, we now always use "Object[]" for holding generics. It can produce more warnings, but all in all seems to leave the least room for other kinds of errors to slip in. Plus it keeps me from remembering so often about how generics don't work with arrays :-) > > *) SynchronousQueue: it seems that if the class SNode was generified, it would > be possible to get rid of the warnings in the 'transfer' method without adding a > global @SuppressWarnings. Yes, possible but it would preclude (or force lying to the type system about) using sentinels that we often need to use for the sake of GC/cleanup. So again, by convention, we always use plain Object in these non-blocking data structures. -Doug From xueming.shen at oracle.com Mon Dec 5 18:51:34 2011 From: xueming.shen at oracle.com (xueming.shen at oracle.com) Date: Mon, 05 Dec 2011 18:51:34 +0000 Subject: hg: jdk8/tl/jdk: 5063455: (fmt) MissingFormatArgumentException.getFormatSpecifier() incorrect return value Message-ID: <20111205185143.E36C24758D@hg.openjdk.java.net> Changeset: 194faa6fdb3c Author: sherman Date: 2011-12-05 10:50 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/194faa6fdb3c 5063455: (fmt) MissingFormatArgumentException.getFormatSpecifier() incorrect return value Summary: updated the incorrect StringBuilder constructor usage Reviewed-by: dholmes, sherman Contributed-by: brandon.passanisi at oracle.com ! src/share/classes/java/util/Formatter.java + test/java/util/MissingFormatArgumentException/GetFormatSpecifier.java From omajid at redhat.com Mon Dec 5 22:09:20 2011 From: omajid at redhat.com (Omair Majid) Date: Mon, 05 Dec 2011 17:09:20 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDC1836.7070106@oracle.com> References: <4EDC1836.7070106@oracle.com> Message-ID: <4EDD4110.2020004@redhat.com> Hi, On 12/04/2011 08:02 PM, Stuart Marks wrote: > Please review the following webrev submitted by Omair Majid, consisting > of warnings fixes for a variety of files in java.lang. > > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > It looks pretty clean, but it would be good to get another pair of eyes > on this since there is sometimes great subtlety in java.lang. > > My comments below. > > AutoCloseable.java -- > > java/lang/AutoCloseable.java:34: warning: [try] auto-closeable > resource AutoCloseable has a member method close() that could > throw InterruptedException > > The warning here is kind of silly. The intent is to warn implementors of > AutoCloseable not to throw InterruptedException. But this is an > interface, not an implementation, and it's the AutoCloseable interface > itself! We may want to rethink when the compiler emits this warning, > instead of suppressing the warning in source code. Joe, what do you > think about this? > > CharacterName.java -- > > Consider narrowing the scope of @SuppressWarnings by using a local > variable. > I have posted a new webrev: http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/03/ This includes all the changes from the feedback so far, as well as changes to ThreadLocal. I will not be posting a patch for ClassValue since (as you kindly pointed out), others are making changes to it and removing some warnings too [1]. I suppose I will revisit it later (if warning fixes are still being accepted :D ). Thanks, Omair [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008541.html From eamonn at mcmanus.net Mon Dec 5 22:19:10 2011 From: eamonn at mcmanus.net (Eamonn McManus) Date: Mon, 5 Dec 2011 14:19:10 -0800 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4EDCE716.1000404@gmx.de> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> <4ED94D4C.8000107@oracle.com> <4EDCB0AA.4040603@oracle.com> <4EDCE716.1000404@gmx.de> Message-ID: To my mind, introducing a new shared parent means defining a new API that can be used by third-party subclasses. The point is that these permissions have an action list like "read,write,delete", with parsing code that converts this into a bitmask and toString() code that converts it back. I think that code is pretty hairy as it stands, all the more so because it is duplicated across the existing subclasses. For MBeanPermission, where there are 17 possible actions, the parsing method is 370 lines long! So refactoring is definitely desirable. An abstract PermissionWithActions class could use enums to good effect, something like this: public abstract class PermissionWithActions> { public abstract Class actionClass(); private final EnumSet actions; protected PermissionWithAction(String target, String actions) { ...use reflection to get E[] values() and parse the actions... } public String getActions() { ...use toString().toLowerCase() on the actions set... } public final Set getActionSet() { return Collections.unmodifiableSet(actions); } public boolean implies(Permission p) { if (p.getClass() != this.getClass()) { return false; } @SuppressWarnings("unchecked") PermissionWIthActions pwa = (PermissionWithActions) p; return this.actions.containsAll(pwa.actions); } } public final class FilePermission extends PermissionWithActions { @Override public Class actionClass() { return FliePermissionActions.class; } } public enum FilePermissionActions {READ, WRITE, EXECUTE, DELETE} However I'm not sure we actually want to make such an API change now. A safer path would be to refactor the parsing and getActions() code into a sun.* class which is not the parent class of anything, using delegation rather than inheritance. Safer both because it doesn't involve figuring out the impact on various JSRs, and because there is some danger that subclassing might introduce unforeseen attack vectors. FilePermission etc could each have one instance of this class that they use for parsing and getActions(), and that instance could construct e.g. a trie for parsing that is essentially as fast as the unmaintainable hand-coded parsers that each of the affected Permission subclasses has today. Parsing does have to be fast because when there is a security manager every checked operation will construct a Permission to check against. ?amonn On 5 December 2011 07:45, Sebastian Sickelmann wrote: > > Am 05.12.2011 12:53, schrieb Weijun Wang: > >> >> >> On 12/03/2011 06:12 AM, Stuart Marks wrote: >>> >>> I'm adding Weijun (Max) Wang to this thread. >>> >>> The same "ackbarfaccept" code had come up a third time when I was >>> reviewing some of Max's changes. The code in question all has to do with >>> permissions, and Max is in the security group, so he might have a better >>> insight whether doing a refactoring is appropriate and how to approach >>> doing it. >> >> >> Maybe we can group all permissions with a target and a predefined set of actions under a new abstract class. > > > This sounds like the best idea from the implementors point of view. I would prepare a patch as suggestion for this. > Regarding to my own question i would say that there isn't any additional jigsaw related problem here by > introducing a common abstract class. They all rely on java.security.Permission, so java.security seems the correct > package for the new abstract class. > > Any suggestions for the name? PermissionWithActions???? AbstractPermission?? > > If i see it right there is the following class hierarchy: > > j.s.Permission implements Serializable > +j.i.FilePermission > +j.n.SocketPermission > +jx.m.MBeanPermission > +jx.s.a.k.ServicePermission > +j.s.BasicPermission > ?+j.u.PropertyPermission > > What happens to serialization when the new hierarchy would look like this: > > j.s.Permission implements Serializable > +j.s.AbstractPermission > +j.i.FilePermission > +j.n.SocketPermission > ?+jx.m.MBeanPermission > +jx.s.a.k.ServicePermission > ?+j.s.BasicPermission > ?+j.u.PropertyPermission > > All the classes have a serialVerionUID so i think serialisation is no problem, or is there > a problem i i don't see here? > > -- Sebastian > >> -Max >> >>> >>> Some searching around reveals that "ackbarfaccept" appears in the >>> PlayerPermission class of the Java ME Mobile Media API (not in any of >>> the OpenJDK repositories) so it looks like the code has been copied even >>> more times than are visible here. Perhaps a public permissions parsing >>> utility method is called for. >>> >>> s'marks >>> >>> On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: >>>> >>>> Am 02.12.2011 16:27, schrieb Brandon Passanisi: >>>>> >>>>> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks >>>>> regarding this, but Stuart was able to find more instances of the >>>>> similar >>>>> block of "fallthrough" code. I can volunteer to apply your upcoming >>>>> change >>>>> to FilePermission to the other files if you wish. Or, you can try >>>>> applying >>>>> the change to the other files, but if you don't have time I don't >>>>> mind doing >>>>> it. Here's the section of Stuart's e-mail on this topic: >>>>> >>>>> ------------------------------------------------------------------------------------- >>>>> >>>>> (Incidentally, this is the third time I've reviewed code today that >>>>> looks exactly like this. The other cases are in java.io.FilePermission >>>>> and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ >>>>> into a set of cases that do nothing but break; and they have similar >>>>> ("ackbarfaccept") comments. It would be nice if these chunks of code >>>>> could be unified, but they differ in a number of fiddly details.) >>>>> >>>>> (The string "ackbarfaccept" occurs in the following files: >>>>> 1. java/io/FilePermission.java >>>>> 2. java/net/SocketPermission.java >>>>> 3. java/util/PropertyPermission.java >>>>> 4. javax/management/MBeanPermission.java >>>>> 5. javax/security/auth/kerberos/ServicePermission.java >>>>> Hmmm.) >>>>> ------------------------------------------------------------------------------------- >>>>> >>>>> >>>>> Thanks. >>>> >>>> >>>> Hi Brandon, >>>> Hi Stuart, >>>> >>>> i had a look at all those classes and it seems to be the same >>>> algorithm. In an >>>> normal project (not the jdk) i would suggest to completely refactor it >>>> and make >>>> some code de-duplication cleanup. But if i thinks on projects like >>>> jigsaw this >>>> can easily get a real problem. What do you think, should we try to >>>> cleanup them >>>> all. Or should we try to make some de-duplication/code-reuse refactoring. >>>> >>>> >>>> -- Sebastian >>>>> >>>>> >>>>> On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >>>>>> >>>>>> Hi Brandon, >>>>>> >>>>>> i will try to work out a fix for both and cc the review request to you. >>>>>> >>>>>> -- Sebastian >>>>>> >>>>>> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>>>>>> >>>>>>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>>>>>> mentioned that the "fallthrough" code in FilePermission.java also >>>>>>> exists in >>>>>>> java.util.PropertyPermission.java. Maybe the code author had done some >>>>>>> copy/paste when working on these files. Stuart had said that you >>>>>>> might be >>>>>>> planning on doing some work on this after the warnings cleanup work. >>>>>>> If/when you do this work, maybe you can let me know so that I can >>>>>>> sync the >>>>>>> same changes you apply to FilePermission.java to >>>>>>> PropertyPermission.java? >>>>>>> Or, maybe you can apply the same changes yourself to >>>>>>> PropertyPermission.java? > > From stuart.marks at oracle.com Mon Dec 5 23:15:15 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Mon, 05 Dec 2011 15:15:15 -0800 Subject: Request for Review: 7116914 (Miscellaneous warnings (sun.text)) In-Reply-To: <4EDCA596.2020807@oracle.com> References: <4ED8837A.1030300@oracle.com> <4EDC3972.7020908@oracle.com> <4EDC6739.2040602@oracle.com> <4EDCA596.2020807@oracle.com> Message-ID: <4EDD5083.1020708@oracle.com> Looks good. Thanks for making the updates. Go ahead and push. s'marks On 12/5/11 3:05 AM, Yuka Kamiya wrote: > Hi Stuart, > > All right. Here's a new webrev which includes two changes: > - 'length=(srcIndex-prevSrc);' in normalizer/NormalizerImpl.java > - @SuppressWarnings("serial") in bidi/BidiBase.java > > http://cr.openjdk.java.net/~peytoia/7116914/webrev.01/ > > Could you please review it? > > Thanks, > -- > Yuka > > > (11/12/05 15:39), Stuart Marks wrote: >> I guess we agree that the only use of serialVersionUID would be to remove the >> warning, as it's not useful for serialization compatibility. Wouldn't it be >> better just to suppress the warning instead? >> >> Regarding the "throw syntaxError()" change, yes that would be a bit too much of >> a refactoring to perform in the context of warnings cleanup. >> >> s'marks >> >> On 12/4/11 7:24 PM, Yuka Kamiya wrote: >>> Hi, >>> >>> Mike, Stuart, Alan, and Masayoshi: >>> Thank you for your comments. >>> >>> If no one has any objections, I'd like to fix only >>> > - The parens are probably not needed around 'length=(srcIndex-prevSrc);' >>> pointed out by Mike. >>> >>> Both the serialVersionUID of AttributedCharacterIterator.Attribute and breaks in UnicodeSet.java seem harmless. >>> >>> I like Stuart's suggestion >>> > case 1: >>> > ... >>> > throw syntaxError(...); >>> but we have a local maintenance policy about these files imported from the third party. >>> As long as the code works correctly (and doesn't issue a warning), smaller change is better. >>> (The policy may change in the future, though.) >>> >>> Thanks, >>> -- >>> Yuka >>> >>> >>> (11/12/02 16:51), Yuka Kamiya wrote: >>>> Hello, >>>> >>>> Could someone please review this fix? >>>> >>>> http://cr.openjdk.java.net/~peytoia/7116914/webrev.00/ >>>> >>>> Some warnings are still issued even after this fix, and that's intentional. >>>> I'd like to solve them in another way rather than using @SuppressWarnings("deprecation") in the future. >>>> >>>> The original number of warnings in this area was 70. Now 16. >>>> >>>> Thanks, >>>> -- >>>> Yuka Kamiya From yuka.kamiya at oracle.com Mon Dec 5 23:40:39 2011 From: yuka.kamiya at oracle.com (yuka.kamiya at oracle.com) Date: Mon, 05 Dec 2011 23:40:39 +0000 Subject: hg: jdk8/tl/jdk: 7116914: Miscellaneous warnings (sun.text) Message-ID: <20111205234049.2693647591@hg.openjdk.java.net> Changeset: ca383e32deaf Author: peytoia Date: 2011-12-06 08:39 +0900 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/ca383e32deaf 7116914: Miscellaneous warnings (sun.text) Reviewed-by: smarks, okutsu ! src/share/classes/sun/text/CompactByteArray.java ! src/share/classes/sun/text/IntHashtable.java ! src/share/classes/sun/text/bidi/BidiBase.java ! src/share/classes/sun/text/normalizer/ICUData.java ! src/share/classes/sun/text/normalizer/NormalizerBase.java ! src/share/classes/sun/text/normalizer/NormalizerImpl.java ! src/share/classes/sun/text/normalizer/SymbolTable.java ! src/share/classes/sun/text/normalizer/UnicodeSet.java ! src/share/classes/sun/text/normalizer/UnicodeSetIterator.java ! src/share/classes/sun/text/normalizer/VersionInfo.java From stuart.marks at oracle.com Tue Dec 6 00:51:00 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Tue, 06 Dec 2011 00:51:00 +0000 Subject: hg: jdk8/tl/jdk: 7116993: fix warnings in java.applet Message-ID: <20111206005114.C208A47592@hg.openjdk.java.net> Changeset: f4fe86bba8a2 Author: smarks Date: 2011-12-05 16:30 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f4fe86bba8a2 7116993: fix warnings in java.applet Reviewed-by: art, smarks Contributed-by: Danesh Dadachanji ! src/share/classes/java/applet/Applet.java From naoto.sato at oracle.com Tue Dec 6 01:09:42 2011 From: naoto.sato at oracle.com (naoto.sato at oracle.com) Date: Tue, 06 Dec 2011 01:09:42 +0000 Subject: hg: jdk8/tl/jdk: 7117469: Warning cleanup for j.u.Currency and j.u.Locale related classes Message-ID: <20111206010951.8BAC347593@hg.openjdk.java.net> Changeset: 85363edbc92f Author: naoto Date: 2011-12-05 17:08 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/85363edbc92f 7117469: Warning cleanup for j.u.Currency and j.u.Locale related classes Reviewed-by: okutsu, smarks ! src/share/classes/java/util/Currency.java ! src/share/classes/sun/util/LocaleServiceProviderPool.java ! src/share/classes/sun/util/resources/LocaleData.java From david.holmes at oracle.com Tue Dec 6 01:12:23 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 06 Dec 2011 11:12:23 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDCE4F4.6060002@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> Message-ID: <4EDD6BF7.2040808@oracle.com> Chris, Doug, A few nits see below. Cheers, David ----- As a matter of style can we ensure annotations are on separate lines. I find this: @SuppressWarnings("unchecked") E x = (E) items[takeIndex]; hard to read. (I hate seeing local variable annotations in the first place - way too much clutter in my opinion.) Is the reason for constructs like this: HashEntry[] tab = (HashEntry[])new HashEntry[cap]; that we can't utilize diamond? Otherwise it would nicely reduce to: HashEntry[] tab = new HashEntry<>[cap]; In ConcurrentSkipListMap: - doesn't the class-level unchecked annotation make the local-variable annotation redundant in clone() - you added: * @param s the stream for readObject, but not for writeObject. Seems unnecessary for either. - in the KeySet and Values classes why the changes from to ? Seems superfluous. Did it affect any warnings? In Exchanger why suppress the serial warning rather than add the serialVersionId? Elsewhere the id was added. (I prefer to suppress but am querying consistency here) In LinkedTransferQueue we changed: this.cast(item); to LinkedTransferQueue.cast(item); but in ArrayBlockingQueue we simply changed to: (E) item. Were these cast methods introduced simply to localize the unchecked suppression? Also in LinkedTransferQueue we went from: E e; while ( (e = poll()) != null) { to for (E e; (e = poll()) != null;) { the side-effect on the loop condition is ugly in a for-loop. Why change from the while? Why not change to a proper for-loop: for (E e = poll(); e != null; e = poll()) { In SynchronousQueue: - the Transferer, TransferStack and TransferQueue classes have been generified, but not the internal SNode and QNode classes. Generifying nodes would take a bit of work, but I guess I don't see the point of generifying the others. - why stop using Collections.emptyIterator()? - same comments on while-loop to for-loop conversions as for LTQ On 6/12/2011 1:36 AM, Chris Hegarty wrote: > > Cleanup warnings in the j.u.c. package. > > This is a sync up with the warning fixes in Doug's CVS. There are also a > few style cleanups, import fixes, trivial local variable renaming, > typos, etc. But nothing too surprising! > > http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ > > -Chris. > > P.S. I have already reviewed this, and the contribution is of course > from Doug. From forax at univ-mlv.fr Tue Dec 6 01:45:47 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Tue, 06 Dec 2011 02:45:47 +0100 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDD6BF7.2040808@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> Message-ID: <4EDD73CB.9070304@univ-mlv.fr> On 12/06/2011 02:12 AM, David Holmes wrote: > Chris, Doug, > > A few nits see below. > > Cheers, > David > ----- > > As a matter of style can we ensure annotations are on separate lines. > I find this: > > @SuppressWarnings("unchecked") E x = (E) items[takeIndex]; > > hard to read. (I hate seeing local variable annotations in the first > place - way too much clutter in my opinion.) > > Is the reason for constructs like this: > > HashEntry[] tab = (HashEntry[])new HashEntry[cap]; > > that we can't utilize diamond? Otherwise it would nicely reduce to: > > HashEntry[] tab = new HashEntry<>[cap]; This should not compile because otherwise you can write HashEntry[] tab = new HashEntry<>[12]; Object[] o = tab; o[1] = new HashEntry(); The VM should reject the line above by throwing an ArrayStoreException but because of the erasure, it will not. So creating an array of parameterized type is only possible if you create a reifed type that inherits from an array of parameterized type. By example, this code is valid: enum Foo { foo } Enum[] enums = Foo.values(); R?mi > > > > On 6/12/2011 1:36 AM, Chris Hegarty wrote: >> >> Cleanup warnings in the j.u.c. package. >> >> This is a sync up with the warning fixes in Doug's CVS. There are also a >> few style cleanups, import fixes, trivial local variable renaming, >> typos, etc. But nothing too surprising! >> >> http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ >> >> -Chris. >> >> P.S. I have already reviewed this, and the contribution is of course >> from Doug. From david.holmes at oracle.com Tue Dec 6 02:14:50 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 06 Dec 2011 12:14:50 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDD73CB.9070304@univ-mlv.fr> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDD73CB.9070304@univ-mlv.fr> Message-ID: <4EDD7A9A.2040905@oracle.com> On 6/12/2011 11:45 AM, R?mi Forax wrote: > On 12/06/2011 02:12 AM, David Holmes wrote: >> Is the reason for constructs like this: >> >> HashEntry[] tab = (HashEntry[])new HashEntry[cap]; >> >> that we can't utilize diamond? Otherwise it would nicely reduce to: >> >> HashEntry[] tab = new HashEntry<>[cap]; > > This should not compile because otherwise you can write This compiles fine: @SuppressWarnings("unchecked") public class TestGenerics { static class HashEntry { } public void m() { HashEntry[] newTable = new HashEntry<>[1]; } } I don't know exactly what the type inference code does but I assumed it effectively converted the above to: HashEntry[] newTable = (HashEntry[]) new HashEntry[1]; and not to: HashEntry[] newTable = new HashEntry[1]; which of course does not compile. David ----- > HashEntry[] tab = new HashEntry<>[12]; > Object[] o = tab; > o[1] = new HashEntry(); > The VM should reject the line above by throwing an ArrayStoreException > but because of the erasure, it will not. So creating an array of > parameterized type > is only possible if you create a reifed type that inherits from an array > of parameterized type. > > By example, this code is valid: > enum Foo { foo } > Enum[] enums = Foo.values(); > > R?mi > >> >> >> >> On 6/12/2011 1:36 AM, Chris Hegarty wrote: >>> >>> Cleanup warnings in the j.u.c. package. >>> >>> This is a sync up with the warning fixes in Doug's CVS. There are also a >>> few style cleanups, import fixes, trivial local variable renaming, >>> typos, etc. But nothing too surprising! >>> >>> http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ >>> >>> -Chris. >>> >>> P.S. I have already reviewed this, and the contribution is of course >>> from Doug. > From zhouyx at linux.vnet.ibm.com Tue Dec 6 03:14:03 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Tue, 6 Dec 2011 11:14:03 +0800 Subject: Add Look&Feel support for AIX platform In-Reply-To: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> Message-ID: Hi, I'm not sure what to do for it next, shall I create a bug for it now ? But I don't think the bug system support AIX platform. I remembered it would report something like "we are not supporting the platform". On Tue, Nov 29, 2011 at 10:05 AM, neugens.limasoftware at gmail.com < neugens.limasoftware at gmail.com> wrote: > The change looks good to me as well. > > Cheers, > Mario > > Inviato da HTC > > > ----- Reply message ----- > Da: "Deven" > Data: mar, nov 29, 2011 02:55 > Oggetto: Add Look&Feel support for AIX platform > A: "Neil Richards" > Cc: "Java Core Libs" , < > swing-dev at openjdk.java.net>, > > > On 10/20/2011 11:10 PM, Neil Richards wrote: > > On Tue, 2011-10-18 at 15:53 +0800, Sean Chou wrote: > >> Hi all, > >> > >> > >> This is a simple patch to add LookAndFeel support for AIX platform > >> to help bring > >> up GUI application. > >> > >> > >> This is part of the series of AIX patches. > >> -- > >> Best Regards, > >> Sean Chou > >> > >> > > For ease of review, I've uploaded this suggested fix as a webrev [1]. > > > > The change looks good to me. > > > > Regards, Neil > > > > [1] http://cr.openjdk.java.net/~ngmr/ojdk-167/webrev.00/index.html > Hello, any more comments on this topic? > > > > -- Best Regards, Sean Chou From sebastian.sickelmann at gmx.de Tue Dec 6 04:35:00 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Tue, 06 Dec 2011 05:35:00 +0100 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: <4EDCB0AA.4040603@oracle.com> References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> <4ED94D4C.8000107@oracle.com> <4EDCB0AA.4040603@oracle.com> Message-ID: <4EDD9B74.7080303@gmx.de> Sorry for the broken history. I am answering to Answering to http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008582.html the mail and my predesecor is not received by my email-provider yet. Email is not the best tool to transport discussion, but the only practically we actually have :-(. >Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of >7116890 (Warning Cleanup java.io) *>Eamonn McManus* eamonn at mcmanus.net />Mon Dec 5 14:19:10 PST 2011/ * Previous message: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) * Next message: 7116722: Miscellaneous warnings sun.misc ( and related classes ) * *Messages sorted by:* [ date ] [ thread ] [ subject ] [ author ] ------------------------------------------------------------------------ >To my mind, introducing a new shared parent means defining a new API >that can be used by third-party subclasses. The point is that these >permissions have an action list like "read,write,delete", with parsing >code that converts this into a bitmask and toString() code that >converts it back. I think that code is pretty hairy as it stands, all >the more so because it is duplicated across the existing subclasses. >For MBeanPermission, where there are 17 possible actions, the parsing >method is 370 lines long! So refactoring is definitely desirable. > >An abstract PermissionWithActions class could use enums to good >effect, something like this: > >public abstract class PermissionWithActions> { > public abstract Class actionClass(); > private final EnumSet actions; > protected PermissionWithAction(String target, String actions) { > ...use reflection to get E[] values() and parse the actions... > } > public String getActions() { > ...use toString().toLowerCase() on the actions set... > } > public final Set getActionSet() { > return Collections.unmodifiableSet(actions); > } > public boolean implies(Permission p) { > if (p.getClass() != this.getClass()) { > return false; > } > @SuppressWarnings("unchecked") > PermissionWIthActions pwa = (PermissionWithActions) p; > return this.actions.containsAll(pwa.actions); > } >} >public final class FilePermission extends >PermissionWithActions { > @Override public Class actionClass() { > return FliePermissionActions.class; > } >} >public enum FilePermissionActions {READ, WRITE, EXECUTE, DELETE} > >However I'm not sure we actually want to make such an API change now. >A safer path would be to refactor the parsing and getActions() code >into a sun.* class which is not the parent class of anything, using >delegation rather than inheritance. Safer both because it doesn't >involve figuring out the impact on various JSRs, and because there is >some danger that subclassing might introduce unforeseen attack >vectors. FilePermission etc could each have one instance of this class >that they use for parsing and getActions(), and that instance could >construct e.g. a trie for parsing that is essentially as fast as the >unmaintainable hand-coded parsers that each of the affected Permission >subclasses has today. Parsing does have to be fast because when there >is a security manager every checked operation will construct a >Permission to check against. This is my main part i worry about. Performance in Permission must be really good. Looking through the code i see thatMBeanPermission and ServicePermission are not using the String identity check that every other "PermissionWithActions" is using. I will try to extract the parsing to an sun.security.PermissionParser. Reintegration it back into an abstract base class for the PermissionWithActions classes should be not the biggest problem. Thanks for the input. -- Sebastian > >?amonn > > >On 5 December 2011 07:45, Sebastian Sickelmann >> wrote: >>/ >/>/ Am 05.12.2011 12:53, schrieb Weijun Wang: />>/ >/>>/ >/>>/ >/>>/ On 12/03/2011 06:12 AM, Stuart Marks wrote: />>>>/ >/>>>/ I'm adding Weijun (Max) Wang to this thread. />>>>/ >/>>>/ The same "ackbarfaccept" code had come up a third time when I was />>>>/ reviewing some of Max's changes. The code in question all has to do with />>>>/ permissions, and Max is in the security group, so he might have a better />>>>/ insight whether doing a refactoring is appropriate and how to approach />>>>/ doing it. />>>/ >/>>/ >/>>/ Maybe we can group all permissions with a target and a predefined set of actions under a new abstract class. />>/ >/>/ >/>/ This sounds like the best idea from the implementors point of view. I would prepare a patch as suggestion for this. />>/ Regarding to my own question i would say that there isn't any additional jigsaw related problem here by />>/ introducing a common abstract class. They all rely on java.security.Permission, so java.security seems the correct />>/ package for the new abstract class. />>/ >/>/ Any suggestions for the name? PermissionWithActions???? AbstractPermission?? />>/ >/>/ If i see it right there is the following class hierarchy: />>/ >/>/ j.s.Permission implements Serializable />>/ +j.i.FilePermission />>/ +j.n.SocketPermission />>/ +jx.m.MBeanPermission />>/ +jx.s.a.k.ServicePermission />>/ +j.s.BasicPermission />>/ +j.u.PropertyPermission />>/ >/>/ What happens to serialization when the new hierarchy would look like this: />>/ >/>/ j.s.Permission implements Serializable />>/ +j.s.AbstractPermission />>/ +j.i.FilePermission />>/ +j.n.SocketPermission />>/ +jx.m.MBeanPermission />>/ +jx.s.a.k.ServicePermission />>/ +j.s.BasicPermission />>/ +j.u.PropertyPermission />>/ >/>/ All the classes have a serialVerionUID so i think serialisation is no problem, or is there />>/ a problem i i don't see here? />>/ >/>/ -- Sebastian />>/ >/>>/ -Max />>>/ >/>>>/ >/>>>/ Some searching around reveals that "ackbarfaccept" appears in the />>>>/ PlayerPermission class of the Java ME Mobile Media API (not in any of />>>>/ the OpenJDK repositories) so it looks like the code has been copied even />>>>/ more times than are visible here. Perhaps a public permissions parsing />>>>/ utility method is called for. />>>>/ >/>>>/ s'marks />>>>/ >/>>>/ On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: />>>>>/ >/>>>>/ Am 02.12.2011 16:27, schrieb Brandon Passanisi: />>>>>>/ >/>>>>>/ Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks />>>>>>/ regarding this, but Stuart was able to find more instances of the />>>>>>/ similar />>>>>>/ block of "fallthrough" code. I can volunteer to apply your upcoming />>>>>>/ change />>>>>>/ to FilePermission to the other files if you wish. Or, you can try />>>>>>/ applying />>>>>>/ the change to the other files, but if you don't have time I don't />>>>>>/ mind doing />>>>>>/ it. Here's the section of Stuart's e-mail on this topic: />>>>>>/ >/>>>>>/ ------------------------------------------------------------------------------------- />>>>>>/ >/>>>>>/ (Incidentally, this is the third time I've reviewed code today that />>>>>>/ looks exactly like this. The other cases are in java.io.FilePermission />>>>>>/ and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ />>>>>>/ into a set of cases that do nothing but break; and they have similar />>>>>>/ ("ackbarfaccept") comments. It would be nice if these chunks of code />>>>>>/ could be unified, but they differ in a number of fiddly details.) />>>>>>/ >/>>>>>/ (The string "ackbarfaccept" occurs in the following files: />>>>>>/ 1. java/io/FilePermission.java />>>>>>/ 2. java/net/SocketPermission.java />>>>>>/ 3. java/util/PropertyPermission.java />>>>>>/ 4. javax/management/MBeanPermission.java />>>>>>/ 5. javax/security/auth/kerberos/ServicePermission.java />>>>>>/ Hmmm.) />>>>>>/ ------------------------------------------------------------------------------------- />>>>>>/ >/>>>>>/ >/>>>>>/ Thanks. />>>>>/ >/>>>>/ >/>>>>/ Hi Brandon, />>>>>/ Hi Stuart, />>>>>/ >/>>>>/ i had a look at all those classes and it seems to be the same />>>>>/ algorithm. In an />>>>>/ normal project (not the jdk) i would suggest to completely refactor it />>>>>/ and make />>>>>/ some code de-duplication cleanup. But if i thinks on projects like />>>>>/ jigsaw this />>>>>/ can easily get a real problem. What do you think, should we try to />>>>>/ cleanup them />>>>>/ all. Or should we try to make some de-duplication/code-reuse refactoring. />>>>>/ >/>>>>/ >/>>>>/ -- Sebastian />>>>>>/ >/>>>>>/ >/>>>>>/ On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: />>>>>>>/ >/>>>>>>/ Hi Brandon, />>>>>>>/ >/>>>>>>/ i will try to work out a fix for both and cc the review request to you. />>>>>>>/ >/>>>>>>/ -- Sebastian />>>>>>>/ >/>>>>>>/ Am 01.12.2011 23:54, schrieb Brandon Passanisi: />>>>>>>>/ >/>>>>>>>/ Hi Sebastian. I was speaking with Stuart Marks earlier today and he />>>>>>>>/ mentioned that the "fallthrough" code in FilePermission.java also />>>>>>>>/ exists in />>>>>>>>/ java.util.PropertyPermission.java. Maybe the code author had done some />>>>>>>>/ copy/paste when working on these files. Stuart had said that you />>>>>>>>/ might be />>>>>>>>/ planning on doing some work on this after the warnings cleanup work. />>>>>>>>/ If/when you do this work, maybe you can let me know so that I can />>>>>>>>/ sync the />>>>>>>>/ same changes you apply to FilePermission.java to />>>>>>>>/ PropertyPermission.java? />>>>>>>>/ Or, maybe you can apply the same changes yourself to />>>>>>>>/ PropertyPermission.java?/ From littlee at linux.vnet.ibm.com Tue Dec 6 07:02:05 2011 From: littlee at linux.vnet.ibm.com (Charles Lee) Date: Tue, 06 Dec 2011 15:02:05 +0800 Subject: TextArea's/TextField's enableInputMethods is not working on linux In-Reply-To: <4DDEA7A0.8020107@oracle.com> References: <4DDEA7A0.8020107@oracle.com> Message-ID: <4EDDBDED.3020006@linux.vnet.ibm.com> On 05/27/2011 03:18 AM, Naoto Sato wrote: > It simply sounds like a bug to me. The behavior should not be different. > > Naoto > > (5/26/11 12:25 AM), Sean Chou wrote: >> Hi all, >> >> I found TextArea's/TextField's enableInputMethods is not working on >> linux, >> even enableInputMethods(false) is invocated, the input method can >> still be >> enabled. The testcase is as follows: >> >> /* >> * ImfAWTTest.java >> */ >> import java.awt.Component; >> import java.awt.Dimension; >> import java.awt.FlowLayout; >> import java.awt.Frame; >> import java.awt.TextArea; >> import java.awt.TextField; >> import java.awt.event.WindowAdapter; >> import java.awt.event.WindowEvent; >> >> import javax.swing.JTextArea; >> import javax.swing.JTextField; >> >> >> public class ImfAWTTest extends Frame { >> Component c; >> public ImfAWTTest() { >> super("Single Frame --- AWT Frame"); >> // set layout here. >> setLayout(new FlowLayout()); >> // add components here. >> c = new TextArea("TextArea component(No IM)"); >> c.enableInputMethods(false); >> c.setPreferredSize(new Dimension(400, 100)); >> add(c); >> >> c = new JTextArea("JTextArea component"); >> c.enableInputMethods(true); >> c.setPreferredSize(new Dimension(400, 100)); >> add(c); >> >> c = new TextField("TextField component(No IM)",52); >> c.enableInputMethods(false); >> add(c); >> >> c = new JTextField("JTextField component(No IM)"); >> c.enableInputMethods(false); >> c.setPreferredSize(new Dimension(400, 20)); >> add(c); >> addWindowListener(new WindowAdapter() { >> public void windowClosing(WindowEvent event) { >> System.exit(0); >> } >> }); >> setSize(850, 360); >> setVisible(true); >> } >> public static void main(String[] args) { >> new ImfAWTTest(); >> } >> } >> >> >> Reproduce steps are: >> 1. On linux system, run the testcase with b143. >> 2. Click 'TextArea component(No IM)'. >> 3. Switch Ime window, and type some characters into it >> >> Expectation: >> IME cannot be enabled. >> Result: >> IME can be used to input. >> >> >> Investigation: >> This behavior was developed when Java was using Motif library, >> however Java7's >> TextArea/TexField does not use Motif any more, so enableInputMethods >> doesn't >> work. >> >> >> I suppose we need to update the specification about the behavior. >> Any comments? >> >> >> -- >> Best Regards, >> Sean Chou >> > Hi all, Here is a little progress on this issue. The reason that enableInputMethod(false) does not take any effect is that in XTextFieldPeer/XTextAreaPeer init, they will do target.enbleInputMethods(true), which is re-enable the input methods again. Once I was thinking the fixes should be easy. Just do not set the enbleInputMethods(true) should do the trick. But I was found that X****Peer was also required to set the inputMethods. Unfortunately, we can not get any info about input methods from the target. (Is there any?) The "areInputMethodsEnabled" method is package private .... Any expertise can help on this issue? Thanks in advance. -- Yours Charles From david.holmes at oracle.com Tue Dec 6 07:07:50 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 06 Dec 2011 17:07:50 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDD7A9A.2040905@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDD73CB.9070304@univ-mlv.fr> <4EDD7A9A.2040905@oracle.com> Message-ID: <4EDDBF46.7010808@oracle.com> On 6/12/2011 12:14 PM, David Holmes wrote: > On 6/12/2011 11:45 AM, R?mi Forax wrote: >> On 12/06/2011 02:12 AM, David Holmes wrote: >>> Is the reason for constructs like this: >>> >>> HashEntry[] tab = (HashEntry[])new HashEntry[cap]; >>> >>> that we can't utilize diamond? Otherwise it would nicely reduce to: >>> >>> HashEntry[] tab = new HashEntry<>[cap]; >> >> This should not compile because otherwise you can write > > This compiles fine: > > @SuppressWarnings("unchecked") > public class TestGenerics { > > static class HashEntry { } > > public void m() { > HashEntry[] newTable = new HashEntry<>[1]; > } > } > > > I don't know exactly what the type inference code does but I assumed it > effectively converted the above to: > > HashEntry[] newTable = (HashEntry[]) new HashEntry[1]; > > and not to: > > HashEntry[] newTable = new HashEntry[1]; > > which of course does not compile. Hmmm. Perhaps this is a compilation accident? I don't see anything in the spec that allows diamond to be used with array creation expressions. David ----- > David > ----- > > >> HashEntry[] tab = new HashEntry<>[12]; >> Object[] o = tab; >> o[1] = new HashEntry(); >> The VM should reject the line above by throwing an ArrayStoreException >> but because of the erasure, it will not. So creating an array of >> parameterized type >> is only possible if you create a reifed type that inherits from an array >> of parameterized type. >> >> By example, this code is valid: >> enum Foo { foo } >> Enum[] enums = Foo.values(); >> >> R?mi >> >>> >>> >>> >>> On 6/12/2011 1:36 AM, Chris Hegarty wrote: >>>> >>>> Cleanup warnings in the j.u.c. package. >>>> >>>> This is a sync up with the warning fixes in Doug's CVS. There are >>>> also a >>>> few style cleanups, import fixes, trivial local variable renaming, >>>> typos, etc. But nothing too surprising! >>>> >>>> http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ >>>> >>>> -Chris. >>>> >>>> P.S. I have already reviewed this, and the contribution is of course >>>> from Doug. >> From forax at univ-mlv.fr Tue Dec 6 08:01:51 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Tue, 06 Dec 2011 09:01:51 +0100 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDDBF46.7010808@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDD73CB.9070304@univ-mlv.fr> <4EDD7A9A.2040905@oracle.com> <4EDDBF46.7010808@oracle.com> Message-ID: <4EDDCBEF.4050300@univ-mlv.fr> On 12/06/2011 08:07 AM, David Holmes wrote: > On 6/12/2011 12:14 PM, David Holmes wrote: >> On 6/12/2011 11:45 AM, R?mi Forax wrote: >>> On 12/06/2011 02:12 AM, David Holmes wrote: >>>> Is the reason for constructs like this: >>>> >>>> HashEntry[] tab = (HashEntry[])new HashEntry[cap]; >>>> >>>> that we can't utilize diamond? Otherwise it would nicely reduce to: >>>> >>>> HashEntry[] tab = new HashEntry<>[cap]; >>> >>> This should not compile because otherwise you can write >> >> This compiles fine: >> >> @SuppressWarnings("unchecked") >> public class TestGenerics { >> >> static class HashEntry { } >> >> public void m() { >> HashEntry[] newTable = new HashEntry<>[1]; >> } >> } >> >> >> I don't know exactly what the type inference code does but I assumed it >> effectively converted the above to: >> >> HashEntry[] newTable = (HashEntry[]) new HashEntry[1]; >> >> and not to: >> >> HashEntry[] newTable = new HashEntry[1]; >> >> which of course does not compile. > > Hmmm. Perhaps this is a compilation accident? I don't see anything in > the spec that allows diamond to be used with array creation expressions. Yes, it's a bug of javac, eclipse compiler rejects this code. > > David > ----- R?mi From maurizio.cimadamore at oracle.com Tue Dec 6 12:13:29 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Tue, 06 Dec 2011 12:13:29 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDDCBEF.4050300@univ-mlv.fr> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDD73CB.9070304@univ-mlv.fr> <4EDD7A9A.2040905@oracle.com> <4EDDBF46.7010808@oracle.com> <4EDDCBEF.4050300@univ-mlv.fr> Message-ID: <4EDE06E9.8030902@oracle.com> On 06/12/11 08:01, R?mi Forax wrote: > On 12/06/2011 08:07 AM, David Holmes wrote: >> On 6/12/2011 12:14 PM, David Holmes wrote: >>> On 6/12/2011 11:45 AM, R?mi Forax wrote: >>>> On 12/06/2011 02:12 AM, David Holmes wrote: >>>>> Is the reason for constructs like this: >>>>> >>>>> HashEntry[] tab = (HashEntry[])new HashEntry[cap]; >>>>> >>>>> that we can't utilize diamond? Otherwise it would nicely reduce to: >>>>> >>>>> HashEntry[] tab = new HashEntry<>[cap]; >>>> >>>> This should not compile because otherwise you can write >>> >>> This compiles fine: >>> >>> @SuppressWarnings("unchecked") >>> public class TestGenerics { >>> >>> static class HashEntry { } >>> >>> public void m() { >>> HashEntry[] newTable = new HashEntry<>[1]; >>> } >>> } >>> >>> >>> I don't know exactly what the type inference code does but I assumed it >>> effectively converted the above to: >>> >>> HashEntry[] newTable = (HashEntry[]) new HashEntry[1]; >>> >>> and not to: >>> >>> HashEntry[] newTable = new HashEntry[1]; >>> >>> which of course does not compile. >> >> Hmmm. Perhaps this is a compilation accident? I don't see anything in >> the spec that allows diamond to be used with array creation expressions. > > Yes, it's a bug of javac, eclipse compiler rejects this code. Was a bug [1] ;-) - if you compile with a recent JDK 8 compiler, you get the following: TestBug.java:12: error: cannot create array with '<>' HashEntry[] newTable = new HashEntry<>[1]; 1 error [1] - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7057297 Maurizio > >> >> David >> ----- > > R?mi > From chris.hegarty at oracle.com Tue Dec 6 12:28:18 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 06 Dec 2011 12:28:18 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDD6BF7.2040808@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> Message-ID: <4EDE0A62.7000304@oracle.com> On 12/ 6/11 01:12 AM, David Holmes wrote: > Chris, Doug, > > A few nits see below. > > Cheers, > David > ----- > > As a matter of style can we ensure annotations are on separate lines. I > find this: > > @SuppressWarnings("unchecked") E x = (E) items[takeIndex]; > > hard to read. (I hate seeing local variable annotations in the first > place - way too much clutter in my opinion.) local variable annotations/declaration now on new line. > Is the reason for constructs like this: > > HashEntry[] tab = (HashEntry[])new HashEntry[cap]; > > that we can't utilize diamond? Otherwise it would nicely reduce to: > > HashEntry[] tab = new HashEntry<>[cap]; I see follow up between you, Remi, and Maruizio, on this. Also note that we need to be able to compile with 1.6, so no diamond anyway. I assume this code is good as stands? > In ConcurrentSkipListMap: > - doesn't the class-level unchecked annotation make the local-variable > annotation redundant in clone() Right, but it is not wrong and may be useful if there is ever refactoring of this code and the class level unchecked annotation is removed. clone always needs to suppress unchecked. I'm ok either way. > - you added: > * @param s the stream > for readObject, but not for writeObject. Seems unnecessary for either. Right, this is obviously not public API and does seem unnecessary. This is just a minor style/comment nit to be consistent with other j.u.c. classes. But now I see there are a few other readObject methods that are not consistent too ( as well as some writeObjects ). If it's ok we can catch these at another time? > - in the KeySet and Values classes why the changes from to > ? Seems superfluous. Did it affect any warnings? Yes, this did effect warnings. The ConcurrentNavigableMap being passed to the KeySet is of type ConcurrentNavigableMap where keySet was expecting ConcurrentNavigableMap. In this case we could use , but since V is not interesting/used it can simply be anything, '?'. Ditto for Values, only the value is interesting. > In Exchanger why suppress the serial warning rather than add the > serialVersionId? Elsewhere the id was added. (I prefer to suppress but > am querying consistency here) Since Node and Slot can never be serialized, but just happen to extend a Serializable class, it is safe to just suppress the warning here, rather than giving a bogus value. > In LinkedTransferQueue we changed: > > this.cast(item); > > to > > LinkedTransferQueue.cast(item); > > but in ArrayBlockingQueue we simply changed to: (E) item. Were these > cast methods introduced simply to localize the unchecked suppression? It would appear that the static cast method was added to perform safe casts without triggering warnings ( similar to java.lang.Class.cast ), a long time ago. The compiler warnings we were seeing here were simply that a static method should be qualified by the type name, LinkedTransferQueue, instead of by an expression. I didn't look into consistency with other classes. > Also in LinkedTransferQueue we went from: > > E e; > while ( (e = poll()) != null) { > > to > > for (E e; (e = poll()) != null;) { > > the side-effect on the loop condition is ugly in a for-loop. Why change > from the while? Why not change to a proper for-loop: > > for (E e = poll(); e != null; e = poll()) { I agree, at least to me this is cleaner. This is just code style cleanup ( or maybe not ;-) ), I'm ok either way, or just dropping it until a later sync. > In SynchronousQueue: > > - the Transferer, TransferStack and TransferQueue classes have been > generified, but not the internal SNode and QNode classes. Generifying > nodes would take a bit of work, but I guess I don't see the point of > generifying the others. Doug answered this in his earlier mail: "Yes, possible but it would preclude (or force lying to the type system about) using sentinels that we often need to use for the sake of GC/cleanup. So again, by convention, we always use plain Object in these non-blocking data structures." > - why stop using Collections.emptyIterator()? Collections.emptyIterator was added in 1.7 ( and also in 6Open? ), so I assumed Doug wanted to break the reliance on compiling with 1.7 here. > - same comments on while-loop to for-loop conversions as for LTQ Same answer ;-) Thanks, -Chris. > > > > On 6/12/2011 1:36 AM, Chris Hegarty wrote: >> >> Cleanup warnings in the j.u.c. package. >> >> This is a sync up with the warning fixes in Doug's CVS. There are also a >> few style cleanups, import fixes, trivial local variable renaming, >> typos, etc. But nothing too surprising! >> >> http://cr.openjdk.java.net/~chegar/7118066/webrev.00/webrev/ >> >> -Chris. >> >> P.S. I have already reviewed this, and the contribution is of course >> from Doug. From forax at univ-mlv.fr Tue Dec 6 13:26:15 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Tue, 06 Dec 2011 14:26:15 +0100 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDE0A62.7000304@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> Message-ID: <4EDE17F7.2080403@univ-mlv.fr> On 12/06/2011 01:28 PM, Chris Hegarty wrote: > > On 12/ 6/11 01:12 AM, David Holmes wrote: >> Chris, Doug, >> >> A few nits see below. >> >> Cheers, >> David >> ----- >> >> As a matter of style can we ensure annotations are on separate lines. I >> find this: >> >> @SuppressWarnings("unchecked") E x = (E) items[takeIndex]; >> >> hard to read. (I hate seeing local variable annotations in the first >> place - way too much clutter in my opinion.) > > local variable annotations/declaration now on new line. > >> Is the reason for constructs like this: >> >> HashEntry[] tab = (HashEntry[])new HashEntry[cap]; >> >> that we can't utilize diamond? Otherwise it would nicely reduce to: >> >> HashEntry[] tab = new HashEntry<>[cap]; > > I see follow up between you, Remi, and Maruizio, on this. Also note > that we need to be able to compile with 1.6, so no diamond anyway. I > assume this code is good as stands? > >> In ConcurrentSkipListMap: >> - doesn't the class-level unchecked annotation make the local-variable >> annotation redundant in clone() > > Right, but it is not wrong and may be useful if there is ever > refactoring of this code and the class level unchecked annotation is > removed. clone always needs to suppress unchecked. I'm ok either way. Not true. You only need a @SuppressWarnings if you use a return type which is different from Object and doesn't inherits from a class that already have a clone that doesn't return an Object. So here you need a @SuppressWarnings but it's not always the case. By the way, there is no need to initialize the local variable clone to null. [...] > > Thanks, > -Chris. cheers, R?mi From stuart.marks at oracle.com Tue Dec 6 18:23:11 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Tue, 06 Dec 2011 18:23:11 +0000 Subject: hg: jdk8/tl/jdk: 7116997: fix warnings in java.util.PropertyPermission Message-ID: <20111206182332.B74AA475A4@hg.openjdk.java.net> Changeset: 77f6d4360f4b Author: smarks Date: 2011-12-06 10:14 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/77f6d4360f4b 7116997: fix warnings in java.util.PropertyPermission Reviewed-by: smarks Contributed-by: Brandon Passanisi ! src/share/classes/java/util/PropertyPermission.java From Alan.Bateman at oracle.com Tue Dec 6 20:46:52 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 06 Dec 2011 20:46:52 +0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> Message-ID: <4EDE7F3C.8080403@oracle.com> On 06/12/2011 18:46, Michael Barker wrote: > Hi, > > Attached is the latest LJC warnings patch. I've merged all of the > changes into a single patch. The one I'm unsure of the comments on > the @SuppressWarnings("deprecation") in the ZipEntry.java. I've been > fairly terse and just mentioned that it's using the date > methods/constructor. > I looked at the updated patch and it looks fine to me. There are other classes in j.u.jar and j.u.logging that also have warnings but fixing the warnings is the classes you've chosen is fine too. The comments on the @SuppressWarnings("deprecation") in ZipEntry look okay to me too. -Alan From sebastian.sickelmann at gmx.de Tue Dec 6 20:48:18 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Tue, 06 Dec 2011 21:48:18 +0100 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4EDD082E.7060803@oracle.com> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> <4ED8F694.8010705@oracle.com> <4EDD082E.7060803@oracle.com> Message-ID: <4EDE7F92.406@gmx.de> Am 05.12.2011 19:06, schrieb Sean Mullan: > On 12/2/11 11:02 AM, Sean Mullan wrote: > >>> [0] Solution 1 >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>> [1] Solution 2 >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html > I definitely prefer solution 2. Just a few minor comments: > > - Use the javadoc @inheritDoc tag instead of copying the javadoc for the > initCause method. > > - PreventOverridingOfChaining > > lines 68, 71: what do these comments mean? > > one additional test that would be useful to add would be to call initCause twice > for those ctors that don't have a Throwable parameter, and make sure initCause > throws IllegalStateExc. > > --Sean > Updated the webrev[2] to include your review. [2] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_7/index.html -- Sebastian From mike.duigou at oracle.com Tue Dec 6 21:29:17 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Tue, 6 Dec 2011 13:29:17 -0800 Subject: java.util patch for Warning Cleanup Day In-Reply-To: <4EDA3C5C.6070404@univ-mlv.fr> References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> Message-ID: I have reviewed this patch and also run it against the java/util jtreg test. It looks good to me. Some comments: Currency.java: - The current mercurial source has one of your changes but the remaining two changes, diamond and @SW are still valid. ResourceBundle: - This file also has changes in the current mercurial source. Your version, IMO, is an improvement over the mercurial version and should be applied. HashMap: -The changes to use wildcard instead of the type parameters are a bit disappointing but reasonable. TreeSet: - The change to readObject() (using a single constructor) is theoretically outside of the scope of "warnings only" but I am OK with it. Mike On Dec 3 2011, at 07:12 , R?mi Forax wrote: > On 12/03/2011 03:33 PM, Alan Bateman wrote: >> On 03/12/2011 12:37, R?mi Forax wrote: >>> I've started to remove warnings from java.util >>> and I'm not able to cleanly retrofit java.util.PropertyPermission >>> because java.util.Collections.enumeration is wrongly typed. >>> >> R?mi - you might want to sync up with Mike Duigou as I believe he has been working on the java.util area including collections. Also best to move any discussions on collections/util area to core-libs-dev too. >> >> -Alan > > too late :) > > Here is a webrev that remove most of the unchecked cast/raw generics warnings > http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ > > R?mi > From naoto.sato at oracle.com Tue Dec 6 21:58:34 2011 From: naoto.sato at oracle.com (Naoto Sato) Date: Tue, 06 Dec 2011 13:58:34 -0800 Subject: java.util patch for Warning Cleanup Day In-Reply-To: References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> Message-ID: <4EDE900A.7000909@oracle.com> On 12/6/11 1:29 PM, Mike Duigou wrote: > I have reviewed this patch and also run it against the java/util jtreg test. It looks good to me. > > Some comments: > > Currency.java: > - The current mercurial source has one of your changes but the remaining two changes, diamond and @SW are still valid. For the @SW, keep the one in the current TL repo, as it has narrower scope. Naoto > > ResourceBundle: > - This file also has changes in the current mercurial source. Your version, IMO, is an improvement over the mercurial version and should be applied. > > HashMap: > -The changes to use wildcard instead of the type parameters are a bit disappointing but reasonable. > > TreeSet: > - The change to readObject() (using a single constructor) is theoretically outside of the scope of "warnings only" but I am OK with it. > > Mike > > On Dec 3 2011, at 07:12 , R?mi Forax wrote: > >> On 12/03/2011 03:33 PM, Alan Bateman wrote: >>> On 03/12/2011 12:37, R?mi Forax wrote: >>>> I've started to remove warnings from java.util >>>> and I'm not able to cleanly retrofit java.util.PropertyPermission >>>> because java.util.Collections.enumeration is wrongly typed. >>>> >>> R?mi - you might want to sync up with Mike Duigou as I believe he has been working on the java.util area including collections. Also best to move any discussions on collections/util area to core-libs-dev too. >>> >>> -Alan >> >> too late :) >> >> Here is a webrev that remove most of the unchecked cast/raw generics warnings >> http://cr.openjdk.java.net/~forax/WarningDay1/webrev/ >> >> R?mi >> > From stuart.marks at oracle.com Wed Dec 7 00:53:14 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Tue, 06 Dec 2011 16:53:14 -0800 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDE7F3C.8080403@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> Message-ID: <4EDEB8FA.9060402@oracle.com> On 12/6/11 12:46 PM, Alan Bateman wrote: > On 06/12/2011 18:46, Michael Barker wrote: >> Attached is the latest LJC warnings patch. I've merged all of the >> changes into a single patch. The one I'm unsure of the comments on >> the @SuppressWarnings("deprecation") in the ZipEntry.java. I've been >> fairly terse and just mentioned that it's using the date >> methods/constructor. >> > I looked at the updated patch and it looks fine to me. There are other classes > in j.u.jar and j.u.logging that also have warnings but fixing the warnings is > the classes you've chosen is fine too. The comments on the > @SuppressWarnings("deprecation") in ZipEntry look okay to me too. Hi Mike, OK, I think we've finally converged on this one. I've produced an updated webrev: http://cr.openjdk.java.net/~smarks/reviews/7117249/webrev.1/ I don't have any further issues, and I think you've addressed everybody else's already. But I do have a question. In the JDK8 projects, the changeset comments have a specific format that must be adhered to. The comment I currently have is: 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip Reviewed-by: alanb, dholmes, forax, sherman, smarks Contributed-by: London Java Community and Michael Barker The first two lines are pretty much prescribed. The third line is intended to identify the contributors. I made an initial guess as you can see above, or I can put something else, such as specific names, if you prefer. The syntax is fairly restrictive, though; it needs to be "name " or a comma-separated list of these. (One or more bare email at domain are acceptable as well.) Since the changeset comment is baked for all eternity, :-) I wanted to make sure I got it right before proceeding. But basically this is the last thing that needs to be resolved before I can push in the changes. Let me know. (By the way Alan, thanks for jumping in with this review, it was quite helpful.) s'marks From mandy.chung at oracle.com Wed Dec 7 01:32:15 2011 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 06 Dec 2011 17:32:15 -0800 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4ED8D93A.5050600@oracle.com> References: <4ED8D93A.5050600@oracle.com> Message-ID: <4EDEC21F.4000902@oracle.com> On 12/2/2011 5:57 AM, Frederic Parain wrote: > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ ManagementPermission.java The diagnostic command is not part of the platform. It doesn't seem right to add this new "diagnosticCommand" ManagementPermission. Are the existing "control" and "monitor" permission not adequate for the diagnostic command use? On the other hand, I expect that the required ManagementPermission should be specified in the new methods added in HotSpotDiagnosticMXBean (see below). HotSpotDiagnosticMXBean.java sun.managment.HotSpotDiagnostic does check if the execute method has the "diagnosticCommand" permission. The javadoc must specify the SecurityException be thrown under what condition. To me, the execute methods could require ManagementPermission("control") as the setVMOption method. I'm not certain if DiagnosticCommandInfo is considered as non-sensitive information. Have you checked with the security team to get their advice? L112: Since you are in this file, can you fix the typo "java.security.SecurityException" to "java.lang.SecurityException"? The execute method doesn't throw any exception other than IAE. What happens if the specified command execution fails in the target VM? If no exception is thrown, how does the caller detect if the command succeeds or not and handle it gracefully? It seems that this mechanism should provide a way to detect if a command succeeds or fails programmatically rather than burying the error message in the returned string. The spec needs some clarification about the list of diagnostic commands may change during JVM execution. HotSpotDiagnostic.java L45-49: jvm is not used and can be removed. L133: do you need to check if command == null and throw NPE? or NPE will be thrown somewhere? L159: NPE should be thrown instead of IAE, right? Unless the javadoc for the execute method is modified to reflect that. L176: minor: I wonder if it's any simpler for this native method to take the DiagnosticCommandInfo[] argument (i.e. the caller method does the array allocation than in the native method implementation). ManagementFactoryHelper.java L270: The new parameter "jvm" doesn't seem to be needed. Util.java See comments in ManagementPermission. jmm.h L316-326: the parameters should be lined up with the first one. L316-317 was aligned improperly and it's good to fix them in this batch. HotSpotDiagnostic.c L44, 51, 76-85: indentation needs fixing. L158, 172: this should never happen unless the hotspot/jdk is mismatched. But would it better to throw an exception with an informative message to help diagnostic in case the mismatch does happen? jcmd.1 (man page) Should PerfCounter.print be listed in the man page? Or treat it like other diagnostic commands that are implementation-dependent? That's all the comments I have on the jdk side. Mandy From dl at cs.oswego.edu Wed Dec 7 01:33:58 2011 From: dl at cs.oswego.edu (Doug Lea) Date: Tue, 06 Dec 2011 20:33:58 -0500 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDE0A62.7000304@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> Message-ID: <4EDEC286.7050303@cs.oswego.edu> Thanks for all the comments. We changed to having the annotations on their own lines (even though it furthers the Java tendency of gratuitously occupying too much vertical space :-). Thanks to Chris for explaining why we didn't incorporate some of the other suggestions. Also ... >> - you added: >> * @param s the stream >> for readObject, but not for writeObject. Seems unnecessary for either. > > Right, this is obviously not public API and does seem unnecessary. This is just > a minor style/comment nit to be consistent with other j.u.c. classes. But now I > see there are a few other readObject methods that are not consistent too ( as > well as some writeObjects ). If it's ok we can catch these at another time? Yes, one of these days we should uniformly just remove them all. -Doug From david.holmes at oracle.com Wed Dec 7 06:04:48 2011 From: david.holmes at oracle.com (David Holmes) Date: Wed, 07 Dec 2011 16:04:48 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDEC286.7050303@cs.oswego.edu> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> Message-ID: <4EDF0200.6000703@oracle.com> Thanks Doug and Chris. They were just nits so it is fine to proceed - thanks for changing the annotations though. David On 7/12/2011 11:33 AM, Doug Lea wrote: > Thanks for all the comments. We changed to having the > annotations on their own lines (even though it furthers > the Java tendency of gratuitously occupying too much vertical > space :-). Thanks to Chris for explaining why we didn't > incorporate some of the other suggestions. > > Also ... > >>> - you added: >>> * @param s the stream >>> for readObject, but not for writeObject. Seems unnecessary for either. >> >> Right, this is obviously not public API and does seem unnecessary. >> This is just >> a minor style/comment nit to be consistent with other j.u.c. classes. >> But now I >> see there are a few other readObject methods that are not consistent >> too ( as >> well as some writeObjects ). If it's ok we can catch these at another >> time? > > Yes, one of these days we should uniformly just remove them all. > > -Doug From Alan.Bateman at oracle.com Wed Dec 7 10:09:35 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 07 Dec 2011 10:09:35 +0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> Message-ID: <4EDF3B5F.8030409@oracle.com> On 07/12/2011 08:43, Michael Barker wrote: > : >> 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip >> Reviewed-by: alanb, dholmes, forax, sherman, smarks >> Contributed-by: London Java Community and Michael Barker >> >> >> Since the changeset comment is baked for all eternity, :-) I wanted to make >> sure I got it right before proceeding. But basically this is the last thing >> that needs to be resolved before I can push in the changes. Let me know. > All looks good to me. Michael - the Contributed-by line is usually the individual's name (+ mail address) or a list of names (and their mail addresses). I think Stuart is suggesting that this would be better than "London Java Community". -Alan. From Alan.Bateman at oracle.com Wed Dec 7 10:43:52 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 07 Dec 2011 10:43:52 +0000 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDD4110.2020004@redhat.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> Message-ID: <4EDF4368.2010806@oracle.com> On 05/12/2011 22:09, Omair Majid wrote: > > I have posted a new webrev: > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/03/ > > This includes all the changes from the feedback so far, as well as > changes to ThreadLocal. > > I will not be posting a patch for ClassValue since (as you kindly > pointed out), others are making changes to it and removing some > warnings too [1]. I suppose I will revisit it later (if warning fixes > are still being accepted :D ). I looked through the latest webrev. In EnumConstantNotPresentException.java then the @SuppressWarnings("rawtypes") should probably have a comment to explain why it is needed. In ThreadLocal.get then it's a pity that an additional local is needed to increase the size of the method. Otherwise the changes look okay to me. -Alan. From martijnverburg at gmail.com Wed Dec 7 11:12:31 2011 From: martijnverburg at gmail.com (Martijn Verburg) Date: Wed, 7 Dec 2011 11:12:31 +0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDF3B5F.8030409@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> <4EDF3B5F.8030409@oracle.com> Message-ID: Hi all, Question on contributions, I assume that as the patch is coming from Mike, his OCA covers the rest of us? Cheers, Martijn On Wednesday, 7 December 2011, Alan Bateman wrote: > On 07/12/2011 08:43, Michael Barker wrote: >> >> : >>> >>> 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip >>> Reviewed-by: alanb, dholmes, forax, sherman, smarks >>> Contributed-by: London Java Community and Michael Barker >>> >>> >>> Since the changeset comment is baked for all eternity, :-) I wanted to make >>> sure I got it right before proceeding. But basically this is the last thing >>> that needs to be resolved before I can push in the changes. Let me know. >> >> All looks good to me. > > Michael - the Contributed-by line is usually the individual's name (+ mail address) or a list of names (and their mail addresses). I think Stuart is suggesting that this would be better than "London Java Community". > > -Alan. > From david.holmes at oracle.com Wed Dec 7 11:54:59 2011 From: david.holmes at oracle.com (David Holmes) Date: Wed, 07 Dec 2011 21:54:59 +1000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> <4EDF3B5F.8030409@oracle.com> Message-ID: <4EDF5413.5000008@oracle.com> On 7/12/2011 9:12 PM, Martijn Verburg wrote: > Hi all, > > Question on contributions, I assume that as the patch is coming from Mike, > his OCA covers the rest of us? These patches are simple enough that OCA is not necessary - any Participant can submit simple patches [1] David ------ [1] http://openjdk.java.net/bylaws > Cheers, > Martijn > > On Wednesday, 7 December 2011, Alan Bateman wrote: >> On 07/12/2011 08:43, Michael Barker wrote: >>> >>> : >>>> >>>> 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip >>>> Reviewed-by: alanb, dholmes, forax, sherman, smarks >>>> Contributed-by: London Java Community and Michael Barker >>>> >>>> >>>> Since the changeset comment is baked for all eternity, :-) I wanted to > make >>>> sure I got it right before proceeding. But basically this is the last > thing >>>> that needs to be resolved before I can push in the changes. Let me know. >>> >>> All looks good to me. >> >> Michael - the Contributed-by line is usually the individual's name (+ > mail address) or a list of names (and their mail addresses). I think Stuart > is suggesting that this would be better than "London Java Community". >> >> -Alan. >> From chris.hegarty at oracle.com Wed Dec 7 12:09:39 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Wed, 07 Dec 2011 12:09:39 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDF0200.6000703@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> Message-ID: <4EDF5783.3060007@oracle.com> Thanks David and Doug, So we should be ready to integrate this change, right? NO, not yet! There is a failing regression test, java.util.Collections.EmptyIterator. This test does a reference comparison ( '==' ) on the iterator returned from an empty SynchronousQueue and the iterator returned by Collections.emptyIterator(). These are no longer equal since SynchronousQueue implements its own EmptyIterator (requires to be buildable with 1.6). In fact, there are reference comparisons for emptyEnumeration and emptyMap too. I think this is too restrictive and I don't believe any of the collection classes are specified in such a manner. This check should simply be removed, unless it was though to be some kind of 'best implementation practice', in which case we could just use a different collection type in the test. I you agree I'll file a new CR on this ( I think it may deserve its own CR, seems out of scope of 7118066 ). Here are my initial proposed diffs: diff -r 97e37d3a2ae3 test/java/util/Collections/EmptyIterator.java --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 2011 +0000 +++ b/test/java/util/Collections/EmptyIterator.java Wed Dec 07 12:00:43 2011 +0000 @@ -59,14 +59,12 @@ public class EmptyIterator { } void testEmptyEnumeration(final Enumeration e) { - check(e == emptyEnumeration()); check(! e.hasMoreElements()); THROWS(NoSuchElementException.class, new F(){void f(){ e.nextElement(); }}); } void testEmptyIterator(final Iterator it) { - check(it == emptyIterator()); check(! it.hasNext()); THROWS(NoSuchElementException.class, new F(){void f(){ it.next(); }}); @@ -75,7 +73,6 @@ public class EmptyIterator { } void testEmptyMap(Map m) { - check(m == emptyMap()); check(m.entrySet().iterator() == Collections.>emptyIterator()); check(m.values().iterator() == emptyIterator()); @@ -110,11 +107,6 @@ public class EmptyIterator { void testEmptyCollection(final Collection c) { testEmptyIterator(c.iterator()); - - check(c.iterator() == emptyIterator()); - if (c instanceof List) - check(((List)c).listIterator() == emptyListIterator()); - testToArray(c); } -Chris. On 07/12/2011 06:04, David Holmes wrote: > Thanks Doug and Chris. > > They were just nits so it is fine to proceed - thanks for changing the > annotations though. > > David > > On 7/12/2011 11:33 AM, Doug Lea wrote: >> Thanks for all the comments. We changed to having the >> annotations on their own lines (even though it furthers >> the Java tendency of gratuitously occupying too much vertical >> space :-). Thanks to Chris for explaining why we didn't >> incorporate some of the other suggestions. >> >> Also ... >> >>>> - you added: >>>> * @param s the stream >>>> for readObject, but not for writeObject. Seems unnecessary for either. >>> >>> Right, this is obviously not public API and does seem unnecessary. >>> This is just >>> a minor style/comment nit to be consistent with other j.u.c. classes. >>> But now I >>> see there are a few other readObject methods that are not consistent >>> too ( as >>> well as some writeObjects ). If it's ok we can catch these at another >>> time? >> >> Yes, one of these days we should uniformly just remove them all. >> >> -Doug From paul.hohensee at oracle.com Wed Dec 7 21:15:26 2011 From: paul.hohensee at oracle.com (Paul Hohensee) Date: Wed, 07 Dec 2011 16:15:26 -0500 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4ED8D93A.5050600@oracle.com> References: <4ED8D93A.5050600@oracle.com> Message-ID: <4EDFD76E.8000302@oracle.com> For the hotspot part: In attachListener.cpp, you might want to delete the first "return JNI_OK;" line, since the code under HAS_PENDING_EXCEPTION just falls through. In jmm.h, minor formatting nit: be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the existing declarations. Add a newline just before it on line 322. On 12/2/11 8:57 AM, Frederic Parain wrote: > Hi All, > > [Posting to serviceability-dev, runtime-dev and core-libs-dev > because changes are pretty big and touch all these areas] > > Here's a framework for issuing diagnostics commands to the JVM. > Diagnostic commands are actions executed inside the JVM mainly > for monitoring or management purpose. This work has two parts. > The first part is in the hotspot repository and contains the > framework itself with two diagnostic commands. The second > part is in the JDK repository and contains the command line > utility to invoke diagnostic commands as well as the > HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean > extensions allow a remote client to discover and invoke > diagnostic commands using a JMX connection. > > This changeset only contains two diagnostic commands, more > commands will be added in the future, as a standalone effort > to improve the monitoring and management services of the > JVM, or as part of other projects. > > Webrevs are here: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ > > Here's a technical description of this work: > > 1 - The Diagnostic Command Framework > 1-1 Overview > > The diagnostic command framework is fully implemented in native code > and relies on the HotSpot's internal exception mechanism. > The rational of a pure native implementation is to be able to execute > diagnostic commands even in critical situations like an OutOfMemory > error. All diagnostic commands are registered in a single list, and two > flags control the way a user can interact with them. The "hidden" flag > prevents a diagnostic command from appearing in the list of available > commands returned by the "help" command. However, it's still possible to > get the detailed help message for a hidden command with the "help > " syntax (but it requires to know the name of the hidden > command). The second flag is "enabled" and it controls if a command can > be invoked or not. When listed with the "help" commands, disabled > commands appear with a "[disabled]" label in their description. If the > user tries to invoke a disabled command, an error message is returned > and the command is not run. This error message can be customized on a > per command base. The framework just provides these two flags with their > semantic, it doesn't provide any policy or mechanism to set or modify > these flags. These actions will be delegated to the JVM or special > diagnostic commands. > > 1-2 Implementation > > All diagnostic commands are implemented as subclasses of the DCmd class > defined in services/diagnosticFramework.hpp. Here's the layout of the > DCmd class and the list of methods that a new command has to define or > overwrite: > > class DCmd { > DCmd(outputStream *output); > > static const char *get_name(); > > static const char *get_description(); > > static const char *get_disabled_message(); > > static const char *get_impact(); > > static int get_num_arguments(); > > virtual void print_help(outputStream* out); > > virtual void parse(CmdLine* line, char delim, TRAPS); > > virtual void execute(TRAPS); > > virtual void reset(TRAPS); > > virtual void cleanup(); > > virtual GrowableArray* get_argument_name_array(); > > virtual GrowableArray* get_argument_info_array(); > } > > A diagnostic command is always instantiated with an outputStream in > parameter. This outputStream can point either to a file, a buffer or a > socket (see the ostream.hpp file). > > The get_name() method returns the string that will identify the command > (i.e. the string to put on the command line to invoke it). > > The get_description() methods returns the global description of the > command. > > The get_disabled_message() returns the customized message to return when > the command is disabled, without having to instantiate the command. > > The get_impact() returns a description of the intrusiveness of the > diagnostic command on the Java Virtual Machine behavior. The rational > for this method is that some diagnostic commands can seriously disrupt > the behavior of the Java Virtual Machine (for instance a Thread Dump for > an application with several tens of thousands of threads, or a Head Dump > with a 40GB+ heap size) and other diagnostic commands have no serious > impact on the JVM (for instance, getting the command line arguments or > the JVM version). The recommended format for the description is level>: [longer description], where the impact level is selected among > this list: {low, medium, high}. The optional longer description can > provide more specific details like the fact that Thread Dump impact > depends on the heap size. > > The get_num_arguments() returns the number of options/arguments > recognized by the diagnostic command. This method is only used by the > JMX interface support (see below). > > The print_help() methods prints a detailed help on the outputStream > passed in argument. The detailed help contains the list of all supported > options with their type and description. > > The parse() method is in charge of parsing the command arguments. Each > command is free to implement its own argument parser. However, an > argument parser framework is provided (see section 1-3) to ease the > implementation, but its use is optional. The parse method takes a > delimiter character in argument, which is used to mark the limit between > two arguments (typically invocation from jcmd will use a space character > as a delimiter while invocation from the JVM command line parsing code > will use a comma as a delimiter). > > The execute() method is naturally the one to invoke to get the > diagnostic command executed. The parse() and the execute() methods are > dissociated, so it's a possible perform the argument parsing in one > thread, and delegate the execution to another thread, as long as the > diagnostic command doesn't reference thread local variables. The > framework allows several instances of the same diagnostic command to be > executed in parallel. If for some reasons concurrent executions should > not be allowed for a given diagnostic command, this is the > responsibility of the diagnostic command implementor to enforce this > rule, for instance by protecting the body of the execute() method with a > global lock. > > The reset() method is used to initialize the internal fields of the > diagnostic command or to reset the internal fields to their initial > value to be able to re-use an already allocated diagnostic command > instance. > > The cleanup() method is used to perform perform cleanup (like freeing of > all memory allocated to store internal data). The DCmd extends the > ResourceObj class, so when allocated in a ResourceArea, destructors > cannot be used to perform cleanup. To ensure that cleanup is performed > in all cases, it is recommended to create a DCmdMark instance for each > DCmd instance. DCmdMark is a stack allocated object with a pointer to a > DCmd instance. When the DCmdMark is destroyed, its destructor calls the > cleanup() method of the DCmd instance it points to. If the DCmd instance > has been allocated on the C-Heap, the DCmdMark will also free the memory > allocated to store the DCmd instance. > > The get_argument_name_array() and get_argument_info_array() are related > to the JMX interface of the diagnostic command framework, so they are > described in section 3. > > 1-3 DCmdParser framework > > The DCmdParser class is an optional framework to help development of > argument parsers. It provides many features required by the diagnostic > command framework (generation of the help message or the argument > descriptions for the JMX interface) but all these features can easily be > re-implemented if a developer decides not to use the DCmdParser > framework. > > The DCmdParser class is relying on the DCmdArgument template. This > template must be used to define the different types of argument the > parser will have to handle. When a new specialization of the template is > done, three methods have to be provided: > > void parse_value(const char *str,size_t len,TRAPS); > void init_value(TRAPS); > void destroy_value(); > > The parse_value() method is used to convert a string into an argument > value. The print_value() method is used to display the default value > (support for the detailed help message). The init_value() method is used > to initialize or reset the argument value. The destroy_value() method is > a clean-up method (useful when the argument has allocated some C-Heap > memory to store its value and this memory has to be freed before > destroying the DCmdArgument instance). > > The DCmdParser makes a distinction between options and arguments. > Options are identified by a key name that must appear on the command > line, while argument are identified just by the position of the argument > on the command line. Options use the = syntax. In case of > boolean options, the '=' part of the syntax can be omitted to set > the option to true. Arguments are just sequences characters delimited by > a separator character. This separator can be specified at runtime when > invoking the diagnostic command framework. If an argument contain a > character that could be used as a delimiter, it's possible to enclose > the argument between single or double quotes. Options are arguments are > instantiated using the same DCmdArgument class but they're registered > differently to the DCmdParser. > > The way to use the DCmdParser is to declare the parser and the > option/arguments as fields of the diagnostic command class (which is > itself a sub-class of the DCmd class), like this: > > > class EchoDCmd : public DCmd { > protected: > DCmdParser _dcmdparser; > > DCmdArgument _required; > > DCmdArgument _intval; > > DCmdArgument _boolval; > > DCmdArgument _stringval; > > DCmdArgument _first_arg; > > DCmdArgument _second_arg; > > DCmdArgument _optional_arg; > > } > > The parser and the options/arguments must be initialized before the > diagnostic command class, and the options/arguments have to be > registered to the parser like this: > > EchoDCmd(outputStream *output) : DCmd(output), > _stringval("-strval","a string argument","STRING",false), > > _boolval("-boolval","a boolean argument","BOOLEAN",false), > > _intval("-intval","an integer argument","INTEGER",false), > > _required("-req","a mandatory integer argument","INTEGER",true), > > _fist_arg("first argument","a string argument","STRING",true), > > _second_arg("second argument,"an integer argument,"INTEGER",true), > > _optional_arg("optional argument","an optional string > argument","STRING","false") > > { > > _dcmdparser.add_dcmd_option(&_stringval) > > _dcmdparser.add_dcmd_option(&_boolval); > > _dcmdparser.add_dcmd_option(&_intval); > > _dcmdparser.add_dcmd_option(&_required); > > _dcmdparser.add_argument(&_first_arg); > > _dcmdparser.add_argument(&_second_arg); > > _dcmdparser.add_argument(&_optional_arg); > }; > > The add_dcmd_argument()/ add_dcmd_option() method is used to add an > argument/option to the parser. The option/argument constructor takes the > name of the option/argument, its description, a string describing its > type and a boolean to specify if the option/argument is mandatory or > not. The parser doesn't support option/argument duplicates (having the > same name) but the code currently doesn't check for duplicates.The order > used to register options has no impact on the parser. However, the order > used to register arguments is critical because the parser will use the > same order to parse the command line. In the example above, the parser > expects to have a first argument of type STRING (parsed using > _first_arg), then a second argument of type INTEGER (parsed using > _second_arg) and optionally a third parameter of type STRING (parsed > using _optional_arg). A mandatory option or argument has to be specify > every time the command is invoked. If it is missing, an exception is > thrown at the end of the parsing. Optional arguments have to be > registered after mandatory arguments. An optional argument will be > considered for parsing only if all arguments before it (mandatory or > not) have already been used to parse the command line. > > The DCmdParser and its DCmdArgument instances are embedded in the DCmd > instance. The rational for this design is to limit the number of C-heap > allocations but also to be able to pre-allocate diagnostic command > instances for critical situations. If the process is running out of > C-heap space, it's not possible to instantiate new diagnostic commands > to troubleshoot the situation. By pre-allocating some diagnostic > commands, it will be possible to run them even in this critical > situation. Of course, the diagnostic command itself should not try to > allocate memory during its execution, this prevents the diagnostic > command to use variable length arguments like strings. By nature, > pre-allocated diagnostic commands aim to be re-usable, this is the > purpose of the reset() method which restores the default status of all > arguments. > > 1-4 Internal invocation > > Using a diagnostic command from the JVM itself is pretty easy: > instantiate the class and invoke the parse() method then the execute() > method. A diagnostic command can be instantiated from inside the JVM > even it is not registered. This is a difference with the external > invocations (from jcmd or JMX) that require the command to be registered. > > 2 - The JCmd interface > > Diagnostic commands can also be invoked from outside the JVM process, > using the new 'jcmd' utility. The jcmd program uses the attach API > to connect to the JVM, send requests and receive results. The > jcmd utility must be launched on the same machine than the one running > the JVM (its a local tool). Launched without arguments, jcmd displays a > list of all JVMs running on the machine. The jcmd source code is in > the jdk repository like other existing j* tools. > > To execute a diagnostic command in a particular JVM, the generic > syntax is: > > jcmd [arguments] > > The attachListener has been modified to recognized the jcmd requests. > When a jcmd request is identified, it is parsed to extract the command > name. The JVM performs a look up of this command in a list of registered > commands. To be executable by an external request, a diagnostic command > has to be registered. The registration is performed with the DCmdFactory > class (see services/management.cpp). > > 3 - The JMX interface > > The framework provides a JMX based interface to the diagnostic commands. > This interface allows remote invocation of diagnostic commands through a > JMX connection. > > 3-1 The interface > > The information related to the diagnostic commands are accessible > through new methods added to the > com.sun.management.HotspotDiagnosticMXBean: > > public List getDiagnosticCommands(); > > public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); > > public List getDiagnosticCommandInfo(List > command); > > public List getDiagnosticCommandInfo(); > > public String execute(String commandLine) throws > IllegalArgumentException ; > > public String execute(String cmd, String... arguments) > throws IllegalArgumentException; > > > The getDiagnosticCommands() method returns an array containing the names > of the not-hidden registered diagnostic commands. > > The three getDiagnosticCommandInfo() methods return one or several > diagnostic command descriptions using the DiagnosticCommandInfo class. > > The two execute() methods allow the user the invoke a diagnostic command > in different ways. > > The DiagnosticCommandInfo class is describing a diagnostic command with > the following information: > > public class DiagnosticCommandInfo { > > public String getName(); > > public String getDescription(); > > public String getImpact(); > > public boolean isEnabled(); > > public List getArgumentsInfo(); > } > > The getName() method returns the name of the diagnostic command. This > name is the one to use in execute() methods to invoke the diagnostic > command. > > The getDescription() method returns a general description of the > diagnostic command. > > The getImpact() method returns a description of the intrusiveness of > diagnostic command. > > The isEnabled() method returns true if the method is enabled, false if > it is disabled. A disabled method cannot be executed. > > The getArgumentsInfo() returns a list of descriptions for the options or > arguments recognized by the diagnostic command. Each option/argument is > described by a DiagnosticCommandArgumentInfo instance: > > public class DiagnosticCommandArgumentInfo { > > public String getName(); > > public String getDescription(); > > public String getType(); > > public String getDefault(); > > public boolean isMandatory(); > > public boolean isOption(); > > public int getPosition(); > } > > If the DiagnosticCommandArgumentInfo instance describes an option, > isOption() returns true and getPosition() returns -1. Otherwise, when > the DiagnosticCommandArgumentInfo instance describes an argument, > isOption() returns false and getPosition() returns the expected position > for this argument. The position of an argument is defined relatively to > all arguments passed on the command line, options are not considered > when defining an argument position. The getDefault() method returns the > default value of the argument if a default has been defined, otherwise > it returns null. > > 3-2 The implementation > > The framework has been designed in a way that prevents diagnostic > command developers to worry about the JMX interface. In addition to > the methods described in section 1-2, a diagnostic command developer has > to provide three methods: > > int get_num_arguments() > > which returns the number of option and arguments supported by the > command. > > GrowableArray* get_argument_name_array() > > which provides the name of the arguments supported by the command. > > GrowableyArray* get_argument_info_array() > > which provides the description of each argument with a DCmdArgumentInfo > instance. DCmdArgumentInfo is a C++ class used by the framework to > generate the sun.com.management.DcmdArgumentInfo instances. This is done > automatically and the diagnostic command developer doesn't need to know > how to create Java objects from the runtime. > > 4 - The Diagnostic Commands > > To avoid name collisions between diagnostic commands coming from > different projects, use of a flat name space should be avoided and > a more structured organization is recommended. The framework itself > doesn't depend on this organization, so it will be a set of rules > defining a convention in the way commands are named. > > Diagnostic commands can easily organized in a hierarchical way, so the > template for a command name can be: > > .[sub-domain.] > > This template can be extended with sub-sub-domains and so on. > > A special set of commands without domain will be reserved for the > commands related to the diagnostic framework itself, like the "help" > command. > > > Thanks, > > Fred > From john.r.rose at oracle.com Wed Dec 7 21:14:33 2011 From: john.r.rose at oracle.com (John Rose) Date: Wed, 7 Dec 2011 13:14:33 -0800 (PST) Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <4EDC2B98.6020101@oracle.com> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> <4EDC0FFE.2080805@oracle.com> <4EDC1851.4060508@univ-mlv.fr> <4EDC2B98.6020101@oracle.com> Message-ID: <2C2A1E0C-876C-4DC6-9812-E53E2619D272@oracle.com> On Dec 4, 2011, at 6:25 PM, David Holmes wrote: >>> In the mean time, all the non-Groovy, non-JRuby, non-Nashorn, etc. >>> uses of class Class and all the classes not visible in those >>> environments when they are being used will be larger. >>> >>> Adding the fields may be the right time/space trade-off, but I think >>> the point merits some discussion given how many Class objects get >>> created and the relative proportion of Java executions where >>> ClassValue is currently used. >>> >>> The more reasonable time/space trade-off can change over time of course. >>> >> >> I agree but as I said, in that case, I think it's better to take a look >> to the big picture >> and see if not only class values fields but also annotations related >> fields or reflection related fields can be moved. > > This is currently being looked at with a general aim of reducing the size of Class instances. So adding back some size would need strong justification. At a minimum we need a single word to root the lookup in the Class itself, in order to avoid (a) many extra branches and indirections per lookup and (b) scaling problems associated with centralized hash tables. (This is the same reasoning as with Thread.threadLocals.) Since the number of classes in apps is typically in the range 10^3 to 10^4, the extra word is not going to hurt anybody. The proof of this is that nobody has needed to touch the highly expansive implementation of reflective caches on Class, which was noted by Remi. These things have existed since March of 2001 without causing enough pain to require fixing, and in those years memory has shrunk in cost by orders of magnitude. But, in order to respect the "general aim" you are mentioning, I have unhoisted one of the two words from the Class instance itself. This will cause a minor slowdown in JSR 292 use cases. This is tolerable, since the next level of speedup will probably come from compiler optimizations, not data structure reorganization. I have updated the webrev in place with this additional change: http://cr.openjdk.java.net/~jrose/7030453/webrev.01 There is a separate mini-diff for the unhoisting, which is trivial: http://cr.openjdk.java.net/~jrose/7030453/unhoist-cache.patch -- John From paul.hohensee at oracle.com Wed Dec 7 21:16:20 2011 From: paul.hohensee at oracle.com (Paul Hohensee) Date: Wed, 07 Dec 2011 16:16:20 -0500 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EDFD76E.8000302@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EDFD76E.8000302@oracle.com> Message-ID: <4EDFD7A4.6090901@oracle.com> This is just the start of a review: fumble-fingers sent it well before it's time. Paul On 12/7/11 4:15 PM, Paul Hohensee wrote: > For the hotspot part: > > In attachListener.cpp, you might want to delete the first "return > JNI_OK;" > line, since the code under HAS_PENDING_EXCEPTION just falls through. > > In jmm.h, minor formatting nit: be nice to indent "(JNIEnv" on lines 318, > 319 and 325 the same as the existing declarations. Add a newline > just before it on line 322. > > > > On 12/2/11 8:57 AM, Frederic Parain wrote: >> Hi All, >> >> [Posting to serviceability-dev, runtime-dev and core-libs-dev >> because changes are pretty big and touch all these areas] >> >> Here's a framework for issuing diagnostics commands to the JVM. >> Diagnostic commands are actions executed inside the JVM mainly >> for monitoring or management purpose. This work has two parts. >> The first part is in the hotspot repository and contains the >> framework itself with two diagnostic commands. The second >> part is in the JDK repository and contains the command line >> utility to invoke diagnostic commands as well as the >> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >> extensions allow a remote client to discover and invoke >> diagnostic commands using a JMX connection. >> >> This changeset only contains two diagnostic commands, more >> commands will be added in the future, as a standalone effort >> to improve the monitoring and management services of the >> JVM, or as part of other projects. >> >> Webrevs are here: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >> >> Here's a technical description of this work: >> >> 1 - The Diagnostic Command Framework >> 1-1 Overview >> >> The diagnostic command framework is fully implemented in native code >> and relies on the HotSpot's internal exception mechanism. >> The rational of a pure native implementation is to be able to execute >> diagnostic commands even in critical situations like an OutOfMemory >> error. All diagnostic commands are registered in a single list, and two >> flags control the way a user can interact with them. The "hidden" flag >> prevents a diagnostic command from appearing in the list of available >> commands returned by the "help" command. However, it's still possible to >> get the detailed help message for a hidden command with the "help >> " syntax (but it requires to know the name of the hidden >> command). The second flag is "enabled" and it controls if a command can >> be invoked or not. When listed with the "help" commands, disabled >> commands appear with a "[disabled]" label in their description. If the >> user tries to invoke a disabled command, an error message is returned >> and the command is not run. This error message can be customized on a >> per command base. The framework just provides these two flags with their >> semantic, it doesn't provide any policy or mechanism to set or modify >> these flags. These actions will be delegated to the JVM or special >> diagnostic commands. >> >> 1-2 Implementation >> >> All diagnostic commands are implemented as subclasses of the DCmd class >> defined in services/diagnosticFramework.hpp. Here's the layout of the >> DCmd class and the list of methods that a new command has to define or >> overwrite: >> >> class DCmd { >> DCmd(outputStream *output); >> >> static const char *get_name(); >> >> static const char *get_description(); >> >> static const char *get_disabled_message(); >> >> static const char *get_impact(); >> >> static int get_num_arguments(); >> >> virtual void print_help(outputStream* out); >> >> virtual void parse(CmdLine* line, char delim, TRAPS); >> >> virtual void execute(TRAPS); >> >> virtual void reset(TRAPS); >> >> virtual void cleanup(); >> >> virtual GrowableArray* get_argument_name_array(); >> >> virtual GrowableArray* get_argument_info_array(); >> } >> >> A diagnostic command is always instantiated with an outputStream in >> parameter. This outputStream can point either to a file, a buffer or a >> socket (see the ostream.hpp file). >> >> The get_name() method returns the string that will identify the command >> (i.e. the string to put on the command line to invoke it). >> >> The get_description() methods returns the global description of the >> command. >> >> The get_disabled_message() returns the customized message to return when >> the command is disabled, without having to instantiate the command. >> >> The get_impact() returns a description of the intrusiveness of the >> diagnostic command on the Java Virtual Machine behavior. The rational >> for this method is that some diagnostic commands can seriously disrupt >> the behavior of the Java Virtual Machine (for instance a Thread Dump for >> an application with several tens of thousands of threads, or a Head Dump >> with a 40GB+ heap size) and other diagnostic commands have no serious >> impact on the JVM (for instance, getting the command line arguments or >> the JVM version). The recommended format for the description is > level>: [longer description], where the impact level is selected among >> this list: {low, medium, high}. The optional longer description can >> provide more specific details like the fact that Thread Dump impact >> depends on the heap size. >> >> The get_num_arguments() returns the number of options/arguments >> recognized by the diagnostic command. This method is only used by the >> JMX interface support (see below). >> >> The print_help() methods prints a detailed help on the outputStream >> passed in argument. The detailed help contains the list of all supported >> options with their type and description. >> >> The parse() method is in charge of parsing the command arguments. Each >> command is free to implement its own argument parser. However, an >> argument parser framework is provided (see section 1-3) to ease the >> implementation, but its use is optional. The parse method takes a >> delimiter character in argument, which is used to mark the limit between >> two arguments (typically invocation from jcmd will use a space character >> as a delimiter while invocation from the JVM command line parsing code >> will use a comma as a delimiter). >> >> The execute() method is naturally the one to invoke to get the >> diagnostic command executed. The parse() and the execute() methods are >> dissociated, so it's a possible perform the argument parsing in one >> thread, and delegate the execution to another thread, as long as the >> diagnostic command doesn't reference thread local variables. The >> framework allows several instances of the same diagnostic command to be >> executed in parallel. If for some reasons concurrent executions should >> not be allowed for a given diagnostic command, this is the >> responsibility of the diagnostic command implementor to enforce this >> rule, for instance by protecting the body of the execute() method with a >> global lock. >> >> The reset() method is used to initialize the internal fields of the >> diagnostic command or to reset the internal fields to their initial >> value to be able to re-use an already allocated diagnostic command >> instance. >> >> The cleanup() method is used to perform perform cleanup (like freeing of >> all memory allocated to store internal data). The DCmd extends the >> ResourceObj class, so when allocated in a ResourceArea, destructors >> cannot be used to perform cleanup. To ensure that cleanup is performed >> in all cases, it is recommended to create a DCmdMark instance for each >> DCmd instance. DCmdMark is a stack allocated object with a pointer to a >> DCmd instance. When the DCmdMark is destroyed, its destructor calls the >> cleanup() method of the DCmd instance it points to. If the DCmd instance >> has been allocated on the C-Heap, the DCmdMark will also free the memory >> allocated to store the DCmd instance. >> >> The get_argument_name_array() and get_argument_info_array() are related >> to the JMX interface of the diagnostic command framework, so they are >> described in section 3. >> >> 1-3 DCmdParser framework >> >> The DCmdParser class is an optional framework to help development of >> argument parsers. It provides many features required by the diagnostic >> command framework (generation of the help message or the argument >> descriptions for the JMX interface) but all these features can easily be >> re-implemented if a developer decides not to use the DCmdParser >> framework. >> >> The DCmdParser class is relying on the DCmdArgument template. This >> template must be used to define the different types of argument the >> parser will have to handle. When a new specialization of the template is >> done, three methods have to be provided: >> >> void parse_value(const char *str,size_t len,TRAPS); >> void init_value(TRAPS); >> void destroy_value(); >> >> The parse_value() method is used to convert a string into an argument >> value. The print_value() method is used to display the default value >> (support for the detailed help message). The init_value() method is used >> to initialize or reset the argument value. The destroy_value() method is >> a clean-up method (useful when the argument has allocated some C-Heap >> memory to store its value and this memory has to be freed before >> destroying the DCmdArgument instance). >> >> The DCmdParser makes a distinction between options and arguments. >> Options are identified by a key name that must appear on the command >> line, while argument are identified just by the position of the argument >> on the command line. Options use the = syntax. In case of >> boolean options, the '=' part of the syntax can be omitted to set >> the option to true. Arguments are just sequences characters delimited by >> a separator character. This separator can be specified at runtime when >> invoking the diagnostic command framework. If an argument contain a >> character that could be used as a delimiter, it's possible to enclose >> the argument between single or double quotes. Options are arguments are >> instantiated using the same DCmdArgument class but they're registered >> differently to the DCmdParser. >> >> The way to use the DCmdParser is to declare the parser and the >> option/arguments as fields of the diagnostic command class (which is >> itself a sub-class of the DCmd class), like this: >> >> >> class EchoDCmd : public DCmd { >> protected: >> DCmdParser _dcmdparser; >> >> DCmdArgument _required; >> >> DCmdArgument _intval; >> >> DCmdArgument _boolval; >> >> DCmdArgument _stringval; >> >> DCmdArgument _first_arg; >> >> DCmdArgument _second_arg; >> >> DCmdArgument _optional_arg; >> >> } >> >> The parser and the options/arguments must be initialized before the >> diagnostic command class, and the options/arguments have to be >> registered to the parser like this: >> >> EchoDCmd(outputStream *output) : DCmd(output), >> _stringval("-strval","a string argument","STRING",false), >> >> _boolval("-boolval","a boolean argument","BOOLEAN",false), >> >> _intval("-intval","an integer argument","INTEGER",false), >> >> _required("-req","a mandatory integer argument","INTEGER",true), >> >> _fist_arg("first argument","a string argument","STRING",true), >> >> _second_arg("second argument,"an integer argument,"INTEGER",true), >> >> _optional_arg("optional argument","an optional string >> argument","STRING","false") >> >> { >> >> _dcmdparser.add_dcmd_option(&_stringval) >> >> _dcmdparser.add_dcmd_option(&_boolval); >> >> _dcmdparser.add_dcmd_option(&_intval); >> >> _dcmdparser.add_dcmd_option(&_required); >> >> _dcmdparser.add_argument(&_first_arg); >> >> _dcmdparser.add_argument(&_second_arg); >> >> _dcmdparser.add_argument(&_optional_arg); >> }; >> >> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >> argument/option to the parser. The option/argument constructor takes the >> name of the option/argument, its description, a string describing its >> type and a boolean to specify if the option/argument is mandatory or >> not. The parser doesn't support option/argument duplicates (having the >> same name) but the code currently doesn't check for duplicates.The order >> used to register options has no impact on the parser. However, the order >> used to register arguments is critical because the parser will use the >> same order to parse the command line. In the example above, the parser >> expects to have a first argument of type STRING (parsed using >> _first_arg), then a second argument of type INTEGER (parsed using >> _second_arg) and optionally a third parameter of type STRING (parsed >> using _optional_arg). A mandatory option or argument has to be specify >> every time the command is invoked. If it is missing, an exception is >> thrown at the end of the parsing. Optional arguments have to be >> registered after mandatory arguments. An optional argument will be >> considered for parsing only if all arguments before it (mandatory or >> not) have already been used to parse the command line. >> >> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >> instance. The rational for this design is to limit the number of C-heap >> allocations but also to be able to pre-allocate diagnostic command >> instances for critical situations. If the process is running out of >> C-heap space, it's not possible to instantiate new diagnostic commands >> to troubleshoot the situation. By pre-allocating some diagnostic >> commands, it will be possible to run them even in this critical >> situation. Of course, the diagnostic command itself should not try to >> allocate memory during its execution, this prevents the diagnostic >> command to use variable length arguments like strings. By nature, >> pre-allocated diagnostic commands aim to be re-usable, this is the >> purpose of the reset() method which restores the default status of all >> arguments. >> >> 1-4 Internal invocation >> >> Using a diagnostic command from the JVM itself is pretty easy: >> instantiate the class and invoke the parse() method then the execute() >> method. A diagnostic command can be instantiated from inside the JVM >> even it is not registered. This is a difference with the external >> invocations (from jcmd or JMX) that require the command to be >> registered. >> >> 2 - The JCmd interface >> >> Diagnostic commands can also be invoked from outside the JVM process, >> using the new 'jcmd' utility. The jcmd program uses the attach API >> to connect to the JVM, send requests and receive results. The >> jcmd utility must be launched on the same machine than the one running >> the JVM (its a local tool). Launched without arguments, jcmd displays a >> list of all JVMs running on the machine. The jcmd source code is in >> the jdk repository like other existing j* tools. >> >> To execute a diagnostic command in a particular JVM, the generic >> syntax is: >> >> jcmd [arguments] >> >> The attachListener has been modified to recognized the jcmd requests. >> When a jcmd request is identified, it is parsed to extract the command >> name. The JVM performs a look up of this command in a list of registered >> commands. To be executable by an external request, a diagnostic command >> has to be registered. The registration is performed with the DCmdFactory >> class (see services/management.cpp). >> >> 3 - The JMX interface >> >> The framework provides a JMX based interface to the diagnostic commands. >> This interface allows remote invocation of diagnostic commands through a >> JMX connection. >> >> 3-1 The interface >> >> The information related to the diagnostic commands are accessible >> through new methods added to the >> com.sun.management.HotspotDiagnosticMXBean: >> >> public List getDiagnosticCommands(); >> >> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >> >> public List getDiagnosticCommandInfo(List >> command); >> >> public List getDiagnosticCommandInfo(); >> >> public String execute(String commandLine) throws >> IllegalArgumentException ; >> >> public String execute(String cmd, String... arguments) >> throws IllegalArgumentException; >> >> >> The getDiagnosticCommands() method returns an array containing the names >> of the not-hidden registered diagnostic commands. >> >> The three getDiagnosticCommandInfo() methods return one or several >> diagnostic command descriptions using the DiagnosticCommandInfo class. >> >> The two execute() methods allow the user the invoke a diagnostic command >> in different ways. >> >> The DiagnosticCommandInfo class is describing a diagnostic command with >> the following information: >> >> public class DiagnosticCommandInfo { >> >> public String getName(); >> >> public String getDescription(); >> >> public String getImpact(); >> >> public boolean isEnabled(); >> >> public List getArgumentsInfo(); >> } >> >> The getName() method returns the name of the diagnostic command. This >> name is the one to use in execute() methods to invoke the diagnostic >> command. >> >> The getDescription() method returns a general description of the >> diagnostic command. >> >> The getImpact() method returns a description of the intrusiveness of >> diagnostic command. >> >> The isEnabled() method returns true if the method is enabled, false if >> it is disabled. A disabled method cannot be executed. >> >> The getArgumentsInfo() returns a list of descriptions for the options or >> arguments recognized by the diagnostic command. Each option/argument is >> described by a DiagnosticCommandArgumentInfo instance: >> >> public class DiagnosticCommandArgumentInfo { >> >> public String getName(); >> >> public String getDescription(); >> >> public String getType(); >> >> public String getDefault(); >> >> public boolean isMandatory(); >> >> public boolean isOption(); >> >> public int getPosition(); >> } >> >> If the DiagnosticCommandArgumentInfo instance describes an option, >> isOption() returns true and getPosition() returns -1. Otherwise, when >> the DiagnosticCommandArgumentInfo instance describes an argument, >> isOption() returns false and getPosition() returns the expected position >> for this argument. The position of an argument is defined relatively to >> all arguments passed on the command line, options are not considered >> when defining an argument position. The getDefault() method returns the >> default value of the argument if a default has been defined, otherwise >> it returns null. >> >> 3-2 The implementation >> >> The framework has been designed in a way that prevents diagnostic >> command developers to worry about the JMX interface. In addition to >> the methods described in section 1-2, a diagnostic command developer has >> to provide three methods: >> >> int get_num_arguments() >> >> which returns the number of option and arguments supported by the >> command. >> >> GrowableArray* get_argument_name_array() >> >> which provides the name of the arguments supported by the command. >> >> GrowableyArray* get_argument_info_array() >> >> which provides the description of each argument with a DCmdArgumentInfo >> instance. DCmdArgumentInfo is a C++ class used by the framework to >> generate the sun.com.management.DcmdArgumentInfo instances. This is done >> automatically and the diagnostic command developer doesn't need to know >> how to create Java objects from the runtime. >> >> 4 - The Diagnostic Commands >> >> To avoid name collisions between diagnostic commands coming from >> different projects, use of a flat name space should be avoided and >> a more structured organization is recommended. The framework itself >> doesn't depend on this organization, so it will be a set of rules >> defining a convention in the way commands are named. >> >> Diagnostic commands can easily organized in a hierarchical way, so the >> template for a command name can be: >> >> .[sub-domain.] >> >> This template can be extended with sub-sub-domains and so on. >> >> A special set of commands without domain will be reserved for the >> commands related to the diagnostic framework itself, like the "help" >> command. >> >> >> Thanks, >> >> Fred >> From frederic.parain at oracle.com Wed Dec 7 21:30:51 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Wed, 07 Dec 2011 22:30:51 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EDEC21F.4000902@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EDEC21F.4000902@oracle.com> Message-ID: <4EDFDB0B.1060802@oracle.com> On 12/7/11 2:32 AM, Mandy Chung wrote: > On 12/2/2011 5:57 AM, Frederic Parain wrote: > >> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ > L112: Since you are in this file, can you fix the typo > "java.security.SecurityException" to "java.lang.SecurityException"? Fixed. > The execute method doesn't throw any exception other than > IAE. What happens if the specified command execution fails > in the target VM? If no exception is thrown, how does the > caller detect if the command succeeds or not and handle it > gracefully? It seems that this mechanism should provide > a way to detect if a command succeeds or fails programmatically > rather than burying the error message in the returned string. This changeset contains the framework, and the framework only throws NPE or IAE. However, a diagnostic command impementation is free to throw any other exception. If such an exception is thrown, it is simply printed on the output stream if the command has been invoked through the attachAPI, or it is propagated like any other exception through JMX if the command has been invoked from the HotSpotDiagnosticMXBean. > HotSpotDiagnostic.java > L45-49: jvm is not used and can be removed. Removed. > L133: do you need to check if command == null and throw NPE? > or NPE will be thrown somewhere? The native code is protected against null commands, it will throw the NPE. > L159: NPE should be thrown instead of IAE, right? Unless > the javadoc for the execute method is modified to reflect that. Fixed. > L176: minor: I wonder if it's any simpler for this native method > to take the DiagnosticCommandInfo[] argument (i.e. the caller > method does the array allocation than in the native method > implementation). It doesn't really help, because native code has allocations to performs anyway (for argument info). > ManagementFactoryHelper.java > L270: The new parameter "jvm" doesn't seem to be needed. Fixed. > jmm.h > L316-326: the parameters should be lined up with the first one. > L316-317 was aligned improperly and it's good to fix them > in this batch. Fixed > HotSpotDiagnostic.c > L44, 51, 76-85: indentation needs fixing. Fixed. > L158, 172: this should never happen unless the hotspot/jdk is > mismatched. But would it better to throw an exception with > an informative message to help diagnostic in case the mismatch > does happen? If a mismatch is detected, the implementation now throws an UnsupportedOperationException("Diagnostic commands are not supported by this VM"). > jcmd.1 (man page) > Should PerfCounter.print be listed in the man page? Or > treat it like other diagnostic commands that are > implementation-dependent? PerfCounter is a built-in command, it doesn't appear in the list of commands returned by the 'help' command. This is why it is documented in the jcmd man page. I'll upload new webrevs tomorrow morning. Thanks, Fred -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at oracle.com From stuart.marks at oracle.com Wed Dec 7 21:47:48 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Wed, 07 Dec 2011 21:47:48 +0000 Subject: hg: jdk8/tl/jdk: 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip Message-ID: <20111207214805.430C647632@hg.openjdk.java.net> Changeset: 4f0f9f9c4892 Author: smarks Date: 2011-12-07 12:12 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4f0f9f9c4892 7117249: fix warnings in java.util.jar, .logging, .prefs, .zip Reviewed-by: alanb, dholmes, forax, sherman, smarks Contributed-by: Prasannaa , Martijn Verburg , Goerge_Albrecht , Graham Allan , Michael Barker ! src/share/classes/java/util/jar/JarFile.java ! src/share/classes/java/util/jar/Manifest.java ! src/share/classes/java/util/logging/LogManager.java ! src/share/classes/java/util/prefs/Preferences.java ! src/share/classes/java/util/prefs/XmlSupport.java ! src/share/classes/java/util/zip/ZipEntry.java From stuart.marks at oracle.com Wed Dec 7 22:01:20 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Wed, 07 Dec 2011 14:01:20 -0800 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> <4EDF3B5F.8030409@oracle.com> Message-ID: <4EDFE230.2010600@oracle.com> On 12/7/11 2:34 AM, Michael Barker wrote: >> Michael - the Contributed-by line is usually the individual's name (+ mail >> address) or a list of names (and their mail addresses). I think Stuart is >> suggesting that this would be better than "London Java Community". > > Okay, no problem: > > Contributed-by: Prasannaa, Martijn Verburg > , Goerge_Albrecht, > Graham Allan, Michael Barker > Pushed, with modified contributed-by line as suggested above, changeset 4f0f9f9c4892. Thanks to all who participated, both by developing patches and by reviewing! BTW we are now down below 9,000 warnings in the TL/jdk repo (not including warnings fixes that were pushed into the 2D forest). s'marks From mandy.chung at oracle.com Wed Dec 7 22:04:48 2011 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 07 Dec 2011 14:04:48 -0800 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EDFDB0B.1060802@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EDEC21F.4000902@oracle.com> <4EDFDB0B.1060802@oracle.com> Message-ID: <4EDFE300.2030200@oracle.com> On 12/7/2011 1:30 PM, Frederic Parain wrote: > >> The execute method doesn't throw any exception other than >> IAE. What happens if the specified command execution fails >> in the target VM? If no exception is thrown, how does the >> caller detect if the command succeeds or not and handle it >> gracefully? It seems that this mechanism should provide >> a way to detect if a command succeeds or fails programmatically >> rather than burying the error message in the returned string. > > This changeset contains the framework, and the framework > only throws NPE or IAE. However, a diagnostic command > impementation is free to throw any other exception. If such > an exception is thrown, it is simply printed on the output > stream if the command has been invoked through the attachAPI, > or it is propagated like any other exception through JMX > if the command has been invoked from the HotSpotDiagnosticMXBean. > What happens when HotSpotDiagnosticMXBean is called locally within the same process but through JMX MBeanServer? I still think you might need DiagnosticCommandException (something like that). > >> L133: do you need to check if command == null and throw NPE? >> or NPE will be thrown somewhere? > > The native code is protected against null commands, it will > throw the NPE. Ok. It's still good to add the null check to make this more explicit - you can use the java.util.Objects.requireNonNull method. > >> L158, 172: this should never happen unless the hotspot/jdk is >> mismatched. But would it better to throw an exception with >> an informative message to help diagnostic in case the mismatch >> does happen? > > If a mismatch is detected, the implementation now throws an > UnsupportedOperationException("Diagnostic commands are not supported > by this VM"). > That's better. Thanks Mandy From mandy.chung at oracle.com Wed Dec 7 22:11:19 2011 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 07 Dec 2011 14:11:19 -0800 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EDFE300.2030200@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EDEC21F.4000902@oracle.com> <4EDFDB0B.1060802@oracle.com> <4EDFE300.2030200@oracle.com> Message-ID: <4EDFE487.903@oracle.com> On 12/7/2011 2:04 PM, Mandy Chung wrote: > > On 12/7/2011 1:30 PM, Frederic Parain wrote: >> >>> The execute method doesn't throw any exception other than >>> IAE. What happens if the specified command execution fails >>> in the target VM? If no exception is thrown, how does the >>> caller detect if the command succeeds or not and handle it >>> gracefully? It seems that this mechanism should provide >>> a way to detect if a command succeeds or fails programmatically >>> rather than burying the error message in the returned string. >> >> This changeset contains the framework, and the framework >> only throws NPE or IAE. However, a diagnostic command >> impementation is free to throw any other exception. If such >> an exception is thrown, it is simply printed on the output >> stream if the command has been invoked through the attachAPI, >> or it is propagated like any other exception through JMX >> if the command has been invoked from the HotSpotDiagnosticMXBean. >> > > What happens when HotSpotDiagnosticMXBean is called locally within the > same process but through JMX MBeanServer? oops.. typo. s/but through/but not through/ the uncaught exception will cause the running JVM to crash which seems to be undesirable. Mandy From kumar.x.srinivasan at oracle.com Wed Dec 7 22:35:20 2011 From: kumar.x.srinivasan at oracle.com (kumar.x.srinivasan at oracle.com) Date: Wed, 07 Dec 2011 22:35:20 +0000 Subject: hg: jdk8/tl/langtools: 7086015: fix test/tools/javac/parser/netbeans/JavacParserTest.java Message-ID: <20111207223524.462F347633@hg.openjdk.java.net> Changeset: abfa0d8ea803 Author: ksrini Date: 2011-12-07 10:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/abfa0d8ea803 7086015: fix test/tools/javac/parser/netbeans/JavacParserTest.java Reviewed-by: ksrini, jjg Contributed-by: matherey.nunez at oracle.com ! test/tools/javac/parser/netbeans/JavacParserTest.java From omajid at redhat.com Wed Dec 7 23:13:56 2011 From: omajid at redhat.com (Omair Majid) Date: Wed, 07 Dec 2011 18:13:56 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDF4368.2010806@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> Message-ID: <4EDFF334.50301@redhat.com> On 12/07/2011 05:43 AM, Alan Bateman wrote: > On 05/12/2011 22:09, Omair Majid wrote: >> >> I have posted a new webrev: >> http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/03/ >> >> This includes all the changes from the feedback so far, as well as >> changes to ThreadLocal. >> >> I will not be posting a patch for ClassValue since (as you kindly >> pointed out), others are making changes to it and removing some >> warnings too [1]. I suppose I will revisit it later (if warning fixes >> are still being accepted :D ). > I looked through the latest webrev. In > EnumConstantNotPresentException.java then the > @SuppressWarnings("rawtypes") should probably have a comment to explain > why it is needed. In ThreadLocal.get then it's a pity that an additional > local is needed to increase the size of the method. Otherwise the > changes look okay to me. > Updated webrev at: http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/04/ Is there something I should do to address the extra local, or is it good to go? Thanks, Omair From david.holmes at oracle.com Thu Dec 8 05:13:34 2011 From: david.holmes at oracle.com (David Holmes) Date: Thu, 08 Dec 2011 15:13:34 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EDF5783.3060007@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> Message-ID: <4EE0477E.30605@oracle.com> Chris, On 7/12/2011 10:09 PM, Chris Hegarty wrote: > Thanks David and Doug, > > So we should be ready to integrate this change, right? NO, not yet! > > There is a failing regression test, java.util.Collections.EmptyIterator. > This test does a reference comparison ( '==' ) on the iterator returned > from an empty SynchronousQueue and the iterator returned by > Collections.emptyIterator(). These are no longer equal since > SynchronousQueue implements its own EmptyIterator (requires to be > buildable with 1.6). In fact, there are reference comparisons for > emptyEnumeration and emptyMap too. > > I think this is too restrictive and I don't believe any of the > collection classes are specified in such a manner. This check should > simply be removed, unless it was though to be some kind of 'best > implementation practice', in which case we could just use a different > collection type in the test. I also think the SynchronousQueue has no business being used in this test. Though I confess I'm unclear what this test is for - is it for emptyIterator() or for "iterators of empty collections" ? David ----- > > I you agree I'll file a new CR on this ( I think it may deserve its own > CR, seems out of scope of 7118066 ). Here are my initial proposed diffs: > > diff -r 97e37d3a2ae3 test/java/util/Collections/EmptyIterator.java > --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 > 2011 +0000 > +++ b/test/java/util/Collections/EmptyIterator.java Wed Dec 07 12:00:43 > 2011 +0000 > @@ -59,14 +59,12 @@ public class EmptyIterator { > } > > void testEmptyEnumeration(final Enumeration e) { > - check(e == emptyEnumeration()); > check(! e.hasMoreElements()); > THROWS(NoSuchElementException.class, > new F(){void f(){ e.nextElement(); }}); > } > > void testEmptyIterator(final Iterator it) { > - check(it == emptyIterator()); > check(! it.hasNext()); > THROWS(NoSuchElementException.class, > new F(){void f(){ it.next(); }}); > @@ -75,7 +73,6 @@ public class EmptyIterator { > } > > void testEmptyMap(Map m) { > - check(m == emptyMap()); > check(m.entrySet().iterator() == > Collections.>emptyIterator()); > check(m.values().iterator() == emptyIterator()); > @@ -110,11 +107,6 @@ public class EmptyIterator { > > void testEmptyCollection(final Collection c) { > testEmptyIterator(c.iterator()); > - > - check(c.iterator() == emptyIterator()); > - if (c instanceof List) > - check(((List)c).listIterator() == emptyListIterator()); > - > testToArray(c); > } > > > -Chris. > > > On 07/12/2011 06:04, David Holmes wrote: >> Thanks Doug and Chris. >> >> They were just nits so it is fine to proceed - thanks for changing the >> annotations though. >> >> David >> >> On 7/12/2011 11:33 AM, Doug Lea wrote: >>> Thanks for all the comments. We changed to having the >>> annotations on their own lines (even though it furthers >>> the Java tendency of gratuitously occupying too much vertical >>> space :-). Thanks to Chris for explaining why we didn't >>> incorporate some of the other suggestions. >>> >>> Also ... >>> >>>>> - you added: >>>>> * @param s the stream >>>>> for readObject, but not for writeObject. Seems unnecessary for either. >>>> >>>> Right, this is obviously not public API and does seem unnecessary. >>>> This is just >>>> a minor style/comment nit to be consistent with other j.u.c. classes. >>>> But now I >>>> see there are a few other readObject methods that are not consistent >>>> too ( as >>>> well as some writeObjects ). If it's ok we can catch these at another >>>> time? >>> >>> Yes, one of these days we should uniformly just remove them all. >>> >>> -Doug From stuart.marks at oracle.com Thu Dec 8 06:22:09 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Wed, 07 Dec 2011 22:22:09 -0800 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EDFF334.50301@redhat.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> <4EDFF334.50301@redhat.com> Message-ID: <4EE05791.2030006@oracle.com> On 12/7/11 3:13 PM, Omair Majid wrote: > On 12/07/2011 05:43 AM, Alan Bateman wrote: >> I looked through the latest webrev. In >> EnumConstantNotPresentException.java then the >> @SuppressWarnings("rawtypes") should probably have a comment to explain >> why it is needed. In ThreadLocal.get then it's a pity that an additional >> local is needed to increase the size of the method. Otherwise the >> changes look okay to me. > > Updated webrev at: > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/04/ > > Is there something I should do to address the extra local, or is it good to go? Hi Omair, Everything looks good to me. I think Alan was lamenting that adding the local variable for the sole purpose of adding the @SuppressWarnings annotation makes the method appear longer and more complex. The alternative is to put @SuppressWarnings on the entire method, which we've consistently frowned on, so I don't see the need to change anything. By the way, I've also run this changeset through our internal multi-platform build and test system, and everything works fine (with the exception of intermittent failures unrelated to this change). You have commit rights, don't you? I'd say it's OK to proceed with the push. Or, if you prefer, Alan should be online in just a couple hours, and I'm sure he can give the final go-ahead. Thanks for working on this! s'marks From Alan.Bateman at oracle.com Thu Dec 8 08:23:36 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 08 Dec 2011 08:23:36 +0000 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EE05791.2030006@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> <4EDFF334.50301@redhat.com> <4EE05791.2030006@oracle.com> Message-ID: <4EE07408.5090504@oracle.com> On 08/12/2011 06:22, Stuart Marks wrote: > > Hi Omair, > > Everything looks good to me. I think Alan was lamenting that adding > the local variable for the sole purpose of adding the > @SuppressWarnings annotation makes the method appear longer and more > complex. The alternative is to put @SuppressWarnings on the entire > method, which we've consistently frowned on, so I don't see the need > to change anything. > > By the way, I've also run this changeset through our internal > multi-platform build and test system, and everything works fine (with > the exception of intermittent failures unrelated to this change). > > You have commit rights, don't you? I'd say it's OK to proceed with the > push. Or, if you prefer, Alan should be online in just a couple hours, > and I'm sure he can give the final go-ahead. Yes, I'm okay with the latest webrev, I just lamenting about tiny increase in the method size and just concerned that it might impact inlining decisions. -Alan From fweimer at bfk.de Thu Dec 8 09:55:00 2011 From: fweimer at bfk.de (Florian Weimer) Date: Thu, 08 Dec 2011 09:55:00 +0000 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <2C2A1E0C-876C-4DC6-9812-E53E2619D272@oracle.com> (John Rose's message of "Wed, 7 Dec 2011 13:14:33 -0800 (PST)") References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> <4EDC0FFE.2080805@oracle.com> <4EDC1851.4060508@univ-mlv.fr> <4EDC2B98.6020101@oracle.com> <2C2A1E0C-876C-4DC6-9812-E53E2619D272@oracle.com> Message-ID: <821usf2xsb.fsf@mid.bfk.de> * John Rose: > But, in order to respect the "general aim" you are mentioning, I have > unhoisted one of the two words from the Class instance itself. This > will cause a minor slowdown in JSR 292 use cases. What about using ClassValue for the various caches instead? enumConstants and enumConstantDirectory seem good candidates (callers cache the value anyway or do additional work while accessing the field). -- Florian Weimer BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstra?e 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99 From chris.hegarty at oracle.com Thu Dec 8 11:33:36 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 08 Dec 2011 11:33:36 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EE0477E.30605@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> Message-ID: <4EE0A090.7000208@oracle.com> On 08/12/2011 05:13, David Holmes wrote: > .... > > I also think the SynchronousQueue has no business being used in this > test. Though I confess I'm unclear what this test is for - is it for > emptyIterator() or for "iterators of empty collections" ? Thanks David, so the proposed change is to simple remove SynchronousQueue. --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 2011 +0000 +++ b/test/java/util/Collections/EmptyIterator.java Thu Dec 08 11:28:16 2011 +0000 @@ -35,8 +35,6 @@ public class EmptyIterator { void test(String[] args) throws Throwable { testEmptyCollection(Collections.emptyList()); testEmptyCollection(Collections.emptySet()); - testEmptyCollection(new java.util.concurrent. - SynchronousQueue()); testEmptyMap(Collections.emptyMap()); Since it is trivial, I'll push it with the warning changes. -Chris. > > David > ----- > From mike.duigou at oracle.com Thu Dec 8 15:21:03 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Thu, 8 Dec 2011 07:21:03 -0800 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EE0A090.7000208@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> <4EE0A090.7000208@oracle.com> Message-ID: Was the SnychronousQueue test recently added or did something else change to cause the failure? Mike On Dec 8 2011, at 03:33 , Chris Hegarty wrote: > On 08/12/2011 05:13, David Holmes wrote: >> .... >> >> I also think the SynchronousQueue has no business being used in this >> test. Though I confess I'm unclear what this test is for - is it for >> emptyIterator() or for "iterators of empty collections" ? > > Thanks David, so the proposed change is to simple remove SynchronousQueue. > > --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 2011 +0000 > +++ b/test/java/util/Collections/EmptyIterator.java Thu Dec 08 11:28:16 2011 +0000 > @@ -35,8 +35,6 @@ public class EmptyIterator { > void test(String[] args) throws Throwable { > testEmptyCollection(Collections.emptyList()); > testEmptyCollection(Collections.emptySet()); > - testEmptyCollection(new java.util.concurrent. > - SynchronousQueue()); > > testEmptyMap(Collections.emptyMap()); > > Since it is trivial, I'll push it with the warning changes. > > -Chris. > >> >> David >> ----- >> From chris.hegarty at oracle.com Thu Dec 8 15:30:18 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 08 Dec 2011 15:30:18 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> <4EE0A090.7000208@oracle.com> Message-ID: <4EE0D80A.5000102@oracle.com> On 08/12/2011 15:21, Mike Duigou wrote: > Was the SnychronousQueue test recently added or did something else change to cause the failure? This failure has not happened yet, but is will when I push the "warning" changes for j.u.c ( with some minor impl changes ). SynchronousQueue.iterator() no longer returns Collections.emptyIterator(), it will return its own private EmptyIterator implementation. Collections.emptyIterator was added in 1.7 and we need to able to compile with 1.6. There is no spec requirement on SynchronousQueue.iterator(). I think the test just took advantage the private implementation of SynchronousQueue. -Chris. > > Mike > > On Dec 8 2011, at 03:33 , Chris Hegarty wrote: > >> On 08/12/2011 05:13, David Holmes wrote: >>> .... >>> >>> I also think the SynchronousQueue has no business being used in this >>> test. Though I confess I'm unclear what this test is for - is it for >>> emptyIterator() or for "iterators of empty collections" ? >> >> Thanks David, so the proposed change is to simple remove SynchronousQueue. >> >> --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 2011 +0000 >> +++ b/test/java/util/Collections/EmptyIterator.java Thu Dec 08 11:28:16 2011 +0000 >> @@ -35,8 +35,6 @@ public class EmptyIterator { >> void test(String[] args) throws Throwable { >> testEmptyCollection(Collections.emptyList()); >> testEmptyCollection(Collections.emptySet()); >> - testEmptyCollection(new java.util.concurrent. >> - SynchronousQueue()); >> >> testEmptyMap(Collections.emptyMap()); >> >> Since it is trivial, I'll push it with the warning changes. >> >> -Chris. >> >>> >>> David >>> ----- >>> > From omajid at redhat.com Thu Dec 8 16:25:21 2011 From: omajid at redhat.com (Omair Majid) Date: Thu, 08 Dec 2011 11:25:21 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EE05791.2030006@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> <4EDFF334.50301@redhat.com> <4EE05791.2030006@oracle.com> Message-ID: <4EE0E4F1.5040401@redhat.com> On 12/08/2011 01:22 AM, Stuart Marks wrote: > On 12/7/11 3:13 PM, Omair Majid wrote: >> On 12/07/2011 05:43 AM, Alan Bateman wrote: >>> I looked through the latest webrev. In >>> EnumConstantNotPresentException.java then the >>> @SuppressWarnings("rawtypes") should probably have a comment to explain >>> why it is needed. In ThreadLocal.get then it's a pity that an additional >>> local is needed to increase the size of the method. Otherwise the >>> changes look okay to me. >> >> Updated webrev at: >> http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/04/ >> >> Is there something I should do to address the extra local, or is it >> good to go? > > Hi Omair, > > Everything looks good to me. I think Alan was lamenting that adding the > local variable for the sole purpose of adding the @SuppressWarnings > annotation makes the method appear longer and more complex. The > alternative is to put @SuppressWarnings on the entire method, which > we've consistently frowned on, so I don't see the need to change anything. > Thanks for the clarification. Since this is the JDK code, I wasnt sure if this is something that might lead to a problem. > By the way, I've also run this changeset through our internal > multi-platform build and test system, and everything works fine (with > the exception of intermittent failures unrelated to this change). > That's great to know. I feel a little more confident about this changeset now. > You have commit rights, don't you? I'd say it's OK to proceed with the > push. Or, if you prefer, Alan should be online in just a couple hours, > and I'm sure he can give the final go-ahead. > Yes, I do have commit rights and I would be more than happy to push the changeset. One quick question, if you dont mind. Does this comment look fine? 7117612: Miscellaneous warnings in java.lang Reviewed-by: smarks, dholmes, alanb Shall I add Joe Darcy to the list of reviewers too? He did make a comment on AutoClosable, but I am not sure if he was a 'reviewer'. > Thanks for working on this! > Glad I could help out. Cheers, Omair From stuart.marks at oracle.com Thu Dec 8 18:25:14 2011 From: stuart.marks at oracle.com (Stuart Marks) Date: Thu, 08 Dec 2011 10:25:14 -0800 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EE0E4F1.5040401@redhat.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> <4EDFF334.50301@redhat.com> <4EE05791.2030006@oracle.com> <4EE0E4F1.5040401@redhat.com> Message-ID: <4EE1010A.50300@oracle.com> On 12/8/11 8:25 AM, Omair Majid wrote: >> On 12/7/11 3:13 PM, Omair Majid wrote: >> You have commit rights, don't you? I'd say it's OK to proceed with the >> push. Or, if you prefer, Alan should be online in just a couple hours, >> and I'm sure he can give the final go-ahead. > > Yes, I do have commit rights and I would be more than happy to push the > changeset. One quick question, if you dont mind. Does this comment look fine? > > 7117612: Miscellaneous warnings in java.lang > Reviewed-by: smarks, dholmes, alanb > > Shall I add Joe Darcy to the list of reviewers too? He did make a comment on > AutoClosable, but I am not sure if he was a 'reviewer'. Comment looks fine overall. I don't know if there are any hard-and-fast rules about what constitues a reviewer. My style is to be fairly inclusive. Joe's comment made a significant point about a specific issue, so I'd include him (darcy) on the Reviewed-by: line. (BTW I need to follow up on this issue with the compiler team, and possibly file a bug on it.) Thanks. s'marks From paul.hohensee at oracle.com Thu Dec 8 18:26:01 2011 From: paul.hohensee at oracle.com (Paul Hohensee) Date: Thu, 08 Dec 2011 13:26:01 -0500 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4ED8D93A.5050600@oracle.com> References: <4ED8D93A.5050600@oracle.com> Message-ID: <4EE10139.8020905@oracle.com> For the hotspot part at http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ Most of my comments are style-related. Nice job on the implementation architecture. In attachListener.cpp: You might want to delete the first "return JNI_OK;" line, since the code under HAS_PENDING_EXCEPTION just falls through. In jmm.h: Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the existing declarations. Add a newline just before it on line 322. In diagnosticFramework.hpp: Fix indenting for lines 63-66, insert blank before "size_t" on line 48. Hotspot convention is that getter method names don't include a "get_" prefix. So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). Similarly, getters such as is_enabled() should retrieve a field named "_is_enabled" rather than one named "enabled". You follow the "_is_enabled" convention in other places such as GenDCmdArgument. Or you could use enabled() to get the value of the _enabled field. Also generally, I'd use accessor methods in the implementation of more complex member methods rather than access the underlying fields directly. E.g. in GenDCmdArgument::read_value, I'd use is_set() and set_is_set(true), (set_is_set() is not actually defined, but should be) rather than directly accessing _is_set. Though sometimes doing this is too much of a pain with fields whose type is a template argument, as in the DCmdArggument::parse_value() method in diagnosticArgument.cpp. For easy readability, it'd be nice to line up field names (the ones with an _ prefix) at the same column. On line 200, "instanciated" -> "instantiated" On line 218, I'd use "heap_allocated" rather than "heap" for the formal arg name. On line 248, you could indent the text to start underneath "outputStream". I generally find that indenting arguments lines (formal or actual) so they line up with the first argument position make the code more readable, but I'm not religious about it. On line 265, "instanciated" -> "instantiated" DCmdFactorys are members of a singly-linked list, right? If so, it'd be good to have a comment to that effect on the declaration of _next. On line 322, insert a blank before "true". You might fix this in other places where there's no blank between a comma in an argument list and the following parameter value. In diagnosticCommandFramework.cpp: The code from lines 80-95 and 105-120 is identical. Factor out? In diagnosticArgument.cpp: On line 41, insert blanks before the actual arguments. (see above generic comment) On line 77, the "if" is indented one space too many. In management.cpp: I'd be consistent with having or not having a space between "while", "if" and "for" and the following "(" in this and your other code. Most hotspot code has a space. Thanks, Paul On 12/2/11 8:57 AM, Frederic Parain wrote: > Hi All, > > [Posting to serviceability-dev, runtime-dev and core-libs-dev > because changes are pretty big and touch all these areas] > > Here's a framework for issuing diagnostics commands to the JVM. > Diagnostic commands are actions executed inside the JVM mainly > for monitoring or management purpose. This work has two parts. > The first part is in the hotspot repository and contains the > framework itself with two diagnostic commands. The second > part is in the JDK repository and contains the command line > utility to invoke diagnostic commands as well as the > HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean > extensions allow a remote client to discover and invoke > diagnostic commands using a JMX connection. > > This changeset only contains two diagnostic commands, more > commands will be added in the future, as a standalone effort > to improve the monitoring and management services of the > JVM, or as part of other projects. > > Webrevs are here: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ > > Here's a technical description of this work: > > 1 - The Diagnostic Command Framework > 1-1 Overview > > The diagnostic command framework is fully implemented in native code > and relies on the HotSpot's internal exception mechanism. > The rational of a pure native implementation is to be able to execute > diagnostic commands even in critical situations like an OutOfMemory > error. All diagnostic commands are registered in a single list, and two > flags control the way a user can interact with them. The "hidden" flag > prevents a diagnostic command from appearing in the list of available > commands returned by the "help" command. However, it's still possible to > get the detailed help message for a hidden command with the "help > " syntax (but it requires to know the name of the hidden > command). The second flag is "enabled" and it controls if a command can > be invoked or not. When listed with the "help" commands, disabled > commands appear with a "[disabled]" label in their description. If the > user tries to invoke a disabled command, an error message is returned > and the command is not run. This error message can be customized on a > per command base. The framework just provides these two flags with their > semantic, it doesn't provide any policy or mechanism to set or modify > these flags. These actions will be delegated to the JVM or special > diagnostic commands. > > 1-2 Implementation > > All diagnostic commands are implemented as subclasses of the DCmd class > defined in services/diagnosticFramework.hpp. Here's the layout of the > DCmd class and the list of methods that a new command has to define or > overwrite: > > class DCmd { > DCmd(outputStream *output); > > static const char *get_name(); > > static const char *get_description(); > > static const char *get_disabled_message(); > > static const char *get_impact(); > > static int get_num_arguments(); > > virtual void print_help(outputStream* out); > > virtual void parse(CmdLine* line, char delim, TRAPS); > > virtual void execute(TRAPS); > > virtual void reset(TRAPS); > > virtual void cleanup(); > > virtual GrowableArray* get_argument_name_array(); > > virtual GrowableArray* get_argument_info_array(); > } > > A diagnostic command is always instantiated with an outputStream in > parameter. This outputStream can point either to a file, a buffer or a > socket (see the ostream.hpp file). > > The get_name() method returns the string that will identify the command > (i.e. the string to put on the command line to invoke it). > > The get_description() methods returns the global description of the > command. > > The get_disabled_message() returns the customized message to return when > the command is disabled, without having to instantiate the command. > > The get_impact() returns a description of the intrusiveness of the > diagnostic command on the Java Virtual Machine behavior. The rational > for this method is that some diagnostic commands can seriously disrupt > the behavior of the Java Virtual Machine (for instance a Thread Dump for > an application with several tens of thousands of threads, or a Head Dump > with a 40GB+ heap size) and other diagnostic commands have no serious > impact on the JVM (for instance, getting the command line arguments or > the JVM version). The recommended format for the description is level>: [longer description], where the impact level is selected among > this list: {low, medium, high}. The optional longer description can > provide more specific details like the fact that Thread Dump impact > depends on the heap size. > > The get_num_arguments() returns the number of options/arguments > recognized by the diagnostic command. This method is only used by the > JMX interface support (see below). > > The print_help() methods prints a detailed help on the outputStream > passed in argument. The detailed help contains the list of all supported > options with their type and description. > > The parse() method is in charge of parsing the command arguments. Each > command is free to implement its own argument parser. However, an > argument parser framework is provided (see section 1-3) to ease the > implementation, but its use is optional. The parse method takes a > delimiter character in argument, which is used to mark the limit between > two arguments (typically invocation from jcmd will use a space character > as a delimiter while invocation from the JVM command line parsing code > will use a comma as a delimiter). > > The execute() method is naturally the one to invoke to get the > diagnostic command executed. The parse() and the execute() methods are > dissociated, so it's a possible perform the argument parsing in one > thread, and delegate the execution to another thread, as long as the > diagnostic command doesn't reference thread local variables. The > framework allows several instances of the same diagnostic command to be > executed in parallel. If for some reasons concurrent executions should > not be allowed for a given diagnostic command, this is the > responsibility of the diagnostic command implementor to enforce this > rule, for instance by protecting the body of the execute() method with a > global lock. > > The reset() method is used to initialize the internal fields of the > diagnostic command or to reset the internal fields to their initial > value to be able to re-use an already allocated diagnostic command > instance. > > The cleanup() method is used to perform perform cleanup (like freeing of > all memory allocated to store internal data). The DCmd extends the > ResourceObj class, so when allocated in a ResourceArea, destructors > cannot be used to perform cleanup. To ensure that cleanup is performed > in all cases, it is recommended to create a DCmdMark instance for each > DCmd instance. DCmdMark is a stack allocated object with a pointer to a > DCmd instance. When the DCmdMark is destroyed, its destructor calls the > cleanup() method of the DCmd instance it points to. If the DCmd instance > has been allocated on the C-Heap, the DCmdMark will also free the memory > allocated to store the DCmd instance. > > The get_argument_name_array() and get_argument_info_array() are related > to the JMX interface of the diagnostic command framework, so they are > described in section 3. > > 1-3 DCmdParser framework > > The DCmdParser class is an optional framework to help development of > argument parsers. It provides many features required by the diagnostic > command framework (generation of the help message or the argument > descriptions for the JMX interface) but all these features can easily be > re-implemented if a developer decides not to use the DCmdParser > framework. > > The DCmdParser class is relying on the DCmdArgument template. This > template must be used to define the different types of argument the > parser will have to handle. When a new specialization of the template is > done, three methods have to be provided: > > void parse_value(const char *str,size_t len,TRAPS); > void init_value(TRAPS); > void destroy_value(); > > The parse_value() method is used to convert a string into an argument > value. The print_value() method is used to display the default value > (support for the detailed help message). The init_value() method is used > to initialize or reset the argument value. The destroy_value() method is > a clean-up method (useful when the argument has allocated some C-Heap > memory to store its value and this memory has to be freed before > destroying the DCmdArgument instance). > > The DCmdParser makes a distinction between options and arguments. > Options are identified by a key name that must appear on the command > line, while argument are identified just by the position of the argument > on the command line. Options use the = syntax. In case of > boolean options, the '=' part of the syntax can be omitted to set > the option to true. Arguments are just sequences characters delimited by > a separator character. This separator can be specified at runtime when > invoking the diagnostic command framework. If an argument contain a > character that could be used as a delimiter, it's possible to enclose > the argument between single or double quotes. Options are arguments are > instantiated using the same DCmdArgument class but they're registered > differently to the DCmdParser. > > The way to use the DCmdParser is to declare the parser and the > option/arguments as fields of the diagnostic command class (which is > itself a sub-class of the DCmd class), like this: > > > class EchoDCmd : public DCmd { > protected: > DCmdParser _dcmdparser; > > DCmdArgument _required; > > DCmdArgument _intval; > > DCmdArgument _boolval; > > DCmdArgument _stringval; > > DCmdArgument _first_arg; > > DCmdArgument _second_arg; > > DCmdArgument _optional_arg; > > } > > The parser and the options/arguments must be initialized before the > diagnostic command class, and the options/arguments have to be > registered to the parser like this: > > EchoDCmd(outputStream *output) : DCmd(output), > _stringval("-strval","a string argument","STRING",false), > > _boolval("-boolval","a boolean argument","BOOLEAN",false), > > _intval("-intval","an integer argument","INTEGER",false), > > _required("-req","a mandatory integer argument","INTEGER",true), > > _fist_arg("first argument","a string argument","STRING",true), > > _second_arg("second argument,"an integer argument,"INTEGER",true), > > _optional_arg("optional argument","an optional string > argument","STRING","false") > > { > > _dcmdparser.add_dcmd_option(&_stringval) > > _dcmdparser.add_dcmd_option(&_boolval); > > _dcmdparser.add_dcmd_option(&_intval); > > _dcmdparser.add_dcmd_option(&_required); > > _dcmdparser.add_argument(&_first_arg); > > _dcmdparser.add_argument(&_second_arg); > > _dcmdparser.add_argument(&_optional_arg); > }; > > The add_dcmd_argument()/ add_dcmd_option() method is used to add an > argument/option to the parser. The option/argument constructor takes the > name of the option/argument, its description, a string describing its > type and a boolean to specify if the option/argument is mandatory or > not. The parser doesn't support option/argument duplicates (having the > same name) but the code currently doesn't check for duplicates.The order > used to register options has no impact on the parser. However, the order > used to register arguments is critical because the parser will use the > same order to parse the command line. In the example above, the parser > expects to have a first argument of type STRING (parsed using > _first_arg), then a second argument of type INTEGER (parsed using > _second_arg) and optionally a third parameter of type STRING (parsed > using _optional_arg). A mandatory option or argument has to be specify > every time the command is invoked. If it is missing, an exception is > thrown at the end of the parsing. Optional arguments have to be > registered after mandatory arguments. An optional argument will be > considered for parsing only if all arguments before it (mandatory or > not) have already been used to parse the command line. > > The DCmdParser and its DCmdArgument instances are embedded in the DCmd > instance. The rational for this design is to limit the number of C-heap > allocations but also to be able to pre-allocate diagnostic command > instances for critical situations. If the process is running out of > C-heap space, it's not possible to instantiate new diagnostic commands > to troubleshoot the situation. By pre-allocating some diagnostic > commands, it will be possible to run them even in this critical > situation. Of course, the diagnostic command itself should not try to > allocate memory during its execution, this prevents the diagnostic > command to use variable length arguments like strings. By nature, > pre-allocated diagnostic commands aim to be re-usable, this is the > purpose of the reset() method which restores the default status of all > arguments. > > 1-4 Internal invocation > > Using a diagnostic command from the JVM itself is pretty easy: > instantiate the class and invoke the parse() method then the execute() > method. A diagnostic command can be instantiated from inside the JVM > even it is not registered. This is a difference with the external > invocations (from jcmd or JMX) that require the command to be registered. > > 2 - The JCmd interface > > Diagnostic commands can also be invoked from outside the JVM process, > using the new 'jcmd' utility. The jcmd program uses the attach API > to connect to the JVM, send requests and receive results. The > jcmd utility must be launched on the same machine than the one running > the JVM (its a local tool). Launched without arguments, jcmd displays a > list of all JVMs running on the machine. The jcmd source code is in > the jdk repository like other existing j* tools. > > To execute a diagnostic command in a particular JVM, the generic > syntax is: > > jcmd [arguments] > > The attachListener has been modified to recognized the jcmd requests. > When a jcmd request is identified, it is parsed to extract the command > name. The JVM performs a look up of this command in a list of registered > commands. To be executable by an external request, a diagnostic command > has to be registered. The registration is performed with the DCmdFactory > class (see services/management.cpp). > > 3 - The JMX interface > > The framework provides a JMX based interface to the diagnostic commands. > This interface allows remote invocation of diagnostic commands through a > JMX connection. > > 3-1 The interface > > The information related to the diagnostic commands are accessible > through new methods added to the > com.sun.management.HotspotDiagnosticMXBean: > > public List getDiagnosticCommands(); > > public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); > > public List getDiagnosticCommandInfo(List > command); > > public List getDiagnosticCommandInfo(); > > public String execute(String commandLine) throws > IllegalArgumentException ; > > public String execute(String cmd, String... arguments) > throws IllegalArgumentException; > > > The getDiagnosticCommands() method returns an array containing the names > of the not-hidden registered diagnostic commands. > > The three getDiagnosticCommandInfo() methods return one or several > diagnostic command descriptions using the DiagnosticCommandInfo class. > > The two execute() methods allow the user the invoke a diagnostic command > in different ways. > > The DiagnosticCommandInfo class is describing a diagnostic command with > the following information: > > public class DiagnosticCommandInfo { > > public String getName(); > > public String getDescription(); > > public String getImpact(); > > public boolean isEnabled(); > > public List getArgumentsInfo(); > } > > The getName() method returns the name of the diagnostic command. This > name is the one to use in execute() methods to invoke the diagnostic > command. > > The getDescription() method returns a general description of the > diagnostic command. > > The getImpact() method returns a description of the intrusiveness of > diagnostic command. > > The isEnabled() method returns true if the method is enabled, false if > it is disabled. A disabled method cannot be executed. > > The getArgumentsInfo() returns a list of descriptions for the options or > arguments recognized by the diagnostic command. Each option/argument is > described by a DiagnosticCommandArgumentInfo instance: > > public class DiagnosticCommandArgumentInfo { > > public String getName(); > > public String getDescription(); > > public String getType(); > > public String getDefault(); > > public boolean isMandatory(); > > public boolean isOption(); > > public int getPosition(); > } > > If the DiagnosticCommandArgumentInfo instance describes an option, > isOption() returns true and getPosition() returns -1. Otherwise, when > the DiagnosticCommandArgumentInfo instance describes an argument, > isOption() returns false and getPosition() returns the expected position > for this argument. The position of an argument is defined relatively to > all arguments passed on the command line, options are not considered > when defining an argument position. The getDefault() method returns the > default value of the argument if a default has been defined, otherwise > it returns null. > > 3-2 The implementation > > The framework has been designed in a way that prevents diagnostic > command developers to worry about the JMX interface. In addition to > the methods described in section 1-2, a diagnostic command developer has > to provide three methods: > > int get_num_arguments() > > which returns the number of option and arguments supported by the > command. > > GrowableArray* get_argument_name_array() > > which provides the name of the arguments supported by the command. > > GrowableyArray* get_argument_info_array() > > which provides the description of each argument with a DCmdArgumentInfo > instance. DCmdArgumentInfo is a C++ class used by the framework to > generate the sun.com.management.DcmdArgumentInfo instances. This is done > automatically and the diagnostic command developer doesn't need to know > how to create Java objects from the runtime. > > 4 - The Diagnostic Commands > > To avoid name collisions between diagnostic commands coming from > different projects, use of a flat name space should be avoided and > a more structured organization is recommended. The framework itself > doesn't depend on this organization, so it will be a set of rules > defining a convention in the way commands are named. > > Diagnostic commands can easily organized in a hierarchical way, so the > template for a command name can be: > > .[sub-domain.] > > This template can be extended with sub-sub-domains and so on. > > A special set of commands without domain will be reserved for the > commands related to the diagnostic framework itself, like the "help" > command. > > > Thanks, > > Fred > From omajid at redhat.com Thu Dec 8 18:51:39 2011 From: omajid at redhat.com (omajid at redhat.com) Date: Thu, 08 Dec 2011 18:51:39 +0000 Subject: hg: jdk8/tl/jdk: 7117612: Miscellaneous warnings in java.lang Message-ID: <20111208185204.5AA4247640@hg.openjdk.java.net> Changeset: f8897baf40ea Author: omajid Date: 2011-12-08 13:48 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f8897baf40ea 7117612: Miscellaneous warnings in java.lang Reviewed-by: smarks, dholmes, alanb, darcy ! src/share/classes/java/lang/Boolean.java ! src/share/classes/java/lang/Byte.java ! src/share/classes/java/lang/Character.java ! src/share/classes/java/lang/CharacterName.java ! src/share/classes/java/lang/Class.java ! src/share/classes/java/lang/ClassLoader.java ! src/share/classes/java/lang/ConditionalSpecialCasing.java ! src/share/classes/java/lang/Double.java ! src/share/classes/java/lang/EnumConstantNotPresentException.java ! src/share/classes/java/lang/Float.java ! src/share/classes/java/lang/Integer.java ! src/share/classes/java/lang/Long.java ! src/share/classes/java/lang/Short.java ! src/share/classes/java/lang/System.java ! src/share/classes/java/lang/ThreadLocal.java ! src/share/classes/java/lang/Void.java ! src/solaris/classes/java/lang/ProcessEnvironment.java ! src/windows/classes/java/lang/ProcessEnvironment.java From omajid at redhat.com Thu Dec 8 18:54:39 2011 From: omajid at redhat.com (Omair Majid) Date: Thu, 08 Dec 2011 13:54:39 -0500 Subject: please review 7117612: warnings fixes in java.lang In-Reply-To: <4EE1010A.50300@oracle.com> References: <4EDC1836.7070106@oracle.com> <4EDD4110.2020004@redhat.com> <4EDF4368.2010806@oracle.com> <4EDFF334.50301@redhat.com> <4EE05791.2030006@oracle.com> <4EE0E4F1.5040401@redhat.com> <4EE1010A.50300@oracle.com> Message-ID: <4EE107EF.4000203@redhat.com> On 12/08/2011 01:25 PM, Stuart Marks wrote: > On 12/8/11 8:25 AM, Omair Majid wrote: >>> On 12/7/11 3:13 PM, Omair Majid wrote: >>> You have commit rights, don't you? I'd say it's OK to proceed with the >>> push. Or, if you prefer, Alan should be online in just a couple hours, >>> and I'm sure he can give the final go-ahead. >> >> Yes, I do have commit rights and I would be more than happy to push the >> changeset. One quick question, if you dont mind. Does this comment >> look fine? >> >> 7117612: Miscellaneous warnings in java.lang >> Reviewed-by: smarks, dholmes, alanb >> >> Shall I add Joe Darcy to the list of reviewers too? He did make a >> comment on >> AutoClosable, but I am not sure if he was a 'reviewer'. > > Comment looks fine overall. > > I don't know if there are any hard-and-fast rules about what constitues > a reviewer. My style is to be fairly inclusive. Joe's comment made a > significant point about a specific issue, so I'd include him (darcy) on > the Reviewed-by: line. (BTW I need to follow up on this issue with the > compiler team, and possibly file a bug on it.) > Thank you very much for all your help. I have pushed the changeset: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f8897baf40ea Thanks, Omair From john.r.rose at oracle.com Thu Dec 8 19:57:17 2011 From: john.r.rose at oracle.com (John Rose) Date: Thu, 8 Dec 2011 11:57:17 -0800 Subject: review request (L): 7030453: JSR 292 ClassValue.get method is too slow In-Reply-To: <821usf2xsb.fsf@mid.bfk.de> References: <5AF69B9B-D7A9-47B0-8452-06308D824D70@oracle.com> <1A25D30F-204C-4CEE-95A1-F6FDB7925B7D@oracle.com> <4EDBCC2F.7030907@oracle.com> <4EDBF093.1000801@univ-mlv.fr> <4EDC0FFE.2080805@oracle.com> <4EDC1851.4060508@univ-mlv.fr> <4EDC2B98.6020101@oracle.com> <2C2A1E0C-876C-4DC6-9812-E53E2619D272@oracle.com> <821usf2xsb.fsf@mid.bfk.de> Message-ID: On Dec 8, 2011, at 1:55 AM, Florian Weimer wrote: > * John Rose: > >> But, in order to respect the "general aim" you are mentioning, I have >> unhoisted one of the two words from the Class instance itself. This >> will cause a minor slowdown in JSR 292 use cases. > > What about using ClassValue for the various caches instead? > enumConstants and enumConstantDirectory seem good candidates (callers > cache the value anyway or do additional work while accessing the field). That's a fine idea, Florian, especially when we are counting every word of fixed overhead. (The alternative is keeping one root pointer in Class for the whole block of caches.) Even the reflective caches are candidates for ClassValue treatment, since only a minority of classes are subjected to reflective operations. ClassValue is good for any set of values associated sparsely with classes, as long as the query does not happen in a very tight loop. The trade-off is whether to add another 4-5 cache line touches per use to buy the extra compactness. To compare queries: Class cls = ...; Object val1 = cls.cache1; if (val1 != null) ... // fill cache test1(val1); load $t1, [$cls + #Class::cache1] test $t1 jump,zero Lfillcache call test1($t1) ClassValue cval = ... Object val2 = cval.get(cls); test2(val2); load $t1, [$cls + #Class::classValueMap] load $t2array, [$t1 + #ClassValueMap::cacheArray] & implicit { test $t1; jump,zero Lfillcache } // via trap handler load $t3, [$t2array + #Object[]::length] sub $t3, 1 jump,negative Lfatal // never taken; software invariant load $t4a, [$cval + #ClassValue::hashCodeForCache] load $t4b, [$cval + #ClassValue::version] and $t4a, $t3 load $t5entry, [$t2array + $t4a*wordSize + #Object[]::base] load $t6a, [$t5entry + #Entry::value] load $t6b, [$t5entry + #Entry::version] cmp $t6b, $t5b jump,notEqual Lfillcache call test2($t6a) The pointer dependencies for cache references are: ClassValue -> t4:{hashCodeForCache,version} Class -> t1:ClassValueMap -> t2:cacheArray -> ( t3:length, t5:Entry -> t6:{value,version} ) The bracketed items are likely to be on a single cache line, so there are six cache references. For a constant ClassValue, the t4 references can (in principle) be hoisted as constants into the code. And the first indirection ($t1) could be removed by hoisting the cache array back into Class. All this reminds me... Somebody should experiment with re-implementing reflection and proxy creation on top of method handles. It would let us cut out a bunch of old code (both C++ and Java), and standardize on a single high-leverage mechanism for runtime method composition. (Look in the current JDK core where bytecode spinning is happening... Those places are all candidates for refactoring with method handles.) We are working on tuning up method handle invocation performance (e.g., 7023639). When method handles are robustly performant, we will have the attractive option of refactoring older APIs on top of MHs. It's not too early to start experimenting with a POC for this. It would be a nice big open-source project. Any takers? -- John From stuart.marks at oracle.com Thu Dec 8 23:12:17 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Thu, 08 Dec 2011 23:12:17 +0000 Subject: hg: jdk8/tl/jdk: 7118546: fix warnings in javax.xml.crypto, javax.script Message-ID: <20111208231227.3940447644@hg.openjdk.java.net> Changeset: 9bb7c3b97384 Author: smarks Date: 2011-12-08 14:57 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/9bb7c3b97384 7118546: fix warnings in javax.xml.crypto, javax.script Reviewed-by: mullan ! src/share/classes/javax/script/ScriptException.java ! src/share/classes/javax/xml/crypto/NodeSetData.java ! src/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java ! src/share/classes/javax/xml/crypto/dsig/Manifest.java ! src/share/classes/javax/xml/crypto/dsig/Reference.java ! src/share/classes/javax/xml/crypto/dsig/SignatureProperties.java ! src/share/classes/javax/xml/crypto/dsig/SignatureProperty.java ! src/share/classes/javax/xml/crypto/dsig/SignedInfo.java ! src/share/classes/javax/xml/crypto/dsig/TransformService.java ! src/share/classes/javax/xml/crypto/dsig/XMLObject.java ! src/share/classes/javax/xml/crypto/dsig/XMLSignature.java ! src/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java ! src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java ! src/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java ! src/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java ! src/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java ! src/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java ! src/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java ! src/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java ! src/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java ! src/share/classes/javax/xml/crypto/dsig/spec/XPathType.java From forax at univ-mlv.fr Fri Dec 9 00:01:48 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Fri, 09 Dec 2011 01:01:48 +0100 Subject: java.util patch for Warning Cleanup Day In-Reply-To: References: <4EDA17FD.6060505@univ-mlv.fr> <4EDA331E.6040800@oracle.com> <4EDA3C5C.6070404@univ-mlv.fr> Message-ID: <4EE14FEC.5010004@univ-mlv.fr> On 12/06/2011 10:29 PM, Mike Duigou wrote: > I have reviewed this patch and also run it against the java/util jtreg test. It looks good to me. > > Some comments: > > Currency.java: > - The current mercurial source has one of your changes but the remaining two changes, diamond and @SW are still valid. > > ResourceBundle: > - This file also has changes in the current mercurial source. Your version, IMO, is an improvement over the mercurial version and should be applied. > > HashMap: > -The changes to use wildcard instead of the type parameters are a bit disappointing but reasonable. There is no good solution. At least this one is coherent for the whole file (and LinkedHashMap) and avoid warnings in equals, remove etc. > > TreeSet: > - The change to readObject() (using a single constructor) is theoretically outside of the scope of "warnings only" but I am OK with it. I forget to mention that change. I found it was weird to have a nullcheck to call a constructor that accepts null. > > Mike R?mi From david.holmes at oracle.com Fri Dec 9 04:16:42 2011 From: david.holmes at oracle.com (David Holmes) Date: Fri, 09 Dec 2011 14:16:42 +1000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EE0A090.7000208@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> <4EE0A090.7000208@oracle.com> Message-ID: <4EE18BAA.5080902@oracle.com> On 8/12/2011 9:33 PM, Chris Hegarty wrote: > On 08/12/2011 05:13, David Holmes wrote: >> .... >> >> I also think the SynchronousQueue has no business being used in this >> test. Though I confess I'm unclear what this test is for - is it for >> emptyIterator() or for "iterators of empty collections" ? > > Thanks David, so the proposed change is to simple remove SynchronousQueue. Well I think your change is also valid: the test is assuming uses of the emptyIterator() that simply are not spec'd to exist. Maybe we still need something that tests SynchronousQueue to verify its iterator is indeed empty. David ----- > --- a/test/java/util/Collections/EmptyIterator.java Wed Dec 07 10:17:34 > 2011 +0000 > +++ b/test/java/util/Collections/EmptyIterator.java Thu Dec 08 11:28:16 > 2011 +0000 > @@ -35,8 +35,6 @@ public class EmptyIterator { > void test(String[] args) throws Throwable { > testEmptyCollection(Collections.emptyList()); > testEmptyCollection(Collections.emptySet()); > - testEmptyCollection(new java.util.concurrent. > - SynchronousQueue()); > > testEmptyMap(Collections.emptyMap()); > > Since it is trivial, I'll push it with the warning changes. > > -Chris. > >> >> David >> ----- >> From zhouyx at linux.vnet.ibm.com Fri Dec 9 07:00:08 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Fri, 9 Dec 2011 15:00:08 +0800 Subject: Try to make OSInfo class recognize AIX platform Message-ID: Hi all, I reported a bug(rrf) to request that OSInfo class recognizes AIX platform. As we know there are more platforms supporting java than platforms supported by openjdk. So I think OSInfo can add the feature to recognize these platforms. This patch uses AIX as an example. The bug link is: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7119285 And the patch link is: http://cr.openjdk.java.net/~zhouyx/7119285/webrev.00/ There was a previous discussion related[1], and I think it would be better to break the patch up. Would anyone have a look ? [1] previous discussion links http://mail.openjdk.java.net/pipermail/swing-dev/2011-October/001795.html http://mail.openjdk.java.net/pipermail/swing-dev/2011-November/001847.html -- Best Regards, Sean Chou From zhouyx at linux.vnet.ibm.com Fri Dec 9 07:46:58 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Fri, 9 Dec 2011 15:46:58 +0800 Subject: Add Look&Feel support for AIX platform In-Reply-To: References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> Message-ID: I split the patch as it would be better to divide the platform recognizing in OSInfo class and the system laf returned by UIManager. I sent the OSInfo part into core-libs-dev list. Here is the link: http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008638.html On Tue, Dec 6, 2011 at 11:14 AM, Sean Chou wrote: > Hi, > > I'm not sure what to do for it next, shall I create a bug for it now ? > But I > don't think the bug system support AIX platform. I remembered it would > report something like "we are not supporting the platform". > > > On Tue, Nov 29, 2011 at 10:05 AM, neugens.limasoftware at gmail.com < > neugens.limasoftware at gmail.com> wrote: > >> The change looks good to me as well. >> >> Cheers, >> Mario >> >> Inviato da HTC >> >> >> ----- Reply message ----- >> Da: "Deven" >> Data: mar, nov 29, 2011 02:55 >> Oggetto: Add Look&Feel support for AIX platform >> A: "Neil Richards" >> Cc: "Java Core Libs" , < >> swing-dev at openjdk.java.net>, >> >> >> On 10/20/2011 11:10 PM, Neil Richards wrote: >> > On Tue, 2011-10-18 at 15:53 +0800, Sean Chou wrote: >> >> Hi all, >> >> >> >> >> >> This is a simple patch to add LookAndFeel support for AIX platform >> >> to help bring >> >> up GUI application. >> >> >> >> >> >> This is part of the series of AIX patches. >> >> -- >> >> Best Regards, >> >> Sean Chou >> >> >> >> >> > For ease of review, I've uploaded this suggested fix as a webrev [1]. >> > >> > The change looks good to me. >> > >> > Regards, Neil >> > >> > [1] http://cr.openjdk.java.net/~ngmr/ojdk-167/webrev.00/index.html >> Hello, any more comments on this topic? >> >> >> >> > > > -- > Best Regards, > Sean Chou > > -- Best Regards, Sean Chou From dl at cs.oswego.edu Fri Dec 9 11:05:37 2011 From: dl at cs.oswego.edu (Doug Lea) Date: Fri, 09 Dec 2011 06:05:37 -0500 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EE18BAA.5080902@oracle.com> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> <4EE0A090.7000208@oracle.com> <4EE18BAA.5080902@oracle.com> Message-ID: <4EE1EB81.5010809@cs.oswego.edu> On 12/08/11 23:16, David Holmes wrote: > > Maybe we still need something that tests SynchronousQueue to verify its iterator > is indeed empty. Bear in mind that we have all the tck tests for j.u.c, that cover such things. The JCK folks at Oracle regularly run them. In general, we use jtreg tests instead of, or in addition to, tck tests only for policy reasons: when there's a CR associated with the test, and/or it can run a long time, and/or it covers multiple classes. -Doug From sean.mullan at oracle.com Fri Dec 9 16:07:18 2011 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 09 Dec 2011 11:07:18 -0500 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4EDE7F92.406@gmx.de> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> <4ED8F694.8010705@oracle.com> <4EDD082E.7060803@oracle.com> <4EDE7F92.406@gmx.de> Message-ID: <4EE23236.2060606@oracle.com> On 12/6/11 3:48 PM, Sebastian Sickelmann wrote: > Am 05.12.2011 19:06, schrieb Sean Mullan: >> On 12/2/11 11:02 AM, Sean Mullan wrote: >> >>>> [0] Solution 1 >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>>> [1] Solution 2 >>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html >> I definitely prefer solution 2. Just a few minor comments: >> >> - Use the javadoc @inheritDoc tag instead of copying the javadoc for the >> initCause method. >> >> - PreventOverridingOfChaining >> >> lines 68, 71: what do these comments mean? >> >> one additional test that would be useful to add would be to call initCause twice >> for those ctors that don't have a Throwable parameter, and make sure initCause >> throws IllegalStateExc. >> >> --Sean >> > Updated the webrev[2] to include your review. > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_7/index.html You didn't add the additional test that I thought would be useful - are you going to add that? Otherwise, it looks good. --Sean From kumar.x.srinivasan at oracle.com Fri Dec 9 16:58:02 2011 From: kumar.x.srinivasan at oracle.com (kumar.x.srinivasan at oracle.com) Date: Fri, 09 Dec 2011 16:58:02 +0000 Subject: hg: jdk8/tl/langtools: 7119032: (javac) increase visibility of JavacParser methods to improve subtyping Message-ID: <20111209165807.240024764F@hg.openjdk.java.net> Changeset: 9350d0498d21 Author: ksrini Date: 2011-12-09 08:40 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/9350d0498d21 7119032: (javac) increase visibility of JavacParser methods to improve subtyping Reviewed-by: jjg Contributed-by: jan.lahoda at oracle.com ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java From jim.holmlund at sun.com Fri Dec 9 21:03:08 2011 From: jim.holmlund at sun.com (jim.holmlund at sun.com) Date: Fri, 09 Dec 2011 21:03:08 +0000 Subject: hg: jdk8/tl/jdk: 7117053: Fix build warnings in com/sun/tools/jdi/* Message-ID: <20111209210329.8100547653@hg.openjdk.java.net> Changeset: 77d41c0e4ffc Author: jjh Date: 2011-12-09 12:56 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/77d41c0e4ffc 7117053: Fix build warnings in com/sun/tools/jdi/* Summary: Warnings fixed. Also reviewed by serguei.spitsyn at oracle.com, who is not yet an openjdk reviewer Reviewed-by: ksrini ! make/tools/src/build/tools/jdwpgen/ArrayRegionTypeNode.java ! make/tools/src/build/tools/jdwpgen/OutNode.java ! src/share/classes/com/sun/jdi/AbsentInformationException.java ! src/share/classes/com/sun/jdi/ClassNotLoadedException.java ! src/share/classes/com/sun/jdi/ClassNotPreparedException.java ! src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java ! src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java ! src/share/classes/com/sun/jdi/InternalException.java ! src/share/classes/com/sun/jdi/InvalidCodeIndexException.java ! src/share/classes/com/sun/jdi/InvalidLineNumberException.java ! src/share/classes/com/sun/jdi/InvalidStackFrameException.java ! src/share/classes/com/sun/jdi/InvalidTypeException.java ! src/share/classes/com/sun/jdi/InvocationException.java ! src/share/classes/com/sun/jdi/JDIPermission.java ! src/share/classes/com/sun/jdi/NativeMethodException.java ! src/share/classes/com/sun/jdi/ObjectCollectedException.java ! src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java ! src/share/classes/com/sun/jdi/VMDisconnectedException.java ! src/share/classes/com/sun/jdi/VMMismatchException.java ! src/share/classes/com/sun/jdi/VMOutOfMemoryException.java ! src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java ! src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java ! src/share/classes/com/sun/jdi/connect/VMStartException.java ! src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java ! src/share/classes/com/sun/jdi/request/DuplicateRequestException.java ! src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java ! src/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java ! src/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java ! src/share/classes/com/sun/tools/jdi/BooleanValueImpl.java ! src/share/classes/com/sun/tools/jdi/CharValueImpl.java ! src/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java ! src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java ! src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java ! src/share/classes/com/sun/tools/jdi/ConnectorImpl.java ! src/share/classes/com/sun/tools/jdi/DoubleValueImpl.java ! src/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java ! src/share/classes/com/sun/tools/jdi/EventSetImpl.java ! src/share/classes/com/sun/tools/jdi/FloatValueImpl.java ! src/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java ! src/share/classes/com/sun/tools/jdi/IntegerValueImpl.java ! src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java ! src/share/classes/com/sun/tools/jdi/InternalEventHandler.java ! src/share/classes/com/sun/tools/jdi/JDWPException.java - src/share/classes/com/sun/tools/jdi/LinkedHashMap.java ! src/share/classes/com/sun/tools/jdi/LongValueImpl.java ! src/share/classes/com/sun/tools/jdi/MethodImpl.java ! src/share/classes/com/sun/tools/jdi/MirrorImpl.java ! src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java ! src/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java ! src/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java ! src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java ! src/share/classes/com/sun/tools/jdi/ShortValueImpl.java ! src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java ! src/share/classes/com/sun/tools/jdi/TargetVM.java ! src/share/classes/com/sun/tools/jdi/ThreadAction.java ! src/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java ! src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java ! src/share/classes/com/sun/tools/jdi/VMAction.java ! src/share/classes/com/sun/tools/jdi/VMState.java ! src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java From forax at univ-mlv.fr Fri Dec 9 22:56:04 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Fri, 09 Dec 2011 23:56:04 +0100 Subject: array and diamond Message-ID: <4EE29204.2020008@univ-mlv.fr> Is there a reason why the diamond syntax can't be used with an array ? List[] list = new List<>[12]; R?mi From stephen.flores at oracle.com Sat Dec 10 06:05:33 2011 From: stephen.flores at oracle.com (Stephen Flores) Date: Sat, 10 Dec 2011 01:05:33 -0500 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. Message-ID: <4EE2F6AD.7050701@oracle.com> Please review the following webrev (includes new test to demonstrate the bug): http://cr.openjdk.java.net/~sflores/6990617/ for bug: 6990617 Regular expression doesn't match if unicode character next to a digit. A DESCRIPTION OF THE PROBLEM : Unicode characters are represented as \\+number. For instance, one could write: Pattern p = Pattern.compile("\\011some text\\012"); Matcher m = p.matcher("\tsome text\n"); System.out.println(m.find()); // yields "true" However, if we want to match a string with a digit next to the unicode character, it doesn't match (whether we "quote" the regular expression or not). Note the "1" next to the tab character (unicode 011). Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); Matcher m = p.matcher("\t1some text\n"); System.out.println(m.find()); // yields "false" This happens because Pattern accepts either \\0011 or \\011 for the same character. From the javadoc: \0nn The character with octal value 0nn (0 <= n <= 7) \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) Evaluation: Pattern.RemoveQEQuoting() does NOT handle this situation correctly. The existing implementation now simply copies all ASCII.isAlnum() characters when handing a quote. Description of fix: In the method Pattern.RemoveQEQuoting any ASCII digit at the beginning of a quote will now be prefixed by "\x3" (not just \ because this would be a backref). 0x30 is the ASCII code for '0'. Thanks, Steve. From maurizio.cimadamore at oracle.com Sat Dec 10 11:38:22 2011 From: maurizio.cimadamore at oracle.com (maurizio cimadamore) Date: Sat, 10 Dec 2011 11:38:22 +0000 Subject: array and diamond In-Reply-To: <4EE29204.2020008@univ-mlv.fr> References: <4EE29204.2020008@univ-mlv.fr> Message-ID: <4EE344AE.5010807@oracle.com> On 09-Dec-11 10:56 PM, R?mi Forax wrote: > Is there a reason why the diamond syntax can't be used > with an array ? > > List[] list = new List<>[12]; > Because the current inference rules would end up inferring: List[] list = new List[12]; If you special-cased diamond on arrays so that it is inferred as: List[] list = new List[12]; Then it would be safe. Maurizio > R?mi > From sebastian.sickelmann at gmx.de Sat Dec 10 12:46:34 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Sat, 10 Dec 2011 13:46:34 +0100 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4EE23236.2060606@oracle.com> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> <4ED8F694.8010705@oracle.com> <4EDD082E.7060803@oracle.com> <4EDE7F92.406@gmx.de> <4EE23236.2060606@oracle.com> Message-ID: <4EE354AA.5060002@gmx.de> Am 09.12.2011 17:07, schrieb Sean Mullan: > On 12/6/11 3:48 PM, Sebastian Sickelmann wrote: >> Am 05.12.2011 19:06, schrieb Sean Mullan: >>> On 12/2/11 11:02 AM, Sean Mullan wrote: >>> >>>>> [0] Solution 1 >>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>>>> [1] Solution 2 >>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html >>> I definitely prefer solution 2. Just a few minor comments: >>> >>> - Use the javadoc @inheritDoc tag instead of copying the javadoc for the >>> initCause method. >>> >>> - PreventOverridingOfChaining >>> >>> lines 68, 71: what do these comments mean? >>> >>> one additional test that would be useful to add would be to call initCause twice >>> for those ctors that don't have a Throwable parameter, and make sure initCause >>> throws IllegalStateExc. >>> >>> --Sean >>> >> Updated the webrev[2] to include your review. >> >> [2] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_7/index.html > You didn't add the additional test that I thought would be useful - are you > going to add that? Otherwise, it looks good. > > --Sean Sorry, I missed this. I updated the webrev[3] [3] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_8/index.html -- Sebastian From david.holmes at oracle.com Sun Dec 11 11:16:55 2011 From: david.holmes at oracle.com (David Holmes) Date: Sun, 11 Dec 2011 21:16:55 +1000 Subject: array and diamond In-Reply-To: <4EE29204.2020008@univ-mlv.fr> References: <4EE29204.2020008@univ-mlv.fr> Message-ID: <4EE49127.9040907@oracle.com> On 10/12/2011 8:56 AM, R?mi Forax wrote: > Is there a reason why the diamond syntax can't be used > with an array ? > > List[] list = new List<>[12]; It can in Java 7. That's the bug that we just discussed in regard to the java.util.concurrent code cleanup where I suggested to use: HashEntry[] newTable = new HashEntry<>[1]; to avoid the explicit cast. ;-) David > R?mi > > From Dmitry.Degrave at oracle.com Sun Dec 11 11:57:47 2011 From: Dmitry.Degrave at oracle.com (Dmeetry Degrave) Date: Sun, 11 Dec 2011 15:57:47 +0400 Subject: (corba) code review for 7046238: new InitialContext(); hangs Message-ID: <4EE49ABB.9000705@oracle.com> Hi, I'm looking for an approval for 7046238, "new InitialContext(); hangs". It was fixed in 6u27(b02) and we need it in 7u4 & jdk8. Fix is identical in all releases and it was approved by Ken for 6. initial description: http://bugs.sun.com/view_bug.do?bug_id=7016182 evaluation: http://bugs.sun.com/view_bug.do?bug_id=7046238 fix: http://cr.openjdk.java.net/~dmeetry/7046238/webrev.0/ thanks, dmeetry From forax at univ-mlv.fr Sun Dec 11 15:21:23 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Sun, 11 Dec 2011 16:21:23 +0100 Subject: array and diamond In-Reply-To: <4EE344AE.5010807@oracle.com> References: <4EE29204.2020008@univ-mlv.fr> <4EE344AE.5010807@oracle.com> Message-ID: <4EE4CA73.5070903@univ-mlv.fr> On 12/10/2011 12:38 PM, maurizio cimadamore wrote: > On 09-Dec-11 10:56 PM, R?mi Forax wrote: >> Is there a reason why the diamond syntax can't be used >> with an array ? >> >> List[] list = new List<>[12]; >> > Because the current inference rules would end up inferring: > > List[] list = new List[12]; > > If you special-cased diamond on arrays so that it is inferred as: > > List[] list = new List[12]; > > Then it would be safe. but in that case List[] list = new List[12]; is not equivalent to static List[] foo() { ... } ... List[] list = foo(); because as you said, Object will be inferred. Is there another case where diamond inference behave differently from method inference ? > > Maurizio R?mi From forax at univ-mlv.fr Sun Dec 11 15:26:17 2011 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Sun, 11 Dec 2011 16:26:17 +0100 Subject: array and diamond In-Reply-To: <4EE49127.9040907@oracle.com> References: <4EE29204.2020008@univ-mlv.fr> <4EE49127.9040907@oracle.com> Message-ID: <4EE4CB99.8020104@univ-mlv.fr> On 12/11/2011 12:16 PM, David Holmes wrote: > On 10/12/2011 8:56 AM, R?mi Forax wrote: >> Is there a reason why the diamond syntax can't be used >> with an array ? >> >> List[] list = new List<>[12]; > > It can in Java 7. That's the bug that we just discussed in regard to > the java.util.concurrent code cleanup where I suggested to use: > > HashEntry[] newTable = new HashEntry<>[1]; > > to avoid the explicit cast. ;-) > > David I've put my desktop in a Faraday cage and cut the internet link to be sure there will be no auto-update even over the air :) R?mi From maurizio.cimadamore at oracle.com Sun Dec 11 16:43:39 2011 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Sun, 11 Dec 2011 16:43:39 +0000 Subject: array and diamond In-Reply-To: <4EE4CA73.5070903@univ-mlv.fr> References: <4EE29204.2020008@univ-mlv.fr> <4EE344AE.5010807@oracle.com> <4EE4CA73.5070903@univ-mlv.fr> Message-ID: <4EE4DDBB.1040207@oracle.com> On 11/12/11 15:21, R?mi Forax wrote: > On 12/10/2011 12:38 PM, maurizio cimadamore wrote: >> On 09-Dec-11 10:56 PM, R?mi Forax wrote: >>> Is there a reason why the diamond syntax can't be used >>> with an array ? >>> >>> List[] list = new List<>[12]; >>> >> Because the current inference rules would end up inferring: >> >> List[] list = new List[12]; >> >> If you special-cased diamond on arrays so that it is inferred as: >> >> List[] list = new List[12]; >> >> Then it would be safe. > > but in that case > List[] list = new List[12]; > is not equivalent to > static List[] foo() { ... } > ... > List[] list = foo(); > because as you said, Object will be inferred. > > Is there another case where diamond inference behave differently from > method inference ? No - that's why the array case is banned; after going back and forth we decided to adopt the principle of least surprise, which means diamond always behave as a static generic method (the diamond spec is also design to map the diamond case back to the generic factory method). What I was saying is that in order for diamond to be safely used in array context we'd need to revisit both the spec and the compiler, and to rethink the diamond vs. generic method inference strategy. I think it will be much more productive if we could remove the ban about creating an array of List (reification) - which then would mean that the current inference strategy will apply to arrays as well. Maurizio > >> >> Maurizio > > R?mi > From kumar.x.srinivasan at oracle.com Sun Dec 11 16:44:15 2011 From: kumar.x.srinivasan at oracle.com (kumar.x.srinivasan at oracle.com) Date: Sun, 11 Dec 2011 16:44:15 +0000 Subject: hg: jdk8/tl/langtools: 7119487: JavacParserTest.java test fails on Windows platforms Message-ID: <20111211164418.455AE4766C@hg.openjdk.java.net> Changeset: e7d5e1a7cde5 Author: ksrini Date: 2011-12-10 17:44 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/e7d5e1a7cde5 7119487: JavacParserTest.java test fails on Windows platforms Reviewed-by: jjg + test/tools/javac/parser/JavacParserTest.java - test/tools/javac/parser/netbeans/JavacParserTest.java From maurizio.cimadamore at oracle.com Sun Dec 11 17:49:07 2011 From: maurizio.cimadamore at oracle.com (maurizio.cimadamore at oracle.com) Date: Sun, 11 Dec 2011 17:49:07 +0000 Subject: hg: jdk8/tl/langtools: 7120266: javac fails to compile hotspot code Message-ID: <20111211174909.921EB4766D@hg.openjdk.java.net> Changeset: e55270a7a022 Author: mcimadamore Date: 2011-12-11 17:48 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/e55270a7a022 7120266: javac fails to compile hotspot code Summary: Parser changes for method references cause bad intercation with method call syntax Reviewed-by: jjg ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java + test/tools/javac/T7120266.java ! test/tools/javac/lambda/MethodReferenceParserTest.java From kelly.ohair at oracle.com Sun Dec 11 21:48:19 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Sun, 11 Dec 2011 13:48:19 -0800 Subject: Need reviewer - testing changes Message-ID: Re-organized the testing targets, moved jdk_tools1 out of the default test targets. Running "cd test && make" should run the default test list, and should be 100% pass, in theory. (Note: Use of the jdk/test/Makefile utilizes jtreg with a default set of options running a default set of tests where some tests are excluded, e.g. those marked @ignore or listed in jdk/test/ProblemList.txt) The JPRT system runs the same tests, with jdk/test/Makefile, just on multiple platforms. Removed some -target 1.5 issues for the Mac, just getting a jump on jdk8 mac changes. 7119829: Adjust default jprt testing configuration 7117110: Remove target 1.5 from jaxp and jaxws repo builds for mac http://cr.openjdk.java.net/~ohair/openjdk8/jdk8-tl-jprt/webrev/ -kto From chris.hegarty at oracle.com Mon Dec 12 10:45:52 2011 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 12 Dec 2011 10:45:52 +0000 Subject: RFR 7118066: Warnings in java.util.concurrent package In-Reply-To: <4EE1EB81.5010809@cs.oswego.edu> References: <4ED8E0F1.10200@oracle.com> <4EDCE4F4.6060002@oracle.com> <4EDD6BF7.2040808@oracle.com> <4EDE0A62.7000304@oracle.com> <4EDEC286.7050303@cs.oswego.edu> <4EDF0200.6000703@oracle.com> <4EDF5783.3060007@oracle.com> <4EE0477E.30605@oracle.com> <4EE0A090.7000208@oracle.com> <4EE18BAA.5080902@oracle.com> <4EE1EB81.5010809@cs.oswego.edu> Message-ID: <4EE5DB60.4000207@oracle.com> On 09/12/2011 11:05, Doug Lea wrote: > On 12/08/11 23:16, David Holmes wrote: > >> >> Maybe we still need something that tests SynchronousQueue to verify >> its iterator >> is indeed empty. > > Bear in mind that we have all the tck tests for j.u.c, that cover > such things. The JCK folks at Oracle regularly run them. > In general, we use jtreg tests instead of, or in addition to, tck > tests only for policy reasons: when there's a CR associated > with the test, and/or it can run a long time, and/or it > covers multiple classes. Thanks Doug, I can see that SynchronousQueue.iterator is tested by JCK tests, so we can simply remove it from this test. Thanks, -Chris. > > -Doug > From Alan.Bateman at oracle.com Mon Dec 12 11:02:24 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 12 Dec 2011 11:02:24 +0000 Subject: Need reviewer - testing changes In-Reply-To: References: Message-ID: <4EE5DF40.8070903@oracle.com> On 11/12/2011 21:48, Kelly O'Hair wrote: > Re-organized the testing targets, moved jdk_tools1 out of the default test targets. > > Running "cd test&& make" should run the default test list, and should be 100% pass, in theory. > (Note: Use of the jdk/test/Makefile utilizes jtreg with a default set of options running a default > set of tests where some tests are excluded, e.g. those marked @ignore or listed in jdk/test/ProblemList.txt) > > The JPRT system runs the same tests, with jdk/test/Makefile, just on multiple platforms. > > Removed some -target 1.5 issues for the Mac, just getting a jump on jdk8 mac changes. > > 7119829: Adjust default jprt testing configuration > 7117110: Remove target 1.5 from jaxp and jaxws repo builds for mac > http://cr.openjdk.java.net/~ohair/openjdk8/jdk8-tl-jprt/webrev/ > > -kto This changes looks okay to me. The only thing is that the list of default test targets is essentially duplicated in 3 places (top-level repo, jdk repo, and jdk/test/Makefile because of JDK_DEFAULT_TARGETS) and it would be nice to somehow avoid that. -Alan From neil.richards at ngmr.net Mon Dec 12 11:33:39 2011 From: neil.richards at ngmr.net (Neil Richards) Date: Mon, 12 Dec 2011 11:33:39 +0000 Subject: Add Look&Feel support for AIX platform In-Reply-To: References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> Message-ID: <1323689619.20905.3.camel@chalkhill> On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > Hi, > > > I'm not sure what to do for it next, shall I create a bug for it > now ? But I > don't think the bug system support AIX platform. I remembered it > would > report something like "we are not supporting the platform". > Hi Sean, Looking at the options available on the Java bug submission site [1], it looks like: Release: OpenJDK Operating System: Generic / Other would be the most appropriate choices to make. Regards, Neil -- Unless stated above: IBM email: neil_richards at uk.ibm.com IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From neil.richards at ngmr.net Mon Dec 12 11:45:09 2011 From: neil.richards at ngmr.net (neil.richards at ngmr.net) Date: Mon, 12 Dec 2011 11:45:09 +0000 Subject: hg: jdk8/tl/jdk: 7118907: InetAddress.isReachable() should return false if sendto fails with EHOSTUNREACH Message-ID: <20111212114532.28EFA4766F@hg.openjdk.java.net> Changeset: c508f38245f8 Author: ngmr Date: 2011-12-12 11:41 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c508f38245f8 7118907: InetAddress.isReachable() should return false if sendto fails with EHOSTUNREACH Reviewed-by: alanb, chegar Contributed-by: Charles Lee ! src/solaris/native/java/net/Inet4AddressImpl.c ! src/solaris/native/java/net/Inet6AddressImpl.c From chris.hegarty at oracle.com Mon Dec 12 11:55:00 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Mon, 12 Dec 2011 11:55:00 +0000 Subject: hg: jdk8/tl/jdk: 2 new changesets Message-ID: <20111212115519.7D5DF47670@hg.openjdk.java.net> Changeset: 3216717f96f5 Author: dl Date: 2011-12-12 10:45 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3216717f96f5 7118066: Warnings in java.util.concurrent package Reviewed-by: chegar, dholmes ! src/share/classes/java/util/concurrent/ArrayBlockingQueue.java ! src/share/classes/java/util/concurrent/ConcurrentHashMap.java ! src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java ! src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java ! src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java ! src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java ! src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java ! src/share/classes/java/util/concurrent/DelayQueue.java ! src/share/classes/java/util/concurrent/Exchanger.java ! src/share/classes/java/util/concurrent/ForkJoinPool.java ! src/share/classes/java/util/concurrent/ForkJoinTask.java ! src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java ! src/share/classes/java/util/concurrent/LinkedTransferQueue.java ! src/share/classes/java/util/concurrent/Phaser.java ! src/share/classes/java/util/concurrent/PriorityBlockingQueue.java ! src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java ! src/share/classes/java/util/concurrent/SynchronousQueue.java ! test/java/util/Collections/EmptyIterator.java Changeset: d4f9d7e86a92 Author: chegar Date: 2011-12-12 03:54 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/d4f9d7e86a92 Merge From neil.richards at ngmr.net Mon Dec 12 13:09:18 2011 From: neil.richards at ngmr.net (Neil Richards) Date: Mon, 12 Dec 2011 13:09:18 +0000 Subject: Try to make OSInfo class recognize AIX platform In-Reply-To: References: Message-ID: <1323695358.20905.7.camel@chalkhill> On Fri, 2011-12-09 at 15:00 +0800, Sean Chou wrote: > Hi all, > > I reported a bug(rrf) to request that OSInfo class recognizes AIX > platform. > As we know there are more platforms supporting java than platforms supported > by openjdk. So I think OSInfo can add the feature to recognize these > platforms. > This patch uses AIX as an example. > > The bug link is: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7119285 > > And the patch link is: > http://cr.openjdk.java.net/~zhouyx/7119285/webrev.00/ > > There was a previous discussion related[1], and I think it would be > better > to break the patch up. Would anyone have a look ? > > > > [1] previous discussion links > http://mail.openjdk.java.net/pipermail/swing-dev/2011-October/001795.html > http://mail.openjdk.java.net/pipermail/swing-dev/2011-November/001847.html > > > As a matter of interest, can someone with suitable powers look into why the bug mentioned above (7119285) is not publically viewable ? Thanks, Neil -- Unless stated above: IBM email: neil_richards at uk.ibm.com IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From Alan.Bateman at oracle.com Mon Dec 12 14:10:51 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 12 Dec 2011 14:10:51 +0000 Subject: Try to make OSInfo class recognize AIX platform In-Reply-To: <1323695358.20905.7.camel@chalkhill> References: <1323695358.20905.7.camel@chalkhill> Message-ID: <4EE60B6B.8060907@oracle.com> On 12/12/2011 13:09, Neil Richards wrote: > : > As a matter of interest, can someone with suitable powers look into why > the bug mentioned above (7119285) is not publically viewable ? > Bug reports that are submitted to bugs.sun.com are initially treated as "incidents" where they are filtered before moving to an appropriate product in the (Oracle internal) bug database. The reason for this is that there are hundreds of bug reports submitted each week, many of which are submitted by end-users that neglect to include anything useful. For some areas (it's on a per-category basis I think) then these incidents go immediately into the bug database and so should be visible on bugs.sun.com. I'm not sure about the Swing category (which this one seems to have been submitted against), they may not be visible on bugs.sun.com until they make it to their final destination. In any case, this one looks to be have closed by the initial triage because it's not a supported platform. As regards this issue then I would suggest starting a new thread on awt-dev to stoke up ideas for how sun.awt.OSInfo could be refactored to better accommodate other platforms. -Alan. From frederic.parain at oracle.com Mon Dec 12 14:29:40 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Mon, 12 Dec 2011 15:29:40 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE10139.8020905@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> Message-ID: <4EE60FD4.3040404@oracle.com> Hi Paul, Thank you for the review. I've applied all your recommendations except the refactoring in diagnosticCommandFramework.cpp (too few lines can be really factored out without passing many arguments). New webrev is here: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ Regards, Fred On 12/ 8/11 07:26 PM, Paul Hohensee wrote: > For the hotspot part at > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ > > Most of my comments are style-related. Nice job on the implementation > architecture. > > In attachListener.cpp: > > You might want to delete the first "return JNI_OK;" line, since the code > under > HAS_PENDING_EXCEPTION just falls through. > > In jmm.h: > > Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the > existing declarations. Add a newline just before it on line 322. > > > In diagnosticFramework.hpp: > > Fix indenting for lines 63-66, insert blank before "size_t" on line 48. > > Hotspot convention is that getter method names don't include a "get_" > prefix. > So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). > Similarly, getters such as is_enabled() should retrieve a field named > "_is_enabled" > rather than one named "enabled". You follow the "_is_enabled" convention > in other places such as GenDCmdArgument. Or you could use enabled() to > get the value of the _enabled field. > > Also generally, I'd use accessor methods in the implementation of more > complex member methods rather than access the underlying fields directly. > E.g. in GenDCmdArgument::read_value, I'd use is_set() and set_is_set(true), > (set_is_set() is not actually defined, but should be) rather than directly > accessing _is_set. Though sometimes doing this is too much of a pain > with fields whose type is a template argument, as in the > DCmdArggument::parse_value() method in diagnosticArgument.cpp. > > For easy readability, it'd be nice to line up field names (the ones with an > _ prefix) at the same column. > > On line 200, "instanciated" -> "instantiated" > > On line 218, I'd use "heap_allocated" rather than "heap" for the formal > arg name. > > On line 248, you could indent the text to start underneath "outputStream". > I generally find that indenting arguments lines (formal or actual) so > they line > up with the first argument position make the code more readable, but I'm > not > religious about it. > > On line 265, "instanciated" -> "instantiated" > > DCmdFactorys are members of a singly-linked list, right? If so, it'd be > good to > have a comment to that effect on the declaration of _next. > > On line 322, insert a blank before "true". You might fix this in other > places > where there's no blank between a comma in an argument list and the > following parameter value. > > > In diagnosticCommandFramework.cpp: > > The code from lines 80-95 and 105-120 is identical. Factor out? > > > In diagnosticArgument.cpp: > > On line 41, insert blanks before the actual arguments. (see above > generic comment) > > On line 77, the "if" is indented one space too many. > > > In management.cpp: > > I'd be consistent with having or not having a space between "while", > "if" and "for" > and the following "(" in this and your other code. Most hotspot code has > a space. > > > Thanks, > > Paul > > > On 12/2/11 8:57 AM, Frederic Parain wrote: >> Hi All, >> >> [Posting to serviceability-dev, runtime-dev and core-libs-dev >> because changes are pretty big and touch all these areas] >> >> Here's a framework for issuing diagnostics commands to the JVM. >> Diagnostic commands are actions executed inside the JVM mainly >> for monitoring or management purpose. This work has two parts. >> The first part is in the hotspot repository and contains the >> framework itself with two diagnostic commands. The second >> part is in the JDK repository and contains the command line >> utility to invoke diagnostic commands as well as the >> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >> extensions allow a remote client to discover and invoke >> diagnostic commands using a JMX connection. >> >> This changeset only contains two diagnostic commands, more >> commands will be added in the future, as a standalone effort >> to improve the monitoring and management services of the >> JVM, or as part of other projects. >> >> Webrevs are here: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >> >> Here's a technical description of this work: >> >> 1 - The Diagnostic Command Framework >> 1-1 Overview >> >> The diagnostic command framework is fully implemented in native code >> and relies on the HotSpot's internal exception mechanism. >> The rational of a pure native implementation is to be able to execute >> diagnostic commands even in critical situations like an OutOfMemory >> error. All diagnostic commands are registered in a single list, and two >> flags control the way a user can interact with them. The "hidden" flag >> prevents a diagnostic command from appearing in the list of available >> commands returned by the "help" command. However, it's still possible to >> get the detailed help message for a hidden command with the "help >> " syntax (but it requires to know the name of the hidden >> command). The second flag is "enabled" and it controls if a command can >> be invoked or not. When listed with the "help" commands, disabled >> commands appear with a "[disabled]" label in their description. If the >> user tries to invoke a disabled command, an error message is returned >> and the command is not run. This error message can be customized on a >> per command base. The framework just provides these two flags with their >> semantic, it doesn't provide any policy or mechanism to set or modify >> these flags. These actions will be delegated to the JVM or special >> diagnostic commands. >> >> 1-2 Implementation >> >> All diagnostic commands are implemented as subclasses of the DCmd class >> defined in services/diagnosticFramework.hpp. Here's the layout of the >> DCmd class and the list of methods that a new command has to define or >> overwrite: >> >> class DCmd { >> DCmd(outputStream *output); >> >> static const char *get_name(); >> >> static const char *get_description(); >> >> static const char *get_disabled_message(); >> >> static const char *get_impact(); >> >> static int get_num_arguments(); >> >> virtual void print_help(outputStream* out); >> >> virtual void parse(CmdLine* line, char delim, TRAPS); >> >> virtual void execute(TRAPS); >> >> virtual void reset(TRAPS); >> >> virtual void cleanup(); >> >> virtual GrowableArray* get_argument_name_array(); >> >> virtual GrowableArray* get_argument_info_array(); >> } >> >> A diagnostic command is always instantiated with an outputStream in >> parameter. This outputStream can point either to a file, a buffer or a >> socket (see the ostream.hpp file). >> >> The get_name() method returns the string that will identify the command >> (i.e. the string to put on the command line to invoke it). >> >> The get_description() methods returns the global description of the >> command. >> >> The get_disabled_message() returns the customized message to return when >> the command is disabled, without having to instantiate the command. >> >> The get_impact() returns a description of the intrusiveness of the >> diagnostic command on the Java Virtual Machine behavior. The rational >> for this method is that some diagnostic commands can seriously disrupt >> the behavior of the Java Virtual Machine (for instance a Thread Dump for >> an application with several tens of thousands of threads, or a Head Dump >> with a 40GB+ heap size) and other diagnostic commands have no serious >> impact on the JVM (for instance, getting the command line arguments or >> the JVM version). The recommended format for the description is > level>: [longer description], where the impact level is selected among >> this list: {low, medium, high}. The optional longer description can >> provide more specific details like the fact that Thread Dump impact >> depends on the heap size. >> >> The get_num_arguments() returns the number of options/arguments >> recognized by the diagnostic command. This method is only used by the >> JMX interface support (see below). >> >> The print_help() methods prints a detailed help on the outputStream >> passed in argument. The detailed help contains the list of all supported >> options with their type and description. >> >> The parse() method is in charge of parsing the command arguments. Each >> command is free to implement its own argument parser. However, an >> argument parser framework is provided (see section 1-3) to ease the >> implementation, but its use is optional. The parse method takes a >> delimiter character in argument, which is used to mark the limit between >> two arguments (typically invocation from jcmd will use a space character >> as a delimiter while invocation from the JVM command line parsing code >> will use a comma as a delimiter). >> >> The execute() method is naturally the one to invoke to get the >> diagnostic command executed. The parse() and the execute() methods are >> dissociated, so it's a possible perform the argument parsing in one >> thread, and delegate the execution to another thread, as long as the >> diagnostic command doesn't reference thread local variables. The >> framework allows several instances of the same diagnostic command to be >> executed in parallel. If for some reasons concurrent executions should >> not be allowed for a given diagnostic command, this is the >> responsibility of the diagnostic command implementor to enforce this >> rule, for instance by protecting the body of the execute() method with a >> global lock. >> >> The reset() method is used to initialize the internal fields of the >> diagnostic command or to reset the internal fields to their initial >> value to be able to re-use an already allocated diagnostic command >> instance. >> >> The cleanup() method is used to perform perform cleanup (like freeing of >> all memory allocated to store internal data). The DCmd extends the >> ResourceObj class, so when allocated in a ResourceArea, destructors >> cannot be used to perform cleanup. To ensure that cleanup is performed >> in all cases, it is recommended to create a DCmdMark instance for each >> DCmd instance. DCmdMark is a stack allocated object with a pointer to a >> DCmd instance. When the DCmdMark is destroyed, its destructor calls the >> cleanup() method of the DCmd instance it points to. If the DCmd instance >> has been allocated on the C-Heap, the DCmdMark will also free the memory >> allocated to store the DCmd instance. >> >> The get_argument_name_array() and get_argument_info_array() are related >> to the JMX interface of the diagnostic command framework, so they are >> described in section 3. >> >> 1-3 DCmdParser framework >> >> The DCmdParser class is an optional framework to help development of >> argument parsers. It provides many features required by the diagnostic >> command framework (generation of the help message or the argument >> descriptions for the JMX interface) but all these features can easily be >> re-implemented if a developer decides not to use the DCmdParser >> framework. >> >> The DCmdParser class is relying on the DCmdArgument template. This >> template must be used to define the different types of argument the >> parser will have to handle. When a new specialization of the template is >> done, three methods have to be provided: >> >> void parse_value(const char *str,size_t len,TRAPS); >> void init_value(TRAPS); >> void destroy_value(); >> >> The parse_value() method is used to convert a string into an argument >> value. The print_value() method is used to display the default value >> (support for the detailed help message). The init_value() method is used >> to initialize or reset the argument value. The destroy_value() method is >> a clean-up method (useful when the argument has allocated some C-Heap >> memory to store its value and this memory has to be freed before >> destroying the DCmdArgument instance). >> >> The DCmdParser makes a distinction between options and arguments. >> Options are identified by a key name that must appear on the command >> line, while argument are identified just by the position of the argument >> on the command line. Options use the = syntax. In case of >> boolean options, the '=' part of the syntax can be omitted to set >> the option to true. Arguments are just sequences characters delimited by >> a separator character. This separator can be specified at runtime when >> invoking the diagnostic command framework. If an argument contain a >> character that could be used as a delimiter, it's possible to enclose >> the argument between single or double quotes. Options are arguments are >> instantiated using the same DCmdArgument class but they're registered >> differently to the DCmdParser. >> >> The way to use the DCmdParser is to declare the parser and the >> option/arguments as fields of the diagnostic command class (which is >> itself a sub-class of the DCmd class), like this: >> >> >> class EchoDCmd : public DCmd { >> protected: >> DCmdParser _dcmdparser; >> >> DCmdArgument _required; >> >> DCmdArgument _intval; >> >> DCmdArgument _boolval; >> >> DCmdArgument _stringval; >> >> DCmdArgument _first_arg; >> >> DCmdArgument _second_arg; >> >> DCmdArgument _optional_arg; >> >> } >> >> The parser and the options/arguments must be initialized before the >> diagnostic command class, and the options/arguments have to be >> registered to the parser like this: >> >> EchoDCmd(outputStream *output) : DCmd(output), >> _stringval("-strval","a string argument","STRING",false), >> >> _boolval("-boolval","a boolean argument","BOOLEAN",false), >> >> _intval("-intval","an integer argument","INTEGER",false), >> >> _required("-req","a mandatory integer argument","INTEGER",true), >> >> _fist_arg("first argument","a string argument","STRING",true), >> >> _second_arg("second argument,"an integer argument,"INTEGER",true), >> >> _optional_arg("optional argument","an optional string >> argument","STRING","false") >> >> { >> >> _dcmdparser.add_dcmd_option(&_stringval) >> >> _dcmdparser.add_dcmd_option(&_boolval); >> >> _dcmdparser.add_dcmd_option(&_intval); >> >> _dcmdparser.add_dcmd_option(&_required); >> >> _dcmdparser.add_argument(&_first_arg); >> >> _dcmdparser.add_argument(&_second_arg); >> >> _dcmdparser.add_argument(&_optional_arg); >> }; >> >> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >> argument/option to the parser. The option/argument constructor takes the >> name of the option/argument, its description, a string describing its >> type and a boolean to specify if the option/argument is mandatory or >> not. The parser doesn't support option/argument duplicates (having the >> same name) but the code currently doesn't check for duplicates.The order >> used to register options has no impact on the parser. However, the order >> used to register arguments is critical because the parser will use the >> same order to parse the command line. In the example above, the parser >> expects to have a first argument of type STRING (parsed using >> _first_arg), then a second argument of type INTEGER (parsed using >> _second_arg) and optionally a third parameter of type STRING (parsed >> using _optional_arg). A mandatory option or argument has to be specify >> every time the command is invoked. If it is missing, an exception is >> thrown at the end of the parsing. Optional arguments have to be >> registered after mandatory arguments. An optional argument will be >> considered for parsing only if all arguments before it (mandatory or >> not) have already been used to parse the command line. >> >> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >> instance. The rational for this design is to limit the number of C-heap >> allocations but also to be able to pre-allocate diagnostic command >> instances for critical situations. If the process is running out of >> C-heap space, it's not possible to instantiate new diagnostic commands >> to troubleshoot the situation. By pre-allocating some diagnostic >> commands, it will be possible to run them even in this critical >> situation. Of course, the diagnostic command itself should not try to >> allocate memory during its execution, this prevents the diagnostic >> command to use variable length arguments like strings. By nature, >> pre-allocated diagnostic commands aim to be re-usable, this is the >> purpose of the reset() method which restores the default status of all >> arguments. >> >> 1-4 Internal invocation >> >> Using a diagnostic command from the JVM itself is pretty easy: >> instantiate the class and invoke the parse() method then the execute() >> method. A diagnostic command can be instantiated from inside the JVM >> even it is not registered. This is a difference with the external >> invocations (from jcmd or JMX) that require the command to be registered. >> >> 2 - The JCmd interface >> >> Diagnostic commands can also be invoked from outside the JVM process, >> using the new 'jcmd' utility. The jcmd program uses the attach API >> to connect to the JVM, send requests and receive results. The >> jcmd utility must be launched on the same machine than the one running >> the JVM (its a local tool). Launched without arguments, jcmd displays a >> list of all JVMs running on the machine. The jcmd source code is in >> the jdk repository like other existing j* tools. >> >> To execute a diagnostic command in a particular JVM, the generic >> syntax is: >> >> jcmd [arguments] >> >> The attachListener has been modified to recognized the jcmd requests. >> When a jcmd request is identified, it is parsed to extract the command >> name. The JVM performs a look up of this command in a list of registered >> commands. To be executable by an external request, a diagnostic command >> has to be registered. The registration is performed with the DCmdFactory >> class (see services/management.cpp). >> >> 3 - The JMX interface >> >> The framework provides a JMX based interface to the diagnostic commands. >> This interface allows remote invocation of diagnostic commands through a >> JMX connection. >> >> 3-1 The interface >> >> The information related to the diagnostic commands are accessible >> through new methods added to the >> com.sun.management.HotspotDiagnosticMXBean: >> >> public List getDiagnosticCommands(); >> >> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >> >> public List getDiagnosticCommandInfo(List >> command); >> >> public List getDiagnosticCommandInfo(); >> >> public String execute(String commandLine) throws >> IllegalArgumentException ; >> >> public String execute(String cmd, String... arguments) >> throws IllegalArgumentException; >> >> >> The getDiagnosticCommands() method returns an array containing the names >> of the not-hidden registered diagnostic commands. >> >> The three getDiagnosticCommandInfo() methods return one or several >> diagnostic command descriptions using the DiagnosticCommandInfo class. >> >> The two execute() methods allow the user the invoke a diagnostic command >> in different ways. >> >> The DiagnosticCommandInfo class is describing a diagnostic command with >> the following information: >> >> public class DiagnosticCommandInfo { >> >> public String getName(); >> >> public String getDescription(); >> >> public String getImpact(); >> >> public boolean isEnabled(); >> >> public List getArgumentsInfo(); >> } >> >> The getName() method returns the name of the diagnostic command. This >> name is the one to use in execute() methods to invoke the diagnostic >> command. >> >> The getDescription() method returns a general description of the >> diagnostic command. >> >> The getImpact() method returns a description of the intrusiveness of >> diagnostic command. >> >> The isEnabled() method returns true if the method is enabled, false if >> it is disabled. A disabled method cannot be executed. >> >> The getArgumentsInfo() returns a list of descriptions for the options or >> arguments recognized by the diagnostic command. Each option/argument is >> described by a DiagnosticCommandArgumentInfo instance: >> >> public class DiagnosticCommandArgumentInfo { >> >> public String getName(); >> >> public String getDescription(); >> >> public String getType(); >> >> public String getDefault(); >> >> public boolean isMandatory(); >> >> public boolean isOption(); >> >> public int getPosition(); >> } >> >> If the DiagnosticCommandArgumentInfo instance describes an option, >> isOption() returns true and getPosition() returns -1. Otherwise, when >> the DiagnosticCommandArgumentInfo instance describes an argument, >> isOption() returns false and getPosition() returns the expected position >> for this argument. The position of an argument is defined relatively to >> all arguments passed on the command line, options are not considered >> when defining an argument position. The getDefault() method returns the >> default value of the argument if a default has been defined, otherwise >> it returns null. >> >> 3-2 The implementation >> >> The framework has been designed in a way that prevents diagnostic >> command developers to worry about the JMX interface. In addition to >> the methods described in section 1-2, a diagnostic command developer has >> to provide three methods: >> >> int get_num_arguments() >> >> which returns the number of option and arguments supported by the >> command. >> >> GrowableArray* get_argument_name_array() >> >> which provides the name of the arguments supported by the command. >> >> GrowableyArray* get_argument_info_array() >> >> which provides the description of each argument with a DCmdArgumentInfo >> instance. DCmdArgumentInfo is a C++ class used by the framework to >> generate the sun.com.management.DcmdArgumentInfo instances. This is done >> automatically and the diagnostic command developer doesn't need to know >> how to create Java objects from the runtime. >> >> 4 - The Diagnostic Commands >> >> To avoid name collisions between diagnostic commands coming from >> different projects, use of a flat name space should be avoided and >> a more structured organization is recommended. The framework itself >> doesn't depend on this organization, so it will be a set of rules >> defining a convention in the way commands are named. >> >> Diagnostic commands can easily organized in a hierarchical way, so the >> template for a command name can be: >> >> .[sub-domain.] >> >> This template can be extended with sub-sub-domains and so on. >> >> A special set of commands without domain will be reserved for the >> commands related to the diagnostic framework itself, like the "help" >> command. >> >> >> Thanks, >> >> Fred >> -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From frederic.parain at oracle.com Mon Dec 12 14:31:28 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Mon, 12 Dec 2011 15:31:28 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <34278e49-efbc-4370-ab36-a50331a9ff65@default> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> <34278e49-efbc-4370-ab36-a50331a9ff65@default> Message-ID: <4EE61040.5040704@oracle.com> Hi Robert, These issues should be solved with the new webrevs: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.03/ Regards, Fred On 12/ 9/11 03:17 PM, Robert Ottenhag wrote: > Adding to the review of jmm.h, that is modified in both the jdk part > and the hotspot part, these files should be identical, without any > differences in whitespace. > > Also, regarding whitespace and indentation, the use TAB characters in > many files in the jdk patch makes jcheck complain (when trying to > import your patch locally), and should be replaced by spaces. > > Best regards, > > /Robert > > >> -----Original Message----- From: Paul Hohensee Sent: Thursday, >> December 08, 2011 7:26 PM To: Frederic Parain Cc: >> serviceability-dev at openjdk.java.net; >> core-libs-dev at openjdk.java.net; >> hotspot-runtime-dev at openjdk.java.net Subject: Re: Request for >> Review (XXL): 7104647: Adding a diagnostic command framework >> >> For the hotspot part at >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >> >> Most of my comments are style-related. Nice job on the >> implementation architecture. >> >> In attachListener.cpp: >> >> You might want to delete the first "return JNI_OK;" line, since the >> code under HAS_PENDING_EXCEPTION just falls through. >> >> In jmm.h: >> >> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as >> the existing declarations. Add a newline just before it on line >> 322. >> >> >> In diagnosticFramework.hpp: >> >> Fix indenting for lines 63-66, insert blank before "size_t" on line >> 48. >> >> Hotspot convention is that getter method names don't include a >> "get_" prefix. So, e.g., DCmdArgIter::get_key_addr() s/b >> DCmdArgIter::key_addr(). Similarly, getters such as is_enabled() >> should retrieve a field named "_is_enabled" rather than one named >> "enabled". You follow the "_is_enabled" convention in other places >> such as GenDCmdArgument. Or you could use enabled() to get the >> value of the _enabled field. >> >> Also generally, I'd use accessor methods in the implementation of >> more complex member methods rather than access the underlying >> fields directly. E.g. in GenDCmdArgument::read_value, I'd use >> is_set() and set_is_set(true), (set_is_set() is not actually >> defined, but should be) rather than directly accessing _is_set. >> Though sometimes doing this is too much of a pain with fields whose >> type is a template argument, as in the >> DCmdArggument::parse_value() method in >> diagnosticArgument.cpp. >> >> For easy readability, it'd be nice to line up field names (the ones >> with an _ prefix) at the same column. >> >> On line 200, "instanciated" -> "instantiated" >> >> On line 218, I'd use "heap_allocated" rather than "heap" for the >> formal arg name. >> >> On line 248, you could indent the text to start underneath >> "outputStream". I generally find that indenting arguments lines >> (formal or actual) so they line up with the first argument position >> make the code more readable, but I'm not religious about it. >> >> On line 265, "instanciated" -> "instantiated" >> >> DCmdFactorys are members of a singly-linked list, right? If so, >> it'd be good to have a comment to that effect on the declaration of >> _next. >> >> On line 322, insert a blank before "true". You might fix this in >> other places where there's no blank between a comma in an argument >> list and the following parameter value. >> >> >> In diagnosticCommandFramework.cpp: >> >> The code from lines 80-95 and 105-120 is identical. Factor out? >> >> >> In diagnosticArgument.cpp: >> >> On line 41, insert blanks before the actual arguments. (see above >> generic comment) >> >> On line 77, the "if" is indented one space too many. >> >> >> In management.cpp: >> >> I'd be consistent with having or not having a space between >> "while", "if" and "for" and the following "(" in this and your >> other code. Most hotspot code has a space. >> >> >> Thanks, >> >> Paul >> >> >> On 12/2/11 8:57 AM, Frederic Parain wrote: >>> Hi All, >>> >>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>> because changes are pretty big and touch all these areas] >>> >>> Here's a framework for issuing diagnostics commands to the JVM. >>> Diagnostic commands are actions executed inside the JVM mainly >>> for monitoring or management purpose. This work has two parts. >>> The first part is in the hotspot repository and contains the >>> framework itself with two diagnostic commands. The second part is >>> in the JDK repository and contains the command line utility to >>> invoke diagnostic commands as well as the HotSpotDiagnosticMXBean >>> extensions. The HotSpotDiagnosticMXBean extensions allow a remote >>> client to discover and invoke diagnostic commands using a JMX >>> connection. >>> >>> This changeset only contains two diagnostic commands, more >>> commands will be added in the future, as a standalone effort to >>> improve the monitoring and management services of the JVM, or as >>> part of other projects. >>> >>> Webrevs are here: >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>> >>> Here's a technical description of this work: >>> >>> 1 - The Diagnostic Command Framework 1-1 Overview >>> >>> The diagnostic command framework is fully implemented in native >>> code and relies on the HotSpot's internal exception mechanism. >>> The rational of a pure native implementation is to be able to >>> execute diagnostic commands even in critical situations like an >>> OutOfMemory error. All diagnostic commands are registered in a >>> single list, and two flags control the way a user can interact >>> with them. The "hidden" flag prevents a diagnostic command from >>> appearing in the list of available commands returned by the >>> "help" command. However, it's still possible to get the detailed >>> help message for a hidden command with the "help " >>> syntax (but it requires to know the name of the hidden command). >>> The second flag is "enabled" and it controls if a command can be >>> invoked or not. When listed with the "help" commands, disabled >>> commands appear with a "[disabled]" label in their description. >>> If the user tries to invoke a disabled command, an error message >>> is returned and the command is not run. This error message can be >>> customized on a per command base. The framework just provides >>> these two flags with their semantic, it doesn't provide any >>> policy or mechanism to set or modify these flags. These actions >>> will be delegated to the JVM or special diagnostic commands. >>> >>> 1-2 Implementation >>> >>> All diagnostic commands are implemented as subclasses of the DCmd >>> class defined in services/diagnosticFramework.hpp. Here's the >>> layout of the DCmd class and the list of methods that a new >>> command has to define or overwrite: >>> >>> class DCmd { DCmd(outputStream *output); >>> >>> static const char *get_name(); >>> >>> static const char *get_description(); >>> >>> static const char *get_disabled_message(); >>> >>> static const char *get_impact(); >>> >>> static int get_num_arguments(); >>> >>> virtual void print_help(outputStream* out); >>> >>> virtual void parse(CmdLine* line, char delim, TRAPS); >>> >>> virtual void execute(TRAPS); >>> >>> virtual void reset(TRAPS); >>> >>> virtual void cleanup(); >>> >>> virtual GrowableArray* get_argument_name_array(); >>> >>> virtual GrowableArray* >>> get_argument_info_array(); } >>> >>> A diagnostic command is always instantiated with an outputStream >>> in parameter. This outputStream can point either to a file, a >>> buffer or a socket (see the ostream.hpp file). >>> >>> The get_name() method returns the string that will identify the >>> command (i.e. the string to put on the command line to invoke >>> it). >>> >>> The get_description() methods returns the global description of >>> the command. >>> >>> The get_disabled_message() returns the customized message to >>> return when the command is disabled, without having to >>> instantiate the command. >>> >>> The get_impact() returns a description of the intrusiveness of >>> the diagnostic command on the Java Virtual Machine behavior. The >>> rational for this method is that some diagnostic commands can >>> seriously disrupt the behavior of the Java Virtual Machine (for >>> instance a Thread Dump for an application with several tens of >>> thousands of threads, or a Head Dump with a 40GB+ heap size) and >>> other diagnostic commands have no serious impact on the JVM (for >>> instance, getting the command line arguments or the JVM version). >>> The recommended format for the description is: >>> [longer description], where the impact level is selected among >>> this list: {low, medium, high}. The optional longer description >>> can provide more specific details like the fact that Thread Dump >>> impact depends on the heap size. >>> >>> The get_num_arguments() returns the number of options/arguments >>> recognized by the diagnostic command. This method is only used by >>> the JMX interface support (see below). >>> >>> The print_help() methods prints a detailed help on the >>> outputStream passed in argument. The detailed help contains the >>> list of all supported options with their type and description. >>> >>> The parse() method is in charge of parsing the command arguments. >>> Each command is free to implement its own argument parser. >>> However, an argument parser framework is provided (see section >>> 1-3) to ease the implementation, but its use is optional. The >>> parse method takes a delimiter character in argument, which is >>> used to mark the limit between two arguments (typically >>> invocation from jcmd will use a space character as a delimiter >>> while invocation from the JVM command line parsing code will use >>> a comma as a delimiter). >>> >>> The execute() method is naturally the one to invoke to get the >>> diagnostic command executed. The parse() and the execute() >>> methods are dissociated, so it's a possible perform the argument >>> parsing in one thread, and delegate the execution to another >>> thread, as long as the diagnostic command doesn't reference >>> thread local variables. The framework allows several instances of >>> the same diagnostic command to be executed in parallel. If for >>> some reasons concurrent executions should not be allowed for a >>> given diagnostic command, this is the responsibility of the >>> diagnostic command implementor to enforce this rule, for instance >>> by protecting the body of the execute() method with a global >>> lock. >>> >>> The reset() method is used to initialize the internal fields of >>> the diagnostic command or to reset the internal fields to their >>> initial value to be able to re-use an already allocated >>> diagnostic command instance. >>> >>> The cleanup() method is used to perform perform cleanup (like >>> freeing of all memory allocated to store internal data). The DCmd >>> extends the ResourceObj class, so when allocated in a >>> ResourceArea, destructors cannot be used to perform cleanup. To >>> ensure that cleanup is performed in all cases, it is recommended >>> to create a DCmdMark instance for each DCmd instance. DCmdMark is >>> a stack allocated object with a pointer to a DCmd instance. When >>> the DCmdMark is destroyed, its destructor calls the cleanup() >>> method of the DCmd instance it points to. If the DCmd instance >>> has been allocated on the C-Heap, the DCmdMark will also free the >>> memory allocated to store the DCmd instance. >>> >>> The get_argument_name_array() and get_argument_info_array() are >>> related to the JMX interface of the diagnostic command framework, >>> so they are described in section 3. >>> >>> 1-3 DCmdParser framework >>> >>> The DCmdParser class is an optional framework to help development >>> of argument parsers. It provides many features required by the >>> diagnostic command framework (generation of the help message or >>> the argument descriptions for the JMX interface) but all these >>> features can easily be re-implemented if a developer decides not >>> to use the DCmdParser framework. >>> >>> The DCmdParser class is relying on the DCmdArgument template. >>> This template must be used to define the different types of >>> argument the parser will have to handle. When a new >>> specialization of the template is done, three methods have to be >>> provided: >>> >>> void parse_value(const char *str,size_t len,TRAPS); void >>> init_value(TRAPS); void destroy_value(); >>> >>> The parse_value() method is used to convert a string into an >>> argument value. The print_value() method is used to display the >>> default value (support for the detailed help message). The >>> init_value() method is used to initialize or reset the argument >>> value. The destroy_value() method is a clean-up method (useful >>> when the argument has allocated some C-Heap memory to store its >>> value and this memory has to be freed before destroying the >>> DCmdArgument instance). >>> >>> The DCmdParser makes a distinction between options and >>> arguments. Options are identified by a key name that must appear >>> on the command line, while argument are identified just by the >>> position of the argument on the command line. Options use >>> the= syntax. In case of boolean options, the >>> '=' part of the syntax can be omitted to set the option to >>> true. Arguments are just sequences characters delimited by a >>> separator character. This separator can be specified at runtime >>> when invoking the diagnostic command framework. If an argument >>> contain a character that could be used as a delimiter, it's >>> possible to enclose the argument between single or double quotes. >>> Options are arguments are instantiated using the same >>> DCmdArgument class but they're registered differently to the >>> DCmdParser. >>> >>> The way to use the DCmdParser is to declare the parser and the >>> option/arguments as fields of the diagnostic command class (which >>> is itself a sub-class of the DCmd class), like this: >>> >>> >>> class EchoDCmd : public DCmd { protected: DCmdParser >>> _dcmdparser; >>> >>> DCmdArgument _required; >>> >>> DCmdArgument _intval; >>> >>> DCmdArgument _boolval; >>> >>> DCmdArgument _stringval; >>> >>> DCmdArgument _first_arg; >>> >>> DCmdArgument _second_arg; >>> >>> DCmdArgument _optional_arg; >>> >>> } >>> >>> The parser and the options/arguments must be initialized before >>> the diagnostic command class, and the options/arguments have to >>> be registered to the parser like this: >>> >>> EchoDCmd(outputStream *output) : DCmd(output), >>> _stringval("-strval","a string argument","STRING",false), >>> >>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>> >>> _intval("-intval","an integer argument","INTEGER",false), >>> >>> _required("-req","a mandatory integer argument","INTEGER",true), >>> >>> _fist_arg("first argument","a string argument","STRING",true), >>> >>> _second_arg("second argument,"an integer >>> argument,"INTEGER",true), >>> >>> _optional_arg("optional argument","an optional string >>> argument","STRING","false") >>> >>> { >>> >>> _dcmdparser.add_dcmd_option(&_stringval) >>> >>> _dcmdparser.add_dcmd_option(&_boolval); >>> >>> _dcmdparser.add_dcmd_option(&_intval); >>> >>> _dcmdparser.add_dcmd_option(&_required); >>> >>> _dcmdparser.add_argument(&_first_arg); >>> >>> _dcmdparser.add_argument(&_second_arg); >>> >>> _dcmdparser.add_argument(&_optional_arg); }; >>> >>> The add_dcmd_argument()/ add_dcmd_option() method is used to add >>> an argument/option to the parser. The option/argument constructor >>> takes the name of the option/argument, its description, a string >>> describing its type and a boolean to specify if the >>> option/argument is mandatory or not. The parser doesn't support >>> option/argument duplicates (having the same name) but the code >>> currently doesn't check for duplicates.The order used to register >>> options has no impact on the parser. However, the order used to >>> register arguments is critical because the parser will use the >>> same order to parse the command line. In the example above, the >>> parser expects to have a first argument of type STRING (parsed >>> using _first_arg), then a second argument of type INTEGER (parsed >>> using _second_arg) and optionally a third parameter of type >>> STRING (parsed using _optional_arg). A mandatory option or >>> argument has to be specify every time the command is invoked. If >>> it is missing, an exception is thrown at the end of the parsing. >>> Optional arguments have to be registered after mandatory >>> arguments. An optional argument will be considered for parsing >>> only if all arguments before it (mandatory or not) have already >>> been used to parse the command line. >>> >>> The DCmdParser and its DCmdArgument instances are embedded in the >>> DCmd instance. The rational for this design is to limit the >>> number of C-heap allocations but also to be able to pre-allocate >>> diagnostic command instances for critical situations. If the >>> process is running out of C-heap space, it's not possible to >>> instantiate new diagnostic commands to troubleshoot the >>> situation. By pre-allocating some diagnostic commands, it will be >>> possible to run them even in this critical situation. Of course, >>> the diagnostic command itself should not try to allocate memory >>> during its execution, this prevents the diagnostic command to use >>> variable length arguments like strings. By nature, pre-allocated >>> diagnostic commands aim to be re-usable, this is the purpose of >>> the reset() method which restores the default status of all >>> arguments. >>> >>> 1-4 Internal invocation >>> >>> Using a diagnostic command from the JVM itself is pretty easy: >>> instantiate the class and invoke the parse() method then the >>> execute() method. A diagnostic command can be instantiated from >>> inside the JVM even it is not registered. This is a difference >>> with the external invocations (from jcmd or JMX) that require the >>> command to be >> registered. >>> >>> 2 - The JCmd interface >>> >>> Diagnostic commands can also be invoked from outside the JVM >>> process, using the new 'jcmd' utility. The jcmd program uses the >>> attach API to connect to the JVM, send requests and receive >>> results. The jcmd utility must be launched on the same machine >>> than the one running the JVM (its a local tool). Launched without >>> arguments, jcmd displays a list of all JVMs running on the >>> machine. The jcmd source code is in the jdk repository like other >>> existing j* tools. >>> >>> To execute a diagnostic command in a particular JVM, the generic >>> syntax is: >>> >>> jcmd [arguments] >>> >>> The attachListener has been modified to recognized the jcmd >>> requests. When a jcmd request is identified, it is parsed to >>> extract the command name. The JVM performs a look up of this >>> command in a list of registered commands. To be executable by an >>> external request, a diagnostic command has to be registered. The >>> registration is performed with the DCmdFactory class (see >>> services/management.cpp). >>> >>> 3 - The JMX interface >>> >>> The framework provides a JMX based interface to the diagnostic >>> commands. This interface allows remote invocation of diagnostic >>> commands through a JMX connection. >>> >>> 3-1 The interface >>> >>> The information related to the diagnostic commands are >>> accessible through new methods added to the >>> com.sun.management.HotspotDiagnosticMXBean: >>> >>> public List getDiagnosticCommands(); >>> >>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String >>> command); >>> >>> public List >>> getDiagnosticCommandInfo(List command); >>> >>> public List getDiagnosticCommandInfo(); >>> >>> public String execute(String commandLine) throws >>> IllegalArgumentException ; >>> >>> public String execute(String cmd, String... arguments) throws >>> IllegalArgumentException; >>> >>> >>> The getDiagnosticCommands() method returns an array containing >>> the names of the not-hidden registered diagnostic commands. >>> >>> The three getDiagnosticCommandInfo() methods return one or >>> several diagnostic command descriptions using the >>> DiagnosticCommandInfo class. >>> >>> The two execute() methods allow the user the invoke a diagnostic >>> command in different ways. >>> >>> The DiagnosticCommandInfo class is describing a diagnostic >>> command with the following information: >>> >>> public class DiagnosticCommandInfo { >>> >>> public String getName(); >>> >>> public String getDescription(); >>> >>> public String getImpact(); >>> >>> public boolean isEnabled(); >>> >>> public List getArgumentsInfo(); >>> } >>> >>> The getName() method returns the name of the diagnostic command. >>> This name is the one to use in execute() methods to invoke the >>> diagnostic command. >>> >>> The getDescription() method returns a general description of the >>> diagnostic command. >>> >>> The getImpact() method returns a description of the intrusiveness >>> of diagnostic command. >>> >>> The isEnabled() method returns true if the method is enabled, >>> false if it is disabled. A disabled method cannot be executed. >>> >>> The getArgumentsInfo() returns a list of descriptions for the >>> options or arguments recognized by the diagnostic command. Each >>> option/argument is described by a DiagnosticCommandArgumentInfo >>> instance: >>> >>> public class DiagnosticCommandArgumentInfo { >>> >>> public String getName(); >>> >>> public String getDescription(); >>> >>> public String getType(); >>> >>> public String getDefault(); >>> >>> public boolean isMandatory(); >>> >>> public boolean isOption(); >>> >>> public int getPosition(); } >>> >>> If the DiagnosticCommandArgumentInfo instance describes an >>> option, isOption() returns true and getPosition() returns -1. >>> Otherwise, when the DiagnosticCommandArgumentInfo instance >>> describes an argument, isOption() returns false and getPosition() >>> returns the expected position for this argument. The position of >>> an argument is defined relatively to all arguments passed on the >>> command line, options are not considered when defining an >>> argument position. The getDefault() method returns the default >>> value of the argument if a default has been defined, otherwise it >>> returns null. >>> >>> 3-2 The implementation >>> >>> The framework has been designed in a way that prevents >>> diagnostic command developers to worry about the JMX interface. >>> In addition to the methods described in section 1-2, a diagnostic >>> command developer has to provide three methods: >>> >>> int get_num_arguments() >>> >>> which returns the number of option and arguments supported by >>> the command. >>> >>> GrowableArray* get_argument_name_array() >>> >>> which provides the name of the arguments supported by the >>> command. >>> >>> GrowableyArray* get_argument_info_array() >>> >>> which provides the description of each argument with a >>> DCmdArgumentInfo instance. DCmdArgumentInfo is a C++ class used >>> by the framework to generate the >>> sun.com.management.DcmdArgumentInfo instances. This is done >>> automatically and the diagnostic command developer doesn't need >>> to know how to create Java objects from the runtime. >>> >>> 4 - The Diagnostic Commands >>> >>> To avoid name collisions between diagnostic commands coming from >>> different projects, use of a flat name space should be avoided >>> and a more structured organization is recommended. The framework >>> itself doesn't depend on this organization, so it will be a set >>> of rules defining a convention in the way commands are named. >>> >>> Diagnostic commands can easily organized in a hierarchical way, >>> so the template for a command name can be: >>> >>> .[sub-domain.] >>> >>> This template can be extended with sub-sub-domains and so on. >>> >>> A special set of commands without domain will be reserved for >>> the commands related to the diagnostic framework itself, like the >>> "help" command. >>> >>> >>> Thanks, >>> >>> Fred >>> -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From gary.adams at oracle.com Mon Dec 12 15:05:05 2011 From: gary.adams at oracle.com (Gary Adams) Date: Mon, 12 Dec 2011 10:05:05 -0500 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EE2F6AD.7050701@oracle.com> References: <4EE2F6AD.7050701@oracle.com> Message-ID: <4EE61821.2070603@oracle.com> I think you want to add 6990617 to the @bug tag in RegExTest. On 12/10/11 01:05 AM, Stephen Flores wrote: > Please review the following webrev (includes new test to demonstrate the bug): > > http://cr.openjdk.java.net/~sflores/6990617/ > > for bug: 6990617 Regular expression doesn't match if unicode character next to > a digit. > > A DESCRIPTION OF THE PROBLEM : > > Unicode characters are represented as \\+number. > For instance, one could write: > Pattern p = Pattern.compile("\\011some text\\012"); > Matcher m = p.matcher("\tsome text\n"); > System.out.println(m.find()); // yields "true" > > However, if we want to match a string with a digit next to > the unicode character, it doesn't match (whether we "quote" > the regular expression or not). Note the "1" next to the tab > character (unicode 011). > Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); > Matcher m = p.matcher("\t1some text\n"); > System.out.println(m.find()); // yields "false" > > This happens because Pattern accepts either \\0011 or \\011 for > the same character. From the javadoc: > > \0nn The character with octal value 0nn (0 <= n <= 7) > \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) > > Evaluation: > > Pattern.RemoveQEQuoting() does NOT handle this situation correctly. > The existing implementation now simply copies all ASCII.isAlnum() > characters when handing a quote. > > Description of fix: > > In the method Pattern.RemoveQEQuoting any ASCII digit at the > beginning of a quote will now be prefixed by "\x3" (not just \ > because this would be a backref). 0x30 is the ASCII code for '0'. > > Thanks, > > Steve. From frederic.parain at oracle.com Mon Dec 12 15:56:43 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Mon, 12 Dec 2011 16:56:43 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE60FD4.3040404@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> Message-ID: <4EE6243B.6070200@oracle.com> Minor updates: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.04/ Fred On 12/12/11 03:29 PM, Frederic Parain wrote: > Hi Paul, > > Thank you for the review. > I've applied all your recommendations except the refactoring > in diagnosticCommandFramework.cpp (too few lines can be really > factored out without passing many arguments). > > New webrev is here: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ > > Regards, > > Fred > > On 12/ 8/11 07:26 PM, Paul Hohensee wrote: >> For the hotspot part at >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >> >> Most of my comments are style-related. Nice job on the implementation >> architecture. >> >> In attachListener.cpp: >> >> You might want to delete the first "return JNI_OK;" line, since the code >> under >> HAS_PENDING_EXCEPTION just falls through. >> >> In jmm.h: >> >> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the >> existing declarations. Add a newline just before it on line 322. >> >> >> In diagnosticFramework.hpp: >> >> Fix indenting for lines 63-66, insert blank before "size_t" on line 48. >> >> Hotspot convention is that getter method names don't include a "get_" >> prefix. >> So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). >> Similarly, getters such as is_enabled() should retrieve a field named >> "_is_enabled" >> rather than one named "enabled". You follow the "_is_enabled" convention >> in other places such as GenDCmdArgument. Or you could use enabled() to >> get the value of the _enabled field. >> >> Also generally, I'd use accessor methods in the implementation of more >> complex member methods rather than access the underlying fields directly. >> E.g. in GenDCmdArgument::read_value, I'd use is_set() and >> set_is_set(true), >> (set_is_set() is not actually defined, but should be) rather than >> directly >> accessing _is_set. Though sometimes doing this is too much of a pain >> with fields whose type is a template argument, as in the >> DCmdArggument::parse_value() method in diagnosticArgument.cpp. >> >> For easy readability, it'd be nice to line up field names (the ones >> with an >> _ prefix) at the same column. >> >> On line 200, "instanciated" -> "instantiated" >> >> On line 218, I'd use "heap_allocated" rather than "heap" for the formal >> arg name. >> >> On line 248, you could indent the text to start underneath >> "outputStream". >> I generally find that indenting arguments lines (formal or actual) so >> they line >> up with the first argument position make the code more readable, but I'm >> not >> religious about it. >> >> On line 265, "instanciated" -> "instantiated" >> >> DCmdFactorys are members of a singly-linked list, right? If so, it'd be >> good to >> have a comment to that effect on the declaration of _next. >> >> On line 322, insert a blank before "true". You might fix this in other >> places >> where there's no blank between a comma in an argument list and the >> following parameter value. >> >> >> In diagnosticCommandFramework.cpp: >> >> The code from lines 80-95 and 105-120 is identical. Factor out? >> >> >> In diagnosticArgument.cpp: >> >> On line 41, insert blanks before the actual arguments. (see above >> generic comment) >> >> On line 77, the "if" is indented one space too many. >> >> >> In management.cpp: >> >> I'd be consistent with having or not having a space between "while", >> "if" and "for" >> and the following "(" in this and your other code. Most hotspot code has >> a space. >> >> >> Thanks, >> >> Paul >> >> >> On 12/2/11 8:57 AM, Frederic Parain wrote: >>> Hi All, >>> >>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>> because changes are pretty big and touch all these areas] >>> >>> Here's a framework for issuing diagnostics commands to the JVM. >>> Diagnostic commands are actions executed inside the JVM mainly >>> for monitoring or management purpose. This work has two parts. >>> The first part is in the hotspot repository and contains the >>> framework itself with two diagnostic commands. The second >>> part is in the JDK repository and contains the command line >>> utility to invoke diagnostic commands as well as the >>> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >>> extensions allow a remote client to discover and invoke >>> diagnostic commands using a JMX connection. >>> >>> This changeset only contains two diagnostic commands, more >>> commands will be added in the future, as a standalone effort >>> to improve the monitoring and management services of the >>> JVM, or as part of other projects. >>> >>> Webrevs are here: >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>> >>> Here's a technical description of this work: >>> >>> 1 - The Diagnostic Command Framework >>> 1-1 Overview >>> >>> The diagnostic command framework is fully implemented in native code >>> and relies on the HotSpot's internal exception mechanism. >>> The rational of a pure native implementation is to be able to execute >>> diagnostic commands even in critical situations like an OutOfMemory >>> error. All diagnostic commands are registered in a single list, and two >>> flags control the way a user can interact with them. The "hidden" flag >>> prevents a diagnostic command from appearing in the list of available >>> commands returned by the "help" command. However, it's still possible to >>> get the detailed help message for a hidden command with the "help >>> " syntax (but it requires to know the name of the hidden >>> command). The second flag is "enabled" and it controls if a command can >>> be invoked or not. When listed with the "help" commands, disabled >>> commands appear with a "[disabled]" label in their description. If the >>> user tries to invoke a disabled command, an error message is returned >>> and the command is not run. This error message can be customized on a >>> per command base. The framework just provides these two flags with their >>> semantic, it doesn't provide any policy or mechanism to set or modify >>> these flags. These actions will be delegated to the JVM or special >>> diagnostic commands. >>> >>> 1-2 Implementation >>> >>> All diagnostic commands are implemented as subclasses of the DCmd class >>> defined in services/diagnosticFramework.hpp. Here's the layout of the >>> DCmd class and the list of methods that a new command has to define or >>> overwrite: >>> >>> class DCmd { >>> DCmd(outputStream *output); >>> >>> static const char *get_name(); >>> >>> static const char *get_description(); >>> >>> static const char *get_disabled_message(); >>> >>> static const char *get_impact(); >>> >>> static int get_num_arguments(); >>> >>> virtual void print_help(outputStream* out); >>> >>> virtual void parse(CmdLine* line, char delim, TRAPS); >>> >>> virtual void execute(TRAPS); >>> >>> virtual void reset(TRAPS); >>> >>> virtual void cleanup(); >>> >>> virtual GrowableArray* get_argument_name_array(); >>> >>> virtual GrowableArray* get_argument_info_array(); >>> } >>> >>> A diagnostic command is always instantiated with an outputStream in >>> parameter. This outputStream can point either to a file, a buffer or a >>> socket (see the ostream.hpp file). >>> >>> The get_name() method returns the string that will identify the command >>> (i.e. the string to put on the command line to invoke it). >>> >>> The get_description() methods returns the global description of the >>> command. >>> >>> The get_disabled_message() returns the customized message to return when >>> the command is disabled, without having to instantiate the command. >>> >>> The get_impact() returns a description of the intrusiveness of the >>> diagnostic command on the Java Virtual Machine behavior. The rational >>> for this method is that some diagnostic commands can seriously disrupt >>> the behavior of the Java Virtual Machine (for instance a Thread Dump for >>> an application with several tens of thousands of threads, or a Head Dump >>> with a 40GB+ heap size) and other diagnostic commands have no serious >>> impact on the JVM (for instance, getting the command line arguments or >>> the JVM version). The recommended format for the description is >> level>: [longer description], where the impact level is selected among >>> this list: {low, medium, high}. The optional longer description can >>> provide more specific details like the fact that Thread Dump impact >>> depends on the heap size. >>> >>> The get_num_arguments() returns the number of options/arguments >>> recognized by the diagnostic command. This method is only used by the >>> JMX interface support (see below). >>> >>> The print_help() methods prints a detailed help on the outputStream >>> passed in argument. The detailed help contains the list of all supported >>> options with their type and description. >>> >>> The parse() method is in charge of parsing the command arguments. Each >>> command is free to implement its own argument parser. However, an >>> argument parser framework is provided (see section 1-3) to ease the >>> implementation, but its use is optional. The parse method takes a >>> delimiter character in argument, which is used to mark the limit between >>> two arguments (typically invocation from jcmd will use a space character >>> as a delimiter while invocation from the JVM command line parsing code >>> will use a comma as a delimiter). >>> >>> The execute() method is naturally the one to invoke to get the >>> diagnostic command executed. The parse() and the execute() methods are >>> dissociated, so it's a possible perform the argument parsing in one >>> thread, and delegate the execution to another thread, as long as the >>> diagnostic command doesn't reference thread local variables. The >>> framework allows several instances of the same diagnostic command to be >>> executed in parallel. If for some reasons concurrent executions should >>> not be allowed for a given diagnostic command, this is the >>> responsibility of the diagnostic command implementor to enforce this >>> rule, for instance by protecting the body of the execute() method with a >>> global lock. >>> >>> The reset() method is used to initialize the internal fields of the >>> diagnostic command or to reset the internal fields to their initial >>> value to be able to re-use an already allocated diagnostic command >>> instance. >>> >>> The cleanup() method is used to perform perform cleanup (like freeing of >>> all memory allocated to store internal data). The DCmd extends the >>> ResourceObj class, so when allocated in a ResourceArea, destructors >>> cannot be used to perform cleanup. To ensure that cleanup is performed >>> in all cases, it is recommended to create a DCmdMark instance for each >>> DCmd instance. DCmdMark is a stack allocated object with a pointer to a >>> DCmd instance. When the DCmdMark is destroyed, its destructor calls the >>> cleanup() method of the DCmd instance it points to. If the DCmd instance >>> has been allocated on the C-Heap, the DCmdMark will also free the memory >>> allocated to store the DCmd instance. >>> >>> The get_argument_name_array() and get_argument_info_array() are related >>> to the JMX interface of the diagnostic command framework, so they are >>> described in section 3. >>> >>> 1-3 DCmdParser framework >>> >>> The DCmdParser class is an optional framework to help development of >>> argument parsers. It provides many features required by the diagnostic >>> command framework (generation of the help message or the argument >>> descriptions for the JMX interface) but all these features can easily be >>> re-implemented if a developer decides not to use the DCmdParser >>> framework. >>> >>> The DCmdParser class is relying on the DCmdArgument template. This >>> template must be used to define the different types of argument the >>> parser will have to handle. When a new specialization of the template is >>> done, three methods have to be provided: >>> >>> void parse_value(const char *str,size_t len,TRAPS); >>> void init_value(TRAPS); >>> void destroy_value(); >>> >>> The parse_value() method is used to convert a string into an argument >>> value. The print_value() method is used to display the default value >>> (support for the detailed help message). The init_value() method is used >>> to initialize or reset the argument value. The destroy_value() method is >>> a clean-up method (useful when the argument has allocated some C-Heap >>> memory to store its value and this memory has to be freed before >>> destroying the DCmdArgument instance). >>> >>> The DCmdParser makes a distinction between options and arguments. >>> Options are identified by a key name that must appear on the command >>> line, while argument are identified just by the position of the argument >>> on the command line. Options use the = syntax. In case of >>> boolean options, the '=' part of the syntax can be omitted to set >>> the option to true. Arguments are just sequences characters delimited by >>> a separator character. This separator can be specified at runtime when >>> invoking the diagnostic command framework. If an argument contain a >>> character that could be used as a delimiter, it's possible to enclose >>> the argument between single or double quotes. Options are arguments are >>> instantiated using the same DCmdArgument class but they're registered >>> differently to the DCmdParser. >>> >>> The way to use the DCmdParser is to declare the parser and the >>> option/arguments as fields of the diagnostic command class (which is >>> itself a sub-class of the DCmd class), like this: >>> >>> >>> class EchoDCmd : public DCmd { >>> protected: >>> DCmdParser _dcmdparser; >>> >>> DCmdArgument _required; >>> >>> DCmdArgument _intval; >>> >>> DCmdArgument _boolval; >>> >>> DCmdArgument _stringval; >>> >>> DCmdArgument _first_arg; >>> >>> DCmdArgument _second_arg; >>> >>> DCmdArgument _optional_arg; >>> >>> } >>> >>> The parser and the options/arguments must be initialized before the >>> diagnostic command class, and the options/arguments have to be >>> registered to the parser like this: >>> >>> EchoDCmd(outputStream *output) : DCmd(output), >>> _stringval("-strval","a string argument","STRING",false), >>> >>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>> >>> _intval("-intval","an integer argument","INTEGER",false), >>> >>> _required("-req","a mandatory integer argument","INTEGER",true), >>> >>> _fist_arg("first argument","a string argument","STRING",true), >>> >>> _second_arg("second argument,"an integer argument,"INTEGER",true), >>> >>> _optional_arg("optional argument","an optional string >>> argument","STRING","false") >>> >>> { >>> >>> _dcmdparser.add_dcmd_option(&_stringval) >>> >>> _dcmdparser.add_dcmd_option(&_boolval); >>> >>> _dcmdparser.add_dcmd_option(&_intval); >>> >>> _dcmdparser.add_dcmd_option(&_required); >>> >>> _dcmdparser.add_argument(&_first_arg); >>> >>> _dcmdparser.add_argument(&_second_arg); >>> >>> _dcmdparser.add_argument(&_optional_arg); >>> }; >>> >>> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >>> argument/option to the parser. The option/argument constructor takes the >>> name of the option/argument, its description, a string describing its >>> type and a boolean to specify if the option/argument is mandatory or >>> not. The parser doesn't support option/argument duplicates (having the >>> same name) but the code currently doesn't check for duplicates.The order >>> used to register options has no impact on the parser. However, the order >>> used to register arguments is critical because the parser will use the >>> same order to parse the command line. In the example above, the parser >>> expects to have a first argument of type STRING (parsed using >>> _first_arg), then a second argument of type INTEGER (parsed using >>> _second_arg) and optionally a third parameter of type STRING (parsed >>> using _optional_arg). A mandatory option or argument has to be specify >>> every time the command is invoked. If it is missing, an exception is >>> thrown at the end of the parsing. Optional arguments have to be >>> registered after mandatory arguments. An optional argument will be >>> considered for parsing only if all arguments before it (mandatory or >>> not) have already been used to parse the command line. >>> >>> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >>> instance. The rational for this design is to limit the number of C-heap >>> allocations but also to be able to pre-allocate diagnostic command >>> instances for critical situations. If the process is running out of >>> C-heap space, it's not possible to instantiate new diagnostic commands >>> to troubleshoot the situation. By pre-allocating some diagnostic >>> commands, it will be possible to run them even in this critical >>> situation. Of course, the diagnostic command itself should not try to >>> allocate memory during its execution, this prevents the diagnostic >>> command to use variable length arguments like strings. By nature, >>> pre-allocated diagnostic commands aim to be re-usable, this is the >>> purpose of the reset() method which restores the default status of all >>> arguments. >>> >>> 1-4 Internal invocation >>> >>> Using a diagnostic command from the JVM itself is pretty easy: >>> instantiate the class and invoke the parse() method then the execute() >>> method. A diagnostic command can be instantiated from inside the JVM >>> even it is not registered. This is a difference with the external >>> invocations (from jcmd or JMX) that require the command to be >>> registered. >>> >>> 2 - The JCmd interface >>> >>> Diagnostic commands can also be invoked from outside the JVM process, >>> using the new 'jcmd' utility. The jcmd program uses the attach API >>> to connect to the JVM, send requests and receive results. The >>> jcmd utility must be launched on the same machine than the one running >>> the JVM (its a local tool). Launched without arguments, jcmd displays a >>> list of all JVMs running on the machine. The jcmd source code is in >>> the jdk repository like other existing j* tools. >>> >>> To execute a diagnostic command in a particular JVM, the generic >>> syntax is: >>> >>> jcmd [arguments] >>> >>> The attachListener has been modified to recognized the jcmd requests. >>> When a jcmd request is identified, it is parsed to extract the command >>> name. The JVM performs a look up of this command in a list of registered >>> commands. To be executable by an external request, a diagnostic command >>> has to be registered. The registration is performed with the DCmdFactory >>> class (see services/management.cpp). >>> >>> 3 - The JMX interface >>> >>> The framework provides a JMX based interface to the diagnostic commands. >>> This interface allows remote invocation of diagnostic commands through a >>> JMX connection. >>> >>> 3-1 The interface >>> >>> The information related to the diagnostic commands are accessible >>> through new methods added to the >>> com.sun.management.HotspotDiagnosticMXBean: >>> >>> public List getDiagnosticCommands(); >>> >>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >>> >>> public List getDiagnosticCommandInfo(List >>> command); >>> >>> public List getDiagnosticCommandInfo(); >>> >>> public String execute(String commandLine) throws >>> IllegalArgumentException ; >>> >>> public String execute(String cmd, String... arguments) >>> throws IllegalArgumentException; >>> >>> >>> The getDiagnosticCommands() method returns an array containing the names >>> of the not-hidden registered diagnostic commands. >>> >>> The three getDiagnosticCommandInfo() methods return one or several >>> diagnostic command descriptions using the DiagnosticCommandInfo class. >>> >>> The two execute() methods allow the user the invoke a diagnostic command >>> in different ways. >>> >>> The DiagnosticCommandInfo class is describing a diagnostic command with >>> the following information: >>> >>> public class DiagnosticCommandInfo { >>> >>> public String getName(); >>> >>> public String getDescription(); >>> >>> public String getImpact(); >>> >>> public boolean isEnabled(); >>> >>> public List getArgumentsInfo(); >>> } >>> >>> The getName() method returns the name of the diagnostic command. This >>> name is the one to use in execute() methods to invoke the diagnostic >>> command. >>> >>> The getDescription() method returns a general description of the >>> diagnostic command. >>> >>> The getImpact() method returns a description of the intrusiveness of >>> diagnostic command. >>> >>> The isEnabled() method returns true if the method is enabled, false if >>> it is disabled. A disabled method cannot be executed. >>> >>> The getArgumentsInfo() returns a list of descriptions for the options or >>> arguments recognized by the diagnostic command. Each option/argument is >>> described by a DiagnosticCommandArgumentInfo instance: >>> >>> public class DiagnosticCommandArgumentInfo { >>> >>> public String getName(); >>> >>> public String getDescription(); >>> >>> public String getType(); >>> >>> public String getDefault(); >>> >>> public boolean isMandatory(); >>> >>> public boolean isOption(); >>> >>> public int getPosition(); >>> } >>> >>> If the DiagnosticCommandArgumentInfo instance describes an option, >>> isOption() returns true and getPosition() returns -1. Otherwise, when >>> the DiagnosticCommandArgumentInfo instance describes an argument, >>> isOption() returns false and getPosition() returns the expected position >>> for this argument. The position of an argument is defined relatively to >>> all arguments passed on the command line, options are not considered >>> when defining an argument position. The getDefault() method returns the >>> default value of the argument if a default has been defined, otherwise >>> it returns null. >>> >>> 3-2 The implementation >>> >>> The framework has been designed in a way that prevents diagnostic >>> command developers to worry about the JMX interface. In addition to >>> the methods described in section 1-2, a diagnostic command developer has >>> to provide three methods: >>> >>> int get_num_arguments() >>> >>> which returns the number of option and arguments supported by the >>> command. >>> >>> GrowableArray* get_argument_name_array() >>> >>> which provides the name of the arguments supported by the command. >>> >>> GrowableyArray* get_argument_info_array() >>> >>> which provides the description of each argument with a DCmdArgumentInfo >>> instance. DCmdArgumentInfo is a C++ class used by the framework to >>> generate the sun.com.management.DcmdArgumentInfo instances. This is done >>> automatically and the diagnostic command developer doesn't need to know >>> how to create Java objects from the runtime. >>> >>> 4 - The Diagnostic Commands >>> >>> To avoid name collisions between diagnostic commands coming from >>> different projects, use of a flat name space should be avoided and >>> a more structured organization is recommended. The framework itself >>> doesn't depend on this organization, so it will be a set of rules >>> defining a convention in the way commands are named. >>> >>> Diagnostic commands can easily organized in a hierarchical way, so the >>> template for a command name can be: >>> >>> .[sub-domain.] >>> >>> This template can be extended with sub-sub-domains and so on. >>> >>> A special set of commands without domain will be reserved for the >>> commands related to the diagnostic framework itself, like the "help" >>> command. >>> >>> >>> Thanks, >>> >>> Fred >>> > -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From kelly.ohair at oracle.com Mon Dec 12 16:00:06 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Mon, 12 Dec 2011 08:00:06 -0800 Subject: Need reviewer - testing changes In-Reply-To: <4EE5DF40.8070903@oracle.com> References: <4EE5DF40.8070903@oracle.com> Message-ID: On Dec 12, 2011, at 3:02 AM, Alan Bateman wrote: > On 11/12/2011 21:48, Kelly O'Hair wrote: >> Re-organized the testing targets, moved jdk_tools1 out of the default test targets. >> >> Running "cd test&& make" should run the default test list, and should be 100% pass, in theory. >> (Note: Use of the jdk/test/Makefile utilizes jtreg with a default set of options running a default >> set of tests where some tests are excluded, e.g. those marked @ignore or listed in jdk/test/ProblemList.txt) >> >> The JPRT system runs the same tests, with jdk/test/Makefile, just on multiple platforms. >> >> Removed some -target 1.5 issues for the Mac, just getting a jump on jdk8 mac changes. >> >> 7119829: Adjust default jprt testing configuration >> 7117110: Remove target 1.5 from jaxp and jaxws repo builds for mac >> http://cr.openjdk.java.net/~ohair/openjdk8/jdk8-tl-jprt/webrev/ >> >> -kto > This changes looks okay to me. The only thing is that the list of default test targets is essentially duplicated in 3 places (top-level repo, jdk repo, and jdk/test/Makefile because of JDK_DEFAULT_TARGETS) and it would be nice to somehow avoid that. I would like to avoid the duplication too, but just haven't figured out a clean way to do that yet. It will need to wait for another day. :^( -kto > > -Alan > From paul.hohensee at oracle.com Mon Dec 12 16:11:13 2011 From: paul.hohensee at oracle.com (Paul Hohensee) Date: Mon, 12 Dec 2011 11:11:13 -0500 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE6243B.6070200@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> <4EE6243B.6070200@oracle.com> Message-ID: <4EE627A1.8020004@oracle.com> Looks good. Thanks, Paul On 12/12/11 10:56 AM, Frederic Parain wrote: > Minor updates: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.04/ > > Fred > > On 12/12/11 03:29 PM, Frederic Parain wrote: >> Hi Paul, >> >> Thank you for the review. >> I've applied all your recommendations except the refactoring >> in diagnosticCommandFramework.cpp (too few lines can be really >> factored out without passing many arguments). >> >> New webrev is here: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >> >> Regards, >> >> Fred >> >> On 12/ 8/11 07:26 PM, Paul Hohensee wrote: >>> For the hotspot part at >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> >>> Most of my comments are style-related. Nice job on the implementation >>> architecture. >>> >>> In attachListener.cpp: >>> >>> You might want to delete the first "return JNI_OK;" line, since the >>> code >>> under >>> HAS_PENDING_EXCEPTION just falls through. >>> >>> In jmm.h: >>> >>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the >>> existing declarations. Add a newline just before it on line 322. >>> >>> >>> In diagnosticFramework.hpp: >>> >>> Fix indenting for lines 63-66, insert blank before "size_t" on line 48. >>> >>> Hotspot convention is that getter method names don't include a "get_" >>> prefix. >>> So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). >>> Similarly, getters such as is_enabled() should retrieve a field named >>> "_is_enabled" >>> rather than one named "enabled". You follow the "_is_enabled" >>> convention >>> in other places such as GenDCmdArgument. Or you could use enabled() to >>> get the value of the _enabled field. >>> >>> Also generally, I'd use accessor methods in the implementation of more >>> complex member methods rather than access the underlying fields >>> directly. >>> E.g. in GenDCmdArgument::read_value, I'd use is_set() and >>> set_is_set(true), >>> (set_is_set() is not actually defined, but should be) rather than >>> directly >>> accessing _is_set. Though sometimes doing this is too much of a pain >>> with fields whose type is a template argument, as in the >>> DCmdArggument::parse_value() method in diagnosticArgument.cpp. >>> >>> For easy readability, it'd be nice to line up field names (the ones >>> with an >>> _ prefix) at the same column. >>> >>> On line 200, "instanciated" -> "instantiated" >>> >>> On line 218, I'd use "heap_allocated" rather than "heap" for the formal >>> arg name. >>> >>> On line 248, you could indent the text to start underneath >>> "outputStream". >>> I generally find that indenting arguments lines (formal or actual) so >>> they line >>> up with the first argument position make the code more readable, but >>> I'm >>> not >>> religious about it. >>> >>> On line 265, "instanciated" -> "instantiated" >>> >>> DCmdFactorys are members of a singly-linked list, right? If so, it'd be >>> good to >>> have a comment to that effect on the declaration of _next. >>> >>> On line 322, insert a blank before "true". You might fix this in other >>> places >>> where there's no blank between a comma in an argument list and the >>> following parameter value. >>> >>> >>> In diagnosticCommandFramework.cpp: >>> >>> The code from lines 80-95 and 105-120 is identical. Factor out? >>> >>> >>> In diagnosticArgument.cpp: >>> >>> On line 41, insert blanks before the actual arguments. (see above >>> generic comment) >>> >>> On line 77, the "if" is indented one space too many. >>> >>> >>> In management.cpp: >>> >>> I'd be consistent with having or not having a space between "while", >>> "if" and "for" >>> and the following "(" in this and your other code. Most hotspot code >>> has >>> a space. >>> >>> >>> Thanks, >>> >>> Paul >>> >>> >>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>> Hi All, >>>> >>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>> because changes are pretty big and touch all these areas] >>>> >>>> Here's a framework for issuing diagnostics commands to the JVM. >>>> Diagnostic commands are actions executed inside the JVM mainly >>>> for monitoring or management purpose. This work has two parts. >>>> The first part is in the hotspot repository and contains the >>>> framework itself with two diagnostic commands. The second >>>> part is in the JDK repository and contains the command line >>>> utility to invoke diagnostic commands as well as the >>>> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >>>> extensions allow a remote client to discover and invoke >>>> diagnostic commands using a JMX connection. >>>> >>>> This changeset only contains two diagnostic commands, more >>>> commands will be added in the future, as a standalone effort >>>> to improve the monitoring and management services of the >>>> JVM, or as part of other projects. >>>> >>>> Webrevs are here: >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>> >>>> Here's a technical description of this work: >>>> >>>> 1 - The Diagnostic Command Framework >>>> 1-1 Overview >>>> >>>> The diagnostic command framework is fully implemented in native code >>>> and relies on the HotSpot's internal exception mechanism. >>>> The rational of a pure native implementation is to be able to execute >>>> diagnostic commands even in critical situations like an OutOfMemory >>>> error. All diagnostic commands are registered in a single list, and >>>> two >>>> flags control the way a user can interact with them. The "hidden" flag >>>> prevents a diagnostic command from appearing in the list of available >>>> commands returned by the "help" command. However, it's still >>>> possible to >>>> get the detailed help message for a hidden command with the "help >>>> " syntax (but it requires to know the name of the hidden >>>> command). The second flag is "enabled" and it controls if a command >>>> can >>>> be invoked or not. When listed with the "help" commands, disabled >>>> commands appear with a "[disabled]" label in their description. If the >>>> user tries to invoke a disabled command, an error message is returned >>>> and the command is not run. This error message can be customized on a >>>> per command base. The framework just provides these two flags with >>>> their >>>> semantic, it doesn't provide any policy or mechanism to set or modify >>>> these flags. These actions will be delegated to the JVM or special >>>> diagnostic commands. >>>> >>>> 1-2 Implementation >>>> >>>> All diagnostic commands are implemented as subclasses of the DCmd >>>> class >>>> defined in services/diagnosticFramework.hpp. Here's the layout of the >>>> DCmd class and the list of methods that a new command has to define or >>>> overwrite: >>>> >>>> class DCmd { >>>> DCmd(outputStream *output); >>>> >>>> static const char *get_name(); >>>> >>>> static const char *get_description(); >>>> >>>> static const char *get_disabled_message(); >>>> >>>> static const char *get_impact(); >>>> >>>> static int get_num_arguments(); >>>> >>>> virtual void print_help(outputStream* out); >>>> >>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>> >>>> virtual void execute(TRAPS); >>>> >>>> virtual void reset(TRAPS); >>>> >>>> virtual void cleanup(); >>>> >>>> virtual GrowableArray* get_argument_name_array(); >>>> >>>> virtual GrowableArray* get_argument_info_array(); >>>> } >>>> >>>> A diagnostic command is always instantiated with an outputStream in >>>> parameter. This outputStream can point either to a file, a buffer or a >>>> socket (see the ostream.hpp file). >>>> >>>> The get_name() method returns the string that will identify the >>>> command >>>> (i.e. the string to put on the command line to invoke it). >>>> >>>> The get_description() methods returns the global description of the >>>> command. >>>> >>>> The get_disabled_message() returns the customized message to return >>>> when >>>> the command is disabled, without having to instantiate the command. >>>> >>>> The get_impact() returns a description of the intrusiveness of the >>>> diagnostic command on the Java Virtual Machine behavior. The rational >>>> for this method is that some diagnostic commands can seriously disrupt >>>> the behavior of the Java Virtual Machine (for instance a Thread >>>> Dump for >>>> an application with several tens of thousands of threads, or a Head >>>> Dump >>>> with a 40GB+ heap size) and other diagnostic commands have no serious >>>> impact on the JVM (for instance, getting the command line arguments or >>>> the JVM version). The recommended format for the description is >>>> >>> level>: [longer description], where the impact level is selected among >>>> this list: {low, medium, high}. The optional longer description can >>>> provide more specific details like the fact that Thread Dump impact >>>> depends on the heap size. >>>> >>>> The get_num_arguments() returns the number of options/arguments >>>> recognized by the diagnostic command. This method is only used by the >>>> JMX interface support (see below). >>>> >>>> The print_help() methods prints a detailed help on the outputStream >>>> passed in argument. The detailed help contains the list of all >>>> supported >>>> options with their type and description. >>>> >>>> The parse() method is in charge of parsing the command arguments. Each >>>> command is free to implement its own argument parser. However, an >>>> argument parser framework is provided (see section 1-3) to ease the >>>> implementation, but its use is optional. The parse method takes a >>>> delimiter character in argument, which is used to mark the limit >>>> between >>>> two arguments (typically invocation from jcmd will use a space >>>> character >>>> as a delimiter while invocation from the JVM command line parsing code >>>> will use a comma as a delimiter). >>>> >>>> The execute() method is naturally the one to invoke to get the >>>> diagnostic command executed. The parse() and the execute() methods are >>>> dissociated, so it's a possible perform the argument parsing in one >>>> thread, and delegate the execution to another thread, as long as the >>>> diagnostic command doesn't reference thread local variables. The >>>> framework allows several instances of the same diagnostic command >>>> to be >>>> executed in parallel. If for some reasons concurrent executions should >>>> not be allowed for a given diagnostic command, this is the >>>> responsibility of the diagnostic command implementor to enforce this >>>> rule, for instance by protecting the body of the execute() method >>>> with a >>>> global lock. >>>> >>>> The reset() method is used to initialize the internal fields of the >>>> diagnostic command or to reset the internal fields to their initial >>>> value to be able to re-use an already allocated diagnostic command >>>> instance. >>>> >>>> The cleanup() method is used to perform perform cleanup (like >>>> freeing of >>>> all memory allocated to store internal data). The DCmd extends the >>>> ResourceObj class, so when allocated in a ResourceArea, destructors >>>> cannot be used to perform cleanup. To ensure that cleanup is performed >>>> in all cases, it is recommended to create a DCmdMark instance for each >>>> DCmd instance. DCmdMark is a stack allocated object with a pointer >>>> to a >>>> DCmd instance. When the DCmdMark is destroyed, its destructor calls >>>> the >>>> cleanup() method of the DCmd instance it points to. If the DCmd >>>> instance >>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>> memory >>>> allocated to store the DCmd instance. >>>> >>>> The get_argument_name_array() and get_argument_info_array() are >>>> related >>>> to the JMX interface of the diagnostic command framework, so they are >>>> described in section 3. >>>> >>>> 1-3 DCmdParser framework >>>> >>>> The DCmdParser class is an optional framework to help development of >>>> argument parsers. It provides many features required by the diagnostic >>>> command framework (generation of the help message or the argument >>>> descriptions for the JMX interface) but all these features can >>>> easily be >>>> re-implemented if a developer decides not to use the DCmdParser >>>> framework. >>>> >>>> The DCmdParser class is relying on the DCmdArgument template. This >>>> template must be used to define the different types of argument the >>>> parser will have to handle. When a new specialization of the >>>> template is >>>> done, three methods have to be provided: >>>> >>>> void parse_value(const char *str,size_t len,TRAPS); >>>> void init_value(TRAPS); >>>> void destroy_value(); >>>> >>>> The parse_value() method is used to convert a string into an argument >>>> value. The print_value() method is used to display the default value >>>> (support for the detailed help message). The init_value() method is >>>> used >>>> to initialize or reset the argument value. The destroy_value() >>>> method is >>>> a clean-up method (useful when the argument has allocated some C-Heap >>>> memory to store its value and this memory has to be freed before >>>> destroying the DCmdArgument instance). >>>> >>>> The DCmdParser makes a distinction between options and arguments. >>>> Options are identified by a key name that must appear on the command >>>> line, while argument are identified just by the position of the >>>> argument >>>> on the command line. Options use the = syntax. In case of >>>> boolean options, the '=' part of the syntax can be omitted >>>> to set >>>> the option to true. Arguments are just sequences characters >>>> delimited by >>>> a separator character. This separator can be specified at runtime when >>>> invoking the diagnostic command framework. If an argument contain a >>>> character that could be used as a delimiter, it's possible to enclose >>>> the argument between single or double quotes. Options are arguments >>>> are >>>> instantiated using the same DCmdArgument class but they're registered >>>> differently to the DCmdParser. >>>> >>>> The way to use the DCmdParser is to declare the parser and the >>>> option/arguments as fields of the diagnostic command class (which is >>>> itself a sub-class of the DCmd class), like this: >>>> >>>> >>>> class EchoDCmd : public DCmd { >>>> protected: >>>> DCmdParser _dcmdparser; >>>> >>>> DCmdArgument _required; >>>> >>>> DCmdArgument _intval; >>>> >>>> DCmdArgument _boolval; >>>> >>>> DCmdArgument _stringval; >>>> >>>> DCmdArgument _first_arg; >>>> >>>> DCmdArgument _second_arg; >>>> >>>> DCmdArgument _optional_arg; >>>> >>>> } >>>> >>>> The parser and the options/arguments must be initialized before the >>>> diagnostic command class, and the options/arguments have to be >>>> registered to the parser like this: >>>> >>>> EchoDCmd(outputStream *output) : DCmd(output), >>>> _stringval("-strval","a string argument","STRING",false), >>>> >>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>> >>>> _intval("-intval","an integer argument","INTEGER",false), >>>> >>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>> >>>> _fist_arg("first argument","a string argument","STRING",true), >>>> >>>> _second_arg("second argument,"an integer argument,"INTEGER",true), >>>> >>>> _optional_arg("optional argument","an optional string >>>> argument","STRING","false") >>>> >>>> { >>>> >>>> _dcmdparser.add_dcmd_option(&_stringval) >>>> >>>> _dcmdparser.add_dcmd_option(&_boolval); >>>> >>>> _dcmdparser.add_dcmd_option(&_intval); >>>> >>>> _dcmdparser.add_dcmd_option(&_required); >>>> >>>> _dcmdparser.add_argument(&_first_arg); >>>> >>>> _dcmdparser.add_argument(&_second_arg); >>>> >>>> _dcmdparser.add_argument(&_optional_arg); >>>> }; >>>> >>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >>>> argument/option to the parser. The option/argument constructor >>>> takes the >>>> name of the option/argument, its description, a string describing its >>>> type and a boolean to specify if the option/argument is mandatory or >>>> not. The parser doesn't support option/argument duplicates (having the >>>> same name) but the code currently doesn't check for duplicates.The >>>> order >>>> used to register options has no impact on the parser. However, the >>>> order >>>> used to register arguments is critical because the parser will use the >>>> same order to parse the command line. In the example above, the parser >>>> expects to have a first argument of type STRING (parsed using >>>> _first_arg), then a second argument of type INTEGER (parsed using >>>> _second_arg) and optionally a third parameter of type STRING (parsed >>>> using _optional_arg). A mandatory option or argument has to be specify >>>> every time the command is invoked. If it is missing, an exception is >>>> thrown at the end of the parsing. Optional arguments have to be >>>> registered after mandatory arguments. An optional argument will be >>>> considered for parsing only if all arguments before it (mandatory or >>>> not) have already been used to parse the command line. >>>> >>>> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >>>> instance. The rational for this design is to limit the number of >>>> C-heap >>>> allocations but also to be able to pre-allocate diagnostic command >>>> instances for critical situations. If the process is running out of >>>> C-heap space, it's not possible to instantiate new diagnostic commands >>>> to troubleshoot the situation. By pre-allocating some diagnostic >>>> commands, it will be possible to run them even in this critical >>>> situation. Of course, the diagnostic command itself should not try to >>>> allocate memory during its execution, this prevents the diagnostic >>>> command to use variable length arguments like strings. By nature, >>>> pre-allocated diagnostic commands aim to be re-usable, this is the >>>> purpose of the reset() method which restores the default status of all >>>> arguments. >>>> >>>> 1-4 Internal invocation >>>> >>>> Using a diagnostic command from the JVM itself is pretty easy: >>>> instantiate the class and invoke the parse() method then the execute() >>>> method. A diagnostic command can be instantiated from inside the JVM >>>> even it is not registered. This is a difference with the external >>>> invocations (from jcmd or JMX) that require the command to be >>>> registered. >>>> >>>> 2 - The JCmd interface >>>> >>>> Diagnostic commands can also be invoked from outside the JVM process, >>>> using the new 'jcmd' utility. The jcmd program uses the attach API >>>> to connect to the JVM, send requests and receive results. The >>>> jcmd utility must be launched on the same machine than the one running >>>> the JVM (its a local tool). Launched without arguments, jcmd >>>> displays a >>>> list of all JVMs running on the machine. The jcmd source code is in >>>> the jdk repository like other existing j* tools. >>>> >>>> To execute a diagnostic command in a particular JVM, the generic >>>> syntax is: >>>> >>>> jcmd [arguments] >>>> >>>> The attachListener has been modified to recognized the jcmd requests. >>>> When a jcmd request is identified, it is parsed to extract the command >>>> name. The JVM performs a look up of this command in a list of >>>> registered >>>> commands. To be executable by an external request, a diagnostic >>>> command >>>> has to be registered. The registration is performed with the >>>> DCmdFactory >>>> class (see services/management.cpp). >>>> >>>> 3 - The JMX interface >>>> >>>> The framework provides a JMX based interface to the diagnostic >>>> commands. >>>> This interface allows remote invocation of diagnostic commands >>>> through a >>>> JMX connection. >>>> >>>> 3-1 The interface >>>> >>>> The information related to the diagnostic commands are accessible >>>> through new methods added to the >>>> com.sun.management.HotspotDiagnosticMXBean: >>>> >>>> public List getDiagnosticCommands(); >>>> >>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >>>> >>>> public List >>>> getDiagnosticCommandInfo(List >>>> command); >>>> >>>> public List getDiagnosticCommandInfo(); >>>> >>>> public String execute(String commandLine) throws >>>> IllegalArgumentException ; >>>> >>>> public String execute(String cmd, String... arguments) >>>> throws IllegalArgumentException; >>>> >>>> >>>> The getDiagnosticCommands() method returns an array containing the >>>> names >>>> of the not-hidden registered diagnostic commands. >>>> >>>> The three getDiagnosticCommandInfo() methods return one or several >>>> diagnostic command descriptions using the DiagnosticCommandInfo class. >>>> >>>> The two execute() methods allow the user the invoke a diagnostic >>>> command >>>> in different ways. >>>> >>>> The DiagnosticCommandInfo class is describing a diagnostic command >>>> with >>>> the following information: >>>> >>>> public class DiagnosticCommandInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getImpact(); >>>> >>>> public boolean isEnabled(); >>>> >>>> public List getArgumentsInfo(); >>>> } >>>> >>>> The getName() method returns the name of the diagnostic command. This >>>> name is the one to use in execute() methods to invoke the diagnostic >>>> command. >>>> >>>> The getDescription() method returns a general description of the >>>> diagnostic command. >>>> >>>> The getImpact() method returns a description of the intrusiveness of >>>> diagnostic command. >>>> >>>> The isEnabled() method returns true if the method is enabled, false if >>>> it is disabled. A disabled method cannot be executed. >>>> >>>> The getArgumentsInfo() returns a list of descriptions for the >>>> options or >>>> arguments recognized by the diagnostic command. Each >>>> option/argument is >>>> described by a DiagnosticCommandArgumentInfo instance: >>>> >>>> public class DiagnosticCommandArgumentInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getType(); >>>> >>>> public String getDefault(); >>>> >>>> public boolean isMandatory(); >>>> >>>> public boolean isOption(); >>>> >>>> public int getPosition(); >>>> } >>>> >>>> If the DiagnosticCommandArgumentInfo instance describes an option, >>>> isOption() returns true and getPosition() returns -1. Otherwise, when >>>> the DiagnosticCommandArgumentInfo instance describes an argument, >>>> isOption() returns false and getPosition() returns the expected >>>> position >>>> for this argument. The position of an argument is defined >>>> relatively to >>>> all arguments passed on the command line, options are not considered >>>> when defining an argument position. The getDefault() method returns >>>> the >>>> default value of the argument if a default has been defined, otherwise >>>> it returns null. >>>> >>>> 3-2 The implementation >>>> >>>> The framework has been designed in a way that prevents diagnostic >>>> command developers to worry about the JMX interface. In addition to >>>> the methods described in section 1-2, a diagnostic command >>>> developer has >>>> to provide three methods: >>>> >>>> int get_num_arguments() >>>> >>>> which returns the number of option and arguments supported by the >>>> command. >>>> >>>> GrowableArray* get_argument_name_array() >>>> >>>> which provides the name of the arguments supported by the command. >>>> >>>> GrowableyArray* get_argument_info_array() >>>> >>>> which provides the description of each argument with a >>>> DCmdArgumentInfo >>>> instance. DCmdArgumentInfo is a C++ class used by the framework to >>>> generate the sun.com.management.DcmdArgumentInfo instances. This is >>>> done >>>> automatically and the diagnostic command developer doesn't need to >>>> know >>>> how to create Java objects from the runtime. >>>> >>>> 4 - The Diagnostic Commands >>>> >>>> To avoid name collisions between diagnostic commands coming from >>>> different projects, use of a flat name space should be avoided and >>>> a more structured organization is recommended. The framework itself >>>> doesn't depend on this organization, so it will be a set of rules >>>> defining a convention in the way commands are named. >>>> >>>> Diagnostic commands can easily organized in a hierarchical way, so the >>>> template for a command name can be: >>>> >>>> .[sub-domain.] >>>> >>>> This template can be extended with sub-sub-domains and so on. >>>> >>>> A special set of commands without domain will be reserved for the >>>> commands related to the diagnostic framework itself, like the "help" >>>> command. >>>> >>>> >>>> Thanks, >>>> >>>> Fred >>>> >> > From mandy.chung at oracle.com Mon Dec 12 17:35:49 2011 From: mandy.chung at oracle.com (Mandy Chung) Date: Mon, 12 Dec 2011 09:35:49 -0800 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE61040.5040704@oracle.com> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> <34278e49-efbc-4370-ab36-a50331a9ff65@default> <4EE61040.5040704@oracle.com> Message-ID: <4EE63B75.2000309@oracle.com> On 12/12/2011 6:31 AM, Frederic Parain wrote: > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.03/ The jdk change looks okay to me. Mandy From xueming.shen at oracle.com Mon Dec 12 19:22:35 2011 From: xueming.shen at oracle.com (Xueming Shen) Date: Mon, 12 Dec 2011 11:22:35 -0800 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EE2F6AD.7050701@oracle.com> References: <4EE2F6AD.7050701@oracle.com> Message-ID: <4EE6547B.406@oracle.com> Hi Steve, The \x3[0-9] approach is interesting, it appears to solve the problem without paying a higher cost I originally thought (looking back, for example). The logic of initializing/setting/unsetting of "beginQuote" to true/false appears to be incorrect when there are multiple \Qn...\E in one pattern. Ln#1622 setting will always be followed by Ln#1630, if I read the code correctly. For example Pattern pattern = Pattern.compile("\\011\\Q1sometext\\E\\011\\Q2sometext\\E"); Matcher matcher = pattern.matcher("\t1sometext\t2sometext"); System.out.printf("find=%b%n", matcher.find()); will still return false? -Sherman On 12/09/2011 10:05 PM, Stephen Flores wrote: > Please review the following webrev (includes new test to demonstrate > the bug): > > http://cr.openjdk.java.net/~sflores/6990617/ > > for bug: 6990617 Regular expression doesn't match if unicode character > next to a digit. > > A DESCRIPTION OF THE PROBLEM : > > Unicode characters are represented as \\+number. > For instance, one could write: > Pattern p = Pattern.compile("\\011some text\\012"); > Matcher m = p.matcher("\tsome text\n"); > System.out.println(m.find()); // yields "true" > > However, if we want to match a string with a digit next to > the unicode character, it doesn't match (whether we "quote" > the regular expression or not). Note the "1" next to the tab > character (unicode 011). > Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); > Matcher m = p.matcher("\t1some text\n"); > System.out.println(m.find()); // yields "false" > > This happens because Pattern accepts either \\0011 or \\011 for > the same character. From the javadoc: > > \0nn The character with octal value 0nn (0 <= n <= 7) > \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) > > Evaluation: > > Pattern.RemoveQEQuoting() does NOT handle this situation correctly. > The existing implementation now simply copies all ASCII.isAlnum() > characters when handing a quote. > > Description of fix: > > In the method Pattern.RemoveQEQuoting any ASCII digit at the > beginning of a quote will now be prefixed by "\x3" (not just \ > because this would be a backref). 0x30 is the ASCII code for '0'. > > Thanks, > > Steve. From daniel.daugherty at oracle.com Mon Dec 12 20:08:45 2011 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Mon, 12 Dec 2011 13:08:45 -0700 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE6243B.6070200@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> <4EE6243B.6070200@oracle.com> Message-ID: <4EE65F4D.7040109@oracle.com> On 12/12/11 8:56 AM, Frederic Parain wrote: > Minor updates: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.04/ src/share/vm/services/attachListener.cpp The new include should be in alpha-order (between lines 36 & 37). I'm pretty sure that's the new style... Block comment on lines 152-155 should be in '//' style and not in JavaDoc style (/** ... */) src/share/vm/services/jmm.h lines 192-208 - HotSpot convention is to mimic the existing style in a file. For these structs, the field names should all be lined up (see 181-188 for an example). src/share/vm/services/management.cpp line 2126 calls JNIHandles::make_local(), but this is a JVM_ENTRY wrapped function which means it depends on VM_ENTRY_BASE which has a HandleMarkCleaner in it. Since this is a make_local() call, won't the local JNIHandle get scrubbed on the way back to the caller? line 2231 also calls JNIHandles::make_local() from a JVM_ENTRY wrapped function. Same local JNIHandle scrubbing issue? src/share/vm/services/diagnosticArgument.hpp lines 45-50 - too much indent; should be 4 spaces src/share/vm/services/diagnosticArgument.cpp HotSpot style is generally 'if (' and not 'if(' src/share/vm/services/diagnosticCommand.hpp lines 28-36 - includes should be in alpha order lines 44, 64 - Parameter defaults in new code is generally frowned upon in HotSpot. They're used when adding a parameter to existing code to avoid changing existing calls where the default is OK. (I happen to disagree with that last part and I think that all calls should be updated just to make sure your reviewers see all uses, but I'm just one cranky voice... :-)) src/share/vm/services/diagnosticCommand.cpp line 28: includes should be in alpha order lines 31-33 - should be some indent here line 74: It would be useful to display the command that can't be found: help foo Help unavailable: 'foo': No such command or something like that. line 101: just FYI, a ResourceMark without a Thread parameter can be expensive. Not an issue for HelpDCmd::num_arguments(). line 103: HotSpot style is generally 'if (' and not 'if(' src/share/vm/services/diagnosticFramework.hpp line 38: typo: 'provides method' -> 'provides methods' line 40: typo: 'keywor' -> 'keyword' lines 43-46 - fields nicely indented here, but not in other new header files. Any particular reason? lines 48, 154, 218, 286, 324 - Parameter defaults again. line 55: is_stop should be: return !is_empty() && strncmp("stop", _cmd, _cmd_len) == 0; !strncmp() is frowned upon and spaces between params line 82 - returns a local variable; that shouldn't work. line 155: missing a space after '=' lines 256, 258: HotSpot style is generally 'if (' and not 'if(' line 304: typo: 'DCmdFActory' -> 'DCmdFactory' line 306: typo: 'command to be executed' -> 'command from being executed' src/share/vm/services/diagnosticFramework.cpp line 55: _cmd_len = cmd_end - line; This length includes any leading white space that was skipped on lines 42-44. It seems odd that '_cmd' points to the first non-whitespace in the command, but _cmd_len includes the leading white space. If you change the _cmd_len calculation, then you have to also change the logic on line 58 so that args_len is also not too long. lines 79, 104: typo: 'simple' -> 'single' line 318 - what is 'idx' used for? line 367: HotSpot style is generally 'if (' and not 'if(' lines 371, 372, 380, 403, 416: space after comma Dan > > Fred > > On 12/12/11 03:29 PM, Frederic Parain wrote: >> Hi Paul, >> >> Thank you for the review. >> I've applied all your recommendations except the refactoring >> in diagnosticCommandFramework.cpp (too few lines can be really >> factored out without passing many arguments). >> >> New webrev is here: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >> >> Regards, >> >> Fred >> >> On 12/ 8/11 07:26 PM, Paul Hohensee wrote: >>> For the hotspot part at >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> >>> Most of my comments are style-related. Nice job on the implementation >>> architecture. >>> >>> In attachListener.cpp: >>> >>> You might want to delete the first "return JNI_OK;" line, since the >>> code >>> under >>> HAS_PENDING_EXCEPTION just falls through. >>> >>> In jmm.h: >>> >>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the >>> existing declarations. Add a newline just before it on line 322. >>> >>> >>> In diagnosticFramework.hpp: >>> >>> Fix indenting for lines 63-66, insert blank before "size_t" on line 48. >>> >>> Hotspot convention is that getter method names don't include a "get_" >>> prefix. >>> So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). >>> Similarly, getters such as is_enabled() should retrieve a field named >>> "_is_enabled" >>> rather than one named "enabled". You follow the "_is_enabled" >>> convention >>> in other places such as GenDCmdArgument. Or you could use enabled() to >>> get the value of the _enabled field. >>> >>> Also generally, I'd use accessor methods in the implementation of more >>> complex member methods rather than access the underlying fields >>> directly. >>> E.g. in GenDCmdArgument::read_value, I'd use is_set() and >>> set_is_set(true), >>> (set_is_set() is not actually defined, but should be) rather than >>> directly >>> accessing _is_set. Though sometimes doing this is too much of a pain >>> with fields whose type is a template argument, as in the >>> DCmdArggument::parse_value() method in diagnosticArgument.cpp. >>> >>> For easy readability, it'd be nice to line up field names (the ones >>> with an >>> _ prefix) at the same column. >>> >>> On line 200, "instanciated" -> "instantiated" >>> >>> On line 218, I'd use "heap_allocated" rather than "heap" for the formal >>> arg name. >>> >>> On line 248, you could indent the text to start underneath >>> "outputStream". >>> I generally find that indenting arguments lines (formal or actual) so >>> they line >>> up with the first argument position make the code more readable, but >>> I'm >>> not >>> religious about it. >>> >>> On line 265, "instanciated" -> "instantiated" >>> >>> DCmdFactorys are members of a singly-linked list, right? If so, it'd be >>> good to >>> have a comment to that effect on the declaration of _next. >>> >>> On line 322, insert a blank before "true". You might fix this in other >>> places >>> where there's no blank between a comma in an argument list and the >>> following parameter value. >>> >>> >>> In diagnosticCommandFramework.cpp: >>> >>> The code from lines 80-95 and 105-120 is identical. Factor out? >>> >>> >>> In diagnosticArgument.cpp: >>> >>> On line 41, insert blanks before the actual arguments. (see above >>> generic comment) >>> >>> On line 77, the "if" is indented one space too many. >>> >>> >>> In management.cpp: >>> >>> I'd be consistent with having or not having a space between "while", >>> "if" and "for" >>> and the following "(" in this and your other code. Most hotspot code >>> has >>> a space. >>> >>> >>> Thanks, >>> >>> Paul >>> >>> >>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>> Hi All, >>>> >>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>> because changes are pretty big and touch all these areas] >>>> >>>> Here's a framework for issuing diagnostics commands to the JVM. >>>> Diagnostic commands are actions executed inside the JVM mainly >>>> for monitoring or management purpose. This work has two parts. >>>> The first part is in the hotspot repository and contains the >>>> framework itself with two diagnostic commands. The second >>>> part is in the JDK repository and contains the command line >>>> utility to invoke diagnostic commands as well as the >>>> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >>>> extensions allow a remote client to discover and invoke >>>> diagnostic commands using a JMX connection. >>>> >>>> This changeset only contains two diagnostic commands, more >>>> commands will be added in the future, as a standalone effort >>>> to improve the monitoring and management services of the >>>> JVM, or as part of other projects. >>>> >>>> Webrevs are here: >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>> >>>> Here's a technical description of this work: >>>> >>>> 1 - The Diagnostic Command Framework >>>> 1-1 Overview >>>> >>>> The diagnostic command framework is fully implemented in native code >>>> and relies on the HotSpot's internal exception mechanism. >>>> The rational of a pure native implementation is to be able to execute >>>> diagnostic commands even in critical situations like an OutOfMemory >>>> error. All diagnostic commands are registered in a single list, and >>>> two >>>> flags control the way a user can interact with them. The "hidden" flag >>>> prevents a diagnostic command from appearing in the list of available >>>> commands returned by the "help" command. However, it's still >>>> possible to >>>> get the detailed help message for a hidden command with the "help >>>> " syntax (but it requires to know the name of the hidden >>>> command). The second flag is "enabled" and it controls if a command >>>> can >>>> be invoked or not. When listed with the "help" commands, disabled >>>> commands appear with a "[disabled]" label in their description. If the >>>> user tries to invoke a disabled command, an error message is returned >>>> and the command is not run. This error message can be customized on a >>>> per command base. The framework just provides these two flags with >>>> their >>>> semantic, it doesn't provide any policy or mechanism to set or modify >>>> these flags. These actions will be delegated to the JVM or special >>>> diagnostic commands. >>>> >>>> 1-2 Implementation >>>> >>>> All diagnostic commands are implemented as subclasses of the DCmd >>>> class >>>> defined in services/diagnosticFramework.hpp. Here's the layout of the >>>> DCmd class and the list of methods that a new command has to define or >>>> overwrite: >>>> >>>> class DCmd { >>>> DCmd(outputStream *output); >>>> >>>> static const char *get_name(); >>>> >>>> static const char *get_description(); >>>> >>>> static const char *get_disabled_message(); >>>> >>>> static const char *get_impact(); >>>> >>>> static int get_num_arguments(); >>>> >>>> virtual void print_help(outputStream* out); >>>> >>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>> >>>> virtual void execute(TRAPS); >>>> >>>> virtual void reset(TRAPS); >>>> >>>> virtual void cleanup(); >>>> >>>> virtual GrowableArray* get_argument_name_array(); >>>> >>>> virtual GrowableArray* get_argument_info_array(); >>>> } >>>> >>>> A diagnostic command is always instantiated with an outputStream in >>>> parameter. This outputStream can point either to a file, a buffer or a >>>> socket (see the ostream.hpp file). >>>> >>>> The get_name() method returns the string that will identify the >>>> command >>>> (i.e. the string to put on the command line to invoke it). >>>> >>>> The get_description() methods returns the global description of the >>>> command. >>>> >>>> The get_disabled_message() returns the customized message to return >>>> when >>>> the command is disabled, without having to instantiate the command. >>>> >>>> The get_impact() returns a description of the intrusiveness of the >>>> diagnostic command on the Java Virtual Machine behavior. The rational >>>> for this method is that some diagnostic commands can seriously disrupt >>>> the behavior of the Java Virtual Machine (for instance a Thread >>>> Dump for >>>> an application with several tens of thousands of threads, or a Head >>>> Dump >>>> with a 40GB+ heap size) and other diagnostic commands have no serious >>>> impact on the JVM (for instance, getting the command line arguments or >>>> the JVM version). The recommended format for the description is >>>> >>> level>: [longer description], where the impact level is selected among >>>> this list: {low, medium, high}. The optional longer description can >>>> provide more specific details like the fact that Thread Dump impact >>>> depends on the heap size. >>>> >>>> The get_num_arguments() returns the number of options/arguments >>>> recognized by the diagnostic command. This method is only used by the >>>> JMX interface support (see below). >>>> >>>> The print_help() methods prints a detailed help on the outputStream >>>> passed in argument. The detailed help contains the list of all >>>> supported >>>> options with their type and description. >>>> >>>> The parse() method is in charge of parsing the command arguments. Each >>>> command is free to implement its own argument parser. However, an >>>> argument parser framework is provided (see section 1-3) to ease the >>>> implementation, but its use is optional. The parse method takes a >>>> delimiter character in argument, which is used to mark the limit >>>> between >>>> two arguments (typically invocation from jcmd will use a space >>>> character >>>> as a delimiter while invocation from the JVM command line parsing code >>>> will use a comma as a delimiter). >>>> >>>> The execute() method is naturally the one to invoke to get the >>>> diagnostic command executed. The parse() and the execute() methods are >>>> dissociated, so it's a possible perform the argument parsing in one >>>> thread, and delegate the execution to another thread, as long as the >>>> diagnostic command doesn't reference thread local variables. The >>>> framework allows several instances of the same diagnostic command >>>> to be >>>> executed in parallel. If for some reasons concurrent executions should >>>> not be allowed for a given diagnostic command, this is the >>>> responsibility of the diagnostic command implementor to enforce this >>>> rule, for instance by protecting the body of the execute() method >>>> with a >>>> global lock. >>>> >>>> The reset() method is used to initialize the internal fields of the >>>> diagnostic command or to reset the internal fields to their initial >>>> value to be able to re-use an already allocated diagnostic command >>>> instance. >>>> >>>> The cleanup() method is used to perform perform cleanup (like >>>> freeing of >>>> all memory allocated to store internal data). The DCmd extends the >>>> ResourceObj class, so when allocated in a ResourceArea, destructors >>>> cannot be used to perform cleanup. To ensure that cleanup is performed >>>> in all cases, it is recommended to create a DCmdMark instance for each >>>> DCmd instance. DCmdMark is a stack allocated object with a pointer >>>> to a >>>> DCmd instance. When the DCmdMark is destroyed, its destructor calls >>>> the >>>> cleanup() method of the DCmd instance it points to. If the DCmd >>>> instance >>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>> memory >>>> allocated to store the DCmd instance. >>>> >>>> The get_argument_name_array() and get_argument_info_array() are >>>> related >>>> to the JMX interface of the diagnostic command framework, so they are >>>> described in section 3. >>>> >>>> 1-3 DCmdParser framework >>>> >>>> The DCmdParser class is an optional framework to help development of >>>> argument parsers. It provides many features required by the diagnostic >>>> command framework (generation of the help message or the argument >>>> descriptions for the JMX interface) but all these features can >>>> easily be >>>> re-implemented if a developer decides not to use the DCmdParser >>>> framework. >>>> >>>> The DCmdParser class is relying on the DCmdArgument template. This >>>> template must be used to define the different types of argument the >>>> parser will have to handle. When a new specialization of the >>>> template is >>>> done, three methods have to be provided: >>>> >>>> void parse_value(const char *str,size_t len,TRAPS); >>>> void init_value(TRAPS); >>>> void destroy_value(); >>>> >>>> The parse_value() method is used to convert a string into an argument >>>> value. The print_value() method is used to display the default value >>>> (support for the detailed help message). The init_value() method is >>>> used >>>> to initialize or reset the argument value. The destroy_value() >>>> method is >>>> a clean-up method (useful when the argument has allocated some C-Heap >>>> memory to store its value and this memory has to be freed before >>>> destroying the DCmdArgument instance). >>>> >>>> The DCmdParser makes a distinction between options and arguments. >>>> Options are identified by a key name that must appear on the command >>>> line, while argument are identified just by the position of the >>>> argument >>>> on the command line. Options use the = syntax. In case of >>>> boolean options, the '=' part of the syntax can be omitted >>>> to set >>>> the option to true. Arguments are just sequences characters >>>> delimited by >>>> a separator character. This separator can be specified at runtime when >>>> invoking the diagnostic command framework. If an argument contain a >>>> character that could be used as a delimiter, it's possible to enclose >>>> the argument between single or double quotes. Options are arguments >>>> are >>>> instantiated using the same DCmdArgument class but they're registered >>>> differently to the DCmdParser. >>>> >>>> The way to use the DCmdParser is to declare the parser and the >>>> option/arguments as fields of the diagnostic command class (which is >>>> itself a sub-class of the DCmd class), like this: >>>> >>>> >>>> class EchoDCmd : public DCmd { >>>> protected: >>>> DCmdParser _dcmdparser; >>>> >>>> DCmdArgument _required; >>>> >>>> DCmdArgument _intval; >>>> >>>> DCmdArgument _boolval; >>>> >>>> DCmdArgument _stringval; >>>> >>>> DCmdArgument _first_arg; >>>> >>>> DCmdArgument _second_arg; >>>> >>>> DCmdArgument _optional_arg; >>>> >>>> } >>>> >>>> The parser and the options/arguments must be initialized before the >>>> diagnostic command class, and the options/arguments have to be >>>> registered to the parser like this: >>>> >>>> EchoDCmd(outputStream *output) : DCmd(output), >>>> _stringval("-strval","a string argument","STRING",false), >>>> >>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>> >>>> _intval("-intval","an integer argument","INTEGER",false), >>>> >>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>> >>>> _fist_arg("first argument","a string argument","STRING",true), >>>> >>>> _second_arg("second argument,"an integer argument,"INTEGER",true), >>>> >>>> _optional_arg("optional argument","an optional string >>>> argument","STRING","false") >>>> >>>> { >>>> >>>> _dcmdparser.add_dcmd_option(&_stringval) >>>> >>>> _dcmdparser.add_dcmd_option(&_boolval); >>>> >>>> _dcmdparser.add_dcmd_option(&_intval); >>>> >>>> _dcmdparser.add_dcmd_option(&_required); >>>> >>>> _dcmdparser.add_argument(&_first_arg); >>>> >>>> _dcmdparser.add_argument(&_second_arg); >>>> >>>> _dcmdparser.add_argument(&_optional_arg); >>>> }; >>>> >>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >>>> argument/option to the parser. The option/argument constructor >>>> takes the >>>> name of the option/argument, its description, a string describing its >>>> type and a boolean to specify if the option/argument is mandatory or >>>> not. The parser doesn't support option/argument duplicates (having the >>>> same name) but the code currently doesn't check for duplicates.The >>>> order >>>> used to register options has no impact on the parser. However, the >>>> order >>>> used to register arguments is critical because the parser will use the >>>> same order to parse the command line. In the example above, the parser >>>> expects to have a first argument of type STRING (parsed using >>>> _first_arg), then a second argument of type INTEGER (parsed using >>>> _second_arg) and optionally a third parameter of type STRING (parsed >>>> using _optional_arg). A mandatory option or argument has to be specify >>>> every time the command is invoked. If it is missing, an exception is >>>> thrown at the end of the parsing. Optional arguments have to be >>>> registered after mandatory arguments. An optional argument will be >>>> considered for parsing only if all arguments before it (mandatory or >>>> not) have already been used to parse the command line. >>>> >>>> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >>>> instance. The rational for this design is to limit the number of >>>> C-heap >>>> allocations but also to be able to pre-allocate diagnostic command >>>> instances for critical situations. If the process is running out of >>>> C-heap space, it's not possible to instantiate new diagnostic commands >>>> to troubleshoot the situation. By pre-allocating some diagnostic >>>> commands, it will be possible to run them even in this critical >>>> situation. Of course, the diagnostic command itself should not try to >>>> allocate memory during its execution, this prevents the diagnostic >>>> command to use variable length arguments like strings. By nature, >>>> pre-allocated diagnostic commands aim to be re-usable, this is the >>>> purpose of the reset() method which restores the default status of all >>>> arguments. >>>> >>>> 1-4 Internal invocation >>>> >>>> Using a diagnostic command from the JVM itself is pretty easy: >>>> instantiate the class and invoke the parse() method then the execute() >>>> method. A diagnostic command can be instantiated from inside the JVM >>>> even it is not registered. This is a difference with the external >>>> invocations (from jcmd or JMX) that require the command to be >>>> registered. >>>> >>>> 2 - The JCmd interface >>>> >>>> Diagnostic commands can also be invoked from outside the JVM process, >>>> using the new 'jcmd' utility. The jcmd program uses the attach API >>>> to connect to the JVM, send requests and receive results. The >>>> jcmd utility must be launched on the same machine than the one running >>>> the JVM (its a local tool). Launched without arguments, jcmd >>>> displays a >>>> list of all JVMs running on the machine. The jcmd source code is in >>>> the jdk repository like other existing j* tools. >>>> >>>> To execute a diagnostic command in a particular JVM, the generic >>>> syntax is: >>>> >>>> jcmd [arguments] >>>> >>>> The attachListener has been modified to recognized the jcmd requests. >>>> When a jcmd request is identified, it is parsed to extract the command >>>> name. The JVM performs a look up of this command in a list of >>>> registered >>>> commands. To be executable by an external request, a diagnostic >>>> command >>>> has to be registered. The registration is performed with the >>>> DCmdFactory >>>> class (see services/management.cpp). >>>> >>>> 3 - The JMX interface >>>> >>>> The framework provides a JMX based interface to the diagnostic >>>> commands. >>>> This interface allows remote invocation of diagnostic commands >>>> through a >>>> JMX connection. >>>> >>>> 3-1 The interface >>>> >>>> The information related to the diagnostic commands are accessible >>>> through new methods added to the >>>> com.sun.management.HotspotDiagnosticMXBean: >>>> >>>> public List getDiagnosticCommands(); >>>> >>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >>>> >>>> public List >>>> getDiagnosticCommandInfo(List >>>> command); >>>> >>>> public List getDiagnosticCommandInfo(); >>>> >>>> public String execute(String commandLine) throws >>>> IllegalArgumentException ; >>>> >>>> public String execute(String cmd, String... arguments) >>>> throws IllegalArgumentException; >>>> >>>> >>>> The getDiagnosticCommands() method returns an array containing the >>>> names >>>> of the not-hidden registered diagnostic commands. >>>> >>>> The three getDiagnosticCommandInfo() methods return one or several >>>> diagnostic command descriptions using the DiagnosticCommandInfo class. >>>> >>>> The two execute() methods allow the user the invoke a diagnostic >>>> command >>>> in different ways. >>>> >>>> The DiagnosticCommandInfo class is describing a diagnostic command >>>> with >>>> the following information: >>>> >>>> public class DiagnosticCommandInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getImpact(); >>>> >>>> public boolean isEnabled(); >>>> >>>> public List getArgumentsInfo(); >>>> } >>>> >>>> The getName() method returns the name of the diagnostic command. This >>>> name is the one to use in execute() methods to invoke the diagnostic >>>> command. >>>> >>>> The getDescription() method returns a general description of the >>>> diagnostic command. >>>> >>>> The getImpact() method returns a description of the intrusiveness of >>>> diagnostic command. >>>> >>>> The isEnabled() method returns true if the method is enabled, false if >>>> it is disabled. A disabled method cannot be executed. >>>> >>>> The getArgumentsInfo() returns a list of descriptions for the >>>> options or >>>> arguments recognized by the diagnostic command. Each >>>> option/argument is >>>> described by a DiagnosticCommandArgumentInfo instance: >>>> >>>> public class DiagnosticCommandArgumentInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getType(); >>>> >>>> public String getDefault(); >>>> >>>> public boolean isMandatory(); >>>> >>>> public boolean isOption(); >>>> >>>> public int getPosition(); >>>> } >>>> >>>> If the DiagnosticCommandArgumentInfo instance describes an option, >>>> isOption() returns true and getPosition() returns -1. Otherwise, when >>>> the DiagnosticCommandArgumentInfo instance describes an argument, >>>> isOption() returns false and getPosition() returns the expected >>>> position >>>> for this argument. The position of an argument is defined >>>> relatively to >>>> all arguments passed on the command line, options are not considered >>>> when defining an argument position. The getDefault() method returns >>>> the >>>> default value of the argument if a default has been defined, otherwise >>>> it returns null. >>>> >>>> 3-2 The implementation >>>> >>>> The framework has been designed in a way that prevents diagnostic >>>> command developers to worry about the JMX interface. In addition to >>>> the methods described in section 1-2, a diagnostic command >>>> developer has >>>> to provide three methods: >>>> >>>> int get_num_arguments() >>>> >>>> which returns the number of option and arguments supported by the >>>> command. >>>> >>>> GrowableArray* get_argument_name_array() >>>> >>>> which provides the name of the arguments supported by the command. >>>> >>>> GrowableyArray* get_argument_info_array() >>>> >>>> which provides the description of each argument with a >>>> DCmdArgumentInfo >>>> instance. DCmdArgumentInfo is a C++ class used by the framework to >>>> generate the sun.com.management.DcmdArgumentInfo instances. This is >>>> done >>>> automatically and the diagnostic command developer doesn't need to >>>> know >>>> how to create Java objects from the runtime. >>>> >>>> 4 - The Diagnostic Commands >>>> >>>> To avoid name collisions between diagnostic commands coming from >>>> different projects, use of a flat name space should be avoided and >>>> a more structured organization is recommended. The framework itself >>>> doesn't depend on this organization, so it will be a set of rules >>>> defining a convention in the way commands are named. >>>> >>>> Diagnostic commands can easily organized in a hierarchical way, so the >>>> template for a command name can be: >>>> >>>> .[sub-domain.] >>>> >>>> This template can be extended with sub-sub-domains and so on. >>>> >>>> A special set of commands without domain will be reserved for the >>>> commands related to the diagnostic framework itself, like the "help" >>>> command. >>>> >>>> >>>> Thanks, >>>> >>>> Fred >>>> >> > From darryl.mocek at oracle.com Mon Dec 12 22:50:10 2011 From: darryl.mocek at oracle.com (Darryl Mocek) Date: Mon, 12 Dec 2011 14:50:10 -0800 Subject: Code Review Request for Bug #7089443 Message-ID: <4EE68522.9000904@oracle.com> Hello. Please review this patch to fix InetAddress.getLocalHost fails if the host name is larger HOST_NAME_MAX. The fix is to use strncpy, and supply the max length the host name can be, instead of using strcpy. There is no test supplied for this fix as I was unable to set the host name larger then MAXHOSTNAMELEN on the Linux and Solaris machines I tried. I tested the fix by adding code to Inet4AddressImpl.c to simulate a host name larger then MAXHOSTNAMELEN. Webrev, can be found here: http://cr.openjdk.java.net/~dmocek/7089443/webrev.00 Thanks, Darryl From kelly.ohair at oracle.com Mon Dec 12 23:29:35 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:29:35 +0000 Subject: hg: jdk8/tl: 7119829: Adjust default jprt testing configuration Message-ID: <20111212232935.6554647677@hg.openjdk.java.net> Changeset: 9acd7374ff8a Author: ohair Date: 2011-12-12 08:11 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/9acd7374ff8a 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties ! test/Makefile From kelly.ohair at oracle.com Mon Dec 12 23:29:45 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:29:45 +0000 Subject: hg: jdk8/tl/jdk: 7119829: Adjust default jprt testing configuration Message-ID: <20111212233005.ADA4047678@hg.openjdk.java.net> Changeset: 9c0a6185188f Author: ohair Date: 2011-12-12 08:17 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/9c0a6185188f 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties ! test/Makefile From kelly.ohair at oracle.com Mon Dec 12 23:30:15 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:30:15 +0000 Subject: hg: jdk8/tl/jaxp: 2 new changesets Message-ID: <20111212233015.6A66A47679@hg.openjdk.java.net> Changeset: a482d45c93e9 Author: ohair Date: 2011-12-12 08:12 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/a482d45c93e9 7117110: Remove target 1.5 from jaxp and jaxws repo builds for mac Reviewed-by: alanb ! build.xml Changeset: a49db7c01db7 Author: ohair Date: 2011-12-12 08:12 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/a49db7c01db7 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties From kelly.ohair at oracle.com Mon Dec 12 23:30:34 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:30:34 +0000 Subject: hg: jdk8/tl/corba: 7119829: Adjust default jprt testing configuration Message-ID: <20111212233035.56B714767A@hg.openjdk.java.net> Changeset: 75529c21094f Author: ohair Date: 2011-12-12 08:15 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/75529c21094f 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties From kelly.ohair at oracle.com Mon Dec 12 23:30:42 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:30:42 +0000 Subject: hg: jdk8/tl/jaxws: 2 new changesets Message-ID: <20111212233042.C6FCE4767B@hg.openjdk.java.net> Changeset: 6d622b1b4db0 Author: ohair Date: 2011-12-12 08:13 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/6d622b1b4db0 7117110: Remove target 1.5 from jaxp and jaxws repo builds for mac Reviewed-by: alanb ! build.xml Changeset: 6d2030eacdac Author: ohair Date: 2011-12-12 08:13 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/6d2030eacdac 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties From kelly.ohair at oracle.com Mon Dec 12 23:31:28 2011 From: kelly.ohair at oracle.com (kelly.ohair at oracle.com) Date: Mon, 12 Dec 2011 23:31:28 +0000 Subject: hg: jdk8/tl/langtools: 7119829: Adjust default jprt testing configuration Message-ID: <20111212233132.4EEDB4767C@hg.openjdk.java.net> Changeset: 4822dfe0922b Author: ohair Date: 2011-12-12 08:15 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/4822dfe0922b 7119829: Adjust default jprt testing configuration Reviewed-by: alanb ! make/jprt.properties From littlee at linux.vnet.ibm.com Tue Dec 13 02:26:07 2011 From: littlee at linux.vnet.ibm.com (Charles Lee) Date: Tue, 13 Dec 2011 10:26:07 +0800 Subject: Code Review Request for Bug #7089443 In-Reply-To: <4EE68522.9000904@oracle.com> References: <4EE68522.9000904@oracle.com> Message-ID: <4EE6B7BF.8030906@linux.vnet.ibm.com> On 12/13/2011 06:50 AM, Darryl Mocek wrote: > Hello. Please review this patch to fix InetAddress.getLocalHost fails > if the host name is larger HOST_NAME_MAX. The fix is to use strncpy, > and supply the max length the host name can be, instead of using > strcpy. There is no test supplied for this fix as I was unable to set > the host name larger then MAXHOSTNAMELEN on the Linux and Solaris > machines I tried. I tested the fix by adding code to > Inet4AddressImpl.c to simulate a host name larger then MAXHOSTNAMELEN. > > Webrev, can be found here: > http://cr.openjdk.java.net/~dmocek/7089443/webrev.00 > > Thanks, > Darryl > > Hi Darryl, I have changed Inet4AddressImpl.c a lot in the commit: changeset: 4757:81987765cb81 user: ngmr date: Fri Nov 11 14:40:18 2011 +0000 summary: 7112670: Inet4AddressImpl should use getaddrinfo/getnameinfo and you can find the webrev here: http://cr.openjdk.java.net/~ngmr/ojdk-229/webrev.02/ Would you please use the latest version of Inet4AddressImpl.c ? -- Yours Charles From zhouyx at linux.vnet.ibm.com Tue Dec 13 02:36:13 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Tue, 13 Dec 2011 10:36:13 +0800 Subject: Add Look&Feel support for AIX platform In-Reply-To: <1323689619.20905.3.camel@chalkhill> References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> <1323689619.20905.3.camel@chalkhill> Message-ID: I tried once, and it was dropped because "the platform is not supported." On Mon, Dec 12, 2011 at 7:33 PM, Neil Richards wrote: > On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > > Hi, > > > > > > I'm not sure what to do for it next, shall I create a bug for it > > now ? But I > > don't think the bug system support AIX platform. I remembered it > > would > > report something like "we are not supporting the platform". > > > > Hi Sean, > Looking at the options available on the Java bug submission site [1], it > looks like: > Release: OpenJDK > Operating System: Generic / Other > > would be the most appropriate choices to make. > > Regards, > Neil > > -- > Unless stated above: > IBM email: neil_richards at uk.ibm.com > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > > -- Best Regards, Sean Chou From david.holmes at oracle.com Tue Dec 13 03:02:44 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Dec 2011 13:02:44 +1000 Subject: Code Review Request for Bug #7089443 In-Reply-To: <4EE6B7BF.8030906@linux.vnet.ibm.com> References: <4EE68522.9000904@oracle.com> <4EE6B7BF.8030906@linux.vnet.ibm.com> Message-ID: <4EE6C054.1060408@oracle.com> It seems that 7089443 is fixed as a by-product of your changes Charles - provided getnameinfo does the right thing :) David ------ On 13/12/2011 12:26 PM, Charles Lee wrote: > On 12/13/2011 06:50 AM, Darryl Mocek wrote: >> Hello. Please review this patch to fix InetAddress.getLocalHost fails >> if the host name is larger HOST_NAME_MAX. The fix is to use strncpy, >> and supply the max length the host name can be, instead of using >> strcpy. There is no test supplied for this fix as I was unable to set >> the host name larger then MAXHOSTNAMELEN on the Linux and Solaris >> machines I tried. I tested the fix by adding code to >> Inet4AddressImpl.c to simulate a host name larger then MAXHOSTNAMELEN. >> >> Webrev, can be found here: >> http://cr.openjdk.java.net/~dmocek/7089443/webrev.00 >> >> Thanks, >> Darryl >> >> > Hi Darryl, > > I have changed Inet4AddressImpl.c a lot in the commit: > > changeset: 4757:81987765cb81 > user: ngmr > date: Fri Nov 11 14:40:18 2011 +0000 > summary: 7112670: Inet4AddressImpl should use getaddrinfo/getnameinfo > > and you can find the webrev here: > http://cr.openjdk.java.net/~ngmr/ojdk-229/webrev.02/ > > Would you please use the latest version of Inet4AddressImpl.c ? > From littlee at linux.vnet.ibm.com Tue Dec 13 03:08:50 2011 From: littlee at linux.vnet.ibm.com (Charles Lee) Date: Tue, 13 Dec 2011 11:08:50 +0800 Subject: Code Review Request for Bug #7089443 In-Reply-To: <4EE6C054.1060408@oracle.com> References: <4EE68522.9000904@oracle.com> <4EE6B7BF.8030906@linux.vnet.ibm.com> <4EE6C054.1060408@oracle.com> Message-ID: <4EE6C1C2.9010709@linux.vnet.ibm.com> On 12/13/2011 11:02 AM, David Holmes wrote: > It seems that 7089443 is fixed as a by-product of your changes Charles > - provided getnameinfo does the right thing :) > > David > ------ > > On 13/12/2011 12:26 PM, Charles Lee wrote: >> On 12/13/2011 06:50 AM, Darryl Mocek wrote: >>> Hello. Please review this patch to fix InetAddress.getLocalHost fails >>> if the host name is larger HOST_NAME_MAX. The fix is to use strncpy, >>> and supply the max length the host name can be, instead of using >>> strcpy. There is no test supplied for this fix as I was unable to set >>> the host name larger then MAXHOSTNAMELEN on the Linux and Solaris >>> machines I tried. I tested the fix by adding code to >>> Inet4AddressImpl.c to simulate a host name larger then MAXHOSTNAMELEN. >>> >>> Webrev, can be found here: >>> http://cr.openjdk.java.net/~dmocek/7089443/webrev.00 >>> >>> Thanks, >>> Darryl >>> >>> >> Hi Darryl, >> >> I have changed Inet4AddressImpl.c a lot in the commit: >> >> changeset: 4757:81987765cb81 >> user: ngmr >> date: Fri Nov 11 14:40:18 2011 +0000 >> summary: 7112670: Inet4AddressImpl should use getaddrinfo/getnameinfo >> >> and you can find the webrev here: >> http://cr.openjdk.java.net/~ngmr/ojdk-229/webrev.02/ >> >> Would you please use the latest version of Inet4AddressImpl.c ? >> > Yeah~~ :-D -- Yours Charles From stephen.flores at oracle.com Tue Dec 13 04:13:11 2011 From: stephen.flores at oracle.com (Stephen Flores) Date: Mon, 12 Dec 2011 23:13:11 -0500 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EE61821.2070603@oracle.com> References: <4EE2F6AD.7050701@oracle.com> <4EE61821.2070603@oracle.com> Message-ID: <4EE6D0D7.1090001@oracle.com> Thanks Gary, I have added the bug number to the tag and updated the webrev. Steve. On 12/12/2011 10:05 AM, Gary Adams wrote: > I think you want to add 6990617 to the @bug tag in RegExTest. > > On 12/10/11 01:05 AM, Stephen Flores wrote: >> Please review the following webrev (includes new test to demonstrate >> the bug): >> >> http://cr.openjdk.java.net/~sflores/6990617/ >> >> for bug: 6990617 Regular expression doesn't match if unicode character >> next to a digit. >> >> A DESCRIPTION OF THE PROBLEM : >> >> Unicode characters are represented as \\+number. >> For instance, one could write: >> Pattern p = Pattern.compile("\\011some text\\012"); >> Matcher m = p.matcher("\tsome text\n"); >> System.out.println(m.find()); // yields "true" >> >> However, if we want to match a string with a digit next to >> the unicode character, it doesn't match (whether we "quote" >> the regular expression or not). Note the "1" next to the tab >> character (unicode 011). >> Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); >> Matcher m = p.matcher("\t1some text\n"); >> System.out.println(m.find()); // yields "false" >> >> This happens because Pattern accepts either \\0011 or \\011 for >> the same character. From the javadoc: >> >> \0nn The character with octal value 0nn (0 <= n <= 7) >> \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) >> >> Evaluation: >> >> Pattern.RemoveQEQuoting() does NOT handle this situation correctly. >> The existing implementation now simply copies all ASCII.isAlnum() >> characters when handing a quote. >> >> Description of fix: >> >> In the method Pattern.RemoveQEQuoting any ASCII digit at the >> beginning of a quote will now be prefixed by "\x3" (not just \ >> because this would be a backref). 0x30 is the ASCII code for '0'. >> >> Thanks, >> >> Steve. > From stephen.flores at oracle.com Tue Dec 13 04:16:04 2011 From: stephen.flores at oracle.com (Stephen Flores) Date: Mon, 12 Dec 2011 23:16:04 -0500 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EE6547B.406@oracle.com> References: <4EE2F6AD.7050701@oracle.com> <4EE6547B.406@oracle.com> Message-ID: <4EE6D184.9000807@oracle.com> Thanks Sherman, I have added the regression test for the case below and added a "continue" statement after line 1622 to get the case to pass. I have updated the webrev. Steve. On 12/12/2011 02:22 PM, Xueming Shen wrote: > Hi Steve, > > The \x3[0-9] approach is interesting, it appears to solve the problem > without > paying a higher cost I originally thought (looking back, for example). > > The logic of initializing/setting/unsetting of "beginQuote" to > true/false appears to > be incorrect when there are multiple \Qn...\E in one pattern. Ln#1622 > setting will > always be followed by Ln#1630, if I read the code correctly. > > For example > > Pattern pattern = > Pattern.compile("\\011\\Q1sometext\\E\\011\\Q2sometext\\E"); > Matcher matcher = pattern.matcher("\t1sometext\t2sometext"); > System.out.printf("find=%b%n", matcher.find()); > > will still return false? > > -Sherman > > On 12/09/2011 10:05 PM, Stephen Flores wrote: >> Please review the following webrev (includes new test to demonstrate >> the bug): >> >> http://cr.openjdk.java.net/~sflores/6990617/ >> >> for bug: 6990617 Regular expression doesn't match if unicode character >> next to a digit. >> >> A DESCRIPTION OF THE PROBLEM : >> >> Unicode characters are represented as \\+number. >> For instance, one could write: >> Pattern p = Pattern.compile("\\011some text\\012"); >> Matcher m = p.matcher("\tsome text\n"); >> System.out.println(m.find()); // yields "true" >> >> However, if we want to match a string with a digit next to >> the unicode character, it doesn't match (whether we "quote" >> the regular expression or not). Note the "1" next to the tab >> character (unicode 011). >> Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); >> Matcher m = p.matcher("\t1some text\n"); >> System.out.println(m.find()); // yields "false" >> >> This happens because Pattern accepts either \\0011 or \\011 for >> the same character. From the javadoc: >> >> \0nn The character with octal value 0nn (0 <= n <= 7) >> \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) >> >> Evaluation: >> >> Pattern.RemoveQEQuoting() does NOT handle this situation correctly. >> The existing implementation now simply copies all ASCII.isAlnum() >> characters when handing a quote. >> >> Description of fix: >> >> In the method Pattern.RemoveQEQuoting any ASCII digit at the >> beginning of a quote will now be prefixed by "\x3" (not just \ >> because this would be a backref). 0x30 is the ASCII code for '0'. >> >> Thanks, >> >> Steve. > From david.holmes at oracle.com Tue Dec 13 06:49:23 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Dec 2011 16:49:23 +1000 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE61040.5040704@oracle.com> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> <34278e49-efbc-4370-ab36-a50331a9ff65@default> <4EE61040.5040704@oracle.com> Message-ID: <4EE6F573.4040802@oracle.com> Hi Fred, A couple of minor comments on the JDK side: HotSpotDiagnosticMXBean.java: Sorry if this is old ground but a query on the API design: is there a specific reason to use Lists rather than the arrays the VM will provide? HotSpotDiagnostic.java: 139 public List getDiagnosticCommandInfo( 140 List commands) { 141 if (commands == null) { 142 throw new NullPointerException(); 143 } 144 return Arrays.asList(getDiagnosticCommandInfo0( 145 commands.toArray(new String[commands.size()]))); 146 } The explicit null check is redundant as commands.size() will be the first thing invoked. --- jmm.h: The structs should use an indent of 2 to match the style of the file. --- hotspotDiagnostic.c: 39 Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0 40 (JNIEnv *env, jobject dummy) Put on one line. 42 if((jmm_version > JMM_VERSION_1_2_1) Space after 'if' 50 jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command, 51 int num_arg) { Align arg with opening parentheses 52-59, 107-112 It is not necessary with modern C compilers to declare all variables at the start of a block/function. You can declare them in the scope they will be used. 61 dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * sizeof(dcmdArgInfo)); Cast is not needed. --- General: I suggest generating the javadoc for your new classes and having an editorial check done. I spotted a couple of typos eg: DiagnosticCommandArgumentInfo.java: 32 * of one parameter of diagnostic command. ^the DiagnosticCommandInfo.java 89 * Returns the a list of the ^^^^ typo Cheers, David On 13/12/2011 12:31 AM, Frederic Parain wrote: > Hi Robert, > > These issues should be solved with the new webrevs: > > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.03/ > > Regards, > > Fred > > On 12/ 9/11 03:17 PM, Robert Ottenhag wrote: >> Adding to the review of jmm.h, that is modified in both the jdk part >> and the hotspot part, these files should be identical, without any >> differences in whitespace. >> >> Also, regarding whitespace and indentation, the use TAB characters in >> many files in the jdk patch makes jcheck complain (when trying to >> import your patch locally), and should be replaced by spaces. >> >> Best regards, >> >> /Robert >> >> >>> -----Original Message----- From: Paul Hohensee Sent: Thursday, >>> December 08, 2011 7:26 PM To: Frederic Parain Cc: >>> serviceability-dev at openjdk.java.net; >>> core-libs-dev at openjdk.java.net; >>> hotspot-runtime-dev at openjdk.java.net Subject: Re: Request for >>> Review (XXL): 7104647: Adding a diagnostic command framework >>> >>> For the hotspot part at >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> >>> Most of my comments are style-related. Nice job on the >>> implementation architecture. >>> >>> In attachListener.cpp: >>> >>> You might want to delete the first "return JNI_OK;" line, since the >>> code under HAS_PENDING_EXCEPTION just falls through. >>> >>> In jmm.h: >>> >>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as >>> the existing declarations. Add a newline just before it on line >>> 322. >>> >>> >>> In diagnosticFramework.hpp: >>> >>> Fix indenting for lines 63-66, insert blank before "size_t" on line >>> 48. >>> >>> Hotspot convention is that getter method names don't include a >>> "get_" prefix. So, e.g., DCmdArgIter::get_key_addr() s/b >>> DCmdArgIter::key_addr(). Similarly, getters such as is_enabled() >>> should retrieve a field named "_is_enabled" rather than one named >>> "enabled". You follow the "_is_enabled" convention in other places >>> such as GenDCmdArgument. Or you could use enabled() to get the >>> value of the _enabled field. >>> >>> Also generally, I'd use accessor methods in the implementation of >>> more complex member methods rather than access the underlying >>> fields directly. E.g. in GenDCmdArgument::read_value, I'd use >>> is_set() and set_is_set(true), (set_is_set() is not actually >>> defined, but should be) rather than directly accessing _is_set. >>> Though sometimes doing this is too much of a pain with fields whose >>> type is a template argument, as in the >>> DCmdArggument::parse_value() method in >>> diagnosticArgument.cpp. >>> >>> For easy readability, it'd be nice to line up field names (the ones >>> with an _ prefix) at the same column. >>> >>> On line 200, "instanciated" -> "instantiated" >>> >>> On line 218, I'd use "heap_allocated" rather than "heap" for the >>> formal arg name. >>> >>> On line 248, you could indent the text to start underneath >>> "outputStream". I generally find that indenting arguments lines >>> (formal or actual) so they line up with the first argument position >>> make the code more readable, but I'm not religious about it. >>> >>> On line 265, "instanciated" -> "instantiated" >>> >>> DCmdFactorys are members of a singly-linked list, right? If so, >>> it'd be good to have a comment to that effect on the declaration of >>> _next. >>> >>> On line 322, insert a blank before "true". You might fix this in >>> other places where there's no blank between a comma in an argument >>> list and the following parameter value. >>> >>> >>> In diagnosticCommandFramework.cpp: >>> >>> The code from lines 80-95 and 105-120 is identical. Factor out? >>> >>> >>> In diagnosticArgument.cpp: >>> >>> On line 41, insert blanks before the actual arguments. (see above >>> generic comment) >>> >>> On line 77, the "if" is indented one space too many. >>> >>> >>> In management.cpp: >>> >>> I'd be consistent with having or not having a space between >>> "while", "if" and "for" and the following "(" in this and your >>> other code. Most hotspot code has a space. >>> >>> >>> Thanks, >>> >>> Paul >>> >>> >>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>> Hi All, >>>> >>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>> because changes are pretty big and touch all these areas] >>>> >>>> Here's a framework for issuing diagnostics commands to the JVM. >>>> Diagnostic commands are actions executed inside the JVM mainly >>>> for monitoring or management purpose. This work has two parts. >>>> The first part is in the hotspot repository and contains the >>>> framework itself with two diagnostic commands. The second part is >>>> in the JDK repository and contains the command line utility to >>>> invoke diagnostic commands as well as the HotSpotDiagnosticMXBean >>>> extensions. The HotSpotDiagnosticMXBean extensions allow a remote >>>> client to discover and invoke diagnostic commands using a JMX >>>> connection. >>>> >>>> This changeset only contains two diagnostic commands, more >>>> commands will be added in the future, as a standalone effort to >>>> improve the monitoring and management services of the JVM, or as >>>> part of other projects. >>>> >>>> Webrevs are here: >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>> >>>> Here's a technical description of this work: >>>> >>>> 1 - The Diagnostic Command Framework 1-1 Overview >>>> >>>> The diagnostic command framework is fully implemented in native >>>> code and relies on the HotSpot's internal exception mechanism. >>>> The rational of a pure native implementation is to be able to >>>> execute diagnostic commands even in critical situations like an >>>> OutOfMemory error. All diagnostic commands are registered in a >>>> single list, and two flags control the way a user can interact >>>> with them. The "hidden" flag prevents a diagnostic command from >>>> appearing in the list of available commands returned by the >>>> "help" command. However, it's still possible to get the detailed >>>> help message for a hidden command with the "help " >>>> syntax (but it requires to know the name of the hidden command). >>>> The second flag is "enabled" and it controls if a command can be >>>> invoked or not. When listed with the "help" commands, disabled >>>> commands appear with a "[disabled]" label in their description. >>>> If the user tries to invoke a disabled command, an error message >>>> is returned and the command is not run. This error message can be >>>> customized on a per command base. The framework just provides >>>> these two flags with their semantic, it doesn't provide any >>>> policy or mechanism to set or modify these flags. These actions >>>> will be delegated to the JVM or special diagnostic commands. >>>> >>>> 1-2 Implementation >>>> >>>> All diagnostic commands are implemented as subclasses of the DCmd >>>> class defined in services/diagnosticFramework.hpp. Here's the >>>> layout of the DCmd class and the list of methods that a new >>>> command has to define or overwrite: >>>> >>>> class DCmd { DCmd(outputStream *output); >>>> >>>> static const char *get_name(); >>>> >>>> static const char *get_description(); >>>> >>>> static const char *get_disabled_message(); >>>> >>>> static const char *get_impact(); >>>> >>>> static int get_num_arguments(); >>>> >>>> virtual void print_help(outputStream* out); >>>> >>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>> >>>> virtual void execute(TRAPS); >>>> >>>> virtual void reset(TRAPS); >>>> >>>> virtual void cleanup(); >>>> >>>> virtual GrowableArray* get_argument_name_array(); >>>> >>>> virtual GrowableArray* >>>> get_argument_info_array(); } >>>> >>>> A diagnostic command is always instantiated with an outputStream >>>> in parameter. This outputStream can point either to a file, a >>>> buffer or a socket (see the ostream.hpp file). >>>> >>>> The get_name() method returns the string that will identify the >>>> command (i.e. the string to put on the command line to invoke >>>> it). >>>> >>>> The get_description() methods returns the global description of >>>> the command. >>>> >>>> The get_disabled_message() returns the customized message to >>>> return when the command is disabled, without having to >>>> instantiate the command. >>>> >>>> The get_impact() returns a description of the intrusiveness of >>>> the diagnostic command on the Java Virtual Machine behavior. The >>>> rational for this method is that some diagnostic commands can >>>> seriously disrupt the behavior of the Java Virtual Machine (for >>>> instance a Thread Dump for an application with several tens of >>>> thousands of threads, or a Head Dump with a 40GB+ heap size) and >>>> other diagnostic commands have no serious impact on the JVM (for >>>> instance, getting the command line arguments or the JVM version). >>>> The recommended format for the description is: >>>> [longer description], where the impact level is selected among >>>> this list: {low, medium, high}. The optional longer description >>>> can provide more specific details like the fact that Thread Dump >>>> impact depends on the heap size. >>>> >>>> The get_num_arguments() returns the number of options/arguments >>>> recognized by the diagnostic command. This method is only used by >>>> the JMX interface support (see below). >>>> >>>> The print_help() methods prints a detailed help on the >>>> outputStream passed in argument. The detailed help contains the >>>> list of all supported options with their type and description. >>>> >>>> The parse() method is in charge of parsing the command arguments. >>>> Each command is free to implement its own argument parser. >>>> However, an argument parser framework is provided (see section >>>> 1-3) to ease the implementation, but its use is optional. The >>>> parse method takes a delimiter character in argument, which is >>>> used to mark the limit between two arguments (typically >>>> invocation from jcmd will use a space character as a delimiter >>>> while invocation from the JVM command line parsing code will use >>>> a comma as a delimiter). >>>> >>>> The execute() method is naturally the one to invoke to get the >>>> diagnostic command executed. The parse() and the execute() >>>> methods are dissociated, so it's a possible perform the argument >>>> parsing in one thread, and delegate the execution to another >>>> thread, as long as the diagnostic command doesn't reference >>>> thread local variables. The framework allows several instances of >>>> the same diagnostic command to be executed in parallel. If for >>>> some reasons concurrent executions should not be allowed for a >>>> given diagnostic command, this is the responsibility of the >>>> diagnostic command implementor to enforce this rule, for instance >>>> by protecting the body of the execute() method with a global >>>> lock. >>>> >>>> The reset() method is used to initialize the internal fields of >>>> the diagnostic command or to reset the internal fields to their >>>> initial value to be able to re-use an already allocated >>>> diagnostic command instance. >>>> >>>> The cleanup() method is used to perform perform cleanup (like >>>> freeing of all memory allocated to store internal data). The DCmd >>>> extends the ResourceObj class, so when allocated in a >>>> ResourceArea, destructors cannot be used to perform cleanup. To >>>> ensure that cleanup is performed in all cases, it is recommended >>>> to create a DCmdMark instance for each DCmd instance. DCmdMark is >>>> a stack allocated object with a pointer to a DCmd instance. When >>>> the DCmdMark is destroyed, its destructor calls the cleanup() >>>> method of the DCmd instance it points to. If the DCmd instance >>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>> memory allocated to store the DCmd instance. >>>> >>>> The get_argument_name_array() and get_argument_info_array() are >>>> related to the JMX interface of the diagnostic command framework, >>>> so they are described in section 3. >>>> >>>> 1-3 DCmdParser framework >>>> >>>> The DCmdParser class is an optional framework to help development >>>> of argument parsers. It provides many features required by the >>>> diagnostic command framework (generation of the help message or >>>> the argument descriptions for the JMX interface) but all these >>>> features can easily be re-implemented if a developer decides not >>>> to use the DCmdParser framework. >>>> >>>> The DCmdParser class is relying on the DCmdArgument template. >>>> This template must be used to define the different types of >>>> argument the parser will have to handle. When a new >>>> specialization of the template is done, three methods have to be >>>> provided: >>>> >>>> void parse_value(const char *str,size_t len,TRAPS); void >>>> init_value(TRAPS); void destroy_value(); >>>> >>>> The parse_value() method is used to convert a string into an >>>> argument value. The print_value() method is used to display the >>>> default value (support for the detailed help message). The >>>> init_value() method is used to initialize or reset the argument >>>> value. The destroy_value() method is a clean-up method (useful >>>> when the argument has allocated some C-Heap memory to store its >>>> value and this memory has to be freed before destroying the >>>> DCmdArgument instance). >>>> >>>> The DCmdParser makes a distinction between options and >>>> arguments. Options are identified by a key name that must appear >>>> on the command line, while argument are identified just by the >>>> position of the argument on the command line. Options use >>>> the= syntax. In case of boolean options, the >>>> '=' part of the syntax can be omitted to set the option to >>>> true. Arguments are just sequences characters delimited by a >>>> separator character. This separator can be specified at runtime >>>> when invoking the diagnostic command framework. If an argument >>>> contain a character that could be used as a delimiter, it's >>>> possible to enclose the argument between single or double quotes. >>>> Options are arguments are instantiated using the same >>>> DCmdArgument class but they're registered differently to the >>>> DCmdParser. >>>> >>>> The way to use the DCmdParser is to declare the parser and the >>>> option/arguments as fields of the diagnostic command class (which >>>> is itself a sub-class of the DCmd class), like this: >>>> >>>> >>>> class EchoDCmd : public DCmd { protected: DCmdParser >>>> _dcmdparser; >>>> >>>> DCmdArgument _required; >>>> >>>> DCmdArgument _intval; >>>> >>>> DCmdArgument _boolval; >>>> >>>> DCmdArgument _stringval; >>>> >>>> DCmdArgument _first_arg; >>>> >>>> DCmdArgument _second_arg; >>>> >>>> DCmdArgument _optional_arg; >>>> >>>> } >>>> >>>> The parser and the options/arguments must be initialized before >>>> the diagnostic command class, and the options/arguments have to >>>> be registered to the parser like this: >>>> >>>> EchoDCmd(outputStream *output) : DCmd(output), >>>> _stringval("-strval","a string argument","STRING",false), >>>> >>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>> >>>> _intval("-intval","an integer argument","INTEGER",false), >>>> >>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>> >>>> _fist_arg("first argument","a string argument","STRING",true), >>>> >>>> _second_arg("second argument,"an integer >>>> argument,"INTEGER",true), >>>> >>>> _optional_arg("optional argument","an optional string >>>> argument","STRING","false") >>>> >>>> { >>>> >>>> _dcmdparser.add_dcmd_option(&_stringval) >>>> >>>> _dcmdparser.add_dcmd_option(&_boolval); >>>> >>>> _dcmdparser.add_dcmd_option(&_intval); >>>> >>>> _dcmdparser.add_dcmd_option(&_required); >>>> >>>> _dcmdparser.add_argument(&_first_arg); >>>> >>>> _dcmdparser.add_argument(&_second_arg); >>>> >>>> _dcmdparser.add_argument(&_optional_arg); }; >>>> >>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add >>>> an argument/option to the parser. The option/argument constructor >>>> takes the name of the option/argument, its description, a string >>>> describing its type and a boolean to specify if the >>>> option/argument is mandatory or not. The parser doesn't support >>>> option/argument duplicates (having the same name) but the code >>>> currently doesn't check for duplicates.The order used to register >>>> options has no impact on the parser. However, the order used to >>>> register arguments is critical because the parser will use the >>>> same order to parse the command line. In the example above, the >>>> parser expects to have a first argument of type STRING (parsed >>>> using _first_arg), then a second argument of type INTEGER (parsed >>>> using _second_arg) and optionally a third parameter of type >>>> STRING (parsed using _optional_arg). A mandatory option or >>>> argument has to be specify every time the command is invoked. If >>>> it is missing, an exception is thrown at the end of the parsing. >>>> Optional arguments have to be registered after mandatory >>>> arguments. An optional argument will be considered for parsing >>>> only if all arguments before it (mandatory or not) have already >>>> been used to parse the command line. >>>> >>>> The DCmdParser and its DCmdArgument instances are embedded in the >>>> DCmd instance. The rational for this design is to limit the >>>> number of C-heap allocations but also to be able to pre-allocate >>>> diagnostic command instances for critical situations. If the >>>> process is running out of C-heap space, it's not possible to >>>> instantiate new diagnostic commands to troubleshoot the >>>> situation. By pre-allocating some diagnostic commands, it will be >>>> possible to run them even in this critical situation. Of course, >>>> the diagnostic command itself should not try to allocate memory >>>> during its execution, this prevents the diagnostic command to use >>>> variable length arguments like strings. By nature, pre-allocated >>>> diagnostic commands aim to be re-usable, this is the purpose of >>>> the reset() method which restores the default status of all >>>> arguments. >>>> >>>> 1-4 Internal invocation >>>> >>>> Using a diagnostic command from the JVM itself is pretty easy: >>>> instantiate the class and invoke the parse() method then the >>>> execute() method. A diagnostic command can be instantiated from >>>> inside the JVM even it is not registered. This is a difference >>>> with the external invocations (from jcmd or JMX) that require the >>>> command to be >>> registered. >>>> >>>> 2 - The JCmd interface >>>> >>>> Diagnostic commands can also be invoked from outside the JVM >>>> process, using the new 'jcmd' utility. The jcmd program uses the >>>> attach API to connect to the JVM, send requests and receive >>>> results. The jcmd utility must be launched on the same machine >>>> than the one running the JVM (its a local tool). Launched without >>>> arguments, jcmd displays a list of all JVMs running on the >>>> machine. The jcmd source code is in the jdk repository like other >>>> existing j* tools. >>>> >>>> To execute a diagnostic command in a particular JVM, the generic >>>> syntax is: >>>> >>>> jcmd [arguments] >>>> >>>> The attachListener has been modified to recognized the jcmd >>>> requests. When a jcmd request is identified, it is parsed to >>>> extract the command name. The JVM performs a look up of this >>>> command in a list of registered commands. To be executable by an >>>> external request, a diagnostic command has to be registered. The >>>> registration is performed with the DCmdFactory class (see >>>> services/management.cpp). >>>> >>>> 3 - The JMX interface >>>> >>>> The framework provides a JMX based interface to the diagnostic >>>> commands. This interface allows remote invocation of diagnostic >>>> commands through a JMX connection. >>>> >>>> 3-1 The interface >>>> >>>> The information related to the diagnostic commands are >>>> accessible through new methods added to the >>>> com.sun.management.HotspotDiagnosticMXBean: >>>> >>>> public List getDiagnosticCommands(); >>>> >>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String >>>> command); >>>> >>>> public List >>>> getDiagnosticCommandInfo(List command); >>>> >>>> public List getDiagnosticCommandInfo(); >>>> >>>> public String execute(String commandLine) throws >>>> IllegalArgumentException ; >>>> >>>> public String execute(String cmd, String... arguments) throws >>>> IllegalArgumentException; >>>> >>>> >>>> The getDiagnosticCommands() method returns an array containing >>>> the names of the not-hidden registered diagnostic commands. >>>> >>>> The three getDiagnosticCommandInfo() methods return one or >>>> several diagnostic command descriptions using the >>>> DiagnosticCommandInfo class. >>>> >>>> The two execute() methods allow the user the invoke a diagnostic >>>> command in different ways. >>>> >>>> The DiagnosticCommandInfo class is describing a diagnostic >>>> command with the following information: >>>> >>>> public class DiagnosticCommandInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getImpact(); >>>> >>>> public boolean isEnabled(); >>>> >>>> public List getArgumentsInfo(); >>>> } >>>> >>>> The getName() method returns the name of the diagnostic command. >>>> This name is the one to use in execute() methods to invoke the >>>> diagnostic command. >>>> >>>> The getDescription() method returns a general description of the >>>> diagnostic command. >>>> >>>> The getImpact() method returns a description of the intrusiveness >>>> of diagnostic command. >>>> >>>> The isEnabled() method returns true if the method is enabled, >>>> false if it is disabled. A disabled method cannot be executed. >>>> >>>> The getArgumentsInfo() returns a list of descriptions for the >>>> options or arguments recognized by the diagnostic command. Each >>>> option/argument is described by a DiagnosticCommandArgumentInfo >>>> instance: >>>> >>>> public class DiagnosticCommandArgumentInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getType(); >>>> >>>> public String getDefault(); >>>> >>>> public boolean isMandatory(); >>>> >>>> public boolean isOption(); >>>> >>>> public int getPosition(); } >>>> >>>> If the DiagnosticCommandArgumentInfo instance describes an >>>> option, isOption() returns true and getPosition() returns -1. >>>> Otherwise, when the DiagnosticCommandArgumentInfo instance >>>> describes an argument, isOption() returns false and getPosition() >>>> returns the expected position for this argument. The position of >>>> an argument is defined relatively to all arguments passed on the >>>> command line, options are not considered when defining an >>>> argument position. The getDefault() method returns the default >>>> value of the argument if a default has been defined, otherwise it >>>> returns null. >>>> >>>> 3-2 The implementation >>>> >>>> The framework has been designed in a way that prevents >>>> diagnostic command developers to worry about the JMX interface. >>>> In addition to the methods described in section 1-2, a diagnostic >>>> command developer has to provide three methods: >>>> >>>> int get_num_arguments() >>>> >>>> which returns the number of option and arguments supported by >>>> the command. >>>> >>>> GrowableArray* get_argument_name_array() >>>> >>>> which provides the name of the arguments supported by the >>>> command. >>>> >>>> GrowableyArray* get_argument_info_array() >>>> >>>> which provides the description of each argument with a >>>> DCmdArgumentInfo instance. DCmdArgumentInfo is a C++ class used >>>> by the framework to generate the >>>> sun.com.management.DcmdArgumentInfo instances. This is done >>>> automatically and the diagnostic command developer doesn't need >>>> to know how to create Java objects from the runtime. >>>> >>>> 4 - The Diagnostic Commands >>>> >>>> To avoid name collisions between diagnostic commands coming from >>>> different projects, use of a flat name space should be avoided >>>> and a more structured organization is recommended. The framework >>>> itself doesn't depend on this organization, so it will be a set >>>> of rules defining a convention in the way commands are named. >>>> >>>> Diagnostic commands can easily organized in a hierarchical way, >>>> so the template for a command name can be: >>>> >>>> .[sub-domain.] >>>> >>>> This template can be extended with sub-sub-domains and so on. >>>> >>>> A special set of commands without domain will be reserved for >>>> the commands related to the diagnostic framework itself, like the >>>> "help" command. >>>> >>>> >>>> Thanks, >>>> >>>> Fred >>>> > From zhouyx at linux.vnet.ibm.com Tue Dec 13 07:21:46 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Tue, 13 Dec 2011 15:21:46 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) Message-ID: Hi all, When I was reading the code of AbstractCollection.toArray(T[] ), I found its behavior maybe different from the spec in multithread environment. The spec says "If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection." However, in multithread environment, it is not easy to tell if the collection fits in the specified array, because the items may be removed when toArray is copying. Here is a testcase: ////////////////////////////////////////////////////////////////////////// import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class CollectionToArrayTest { static volatile Map map = new TConcurrentHashMap(); static volatile boolean gosleep = true; static class TConcurrentHashMap extends ConcurrentHashMap { public int size() { int oldresult = super.size(); System.out.println("map size before concurrent remove is " + oldresult); while (gosleep) { try { // Make sure the map is modified during toArray is called, // between getsize and being iterated. Thread.sleep(1000); // System.out.println("size called, size is " + oldresult + // " take a sleep to make sure the element is deleted before size is returned."); } catch (Exception e) { } } return oldresult; } } static class ToArrayThread implements Runnable { public void run() { for (int i = 0; i < 5; i++) { String str = Integer.toString(i); map.put(str, str); } String[] buffer = new String[4]; String[] strings = map.values().toArray(buffer); // System.out.println("length is " + strings.length); if (strings.length <= buffer.length) { System.out.println("given array size is " + buffer.length + " \nreturned array size is " + strings.length + ", \nbuffer should be used according to spec. Is buffer used : " + (strings == buffer)); } } } static class RemoveThread implements Runnable { public void run() { String str = Integer.toString(0); map.remove(str); gosleep = false; } } public static void main(String args[]) { CollectionToArrayTest app = new CollectionToArrayTest(); app.test_concurrentRemove(); } public void test_concurrentRemove() { System.out.println("//////////////////////////////////////////////\n" + "The spec says if the given array is large\n " + "enough to hold all elements, the given array\n" + "should be returned by toArray. This \n" + "testcase checks this case. \n" + "//////////////////////////////////////////////"); Thread[] threads = new Thread[2]; threads[0] = new Thread(new ToArrayThread()); threads[1] = new Thread(new RemoveThread()); threads[0].start(); try { // Take a sleep to make sure toArray is already called. Thread.sleep(1200); } catch (Exception e) { } threads[1].start(); } } ////////////////////////////////////////////////////////////////////////// TConcurrentHashMap is used to make sure the collection is modified during toArray is invoked. So the returned array fits in the specified array, but a new array is used because toArray checks the size before copying. Is this a bug ? -- Best Regards, Sean Chou From david.holmes at oracle.com Tue Dec 13 07:41:21 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Dec 2011 17:41:21 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: Message-ID: <4EE701A1.2000506@oracle.com> Hi Sean, On 13/12/2011 5:21 PM, Sean Chou wrote: > When I was reading the code of AbstractCollection.toArray(T[] ), I > found its behavior maybe different from the spec in multithread > environment. The spec says "If the collection fits in the specified > array, it is returned therein. Otherwise, a new array is allocated > with the runtime type of the specified array and the size of this > collection." However, in multithread environment, it is not easy to > tell if the collection fits in the specified array, because the > items may be removed when toArray is copying. Right. The problem is that AbstractCollection doesn't address thread-safety or any other concurrency issues so doesn't account for the collection growing or shrinking while the toArray snapshot is being taken. Really the collection implementations that are designed to support multiple threads should override toArray to make it clear how it should behave. As it stands, in my opinion, it is more a "quality of implementation" issue as to whether AbstractCollection expends effort after creating the array to see if the array is actually full or not; or whether after creating an array it turns out it could have fit in the original. For a concurrent collection I would write the spec for toArray something like: "The current size of the collection is examined and if the collection fits in the specified array it will be the target array, else a new array is allocated based on that current size and it becomes the target array. If the collection grows such that the target array no longer fits then extra elements will not be copied into the target array. If the collection shrinks then the target array will contain null elements." Or for the last part "then the target array will be copied to a new array that exactly fits the number of elements returned". David Holmes ------------ > > Here is a testcase: > ////////////////////////////////////////////////////////////////////////// > > import java.util.Map; > import java.util.concurrent.ConcurrentHashMap; > > public class CollectionToArrayTest { > > static volatile Map map = new > TConcurrentHashMap(); > static volatile boolean gosleep = true; > > static class TConcurrentHashMap extends ConcurrentHashMap { > public int size() { > int oldresult = super.size(); > System.out.println("map size before concurrent remove is " > + oldresult); > while (gosleep) { > try { > // Make sure the map is modified during toArray is > called, > // between getsize and being iterated. > Thread.sleep(1000); > // System.out.println("size called, size is " + > oldresult + > // " take a sleep to make sure the element is deleted > before size is returned."); > } catch (Exception e) { > } > } > return oldresult; > } > } > > static class ToArrayThread implements Runnable { > public void run() { > for (int i = 0; i< 5; i++) { > String str = Integer.toString(i); > map.put(str, str); > } > String[] buffer = new String[4]; > String[] strings = map.values().toArray(buffer); > // System.out.println("length is " + strings.length); > if (strings.length<= buffer.length) { > System.out.println("given array size is " > + buffer.length > + " \nreturned array size is " > + strings.length > + ", \nbuffer should be used according to > spec. Is buffer used : " > + (strings == buffer)); > } > } > } > > static class RemoveThread implements Runnable { > public void run() { > String str = Integer.toString(0); > map.remove(str); > gosleep = false; > } > } > > public static void main(String args[]) { > CollectionToArrayTest app = new CollectionToArrayTest(); > app.test_concurrentRemove(); > } > > public void test_concurrentRemove() { > > System.out.println("//////////////////////////////////////////////\n" + > "The spec says if the given array is large\n " + > "enough to hold all elements, the given array\n" + > "should be returned by toArray. This \n" + > "testcase checks this case. \n" + > "//////////////////////////////////////////////"); > > Thread[] threads = new Thread[2]; > threads[0] = new Thread(new ToArrayThread()); > threads[1] = new Thread(new RemoveThread()); > > threads[0].start(); > > try { > // Take a sleep to make sure toArray is already called. > Thread.sleep(1200); > } catch (Exception e) { > } > > threads[1].start(); > } > } > > ////////////////////////////////////////////////////////////////////////// > > TConcurrentHashMap is used to make sure the collection is modified > during toArray is invoked. So the returned array fits in the specified > array, but a new array is used because toArray checks the size > before copying. > > Is this a bug ? > > From Ulf.Zibis at gmx.de Tue Dec 13 10:16:01 2011 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Tue, 13 Dec 2011 11:16:01 +0100 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE701A1.2000506@oracle.com> References: <4EE701A1.2000506@oracle.com> Message-ID: <4EE725E1.2060701@gmx.de> Am 13.12.2011 08:41, schrieb David Holmes: > Hi Sean, > > On 13/12/2011 5:21 PM, Sean Chou wrote: >> When I was reading the code of AbstractCollection.toArray(T[] ), I >> found its behavior maybe different from the spec in multithread >> environment. The spec says "If the collection fits in the specified >> array, it is returned therein. Otherwise, a new array is allocated >> with the runtime type of the specified array and the size of this >> collection." However, in multithread environment, it is not easy to >> tell if the collection fits in the specified array, because the >> items may be removed when toArray is copying. > > Right. The problem is that AbstractCollection doesn't address thread-safety or any other > concurrency issues so doesn't account for the collection growing or shrinking while the toArray > snapshot is being taken. Really the collection implementations that are designed to support > multiple threads should override toArray to make it clear how it should behave. As it stands, in > my opinion, it is more a "quality of implementation" issue as to whether AbstractCollection > expends effort after creating the array to see if the array is actually full or not; or whether > after creating an array it turns out it could have fit in the original. > > For a concurrent collection I would write the spec for toArray something like: > > "The current size of the collection is examined and if the collection fits in the specified array > it will be the target array, else a new array is allocated based on that current size + with the runtime type of the specified array > and it becomes the target array. If the collection grows such that the target array no longer fits > then extra elements will not be copied into the target array. If the collection shrinks then the > target array will contain null elements." What about, if the size is not changed, but some elements were changed (could cause position change) or the order with same elements would be changed? This could cause inconsistencies and/or duplicates in the resulting array from a collection which in worst case doesn't allow duplicates, e.g. Set. IMHO, in concurrent collection, changing the collection's content should be blocked in consistent state until toArray is finished. -Ulf From zhouyx at linux.vnet.ibm.com Tue Dec 13 11:18:20 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Tue, 13 Dec 2011 19:18:20 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE701A1.2000506@oracle.com> References: <4EE701A1.2000506@oracle.com> Message-ID: Hi , Is it possible to change the spec ? I found it is defined in java.utils.Collection interface. It would be easy for AbstractCollection to state that it is not designed for concurrent operations, and its subclass should take care of them. However, I think the simplest way may be modifying toArray(T[]) method for an additional check, which would work for most subclasses of AbstractCollection... Is that ok ? On Tue, Dec 13, 2011 at 3:41 PM, David Holmes wrote: > Hi Sean, > > > On 13/12/2011 5:21 PM, Sean Chou wrote: > >> When I was reading the code of AbstractCollection.toArray(T[] ), I >> found its behavior maybe different from the spec in multithread >> environment. The spec says "If the collection fits in the specified >> array, it is returned therein. Otherwise, a new array is allocated >> with the runtime type of the specified array and the size of this >> collection." However, in multithread environment, it is not easy to >> tell if the collection fits in the specified array, because the >> items may be removed when toArray is copying. >> > > Right. The problem is that AbstractCollection doesn't address > thread-safety or any other concurrency issues so doesn't account for the > collection growing or shrinking while the toArray snapshot is being taken. > Really the collection implementations that are designed to support multiple > threads should override toArray to make it clear how it should behave. As > it stands, in my opinion, it is more a "quality of implementation" issue as > to whether AbstractCollection expends effort after creating the array to > see if the array is actually full or not; or whether after creating an > array it turns out it could have fit in the original. > > For a concurrent collection I would write the spec for toArray something > like: > > "The current size of the collection is examined and if the collection fits > in the specified array it will be the target array, else a new array is > allocated based on that current size and it becomes the target array. If > the collection grows such that the target array no longer fits then extra > elements will not be copied into the target array. If the collection > shrinks then the target array will contain null elements." > > Or for the last part "then the target array will be copied to a new array > that exactly fits the number of elements returned". > > David Holmes > ------------ > > > >> Here is a testcase: >> //////////////////////////////**//////////////////////////////** >> ////////////// >> >> import java.util.Map; >> import java.util.concurrent.**ConcurrentHashMap; >> >> public class CollectionToArrayTest { >> >> static volatile Map map = new >> TConcurrentHashMap(); >> static volatile boolean gosleep = true; >> >> static class TConcurrentHashMap extends ConcurrentHashMap> V> { >> public int size() { >> int oldresult = super.size(); >> System.out.println("map size before concurrent remove is " >> + oldresult); >> while (gosleep) { >> try { >> // Make sure the map is modified during toArray is >> called, >> // between getsize and being iterated. >> Thread.sleep(1000); >> // System.out.println("size called, size is " + >> oldresult + >> // " take a sleep to make sure the element is deleted >> before size is returned."); >> } catch (Exception e) { >> } >> } >> return oldresult; >> } >> } >> >> static class ToArrayThread implements Runnable { >> public void run() { >> for (int i = 0; i< 5; i++) { >> String str = Integer.toString(i); >> map.put(str, str); >> } >> String[] buffer = new String[4]; >> String[] strings = map.values().toArray(buffer); >> // System.out.println("length is " + strings.length); >> if (strings.length<= buffer.length) { >> System.out.println("given array size is " >> + buffer.length >> + " \nreturned array size is " >> + strings.length >> + ", \nbuffer should be used according to >> spec. Is buffer used : " >> + (strings == buffer)); >> } >> } >> } >> >> static class RemoveThread implements Runnable { >> public void run() { >> String str = Integer.toString(0); >> map.remove(str); >> gosleep = false; >> } >> } >> >> public static void main(String args[]) { >> CollectionToArrayTest app = new CollectionToArrayTest(); >> app.test_concurrentRemove(); >> } >> >> public void test_concurrentRemove() { >> >> System.out.println("//////////**//////////////////////////////**//////\n" >> + >> "The spec says if the given array is large\n " + >> "enough to hold all elements, the given array\n" + >> "should be returned by toArray. This \n" + >> "testcase checks this case. \n" + >> "/////////////////////////////** >> /////////////////"); >> >> Thread[] threads = new Thread[2]; >> threads[0] = new Thread(new ToArrayThread()); >> threads[1] = new Thread(new RemoveThread()); >> >> threads[0].start(); >> >> try { >> // Take a sleep to make sure toArray is already called. >> Thread.sleep(1200); >> } catch (Exception e) { >> } >> >> threads[1].start(); >> } >> } >> >> //////////////////////////////**//////////////////////////////** >> ////////////// >> >> TConcurrentHashMap is used to make sure the collection is modified >> during toArray is invoked. So the returned array fits in the specified >> array, but a new array is used because toArray checks the size >> before copying. >> >> Is this a bug ? >> >> >> -- Best Regards, Sean Chou From david.holmes at oracle.com Tue Dec 13 11:55:29 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Dec 2011 21:55:29 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE725E1.2060701@gmx.de> References: <4EE701A1.2000506@oracle.com> <4EE725E1.2060701@gmx.de> Message-ID: <4EE73D31.2010308@oracle.com> On 13/12/2011 8:16 PM, Ulf Zibis wrote: > Am 13.12.2011 08:41, schrieb David Holmes: >> Hi Sean, >> >> On 13/12/2011 5:21 PM, Sean Chou wrote: >>> When I was reading the code of AbstractCollection.toArray(T[] ), I >>> found its behavior maybe different from the spec in multithread >>> environment. The spec says "If the collection fits in the specified >>> array, it is returned therein. Otherwise, a new array is allocated >>> with the runtime type of the specified array and the size of this >>> collection." However, in multithread environment, it is not easy to >>> tell if the collection fits in the specified array, because the >>> items may be removed when toArray is copying. >> >> Right. The problem is that AbstractCollection doesn't address >> thread-safety or any other concurrency issues so doesn't account for >> the collection growing or shrinking while the toArray snapshot is >> being taken. Really the collection implementations that are designed >> to support multiple threads should override toArray to make it clear >> how it should behave. As it stands, in my opinion, it is more a >> "quality of implementation" issue as to whether AbstractCollection >> expends effort after creating the array to see if the array is >> actually full or not; or whether after creating an array it turns out >> it could have fit in the original. >> >> For a concurrent collection I would write the spec for toArray >> something like: >> >> "The current size of the collection is examined and if the collection >> fits in the specified array it will be the target array, else a new >> array is allocated based on that current size > + with the runtime type of the specified array Of course. >> and it becomes the target array. If the collection grows such that the >> target array no longer fits then extra elements will not be copied >> into the target array. If the collection shrinks then the target array >> will contain null elements." > What about, if the size is not changed, but some elements were changed > (could cause position change) or the order with same elements would be > changed? This could cause inconsistencies and/or duplicates in the > resulting array from a collection which in worst case doesn't allow > duplicates, e.g. Set. > IMHO, in concurrent collection, changing the collection's content should > be blocked in consistent state until toArray is finished. It's up to each concurrent collection to specify exactly what it means for itself. A concurrent Set may indeed have to do additional work if it wants to guarantee the array has no duplicates. David > -Ulf > From david.holmes at oracle.com Tue Dec 13 12:06:12 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Dec 2011 22:06:12 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> Message-ID: <4EE73FB4.7030505@oracle.com> On 13/12/2011 9:18 PM, Sean Chou wrote: > Hi , > > Is it possible to change the spec ? I found it is defined in > java.utils.Collection interface. It would be easy for > AbstractCollection to state that it is not designed for concurrent > operations, and its subclass should take care of them. Such a disclaimer might be added to the spec for AbstractCollection but that doesn't really change anything - it just makes observed behaviour less surprising. > However, I think the simplest way may be modifying toArray(T[]) > method for an additional check, which would work for most subclasses of > AbstractCollection... > Is that ok ? "ok" in what sense? Do you want to change the spec or just change the current behaviour? If you do the latter and people rely on that implementation rather than the spec then code will not be portable across different implementations of the platform. I would not want to see a change in behaviour without a change in specification and I do not think the specification for AbstractCollection can, or should be, changed. Just my opinion of course. What is the concrete concurrent collection that you have a problem with? If it is ConcurrentHashMap, as per the example, then perhaps ConcurrentHashMap should be where a change is considered. David ----- > > On Tue, Dec 13, 2011 at 3:41 PM, David Holmes > wrote: > > Hi Sean, > > > On 13/12/2011 5:21 PM, Sean Chou wrote: > > When I was reading the code of AbstractCollection.toArray(T[] ), I > found its behavior maybe different from the spec in multithread > environment. The spec says "If the collection fits in the specified > array, it is returned therein. Otherwise, a new array is allocated > with the runtime type of the specified array and the size of this > collection." However, in multithread environment, it is not easy to > tell if the collection fits in the specified array, because the > items may be removed when toArray is copying. > > > Right. The problem is that AbstractCollection doesn't address > thread-safety or any other concurrency issues so doesn't account for > the collection growing or shrinking while the toArray snapshot is > being taken. Really the collection implementations that are designed > to support multiple threads should override toArray to make it clear > how it should behave. As it stands, in my opinion, it is more a > "quality of implementation" issue as to whether AbstractCollection > expends effort after creating the array to see if the array is > actually full or not; or whether after creating an array it turns > out it could have fit in the original. > > For a concurrent collection I would write the spec for toArray > something like: > > "The current size of the collection is examined and if the > collection fits in the specified array it will be the target array, > else a new array is allocated based on that current size and it > becomes the target array. If the collection grows such that the > target array no longer fits then extra elements will not be copied > into the target array. If the collection shrinks then the target > array will contain null elements." > > Or for the last part "then the target array will be copied to a new > array that exactly fits the number of elements returned". > > David Holmes > ------------ > > > > Here is a testcase: > //////////////////////////////__//////////////////////////////__////////////// > > import java.util.Map; > import java.util.concurrent.__ConcurrentHashMap; > > public class CollectionToArrayTest { > > static volatile Map map = new > TConcurrentHashMap(); > static volatile boolean gosleep = true; > > static class TConcurrentHashMap extends > ConcurrentHashMap { > public int size() { > int oldresult = super.size(); > System.out.println("map size before concurrent > remove is " > + oldresult); > while (gosleep) { > try { > // Make sure the map is modified during > toArray is > called, > // between getsize and being iterated. > Thread.sleep(1000); > // System.out.println("size called, size is " + > oldresult + > // " take a sleep to make sure the element > is deleted > before size is returned."); > } catch (Exception e) { > } > } > return oldresult; > } > } > > static class ToArrayThread implements Runnable { > public void run() { > for (int i = 0; i< 5; i++) { > String str = Integer.toString(i); > map.put(str, str); > } > String[] buffer = new String[4]; > String[] strings = map.values().toArray(buffer); > // System.out.println("length is " + strings.length); > if (strings.length<= buffer.length) { > System.out.println("given array size is " > + buffer.length > + " \nreturned array size is " > + strings.length > + ", \nbuffer should be used > according to > spec. Is buffer used : " > + (strings == buffer)); > } > } > } > > static class RemoveThread implements Runnable { > public void run() { > String str = Integer.toString(0); > map.remove(str); > gosleep = false; > } > } > > public static void main(String args[]) { > CollectionToArrayTest app = new CollectionToArrayTest(); > app.test_concurrentRemove(); > } > > public void test_concurrentRemove() { > > System.out.println("//////////__//////////////////////////////__//////\n" > + > "The spec says if the given array is large\n " + > "enough to hold all elements, the given array\n" + > "should be returned by toArray. This \n" + > "testcase checks this case. \n" + > "/////////////////////////////__/////////////////"); > > Thread[] threads = new Thread[2]; > threads[0] = new Thread(new ToArrayThread()); > threads[1] = new Thread(new RemoveThread()); > > threads[0].start(); > > try { > // Take a sleep to make sure toArray is already called. > Thread.sleep(1200); > } catch (Exception e) { > } > > threads[1].start(); > } > } > > //////////////////////////////__//////////////////////////////__////////////// > > TConcurrentHashMap is used to make sure the collection is modified > during toArray is invoked. So the returned array fits in the > specified > array, but a new array is used because toArray checks the size > before copying. > > Is this a bug ? > > > > > > -- > Best Regards, > Sean Chou > From Ulf.Zibis at gmx.de Tue Dec 13 12:00:26 2011 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Tue, 13 Dec 2011 13:00:26 +0100 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> Message-ID: <4EE73E5A.4080803@gmx.de> Am 13.12.2011 12:18, schrieb Sean Chou: > Hi , > > Is it possible to change the spec ? I found it is defined in > java.utils.Collection > interface. It would be easy for AbstractCollection to state that it is not > designed > for concurrent operations, and its subclass should take care of them. +1 -Ulf From zhouyx at linux.vnet.ibm.com Tue Dec 13 13:30:58 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Tue, 13 Dec 2011 21:30:58 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE73FB4.7030505@oracle.com> References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> Message-ID: Sorry for the confuse. By "ok", I mean "compare the size of array which is going to be returned and the size of the specified array, and copy the elements into the specified array if it is larger and return the specified array." Nothing is causing problem for now, I just found a mismatch. I think most guys will just use the returned array without checking if it's the specified one; and this is also why I think it may be possible to modify the behavior without causing problems. And I think modifying ConcurrentHashMap is as dangerous as modifying AbstractCollection if people are relying on implementation, is this right? So it seems we can do nothing to the mismatch now... On Tue, Dec 13, 2011 at 8:06 PM, David Holmes wrote: > On 13/12/2011 9:18 PM, Sean Chou wrote: > >> Hi , >> >> Is it possible to change the spec ? I found it is defined in >> java.utils.Collection interface. It would be easy for >> AbstractCollection to state that it is not designed for concurrent >> operations, and its subclass should take care of them. >> > > Such a disclaimer might be added to the spec for AbstractCollection but > that doesn't really change anything - it just makes observed behaviour less > surprising. > > > However, I think the simplest way may be modifying toArray(T[]) >> method for an additional check, which would work for most subclasses of >> AbstractCollection... >> Is that ok ? >> > > "ok" in what sense? Do you want to change the spec or just change the > current behaviour? If you do the latter and people rely on that > implementation rather than the spec then code will not be portable across > different implementations of the platform. > > I would not want to see a change in behaviour without a change in > specification and I do not think the specification for AbstractCollection > can, or should be, changed. Just my opinion of course. > > What is the concrete concurrent collection that you have a problem with? > If it is ConcurrentHashMap, as per the example, then perhaps > ConcurrentHashMap should be where a change is considered. > > David > ----- > > >> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes > >> wrote: >> >> Hi Sean, >> >> >> On 13/12/2011 5:21 PM, Sean Chou wrote: >> >> When I was reading the code of AbstractCollection.toArray(T[] ), I >> found its behavior maybe different from the spec in multithread >> environment. The spec says "If the collection fits in the specified >> array, it is returned therein. Otherwise, a new array is allocated >> with the runtime type of the specified array and the size of this >> collection." However, in multithread environment, it is not easy >> to >> tell if the collection fits in the specified array, because the >> items may be removed when toArray is copying. >> >> >> Right. The problem is that AbstractCollection doesn't address >> thread-safety or any other concurrency issues so doesn't account for >> the collection growing or shrinking while the toArray snapshot is >> being taken. Really the collection implementations that are designed >> to support multiple threads should override toArray to make it clear >> how it should behave. As it stands, in my opinion, it is more a >> "quality of implementation" issue as to whether AbstractCollection >> expends effort after creating the array to see if the array is >> actually full or not; or whether after creating an array it turns >> out it could have fit in the original. >> >> For a concurrent collection I would write the spec for toArray >> something like: >> >> "The current size of the collection is examined and if the >> collection fits in the specified array it will be the target array, >> else a new array is allocated based on that current size and it >> becomes the target array. If the collection grows such that the >> target array no longer fits then extra elements will not be copied >> into the target array. If the collection shrinks then the target >> array will contain null elements." >> >> Or for the last part "then the target array will be copied to a new >> array that exactly fits the number of elements returned". >> >> David Holmes >> ------------ >> >> >> >> Here is a testcase: >> //////////////////////////////**__////////////////////////////** >> //__////////////// >> >> import java.util.Map; >> import java.util.concurrent.__**ConcurrentHashMap; >> >> >> public class CollectionToArrayTest { >> >> static volatile Map map = new >> TConcurrentHashMap(); >> static volatile boolean gosleep = true; >> >> static class TConcurrentHashMap extends >> ConcurrentHashMap { >> public int size() { >> int oldresult = super.size(); >> System.out.println("map size before concurrent >> remove is " >> + oldresult); >> while (gosleep) { >> try { >> // Make sure the map is modified during >> toArray is >> called, >> // between getsize and being iterated. >> Thread.sleep(1000); >> // System.out.println("size called, size is " >> + >> oldresult + >> // " take a sleep to make sure the element >> is deleted >> before size is returned."); >> } catch (Exception e) { >> } >> } >> return oldresult; >> } >> } >> >> static class ToArrayThread implements Runnable { >> public void run() { >> for (int i = 0; i< 5; i++) { >> String str = Integer.toString(i); >> map.put(str, str); >> } >> String[] buffer = new String[4]; >> String[] strings = map.values().toArray(buffer); >> // System.out.println("length is " + strings.length); >> if (strings.length<= buffer.length) { >> System.out.println("given array size is " >> + buffer.length >> + " \nreturned array size is " >> + strings.length >> + ", \nbuffer should be used >> according to >> spec. Is buffer used : " >> + (strings == buffer)); >> } >> } >> } >> >> static class RemoveThread implements Runnable { >> public void run() { >> String str = Integer.toString(0); >> map.remove(str); >> gosleep = false; >> } >> } >> >> public static void main(String args[]) { >> CollectionToArrayTest app = new CollectionToArrayTest(); >> app.test_concurrentRemove(); >> } >> >> public void test_concurrentRemove() { >> >> System.out.println("//////////**__////////////////////////////** >> //__//////\n" >> >> + >> "The spec says if the given array is large\n " + >> "enough to hold all elements, the given array\n" + >> "should be returned by toArray. This \n" + >> "testcase checks this case. \n" + >> "/////////////////////////////**__/////////////////"); >> >> >> Thread[] threads = new Thread[2]; >> threads[0] = new Thread(new ToArrayThread()); >> threads[1] = new Thread(new RemoveThread()); >> >> threads[0].start(); >> >> try { >> // Take a sleep to make sure toArray is already >> called. >> Thread.sleep(1200); >> } catch (Exception e) { >> } >> >> threads[1].start(); >> } >> } >> >> //////////////////////////////**__////////////////////////////** >> //__////////////// >> >> >> TConcurrentHashMap is used to make sure the collection is modified >> during toArray is invoked. So the returned array fits in the >> specified >> array, but a new array is used because toArray checks the size >> before copying. >> >> Is this a bug ? >> >> >> >> >> >> -- >> Best Regards, >> Sean Chou >> >> -- Best Regards, Sean Chou From frederic.parain at oracle.com Tue Dec 13 14:04:56 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Tue, 13 Dec 2011 15:04:56 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE65F4D.7040109@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> <4EE6243B.6070200@oracle.com> <4EE65F4D.7040109@oracle.com> Message-ID: <4EE75B88.3070509@oracle.com> Hi Dan, Thank you for the review. The new webrev is here: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.05/ And my answers are in-lined below. On 12/12/11 09:08 PM, Daniel D. Daugherty wrote: > src/share/vm/services/attachListener.cpp > The new include should be in alpha-order (between lines 36 & 37). > I'm pretty sure that's the new style... Fixed > Block comment on lines 152-155 should be in '//' style and not > in JavaDoc style (/** ... */) Fixed > src/share/vm/services/jmm.h > lines 192-208 - HotSpot convention is to mimic the existing style > in a file. For these structs, the field names should all be > lined up (see 181-188 for an example). Fixed > src/share/vm/services/management.cpp > line 2126 calls JNIHandles::make_local(), but this is a JVM_ENTRY > wrapped function which means it depends on VM_ENTRY_BASE which > has a HandleMarkCleaner in it. Since this is a make_local() > call, won't the local JNIHandle get scrubbed on the way back > to the caller? Threads have two areas to store handles, one for internal handles and one for JNI handles. The HandleMarkCleaner applies only to the internal handles. The purpose of the make_local() is to create a JNI handle from the internal handle, so when the internal area is cleaned up by the HandleMarkCleaner, the JNI handle is still valid in the context of the caller. > src/share/vm/services/diagnosticArgument.hpp > lines 45-50 - too much indent; should be 4 spaces Fixed > src/share/vm/services/diagnosticArgument.cpp > HotSpot style is generally 'if (' and not 'if(' Fixed > src/share/vm/services/diagnosticCommand.hpp > lines 28-36 - includes should be in alpha order Fixed > lines 44, 64 - Parameter defaults in new code is generally frowned > upon in HotSpot. They're used when adding a parameter to existing > code to avoid changing existing calls where the default is OK. > (I happen to disagree with that last part and I think that all > calls should be updated just to make sure your reviewers see > all uses, but I'm just one cranky voice... :-)) I've removed all default parameters I found. > src/share/vm/services/diagnosticCommand.cpp > line 28: includes should be in alpha order Fixed > lines 31-33 - should be some indent here Fixed > line 74: It would be useful to display the command that > can't be found: > > help foo > Help unavailable: 'foo': No such command Done. > line 101: just FYI, a ResourceMark without a Thread parameter can > be expensive. Not an issue for HelpDCmd::num_arguments(). I was not aware of the performance penalty. However, this method is called only once in the lifetime of the VM, so I didn't fixed it. > line 103: HotSpot style is generally 'if (' and not 'if(' Fixed > src/share/vm/services/diagnosticFramework.hpp > line 38: typo: 'provides method' -> 'provides methods' > line 40: typo: 'keywor' -> 'keyword' Fixed. > lines 43-46 - fields nicely indented here, but not in other new > header files. Any particular reason? Yes, I got several reviews about the style :-) > lines 48, 154, 218, 286, 324 - Parameter defaults again. Removed > line 55: is_stop should be: > return !is_empty() && strncmp("stop", _cmd, _cmd_len) == 0; > !strncmp() is frowned upon and spaces between params OK. Fixed > line 82 - returns a local variable; that shouldn't work. The method doesn't really return a local variable, this is a return by value. The return statement invokes the copy constructor to duplicate the local object into the caller context. Here, the default copy constructor is called but it's okay because the CmdLine class has be designed to work this way. I've added a comment in the code to make this mechanism more explicit. > line 155: missing a space after '=' Fixed > lines 256, 258: HotSpot style is generally 'if (' and not 'if(' Fixed > line 304: typo: 'DCmdFActory' -> 'DCmdFactory' Fixed > line 306: typo: 'command to be executed' -> 'command from being executed' Fixed > src/share/vm/services/diagnosticFramework.cpp > line 55: _cmd_len = cmd_end - line; > This length includes any leading white space that was skipped > on lines 42-44. It seems odd that '_cmd' points to the first > non-whitespace in the command, but _cmd_len includes the > leading white space. If you change the _cmd_len calculation, > then you have to also change the logic on line 58 so that > args_len is also not too long. You're right, this is definitively odd. I've fixed _cmd_len and updated line 58. > lines 79, 104: typo: 'simple' -> 'single' Fixed > line 318 - what is 'idx' used for? Remaining code from a previous version. Unused now, so I removed it. > line 367: HotSpot style is generally 'if (' and not 'if(' > lines 371, 372, 380, 403, 416: space after comma Fixed Thank you, Fred -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From frederic.parain at oracle.com Tue Dec 13 14:05:54 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Tue, 13 Dec 2011 15:05:54 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE71E3F.9010703@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> <4EE6243B.6070200@oracle.com> <4EE71E3F.9010703@oracle.com> Message-ID: <4EE75BC2.5000401@oracle.com> Hi Serguei, Thanks for the review. I've applied the changes and the new webrev is here: http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.05/ Regards, Fred On 12/13/11 10:43 AM, serguei.spitsyn at oracle.com wrote: > Hi Frederik, > > Your fix is already in a good shape! > > src/share/vm/services/management.cpp: > > It is better to have different diagnostic messages at lines 2181 and 2186 > so that it is easy to find out what of the two lines caused an exception. > The messages would be better to be more specific. > The same applies to the lines 2221 and 2226. > Indent must be aligned with the first argument above. > > 2178 oop cmd = JNIHandles::resolve_external_guard(command); > 2179 if (cmd == NULL) { > 2180 THROW_MSG(vmSymbols::java_lang_NullPointerException(), > 2181 "Command line cannot be null."); > 2182 } > 2183 char* cmd_name = java_lang_String::as_utf8_string(cmd); > 2184 if (cmd_name == NULL) { > 2185 THROW_MSG(vmSymbols::java_lang_NullPointerException(), > 2186 "Command line cannot be null."); > 2187 } > ... > 2219 if (cmd == NULL) { > 2220 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), > 2221 "Command line cannot be null."); > 2222 } > 2223 char* cmdline = java_lang_String::as_utf8_string(cmd); > 2224 if (cmdline == NULL) { > > 2225 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), > 2226 "Command line cannot be null."); > 2227 } > > The lines 2189 and 2194 look redundant: > > src/share/vm/services/diagnosticFramework.cpp: > > 2188 DCmd* dcmd = NULL; > 2189 { > 2190 DCmdFactory*factory = DCmdFactory::factory(cmd_name, strlen(cmd_name)); > 2191 if (factory != NULL) { > 2192 dcmd = factory->create_resource_instance(NULL); > 2193 } > 2194 } > > Indent is not correct at the lines 2205-2211: > > 2204 for (int i = 0; i< array->length(); i++) { > 2205 infoArray[i].name = array->at(i)->name(); > 2206 infoArray[i].description = array->at(i)->description(); > 2207 infoArray[i].type = array->at(i)->type(); > 2208 infoArray[i].default_string = array->at(i)->default_string(); > 2209 infoArray[i].mandatory = array->at(i)->is_mandatory(); > 2210 infoArray[i].option = array->at(i)->is_option(); > 2211 infoArray[i].position = array->at(i)->position(); > 2212 } > > > Space is missed after 'while': > > 320 while(arg != NULL) { > 326 while(arg != NULL) { > > > Thanks, > Serguei > > > > On 12/12/11 7:56 AM, Frederic Parain wrote: >> Minor updates: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.04/ >> >> Fred >> >> On 12/12/11 03:29 PM, Frederic Parain wrote: >>> Hi Paul, >>> >>> Thank you for the review. >>> I've applied all your recommendations except the refactoring >>> in diagnosticCommandFramework.cpp (too few lines can be really >>> factored out without passing many arguments). >>> >>> New webrev is here: >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >>> >>> Regards, >>> >>> Fred >>> >>> On 12/ 8/11 07:26 PM, Paul Hohensee wrote: >>>> For the hotspot part at >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> >>>> Most of my comments are style-related. Nice job on the implementation >>>> architecture. >>>> >>>> In attachListener.cpp: >>>> >>>> You might want to delete the first "return JNI_OK;" line, since the >>>> code >>>> under >>>> HAS_PENDING_EXCEPTION just falls through. >>>> >>>> In jmm.h: >>>> >>>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the >>>> existing declarations. Add a newline just before it on line 322. >>>> >>>> >>>> In diagnosticFramework.hpp: >>>> >>>> Fix indenting for lines 63-66, insert blank before "size_t" on line 48. >>>> >>>> Hotspot convention is that getter method names don't include a "get_" >>>> prefix. >>>> So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). >>>> Similarly, getters such as is_enabled() should retrieve a field named >>>> "_is_enabled" >>>> rather than one named "enabled". You follow the "_is_enabled" >>>> convention >>>> in other places such as GenDCmdArgument. Or you could use enabled() to >>>> get the value of the _enabled field. >>>> >>>> Also generally, I'd use accessor methods in the implementation of more >>>> complex member methods rather than access the underlying fields >>>> directly. >>>> E.g. in GenDCmdArgument::read_value, I'd use is_set() and >>>> set_is_set(true), >>>> (set_is_set() is not actually defined, but should be) rather than >>>> directly >>>> accessing _is_set. Though sometimes doing this is too much of a pain >>>> with fields whose type is a template argument, as in the >>>> DCmdArggument::parse_value() method in diagnosticArgument.cpp. >>>> >>>> For easy readability, it'd be nice to line up field names (the ones >>>> with an >>>> _ prefix) at the same column. >>>> >>>> On line 200, "instanciated" -> "instantiated" >>>> >>>> On line 218, I'd use "heap_allocated" rather than "heap" for the formal >>>> arg name. >>>> >>>> On line 248, you could indent the text to start underneath >>>> "outputStream". >>>> I generally find that indenting arguments lines (formal or actual) so >>>> they line >>>> up with the first argument position make the code more readable, but >>>> I'm >>>> not >>>> religious about it. >>>> >>>> On line 265, "instanciated" -> "instantiated" >>>> >>>> DCmdFactorys are members of a singly-linked list, right? If so, it'd be >>>> good to >>>> have a comment to that effect on the declaration of _next. >>>> >>>> On line 322, insert a blank before "true". You might fix this in other >>>> places >>>> where there's no blank between a comma in an argument list and the >>>> following parameter value. >>>> >>>> >>>> In diagnosticCommandFramework.cpp: >>>> >>>> The code from lines 80-95 and 105-120 is identical. Factor out? >>>> >>>> >>>> In diagnosticArgument.cpp: >>>> >>>> On line 41, insert blanks before the actual arguments. (see above >>>> generic comment) >>>> >>>> On line 77, the "if" is indented one space too many. >>>> >>>> >>>> In management.cpp: >>>> >>>> I'd be consistent with having or not having a space between "while", >>>> "if" and "for" >>>> and the following "(" in this and your other code. Most hotspot code >>>> has >>>> a space. >>>> >>>> >>>> Thanks, >>>> >>>> Paul >>>> >>>> >>>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>>> Hi All, >>>>> >>>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>>> because changes are pretty big and touch all these areas] >>>>> >>>>> Here's a framework for issuing diagnostics commands to the JVM. >>>>> Diagnostic commands are actions executed inside the JVM mainly >>>>> for monitoring or management purpose. This work has two parts. >>>>> The first part is in the hotspot repository and contains the >>>>> framework itself with two diagnostic commands. The second >>>>> part is in the JDK repository and contains the command line >>>>> utility to invoke diagnostic commands as well as the >>>>> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >>>>> extensions allow a remote client to discover and invoke >>>>> diagnostic commands using a JMX connection. >>>>> >>>>> This changeset only contains two diagnostic commands, more >>>>> commands will be added in the future, as a standalone effort >>>>> to improve the monitoring and management services of the >>>>> JVM, or as part of other projects. >>>>> >>>>> Webrevs are here: >>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>>> >>>>> Here's a technical description of this work: >>>>> >>>>> 1 - The Diagnostic Command Framework >>>>> 1-1 Overview >>>>> >>>>> The diagnostic command framework is fully implemented in native code >>>>> and relies on the HotSpot's internal exception mechanism. >>>>> The rational of a pure native implementation is to be able to execute >>>>> diagnostic commands even in critical situations like an OutOfMemory >>>>> error. All diagnostic commands are registered in a single list, and >>>>> two >>>>> flags control the way a user can interact with them. The "hidden" flag >>>>> prevents a diagnostic command from appearing in the list of available >>>>> commands returned by the "help" command. However, it's still >>>>> possible to >>>>> get the detailed help message for a hidden command with the "help >>>>> " syntax (but it requires to know the name of the hidden >>>>> command). The second flag is "enabled" and it controls if a command >>>>> can >>>>> be invoked or not. When listed with the "help" commands, disabled >>>>> commands appear with a "[disabled]" label in their description. If the >>>>> user tries to invoke a disabled command, an error message is returned >>>>> and the command is not run. This error message can be customized on a >>>>> per command base. The framework just provides these two flags with >>>>> their >>>>> semantic, it doesn't provide any policy or mechanism to set or modify >>>>> these flags. These actions will be delegated to the JVM or special >>>>> diagnostic commands. >>>>> >>>>> 1-2 Implementation >>>>> >>>>> All diagnostic commands are implemented as subclasses of the DCmd >>>>> class >>>>> defined in services/diagnosticFramework.hpp. Here's the layout of the >>>>> DCmd class and the list of methods that a new command has to define or >>>>> overwrite: >>>>> >>>>> class DCmd { >>>>> DCmd(outputStream *output); >>>>> >>>>> static const char *get_name(); >>>>> >>>>> static const char *get_description(); >>>>> >>>>> static const char *get_disabled_message(); >>>>> >>>>> static const char *get_impact(); >>>>> >>>>> static int get_num_arguments(); >>>>> >>>>> virtual void print_help(outputStream* out); >>>>> >>>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>>> >>>>> virtual void execute(TRAPS); >>>>> >>>>> virtual void reset(TRAPS); >>>>> >>>>> virtual void cleanup(); >>>>> >>>>> virtual GrowableArray* get_argument_name_array(); >>>>> >>>>> virtual GrowableArray* get_argument_info_array(); >>>>> } >>>>> >>>>> A diagnostic command is always instantiated with an outputStream in >>>>> parameter. This outputStream can point either to a file, a buffer or a >>>>> socket (see the ostream.hpp file). >>>>> >>>>> The get_name() method returns the string that will identify the >>>>> command >>>>> (i.e. the string to put on the command line to invoke it). >>>>> >>>>> The get_description() methods returns the global description of the >>>>> command. >>>>> >>>>> The get_disabled_message() returns the customized message to return >>>>> when >>>>> the command is disabled, without having to instantiate the command. >>>>> >>>>> The get_impact() returns a description of the intrusiveness of the >>>>> diagnostic command on the Java Virtual Machine behavior. The rational >>>>> for this method is that some diagnostic commands can seriously disrupt >>>>> the behavior of the Java Virtual Machine (for instance a Thread >>>>> Dump for >>>>> an application with several tens of thousands of threads, or a Head >>>>> Dump >>>>> with a 40GB+ heap size) and other diagnostic commands have no serious >>>>> impact on the JVM (for instance, getting the command line arguments or >>>>> the JVM version). The recommended format for the description is >>>>> >>>> level>: [longer description], where the impact level is selected among >>>>> this list: {low, medium, high}. The optional longer description can >>>>> provide more specific details like the fact that Thread Dump impact >>>>> depends on the heap size. >>>>> >>>>> The get_num_arguments() returns the number of options/arguments >>>>> recognized by the diagnostic command. This method is only used by the >>>>> JMX interface support (see below). >>>>> >>>>> The print_help() methods prints a detailed help on the outputStream >>>>> passed in argument. The detailed help contains the list of all >>>>> supported >>>>> options with their type and description. >>>>> >>>>> The parse() method is in charge of parsing the command arguments. Each >>>>> command is free to implement its own argument parser. However, an >>>>> argument parser framework is provided (see section 1-3) to ease the >>>>> implementation, but its use is optional. The parse method takes a >>>>> delimiter character in argument, which is used to mark the limit >>>>> between >>>>> two arguments (typically invocation from jcmd will use a space >>>>> character >>>>> as a delimiter while invocation from the JVM command line parsing code >>>>> will use a comma as a delimiter). >>>>> >>>>> The execute() method is naturally the one to invoke to get the >>>>> diagnostic command executed. The parse() and the execute() methods are >>>>> dissociated, so it's a possible perform the argument parsing in one >>>>> thread, and delegate the execution to another thread, as long as the >>>>> diagnostic command doesn't reference thread local variables. The >>>>> framework allows several instances of the same diagnostic command >>>>> to be >>>>> executed in parallel. If for some reasons concurrent executions should >>>>> not be allowed for a given diagnostic command, this is the >>>>> responsibility of the diagnostic command implementor to enforce this >>>>> rule, for instance by protecting the body of the execute() method >>>>> with a >>>>> global lock. >>>>> >>>>> The reset() method is used to initialize the internal fields of the >>>>> diagnostic command or to reset the internal fields to their initial >>>>> value to be able to re-use an already allocated diagnostic command >>>>> instance. >>>>> >>>>> The cleanup() method is used to perform perform cleanup (like >>>>> freeing of >>>>> all memory allocated to store internal data). The DCmd extends the >>>>> ResourceObj class, so when allocated in a ResourceArea, destructors >>>>> cannot be used to perform cleanup. To ensure that cleanup is performed >>>>> in all cases, it is recommended to create a DCmdMark instance for each >>>>> DCmd instance. DCmdMark is a stack allocated object with a pointer >>>>> to a >>>>> DCmd instance. When the DCmdMark is destroyed, its destructor calls >>>>> the >>>>> cleanup() method of the DCmd instance it points to. If the DCmd >>>>> instance >>>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>>> memory >>>>> allocated to store the DCmd instance. >>>>> >>>>> The get_argument_name_array() and get_argument_info_array() are >>>>> related >>>>> to the JMX interface of the diagnostic command framework, so they are >>>>> described in section 3. >>>>> >>>>> 1-3 DCmdParser framework >>>>> >>>>> The DCmdParser class is an optional framework to help development of >>>>> argument parsers. It provides many features required by the diagnostic >>>>> command framework (generation of the help message or the argument >>>>> descriptions for the JMX interface) but all these features can >>>>> easily be >>>>> re-implemented if a developer decides not to use the DCmdParser >>>>> framework. >>>>> >>>>> The DCmdParser class is relying on the DCmdArgument template. This >>>>> template must be used to define the different types of argument the >>>>> parser will have to handle. When a new specialization of the >>>>> template is >>>>> done, three methods have to be provided: >>>>> >>>>> void parse_value(const char *str,size_t len,TRAPS); >>>>> void init_value(TRAPS); >>>>> void destroy_value(); >>>>> >>>>> The parse_value() method is used to convert a string into an argument >>>>> value. The print_value() method is used to display the default value >>>>> (support for the detailed help message). The init_value() method is >>>>> used >>>>> to initialize or reset the argument value. The destroy_value() >>>>> method is >>>>> a clean-up method (useful when the argument has allocated some C-Heap >>>>> memory to store its value and this memory has to be freed before >>>>> destroying the DCmdArgument instance). >>>>> >>>>> The DCmdParser makes a distinction between options and arguments. >>>>> Options are identified by a key name that must appear on the command >>>>> line, while argument are identified just by the position of the >>>>> argument >>>>> on the command line. Options use the = syntax. In case of >>>>> boolean options, the '=' part of the syntax can be omitted >>>>> to set >>>>> the option to true. Arguments are just sequences characters >>>>> delimited by >>>>> a separator character. This separator can be specified at runtime when >>>>> invoking the diagnostic command framework. If an argument contain a >>>>> character that could be used as a delimiter, it's possible to enclose >>>>> the argument between single or double quotes. Options are arguments >>>>> are >>>>> instantiated using the same DCmdArgument class but they're registered >>>>> differently to the DCmdParser. >>>>> >>>>> The way to use the DCmdParser is to declare the parser and the >>>>> option/arguments as fields of the diagnostic command class (which is >>>>> itself a sub-class of the DCmd class), like this: >>>>> >>>>> >>>>> class EchoDCmd : public DCmd { >>>>> protected: >>>>> DCmdParser _dcmdparser; >>>>> >>>>> DCmdArgument _required; >>>>> >>>>> DCmdArgument _intval; >>>>> >>>>> DCmdArgument _boolval; >>>>> >>>>> DCmdArgument _stringval; >>>>> >>>>> DCmdArgument _first_arg; >>>>> >>>>> DCmdArgument _second_arg; >>>>> >>>>> DCmdArgument _optional_arg; >>>>> >>>>> } >>>>> >>>>> The parser and the options/arguments must be initialized before the >>>>> diagnostic command class, and the options/arguments have to be >>>>> registered to the parser like this: >>>>> >>>>> EchoDCmd(outputStream *output) : DCmd(output), >>>>> _stringval("-strval","a string argument","STRING",false), >>>>> >>>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>>> >>>>> _intval("-intval","an integer argument","INTEGER",false), >>>>> >>>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>>> >>>>> _fist_arg("first argument","a string argument","STRING",true), >>>>> >>>>> _second_arg("second argument,"an integer argument,"INTEGER",true), >>>>> >>>>> _optional_arg("optional argument","an optional string >>>>> argument","STRING","false") >>>>> >>>>> { >>>>> >>>>> _dcmdparser.add_dcmd_option(&_stringval) >>>>> >>>>> _dcmdparser.add_dcmd_option(&_boolval); >>>>> >>>>> _dcmdparser.add_dcmd_option(&_intval); >>>>> >>>>> _dcmdparser.add_dcmd_option(&_required); >>>>> >>>>> _dcmdparser.add_argument(&_first_arg); >>>>> >>>>> _dcmdparser.add_argument(&_second_arg); >>>>> >>>>> _dcmdparser.add_argument(&_optional_arg); >>>>> }; >>>>> >>>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >>>>> argument/option to the parser. The option/argument constructor >>>>> takes the >>>>> name of the option/argument, its description, a string describing its >>>>> type and a boolean to specify if the option/argument is mandatory or >>>>> not. The parser doesn't support option/argument duplicates (having the >>>>> same name) but the code currently doesn't check for duplicates.The >>>>> order >>>>> used to register options has no impact on the parser. However, the >>>>> order >>>>> used to register arguments is critical because the parser will use the >>>>> same order to parse the command line. In the example above, the parser >>>>> expects to have a first argument of type STRING (parsed using >>>>> _first_arg), then a second argument of type INTEGER (parsed using >>>>> _second_arg) and optionally a third parameter of type STRING (parsed >>>>> using _optional_arg). A mandatory option or argument has to be specify >>>>> every time the command is invoked. If it is missing, an exception is >>>>> thrown at the end of the parsing. Optional arguments have to be >>>>> registered after mandatory arguments. An optional argument will be >>>>> considered for parsing only if all arguments before it (mandatory or >>>>> not) have already been used to parse the command line. >>>>> >>>>> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >>>>> instance. The rational for this design is to limit the number of >>>>> C-heap >>>>> allocations but also to be able to pre-allocate diagnostic command >>>>> instances for critical situations. If the process is running out of >>>>> C-heap space, it's not possible to instantiate new diagnostic commands >>>>> to troubleshoot the situation. By pre-allocating some diagnostic >>>>> commands, it will be possible to run them even in this critical >>>>> situation. Of course, the diagnostic command itself should not try to >>>>> allocate memory during its execution, this prevents the diagnostic >>>>> command to use variable length arguments like strings. By nature, >>>>> pre-allocated diagnostic commands aim to be re-usable, this is the >>>>> purpose of the reset() method which restores the default status of all >>>>> arguments. >>>>> >>>>> 1-4 Internal invocation >>>>> >>>>> Using a diagnostic command from the JVM itself is pretty easy: >>>>> instantiate the class and invoke the parse() method then the execute() >>>>> method. A diagnostic command can be instantiated from inside the JVM >>>>> even it is not registered. This is a difference with the external >>>>> invocations (from jcmd or JMX) that require the command to be >>>>> registered. >>>>> >>>>> 2 - The JCmd interface >>>>> >>>>> Diagnostic commands can also be invoked from outside the JVM process, >>>>> using the new 'jcmd' utility. The jcmd program uses the attach API >>>>> to connect to the JVM, send requests and receive results. The >>>>> jcmd utility must be launched on the same machine than the one running >>>>> the JVM (its a local tool). Launched without arguments, jcmd >>>>> displays a >>>>> list of all JVMs running on the machine. The jcmd source code is in >>>>> the jdk repository like other existing j* tools. >>>>> >>>>> To execute a diagnostic command in a particular JVM, the generic >>>>> syntax is: >>>>> >>>>> jcmd [arguments] >>>>> >>>>> The attachListener has been modified to recognized the jcmd requests. >>>>> When a jcmd request is identified, it is parsed to extract the command >>>>> name. The JVM performs a look up of this command in a list of >>>>> registered >>>>> commands. To be executable by an external request, a diagnostic >>>>> command >>>>> has to be registered. The registration is performed with the >>>>> DCmdFactory >>>>> class (see services/management.cpp). >>>>> >>>>> 3 - The JMX interface >>>>> >>>>> The framework provides a JMX based interface to the diagnostic >>>>> commands. >>>>> This interface allows remote invocation of diagnostic commands >>>>> through a >>>>> JMX connection. >>>>> >>>>> 3-1 The interface >>>>> >>>>> The information related to the diagnostic commands are accessible >>>>> through new methods added to the >>>>> com.sun.management.HotspotDiagnosticMXBean: >>>>> >>>>> public List getDiagnosticCommands(); >>>>> >>>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >>>>> >>>>> public List >>>>> getDiagnosticCommandInfo(List >>>>> command); >>>>> >>>>> public List getDiagnosticCommandInfo(); >>>>> >>>>> public String execute(String commandLine) throws >>>>> IllegalArgumentException ; >>>>> >>>>> public String execute(String cmd, String... arguments) >>>>> throws IllegalArgumentException; >>>>> >>>>> >>>>> The getDiagnosticCommands() method returns an array containing the >>>>> names >>>>> of the not-hidden registered diagnostic commands. >>>>> >>>>> The three getDiagnosticCommandInfo() methods return one or several >>>>> diagnostic command descriptions using the DiagnosticCommandInfo class. >>>>> >>>>> The two execute() methods allow the user the invoke a diagnostic >>>>> command >>>>> in different ways. >>>>> >>>>> The DiagnosticCommandInfo class is describing a diagnostic command >>>>> with >>>>> the following information: >>>>> >>>>> public class DiagnosticCommandInfo { >>>>> >>>>> public String getName(); >>>>> >>>>> public String getDescription(); >>>>> >>>>> public String getImpact(); >>>>> >>>>> public boolean isEnabled(); >>>>> >>>>> public List getArgumentsInfo(); >>>>> } >>>>> >>>>> The getName() method returns the name of the diagnostic command. This >>>>> name is the one to use in execute() methods to invoke the diagnostic >>>>> command. >>>>> >>>>> The getDescription() method returns a general description of the >>>>> diagnostic command. >>>>> >>>>> The getImpact() method returns a description of the intrusiveness of >>>>> diagnostic command. >>>>> >>>>> The isEnabled() method returns true if the method is enabled, false if >>>>> it is disabled. A disabled method cannot be executed. >>>>> >>>>> The getArgumentsInfo() returns a list of descriptions for the >>>>> options or >>>>> arguments recognized by the diagnostic command. Each >>>>> option/argument is >>>>> described by a DiagnosticCommandArgumentInfo instance: >>>>> >>>>> public class DiagnosticCommandArgumentInfo { >>>>> >>>>> public String getName(); >>>>> >>>>> public String getDescription(); >>>>> >>>>> public String getType(); >>>>> >>>>> public String getDefault(); >>>>> >>>>> public boolean isMandatory(); >>>>> >>>>> public boolean isOption(); >>>>> >>>>> public int getPosition(); >>>>> } >>>>> >>>>> If the DiagnosticCommandArgumentInfo instance describes an option, >>>>> isOption() returns true and getPosition() returns -1. Otherwise, when >>>>> the DiagnosticCommandArgumentInfo instance describes an argument, >>>>> isOption() returns false and getPosition() returns the expected >>>>> position >>>>> for this argument. The position of an argument is defined >>>>> relatively to >>>>> all arguments passed on the command line, options are not considered >>>>> when defining an argument position. The getDefault() method returns >>>>> the >>>>> default value of the argument if a default has been defined, otherwise >>>>> it returns null. >>>>> >>>>> 3-2 The implementation >>>>> >>>>> The framework has been designed in a way that prevents diagnostic >>>>> command developers to worry about the JMX interface. In addition to >>>>> the methods described in section 1-2, a diagnostic command >>>>> developer has >>>>> to provide three methods: >>>>> >>>>> int get_num_arguments() >>>>> >>>>> which returns the number of option and arguments supported by the >>>>> command. >>>>> >>>>> GrowableArray* get_argument_name_array() >>>>> >>>>> which provides the name of the arguments supported by the command. >>>>> >>>>> GrowableyArray* get_argument_info_array() >>>>> >>>>> which provides the description of each argument with a >>>>> DCmdArgumentInfo >>>>> instance. DCmdArgumentInfo is a C++ class used by the framework to >>>>> generate the sun.com.management.DcmdArgumentInfo instances. This is >>>>> done >>>>> automatically and the diagnostic command developer doesn't need to >>>>> know >>>>> how to create Java objects from the runtime. >>>>> >>>>> 4 - The Diagnostic Commands >>>>> >>>>> To avoid name collisions between diagnostic commands coming from >>>>> different projects, use of a flat name space should be avoided and >>>>> a more structured organization is recommended. The framework itself >>>>> doesn't depend on this organization, so it will be a set of rules >>>>> defining a convention in the way commands are named. >>>>> >>>>> Diagnostic commands can easily organized in a hierarchical way, so the >>>>> template for a command name can be: >>>>> >>>>> .[sub-domain.] >>>>> >>>>> This template can be extended with sub-sub-domains and so on. >>>>> >>>>> A special set of commands without domain will be reserved for the >>>>> commands related to the diagnostic framework itself, like the "help" >>>>> command. >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Fred >>>>> >>> >> > -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From Ulf.Zibis at gmx.de Tue Dec 13 14:20:17 2011 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Tue, 13 Dec 2011 15:20:17 +0100 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> Message-ID: <4EE75F21.1040803@gmx.de> IMO in 99.8 % this check would be superfluous overhead. For those, who want 100 %, they can check and copy in their code. -Ulf Am 13.12.2011 14:30, schrieb Sean Chou: > Sorry for the confuse. By "ok", I mean "compare the size of array which is > going to be > returned and the size of the specified array, and copy the elements > into the specified > array if it is larger and return the specified array." > > Nothing is causing problem for now, I just found a mismatch. I think most > guys will > just use the returned array without checking if it's the specified one; and > this is also > why I think it may be possible to modify the behavior without causing > problems. > > And I think modifying ConcurrentHashMap is as dangerous as modifying > AbstractCollection > if people are relying on implementation, is this right? So it seems we can > do nothing > to the mismatch now... > From frederic.parain at oracle.com Tue Dec 13 14:32:33 2011 From: frederic.parain at oracle.com (Frederic Parain) Date: Tue, 13 Dec 2011 15:32:33 +0100 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE6F573.4040802@oracle.com> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> <34278e49-efbc-4370-ab36-a50331a9ff65@default> <4EE61040.5040704@oracle.com> <4EE6F573.4040802@oracle.com> Message-ID: <4EE76201.9010004@oracle.com> Hi David, Thanks for the review. Changes have been applied to this new webrev: http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.05/ My answers are in-lined below. Fred On 12/13/11 07:49 AM, David Holmes wrote: > Hi Fred, > > A couple of minor comments on the JDK side: > > HotSpotDiagnosticMXBean.java: > > Sorry if this is old ground but a query on the API design: is there a > specific reason to use Lists rather than the arrays the VM will provide? List are more convenient to use. The VM returns a jobjectArray to avoid the creation of a new dependency between the VM code and the java.util.List class. > HotSpotDiagnostic.java: > > 139 public List getDiagnosticCommandInfo( > 140 List commands) { > 141 if (commands == null) { > 142 throw new NullPointerException(); > 143 } > 144 return Arrays.asList(getDiagnosticCommandInfo0( > 145 commands.toArray(new String[commands.size()]))); > 146 } > > The explicit null check is redundant as commands.size() will be the > first thing invoked. Right. The null check has been removed. > --- > > jmm.h: > > The structs should use an indent of 2 to match the style of the file. Fixed > --- > > hotspotDiagnostic.c: > > 39 Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0 > 40 (JNIEnv *env, jobject dummy) > > Put on one line. But then it goes over the 80 columns limit. I used a formatting consistent with the dumpHeap method above. > 42 if((jmm_version > JMM_VERSION_1_2_1) > > Space after 'if' Fixed > 50 jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring > command, > 51 int num_arg) { > > Align arg with opening parentheses Fixed > 52-59, 107-112 > It is not necessary with modern C compilers to declare all variables at > the start of a block/function. You can declare them in the scope they > will be used. I agree. But I've tried to be consistent with existing code in the directory, like GcInfoBuilder.c > 61 dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * > sizeof(dcmdArgInfo)); > > Cast is not needed. All calls to malloc in this directory have a cast. > --- > > General: I suggest generating the javadoc for your new classes and > having an editorial check done. I spotted a couple of typos eg: > > DiagnosticCommandArgumentInfo.java: > 32 * of one parameter of diagnostic command. > ^the > DiagnosticCommandInfo.java > 89 * Returns the a list of the > ^^^^ typo These two typos have been fixed. I'm re-re-re-reading the javadoc looking for more :-) Thanks, Fred > On 13/12/2011 12:31 AM, Frederic Parain wrote: >> Hi Robert, >> >> These issues should be solved with the new webrevs: >> >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.03/ >> >> Regards, >> >> Fred >> >> On 12/ 9/11 03:17 PM, Robert Ottenhag wrote: >>> Adding to the review of jmm.h, that is modified in both the jdk part >>> and the hotspot part, these files should be identical, without any >>> differences in whitespace. >>> >>> Also, regarding whitespace and indentation, the use TAB characters in >>> many files in the jdk patch makes jcheck complain (when trying to >>> import your patch locally), and should be replaced by spaces. >>> >>> Best regards, >>> >>> /Robert >>> >>> >>>> -----Original Message----- From: Paul Hohensee Sent: Thursday, >>>> December 08, 2011 7:26 PM To: Frederic Parain Cc: >>>> serviceability-dev at openjdk.java.net; >>>> core-libs-dev at openjdk.java.net; >>>> hotspot-runtime-dev at openjdk.java.net Subject: Re: Request for >>>> Review (XXL): 7104647: Adding a diagnostic command framework >>>> >>>> For the hotspot part at >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> >>>> Most of my comments are style-related. Nice job on the >>>> implementation architecture. >>>> >>>> In attachListener.cpp: >>>> >>>> You might want to delete the first "return JNI_OK;" line, since the >>>> code under HAS_PENDING_EXCEPTION just falls through. >>>> >>>> In jmm.h: >>>> >>>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as >>>> the existing declarations. Add a newline just before it on line >>>> 322. >>>> >>>> >>>> In diagnosticFramework.hpp: >>>> >>>> Fix indenting for lines 63-66, insert blank before "size_t" on line >>>> 48. >>>> >>>> Hotspot convention is that getter method names don't include a >>>> "get_" prefix. So, e.g., DCmdArgIter::get_key_addr() s/b >>>> DCmdArgIter::key_addr(). Similarly, getters such as is_enabled() >>>> should retrieve a field named "_is_enabled" rather than one named >>>> "enabled". You follow the "_is_enabled" convention in other places >>>> such as GenDCmdArgument. Or you could use enabled() to get the >>>> value of the _enabled field. >>>> >>>> Also generally, I'd use accessor methods in the implementation of >>>> more complex member methods rather than access the underlying >>>> fields directly. E.g. in GenDCmdArgument::read_value, I'd use >>>> is_set() and set_is_set(true), (set_is_set() is not actually >>>> defined, but should be) rather than directly accessing _is_set. >>>> Though sometimes doing this is too much of a pain with fields whose >>>> type is a template argument, as in the >>>> DCmdArggument::parse_value() method in >>>> diagnosticArgument.cpp. >>>> >>>> For easy readability, it'd be nice to line up field names (the ones >>>> with an _ prefix) at the same column. >>>> >>>> On line 200, "instanciated" -> "instantiated" >>>> >>>> On line 218, I'd use "heap_allocated" rather than "heap" for the >>>> formal arg name. >>>> >>>> On line 248, you could indent the text to start underneath >>>> "outputStream". I generally find that indenting arguments lines >>>> (formal or actual) so they line up with the first argument position >>>> make the code more readable, but I'm not religious about it. >>>> >>>> On line 265, "instanciated" -> "instantiated" >>>> >>>> DCmdFactorys are members of a singly-linked list, right? If so, >>>> it'd be good to have a comment to that effect on the declaration of >>>> _next. >>>> >>>> On line 322, insert a blank before "true". You might fix this in >>>> other places where there's no blank between a comma in an argument >>>> list and the following parameter value. >>>> >>>> >>>> In diagnosticCommandFramework.cpp: >>>> >>>> The code from lines 80-95 and 105-120 is identical. Factor out? >>>> >>>> >>>> In diagnosticArgument.cpp: >>>> >>>> On line 41, insert blanks before the actual arguments. (see above >>>> generic comment) >>>> >>>> On line 77, the "if" is indented one space too many. >>>> >>>> >>>> In management.cpp: >>>> >>>> I'd be consistent with having or not having a space between >>>> "while", "if" and "for" and the following "(" in this and your >>>> other code. Most hotspot code has a space. >>>> >>>> >>>> Thanks, >>>> >>>> Paul >>>> >>>> >>>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>>> Hi All, >>>>> >>>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>>> because changes are pretty big and touch all these areas] >>>>> >>>>> Here's a framework for issuing diagnostics commands to the JVM. >>>>> Diagnostic commands are actions executed inside the JVM mainly >>>>> for monitoring or management purpose. This work has two parts. >>>>> The first part is in the hotspot repository and contains the >>>>> framework itself with two diagnostic commands. The second part is >>>>> in the JDK repository and contains the command line utility to >>>>> invoke diagnostic commands as well as the HotSpotDiagnosticMXBean >>>>> extensions. The HotSpotDiagnosticMXBean extensions allow a remote >>>>> client to discover and invoke diagnostic commands using a JMX >>>>> connection. >>>>> >>>>> This changeset only contains two diagnostic commands, more >>>>> commands will be added in the future, as a standalone effort to >>>>> improve the monitoring and management services of the JVM, or as >>>>> part of other projects. >>>>> >>>>> Webrevs are here: >>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>>> >>>>> Here's a technical description of this work: >>>>> >>>>> 1 - The Diagnostic Command Framework 1-1 Overview >>>>> >>>>> The diagnostic command framework is fully implemented in native >>>>> code and relies on the HotSpot's internal exception mechanism. >>>>> The rational of a pure native implementation is to be able to >>>>> execute diagnostic commands even in critical situations like an >>>>> OutOfMemory error. All diagnostic commands are registered in a >>>>> single list, and two flags control the way a user can interact >>>>> with them. The "hidden" flag prevents a diagnostic command from >>>>> appearing in the list of available commands returned by the >>>>> "help" command. However, it's still possible to get the detailed >>>>> help message for a hidden command with the "help " >>>>> syntax (but it requires to know the name of the hidden command). >>>>> The second flag is "enabled" and it controls if a command can be >>>>> invoked or not. When listed with the "help" commands, disabled >>>>> commands appear with a "[disabled]" label in their description. >>>>> If the user tries to invoke a disabled command, an error message >>>>> is returned and the command is not run. This error message can be >>>>> customized on a per command base. The framework just provides >>>>> these two flags with their semantic, it doesn't provide any >>>>> policy or mechanism to set or modify these flags. These actions >>>>> will be delegated to the JVM or special diagnostic commands. >>>>> >>>>> 1-2 Implementation >>>>> >>>>> All diagnostic commands are implemented as subclasses of the DCmd >>>>> class defined in services/diagnosticFramework.hpp. Here's the >>>>> layout of the DCmd class and the list of methods that a new >>>>> command has to define or overwrite: >>>>> >>>>> class DCmd { DCmd(outputStream *output); >>>>> >>>>> static const char *get_name(); >>>>> >>>>> static const char *get_description(); >>>>> >>>>> static const char *get_disabled_message(); >>>>> >>>>> static const char *get_impact(); >>>>> >>>>> static int get_num_arguments(); >>>>> >>>>> virtual void print_help(outputStream* out); >>>>> >>>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>>> >>>>> virtual void execute(TRAPS); >>>>> >>>>> virtual void reset(TRAPS); >>>>> >>>>> virtual void cleanup(); >>>>> >>>>> virtual GrowableArray* get_argument_name_array(); >>>>> >>>>> virtual GrowableArray* >>>>> get_argument_info_array(); } >>>>> >>>>> A diagnostic command is always instantiated with an outputStream >>>>> in parameter. This outputStream can point either to a file, a >>>>> buffer or a socket (see the ostream.hpp file). >>>>> >>>>> The get_name() method returns the string that will identify the >>>>> command (i.e. the string to put on the command line to invoke >>>>> it). >>>>> >>>>> The get_description() methods returns the global description of >>>>> the command. >>>>> >>>>> The get_disabled_message() returns the customized message to >>>>> return when the command is disabled, without having to >>>>> instantiate the command. >>>>> >>>>> The get_impact() returns a description of the intrusiveness of >>>>> the diagnostic command on the Java Virtual Machine behavior. The >>>>> rational for this method is that some diagnostic commands can >>>>> seriously disrupt the behavior of the Java Virtual Machine (for >>>>> instance a Thread Dump for an application with several tens of >>>>> thousands of threads, or a Head Dump with a 40GB+ heap size) and >>>>> other diagnostic commands have no serious impact on the JVM (for >>>>> instance, getting the command line arguments or the JVM version). >>>>> The recommended format for the description is: >>>>> [longer description], where the impact level is selected among >>>>> this list: {low, medium, high}. The optional longer description >>>>> can provide more specific details like the fact that Thread Dump >>>>> impact depends on the heap size. >>>>> >>>>> The get_num_arguments() returns the number of options/arguments >>>>> recognized by the diagnostic command. This method is only used by >>>>> the JMX interface support (see below). >>>>> >>>>> The print_help() methods prints a detailed help on the >>>>> outputStream passed in argument. The detailed help contains the >>>>> list of all supported options with their type and description. >>>>> >>>>> The parse() method is in charge of parsing the command arguments. >>>>> Each command is free to implement its own argument parser. >>>>> However, an argument parser framework is provided (see section >>>>> 1-3) to ease the implementation, but its use is optional. The >>>>> parse method takes a delimiter character in argument, which is >>>>> used to mark the limit between two arguments (typically >>>>> invocation from jcmd will use a space character as a delimiter >>>>> while invocation from the JVM command line parsing code will use >>>>> a comma as a delimiter). >>>>> >>>>> The execute() method is naturally the one to invoke to get the >>>>> diagnostic command executed. The parse() and the execute() >>>>> methods are dissociated, so it's a possible perform the argument >>>>> parsing in one thread, and delegate the execution to another >>>>> thread, as long as the diagnostic command doesn't reference >>>>> thread local variables. The framework allows several instances of >>>>> the same diagnostic command to be executed in parallel. If for >>>>> some reasons concurrent executions should not be allowed for a >>>>> given diagnostic command, this is the responsibility of the >>>>> diagnostic command implementor to enforce this rule, for instance >>>>> by protecting the body of the execute() method with a global >>>>> lock. >>>>> >>>>> The reset() method is used to initialize the internal fields of >>>>> the diagnostic command or to reset the internal fields to their >>>>> initial value to be able to re-use an already allocated >>>>> diagnostic command instance. >>>>> >>>>> The cleanup() method is used to perform perform cleanup (like >>>>> freeing of all memory allocated to store internal data). The DCmd >>>>> extends the ResourceObj class, so when allocated in a >>>>> ResourceArea, destructors cannot be used to perform cleanup. To >>>>> ensure that cleanup is performed in all cases, it is recommended >>>>> to create a DCmdMark instance for each DCmd instance. DCmdMark is >>>>> a stack allocated object with a pointer to a DCmd instance. When >>>>> the DCmdMark is destroyed, its destructor calls the cleanup() >>>>> method of the DCmd instance it points to. If the DCmd instance >>>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>>> memory allocated to store the DCmd instance. >>>>> >>>>> The get_argument_name_array() and get_argument_info_array() are >>>>> related to the JMX interface of the diagnostic command framework, >>>>> so they are described in section 3. >>>>> >>>>> 1-3 DCmdParser framework >>>>> >>>>> The DCmdParser class is an optional framework to help development >>>>> of argument parsers. It provides many features required by the >>>>> diagnostic command framework (generation of the help message or >>>>> the argument descriptions for the JMX interface) but all these >>>>> features can easily be re-implemented if a developer decides not >>>>> to use the DCmdParser framework. >>>>> >>>>> The DCmdParser class is relying on the DCmdArgument template. >>>>> This template must be used to define the different types of >>>>> argument the parser will have to handle. When a new >>>>> specialization of the template is done, three methods have to be >>>>> provided: >>>>> >>>>> void parse_value(const char *str,size_t len,TRAPS); void >>>>> init_value(TRAPS); void destroy_value(); >>>>> >>>>> The parse_value() method is used to convert a string into an >>>>> argument value. The print_value() method is used to display the >>>>> default value (support for the detailed help message). The >>>>> init_value() method is used to initialize or reset the argument >>>>> value. The destroy_value() method is a clean-up method (useful >>>>> when the argument has allocated some C-Heap memory to store its >>>>> value and this memory has to be freed before destroying the >>>>> DCmdArgument instance). >>>>> >>>>> The DCmdParser makes a distinction between options and >>>>> arguments. Options are identified by a key name that must appear >>>>> on the command line, while argument are identified just by the >>>>> position of the argument on the command line. Options use >>>>> the= syntax. In case of boolean options, the >>>>> '=' part of the syntax can be omitted to set the option to >>>>> true. Arguments are just sequences characters delimited by a >>>>> separator character. This separator can be specified at runtime >>>>> when invoking the diagnostic command framework. If an argument >>>>> contain a character that could be used as a delimiter, it's >>>>> possible to enclose the argument between single or double quotes. >>>>> Options are arguments are instantiated using the same >>>>> DCmdArgument class but they're registered differently to the >>>>> DCmdParser. >>>>> >>>>> The way to use the DCmdParser is to declare the parser and the >>>>> option/arguments as fields of the diagnostic command class (which >>>>> is itself a sub-class of the DCmd class), like this: >>>>> >>>>> >>>>> class EchoDCmd : public DCmd { protected: DCmdParser >>>>> _dcmdparser; >>>>> >>>>> DCmdArgument _required; >>>>> >>>>> DCmdArgument _intval; >>>>> >>>>> DCmdArgument _boolval; >>>>> >>>>> DCmdArgument _stringval; >>>>> >>>>> DCmdArgument _first_arg; >>>>> >>>>> DCmdArgument _second_arg; >>>>> >>>>> DCmdArgument _optional_arg; >>>>> >>>>> } >>>>> >>>>> The parser and the options/arguments must be initialized before >>>>> the diagnostic command class, and the options/arguments have to >>>>> be registered to the parser like this: >>>>> >>>>> EchoDCmd(outputStream *output) : DCmd(output), >>>>> _stringval("-strval","a string argument","STRING",false), >>>>> >>>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>>> >>>>> _intval("-intval","an integer argument","INTEGER",false), >>>>> >>>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>>> >>>>> _fist_arg("first argument","a string argument","STRING",true), >>>>> >>>>> _second_arg("second argument,"an integer >>>>> argument,"INTEGER",true), >>>>> >>>>> _optional_arg("optional argument","an optional string >>>>> argument","STRING","false") >>>>> >>>>> { >>>>> >>>>> _dcmdparser.add_dcmd_option(&_stringval) >>>>> >>>>> _dcmdparser.add_dcmd_option(&_boolval); >>>>> >>>>> _dcmdparser.add_dcmd_option(&_intval); >>>>> >>>>> _dcmdparser.add_dcmd_option(&_required); >>>>> >>>>> _dcmdparser.add_argument(&_first_arg); >>>>> >>>>> _dcmdparser.add_argument(&_second_arg); >>>>> >>>>> _dcmdparser.add_argument(&_optional_arg); }; >>>>> >>>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add >>>>> an argument/option to the parser. The option/argument constructor >>>>> takes the name of the option/argument, its description, a string >>>>> describing its type and a boolean to specify if the >>>>> option/argument is mandatory or not. The parser doesn't support >>>>> option/argument duplicates (having the same name) but the code >>>>> currently doesn't check for duplicates.The order used to register >>>>> options has no impact on the parser. However, the order used to >>>>> register arguments is critical because the parser will use the >>>>> same order to parse the command line. In the example above, the >>>>> parser expects to have a first argument of type STRING (parsed >>>>> using _first_arg), then a second argument of type INTEGER (parsed >>>>> using _second_arg) and optionally a third parameter of type >>>>> STRING (parsed using _optional_arg). A mandatory option or >>>>> argument has to be specify every time the command is invoked. If >>>>> it is missing, an exception is thrown at the end of the parsing. >>>>> Optional arguments have to be registered after mandatory >>>>> arguments. An optional argument will be considered for parsing >>>>> only if all arguments before it (mandatory or not) have already >>>>> been used to parse the command line. >>>>> >>>>> The DCmdParser and its DCmdArgument instances are embedded in the >>>>> DCmd instance. The rational for this design is to limit the >>>>> number of C-heap allocations but also to be able to pre-allocate >>>>> diagnostic command instances for critical situations. If the >>>>> process is running out of C-heap space, it's not possible to >>>>> instantiate new diagnostic commands to troubleshoot the >>>>> situation. By pre-allocating some diagnostic commands, it will be >>>>> possible to run them even in this critical situation. Of course, >>>>> the diagnostic command itself should not try to allocate memory >>>>> during its execution, this prevents the diagnostic command to use >>>>> variable length arguments like strings. By nature, pre-allocated >>>>> diagnostic commands aim to be re-usable, this is the purpose of >>>>> the reset() method which restores the default status of all >>>>> arguments. >>>>> >>>>> 1-4 Internal invocation >>>>> >>>>> Using a diagnostic command from the JVM itself is pretty easy: >>>>> instantiate the class and invoke the parse() method then the >>>>> execute() method. A diagnostic command can be instantiated from >>>>> inside the JVM even it is not registered. This is a difference >>>>> with the external invocations (from jcmd or JMX) that require the >>>>> command to be >>>> registered. >>>>> >>>>> 2 - The JCmd interface >>>>> >>>>> Diagnostic commands can also be invoked from outside the JVM >>>>> process, using the new 'jcmd' utility. The jcmd program uses the >>>>> attach API to connect to the JVM, send requests and receive >>>>> results. The jcmd utility must be launched on the same machine >>>>> than the one running the JVM (its a local tool). Launched without >>>>> arguments, jcmd displays a list of all JVMs running on the >>>>> machine. The jcmd source code is in the jdk repository like other >>>>> existing j* tools. >>>>> >>>>> To execute a diagnostic command in a particular JVM, the generic >>>>> syntax is: >>>>> >>>>> jcmd [arguments] >>>>> >>>>> The attachListener has been modified to recognized the jcmd >>>>> requests. When a jcmd request is identified, it is parsed to >>>>> extract the command name. The JVM performs a look up of this >>>>> command in a list of registered commands. To be executable by an >>>>> external request, a diagnostic command has to be registered. The >>>>> registration is performed with the DCmdFactory class (see >>>>> services/management.cpp). >>>>> >>>>> 3 - The JMX interface >>>>> >>>>> The framework provides a JMX based interface to the diagnostic >>>>> commands. This interface allows remote invocation of diagnostic >>>>> commands through a JMX connection. >>>>> >>>>> 3-1 The interface >>>>> >>>>> The information related to the diagnostic commands are >>>>> accessible through new methods added to the >>>>> com.sun.management.HotspotDiagnosticMXBean: >>>>> >>>>> public List getDiagnosticCommands(); >>>>> >>>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String >>>>> command); >>>>> >>>>> public List >>>>> getDiagnosticCommandInfo(List command); >>>>> >>>>> public List getDiagnosticCommandInfo(); >>>>> >>>>> public String execute(String commandLine) throws >>>>> IllegalArgumentException ; >>>>> >>>>> public String execute(String cmd, String... arguments) throws >>>>> IllegalArgumentException; >>>>> >>>>> >>>>> The getDiagnosticCommands() method returns an array containing >>>>> the names of the not-hidden registered diagnostic commands. >>>>> >>>>> The three getDiagnosticCommandInfo() methods return one or >>>>> several diagnostic command descriptions using the >>>>> DiagnosticCommandInfo class. >>>>> >>>>> The two execute() methods allow the user the invoke a diagnostic >>>>> command in different ways. >>>>> >>>>> The DiagnosticCommandInfo class is describing a diagnostic >>>>> command with the following information: >>>>> >>>>> public class DiagnosticCommandInfo { >>>>> >>>>> public String getName(); >>>>> >>>>> public String getDescription(); >>>>> >>>>> public String getImpact(); >>>>> >>>>> public boolean isEnabled(); >>>>> >>>>> public List getArgumentsInfo(); >>>>> } >>>>> >>>>> The getName() method returns the name of the diagnostic command. >>>>> This name is the one to use in execute() methods to invoke the >>>>> diagnostic command. >>>>> >>>>> The getDescription() method returns a general description of the >>>>> diagnostic command. >>>>> >>>>> The getImpact() method returns a description of the intrusiveness >>>>> of diagnostic command. >>>>> >>>>> The isEnabled() method returns true if the method is enabled, >>>>> false if it is disabled. A disabled method cannot be executed. >>>>> >>>>> The getArgumentsInfo() returns a list of descriptions for the >>>>> options or arguments recognized by the diagnostic command. Each >>>>> option/argument is described by a DiagnosticCommandArgumentInfo >>>>> instance: >>>>> >>>>> public class DiagnosticCommandArgumentInfo { >>>>> >>>>> public String getName(); >>>>> >>>>> public String getDescription(); >>>>> >>>>> public String getType(); >>>>> >>>>> public String getDefault(); >>>>> >>>>> public boolean isMandatory(); >>>>> >>>>> public boolean isOption(); >>>>> >>>>> public int getPosition(); } >>>>> >>>>> If the DiagnosticCommandArgumentInfo instance describes an >>>>> option, isOption() returns true and getPosition() returns -1. >>>>> Otherwise, when the DiagnosticCommandArgumentInfo instance >>>>> describes an argument, isOption() returns false and getPosition() >>>>> returns the expected position for this argument. The position of >>>>> an argument is defined relatively to all arguments passed on the >>>>> command line, options are not considered when defining an >>>>> argument position. The getDefault() method returns the default >>>>> value of the argument if a default has been defined, otherwise it >>>>> returns null. >>>>> >>>>> 3-2 The implementation >>>>> >>>>> The framework has been designed in a way that prevents >>>>> diagnostic command developers to worry about the JMX interface. >>>>> In addition to the methods described in section 1-2, a diagnostic >>>>> command developer has to provide three methods: >>>>> >>>>> int get_num_arguments() >>>>> >>>>> which returns the number of option and arguments supported by >>>>> the command. >>>>> >>>>> GrowableArray* get_argument_name_array() >>>>> >>>>> which provides the name of the arguments supported by the >>>>> command. >>>>> >>>>> GrowableyArray* get_argument_info_array() >>>>> >>>>> which provides the description of each argument with a >>>>> DCmdArgumentInfo instance. DCmdArgumentInfo is a C++ class used >>>>> by the framework to generate the >>>>> sun.com.management.DcmdArgumentInfo instances. This is done >>>>> automatically and the diagnostic command developer doesn't need >>>>> to know how to create Java objects from the runtime. >>>>> >>>>> 4 - The Diagnostic Commands >>>>> >>>>> To avoid name collisions between diagnostic commands coming from >>>>> different projects, use of a flat name space should be avoided >>>>> and a more structured organization is recommended. The framework >>>>> itself doesn't depend on this organization, so it will be a set >>>>> of rules defining a convention in the way commands are named. >>>>> >>>>> Diagnostic commands can easily organized in a hierarchical way, >>>>> so the template for a command name can be: >>>>> >>>>> .[sub-domain.] >>>>> >>>>> This template can be extended with sub-sub-domains and so on. >>>>> >>>>> A special set of commands without domain will be reserved for >>>>> the commands related to the diagnostic framework itself, like the >>>>> "help" command. >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Fred >>>>> >> -- Frederic Parain - Oracle Grenoble Engineering Center - France Phone: +33 4 76 18 81 17 Email: Frederic.Parain at Oracle.com From neil.richards at ngmr.net Tue Dec 13 14:42:29 2011 From: neil.richards at ngmr.net (Neil Richards) Date: Tue, 13 Dec 2011 14:42:29 +0000 Subject: Add Look&Feel support for AIX platform In-Reply-To: References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> <1323689619.20905.3.camel@chalkhill> Message-ID: <1323787349.20905.15.camel@chalkhill> On Tue, 2011-12-13 at 10:36 +0800, Sean Chou wrote: > On Mon, Dec 12, 2011 at 7:33 PM, Neil Richards > wrote: > On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > > Hi, > > > > > > I'm not sure what to do for it next, shall I create a bug > for it > > now ? But I > > don't think the bug system support AIX platform. I > remembered it > > would > > report something like "we are not supporting the platform". > > > > > Hi Sean, > Looking at the options available on the Java bug submission > site [1], it > looks like: > Release: OpenJDK > Operating System: Generic / Other > > would be the most appropriate choices to make. > > Regards, > Neil > > > -- > Unless stated above: > IBM email: neil_richards at uk.ibm.com > IBM United Kingdom Limited - Registered in England and Wales > with number 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, > Hampshire PO6 3AU > I tried once, and it was dropped because "the platform is not > supported." > > -- > Best Regards, > Sean Chou > Hmm, in that case, perhaps someone from Oracle can help in creating a suitable Java bug id under which this change can be made? >From the OpenJDK census [1], I see that both Mario and I are currently "committers" in the jdk8 project. As jdk8 is under review control, I believe you'll need some affirmation from someone who is a "reviewer". Such a person is currently likely to be from Oracle, and so may be able to help in creating the associated bug id. Hope this helps. Regards, Neil -- Unless stated above: IBM email: neil_richards at uk.ibm.com IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From neil.richards at ngmr.net Tue Dec 13 14:45:15 2011 From: neil.richards at ngmr.net (Neil Richards) Date: Tue, 13 Dec 2011 14:45:15 +0000 Subject: Add Look&Feel support for AIX platform In-Reply-To: <1323787349.20905.15.camel@chalkhill> References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> <1323689619.20905.3.camel@chalkhill> <1323787349.20905.15.camel@chalkhill> Message-ID: <1323787515.20905.17.camel@chalkhill> On Tue, 2011-12-13 at 14:42 +0000, Neil Richards wrote: > On Tue, 2011-12-13 at 10:36 +0800, Sean Chou wrote: > > On Mon, Dec 12, 2011 at 7:33 PM, Neil Richards > > wrote: > > On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > > > Hi, > > > > > > > > > I'm not sure what to do for it next, shall I create a bug > > for it > > > now ? But I > > > don't think the bug system support AIX platform. I > > remembered it > > > would > > > report something like "we are not supporting the platform". > > > > > > > > > Hi Sean, > > Looking at the options available on the Java bug submission > > site [1], it > > looks like: > > Release: OpenJDK > > Operating System: Generic / Other > > > > would be the most appropriate choices to make. > > > > Regards, > > Neil > > > > > > -- > > Unless stated above: > > IBM email: neil_richards at uk.ibm.com > > IBM United Kingdom Limited - Registered in England and Wales > > with number 741598. > > Registered office: PO Box 41, North Harbour, Portsmouth, > > Hampshire PO6 3AU > > > I tried once, and it was dropped because "the platform is not > > supported." > > > > -- > > Best Regards, > > Sean Chou > > > > Hmm, in that case, perhaps someone from Oracle can help in creating a > suitable Java bug id under which this change can be made? > > >From the OpenJDK census [1], I see that both Mario and I are currently > "committers" in the jdk8 project. > > As jdk8 is under review control, I believe you'll need some affirmation > from someone who is a "reviewer". > > Such a person is currently likely to be from Oracle, and so may be able > to help in creating the associated bug id. > > Hope this helps. > > Regards, > Neil > Oops, forgot to give the trailed link to the OpenJDK census. Regards, Neil [1] http://openjdk.java.net/census -- Unless stated above: IBM email: neil_richards at uk.ibm.com IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From darryl.mocek at oracle.com Tue Dec 13 18:35:30 2011 From: darryl.mocek at oracle.com (Darryl Mocek) Date: Tue, 13 Dec 2011 10:35:30 -0800 Subject: Code Review Request for Bug #7089443 In-Reply-To: <4EE6B7BF.8030906@linux.vnet.ibm.com> References: <4EE68522.9000904@oracle.com> <4EE6B7BF.8030906@linux.vnet.ibm.com> Message-ID: <4EE79AF2.8040009@oracle.com> Charles, thanks for the notification. I was scratching my head trying to figure out why I was seeing the old code and not the new. Being new to Mercurial and after some digging, I realized I was using 'up' the way I used it in Subversion (pull from the repo and update the local copy), the tool I've been using up to now. After reading the docs I realize I need to do a pull in Mercurial first. Your commit indeed looks like it fixes the bug, I'll mark the bug report as appropriate. Thanks, Darryl On 12/12/2011 06:26 PM, Charles Lee wrote: > On 12/13/2011 06:50 AM, Darryl Mocek wrote: >> Hello. Please review this patch to fix InetAddress.getLocalHost >> fails if the host name is larger HOST_NAME_MAX. The fix is to use >> strncpy, and supply the max length the host name can be, instead of >> using strcpy. There is no test supplied for this fix as I was unable >> to set the host name larger then MAXHOSTNAMELEN on the Linux and >> Solaris machines I tried. I tested the fix by adding code to >> Inet4AddressImpl.c to simulate a host name larger then MAXHOSTNAMELEN. >> >> Webrev, can be found here: >> http://cr.openjdk.java.net/~dmocek/7089443/webrev.00 >> >> Thanks, >> Darryl >> >> > Hi Darryl, > > I have changed Inet4AddressImpl.c a lot in the commit: > > changeset: 4757:81987765cb81 > user: ngmr > date: Fri Nov 11 14:40:18 2011 +0000 > summary: 7112670: Inet4AddressImpl should use getaddrinfo/getnameinfo > > and you can find the webrev here: > http://cr.openjdk.java.net/~ngmr/ojdk-229/webrev.02/ > > Would you please use the latest version of Inet4AddressImpl.c ? > From sean.mullan at oracle.com Tue Dec 13 18:59:51 2011 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 13 Dec 2011 13:59:51 -0500 Subject: Answer requested!!! was: Re: 7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException In-Reply-To: <4EE354AA.5060002@gmx.de> References: <4E525386.9000207@gmx.de> <4E52758D.2020208@oracle.com> <4E5E8AE3.3070402@gmx.de> <4E5FE753.2010705@oracle.com> <4E606D1D.6050509@gmx.de> <4E613565.1080801@oracle.com> <4E625E14.9060101@gmx.de> <4E67AF3D.2090609@oracle.com> <4E68FFBD.2030601@gmx.de> <4E6A13A2.2020503@gmx.de> <4E74F05D.7090806@gmx.de> <4E7CD5F8.9000501@oracle.com> <4E7DA91C.2000600@gmx.de> <4E81EDE6.9050205@oracle.com> <4E82A437.30907@gmx.de> <4E86073D.9050101@gmx.de> <4E873DA0.5050906@oracle.com> <4E88C03A.90904@gmx.de> <4EA96FB4.7000502@gmx.de> <4EABE0D5.5050802@gmx.de> <4ECC7A87.1030604@gmx.de> <4ED79956.4020101@oracle.com> <4ED86811.4090804@gmx.de> <4ED8F694.8010705@oracle.com> <4EDD082E.7060803@oracle.com> <4EDE7F92.406@gmx.de> <4EE23236.2060606@oracle.com> <4EE354AA.5060002@gmx.de> Message-ID: <4EE7A0A7.4020609@oracle.com> On 12/10/11 7:46 AM, Sebastian Sickelmann wrote: > Am 09.12.2011 17:07, schrieb Sean Mullan: >> On 12/6/11 3:48 PM, Sebastian Sickelmann wrote: >>> Am 05.12.2011 19:06, schrieb Sean Mullan: >>>> On 12/2/11 11:02 AM, Sean Mullan wrote: >>>> >>>>>> [0] Solution 1 >>>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_4/index.html >>>>>> [1] Solution 2 >>>>>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_6/index.html >>>> I definitely prefer solution 2. Just a few minor comments: >>>> >>>> - Use the javadoc @inheritDoc tag instead of copying the javadoc for the >>>> initCause method. >>>> >>>> - PreventOverridingOfChaining >>>> >>>> lines 68, 71: what do these comments mean? >>>> >>>> one additional test that would be useful to add would be to call initCause twice >>>> for those ctors that don't have a Throwable parameter, and make sure initCause >>>> throws IllegalStateExc. >>>> >>>> --Sean >>>> >>> Updated the webrev[2] to include your review. >>> >>> [2] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_7/index.html >> You didn't add the additional test that I thought would be useful - are you >> going to add that? Otherwise, it looks good. >> >> --Sean > Sorry, I missed this. > > I updated the webrev[3] This looks fine. Do you want me to push this on your behalf, or would you like to first wait for your discussion on core-libs-dev to reach a conclusion? --Sean > > [3] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_8/index.html > > -- Sebastian From jonathan.gibbons at oracle.com Tue Dec 13 19:21:56 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Tue, 13 Dec 2011 19:21:56 +0000 Subject: hg: jdk8/tl/langtools: 7120736: refactor javac option handling Message-ID: <20111213192201.41ECF4769A@hg.openjdk.java.net> Changeset: 3809292620c9 Author: jjg Date: 2011-12-13 11:21 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/3809292620c9 7120736: refactor javac option handling Reviewed-by: mcimadamore ! src/share/classes/com/sun/tools/javac/api/JavacTool.java ! src/share/classes/com/sun/tools/javac/code/Source.java ! src/share/classes/com/sun/tools/javac/comp/Check.java ! src/share/classes/com/sun/tools/javac/comp/Enter.java ! src/share/classes/com/sun/tools/javac/comp/Lower.java ! src/share/classes/com/sun/tools/javac/file/Locations.java ! src/share/classes/com/sun/tools/javac/jvm/ClassReader.java ! src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java ! src/share/classes/com/sun/tools/javac/jvm/Gen.java ! src/share/classes/com/sun/tools/javac/jvm/Target.java ! src/share/classes/com/sun/tools/javac/main/JavaCompiler.java ! src/share/classes/com/sun/tools/javac/main/Main.java ! src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java ! src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java ! src/share/classes/com/sun/tools/javac/util/BaseFileManager.java ! src/share/classes/com/sun/tools/javac/util/Log.java ! src/share/classes/com/sun/tools/javac/util/Options.java ! test/tools/javac/diags/examples/UnsupportedEncoding.java From jonathan.gibbons at oracle.com Tue Dec 13 22:34:13 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Tue, 13 Dec 2011 22:34:13 +0000 Subject: hg: jdk8/tl/langtools: 7121164: renamed files not committed Message-ID: <20111213223417.65FFD4769E@hg.openjdk.java.net> Changeset: 4e4fed1d02f9 Author: jjg Date: 2011-12-13 14:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/4e4fed1d02f9 7121164: renamed files not committed Reviewed-by: ksrini - src/share/classes/com/sun/tools/javac/main/JavacOption.java + src/share/classes/com/sun/tools/javac/main/Option.java + src/share/classes/com/sun/tools/javac/main/OptionHelper.java - src/share/classes/com/sun/tools/javac/main/OptionName.java - src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java From naoto.sato at oracle.com Tue Dec 13 23:42:37 2011 From: naoto.sato at oracle.com (naoto.sato at oracle.com) Date: Tue, 13 Dec 2011 23:42:37 +0000 Subject: hg: jdk8/tl/jdk: 4808233: "Locale" not thread-safe Message-ID: <20111213234300.63D54476A1@hg.openjdk.java.net> Changeset: c647ebb3c4f7 Author: naoto Date: 2011-12-13 15:41 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c647ebb3c4f7 4808233: "Locale" not thread-safe Reviewed-by: okutsu ! src/share/classes/java/util/Locale.java From ahughes at redhat.com Wed Dec 14 00:44:29 2011 From: ahughes at redhat.com (Dr Andrew John Hughes) Date: Wed, 14 Dec 2011 00:44:29 +0000 Subject: Add Look&Feel support for AIX platform In-Reply-To: <1323787515.20905.17.camel@chalkhill> References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> <1323689619.20905.3.camel@chalkhill> <1323787349.20905.15.camel@chalkhill> <1323787515.20905.17.camel@chalkhill> Message-ID: <20111214004429.GE25730@rivendell.middle-earth.co.uk> On 14:45 Tue 13 Dec , Neil Richards wrote: > On Tue, 2011-12-13 at 14:42 +0000, Neil Richards wrote: > > On Tue, 2011-12-13 at 10:36 +0800, Sean Chou wrote: > > > On Mon, Dec 12, 2011 at 7:33 PM, Neil Richards > > > wrote: > > > On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > > > > Hi, > > > > > > > > > > > > I'm not sure what to do for it next, shall I create a bug > > > for it > > > > now ? But I > > > > don't think the bug system support AIX platform. I > > > remembered it > > > > would > > > > report something like "we are not supporting the platform". > > > > > > > > > > > > > Hi Sean, > > > Looking at the options available on the Java bug submission > > > site [1], it > > > looks like: > > > Release: OpenJDK > > > Operating System: Generic / Other > > > > > > would be the most appropriate choices to make. > > > > > > Regards, > > > Neil > > > > > > > > > -- > > > Unless stated above: > > > IBM email: neil_richards at uk.ibm.com > > > IBM United Kingdom Limited - Registered in England and Wales > > > with number 741598. > > > Registered office: PO Box 41, North Harbour, Portsmouth, > > > Hampshire PO6 3AU > > > > > I tried once, and it was dropped because "the platform is not > > > supported." > > > > > > -- > > > Best Regards, > > > Sean Chou > > > > > > > Hmm, in that case, perhaps someone from Oracle can help in creating a > > suitable Java bug id under which this change can be made? > > > > >From the OpenJDK census [1], I see that both Mario and I are currently > > "committers" in the jdk8 project. > > > > As jdk8 is under review control, I believe you'll need some affirmation > > from someone who is a "reviewer". > > > > Such a person is currently likely to be from Oracle, and so may be able > > to help in creating the associated bug id. > > > > Hope this helps. > > > > Regards, > > Neil > > > > Oops, forgot to give the trailed link to the OpenJDK census. > > Regards, Neil > > [1] http://openjdk.java.net/census > > -- > Unless stated above: > IBM email: neil_richards at uk.ibm.com > IBM United Kingdom Limited - Registered in England and Wales with number 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU > This seems to have dragged on an unduly long time for such a simple patch. The patch looks good to me. The only minor point I'd make is that the comment '// determine another OS here' should probably be under where the AIX if block is added, not above it. According to the census, I have jdk8 reviewer status so this should count as a review. However, as we're still stuck with the antiquated bug system at present, we still need someone at Oracle to give it a bug ID. So if an Oracle employee would be so kind as to do so, this can finally be pushed. It's only about two months old... -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 From david.holmes at oracle.com Wed Dec 14 01:02:40 2011 From: david.holmes at oracle.com (David Holmes) Date: Wed, 14 Dec 2011 11:02:40 +1000 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE76201.9010004@oracle.com> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> <34278e49-efbc-4370-ab36-a50331a9ff65@default> <4EE61040.5040704@oracle.com> <4EE6F573.4040802@oracle.com> <4EE76201.9010004@oracle.com> Message-ID: <4EE7F5B0.90405@oracle.com> Thanks Fred. I don't think maintaining the style of existing code needs to extend to all aspects of that code but is more about general layout, spacing and naming. So adding unnecessary casts to malloc, or declaring all variables at the start of the method are not things that need to be repeated forever in my opinion. But I won't push for further changes. Cheers, David On 14/12/2011 12:32 AM, Frederic Parain wrote: > Hi David, > > Thanks for the review. > > Changes have been applied to this new webrev: > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.05/ > > My answers are in-lined below. > > Fred > > On 12/13/11 07:49 AM, David Holmes wrote: >> Hi Fred, >> >> A couple of minor comments on the JDK side: >> >> HotSpotDiagnosticMXBean.java: >> >> Sorry if this is old ground but a query on the API design: is there a >> specific reason to use Lists rather than the arrays the VM will provide? > > List are more convenient to use. > The VM returns a jobjectArray to avoid the creation of a new dependency > between the VM code and the java.util.List class. > >> HotSpotDiagnostic.java: >> >> 139 public List getDiagnosticCommandInfo( >> 140 List commands) { >> 141 if (commands == null) { >> 142 throw new NullPointerException(); >> 143 } >> 144 return Arrays.asList(getDiagnosticCommandInfo0( >> 145 commands.toArray(new String[commands.size()]))); >> 146 } >> >> The explicit null check is redundant as commands.size() will be the >> first thing invoked. > > Right. The null check has been removed. > >> --- >> >> jmm.h: >> >> The structs should use an indent of 2 to match the style of the file. > > Fixed > >> --- >> >> hotspotDiagnostic.c: >> >> 39 Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0 >> 40 (JNIEnv *env, jobject dummy) >> >> Put on one line. > > But then it goes over the 80 columns limit. I used a formatting > consistent with the dumpHeap method above. > >> 42 if((jmm_version > JMM_VERSION_1_2_1) >> >> Space after 'if' > > Fixed > >> 50 jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring >> command, >> 51 int num_arg) { >> >> Align arg with opening parentheses > > Fixed > >> 52-59, 107-112 >> It is not necessary with modern C compilers to declare all variables at >> the start of a block/function. You can declare them in the scope they >> will be used. > > I agree. But I've tried to be consistent with existing code in the > directory, like GcInfoBuilder.c > >> 61 dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * >> sizeof(dcmdArgInfo)); >> >> Cast is not needed. > > All calls to malloc in this directory have a cast. > >> --- >> >> General: I suggest generating the javadoc for your new classes and >> having an editorial check done. I spotted a couple of typos eg: >> >> DiagnosticCommandArgumentInfo.java: >> 32 * of one parameter of diagnostic command. >> ^the >> DiagnosticCommandInfo.java >> 89 * Returns the a list of the >> ^^^^ typo > > These two typos have been fixed. I'm re-re-re-reading the javadoc > looking for more :-) > > Thanks, > > Fred > >> On 13/12/2011 12:31 AM, Frederic Parain wrote: >>> Hi Robert, >>> >>> These issues should be solved with the new webrevs: >>> >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.03/ >>> >>> Regards, >>> >>> Fred >>> >>> On 12/ 9/11 03:17 PM, Robert Ottenhag wrote: >>>> Adding to the review of jmm.h, that is modified in both the jdk part >>>> and the hotspot part, these files should be identical, without any >>>> differences in whitespace. >>>> >>>> Also, regarding whitespace and indentation, the use TAB characters in >>>> many files in the jdk patch makes jcheck complain (when trying to >>>> import your patch locally), and should be replaced by spaces. >>>> >>>> Best regards, >>>> >>>> /Robert >>>> >>>> >>>>> -----Original Message----- From: Paul Hohensee Sent: Thursday, >>>>> December 08, 2011 7:26 PM To: Frederic Parain Cc: >>>>> serviceability-dev at openjdk.java.net; >>>>> core-libs-dev at openjdk.java.net; >>>>> hotspot-runtime-dev at openjdk.java.net Subject: Re: Request for >>>>> Review (XXL): 7104647: Adding a diagnostic command framework >>>>> >>>>> For the hotspot part at >>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>>> >>>>> Most of my comments are style-related. Nice job on the >>>>> implementation architecture. >>>>> >>>>> In attachListener.cpp: >>>>> >>>>> You might want to delete the first "return JNI_OK;" line, since the >>>>> code under HAS_PENDING_EXCEPTION just falls through. >>>>> >>>>> In jmm.h: >>>>> >>>>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as >>>>> the existing declarations. Add a newline just before it on line >>>>> 322. >>>>> >>>>> >>>>> In diagnosticFramework.hpp: >>>>> >>>>> Fix indenting for lines 63-66, insert blank before "size_t" on line >>>>> 48. >>>>> >>>>> Hotspot convention is that getter method names don't include a >>>>> "get_" prefix. So, e.g., DCmdArgIter::get_key_addr() s/b >>>>> DCmdArgIter::key_addr(). Similarly, getters such as is_enabled() >>>>> should retrieve a field named "_is_enabled" rather than one named >>>>> "enabled". You follow the "_is_enabled" convention in other places >>>>> such as GenDCmdArgument. Or you could use enabled() to get the >>>>> value of the _enabled field. >>>>> >>>>> Also generally, I'd use accessor methods in the implementation of >>>>> more complex member methods rather than access the underlying >>>>> fields directly. E.g. in GenDCmdArgument::read_value, I'd use >>>>> is_set() and set_is_set(true), (set_is_set() is not actually >>>>> defined, but should be) rather than directly accessing _is_set. >>>>> Though sometimes doing this is too much of a pain with fields whose >>>>> type is a template argument, as in the >>>>> DCmdArggument::parse_value() method in >>>>> diagnosticArgument.cpp. >>>>> >>>>> For easy readability, it'd be nice to line up field names (the ones >>>>> with an _ prefix) at the same column. >>>>> >>>>> On line 200, "instanciated" -> "instantiated" >>>>> >>>>> On line 218, I'd use "heap_allocated" rather than "heap" for the >>>>> formal arg name. >>>>> >>>>> On line 248, you could indent the text to start underneath >>>>> "outputStream". I generally find that indenting arguments lines >>>>> (formal or actual) so they line up with the first argument position >>>>> make the code more readable, but I'm not religious about it. >>>>> >>>>> On line 265, "instanciated" -> "instantiated" >>>>> >>>>> DCmdFactorys are members of a singly-linked list, right? If so, >>>>> it'd be good to have a comment to that effect on the declaration of >>>>> _next. >>>>> >>>>> On line 322, insert a blank before "true". You might fix this in >>>>> other places where there's no blank between a comma in an argument >>>>> list and the following parameter value. >>>>> >>>>> >>>>> In diagnosticCommandFramework.cpp: >>>>> >>>>> The code from lines 80-95 and 105-120 is identical. Factor out? >>>>> >>>>> >>>>> In diagnosticArgument.cpp: >>>>> >>>>> On line 41, insert blanks before the actual arguments. (see above >>>>> generic comment) >>>>> >>>>> On line 77, the "if" is indented one space too many. >>>>> >>>>> >>>>> In management.cpp: >>>>> >>>>> I'd be consistent with having or not having a space between >>>>> "while", "if" and "for" and the following "(" in this and your >>>>> other code. Most hotspot code has a space. >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Paul >>>>> >>>>> >>>>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>>>> Hi All, >>>>>> >>>>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>>>> because changes are pretty big and touch all these areas] >>>>>> >>>>>> Here's a framework for issuing diagnostics commands to the JVM. >>>>>> Diagnostic commands are actions executed inside the JVM mainly >>>>>> for monitoring or management purpose. This work has two parts. >>>>>> The first part is in the hotspot repository and contains the >>>>>> framework itself with two diagnostic commands. The second part is >>>>>> in the JDK repository and contains the command line utility to >>>>>> invoke diagnostic commands as well as the HotSpotDiagnosticMXBean >>>>>> extensions. The HotSpotDiagnosticMXBean extensions allow a remote >>>>>> client to discover and invoke diagnostic commands using a JMX >>>>>> connection. >>>>>> >>>>>> This changeset only contains two diagnostic commands, more >>>>>> commands will be added in the future, as a standalone effort to >>>>>> improve the monitoring and management services of the JVM, or as >>>>>> part of other projects. >>>>>> >>>>>> Webrevs are here: >>>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>>>> >>>>>> Here's a technical description of this work: >>>>>> >>>>>> 1 - The Diagnostic Command Framework 1-1 Overview >>>>>> >>>>>> The diagnostic command framework is fully implemented in native >>>>>> code and relies on the HotSpot's internal exception mechanism. >>>>>> The rational of a pure native implementation is to be able to >>>>>> execute diagnostic commands even in critical situations like an >>>>>> OutOfMemory error. All diagnostic commands are registered in a >>>>>> single list, and two flags control the way a user can interact >>>>>> with them. The "hidden" flag prevents a diagnostic command from >>>>>> appearing in the list of available commands returned by the >>>>>> "help" command. However, it's still possible to get the detailed >>>>>> help message for a hidden command with the "help " >>>>>> syntax (but it requires to know the name of the hidden command). >>>>>> The second flag is "enabled" and it controls if a command can be >>>>>> invoked or not. When listed with the "help" commands, disabled >>>>>> commands appear with a "[disabled]" label in their description. >>>>>> If the user tries to invoke a disabled command, an error message >>>>>> is returned and the command is not run. This error message can be >>>>>> customized on a per command base. The framework just provides >>>>>> these two flags with their semantic, it doesn't provide any >>>>>> policy or mechanism to set or modify these flags. These actions >>>>>> will be delegated to the JVM or special diagnostic commands. >>>>>> >>>>>> 1-2 Implementation >>>>>> >>>>>> All diagnostic commands are implemented as subclasses of the DCmd >>>>>> class defined in services/diagnosticFramework.hpp. Here's the >>>>>> layout of the DCmd class and the list of methods that a new >>>>>> command has to define or overwrite: >>>>>> >>>>>> class DCmd { DCmd(outputStream *output); >>>>>> >>>>>> static const char *get_name(); >>>>>> >>>>>> static const char *get_description(); >>>>>> >>>>>> static const char *get_disabled_message(); >>>>>> >>>>>> static const char *get_impact(); >>>>>> >>>>>> static int get_num_arguments(); >>>>>> >>>>>> virtual void print_help(outputStream* out); >>>>>> >>>>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>>>> >>>>>> virtual void execute(TRAPS); >>>>>> >>>>>> virtual void reset(TRAPS); >>>>>> >>>>>> virtual void cleanup(); >>>>>> >>>>>> virtual GrowableArray* get_argument_name_array(); >>>>>> >>>>>> virtual GrowableArray* >>>>>> get_argument_info_array(); } >>>>>> >>>>>> A diagnostic command is always instantiated with an outputStream >>>>>> in parameter. This outputStream can point either to a file, a >>>>>> buffer or a socket (see the ostream.hpp file). >>>>>> >>>>>> The get_name() method returns the string that will identify the >>>>>> command (i.e. the string to put on the command line to invoke >>>>>> it). >>>>>> >>>>>> The get_description() methods returns the global description of >>>>>> the command. >>>>>> >>>>>> The get_disabled_message() returns the customized message to >>>>>> return when the command is disabled, without having to >>>>>> instantiate the command. >>>>>> >>>>>> The get_impact() returns a description of the intrusiveness of >>>>>> the diagnostic command on the Java Virtual Machine behavior. The >>>>>> rational for this method is that some diagnostic commands can >>>>>> seriously disrupt the behavior of the Java Virtual Machine (for >>>>>> instance a Thread Dump for an application with several tens of >>>>>> thousands of threads, or a Head Dump with a 40GB+ heap size) and >>>>>> other diagnostic commands have no serious impact on the JVM (for >>>>>> instance, getting the command line arguments or the JVM version). >>>>>> The recommended format for the description is: >>>>>> [longer description], where the impact level is selected among >>>>>> this list: {low, medium, high}. The optional longer description >>>>>> can provide more specific details like the fact that Thread Dump >>>>>> impact depends on the heap size. >>>>>> >>>>>> The get_num_arguments() returns the number of options/arguments >>>>>> recognized by the diagnostic command. This method is only used by >>>>>> the JMX interface support (see below). >>>>>> >>>>>> The print_help() methods prints a detailed help on the >>>>>> outputStream passed in argument. The detailed help contains the >>>>>> list of all supported options with their type and description. >>>>>> >>>>>> The parse() method is in charge of parsing the command arguments. >>>>>> Each command is free to implement its own argument parser. >>>>>> However, an argument parser framework is provided (see section >>>>>> 1-3) to ease the implementation, but its use is optional. The >>>>>> parse method takes a delimiter character in argument, which is >>>>>> used to mark the limit between two arguments (typically >>>>>> invocation from jcmd will use a space character as a delimiter >>>>>> while invocation from the JVM command line parsing code will use >>>>>> a comma as a delimiter). >>>>>> >>>>>> The execute() method is naturally the one to invoke to get the >>>>>> diagnostic command executed. The parse() and the execute() >>>>>> methods are dissociated, so it's a possible perform the argument >>>>>> parsing in one thread, and delegate the execution to another >>>>>> thread, as long as the diagnostic command doesn't reference >>>>>> thread local variables. The framework allows several instances of >>>>>> the same diagnostic command to be executed in parallel. If for >>>>>> some reasons concurrent executions should not be allowed for a >>>>>> given diagnostic command, this is the responsibility of the >>>>>> diagnostic command implementor to enforce this rule, for instance >>>>>> by protecting the body of the execute() method with a global >>>>>> lock. >>>>>> >>>>>> The reset() method is used to initialize the internal fields of >>>>>> the diagnostic command or to reset the internal fields to their >>>>>> initial value to be able to re-use an already allocated >>>>>> diagnostic command instance. >>>>>> >>>>>> The cleanup() method is used to perform perform cleanup (like >>>>>> freeing of all memory allocated to store internal data). The DCmd >>>>>> extends the ResourceObj class, so when allocated in a >>>>>> ResourceArea, destructors cannot be used to perform cleanup. To >>>>>> ensure that cleanup is performed in all cases, it is recommended >>>>>> to create a DCmdMark instance for each DCmd instance. DCmdMark is >>>>>> a stack allocated object with a pointer to a DCmd instance. When >>>>>> the DCmdMark is destroyed, its destructor calls the cleanup() >>>>>> method of the DCmd instance it points to. If the DCmd instance >>>>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>>>> memory allocated to store the DCmd instance. >>>>>> >>>>>> The get_argument_name_array() and get_argument_info_array() are >>>>>> related to the JMX interface of the diagnostic command framework, >>>>>> so they are described in section 3. >>>>>> >>>>>> 1-3 DCmdParser framework >>>>>> >>>>>> The DCmdParser class is an optional framework to help development >>>>>> of argument parsers. It provides many features required by the >>>>>> diagnostic command framework (generation of the help message or >>>>>> the argument descriptions for the JMX interface) but all these >>>>>> features can easily be re-implemented if a developer decides not >>>>>> to use the DCmdParser framework. >>>>>> >>>>>> The DCmdParser class is relying on the DCmdArgument template. >>>>>> This template must be used to define the different types of >>>>>> argument the parser will have to handle. When a new >>>>>> specialization of the template is done, three methods have to be >>>>>> provided: >>>>>> >>>>>> void parse_value(const char *str,size_t len,TRAPS); void >>>>>> init_value(TRAPS); void destroy_value(); >>>>>> >>>>>> The parse_value() method is used to convert a string into an >>>>>> argument value. The print_value() method is used to display the >>>>>> default value (support for the detailed help message). The >>>>>> init_value() method is used to initialize or reset the argument >>>>>> value. The destroy_value() method is a clean-up method (useful >>>>>> when the argument has allocated some C-Heap memory to store its >>>>>> value and this memory has to be freed before destroying the >>>>>> DCmdArgument instance). >>>>>> >>>>>> The DCmdParser makes a distinction between options and >>>>>> arguments. Options are identified by a key name that must appear >>>>>> on the command line, while argument are identified just by the >>>>>> position of the argument on the command line. Options use >>>>>> the= syntax. In case of boolean options, the >>>>>> '=' part of the syntax can be omitted to set the option to >>>>>> true. Arguments are just sequences characters delimited by a >>>>>> separator character. This separator can be specified at runtime >>>>>> when invoking the diagnostic command framework. If an argument >>>>>> contain a character that could be used as a delimiter, it's >>>>>> possible to enclose the argument between single or double quotes. >>>>>> Options are arguments are instantiated using the same >>>>>> DCmdArgument class but they're registered differently to the >>>>>> DCmdParser. >>>>>> >>>>>> The way to use the DCmdParser is to declare the parser and the >>>>>> option/arguments as fields of the diagnostic command class (which >>>>>> is itself a sub-class of the DCmd class), like this: >>>>>> >>>>>> >>>>>> class EchoDCmd : public DCmd { protected: DCmdParser >>>>>> _dcmdparser; >>>>>> >>>>>> DCmdArgument _required; >>>>>> >>>>>> DCmdArgument _intval; >>>>>> >>>>>> DCmdArgument _boolval; >>>>>> >>>>>> DCmdArgument _stringval; >>>>>> >>>>>> DCmdArgument _first_arg; >>>>>> >>>>>> DCmdArgument _second_arg; >>>>>> >>>>>> DCmdArgument _optional_arg; >>>>>> >>>>>> } >>>>>> >>>>>> The parser and the options/arguments must be initialized before >>>>>> the diagnostic command class, and the options/arguments have to >>>>>> be registered to the parser like this: >>>>>> >>>>>> EchoDCmd(outputStream *output) : DCmd(output), >>>>>> _stringval("-strval","a string argument","STRING",false), >>>>>> >>>>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>>>> >>>>>> _intval("-intval","an integer argument","INTEGER",false), >>>>>> >>>>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>>>> >>>>>> _fist_arg("first argument","a string argument","STRING",true), >>>>>> >>>>>> _second_arg("second argument,"an integer >>>>>> argument,"INTEGER",true), >>>>>> >>>>>> _optional_arg("optional argument","an optional string >>>>>> argument","STRING","false") >>>>>> >>>>>> { >>>>>> >>>>>> _dcmdparser.add_dcmd_option(&_stringval) >>>>>> >>>>>> _dcmdparser.add_dcmd_option(&_boolval); >>>>>> >>>>>> _dcmdparser.add_dcmd_option(&_intval); >>>>>> >>>>>> _dcmdparser.add_dcmd_option(&_required); >>>>>> >>>>>> _dcmdparser.add_argument(&_first_arg); >>>>>> >>>>>> _dcmdparser.add_argument(&_second_arg); >>>>>> >>>>>> _dcmdparser.add_argument(&_optional_arg); }; >>>>>> >>>>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add >>>>>> an argument/option to the parser. The option/argument constructor >>>>>> takes the name of the option/argument, its description, a string >>>>>> describing its type and a boolean to specify if the >>>>>> option/argument is mandatory or not. The parser doesn't support >>>>>> option/argument duplicates (having the same name) but the code >>>>>> currently doesn't check for duplicates.The order used to register >>>>>> options has no impact on the parser. However, the order used to >>>>>> register arguments is critical because the parser will use the >>>>>> same order to parse the command line. In the example above, the >>>>>> parser expects to have a first argument of type STRING (parsed >>>>>> using _first_arg), then a second argument of type INTEGER (parsed >>>>>> using _second_arg) and optionally a third parameter of type >>>>>> STRING (parsed using _optional_arg). A mandatory option or >>>>>> argument has to be specify every time the command is invoked. If >>>>>> it is missing, an exception is thrown at the end of the parsing. >>>>>> Optional arguments have to be registered after mandatory >>>>>> arguments. An optional argument will be considered for parsing >>>>>> only if all arguments before it (mandatory or not) have already >>>>>> been used to parse the command line. >>>>>> >>>>>> The DCmdParser and its DCmdArgument instances are embedded in the >>>>>> DCmd instance. The rational for this design is to limit the >>>>>> number of C-heap allocations but also to be able to pre-allocate >>>>>> diagnostic command instances for critical situations. If the >>>>>> process is running out of C-heap space, it's not possible to >>>>>> instantiate new diagnostic commands to troubleshoot the >>>>>> situation. By pre-allocating some diagnostic commands, it will be >>>>>> possible to run them even in this critical situation. Of course, >>>>>> the diagnostic command itself should not try to allocate memory >>>>>> during its execution, this prevents the diagnostic command to use >>>>>> variable length arguments like strings. By nature, pre-allocated >>>>>> diagnostic commands aim to be re-usable, this is the purpose of >>>>>> the reset() method which restores the default status of all >>>>>> arguments. >>>>>> >>>>>> 1-4 Internal invocation >>>>>> >>>>>> Using a diagnostic command from the JVM itself is pretty easy: >>>>>> instantiate the class and invoke the parse() method then the >>>>>> execute() method. A diagnostic command can be instantiated from >>>>>> inside the JVM even it is not registered. This is a difference >>>>>> with the external invocations (from jcmd or JMX) that require the >>>>>> command to be >>>>> registered. >>>>>> >>>>>> 2 - The JCmd interface >>>>>> >>>>>> Diagnostic commands can also be invoked from outside the JVM >>>>>> process, using the new 'jcmd' utility. The jcmd program uses the >>>>>> attach API to connect to the JVM, send requests and receive >>>>>> results. The jcmd utility must be launched on the same machine >>>>>> than the one running the JVM (its a local tool). Launched without >>>>>> arguments, jcmd displays a list of all JVMs running on the >>>>>> machine. The jcmd source code is in the jdk repository like other >>>>>> existing j* tools. >>>>>> >>>>>> To execute a diagnostic command in a particular JVM, the generic >>>>>> syntax is: >>>>>> >>>>>> jcmd [arguments] >>>>>> >>>>>> The attachListener has been modified to recognized the jcmd >>>>>> requests. When a jcmd request is identified, it is parsed to >>>>>> extract the command name. The JVM performs a look up of this >>>>>> command in a list of registered commands. To be executable by an >>>>>> external request, a diagnostic command has to be registered. The >>>>>> registration is performed with the DCmdFactory class (see >>>>>> services/management.cpp). >>>>>> >>>>>> 3 - The JMX interface >>>>>> >>>>>> The framework provides a JMX based interface to the diagnostic >>>>>> commands. This interface allows remote invocation of diagnostic >>>>>> commands through a JMX connection. >>>>>> >>>>>> 3-1 The interface >>>>>> >>>>>> The information related to the diagnostic commands are >>>>>> accessible through new methods added to the >>>>>> com.sun.management.HotspotDiagnosticMXBean: >>>>>> >>>>>> public List getDiagnosticCommands(); >>>>>> >>>>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String >>>>>> command); >>>>>> >>>>>> public List >>>>>> getDiagnosticCommandInfo(List command); >>>>>> >>>>>> public List getDiagnosticCommandInfo(); >>>>>> >>>>>> public String execute(String commandLine) throws >>>>>> IllegalArgumentException ; >>>>>> >>>>>> public String execute(String cmd, String... arguments) throws >>>>>> IllegalArgumentException; >>>>>> >>>>>> >>>>>> The getDiagnosticCommands() method returns an array containing >>>>>> the names of the not-hidden registered diagnostic commands. >>>>>> >>>>>> The three getDiagnosticCommandInfo() methods return one or >>>>>> several diagnostic command descriptions using the >>>>>> DiagnosticCommandInfo class. >>>>>> >>>>>> The two execute() methods allow the user the invoke a diagnostic >>>>>> command in different ways. >>>>>> >>>>>> The DiagnosticCommandInfo class is describing a diagnostic >>>>>> command with the following information: >>>>>> >>>>>> public class DiagnosticCommandInfo { >>>>>> >>>>>> public String getName(); >>>>>> >>>>>> public String getDescription(); >>>>>> >>>>>> public String getImpact(); >>>>>> >>>>>> public boolean isEnabled(); >>>>>> >>>>>> public List getArgumentsInfo(); >>>>>> } >>>>>> >>>>>> The getName() method returns the name of the diagnostic command. >>>>>> This name is the one to use in execute() methods to invoke the >>>>>> diagnostic command. >>>>>> >>>>>> The getDescription() method returns a general description of the >>>>>> diagnostic command. >>>>>> >>>>>> The getImpact() method returns a description of the intrusiveness >>>>>> of diagnostic command. >>>>>> >>>>>> The isEnabled() method returns true if the method is enabled, >>>>>> false if it is disabled. A disabled method cannot be executed. >>>>>> >>>>>> The getArgumentsInfo() returns a list of descriptions for the >>>>>> options or arguments recognized by the diagnostic command. Each >>>>>> option/argument is described by a DiagnosticCommandArgumentInfo >>>>>> instance: >>>>>> >>>>>> public class DiagnosticCommandArgumentInfo { >>>>>> >>>>>> public String getName(); >>>>>> >>>>>> public String getDescription(); >>>>>> >>>>>> public String getType(); >>>>>> >>>>>> public String getDefault(); >>>>>> >>>>>> public boolean isMandatory(); >>>>>> >>>>>> public boolean isOption(); >>>>>> >>>>>> public int getPosition(); } >>>>>> >>>>>> If the DiagnosticCommandArgumentInfo instance describes an >>>>>> option, isOption() returns true and getPosition() returns -1. >>>>>> Otherwise, when the DiagnosticCommandArgumentInfo instance >>>>>> describes an argument, isOption() returns false and getPosition() >>>>>> returns the expected position for this argument. The position of >>>>>> an argument is defined relatively to all arguments passed on the >>>>>> command line, options are not considered when defining an >>>>>> argument position. The getDefault() method returns the default >>>>>> value of the argument if a default has been defined, otherwise it >>>>>> returns null. >>>>>> >>>>>> 3-2 The implementation >>>>>> >>>>>> The framework has been designed in a way that prevents >>>>>> diagnostic command developers to worry about the JMX interface. >>>>>> In addition to the methods described in section 1-2, a diagnostic >>>>>> command developer has to provide three methods: >>>>>> >>>>>> int get_num_arguments() >>>>>> >>>>>> which returns the number of option and arguments supported by >>>>>> the command. >>>>>> >>>>>> GrowableArray* get_argument_name_array() >>>>>> >>>>>> which provides the name of the arguments supported by the >>>>>> command. >>>>>> >>>>>> GrowableyArray* get_argument_info_array() >>>>>> >>>>>> which provides the description of each argument with a >>>>>> DCmdArgumentInfo instance. DCmdArgumentInfo is a C++ class used >>>>>> by the framework to generate the >>>>>> sun.com.management.DcmdArgumentInfo instances. This is done >>>>>> automatically and the diagnostic command developer doesn't need >>>>>> to know how to create Java objects from the runtime. >>>>>> >>>>>> 4 - The Diagnostic Commands >>>>>> >>>>>> To avoid name collisions between diagnostic commands coming from >>>>>> different projects, use of a flat name space should be avoided >>>>>> and a more structured organization is recommended. The framework >>>>>> itself doesn't depend on this organization, so it will be a set >>>>>> of rules defining a convention in the way commands are named. >>>>>> >>>>>> Diagnostic commands can easily organized in a hierarchical way, >>>>>> so the template for a command name can be: >>>>>> >>>>>> .[sub-domain.] >>>>>> >>>>>> This template can be extended with sub-sub-domains and so on. >>>>>> >>>>>> A special set of commands without domain will be reserved for >>>>>> the commands related to the diagnostic framework itself, like the >>>>>> "help" command. >>>>>> >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Fred >>>>>> >>> > From zhouyx at linux.vnet.ibm.com Wed Dec 14 02:42:37 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Wed, 14 Dec 2011 10:42:37 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE75F21.1040803@gmx.de> References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4EE75F21.1040803@gmx.de> Message-ID: Yeah, that is the reason I think a declaimer about "not designed for concurrent operation. " in the spec would be a proper choice. On Tue, Dec 13, 2011 at 10:20 PM, Ulf Zibis wrote: > IMO in 99.8 % this check would be superfluous overhead. > For those, who want 100 %, they can check and copy in their code. > > -Ulf > > Am 13.12.2011 14:30, schrieb Sean Chou: > > Sorry for the confuse. By "ok", I mean "compare the size of array which is >> going to be >> returned and the size of the specified array, and copy the elements >> into the specified >> array if it is larger and return the specified array." >> >> Nothing is causing problem for now, I just found a mismatch. I think most >> guys will >> just use the returned array without checking if it's the specified one; >> and >> this is also >> why I think it may be possible to modify the behavior without causing >> problems. >> >> And I think modifying ConcurrentHashMap is as dangerous as modifying >> AbstractCollection >> if people are relying on implementation, is this right? So it seems we can >> do nothing >> to the mismatch now... >> >> -- Best Regards, Sean Chou From david.holmes at oracle.com Wed Dec 14 05:01:54 2011 From: david.holmes at oracle.com (David Holmes) Date: Wed, 14 Dec 2011 15:01:54 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4EE75F21.1040803@gmx.de> Message-ID: <4EE82DC2.4040100@oracle.com> Sean, Ulf, I retract all my previous comments - they were completely wrong. AbstractCollection.toArray _does_ address concurrent modification: "This implementation returns an array containing all the elements returned by this collection's iterator in the same order, stored in consecutive elements of the array, starting with index 0. If the number of elements returned by the iterator is too large to fit into the specified array, then the elements are returned in a newly allocated array with length equal to the number of elements returned by the iterator, even if the size of this collection changes during iteration, as might happen if the collection permits concurrent modification during iteration. The size method is called only as an optimization hint; the correct result is returned even if the iterator returns a different number of elements. " As the number of elements to be returned by the iterator can not be known until iteration completes, it follows that only then can the question of whether or not the specified array is large enough, be answered. Consequently if the number of elements returned by the iterator would fit in the specified array then the specified array must be returned. So I would say that this is a bug in the JDK's AbstractCollection implementation afterall. Note that the above part of the "spec" is an "implementation note" that describes the JDKs implementation of AbstractCollection - it is not part of the specification for AbstractCollection such that a third party implementor would have to do the same. Further, the use of AbstractCollection as a base implementation for the Set returned by ConcurrentHashMap.values() is part of the internal implementation details of CHM, not part of the spec for CHM.values(). So although this is a bug in the JDKs implementation of AbstractCollection, based on its own implementation note, it is not behaviour that a portable application should rely on. My apologies for my confusion on this issue. David ----- On 14/12/2011 12:42 PM, Sean Chou wrote: > > Yeah, that is the reason I think a declaimer about "not designed for > concurrent > operation. " in the spec would be a proper choice. > > > On Tue, Dec 13, 2011 at 10:20 PM, Ulf Zibis > wrote: > > IMO in 99.8 % this check would be superfluous overhead. > For those, who want 100 %, they can check and copy in their code. > > -Ulf > > Am 13.12.2011 14:30, schrieb Sean Chou: > > Sorry for the confuse. By "ok", I mean "compare the size of > array which is > going to be > returned and the size of the specified array, and copy the elements > into the specified > array if it is larger and return the specified array." > > Nothing is causing problem for now, I just found a mismatch. I > think most > guys will > just use the returned array without checking if it's the > specified one; and > this is also > why I think it may be possible to modify the behavior without > causing > problems. > > And I think modifying ConcurrentHashMap is as dangerous as modifying > AbstractCollection > if people are relying on implementation, is this right? So it > seems we can > do nothing > to the mismatch now... > > > > > -- > Best Regards, > Sean Chou > From mike.duigou at oracle.com Wed Dec 14 05:03:03 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Tue, 13 Dec 2011 21:03:03 -0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> Message-ID: <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> I agree that most people probably won't check whether the array returned is the array they provided. It is possible that they incorrectly assume it is. ie. Collection collection; ... Integer[] foo = new Integer[collection.size()]; // of sufficient size for all elements // at this point collection grows. collection.toArray(foo); // this will work, right? for(Integer each : foo) { // wait! foo is empty, why? } If collection is mutated and increased in size between the creation of foo and the toArray operation then foo will be empty and the user probably won't know why the elements weren't copied. Actually, the elements were copied but the result of toArray containing those elements was ignored. This usage seems like just a bad idiom though and is avoidable. More worrying is the toArray() case where the resultant array is currently documented to hold only result elements and no extra nulls. If the collection shrinks then it is currently possible that the resulting array could very unexpectedly hold nulls. Mike On Dec 13 2011, at 05:30 , Sean Chou wrote: > Sorry for the confuse. By "ok", I mean "compare the size of array which is > going to be > returned and the size of the specified array, and copy the elements > into the specified > array if it is larger and return the specified array." > > Nothing is causing problem for now, I just found a mismatch. I think most > guys will > just use the returned array without checking if it's the specified one; and > this is also > why I think it may be possible to modify the behavior without causing > problems. > > And I think modifying ConcurrentHashMap is as dangerous as modifying > AbstractCollection > if people are relying on implementation, is this right? So it seems we can > do nothing > to the mismatch now... > > > On Tue, Dec 13, 2011 at 8:06 PM, David Holmes wrote: > >> On 13/12/2011 9:18 PM, Sean Chou wrote: >> >>> Hi , >>> >>> Is it possible to change the spec ? I found it is defined in >>> java.utils.Collection interface. It would be easy for >>> AbstractCollection to state that it is not designed for concurrent >>> operations, and its subclass should take care of them. >>> >> >> Such a disclaimer might be added to the spec for AbstractCollection but >> that doesn't really change anything - it just makes observed behaviour less >> surprising. >> >> >> However, I think the simplest way may be modifying toArray(T[]) >>> method for an additional check, which would work for most subclasses of >>> AbstractCollection... >>> Is that ok ? >>> >> >> "ok" in what sense? Do you want to change the spec or just change the >> current behaviour? If you do the latter and people rely on that >> implementation rather than the spec then code will not be portable across >> different implementations of the platform. >> >> I would not want to see a change in behaviour without a change in >> specification and I do not think the specification for AbstractCollection >> can, or should be, changed. Just my opinion of course. >> >> What is the concrete concurrent collection that you have a problem with? >> If it is ConcurrentHashMap, as per the example, then perhaps >> ConcurrentHashMap should be where a change is considered. >> >> David >> ----- >> >> >>> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes >> >> wrote: >>> >>> Hi Sean, >>> >>> >>> On 13/12/2011 5:21 PM, Sean Chou wrote: >>> >>> When I was reading the code of AbstractCollection.toArray(T[] ), I >>> found its behavior maybe different from the spec in multithread >>> environment. The spec says "If the collection fits in the specified >>> array, it is returned therein. Otherwise, a new array is allocated >>> with the runtime type of the specified array and the size of this >>> collection." However, in multithread environment, it is not easy >>> to >>> tell if the collection fits in the specified array, because the >>> items may be removed when toArray is copying. >>> >>> >>> Right. The problem is that AbstractCollection doesn't address >>> thread-safety or any other concurrency issues so doesn't account for >>> the collection growing or shrinking while the toArray snapshot is >>> being taken. Really the collection implementations that are designed >>> to support multiple threads should override toArray to make it clear >>> how it should behave. As it stands, in my opinion, it is more a >>> "quality of implementation" issue as to whether AbstractCollection >>> expends effort after creating the array to see if the array is >>> actually full or not; or whether after creating an array it turns >>> out it could have fit in the original. >>> >>> For a concurrent collection I would write the spec for toArray >>> something like: >>> >>> "The current size of the collection is examined and if the >>> collection fits in the specified array it will be the target array, >>> else a new array is allocated based on that current size and it >>> becomes the target array. If the collection grows such that the >>> target array no longer fits then extra elements will not be copied >>> into the target array. If the collection shrinks then the target >>> array will contain null elements." >>> >>> Or for the last part "then the target array will be copied to a new >>> array that exactly fits the number of elements returned". >>> >>> David Holmes >>> ------------ >>> >>> >>> >>> Here is a testcase: >>> //////////////////////////////**__////////////////////////////** >>> //__////////////// >>> >>> import java.util.Map; >>> import java.util.concurrent.__**ConcurrentHashMap; >>> >>> >>> public class CollectionToArrayTest { >>> >>> static volatile Map map = new >>> TConcurrentHashMap(); >>> static volatile boolean gosleep = true; >>> >>> static class TConcurrentHashMap extends >>> ConcurrentHashMap { >>> public int size() { >>> int oldresult = super.size(); >>> System.out.println("map size before concurrent >>> remove is " >>> + oldresult); >>> while (gosleep) { >>> try { >>> // Make sure the map is modified during >>> toArray is >>> called, >>> // between getsize and being iterated. >>> Thread.sleep(1000); >>> // System.out.println("size called, size is " >>> + >>> oldresult + >>> // " take a sleep to make sure the element >>> is deleted >>> before size is returned."); >>> } catch (Exception e) { >>> } >>> } >>> return oldresult; >>> } >>> } >>> >>> static class ToArrayThread implements Runnable { >>> public void run() { >>> for (int i = 0; i< 5; i++) { >>> String str = Integer.toString(i); >>> map.put(str, str); >>> } >>> String[] buffer = new String[4]; >>> String[] strings = map.values().toArray(buffer); >>> // System.out.println("length is " + strings.length); >>> if (strings.length<= buffer.length) { >>> System.out.println("given array size is " >>> + buffer.length >>> + " \nreturned array size is " >>> + strings.length >>> + ", \nbuffer should be used >>> according to >>> spec. Is buffer used : " >>> + (strings == buffer)); >>> } >>> } >>> } >>> >>> static class RemoveThread implements Runnable { >>> public void run() { >>> String str = Integer.toString(0); >>> map.remove(str); >>> gosleep = false; >>> } >>> } >>> >>> public static void main(String args[]) { >>> CollectionToArrayTest app = new CollectionToArrayTest(); >>> app.test_concurrentRemove(); >>> } >>> >>> public void test_concurrentRemove() { >>> >>> System.out.println("//////////**__////////////////////////////** >>> //__//////\n" >>> >>> + >>> "The spec says if the given array is large\n " + >>> "enough to hold all elements, the given array\n" + >>> "should be returned by toArray. This \n" + >>> "testcase checks this case. \n" + >>> "/////////////////////////////**__/////////////////"); >>> >>> >>> Thread[] threads = new Thread[2]; >>> threads[0] = new Thread(new ToArrayThread()); >>> threads[1] = new Thread(new RemoveThread()); >>> >>> threads[0].start(); >>> >>> try { >>> // Take a sleep to make sure toArray is already >>> called. >>> Thread.sleep(1200); >>> } catch (Exception e) { >>> } >>> >>> threads[1].start(); >>> } >>> } >>> >>> //////////////////////////////**__////////////////////////////** >>> //__////////////// >>> >>> >>> TConcurrentHashMap is used to make sure the collection is modified >>> during toArray is invoked. So the returned array fits in the >>> specified >>> array, but a new array is used because toArray checks the size >>> before copying. >>> >>> Is this a bug ? >>> >>> >>> >>> >>> >>> -- >>> Best Regards, >>> Sean Chou >>> >>> > > > -- > Best Regards, > Sean Chou From zhouyx at linux.vnet.ibm.com Wed Dec 14 07:05:14 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Wed, 14 Dec 2011 15:05:14 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> Message-ID: Hi Mike, David, I reported this as a bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7121314 . On Wed, Dec 14, 2011 at 1:03 PM, Mike Duigou wrote: > I agree that most people probably won't check whether the array returned > is the array they provided. It is possible that they incorrectly assume it > is. ie. > > Collection collection; > ... > Integer[] foo = new Integer[collection.size()]; // of sufficient size for > all elements > // at this point collection grows. > collection.toArray(foo); // this will work, right? > for(Integer each : foo) { > // wait! foo is empty, why? > } > > If collection is mutated and increased in size between the creation of foo > and the toArray operation then foo will be empty and the user probably > won't know why the elements weren't copied. Actually, the elements were > copied but the result of toArray containing those elements was ignored. > > This usage seems like just a bad idiom though and is avoidable. > > More worrying is the toArray() case where the resultant array is currently > documented to hold only result elements and no extra nulls. If the > collection shrinks then it is currently possible that the resulting array > could very unexpectedly hold nulls. > > Mike > > On Dec 13 2011, at 05:30 , Sean Chou wrote: > > > Sorry for the confuse. By "ok", I mean "compare the size of array which > is > > going to be > > returned and the size of the specified array, and copy the elements > > into the specified > > array if it is larger and return the specified array." > > > > Nothing is causing problem for now, I just found a mismatch. I think most > > guys will > > just use the returned array without checking if it's the specified one; > and > > this is also > > why I think it may be possible to modify the behavior without causing > > problems. > > > > And I think modifying ConcurrentHashMap is as dangerous as modifying > > AbstractCollection > > if people are relying on implementation, is this right? So it seems we > can > > do nothing > > to the mismatch now... > > > > > > On Tue, Dec 13, 2011 at 8:06 PM, David Holmes >wrote: > > > >> On 13/12/2011 9:18 PM, Sean Chou wrote: > >> > >>> Hi , > >>> > >>> Is it possible to change the spec ? I found it is defined in > >>> java.utils.Collection interface. It would be easy for > >>> AbstractCollection to state that it is not designed for concurrent > >>> operations, and its subclass should take care of them. > >>> > >> > >> Such a disclaimer might be added to the spec for AbstractCollection but > >> that doesn't really change anything - it just makes observed behaviour > less > >> surprising. > >> > >> > >> However, I think the simplest way may be modifying toArray(T[]) > >>> method for an additional check, which would work for most subclasses of > >>> AbstractCollection... > >>> Is that ok ? > >>> > >> > >> "ok" in what sense? Do you want to change the spec or just change the > >> current behaviour? If you do the latter and people rely on that > >> implementation rather than the spec then code will not be portable > across > >> different implementations of the platform. > >> > >> I would not want to see a change in behaviour without a change in > >> specification and I do not think the specification for > AbstractCollection > >> can, or should be, changed. Just my opinion of course. > >> > >> What is the concrete concurrent collection that you have a problem with? > >> If it is ConcurrentHashMap, as per the example, then perhaps > >> ConcurrentHashMap should be where a change is considered. > >> > >> David > >> ----- > >> > >> > >>> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes >>> >> wrote: > >>> > >>> Hi Sean, > >>> > >>> > >>> On 13/12/2011 5:21 PM, Sean Chou wrote: > >>> > >>> When I was reading the code of AbstractCollection.toArray(T[] ), > I > >>> found its behavior maybe different from the spec in multithread > >>> environment. The spec says "If the collection fits in the > specified > >>> array, it is returned therein. Otherwise, a new array is > allocated > >>> with the runtime type of the specified array and the size of this > >>> collection." However, in multithread environment, it is not easy > >>> to > >>> tell if the collection fits in the specified array, because the > >>> items may be removed when toArray is copying. > >>> > >>> > >>> Right. The problem is that AbstractCollection doesn't address > >>> thread-safety or any other concurrency issues so doesn't account for > >>> the collection growing or shrinking while the toArray snapshot is > >>> being taken. Really the collection implementations that are designed > >>> to support multiple threads should override toArray to make it clear > >>> how it should behave. As it stands, in my opinion, it is more a > >>> "quality of implementation" issue as to whether AbstractCollection > >>> expends effort after creating the array to see if the array is > >>> actually full or not; or whether after creating an array it turns > >>> out it could have fit in the original. > >>> > >>> For a concurrent collection I would write the spec for toArray > >>> something like: > >>> > >>> "The current size of the collection is examined and if the > >>> collection fits in the specified array it will be the target array, > >>> else a new array is allocated based on that current size and it > >>> becomes the target array. If the collection grows such that the > >>> target array no longer fits then extra elements will not be copied > >>> into the target array. If the collection shrinks then the target > >>> array will contain null elements." > >>> > >>> Or for the last part "then the target array will be copied to a new > >>> array that exactly fits the number of elements returned". > >>> > >>> David Holmes > >>> ------------ > >>> > >>> > >>> > >>> Here is a testcase: > >>> //////////////////////////////**__////////////////////////////** > >>> //__////////////// > >>> > >>> import java.util.Map; > >>> import java.util.concurrent.__**ConcurrentHashMap; > >>> > >>> > >>> public class CollectionToArrayTest { > >>> > >>> static volatile Map map = new > >>> TConcurrentHashMap(); > >>> static volatile boolean gosleep = true; > >>> > >>> static class TConcurrentHashMap extends > >>> ConcurrentHashMap { > >>> public int size() { > >>> int oldresult = super.size(); > >>> System.out.println("map size before concurrent > >>> remove is " > >>> + oldresult); > >>> while (gosleep) { > >>> try { > >>> // Make sure the map is modified during > >>> toArray is > >>> called, > >>> // between getsize and being iterated. > >>> Thread.sleep(1000); > >>> // System.out.println("size called, size is > " > >>> + > >>> oldresult + > >>> // " take a sleep to make sure the element > >>> is deleted > >>> before size is returned."); > >>> } catch (Exception e) { > >>> } > >>> } > >>> return oldresult; > >>> } > >>> } > >>> > >>> static class ToArrayThread implements Runnable { > >>> public void run() { > >>> for (int i = 0; i< 5; i++) { > >>> String str = Integer.toString(i); > >>> map.put(str, str); > >>> } > >>> String[] buffer = new String[4]; > >>> String[] strings = map.values().toArray(buffer); > >>> // System.out.println("length is " + > strings.length); > >>> if (strings.length<= buffer.length) { > >>> System.out.println("given array size is " > >>> + buffer.length > >>> + " \nreturned array size is " > >>> + strings.length > >>> + ", \nbuffer should be used > >>> according to > >>> spec. Is buffer used : " > >>> + (strings == buffer)); > >>> } > >>> } > >>> } > >>> > >>> static class RemoveThread implements Runnable { > >>> public void run() { > >>> String str = Integer.toString(0); > >>> map.remove(str); > >>> gosleep = false; > >>> } > >>> } > >>> > >>> public static void main(String args[]) { > >>> CollectionToArrayTest app = new CollectionToArrayTest(); > >>> app.test_concurrentRemove(); > >>> } > >>> > >>> public void test_concurrentRemove() { > >>> > >>> System.out.println("//////////**__////////////////////////////** > >>> //__//////\n" > >>> > >>> + > >>> "The spec says if the given array is large\n " + > >>> "enough to hold all elements, the given array\n" + > >>> "should be returned by toArray. This \n" + > >>> "testcase checks this case. \n" + > >>> "/////////////////////////////**__/////////////////"); > >>> > >>> > >>> Thread[] threads = new Thread[2]; > >>> threads[0] = new Thread(new ToArrayThread()); > >>> threads[1] = new Thread(new RemoveThread()); > >>> > >>> threads[0].start(); > >>> > >>> try { > >>> // Take a sleep to make sure toArray is already > >>> called. > >>> Thread.sleep(1200); > >>> } catch (Exception e) { > >>> } > >>> > >>> threads[1].start(); > >>> } > >>> } > >>> > >>> //////////////////////////////**__////////////////////////////** > >>> //__////////////// > >>> > >>> > >>> TConcurrentHashMap is used to make sure the collection is > modified > >>> during toArray is invoked. So the returned array fits in the > >>> specified > >>> array, but a new array is used because toArray checks the size > >>> before copying. > >>> > >>> Is this a bug ? > >>> > >>> > >>> > >>> > >>> > >>> -- > >>> Best Regards, > >>> Sean Chou > >>> > >>> > > > > > > -- > > Best Regards, > > Sean Chou > > -- Best Regards, Sean Chou From zhouyx at linux.vnet.ibm.com Wed Dec 14 08:00:18 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Wed, 14 Dec 2011 16:00:18 +0800 Subject: Add Look&Feel support for AIX platform In-Reply-To: <20111214004429.GE25730@rivendell.middle-earth.co.uk> References: <4ed43de2.4713cc0a.2daf.1d8d@mx.google.com> <1323689619.20905.3.camel@chalkhill> <1323787349.20905.15.camel@chalkhill> <1323787515.20905.17.camel@chalkhill> <20111214004429.GE25730@rivendell.middle-earth.co.uk> Message-ID: Thanks for the comment! I modified it according to your suggestion. The new version is here: http://cr.openjdk.java.net/~zhouyx/OJDK-167/webrev.00/ So will any oracle guy help create a bug and push it or give some additional comments so I can enhance the patch ? On Wed, Dec 14, 2011 at 8:44 AM, Dr Andrew John Hughes wrote: > On 14:45 Tue 13 Dec , Neil Richards wrote: > > On Tue, 2011-12-13 at 14:42 +0000, Neil Richards wrote: > > > On Tue, 2011-12-13 at 10:36 +0800, Sean Chou wrote: > > > > On Mon, Dec 12, 2011 at 7:33 PM, Neil Richards > > > > wrote: > > > > On Tue, 2011-12-06 at 11:14 +0800, Sean Chou wrote: > > > > > Hi, > > > > > > > > > > > > > > > I'm not sure what to do for it next, shall I create a > bug > > > > for it > > > > > now ? But I > > > > > don't think the bug system support AIX platform. I > > > > remembered it > > > > > would > > > > > report something like "we are not supporting the platform". > > > > > > > > > > > > > > > > > Hi Sean, > > > > Looking at the options available on the Java bug submission > > > > site [1], it > > > > looks like: > > > > Release: OpenJDK > > > > Operating System: Generic / Other > > > > > > > > would be the most appropriate choices to make. > > > > > > > > Regards, > > > > Neil > > > > > > > > > > > > -- > > > > Unless stated above: > > > > IBM email: neil_richards at uk.ibm.com > > > > IBM United Kingdom Limited - Registered in England and Wales > > > > with number 741598. > > > > Registered office: PO Box 41, North Harbour, Portsmouth, > > > > Hampshire PO6 3AU > > > > > > > I tried once, and it was dropped because "the platform is not > > > > supported." > > > > > > > > -- > > > > Best Regards, > > > > Sean Chou > > > > > > > > > > Hmm, in that case, perhaps someone from Oracle can help in creating a > > > suitable Java bug id under which this change can be made? > > > > > > >From the OpenJDK census [1], I see that both Mario and I are currently > > > "committers" in the jdk8 project. > > > > > > As jdk8 is under review control, I believe you'll need some affirmation > > > from someone who is a "reviewer". > > > > > > Such a person is currently likely to be from Oracle, and so may be able > > > to help in creating the associated bug id. > > > > > > Hope this helps. > > > > > > Regards, > > > Neil > > > > > > > Oops, forgot to give the trailed link to the OpenJDK census. > > > > Regards, Neil > > > > [1] http://openjdk.java.net/census > > > > -- > > Unless stated above: > > IBM email: neil_richards at uk.ibm.com > > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU > > > > This seems to have dragged on an unduly long time for such a simple patch. > > The patch looks good to me. The only minor point I'd make is that the > comment '// determine another OS here' should probably be under where the > AIX if block is added, not above it. > > According to the census, I have jdk8 reviewer status so this should count > as a review. However, as we're still stuck with the antiquated bug system > at present, we still need someone at Oracle to give it a bug ID. > > So if an Oracle employee would be so kind as to do so, this can > finally be pushed. It's only about two months old... > -- > Andrew :) > > Free Java Software Engineer > Red Hat, Inc. (http://www.redhat.com) > > PGP Key: 248BDC07 (https://keys.indymedia.org/) > Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 > -- Best Regards, Sean Chou From david.holmes at oracle.com Wed Dec 14 08:02:21 2011 From: david.holmes at oracle.com (David Holmes) Date: Wed, 14 Dec 2011 18:02:21 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> Message-ID: <4EE8580D.1060606@oracle.com> On 14/12/2011 5:05 PM, Sean Chou wrote: > Hi Mike, David, > > I reported this as a bug: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7121314 . Thanks - I've turned the initial incident report into a "real" bug report. David > On Wed, Dec 14, 2011 at 1:03 PM, Mike Duigou > wrote: > > I agree that most people probably won't check whether the array > returned is the array they provided. It is possible that they > incorrectly assume it is. ie. > > Collection collection; > ... > Integer[] foo = new Integer[collection.size()]; // of sufficient > size for all elements > // at this point collection grows. > collection.toArray(foo); // this will work, right? > for(Integer each : foo) { > // wait! foo is empty, why? > } > > If collection is mutated and increased in size between the creation > of foo and the toArray operation then foo will be empty and the user > probably won't know why the elements weren't copied. Actually, the > elements were copied but the result of toArray containing those > elements was ignored. > > This usage seems like just a bad idiom though and is avoidable. > > More worrying is the toArray() case where the resultant array is > currently documented to hold only result elements and no extra > nulls. If the collection shrinks then it is currently possible that > the resulting array could very unexpectedly hold nulls. > > Mike > > On Dec 13 2011, at 05:30 , Sean Chou wrote: > > > Sorry for the confuse. By "ok", I mean "compare the size of array > which is > > going to be > > returned and the size of the specified array, and copy the elements > > into the specified > > array if it is larger and return the specified array." > > > > Nothing is causing problem for now, I just found a mismatch. I > think most > > guys will > > just use the returned array without checking if it's the > specified one; and > > this is also > > why I think it may be possible to modify the behavior without causing > > problems. > > > > And I think modifying ConcurrentHashMap is as dangerous as modifying > > AbstractCollection > > if people are relying on implementation, is this right? So it > seems we can > > do nothing > > to the mismatch now... > > > > > > On Tue, Dec 13, 2011 at 8:06 PM, David Holmes > >wrote: > > > >> On 13/12/2011 9:18 PM, Sean Chou wrote: > >> > >>> Hi , > >>> > >>> Is it possible to change the spec ? I found it is defined in > >>> java.utils.Collection interface. It would be easy for > >>> AbstractCollection to state that it is not designed for concurrent > >>> operations, and its subclass should take care of them. > >>> > >> > >> Such a disclaimer might be added to the spec for > AbstractCollection but > >> that doesn't really change anything - it just makes observed > behaviour less > >> surprising. > >> > >> > >> However, I think the simplest way may be modifying toArray(T[]) > >>> method for an additional check, which would work for most > subclasses of > >>> AbstractCollection... > >>> Is that ok ? > >>> > >> > >> "ok" in what sense? Do you want to change the spec or just > change the > >> current behaviour? If you do the latter and people rely on that > >> implementation rather than the spec then code will not be > portable across > >> different implementations of the platform. > >> > >> I would not want to see a change in behaviour without a change in > >> specification and I do not think the specification for > AbstractCollection > >> can, or should be, changed. Just my opinion of course. > >> > >> What is the concrete concurrent collection that you have a > problem with? > >> If it is ConcurrentHashMap, as per the example, then perhaps > >> ConcurrentHashMap should be where a change is considered. > >> > >> David > >> ----- > >> > >> > >>> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes > > >>> **com > >>> wrote: > >>> > >>> Hi Sean, > >>> > >>> > >>> On 13/12/2011 5:21 PM, Sean Chou wrote: > >>> > >>> When I was reading the code of > AbstractCollection.toArray(T[] ), I > >>> found its behavior maybe different from the spec in > multithread > >>> environment. The spec says "If the collection fits in the > specified > >>> array, it is returned therein. Otherwise, a new array is > allocated > >>> with the runtime type of the specified array and the size > of this > >>> collection." However, in multithread environment, it is > not easy > >>> to > >>> tell if the collection fits in the specified array, > because the > >>> items may be removed when toArray is copying. > >>> > >>> > >>> Right. The problem is that AbstractCollection doesn't address > >>> thread-safety or any other concurrency issues so doesn't > account for > >>> the collection growing or shrinking while the toArray snapshot is > >>> being taken. Really the collection implementations that are > designed > >>> to support multiple threads should override toArray to make > it clear > >>> how it should behave. As it stands, in my opinion, it is more a > >>> "quality of implementation" issue as to whether AbstractCollection > >>> expends effort after creating the array to see if the array is > >>> actually full or not; or whether after creating an array it turns > >>> out it could have fit in the original. > >>> > >>> For a concurrent collection I would write the spec for toArray > >>> something like: > >>> > >>> "The current size of the collection is examined and if the > >>> collection fits in the specified array it will be the target > array, > >>> else a new array is allocated based on that current size and it > >>> becomes the target array. If the collection grows such that the > >>> target array no longer fits then extra elements will not be > copied > >>> into the target array. If the collection shrinks then the target > >>> array will contain null elements." > >>> > >>> Or for the last part "then the target array will be copied to > a new > >>> array that exactly fits the number of elements returned". > >>> > >>> David Holmes > >>> ------------ > >>> > >>> > >>> > >>> Here is a testcase: > >>> > //////////////////////////////**__////////////////////////////** > >>> //__////////////// > >>> > >>> import java.util.Map; > >>> import java.util.concurrent.__**ConcurrentHashMap; > >>> > >>> > >>> public class CollectionToArrayTest { > >>> > >>> static volatile Map map = new > >>> TConcurrentHashMap(); > >>> static volatile boolean gosleep = true; > >>> > >>> static class TConcurrentHashMap extends > >>> ConcurrentHashMap { > >>> public int size() { > >>> int oldresult = super.size(); > >>> System.out.println("map size before concurrent > >>> remove is " > >>> + oldresult); > >>> while (gosleep) { > >>> try { > >>> // Make sure the map is modified during > >>> toArray is > >>> called, > >>> // between getsize and being iterated. > >>> Thread.sleep(1000); > >>> // System.out.println("size called, > size is " > >>> + > >>> oldresult + > >>> // " take a sleep to make sure the > element > >>> is deleted > >>> before size is returned."); > >>> } catch (Exception e) { > >>> } > >>> } > >>> return oldresult; > >>> } > >>> } > >>> > >>> static class ToArrayThread implements Runnable { > >>> public void run() { > >>> for (int i = 0; i< 5; i++) { > >>> String str = Integer.toString(i); > >>> map.put(str, str); > >>> } > >>> String[] buffer = new String[4]; > >>> String[] strings = map.values().toArray(buffer); > >>> // System.out.println("length is " + > strings.length); > >>> if (strings.length<= buffer.length) { > >>> System.out.println("given array size is " > >>> + buffer.length > >>> + " \nreturned array > size is " > >>> + strings.length > >>> + ", \nbuffer should be used > >>> according to > >>> spec. Is buffer used : " > >>> + (strings == buffer)); > >>> } > >>> } > >>> } > >>> > >>> static class RemoveThread implements Runnable { > >>> public void run() { > >>> String str = Integer.toString(0); > >>> map.remove(str); > >>> gosleep = false; > >>> } > >>> } > >>> > >>> public static void main(String args[]) { > >>> CollectionToArrayTest app = new > CollectionToArrayTest(); > >>> app.test_concurrentRemove(); > >>> } > >>> > >>> public void test_concurrentRemove() { > >>> > >>> > System.out.println("//////////**__////////////////////////////** > >>> //__//////\n" > >>> > >>> + > >>> "The spec says if the given array is large\n " + > >>> "enough to hold all elements, the given array\n" + > >>> "should be returned by toArray. This \n" + > >>> "testcase checks this case. \n" + > >>> "/////////////////////////////**__/////////////////"); > >>> > >>> > >>> Thread[] threads = new Thread[2]; > >>> threads[0] = new Thread(new ToArrayThread()); > >>> threads[1] = new Thread(new RemoveThread()); > >>> > >>> threads[0].start(); > >>> > >>> try { > >>> // Take a sleep to make sure toArray is already > >>> called. > >>> Thread.sleep(1200); > >>> } catch (Exception e) { > >>> } > >>> > >>> threads[1].start(); > >>> } > >>> } > >>> > >>> > //////////////////////////////**__////////////////////////////** > >>> //__////////////// > >>> > >>> > >>> TConcurrentHashMap is used to make sure the collection is > modified > >>> during toArray is invoked. So the returned array fits in the > >>> specified > >>> array, but a new array is used because toArray checks the > size > >>> before copying. > >>> > >>> Is this a bug ? > >>> > >>> > >>> > >>> > >>> > >>> -- > >>> Best Regards, > >>> Sean Chou > >>> > >>> > > > > > > -- > > Best Regards, > > Sean Chou > > > > > -- > Best Regards, > Sean Chou > From zhouyx at linux.vnet.ibm.com Wed Dec 14 12:27:17 2011 From: zhouyx at linux.vnet.ibm.com (Sean Chou) Date: Wed, 14 Dec 2011 20:27:17 +0800 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: <4EE8580D.1060606@oracle.com> References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> <4EE8580D.1060606@oracle.com> Message-ID: Thank you as well~ I'll work on it. On Wed, Dec 14, 2011 at 4:02 PM, David Holmes wrote: > On 14/12/2011 5:05 PM, Sean Chou wrote: > >> Hi Mike, David, >> >> I reported this as a bug: >> http://bugs.sun.com/**bugdatabase/view_bug.do?bug_**id=7121314 . >> > > Thanks - I've turned the initial incident report into a "real" bug report. > > David > > On Wed, Dec 14, 2011 at 1:03 PM, Mike Duigou > > wrote: >> >> I agree that most people probably won't check whether the array >> returned is the array they provided. It is possible that they >> incorrectly assume it is. ie. >> >> Collection collection; >> ... >> Integer[] foo = new Integer[collection.size()]; // of sufficient >> size for all elements >> // at this point collection grows. >> collection.toArray(foo); // this will work, right? >> for(Integer each : foo) { >> // wait! foo is empty, why? >> } >> >> If collection is mutated and increased in size between the creation >> of foo and the toArray operation then foo will be empty and the user >> probably won't know why the elements weren't copied. Actually, the >> elements were copied but the result of toArray containing those >> elements was ignored. >> >> This usage seems like just a bad idiom though and is avoidable. >> >> More worrying is the toArray() case where the resultant array is >> currently documented to hold only result elements and no extra >> nulls. If the collection shrinks then it is currently possible that >> the resulting array could very unexpectedly hold nulls. >> >> Mike >> >> On Dec 13 2011, at 05:30 , Sean Chou wrote: >> >> > Sorry for the confuse. By "ok", I mean "compare the size of array >> which is >> > going to be >> > returned and the size of the specified array, and copy the elements >> > into the specified >> > array if it is larger and return the specified array." >> > >> > Nothing is causing problem for now, I just found a mismatch. I >> think most >> > guys will >> > just use the returned array without checking if it's the >> specified one; and >> > this is also >> > why I think it may be possible to modify the behavior without >> causing >> > problems. >> > >> > And I think modifying ConcurrentHashMap is as dangerous as modifying >> > AbstractCollection >> > if people are relying on implementation, is this right? So it >> seems we can >> > do nothing >> > to the mismatch now... >> > >> > >> > On Tue, Dec 13, 2011 at 8:06 PM, David Holmes >> >> >>wrote: >> >> > >> >> On 13/12/2011 9:18 PM, Sean Chou wrote: >> >> >> >>> Hi , >> >>> >> >>> Is it possible to change the spec ? I found it is defined in >> >>> java.utils.Collection interface. It would be easy for >> >>> AbstractCollection to state that it is not designed for concurrent >> >>> operations, and its subclass should take care of them. >> >>> >> >> >> >> Such a disclaimer might be added to the spec for >> AbstractCollection but >> >> that doesn't really change anything - it just makes observed >> behaviour less >> >> surprising. >> >> >> >> >> >> However, I think the simplest way may be modifying toArray(T[]) >> >>> method for an additional check, which would work for most >> subclasses of >> >>> AbstractCollection... >> >>> Is that ok ? >> >>> >> >> >> >> "ok" in what sense? Do you want to change the spec or just >> change the >> >> current behaviour? If you do the latter and people rely on that >> >> implementation rather than the spec then code will not be >> portable across >> >> different implementations of the platform. >> >> >> >> I would not want to see a change in behaviour without a change in >> >> specification and I do not think the specification for >> AbstractCollection >> >> can, or should be, changed. Just my opinion of course. >> >> >> >> What is the concrete concurrent collection that you have a >> problem with? >> >> If it is ConcurrentHashMap, as per the example, then perhaps >> >> ConcurrentHashMap should be where a change is considered. >> >> >> >> David >> >> ----- >> >> >> >> >> >>> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes >> >> > >> >>> ****com >> >> >>>> >> wrote: >> >>> >> >>> Hi Sean, >> >>> >> >>> >> >>> On 13/12/2011 5:21 PM, Sean Chou wrote: >> >>> >> >>> When I was reading the code of >> AbstractCollection.toArray(T[] ), I >> >>> found its behavior maybe different from the spec in >> multithread >> >>> environment. The spec says "If the collection fits in the >> specified >> >>> array, it is returned therein. Otherwise, a new array is >> allocated >> >>> with the runtime type of the specified array and the size >> of this >> >>> collection." However, in multithread environment, it is >> not easy >> >>> to >> >>> tell if the collection fits in the specified array, >> because the >> >>> items may be removed when toArray is copying. >> >>> >> >>> >> >>> Right. The problem is that AbstractCollection doesn't address >> >>> thread-safety or any other concurrency issues so doesn't >> account for >> >>> the collection growing or shrinking while the toArray snapshot >> is >> >>> being taken. Really the collection implementations that are >> designed >> >>> to support multiple threads should override toArray to make >> it clear >> >>> how it should behave. As it stands, in my opinion, it is more a >> >>> "quality of implementation" issue as to whether AbstractCollection >> >>> expends effort after creating the array to see if the array is >> >>> actually full or not; or whether after creating an array it >> turns >> >>> out it could have fit in the original. >> >>> >> >>> For a concurrent collection I would write the spec for toArray >> >>> something like: >> >>> >> >>> "The current size of the collection is examined and if the >> >>> collection fits in the specified array it will be the target >> array, >> >>> else a new array is allocated based on that current size and it >> >>> becomes the target array. If the collection grows such that the >> >>> target array no longer fits then extra elements will not be >> copied >> >>> into the target array. If the collection shrinks then the target >> >>> array will contain null elements." >> >>> >> >>> Or for the last part "then the target array will be copied to >> a new >> >>> array that exactly fits the number of elements returned". >> >>> >> >>> David Holmes >> >>> ------------ >> >>> >> >>> >> >>> >> >>> Here is a testcase: >> >>> >> //////////////////////////////****__//////////////////////////**//** >> >>> //__////////////// >> >>> >> >>> import java.util.Map; >> >>> import java.util.concurrent.__****ConcurrentHashMap; >> >>> >> >>> >> >>> public class CollectionToArrayTest { >> >>> >> >>> static volatile Map map = new >> >>> TConcurrentHashMap(); >> >>> static volatile boolean gosleep = true; >> >>> >> >>> static class TConcurrentHashMap extends >> >>> ConcurrentHashMap { >> >>> public int size() { >> >>> int oldresult = super.size(); >> >>> System.out.println("map size before concurrent >> >>> remove is " >> >>> + oldresult); >> >>> while (gosleep) { >> >>> try { >> >>> // Make sure the map is modified during >> >>> toArray is >> >>> called, >> >>> // between getsize and being iterated. >> >>> Thread.sleep(1000); >> >>> // System.out.println("size called, >> size is " >> >>> + >> >>> oldresult + >> >>> // " take a sleep to make sure the >> element >> >>> is deleted >> >>> before size is returned."); >> >>> } catch (Exception e) { >> >>> } >> >>> } >> >>> return oldresult; >> >>> } >> >>> } >> >>> >> >>> static class ToArrayThread implements Runnable { >> >>> public void run() { >> >>> for (int i = 0; i< 5; i++) { >> >>> String str = Integer.toString(i); >> >>> map.put(str, str); >> >>> } >> >>> String[] buffer = new String[4]; >> >>> String[] strings = >> map.values().toArray(buffer); >> >>> // System.out.println("length is " + >> strings.length); >> >>> if (strings.length<= buffer.length) { >> >>> System.out.println("given array size is " >> >>> + buffer.length >> >>> + " \nreturned array >> size is " >> >>> + strings.length >> >>> + ", \nbuffer should be >> used >> >>> according to >> >>> spec. Is buffer used : " >> >>> + (strings == buffer)); >> >>> } >> >>> } >> >>> } >> >>> >> >>> static class RemoveThread implements Runnable { >> >>> public void run() { >> >>> String str = Integer.toString(0); >> >>> map.remove(str); >> >>> gosleep = false; >> >>> } >> >>> } >> >>> >> >>> public static void main(String args[]) { >> >>> CollectionToArrayTest app = new >> CollectionToArrayTest(); >> >>> app.test_concurrentRemove(); >> >>> } >> >>> >> >>> public void test_concurrentRemove() { >> >>> >> >>> >> System.out.println("//////////****__//////////////////////////**//** >> >>> //__//////\n" >> >>> >> >>> + >> >>> "The spec says if the given array is large\n " + >> >>> "enough to hold all elements, the given array\n" + >> >>> "should be returned by toArray. This \n" + >> >>> "testcase checks this case. \n" + >> >>> "/////////////////////////////****__/////////////////"); >> >>> >> >>> >> >>> Thread[] threads = new Thread[2]; >> >>> threads[0] = new Thread(new ToArrayThread()); >> >>> threads[1] = new Thread(new RemoveThread()); >> >>> >> >>> threads[0].start(); >> >>> >> >>> try { >> >>> // Take a sleep to make sure toArray is already >> >>> called. >> >>> Thread.sleep(1200); >> >>> } catch (Exception e) { >> >>> } >> >>> >> >>> threads[1].start(); >> >>> } >> >>> } >> >>> >> >>> >> //////////////////////////////****__//////////////////////////**//** >> >>> //__////////////// >> >>> >> >>> >> >>> TConcurrentHashMap is used to make sure the collection is >> modified >> >>> during toArray is invoked. So the returned array fits in the >> >>> specified >> >>> array, but a new array is used because toArray checks the >> size >> >>> before copying. >> >>> >> >>> Is this a bug ? >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> -- >> >>> Best Regards, >> >>> Sean Chou >> >>> >> >>> >> > >> > >> > -- >> > Best Regards, >> > Sean Chou >> >> >> >> >> -- >> Best Regards, >> Sean Chou >> >> -- Best Regards, Sean Chou From paul.ciprich at gmail.com Wed Dec 14 21:45:48 2011 From: paul.ciprich at gmail.com (Paul Ciprich) Date: Wed, 14 Dec 2011 16:45:48 -0500 Subject: 100218: BigInteger staticRandom field Message-ID: All, I've created a bug report to address a scalability problem with BigInteger's staticRandom field. The problem is that the shared staticRandom field causes bottlenecks with parallel code. The proposed solution is to change the staticRandom field to a ThreadLocal and eliminate the bottleneck by giving each thread its own copy of the SecureRandom object. Bug 100218 contains a patch with the proposed change if it is deemed acceptable. Thanks, -Paul Ciprich From jonathan.gibbons at oracle.com Thu Dec 15 00:16:30 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Thu, 15 Dec 2011 00:16:30 +0000 Subject: hg: jdk8/tl/langtools: 7111022: javac no long prints last round of processing; ... Message-ID: <20111215001632.91A46476C7@hg.openjdk.java.net> Changeset: 4261dc8af622 Author: jjg Date: 2011-12-14 16:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/4261dc8af622 7111022: javac no long prints last round of processing 7121323: Sqe tests using -Xstdout option fail with an invalid flag error message Reviewed-by: darcy ! src/share/classes/com/sun/tools/javac/main/Option.java ! src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java ! src/share/classes/com/sun/tools/javac/util/Log.java ! test/tools/javac/4846262/Test.sh + test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java ! test/tools/javac/util/T6597678.java From jonathan.gibbons at oracle.com Thu Dec 15 01:52:56 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Thu, 15 Dec 2011 01:52:56 +0000 Subject: hg: jdk8/tl/langtools: 7121681: compiler message file broken for javac -fullversion Message-ID: <20111215015258.B181E476C8@hg.openjdk.java.net> Changeset: 281eeedf9755 Author: jjg Date: 2011-12-14 17:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/281eeedf9755 7121681: compiler message file broken for javac -fullversion Reviewed-by: jjh ! src/share/classes/com/sun/tools/javac/main/Option.java From david.holmes at oracle.com Thu Dec 15 05:41:00 2011 From: david.holmes at oracle.com (David Holmes) Date: Thu, 15 Dec 2011 15:41:00 +1000 Subject: A behavior mismatch in AbstractCollection.toArray(T[] ) In-Reply-To: References: <4EE701A1.2000506@oracle.com> <4EE73FB4.7030505@oracle.com> <4E4EC3F6-7E10-4DA0-AE6A-610E2396210A@oracle.com> <4EE8580D.1060606@oracle.com> Message-ID: <4EE9886C.6040902@oracle.com> On 14/12/2011 10:27 PM, Sean Chou wrote: > > Thank you as well~ I'll work on it. I'm not sure it is worth fixing by changing the code. A change to the implementation note might be simpler and better. Although it is easy to detect when this behavioural mismatch occurs, I can not conceive a meaningful situation where this would make a difference. The code would have to assume the passed in array is large enough and somehow know that even if the collection grows during the call that it will shrink again - that seems unknowable to me. David ----- > > On Wed, Dec 14, 2011 at 4:02 PM, David Holmes > wrote: > > On 14/12/2011 5:05 PM, Sean Chou wrote: > > Hi Mike, David, > > I reported this as a bug: > http://bugs.sun.com/__bugdatabase/view_bug.do?bug___id=7121314 > . > > > Thanks - I've turned the initial incident report into a "real" bug > report. > > David > > On Wed, Dec 14, 2011 at 1:03 PM, Mike Duigou > > __>> wrote: > > I agree that most people probably won't check whether the array > returned is the array they provided. It is possible that they > incorrectly assume it is. ie. > > Collection collection; > ... > Integer[] foo = new Integer[collection.size()]; // of sufficient > size for all elements > // at this point collection grows. > collection.toArray(foo); // this will work, right? > for(Integer each : foo) { > // wait! foo is empty, why? > } > > If collection is mutated and increased in size between the > creation > of foo and the toArray operation then foo will be empty and > the user > probably won't know why the elements weren't copied. > Actually, the > elements were copied but the result of toArray containing those > elements was ignored. > > This usage seems like just a bad idiom though and is avoidable. > > More worrying is the toArray() case where the resultant array is > currently documented to hold only result elements and no extra > nulls. If the collection shrinks then it is currently > possible that > the resulting array could very unexpectedly hold nulls. > > Mike > > On Dec 13 2011, at 05:30 , Sean Chou wrote: > > > Sorry for the confuse. By "ok", I mean "compare the size of array > which is > > going to be > > returned and the size of the specified array, and copy the > elements > > into the specified > > array if it is larger and return the specified array." > > > > Nothing is causing problem for now, I just found a mismatch. I > think most > > guys will > > just use the returned array without checking if it's the > specified one; and > > this is also > > why I think it may be possible to modify the behavior without > causing > > problems. > > > > And I think modifying ConcurrentHashMap is as dangerous as > modifying > > AbstractCollection > > if people are relying on implementation, is this right? So it > seems we can > > do nothing > > to the mismatch now... > > > > > > On Tue, Dec 13, 2011 at 8:06 PM, David Holmes > > >>wrote: > > > > >> On 13/12/2011 9:18 PM, Sean Chou wrote: > >> > >>> Hi , > >>> > >>> Is it possible to change the spec ? I found it is defined in > >>> java.utils.Collection interface. It would be easy for > >>> AbstractCollection to state that it is not designed for > concurrent > >>> operations, and its subclass should take care of them. > >>> > >> > >> Such a disclaimer might be added to the spec for > AbstractCollection but > >> that doesn't really change anything - it just makes observed > behaviour less > >> surprising. > >> > >> > >> However, I think the simplest way may be modifying > toArray(T[]) > >>> method for an additional check, which would work for most > subclasses of > >>> AbstractCollection... > >>> Is that ok ? > >>> > >> > >> "ok" in what sense? Do you want to change the spec or just > change the > >> current behaviour? If you do the latter and people rely on that > >> implementation rather than the spec then code will not be > portable across > >> different implementations of the platform. > >> > >> I would not want to see a change in behaviour without a > change in > >> specification and I do not think the specification for > AbstractCollection > >> can, or should be, changed. Just my opinion of course. > >> > >> What is the concrete concurrent collection that you have a > problem with? > >> If it is ConcurrentHashMap, as per the example, then perhaps > >> ConcurrentHashMap should be where a change is considered. > >> > >> David > >> ----- > >> > >> > >>> On Tue, Dec 13, 2011 at 3:41 PM, David Holmes > > > > >>> . > .>*__*com > > > >>>> wrote: > >>> > >>> Hi Sean, > >>> > >>> > >>> On 13/12/2011 5:21 PM, Sean Chou wrote: > >>> > >>> When I was reading the code of > AbstractCollection.toArray(T[] ), I > >>> found its behavior maybe different from the spec in > multithread > >>> environment. The spec says "If the collection fits in the > specified > >>> array, it is returned therein. Otherwise, a new array is > allocated > >>> with the runtime type of the specified array and the size > of this > >>> collection." However, in multithread environment, it is > not easy > >>> to > >>> tell if the collection fits in the specified array, > because the > >>> items may be removed when toArray is copying. > >>> > >>> > >>> Right. The problem is that AbstractCollection doesn't address > >>> thread-safety or any other concurrency issues so doesn't > account for > >>> the collection growing or shrinking while the toArray > snapshot is > >>> being taken. Really the collection implementations that are > designed > >>> to support multiple threads should override toArray to make > it clear > >>> how it should behave. As it stands, in my opinion, it is > more a > >>> "quality of implementation" issue as to whether > AbstractCollection > >>> expends effort after creating the array to see if the > array is > >>> actually full or not; or whether after creating an array > it turns > >>> out it could have fit in the original. > >>> > >>> For a concurrent collection I would write the spec for > toArray > >>> something like: > >>> > >>> "The current size of the collection is examined and if the > >>> collection fits in the specified array it will be the target > array, > >>> else a new array is allocated based on that current size > and it > >>> becomes the target array. If the collection grows such > that the > >>> target array no longer fits then extra elements will not be > copied > >>> into the target array. If the collection shrinks then the > target > >>> array will contain null elements." > >>> > >>> Or for the last part "then the target array will be copied to > a new > >>> array that exactly fits the number of elements returned". > >>> > >>> David Holmes > >>> ------------ > >>> > >>> > >>> > >>> Here is a testcase: > >>> > > //////////////////////////////__**__//////////////////////////__//** > >>> //__////////////// > >>> > >>> import java.util.Map; > >>> import java.util.concurrent.__**__ConcurrentHashMap; > >>> > >>> > >>> public class CollectionToArrayTest { > >>> > >>> static volatile Map map = new > >>> TConcurrentHashMap(); > >>> static volatile boolean gosleep = true; > >>> > >>> static class TConcurrentHashMap extends > >>> ConcurrentHashMap { > >>> public int size() { > >>> int oldresult = super.size(); > >>> System.out.println("map size before > concurrent > >>> remove is " > >>> + oldresult); > >>> while (gosleep) { > >>> try { > >>> // Make sure the map is modified > during > >>> toArray is > >>> called, > >>> // between getsize and being > iterated. > >>> Thread.sleep(1000); > >>> // System.out.println("size called, > size is " > >>> + > >>> oldresult + > >>> // " take a sleep to make sure the > element > >>> is deleted > >>> before size is returned."); > >>> } catch (Exception e) { > >>> } > >>> } > >>> return oldresult; > >>> } > >>> } > >>> > >>> static class ToArrayThread implements Runnable { > >>> public void run() { > >>> for (int i = 0; i< 5; i++) { > >>> String str = Integer.toString(i); > >>> map.put(str, str); > >>> } > >>> String[] buffer = new String[4]; > >>> String[] strings = > map.values().toArray(buffer); > >>> // System.out.println("length is " + > strings.length); > >>> if (strings.length<= buffer.length) { > >>> System.out.println("given array size > is " > >>> + buffer.length > >>> + " \nreturned array > size is " > >>> + strings.length > >>> + ", \nbuffer should > be used > >>> according to > >>> spec. Is buffer used : " > >>> + (strings == buffer)); > >>> } > >>> } > >>> } > >>> > >>> static class RemoveThread implements Runnable { > >>> public void run() { > >>> String str = Integer.toString(0); > >>> map.remove(str); > >>> gosleep = false; > >>> } > >>> } > >>> > >>> public static void main(String args[]) { > >>> CollectionToArrayTest app = new > CollectionToArrayTest(); > >>> app.test_concurrentRemove(); > >>> } > >>> > >>> public void test_concurrentRemove() { > >>> > >>> > > System.out.println("//////////__**__//////////////////////////__//** > >>> //__//////\n" > >>> > >>> + > >>> "The spec says if the given array is large\n " + > >>> "enough to hold all elements, the given array\n" + > >>> "should be returned by toArray. This \n" + > >>> "testcase checks this case. \n" + > >>> "/////////////////////////////__**__/////////////////"); > >>> > >>> > >>> Thread[] threads = new Thread[2]; > >>> threads[0] = new Thread(new ToArrayThread()); > >>> threads[1] = new Thread(new RemoveThread()); > >>> > >>> threads[0].start(); > >>> > >>> try { > >>> // Take a sleep to make sure toArray is > already > >>> called. > >>> Thread.sleep(1200); > >>> } catch (Exception e) { > >>> } > >>> > >>> threads[1].start(); > >>> } > >>> } > >>> > >>> > > //////////////////////////////__**__//////////////////////////__//** > >>> //__////////////// > >>> > >>> > >>> TConcurrentHashMap is used to make sure the collection is > modified > >>> during toArray is invoked. So the returned array fits > in the > >>> specified > >>> array, but a new array is used because toArray checks the > size > >>> before copying. > >>> > >>> Is this a bug ? > >>> > >>> > >>> > >>> > >>> > >>> -- > >>> Best Regards, > >>> Sean Chou > >>> > >>> > > > > > > -- > > Best Regards, > > Sean Chou > > > > > -- > Best Regards, > Sean Chou > > > > > -- > Best Regards, > Sean Chou > From jonathan.gibbons at oracle.com Thu Dec 15 05:54:05 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Thu, 15 Dec 2011 05:54:05 +0000 Subject: hg: jdk8/tl/langtools: 7121682: remove obsolete import Message-ID: <20111215055408.47894476CA@hg.openjdk.java.net> Changeset: 42ffceeceeca Author: jjg Date: 2011-12-14 21:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/42ffceeceeca 7121682: remove obsolete import Reviewed-by: jjh ! test/tools/javac/api/T6838467.java From Alan.Bateman at oracle.com Thu Dec 15 14:00:46 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 15 Dec 2011 14:00:46 +0000 Subject: 100218: BigInteger staticRandom field In-Reply-To: References: Message-ID: <4EE9FD8E.3030203@oracle.com> On 14/12/2011 21:45, Paul Ciprich wrote: > All, > > I've created a bug report to address a scalability problem with > BigInteger's staticRandom field. The problem is that the shared > staticRandom field causes bottlenecks with parallel code. The proposed > solution is to change the staticRandom field to a ThreadLocal and eliminate > the bottleneck by giving each thread its own copy of the SecureRandom > object. Bug 100218 contains a patch with the proposed change if it is > deemed acceptable. > > Thanks, > -Paul Ciprich Here's the link to the contribution: https://bugs.openjdk.java.net/show_bug.cgi?id=100218 From sebastian.sickelmann at gmx.de Thu Dec 15 04:19:39 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Thu, 15 Dec 2011 05:19:39 +0100 Subject: Cleanup fallthrough in FilePermission and PropertyPermission was: Request for Review of 7116890 (Warning Cleanup java.io) In-Reply-To: References: <4ED7039A.2080903@gmx.de> <4ED745ED.6080409@oracle.com> <4ED7AB03.6000006@gmx.de> <4ED8059B.8040805@oracle.com> <4ED86DA3.3050205@gmx.de> <4ED8EE66.7020502@oracle.com> <4ED904C2.7060803@gmx.de> <4ED94D4C.8000107@oracle.com> <4EDCB0AA.4040603@oracle.com> <4EDCE716.1000404@gmx.de> Message-ID: <4EE9755B.3070709@gmx.de> Hi, just a short update. I created a first concept-implementations that works and is really slow (roughly 1/3 of the performance of the actual Implementation). I am actually reading through some micro-benchmark suggestions and working at what can i do to make it fast without getting to much implementation-readability-penalty. I think this patch isn't time critical. So i want to use the time and dig a little bit deeper into this on my own. I will discuss my results here, when I am ready with it. Hopefully in the first quarter of 2012. -- Sebastian Am 05.12.2011 23:19, schrieb Eamonn McManus: > To my mind, introducing a new shared parent means defining a new API > that can be used by third-party subclasses. The point is that these > permissions have an action list like "read,write,delete", with parsing > code that converts this into a bitmask and toString() code that > converts it back. I think that code is pretty hairy as it stands, all > the more so because it is duplicated across the existing subclasses. > For MBeanPermission, where there are 17 possible actions, the parsing > method is 370 lines long! So refactoring is definitely desirable. > > An abstract PermissionWithActions class could use enums to good > effect, something like this: > > public abstract class PermissionWithActions> { > public abstract Class actionClass(); > private final EnumSet actions; > protected PermissionWithAction(String target, String actions) { > ...use reflection to get E[] values() and parse the actions... > } > public String getActions() { > ...use toString().toLowerCase() on the actions set... > } > public final Set getActionSet() { > return Collections.unmodifiableSet(actions); > } > public boolean implies(Permission p) { > if (p.getClass() != this.getClass()) { > return false; > } > @SuppressWarnings("unchecked") > PermissionWIthActions pwa = (PermissionWithActions) p; > return this.actions.containsAll(pwa.actions); > } > } > public final class FilePermission extends > PermissionWithActions { > @Override public Class actionClass() { > return FliePermissionActions.class; > } > } > public enum FilePermissionActions {READ, WRITE, EXECUTE, DELETE} > > However I'm not sure we actually want to make such an API change now. > A safer path would be to refactor the parsing and getActions() code > into a sun.* class which is not the parent class of anything, using > delegation rather than inheritance. Safer both because it doesn't > involve figuring out the impact on various JSRs, and because there is > some danger that subclassing might introduce unforeseen attack > vectors. FilePermission etc could each have one instance of this class > that they use for parsing and getActions(), and that instance could > construct e.g. a trie for parsing that is essentially as fast as the > unmaintainable hand-coded parsers that each of the affected Permission > subclasses has today. Parsing does have to be fast because when there > is a security manager every checked operation will construct a > Permission to check against. > > ?amonn > > > On 5 December 2011 07:45, Sebastian Sickelmann > wrote: >> Am 05.12.2011 12:53, schrieb Weijun Wang: >> >>> >>> On 12/03/2011 06:12 AM, Stuart Marks wrote: >>>> I'm adding Weijun (Max) Wang to this thread. >>>> >>>> The same "ackbarfaccept" code had come up a third time when I was >>>> reviewing some of Max's changes. The code in question all has to do with >>>> permissions, and Max is in the security group, so he might have a better >>>> insight whether doing a refactoring is appropriate and how to approach >>>> doing it. >>> >>> Maybe we can group all permissions with a target and a predefined set of actions under a new abstract class. >> >> This sounds like the best idea from the implementors point of view. I would prepare a patch as suggestion for this. >> Regarding to my own question i would say that there isn't any additional jigsaw related problem here by >> introducing a common abstract class. They all rely on java.security.Permission, so java.security seems the correct >> package for the new abstract class. >> >> Any suggestions for the name? PermissionWithActions???? AbstractPermission?? >> >> If i see it right there is the following class hierarchy: >> >> j.s.Permission implements Serializable >> +j.i.FilePermission >> +j.n.SocketPermission >> +jx.m.MBeanPermission >> +jx.s.a.k.ServicePermission >> +j.s.BasicPermission >> +j.u.PropertyPermission >> >> What happens to serialization when the new hierarchy would look like this: >> >> j.s.Permission implements Serializable >> +j.s.AbstractPermission >> +j.i.FilePermission >> +j.n.SocketPermission >> +jx.m.MBeanPermission >> +jx.s.a.k.ServicePermission >> +j.s.BasicPermission >> +j.u.PropertyPermission >> >> All the classes have a serialVerionUID so i think serialisation is no problem, or is there >> a problem i i don't see here? >> >> -- Sebastian >> >>> -Max >>> >>>> Some searching around reveals that "ackbarfaccept" appears in the >>>> PlayerPermission class of the Java ME Mobile Media API (not in any of >>>> the OpenJDK repositories) so it looks like the code has been copied even >>>> more times than are visible here. Perhaps a public permissions parsing >>>> utility method is called for. >>>> >>>> s'marks >>>> >>>> On 12/2/11 9:02 AM, Sebastian Sickelmann wrote: >>>>> Am 02.12.2011 16:27, schrieb Brandon Passanisi: >>>>>> Hi Sebastian. I'm not sure if you had seen the e-mail from Stuart Marks >>>>>> regarding this, but Stuart was able to find more instances of the >>>>>> similar >>>>>> block of "fallthrough" code. I can volunteer to apply your upcoming >>>>>> change >>>>>> to FilePermission to the other files if you wish. Or, you can try >>>>>> applying >>>>>> the change to the other files, but if you don't have time I don't >>>>>> mind doing >>>>>> it. Here's the section of Stuart's e-mail on this topic: >>>>>> >>>>>> ------------------------------------------------------------------------------------- >>>>>> >>>>>> (Incidentally, this is the third time I've reviewed code today that >>>>>> looks exactly like this. The other cases are in java.io.FilePermission >>>>>> and java.util.PropertyPermission. They each have the /*FALLTHROUGH*/ >>>>>> into a set of cases that do nothing but break; and they have similar >>>>>> ("ackbarfaccept") comments. It would be nice if these chunks of code >>>>>> could be unified, but they differ in a number of fiddly details.) >>>>>> >>>>>> (The string "ackbarfaccept" occurs in the following files: >>>>>> 1. java/io/FilePermission.java >>>>>> 2. java/net/SocketPermission.java >>>>>> 3. java/util/PropertyPermission.java >>>>>> 4. javax/management/MBeanPermission.java >>>>>> 5. javax/security/auth/kerberos/ServicePermission.java >>>>>> Hmmm.) >>>>>> ------------------------------------------------------------------------------------- >>>>>> >>>>>> >>>>>> Thanks. >>>>> >>>>> Hi Brandon, >>>>> Hi Stuart, >>>>> >>>>> i had a look at all those classes and it seems to be the same >>>>> algorithm. In an >>>>> normal project (not the jdk) i would suggest to completely refactor it >>>>> and make >>>>> some code de-duplication cleanup. But if i thinks on projects like >>>>> jigsaw this >>>>> can easily get a real problem. What do you think, should we try to >>>>> cleanup them >>>>> all. Or should we try to make some de-duplication/code-reuse refactoring. >>>>> >>>>> >>>>> -- Sebastian >>>>>> >>>>>> On 12/1/2011 10:18 PM, Sebastian Sickelmann wrote: >>>>>>> Hi Brandon, >>>>>>> >>>>>>> i will try to work out a fix for both and cc the review request to you. >>>>>>> >>>>>>> -- Sebastian >>>>>>> >>>>>>> Am 01.12.2011 23:54, schrieb Brandon Passanisi: >>>>>>>> Hi Sebastian. I was speaking with Stuart Marks earlier today and he >>>>>>>> mentioned that the "fallthrough" code in FilePermission.java also >>>>>>>> exists in >>>>>>>> java.util.PropertyPermission.java. Maybe the code author had done some >>>>>>>> copy/paste when working on these files. Stuart had said that you >>>>>>>> might be >>>>>>>> planning on doing some work on this after the warnings cleanup work. >>>>>>>> If/when you do this work, maybe you can let me know so that I can >>>>>>>> sync the >>>>>>>> same changes you apply to FilePermission.java to >>>>>>>> PropertyPermission.java? >>>>>>>> Or, maybe you can apply the same changes yourself to >>>>>>>> PropertyPermission.java? >> From sebastian.sickelmann at gmx.de Thu Dec 15 16:46:55 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Thu, 15 Dec 2011 17:46:55 +0100 Subject: Consistent Behavior of exception-chaining Message-ID: <4EEA247F.9010500@gmx.de> Hello, while refactoring some exceptions (support for the 4 common ctors) i come along some inconsistency in handling cause-chaining via initCause method. I hope we can unify to a compatible solution that there is only one initCause-behavior for every Exception in JDK. Here are the types i discovered: Type 1: Disallow calls to initCause after creation. Type 2: Disallow calls to initCause after creation using a ctor which has a cause parameter. through Type 2 is the type used by Exceptions that had no cause-chaining (before it was introduced through Throwable). ex. java.lang.RuntimeException Type 1 is the type used by Exceptions that had a cause-chaining (before it was introduced through Throwable). ex. java.lang.ClassNotFoundException Because there a two ways of looking at this feature i tried to realize which behavior i would expect. Lets call it Type 3. Type 3: Disallow calls to initCause after creation if there is a ctor present which i had the change to specify a given cause. Which effectively is Type 1 if we introduce the 4 common-ctors to every Exception. Type 3 has some problems. 1st: There maybe some cases in JDK codebase where the cause-plumbing is delayed so that it is a problem that initCause cannot be called later. I think this cases can be refactored to work with Type 3(1). 2nd: There are code-bases outside the jdk that uses the initCause-method. These would be binary compatible with Type 3(1) but are behavior-incompatible with it. I think the second reason weight more than the first. And i think this is the deatchblow for Type 3. So i think it concludes to the question: "Should we migrate the Type 1 Exceptions to Type 2?" I think Type 1 Exceptions are only used by Exceptions that has a cause-chaining (before it was introduced through Throwable). There are some exception in javax/xml/crypto that had exception-chaining before it was introduced through Throwable. I had some discussion[1] with Sean Mullan about introducing exception-chaining to javax/xml/crypto in the way Throwable introduced it. We get to an solution[2] that implements Type 2. Are there good reasons to not change Type 1 Exceptions to Type 2? Kind regards Sebastian [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-August/007399.html [2] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_8/index.html From xueming.shen at oracle.com Thu Dec 15 18:44:15 2011 From: xueming.shen at oracle.com (Xueming Shen) Date: Thu, 15 Dec 2011 10:44:15 -0800 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EE6D184.9000807@oracle.com> References: <4EE2F6AD.7050701@oracle.com> <4EE6547B.406@oracle.com> <4EE6D184.9000807@oracle.com> Message-ID: <4EEA3FFF.8030403@oracle.com> I would suggest to combine removeQEQuotingTest1 and 2 into one method, they kinda look redundant. Otherwise the change looks fine for me. -Sherman On 12/12/2011 08:16 PM, Stephen Flores wrote: > Thanks Sherman, > > I have added the regression test for the case below and added a > "continue" statement after line 1622 to get the case to pass. > > I have updated the webrev. > > Steve. > > On 12/12/2011 02:22 PM, Xueming Shen wrote: >> Hi Steve, >> >> The \x3[0-9] approach is interesting, it appears to solve the problem >> without >> paying a higher cost I originally thought (looking back, for example). >> >> The logic of initializing/setting/unsetting of "beginQuote" to >> true/false appears to >> be incorrect when there are multiple \Qn...\E in one pattern. Ln#1622 >> setting will >> always be followed by Ln#1630, if I read the code correctly. >> >> For example >> >> Pattern pattern = >> Pattern.compile("\\011\\Q1sometext\\E\\011\\Q2sometext\\E"); >> Matcher matcher = pattern.matcher("\t1sometext\t2sometext"); >> System.out.printf("find=%b%n", matcher.find()); >> >> will still return false? >> >> -Sherman >> >> On 12/09/2011 10:05 PM, Stephen Flores wrote: >>> Please review the following webrev (includes new test to demonstrate >>> the bug): >>> >>> http://cr.openjdk.java.net/~sflores/6990617/ >>> >>> for bug: 6990617 Regular expression doesn't match if unicode character >>> next to a digit. >>> >>> A DESCRIPTION OF THE PROBLEM : >>> >>> Unicode characters are represented as \\+number. >>> For instance, one could write: >>> Pattern p = Pattern.compile("\\011some text\\012"); >>> Matcher m = p.matcher("\tsome text\n"); >>> System.out.println(m.find()); // yields "true" >>> >>> However, if we want to match a string with a digit next to >>> the unicode character, it doesn't match (whether we "quote" >>> the regular expression or not). Note the "1" next to the tab >>> character (unicode 011). >>> Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); >>> Matcher m = p.matcher("\t1some text\n"); >>> System.out.println(m.find()); // yields "false" >>> >>> This happens because Pattern accepts either \\0011 or \\011 for >>> the same character. From the javadoc: >>> >>> \0nn The character with octal value 0nn (0 <= n <= 7) >>> \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) >>> >>> Evaluation: >>> >>> Pattern.RemoveQEQuoting() does NOT handle this situation correctly. >>> The existing implementation now simply copies all ASCII.isAlnum() >>> characters when handing a quote. >>> >>> Description of fix: >>> >>> In the method Pattern.RemoveQEQuoting any ASCII digit at the >>> beginning of a quote will now be prefixed by "\x3" (not just \ >>> because this would be a backref). 0x30 is the ASCII code for '0'. >>> >>> Thanks, >>> >>> Steve. >> From weijun.wang at oracle.com Fri Dec 16 02:29:20 2011 From: weijun.wang at oracle.com (Weijun Wang) Date: Fri, 16 Dec 2011 10:29:20 +0800 Subject: Consistent Behavior of exception-chaining In-Reply-To: <4EEA247F.9010500@gmx.de> References: <4EEA247F.9010500@gmx.de> Message-ID: <4EEAAD00.5060901@oracle.com> > Are there good reasons to not change Type 1 Exceptions to Type 2? Maybe serialization compatibility? -Max On 12/16/2011 12:46 AM, Sebastian Sickelmann wrote: > Hello, > > while refactoring some exceptions (support for the 4 common ctors) i > come along some > inconsistency in handling cause-chaining via initCause method. I hope we > can unify to a > compatible solution that there is only one initCause-behavior for every > Exception in JDK. > > Here are the types i discovered: > > Type 1: > Disallow calls to initCause after creation. > Type 2: > Disallow calls to initCause after creation using a ctor which has a > cause parameter. > through > Type 2 is the type used by Exceptions that had no cause-chaining (before > it was introduced > through Throwable). ex. java.lang.RuntimeException > Type 1 is the type used by Exceptions that had a cause-chaining (before > it was introduced > through Throwable). ex. java.lang.ClassNotFoundException > > Because there a two ways of looking at this feature i tried to realize > which behavior i > would expect. Lets call it Type 3. > > Type 3: > Disallow calls to initCause after creation if there is a ctor present > which i had the > change to specify a given cause. Which effectively is Type 1 if we > introduce the > 4 common-ctors to every Exception. > > > Type 3 has some problems. > 1st: There maybe some cases in JDK codebase where the cause-plumbing is > delayed > so that it is a problem that initCause cannot be called later. I think > this cases can be > refactored to work with Type 3(1). > 2nd: There are code-bases outside the jdk that uses the > initCause-method. These would > be binary compatible with Type 3(1) but are behavior-incompatible with it. > > I think the second reason weight more than the first. And i think this > is the deatchblow for > Type 3. > > So i think it concludes to the question: "Should we migrate the Type 1 > Exceptions to Type 2?" > > I think Type 1 Exceptions are only used by Exceptions that has a > cause-chaining (before > it was introduced through Throwable). There are some exception in > javax/xml/crypto that > had exception-chaining before it was introduced through Throwable. I had > some discussion[1] > with Sean Mullan about introducing exception-chaining to > javax/xml/crypto in the way > Throwable introduced it. We get to an solution[2] that implements Type 2. > > Are there good reasons to not change Type 1 Exceptions to Type 2? > > Kind regards > Sebastian > > [1] > http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-August/007399.html > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7011804_8/index.html > From david.holmes at oracle.com Fri Dec 16 04:38:43 2011 From: david.holmes at oracle.com (David Holmes) Date: Fri, 16 Dec 2011 14:38:43 +1000 Subject: 100218: BigInteger staticRandom field In-Reply-To: References: Message-ID: <4EEACB53.80800@oracle.com> On 15/12/2011 7:45 AM, Paul Ciprich wrote: > I've created a bug report to address a scalability problem with > BigInteger's staticRandom field. The problem is that the shared > staticRandom field causes bottlenecks with parallel code. The proposed > solution is to change the staticRandom field to a ThreadLocal and eliminate > the bottleneck by giving each thread its own copy of the SecureRandom > object. Bug 100218 contains a patch with the proposed change if it is > deemed acceptable. As I wrote in the bug report: If multiple threads pound on probablePrime then the shared random instance may indeed become a bottleneck. The performance implications of switching to a Thread-local instance needs to be given due consideration for the uncontended case. Also you need to consider the lifetime of these Thread-local Random instances as with the current proposal they will remain live for the lifetime of the thread. --- David Holmes From stephen.flores at oracle.com Fri Dec 16 06:41:10 2011 From: stephen.flores at oracle.com (Stephen Flores) Date: Fri, 16 Dec 2011 01:41:10 -0500 Subject: 6990617: Regular expression doesn't match if unicode character next to a digit. In-Reply-To: <4EEA3FFF.8030403@oracle.com> References: <4EE2F6AD.7050701@oracle.com> <4EE6547B.406@oracle.com> <4EE6D184.9000807@oracle.com> <4EEA3FFF.8030403@oracle.com> Message-ID: <4EEAE806.70400@oracle.com> I removed test 1 since test tests the same state. I updated the webrev. Steve. On 12/15/2011 01:44 PM, Xueming Shen wrote: > I would suggest to combine removeQEQuotingTest1 and 2 into one method, > they kinda > look redundant. > > Otherwise the change looks fine for me. > > -Sherman > > > On 12/12/2011 08:16 PM, Stephen Flores wrote: >> Thanks Sherman, >> >> I have added the regression test for the case below and added a >> "continue" statement after line 1622 to get the case to pass. >> >> I have updated the webrev. >> >> Steve. >> >> On 12/12/2011 02:22 PM, Xueming Shen wrote: >>> Hi Steve, >>> >>> The \x3[0-9] approach is interesting, it appears to solve the problem >>> without >>> paying a higher cost I originally thought (looking back, for example). >>> >>> The logic of initializing/setting/unsetting of "beginQuote" to >>> true/false appears to >>> be incorrect when there are multiple \Qn...\E in one pattern. Ln#1622 >>> setting will >>> always be followed by Ln#1630, if I read the code correctly. >>> >>> For example >>> >>> Pattern pattern = >>> Pattern.compile("\\011\\Q1sometext\\E\\011\\Q2sometext\\E"); >>> Matcher matcher = pattern.matcher("\t1sometext\t2sometext"); >>> System.out.printf("find=%b%n", matcher.find()); >>> >>> will still return false? >>> >>> -Sherman >>> >>> On 12/09/2011 10:05 PM, Stephen Flores wrote: >>>> Please review the following webrev (includes new test to demonstrate >>>> the bug): >>>> >>>> http://cr.openjdk.java.net/~sflores/6990617/ >>>> >>>> for bug: 6990617 Regular expression doesn't match if unicode character >>>> next to a digit. >>>> >>>> A DESCRIPTION OF THE PROBLEM : >>>> >>>> Unicode characters are represented as \\+number. >>>> For instance, one could write: >>>> Pattern p = Pattern.compile("\\011some text\\012"); >>>> Matcher m = p.matcher("\tsome text\n"); >>>> System.out.println(m.find()); // yields "true" >>>> >>>> However, if we want to match a string with a digit next to >>>> the unicode character, it doesn't match (whether we "quote" >>>> the regular expression or not). Note the "1" next to the tab >>>> character (unicode 011). >>>> Pattern p = Pattern.compile("\\011\\Q1some text\\E\\012"); >>>> Matcher m = p.matcher("\t1some text\n"); >>>> System.out.println(m.find()); // yields "false" >>>> >>>> This happens because Pattern accepts either \\0011 or \\011 for >>>> the same character. From the javadoc: >>>> >>>> \0nn The character with octal value 0nn (0 <= n <= 7) >>>> \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) >>>> >>>> Evaluation: >>>> >>>> Pattern.RemoveQEQuoting() does NOT handle this situation correctly. >>>> The existing implementation now simply copies all ASCII.isAlnum() >>>> characters when handing a quote. >>>> >>>> Description of fix: >>>> >>>> In the method Pattern.RemoveQEQuoting any ASCII digit at the >>>> beginning of a quote will now be prefixed by "\x3" (not just \ >>>> because this would be a backref). 0x30 is the ASCII code for '0'. >>>> >>>> Thanks, >>>> >>>> Steve. >>> > From lana.steuck at oracle.com Fri Dec 16 08:11:59 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:11:59 +0000 Subject: hg: jdk8/tl: 5 new changesets Message-ID: <20111216081159.DB44347716@hg.openjdk.java.net> Changeset: 4e06ae613e99 Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/4e06ae613e99 Added tag jdk8-b15 for changeset a4f28069d44a ! .hgtags Changeset: 8606f4ab62dc Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/8606f4ab62dc Added tag jdk8-b17 for changeset 4e06ae613e99 ! .hgtags Changeset: d82d3bb3a2e5 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/d82d3bb3a2e5 Added tag jdk8-b16 for changeset 4e06ae613e99 ! .hgtags Changeset: 7010bd24cdd0 Author: katleman Date: 2011-12-15 15:51 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/7010bd24cdd0 Merge ! .hgtags Changeset: 00d13c40d7a7 Author: lana Date: 2011-12-15 19:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/00d13c40d7a7 Merge From lana.steuck at oracle.com Fri Dec 16 08:12:01 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:12:01 +0000 Subject: hg: jdk8/tl/jaxws: 7 new changesets Message-ID: <20111216081202.2C40B47717@hg.openjdk.java.net> Changeset: 76e37e606354 Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/76e37e606354 Added tag jdk8-b15 for changeset c9ab96ff23d5 ! .hgtags Changeset: 23c42f40fd3e Author: katleman Date: 2011-12-06 08:43 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/23c42f40fd3e 7117162: jdk8/jaxws/Makefile default DROPS_DIR should set to jdk8-drops Reviewed-by: ohair, xdono, mchung ! build.properties ! make/Makefile Changeset: 3d45ab79643d Author: katleman Date: 2011-12-07 13:02 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/3d45ab79643d Merge Changeset: b38846b9974c Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/b38846b9974c Added tag jdk8-b17 for changeset 3d45ab79643d ! .hgtags Changeset: e662b652098c Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/e662b652098c Added tag jdk8-b16 for changeset 3d45ab79643d ! .hgtags Changeset: 54928c8850f5 Author: katleman Date: 2011-12-15 15:54 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/54928c8850f5 Merge ! .hgtags Changeset: b2e4ab8b5fa3 Author: lana Date: 2011-12-15 19:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/b2e4ab8b5fa3 Merge From lana.steuck at oracle.com Fri Dec 16 08:12:03 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:12:03 +0000 Subject: hg: jdk8/tl/jaxp: 7 new changesets Message-ID: <20111216081203.C4E6E47718@hg.openjdk.java.net> Changeset: 8181f7634e4a Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/8181f7634e4a Added tag jdk8-b15 for changeset 804f666d6d44 ! .hgtags Changeset: e32444f13774 Author: katleman Date: 2011-12-06 08:43 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/e32444f13774 7117162: jdk8/jaxws/Makefile default DROPS_DIR should set to jdk8-drops Reviewed-by: ohair, xdono, mchung ! build.properties ! make/Makefile Changeset: 09eb517404b0 Author: katleman Date: 2011-12-07 13:02 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/09eb517404b0 Merge Changeset: db44484a9d6e Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/db44484a9d6e Added tag jdk8-b17 for changeset 09eb517404b0 ! .hgtags Changeset: bc3ed3122933 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/bc3ed3122933 Added tag jdk8-b16 for changeset 09eb517404b0 ! .hgtags Changeset: ebec6a7e8d4e Author: katleman Date: 2011-12-15 15:54 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/ebec6a7e8d4e Merge ! .hgtags Changeset: f26e2ab2c2c7 Author: lana Date: 2011-12-15 19:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/f26e2ab2c2c7 Merge From lana.steuck at oracle.com Fri Dec 16 08:11:59 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:11:59 +0000 Subject: hg: jdk8/tl/corba: 5 new changesets Message-ID: <20111216081205.C2F9347719@hg.openjdk.java.net> Changeset: 82dc033975bb Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/82dc033975bb Added tag jdk8-b15 for changeset 7da69e7175a7 ! .hgtags Changeset: 05f47d29b438 Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/05f47d29b438 Added tag jdk8-b17 for changeset 82dc033975bb ! .hgtags Changeset: 6e51ad8d3707 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/6e51ad8d3707 Added tag jdk8-b16 for changeset 82dc033975bb ! .hgtags Changeset: 312cf15d1657 Author: katleman Date: 2011-12-15 15:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/312cf15d1657 Merge ! .hgtags Changeset: 0289a94d653b Author: lana Date: 2011-12-15 19:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/0289a94d653b Merge From lana.steuck at oracle.com Fri Dec 16 08:12:00 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:12:00 +0000 Subject: hg: jdk8/tl/hotspot: 4 new changesets Message-ID: <20111216081212.B6BDC4771A@hg.openjdk.java.net> Changeset: d1f29d4e0bc6 Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/d1f29d4e0bc6 Added tag jdk8-b15 for changeset fde2a39ed7f3 ! .hgtags Changeset: 698a22e99f74 Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/698a22e99f74 Added tag jdk8-b17 for changeset d1f29d4e0bc6 ! .hgtags Changeset: 09f3b8a372b2 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/09f3b8a372b2 Added tag jdk8-b16 for changeset d1f29d4e0bc6 ! .hgtags Changeset: e46c2339d0fc Author: katleman Date: 2011-12-15 15:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/e46c2339d0fc Merge ! .hgtags From lana.steuck at oracle.com Fri Dec 16 08:12:11 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:12:11 +0000 Subject: hg: jdk8/tl/langtools: 7 new changesets Message-ID: <20111216081227.C2EAF4771B@hg.openjdk.java.net> Changeset: ec2c0973cc31 Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/ec2c0973cc31 Added tag jdk8-b15 for changeset 07599bd780ca ! .hgtags Changeset: 2584f5358cba Author: lana Date: 2011-12-06 20:26 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/2584f5358cba Merge Changeset: 1cbe86c11ba6 Author: lana Date: 2011-12-12 10:08 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/1cbe86c11ba6 Merge - test/tools/javac/parser/netbeans/JavacParserTest.java Changeset: 55a49c399603 Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/55a49c399603 Added tag jdk8-b17 for changeset 1cbe86c11ba6 ! .hgtags Changeset: 29a512337b79 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/29a512337b79 Added tag jdk8-b16 for changeset ec2c0973cc31 ! .hgtags Changeset: ab1b1cc78577 Author: katleman Date: 2011-12-15 15:57 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/ab1b1cc78577 Merge ! .hgtags - test/tools/javac/parser/netbeans/JavacParserTest.java Changeset: ab2a880cc23b Author: lana Date: 2011-12-15 19:53 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/ab2a880cc23b Merge From lana.steuck at oracle.com Fri Dec 16 08:13:06 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Fri, 16 Dec 2011 08:13:06 +0000 Subject: hg: jdk8/tl/jdk: 31 new changesets Message-ID: <20111216081812.A66194771C@hg.openjdk.java.net> Changeset: 929597c6e777 Author: katleman Date: 2011-12-01 10:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/929597c6e777 Added tag jdk8-b15 for changeset 3c248d0e2c48 ! .hgtags Changeset: 23acf34c80b0 Author: neugens Date: 2011-12-03 15:40 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/23acf34c80b0 7117914: Fix javac warnings in src/share/classes/sun/java2d Summary: Fix some javac warnings in java2d related code for the Warning Cleanup Day. Reviewed-by: prr, flar ! src/share/classes/java/awt/geom/Path2D.java ! src/share/classes/sun/awt/image/BufImgSurfaceData.java ! src/share/classes/sun/java2d/SunGraphics2D.java ! src/share/classes/sun/java2d/SurfaceData.java ! src/share/classes/sun/java2d/SurfaceDataProxy.java ! src/share/classes/sun/java2d/loops/GraphicsPrimitive.java ! src/share/classes/sun/java2d/loops/SurfaceType.java ! src/share/classes/sun/java2d/opengl/OGLBufImgOps.java ! src/share/classes/sun/java2d/opengl/OGLDrawImage.java ! src/share/classes/sun/java2d/opengl/OGLPaints.java ! src/share/classes/sun/java2d/opengl/OGLSurfaceData.java ! src/share/classes/sun/java2d/pipe/AAShapePipe.java ! src/share/classes/sun/java2d/pipe/BufferedPaints.java ! src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java ! src/share/classes/sun/java2d/pipe/DrawImage.java ! src/share/classes/sun/java2d/pipe/GlyphListPipe.java ! src/share/classes/sun/java2d/pipe/LoopPipe.java ! src/share/classes/sun/java2d/pipe/RenderingEngine.java ! src/solaris/classes/sun/java2d/x11/X11Renderer.java ! src/solaris/classes/sun/java2d/x11/X11SurfaceData.java Changeset: 70b40ea06df0 Author: prr Date: 2011-12-03 16:26 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/70b40ea06df0 7117199: Fix javac warnings in src/share/classes/java/awt/font Reviewed-by: jgodinez, bae ! src/share/classes/java/awt/font/StyledParagraph.java ! src/share/classes/java/awt/font/TextAttribute.java ! src/share/classes/java/awt/font/TextLayout.java ! src/share/classes/java/awt/font/TextLine.java ! src/share/classes/java/awt/font/TextMeasurer.java Changeset: 4075d524fa46 Author: lana Date: 2011-12-06 16:15 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4075d524fa46 Merge Changeset: e53a078c2840 Author: anthony Date: 2011-11-09 13:43 +0300 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e53a078c2840 7045370: Java Statically Determines Display Size on Linux platforms Summary: Listen to ConfigureNotify events on the root window and update the current screen size accordingly Reviewed-by: art, bae ! src/share/classes/java/awt/Component.java ! src/solaris/classes/sun/awt/X11/XToolkit.java ! src/solaris/classes/sun/awt/X11GraphicsDevice.java ! src/solaris/native/sun/awt/awt_GraphicsEnv.c Changeset: 84e473cf4531 Author: rupashka Date: 2011-11-10 14:10 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/84e473cf4531 6938583: Unexpected NullPointerException by InputContext.endComposition() Reviewed-by: rupashka Contributed-by: Charles Lee ! src/share/classes/javax/swing/text/DefaultCaret.java + test/javax/swing/text/DefaultCaret/6938583/bug6938583.java Changeset: 81f1b32f9e24 Author: malenkov Date: 2011-11-10 17:15 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/81f1b32f9e24 7057459: Regression: Performance degradation with java.beans.XMLEncoder Reviewed-by: rupashka ! src/share/classes/java/beans/Encoder.java Changeset: e120c78cb45c Author: malenkov Date: 2011-11-10 17:27 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e120c78cb45c 7064279: Introspector.getBeanInfo() should release some resources in timely manner Reviewed-by: art, alexp ! src/share/classes/java/beans/Beans.java ! src/share/classes/java/beans/Introspector.java ! src/share/classes/java/beans/PropertyEditorManager.java + src/share/classes/java/beans/ThreadGroupContext.java ! test/java/beans/Beans/6669869/TestDesignTime.java ! test/java/beans/Beans/6669869/TestGuiAvailable.java ! test/java/beans/Introspector/6380849/TestBeanInfo.java + test/java/beans/Introspector/7064279/Test7064279.java + test/java/beans/Introspector/7064279/test.jar ! test/java/beans/Introspector/Test6660539.java ! test/java/beans/PropertyEditor/6380849/TestPropertyEditor.java Changeset: 8b6a69b2e482 Author: malenkov Date: 2011-11-10 17:32 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/8b6a69b2e482 7087876: java/beans/PropertyDescriptor.html#createPropertyEditor() throws RE if editor cannot be created Reviewed-by: rupashka ! src/share/classes/java/beans/PropertyDescriptor.java + test/java/beans/PropertyEditor/Test7087876.java Changeset: b02495c51b9c Author: malenkov Date: 2011-11-10 17:35 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/b02495c51b9c 7092744: XMLEncoder fails to encode and breaks backward compatibility Reviewed-by: rupashka ! src/share/classes/com/sun/beans/finder/AbstractFinder.java ! src/share/classes/com/sun/beans/finder/ConstructorFinder.java ! src/share/classes/com/sun/beans/finder/MethodFinder.java + test/java/beans/XMLEncoder/Test7092744.java Changeset: 16327765859c Author: malenkov Date: 2011-11-10 17:37 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/16327765859c 7087429: Constructor of java.beans.PropertyChangeEvent should declare thrown NPE for null source Reviewed-by: rupashka ! src/share/classes/java/beans/PropertyChangeEvent.java + test/java/beans/PropertyChangeSupport/Test7087429.java Changeset: f614bcada2a9 Author: anthony Date: 2011-11-11 15:17 +0300 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/f614bcada2a9 7103610: _NET_WM_PID and WM_CLIENT_MACHINE are not set Summary: Set the properties to all top-level windows Reviewed-by: anthony Contributed-by: Danesh Dadachanji ! make/sun/xawt/mapfile-vers ! src/solaris/classes/sun/awt/X11/XWindowPeer.java ! src/solaris/native/sun/xawt/XToolkit.c Changeset: c0f3f1558a94 Author: rupashka Date: 2011-11-14 14:00 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c0f3f1558a94 7109617: Test was writed for Metal L&F but not set it Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com + test/javax/swing/plaf/metal/MetalLookAndFeel/5073047/bug5073047.java Changeset: a51777c9228a Author: malenkov Date: 2011-11-14 14:38 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/a51777c9228a 7110521: Regression test failed: Introspector/TestTypeResolver.java Reviewed-by: rupashka ! test/java/beans/Introspector/TestTypeResolver.java Changeset: 28f768c41a90 Author: serb Date: 2011-11-12 04:13 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/28f768c41a90 6996291: command line selection of MToolkit by -Dawt.toolkit=sun.awt.motif.MToolkit fails from jdk7 b21 on Reviewed-by: art, dcherepanov, bae, prr ! make/sun/awt/FILES_c_unix.gmk ! make/sun/awt/FILES_export_unix.gmk ! make/sun/awt/mapfile-mawt-vers ! make/sun/awt/mapfile-vers-linux ! make/sun/awt/mawt.gmk - make/sun/motif12/reorder-i586 - make/sun/motif12/reorder-sparc - make/sun/motif12/reorder-sparcv9 ! make/sun/xawt/mapfile-vers ! src/solaris/classes/sun/awt/X11/ListHelper.java ! src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java ! src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java - src/solaris/classes/sun/awt/motif/AWTLockAccess.java ! src/solaris/classes/sun/awt/motif/MFontConfiguration.java - src/solaris/classes/sun/awt/motif/MFontPeer.java - src/solaris/classes/sun/awt/motif/MToolkit.java - src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java - src/solaris/classes/sun/awt/motif/MWindowAttributes.java - src/solaris/classes/sun/awt/motif/X11FontMetrics.java - src/solaris/native/sun/awt/MouseInfo.c - src/solaris/native/sun/awt/XDrawingArea.c - src/solaris/native/sun/awt/XDrawingArea.h - src/solaris/native/sun/awt/XDrawingAreaP.h ! src/solaris/native/sun/awt/awt.h ! src/solaris/native/sun/awt/awt_AWTEvent.c ! src/solaris/native/sun/awt/awt_Component.h - src/solaris/native/sun/awt/awt_Cursor.h ! src/solaris/native/sun/awt/awt_DrawingSurface.c ! src/solaris/native/sun/awt/awt_Font.c ! src/solaris/native/sun/awt/awt_Font.h ! src/solaris/native/sun/awt/awt_GraphicsEnv.c ! src/solaris/native/sun/awt/awt_InputMethod.c - src/solaris/native/sun/awt/awt_KeyboardFocusManager.h - src/solaris/native/sun/awt/awt_MToolkit.c - src/solaris/native/sun/awt/awt_MToolkit.h - src/solaris/native/sun/awt/awt_MenuItem.h - src/solaris/native/sun/awt/awt_PopupMenu.h ! src/solaris/native/sun/awt/awt_Robot.c - src/solaris/native/sun/awt/awt_TopLevel.h - src/solaris/native/sun/awt/awt_Window.h - src/solaris/native/sun/awt/awt_mgrsel.c - src/solaris/native/sun/awt/awt_mgrsel.h - src/solaris/native/sun/awt/awt_motif.h ! src/solaris/native/sun/awt/awt_p.h ! src/solaris/native/sun/awt/awt_util.c ! src/solaris/native/sun/awt/awt_util.h - src/solaris/native/sun/awt/awt_wm.c - src/solaris/native/sun/awt/awt_wm.h - src/solaris/native/sun/awt/awt_xembed.h - src/solaris/native/sun/awt/awt_xembed_server.c - src/solaris/native/sun/awt/awt_xembed_server.h ! src/solaris/native/sun/awt/canvas.h ! src/solaris/native/sun/awt/multi_font.c ! src/solaris/native/sun/awt/multi_font.h ! src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c ! src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h ! src/solaris/native/sun/java2d/x11/X11SurfaceData.c ! src/solaris/native/sun/xawt/XToolkit.c Changeset: 6a9d735ebd0a Author: bagiras Date: 2011-11-16 15:40 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/6a9d735ebd0a 7108598: Pogo Table Games freeze with JDK 7 Reviewed-by: art, ant ! src/share/classes/java/awt/Component.java ! src/share/classes/java/awt/Container.java + test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java Changeset: 1df53949945d Author: lana Date: 2011-11-18 15:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/1df53949945d Merge Changeset: 90d33a64a404 Author: rupashka Date: 2011-11-21 18:22 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/90d33a64a404 7109085: Test use hotkeys not intended for Mac Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com ! test/javax/swing/regtesthelpers/Util.java + test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java + test/javax/swing/text/JTextComponent/5074573/bug5074573.java + test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java Changeset: c3c80f96cb83 Author: rupashka Date: 2011-11-25 11:52 +0300 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c3c80f96cb83 7113337: Swing closed test tries to click in the area reserved for resize by Mac OS X Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com + test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java Changeset: 9cbc208dcf08 Author: rupashka Date: 2011-11-29 12:47 +0300 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/9cbc208dcf08 7112925: closed/javax/swing/JTabbedPane/4624207/bug4624207.java fails on MacOS Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com + test/javax/swing/JTabbedPane/4624207/bug4624207.java Changeset: 051beb804b12 Author: rupashka Date: 2011-11-30 16:54 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/051beb804b12 7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com + test/javax/swing/JScrollBar/4865918/bug4865918.java Changeset: 7dd4395fe4a5 Author: rupashka Date: 2011-11-30 19:38 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/7dd4395fe4a5 7115357: closed/javax/swing/JTable/6263446/bug6263446Table.java fails on MacOS Reviewed-by: rupashka Contributed-by: alexandr.scherbatiy at oracle.com + test/javax/swing/JTable/6263446/bug6263446.java Changeset: 4b416a0180dc Author: lana Date: 2011-11-29 15:57 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4b416a0180dc Merge - test/java/io/FileDescriptor/FileChannelFDTest.java - test/java/io/etc/FileDescriptorSharing.java Changeset: 45eb5a61da07 Author: lana Date: 2011-11-30 12:06 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/45eb5a61da07 Merge Changeset: 79b5c5a8c7e9 Author: serb Date: 2011-12-05 17:11 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/79b5c5a8c7e9 7115400: jdk 8 awt-gate build fails in headless toolkit on solaris. Reviewed-by: prr, art, bae ! make/sun/awt/FILES_c_unix.gmk + src/solaris/native/sun/awt/HeadlessToolkit.c ! src/solaris/native/sun/java2d/x11/X11SurfaceData.h Changeset: 2b1438297561 Author: lana Date: 2011-12-06 16:17 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2b1438297561 Merge - make/sun/motif12/reorder-i586 - make/sun/motif12/reorder-sparc - make/sun/motif12/reorder-sparcv9 - src/solaris/classes/sun/awt/motif/AWTLockAccess.java - src/solaris/classes/sun/awt/motif/MFontPeer.java - src/solaris/classes/sun/awt/motif/MToolkit.java - src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java - src/solaris/classes/sun/awt/motif/MWindowAttributes.java - src/solaris/classes/sun/awt/motif/X11FontMetrics.java - src/solaris/native/sun/awt/MouseInfo.c - src/solaris/native/sun/awt/XDrawingArea.c - src/solaris/native/sun/awt/XDrawingArea.h - src/solaris/native/sun/awt/XDrawingAreaP.h - src/solaris/native/sun/awt/awt_Cursor.h - src/solaris/native/sun/awt/awt_KeyboardFocusManager.h - src/solaris/native/sun/awt/awt_MToolkit.c - src/solaris/native/sun/awt/awt_MToolkit.h - src/solaris/native/sun/awt/awt_MenuItem.h - src/solaris/native/sun/awt/awt_PopupMenu.h - src/solaris/native/sun/awt/awt_TopLevel.h - src/solaris/native/sun/awt/awt_Window.h - src/solaris/native/sun/awt/awt_mgrsel.c - src/solaris/native/sun/awt/awt_mgrsel.h - src/solaris/native/sun/awt/awt_motif.h - src/solaris/native/sun/awt/awt_wm.c - src/solaris/native/sun/awt/awt_wm.h - src/solaris/native/sun/awt/awt_xembed.h - src/solaris/native/sun/awt/awt_xembed_server.c - src/solaris/native/sun/awt/awt_xembed_server.h Changeset: b71d1acfae52 Author: lana Date: 2011-12-06 20:25 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/b71d1acfae52 Merge ! src/share/classes/java/beans/Beans.java ! src/share/classes/java/beans/Encoder.java ! src/share/classes/java/beans/Introspector.java ! src/share/classes/java/beans/PropertyDescriptor.java - src/share/native/java/util/zip/zlib-1.2.3/ChangeLog - src/share/native/java/util/zip/zlib-1.2.3/README - src/share/native/java/util/zip/zlib-1.2.3/compress.c - src/share/native/java/util/zip/zlib-1.2.3/crc32.h - src/share/native/java/util/zip/zlib-1.2.3/deflate.c - src/share/native/java/util/zip/zlib-1.2.3/deflate.h - src/share/native/java/util/zip/zlib-1.2.3/gzio.c - src/share/native/java/util/zip/zlib-1.2.3/infback.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.h - src/share/native/java/util/zip/zlib-1.2.3/inffixed.h - src/share/native/java/util/zip/zlib-1.2.3/inflate.c - src/share/native/java/util/zip/zlib-1.2.3/inflate.h - src/share/native/java/util/zip/zlib-1.2.3/inftrees.c - src/share/native/java/util/zip/zlib-1.2.3/inftrees.h - src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java - src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff - src/share/native/java/util/zip/zlib-1.2.3/trees.c - src/share/native/java/util/zip/zlib-1.2.3/trees.h - src/share/native/java/util/zip/zlib-1.2.3/uncompr.c - src/share/native/java/util/zip/zlib-1.2.3/zadler32.c - src/share/native/java/util/zip/zlib-1.2.3/zconf.h - src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.2.3/zlib.h - src/share/native/java/util/zip/zlib-1.2.3/zutil.c - src/share/native/java/util/zip/zlib-1.2.3/zutil.h - test/java/util/ResourceBundle/Control/ExpirationTest.java - test/java/util/ResourceBundle/Control/ExpirationTest.sh Changeset: cd95291bbbf3 Author: katleman Date: 2011-12-15 12:16 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/cd95291bbbf3 Added tag jdk8-b17 for changeset b71d1acfae52 ! .hgtags Changeset: 8f3d916a9164 Author: katleman Date: 2011-12-15 15:47 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/8f3d916a9164 Added tag jdk8-b16 for changeset 929597c6e777 ! .hgtags Changeset: e55ac966ed95 Author: katleman Date: 2011-12-15 15:55 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e55ac966ed95 Merge ! .hgtags - make/sun/motif12/reorder-i586 - make/sun/motif12/reorder-sparc - make/sun/motif12/reorder-sparcv9 - src/share/native/java/util/zip/zlib-1.2.3/ChangeLog - src/share/native/java/util/zip/zlib-1.2.3/README - src/share/native/java/util/zip/zlib-1.2.3/compress.c - src/share/native/java/util/zip/zlib-1.2.3/crc32.h - src/share/native/java/util/zip/zlib-1.2.3/deflate.c - src/share/native/java/util/zip/zlib-1.2.3/deflate.h - src/share/native/java/util/zip/zlib-1.2.3/gzio.c - src/share/native/java/util/zip/zlib-1.2.3/infback.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.h - src/share/native/java/util/zip/zlib-1.2.3/inffixed.h - src/share/native/java/util/zip/zlib-1.2.3/inflate.c - src/share/native/java/util/zip/zlib-1.2.3/inflate.h - src/share/native/java/util/zip/zlib-1.2.3/inftrees.c - src/share/native/java/util/zip/zlib-1.2.3/inftrees.h - src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java - src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff - src/share/native/java/util/zip/zlib-1.2.3/trees.c - src/share/native/java/util/zip/zlib-1.2.3/trees.h - src/share/native/java/util/zip/zlib-1.2.3/uncompr.c - src/share/native/java/util/zip/zlib-1.2.3/zadler32.c - src/share/native/java/util/zip/zlib-1.2.3/zconf.h - src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.2.3/zlib.h - src/share/native/java/util/zip/zlib-1.2.3/zutil.c - src/share/native/java/util/zip/zlib-1.2.3/zutil.h - src/solaris/classes/sun/awt/motif/AWTLockAccess.java - src/solaris/classes/sun/awt/motif/MFontPeer.java - src/solaris/classes/sun/awt/motif/MToolkit.java - src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java - src/solaris/classes/sun/awt/motif/MWindowAttributes.java - src/solaris/classes/sun/awt/motif/X11FontMetrics.java - src/solaris/native/sun/awt/MouseInfo.c - src/solaris/native/sun/awt/XDrawingArea.c - src/solaris/native/sun/awt/XDrawingArea.h - src/solaris/native/sun/awt/XDrawingAreaP.h - src/solaris/native/sun/awt/awt_Cursor.h - src/solaris/native/sun/awt/awt_KeyboardFocusManager.h - src/solaris/native/sun/awt/awt_MToolkit.c - src/solaris/native/sun/awt/awt_MToolkit.h - src/solaris/native/sun/awt/awt_MenuItem.h - src/solaris/native/sun/awt/awt_PopupMenu.h - src/solaris/native/sun/awt/awt_TopLevel.h - src/solaris/native/sun/awt/awt_Window.h - src/solaris/native/sun/awt/awt_mgrsel.c - src/solaris/native/sun/awt/awt_mgrsel.h - src/solaris/native/sun/awt/awt_motif.h - src/solaris/native/sun/awt/awt_wm.c - src/solaris/native/sun/awt/awt_wm.h - src/solaris/native/sun/awt/awt_xembed.h - src/solaris/native/sun/awt/awt_xembed_server.c - src/solaris/native/sun/awt/awt_xembed_server.h - test/java/util/ResourceBundle/Control/ExpirationTest.java - test/java/util/ResourceBundle/Control/ExpirationTest.sh Changeset: e446c7d24d6c Author: lana Date: 2011-12-15 19:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e446c7d24d6c Merge - make/sun/motif12/reorder-i586 - make/sun/motif12/reorder-sparc - make/sun/motif12/reorder-sparcv9 - src/solaris/classes/sun/awt/motif/AWTLockAccess.java - src/solaris/classes/sun/awt/motif/MFontPeer.java - src/solaris/classes/sun/awt/motif/MToolkit.java - src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java - src/solaris/classes/sun/awt/motif/MWindowAttributes.java - src/solaris/classes/sun/awt/motif/X11FontMetrics.java - src/solaris/native/sun/awt/MouseInfo.c - src/solaris/native/sun/awt/XDrawingArea.c - src/solaris/native/sun/awt/XDrawingArea.h - src/solaris/native/sun/awt/XDrawingAreaP.h - src/solaris/native/sun/awt/awt_Cursor.h - src/solaris/native/sun/awt/awt_KeyboardFocusManager.h - src/solaris/native/sun/awt/awt_MToolkit.c - src/solaris/native/sun/awt/awt_MToolkit.h - src/solaris/native/sun/awt/awt_MenuItem.h - src/solaris/native/sun/awt/awt_PopupMenu.h - src/solaris/native/sun/awt/awt_TopLevel.h - src/solaris/native/sun/awt/awt_Window.h - src/solaris/native/sun/awt/awt_mgrsel.c - src/solaris/native/sun/awt/awt_mgrsel.h - src/solaris/native/sun/awt/awt_motif.h - src/solaris/native/sun/awt/awt_wm.c - src/solaris/native/sun/awt/awt_wm.h - src/solaris/native/sun/awt/awt_xembed.h - src/solaris/native/sun/awt/awt_xembed_server.c - src/solaris/native/sun/awt/awt_xembed_server.h From chris.hegarty at oracle.com Fri Dec 16 19:16:52 2011 From: chris.hegarty at oracle.com (chris.hegarty at oracle.com) Date: Fri, 16 Dec 2011 19:16:52 +0000 Subject: hg: jdk8/tl/jdk: 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies Message-ID: <20111216191703.283FA4773B@hg.openjdk.java.net> Changeset: 33ac7a057b9c Author: chegar Date: 2011-12-16 16:09 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/33ac7a057b9c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies Reviewed-by: michaelm ! src/share/classes/java/net/HttpCookie.java + src/share/classes/sun/misc/JavaNetHttpCookieAccess.java ! src/share/classes/sun/misc/SharedSecrets.java ! src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java + test/sun/net/www/protocol/http/HttpOnly.java From jonathan.gibbons at oracle.com Fri Dec 16 21:50:09 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Fri, 16 Dec 2011 21:50:09 +0000 Subject: hg: jdk8/tl/langtools: 7121961: javadoc is missing a resource property Message-ID: <20111216215015.1DB0D4773C@hg.openjdk.java.net> Changeset: 6b773fdeb633 Author: jjg Date: 2011-12-16 13:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/6b773fdeb633 7121961: javadoc is missing a resource property Reviewed-by: bpatel ! src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties From jim.holmlund at sun.com Sat Dec 17 00:42:59 2011 From: jim.holmlund at sun.com (jim.holmlund at sun.com) Date: Sat, 17 Dec 2011 00:42:59 +0000 Subject: hg: jdk8/tl/langtools: 7122342: testPrintProcessorInfo/TestWithXstdout.java failed for JDK8 nightly build at 12/16/2011 Message-ID: <20111217004301.B48AA4774D@hg.openjdk.java.net> Changeset: a7a2720c7897 Author: jjh Date: 2011-12-16 16:41 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/a7a2720c7897 7122342: testPrintProcessorInfo/TestWithXstdout.java failed for JDK8 nightly build at 12/16/2011 Summary: Do not pass empty args to javac Reviewed-by: jjg ! test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java From stuart.marks at oracle.com Sat Dec 17 16:20:54 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Sat, 17 Dec 2011 16:20:54 +0000 Subject: hg: jdk8/tl/jdk: 7122235: stop the build if javac fails Message-ID: <20111217162116.4EF5C47751@hg.openjdk.java.net> Changeset: abbca81a98a7 Author: smarks Date: 2011-12-17 08:21 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/abbca81a98a7 7122235: stop the build if javac fails Reviewed-by: chegar, dholmes, mcimadamore, ohair ! make/common/Rules.gmk From i30817 at gmail.com Sat Dec 17 18:13:41 2011 From: i30817 at gmail.com (Paulo Levi) Date: Sat, 17 Dec 2011 18:13:41 +0000 Subject: Ever think about documenting design tradeoffs Message-ID: When i scan the messages in this list i see many instances of backwards compatibility design tradeoffs. Can't change the binary classfile format - adopt a limited transformation, limit inference, etc etc etc. And the user visible documentation of the omits these tradeoffs and irritations. Wouldn't it be wise to document all of them so that on a eventual "java++", you wouldn't just copy wholesale library/compiler/runtime design from java but vanquish these old irritations? Just a thought i had, don't really know if you're already doing it internally. From alan.bateman at oracle.com Sat Dec 17 20:10:05 2011 From: alan.bateman at oracle.com (alan.bateman at oracle.com) Date: Sat, 17 Dec 2011 20:10:05 +0000 Subject: hg: jdk8/tl/jdk: 7087549: (fs) Files.newInputStream throws UOE for custom provider options Message-ID: <20111217201024.B8B3547752@hg.openjdk.java.net> Changeset: 528eb0d43e3a Author: alanb Date: 2011-12-17 20:07 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/528eb0d43e3a 7087549: (fs) Files.newInputStream throws UOE for custom provider options Reviewed-by: alanb Contributed-by: brandon.passanisi at oracle.com ! src/share/classes/java/nio/file/spi/FileSystemProvider.java + test/java/nio/file/Files/CustomOptions.java From maurizio.cimadamore at oracle.com Mon Dec 19 12:07:58 2011 From: maurizio.cimadamore at oracle.com (maurizio.cimadamore at oracle.com) Date: Mon, 19 Dec 2011 12:07:58 +0000 Subject: hg: jdk8/tl/langtools: 7120463: Fix method reference parser support in order to avoid ambiguities Message-ID: <20111219120803.7D0E547756@hg.openjdk.java.net> Changeset: 1ae5988e201b Author: mcimadamore Date: 2011-12-19 12:07 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/1ae5988e201b 7120463: Fix method reference parser support in order to avoid ambiguities Summary: Add lookahead routine to disambiguate between method reference in method context and binary expression Reviewed-by: jjg, dlsmith ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java ! test/tools/javac/lambda/MethodReferenceParserTest.java From brandon.passanisi at oracle.com Mon Dec 19 18:53:24 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Mon, 19 Dec 2011 10:53:24 -0800 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4ED8A9A0.3000808@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com> Message-ID: <4EEF8824.7030500@oracle.com> Hello core-libs. I was wondering if somebody could please review the following updated webrev for this bug. There was an e-mail thread regarding the first webrev [1] that prompted the changes in this webrev. Webrev: http://cr.openjdk.java.net/~mduigou/4802647/1/webrev/ Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 Here is a summary of the changes: 1. I followed the suggestion to look into Collection/MOAT.java and decided that updating this test was better than using the new test program I had written in the previous webrev named RemoveAllRetainAllNPE.java 2. I noticed that MOAT.java didn't directly test AbstractCollection.java and AbstractSet.java. So, I added the testing of these classes to MOAT.java on lines 62 and 63 of the updated webrev. 3. While MOAT.java does test removeAll(null) and retainAll(null), it doesn't test the scenario where the collection is empty when calling c.removeAll(null) and c.retainAll(null). The current testing in MOAT.java uses a collection with one element when testing removeAll(null) and retainAll(null). So, I added code for the testing of removeAll(null) and retainAll(null) with an empty collection, which is the scenario for the behavior in the bug report. These are the changes on lines 759 - 766, 775 - 782 of MOAT.java. 4. The added classes NewAbstractColection and NewAbstractSet were intentionally written to be very basic and were inspired from the source in the bug report. Is there a better way to write these classes or are they ok as-is? 5. The changes to MOAT.java in this updated webrev result in more classes that exhibit the same bug behavior described in this bug report for AbstractCollection (no NPE thrown). These classes are: java.util.ArrayList and java.util.concurrent.CopyOnWriteArrayList. Should a new bug be filed for these cases? Thanks. [1]: http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-November/008283.html On 12/2/2011 2:34 AM, Alan Bateman wrote: > On 01/12/2011 22:42, Brandon Passanisi wrote: >> Hi Jason. Thanks for your response. I was thinking about how I can >> improve the test using your suggestion. I could possibly do the >> following: >> >> 1. Find all of the subclasses of AbstractCollection which override >> removeAll(Collection) and which also contain the spec language >> which specifies that NullPointerException is thrown if the specified >> collection is null. >> >> 2. Find all of the subclasses of AbstractCollection which override >> retainAll(Collection) and which also contain the spec language >> which specifies that NullPointerException is thrown if the specified >> collection is null. >> >> 3. Add the classes found in #1 and #2 to the test. >> >> 4. If any of the new classes added because of #3 result in a test >> failure, it might be a good idea to file a new bug as Bug #4802647 >> specifically mentions subclasses of AbstractCollection which do not >> override remainAll, retainAll. >> >> 5. The public subclasses of AbstractCollection which do not override >> removeAll, retainAll (probably) shouldn't be included in the test as >> the currently existing NewAbstractCollection represents this >> scenario. >> >> What do you think? >> > Brandon - it's probably worth getting familiar with the existing > tests, in in particular Martin's "Mother Of All Test" > (Collection/MOAT.java). > > -Alan. -- Oracle Brandon Passanisi | Principle Member of Technical Staff Green Oracle Oracle is committed to developing practices and products that help protect the environment From xueming.shen at oracle.com Mon Dec 19 22:15:25 2011 From: xueming.shen at oracle.com (xueming.shen at oracle.com) Date: Mon, 19 Dec 2011 22:15:25 +0000 Subject: hg: jdk8/tl/jdk: 6990617: Regular expression doesn't match if unicode character next to a digit. Message-ID: <20111219221551.24C984775E@hg.openjdk.java.net> Changeset: 5b27b978ed42 Author: sherman Date: 2011-12-19 14:14 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/5b27b978ed42 6990617: Regular expression doesn't match if unicode character next to a digit. Summary: updated RemoveQEQuotation() to deal with this case correctly Reviewed-by: sherman Contributed-by: stephen.flores at oracle.com ! src/share/classes/java/util/regex/Pattern.java ! test/java/util/regex/RegExTest.java From mike.duigou at oracle.com Mon Dec 19 22:17:16 2011 From: mike.duigou at oracle.com (Mike Duigou) Date: Mon, 19 Dec 2011 14:17:16 -0800 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EEF8824.7030500@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com> <4EEF8824.7030500@oracle.com> Message-ID: This looks complete to me. Mike On Dec 19 2011, at 10:53 , Brandon Passanisi wrote: > Hello core-libs. I was wondering if somebody could please review the following updated webrev for this bug. There was an e-mail thread regarding the first webrev [1] that prompted the changes in this webrev. > > Webrev: http://cr.openjdk.java.net/~mduigou/4802647/1/webrev/ > Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 > > Here is a summary of the changes: > ... > 4. The added classes NewAbstractColection and NewAbstractSet were intentionally written to be very basic and were inspired from the source in the bug report. Is there a better way to write these classes or are they ok as-is? Seems good to me. > 5. The changes to MOAT.java in this updated webrev result in more classes that exhibit the same bug behavior described in this bug report for AbstractCollection (no NPE thrown). These classes are: java.util.ArrayList and java.util.concurrent.CopyOnWriteArrayList. Should a new bug be filed for these cases? If these other classes are just inheriting the AbstractCollection behaviour then the bug can be expanded to include them. If they have their own implementations which also exhibit the problem then they should probably addressed separately. (CopyOnWriteArrayList in particular). > Thanks. > > > [1]: http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-November/008283.html > > > On 12/2/2011 2:34 AM, Alan Bateman wrote: >> On 01/12/2011 22:42, Brandon Passanisi wrote: >>> Hi Jason. Thanks for your response. I was thinking about how I can improve the test using your suggestion. I could possibly do the following: >>> >>> 1. Find all of the subclasses of AbstractCollection which override >>> removeAll(Collection) and which also contain the spec language >>> which specifies that NullPointerException is thrown if the specified >>> collection is null. >>> >>> 2. Find all of the subclasses of AbstractCollection which override >>> retainAll(Collection) and which also contain the spec language >>> which specifies that NullPointerException is thrown if the specified >>> collection is null. >>> >>> 3. Add the classes found in #1 and #2 to the test. >>> >>> 4. If any of the new classes added because of #3 result in a test >>> failure, it might be a good idea to file a new bug as Bug #4802647 >>> specifically mentions subclasses of AbstractCollection which do not >>> override remainAll, retainAll. >>> >>> 5. The public subclasses of AbstractCollection which do not override >>> removeAll, retainAll (probably) shouldn't be included in the test as >>> the currently existing NewAbstractCollection represents this scenario. >>> >>> What do you think? >>> >> Brandon - it's probably worth getting familiar with the existing tests, in in particular Martin's "Mother Of All Test" (Collection/MOAT.java). >> >> -Alan. > > -- > Oracle > Brandon Passanisi | Principle Member of Technical Staff > > Green Oracle Oracle is committed to developing practices and products that help protect the environment From david.holmes at oracle.com Tue Dec 20 00:12:02 2011 From: david.holmes at oracle.com (David Holmes) Date: Tue, 20 Dec 2011 10:12:02 +1000 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EEF8824.7030500@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com> <4EEF8824.7030500@oracle.com> Message-ID: <4EEFD2D2.4090305@oracle.com> Brandon, I don't see the purpose of NewAbstractSet. It is identical to NewAbstractCollection. Otherwise my only concern is as you raised previously, updating the test to check existing subclasses causes new failures for ArrayList and CopyOnWriteArrayList. I'd suggest fixing ArrayList as part of this CR and file a new CR for COWAL so that Doug Lea can fix it upstream in the jsr166 cvs repository. David On 20/12/2011 4:53 AM, Brandon Passanisi wrote: > Hello core-libs. I was wondering if somebody could please review the > following updated webrev for this bug. There was an e-mail thread > regarding the first webrev [1] that prompted the changes in this webrev. > > Webrev: http://cr.openjdk.java.net/~mduigou/4802647/1/webrev/ > Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 > > Here is a summary of the changes: > > 1. I followed the suggestion to look into Collection/MOAT.java and > decided that updating this test was better than using the new test > program I had written in the previous webrev named > RemoveAllRetainAllNPE.java > > 2. I noticed that MOAT.java didn't directly test AbstractCollection.java > and AbstractSet.java. So, I added the testing of these classes to > MOAT.java on lines 62 and 63 of the updated webrev. > > 3. While MOAT.java does test removeAll(null) and retainAll(null), it > doesn't test the scenario where the collection is empty when calling > c.removeAll(null) and c.retainAll(null). The current testing in > MOAT.java uses a collection with one element when testing > removeAll(null) and retainAll(null). So, I added code for the testing of > removeAll(null) and retainAll(null) with an empty collection, which is > the scenario for the behavior in the bug report. These are the changes > on lines 759 - 766, 775 - 782 of MOAT.java. > > 4. The added classes NewAbstractColection and NewAbstractSet were > intentionally written to be very basic and were inspired from the source > in the bug report. Is there a better way to write these classes or are > they ok as-is? > > 5. The changes to MOAT.java in this updated webrev result in more > classes that exhibit the same bug behavior described in this bug report > for AbstractCollection (no NPE thrown). These classes are: > java.util.ArrayList and java.util.concurrent.CopyOnWriteArrayList. > Should a new bug be filed for these cases? > > Thanks. > > > [1]: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-November/008283.html > > > > On 12/2/2011 2:34 AM, Alan Bateman wrote: >> On 01/12/2011 22:42, Brandon Passanisi wrote: >>> Hi Jason. Thanks for your response. I was thinking about how I can >>> improve the test using your suggestion. I could possibly do the >>> following: >>> >>> 1. Find all of the subclasses of AbstractCollection which override >>> removeAll(Collection) and which also contain the spec language >>> which specifies that NullPointerException is thrown if the specified >>> collection is null. >>> >>> 2. Find all of the subclasses of AbstractCollection which override >>> retainAll(Collection) and which also contain the spec language >>> which specifies that NullPointerException is thrown if the specified >>> collection is null. >>> >>> 3. Add the classes found in #1 and #2 to the test. >>> >>> 4. If any of the new classes added because of #3 result in a test >>> failure, it might be a good idea to file a new bug as Bug #4802647 >>> specifically mentions subclasses of AbstractCollection which do not >>> override remainAll, retainAll. >>> >>> 5. The public subclasses of AbstractCollection which do not override >>> removeAll, retainAll (probably) shouldn't be included in the test as >>> the currently existing NewAbstractCollection represents this scenario. >>> >>> What do you think? >>> >> Brandon - it's probably worth getting familiar with the existing >> tests, in in particular Martin's "Mother Of All Test" >> (Collection/MOAT.java). >> >> -Alan. > From Alan.Bateman at oracle.com Tue Dec 20 09:17:09 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 20 Dec 2011 09:17:09 +0000 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EEFD2D2.4090305@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, <4ED67166.7070303@oracle.com> <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com> <4EEF8824.7030500@oracle.com> <4EEFD2D2.4090305@oracle.com> Message-ID: <4EF05295.8010206@oracle.com> On 20/12/2011 00:12, David Holmes wrote: > Brandon, > > I don't see the purpose of NewAbstractSet. It is identical to > NewAbstractCollection. > > Otherwise my only concern is as you raised previously, updating the > test to check existing subclasses causes new failures for ArrayList > and CopyOnWriteArrayList. I'd suggest fixing ArrayList as part of this > CR and file a new CR for COWAL so that Doug Lea can fix it upstream in > the jsr166 cvs repository. Just to add to David's comments, if the change to COWAL/COWAS is separated into its own bug then it means that MOAT will need to skip the retainAll/removeAll(null) tests for these collections as we can't have this test (or any other) failing. -Alan. From masayoshi.okutsu at oracle.com Wed Dec 21 08:14:39 2011 From: masayoshi.okutsu at oracle.com (masayoshi.okutsu at oracle.com) Date: Wed, 21 Dec 2011 08:14:39 +0000 Subject: hg: jdk8/tl/jdk: 7122054: (tz) Windows-only: tzmappings needs update for KB2633952 Message-ID: <20111221081457.59EF647777@hg.openjdk.java.net> Changeset: 1c4fffa22930 Author: okutsu Date: 2011-12-21 17:09 +0900 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/1c4fffa22930 7122054: (tz) Windows-only: tzmappings needs update for KB2633952 Reviewed-by: peytoia ! src/windows/lib/tzmappings From michael.x.mcmahon at oracle.com Wed Dec 21 10:07:27 2011 From: michael.x.mcmahon at oracle.com (michael.x.mcmahon at oracle.com) Date: Wed, 21 Dec 2011 10:07:27 +0000 Subject: hg: jdk8/tl/jdk: 7078386: NetworkInterface.getNetworkInterfaces() may return corrupted results on linux Message-ID: <20111221100737.D926447778@hg.openjdk.java.net> Changeset: b1814b3ea6d3 Author: michaelm Date: 2011-12-21 10:06 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/b1814b3ea6d3 7078386: NetworkInterface.getNetworkInterfaces() may return corrupted results on linux Reviewed-by: michaelm, alanb, chegar Contributed-by: brandon.passanisi at oracle.com ! src/solaris/native/java/net/NetworkInterface.c From jason_mehrens at hotmail.com Wed Dec 21 15:52:37 2011 From: jason_mehrens at hotmail.com (Jason Mehrens) Date: Wed, 21 Dec 2011 09:52:37 -0600 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EEFD2D2.4090305@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>,,<4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, , <4ED67166.7070303@oracle.com>, , <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com>, <4EEF8824.7030500@oracle.com>, <4EEFD2D2.4090305@oracle.com> Message-ID: > Date: Tue, 20 Dec 2011 10:12:02 +1000 > From: david.holmes at oracle.com > To: brandon.passanisi at oracle.com > Subject: Re: Code Review Request for Bug #4802647 > CC: core-libs-dev at openjdk.java.net > > Brandon, > > I don't see the purpose of NewAbstractSet. It is identical to > NewAbstractCollection. I would assume the intent was "extends AbstractSet" instead of "extends NewAbstractCollection". Jason From brandon.passanisi at oracle.com Wed Dec 21 19:23:06 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Wed, 21 Dec 2011 11:23:06 -0800 Subject: Code Review Request for Bug #4802647 In-Reply-To: References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, , <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, , <4ED67166.7070303@oracle.com>, , <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com>, <4EEF8824.7030500@oracle.com>, <4EEFD2D2.4090305@oracle.com> Message-ID: <4EF2321A.2090004@oracle.com> Yes, my intent was "extends AbstractSet" instead of "extends NewAbstractCollection". I have reflected this in the updated webrev below. Here's the information: Webrev URL: http://cr.openjdk.java.net/~bpassani/4802647/2/webrev/ Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 1. In MOAT.java, I changed NewAbstractSet to extend AbstractSet. 2. The changes in 1) resulted in finding out that AbstractSet has the same bug behavior with removeAll(null). AbstractSet.removeAll(Collection c) was updated accordingly. 3. I filed bug 7123424 to account for the same bug behavior found in CopyOnWriteArrayList and CopyOnWriteArraySet. 4. It was advised that I skip the failing behavior of CopyOnWriteArrayList and CopyOnWriteArraySet for removeAll(null)/retainAll(null) in MOAT.java and provide a comment about how the skip needs to be removed once bug 7123424 is fixed. This is the reason for the instanceof checks that were recently added and the added comments. Thanks. On 12/21/2011 7:52 AM, Jason Mehrens wrote: > > Date: Tue, 20 Dec 2011 10:12:02 +1000 > > From: david.holmes at oracle.com > > To: brandon.passanisi at oracle.com > > Subject: Re: Code Review Request for Bug #4802647 > > CC: core-libs-dev at openjdk.java.net > > > > Brandon, > > > > I don't see the purpose of NewAbstractSet. It is identical to > > NewAbstractCollection. > > I would assume the intent was "extends AbstractSet" instead > of "extends NewAbstractCollection". > > Jason -- Oracle Brandon Passanisi | Principle Member of Technical Staff Green Oracle Oracle is committed to developing practices and products that help protect the environment From valerie.peng at oracle.com Wed Dec 21 22:22:12 2011 From: valerie.peng at oracle.com (valerie.peng at oracle.com) Date: Wed, 21 Dec 2011 22:22:12 +0000 Subject: hg: jdk8/tl/jdk: 6839886: Array overrun in pkcs11 Message-ID: <20111221222230.719CA47780@hg.openjdk.java.net> Changeset: a9dfdc523c2c Author: valeriep Date: 2011-12-21 14:08 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/a9dfdc523c2c 6839886: Array overrun in pkcs11 Summary: Fix the wrong value when dealing w/ month and day. Reviewed-by: mullan ! src/share/native/sun/security/pkcs11/wrapper/p11_convert.c From weijun.wang at oracle.com Thu Dec 22 07:37:41 2011 From: weijun.wang at oracle.com (weijun.wang at oracle.com) Date: Thu, 22 Dec 2011 07:37:41 +0000 Subject: hg: jdk8/tl/jdk: 7122169: TcpTimeout fail for various reasons Message-ID: <20111222073803.CAC204778C@hg.openjdk.java.net> Changeset: 11698dedbe79 Author: weijun Date: 2011-12-22 15:35 +0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/11698dedbe79 7122169: TcpTimeout fail for various reasons Reviewed-by: alanb ! test/sun/security/krb5/auto/TcpTimeout.java From alan.bateman at oracle.com Thu Dec 22 10:54:12 2011 From: alan.bateman at oracle.com (alan.bateman at oracle.com) Date: Thu, 22 Dec 2011 10:54:12 +0000 Subject: hg: jdk8/tl/jdk: 7076310: (file) AclEntry.Builder setFlags throws IllegalArgumentException if set argument is empty Message-ID: <20111222105450.9D90E4778F@hg.openjdk.java.net> Changeset: 559e07ed1f56 Author: alanb Date: 2011-12-22 10:52 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/559e07ed1f56 7076310: (file) AclEntry.Builder setFlags throws IllegalArgumentException if set argument is empty Reviewed-by: alanb Contributed-by: stephen.flores at oracle.com ! src/share/classes/java/nio/file/attribute/AclEntry.java + test/java/nio/file/attribute/AclEntry/EmptySet.java From gary.adams at oracle.com Thu Dec 22 15:08:52 2011 From: gary.adams at oracle.com (Gary Adams) Date: Thu, 22 Dec 2011 10:08:52 -0500 Subject: Code Review - CR #7114195 -Short timeouts on regression tests Message-ID: <4EF34804.50406@oracle.com> A number of regression tests have designated short timeouts and have been the cause of intermittent test failures on slow machines or on builds with slower runtime execution speeds, e.g. -Xcomp, etc. The jtreg regression harness uses 2 minutes as the default timeout value for forcing a test failure. http://openjdk.java.net/jtreg/tag-spec.txt Some tests designated less than 120 seconds as a preferred timeout value. This changeset removes timeouts set lower than the default jtreg limit. To accommodate slower configurations the harness is run with a 4x timeoutFactor from the default test makefile. jdk/test/Makefile JTREG_TIMEOUT_OPTION = -timeoutFactor:4 This ensures that slow machines are not terminated prematurely on automated regression test runs. Webrev at: http://cr.openjdk.java.net/~gadams/7114195/ From kumar.x.srinivasan at oracle.COM Fri Dec 23 02:22:16 2011 From: kumar.x.srinivasan at oracle.COM (Kumar Srinivasan) Date: Thu, 22 Dec 2011 18:22:16 -0800 Subject: Request for review: 7123582: (launcher) display the -version and -XshowSettings Message-ID: <4EF3E5D8.5000306@oracle.COM> Hi, This fixes a bug in launcher where showSettings in conjunction with -version will do both and exit successfully. Thanks to Sean for pointing this out. Here is the webrev: http://cr.openjdk.java.net/~ksrini/7123582/ Thanks Kumar From daniel.daugherty at oracle.com Fri Dec 23 02:38:36 2011 From: daniel.daugherty at oracle.com (daniel.daugherty at oracle.com) Date: Fri, 23 Dec 2011 02:38:36 +0000 Subject: hg: jdk8/tl/jdk: 7121600: Instrumentation.redefineClasses() leaks class bytes Message-ID: <20111223023853.7AC374779F@hg.openjdk.java.net> Changeset: 3c1ab134db71 Author: dcubed Date: 2011-12-22 18:35 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3c1ab134db71 7121600: Instrumentation.redefineClasses() leaks class bytes Summary: Call JNI ReleaseByteArrayElements() on memory returned by JNI GetByteArrayElements(). Also push test for 7122253. Reviewed-by: acorn, poonam ! src/share/instrument/JPLISAgent.c + test/java/lang/instrument/BigClass.java + test/java/lang/instrument/MakeJAR4.sh + test/java/lang/instrument/RedefineBigClass.sh + test/java/lang/instrument/RedefineBigClassAgent.java + test/java/lang/instrument/RedefineBigClassApp.java + test/java/lang/instrument/RetransformBigClass.sh + test/java/lang/instrument/RetransformBigClassAgent.java + test/java/lang/instrument/RetransformBigClassApp.java From kumar.x.srinivasan at oracle.COM Fri Dec 23 03:03:38 2011 From: kumar.x.srinivasan at oracle.COM (Kumar Srinivasan) Date: Thu, 22 Dec 2011 19:03:38 -0800 Subject: Please review: 7124443: (launcher) test DefaultsLocaleTest fails with Windows shells. Message-ID: <4EF3EF8A.4060808@oracle.COM> Hi, This fixes a perennial problem with the shell test and its interactions with MKS/Cygwin shells, by eliminating the shell test completely. http://cr.openjdk.java.net/~ksrini/7124443/webrev.0/ Thanks Kumar From joe.darcy at oracle.com Fri Dec 23 06:12:00 2011 From: joe.darcy at oracle.com (Joe Darcy) Date: Thu, 22 Dec 2011 22:12:00 -0800 Subject: Please review: 7124443: (launcher) test DefaultsLocaleTest fails with Windows shells. In-Reply-To: <4EF3EF8A.4060808@oracle.COM> References: <4EF3EF8A.4060808@oracle.COM> Message-ID: <4EF41BAF.1010305@oracle.com> Look fine Kumar, -Joe On 12/22/2011 7:03 PM, Kumar Srinivasan wrote: > Hi, > > This fixes a perennial problem with the shell test and its interactions > with MKS/Cygwin shells, by eliminating the shell test completely. > > http://cr.openjdk.java.net/~ksrini/7124443/webrev.0/ > > Thanks > Kumar From Alan.Bateman at oracle.com Fri Dec 23 09:51:33 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 23 Dec 2011 09:51:33 +0000 Subject: Code Review - CR #7114195 -Short timeouts on regression tests In-Reply-To: <4EF34804.50406@oracle.com> References: <4EF34804.50406@oracle.com> Message-ID: <4EF44F25.5070409@oracle.com> On 22/12/2011 15:08, Gary Adams wrote: > : > > Webrev at: > > http://cr.openjdk.java.net/~gadams/7114195/ > Dropping the /timeout from tests that specify <= 120s should be fine (and skimming through the patch, I don't see any issues). All it really means is that if the test hangs or deadlocks then it won't failed until the default timeout elapses. Many of these short timeouts were likely included when the test was originally created to make it quicker to test when running on a JDK without the corresponding fix. -Alan From Alan.Bateman at oracle.com Fri Dec 23 09:54:31 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 23 Dec 2011 09:54:31 +0000 Subject: Request for review: 7123582: (launcher) display the -version and -XshowSettings In-Reply-To: <4EF3E5D8.5000306@oracle.COM> References: <4EF3E5D8.5000306@oracle.COM> Message-ID: <4EF44FD7.60807@oracle.com> On 23/12/2011 02:22, Kumar Srinivasan wrote: > Hi, > > This fixes a bug in launcher where showSettings in conjunction with > -version > will do both and exit successfully. Thanks to Sean for pointing this out. > > Here is the webrev: > http://cr.openjdk.java.net/~ksrini/7123582/ > > Thanks > Kumar > Looks okay to me except in the test where runTest7123582 is named differently to the other run* methods in this test. -Alan From kumar.x.srinivasan at oracle.COM Fri Dec 23 14:36:24 2011 From: kumar.x.srinivasan at oracle.COM (Kumar Srinivasan) Date: Fri, 23 Dec 2011 06:36:24 -0800 Subject: Request for review: 7123582: (launcher) display the -version and -XshowSettings In-Reply-To: <4EF44FD7.60807@oracle.com> References: <4EF3E5D8.5000306@oracle.COM> <4EF44FD7.60807@oracle.com> Message-ID: <4EF491E8.9060401@oracle.COM> Alan, > On 23/12/2011 02:22, Kumar Srinivasan wrote: >> Hi, >> >> This fixes a bug in launcher where showSettings in conjunction with >> -version >> will do both and exit successfully. Thanks to Sean for pointing this >> out. >> >> Here is the webrev: >> http://cr.openjdk.java.net/~ksrini/7123582/ >> >> Thanks >> Kumar >> > Looks okay to me except in the test where runTest7123582 is named > differently to the other run* methods in this test. The others were part of the feature, but this one is a regression. These comprehensive tests become a pain in the future to determine when a particular method maps to a CR, so we tend to use a comment with CR in these places, but comments sometimes get lost when shuffling code around, by naming the method with a CR makes it self-explanatory. Kumar > > -Alan From gary.adams at oracle.com Fri Dec 23 16:19:24 2011 From: gary.adams at oracle.com (Gary Adams) Date: Fri, 23 Dec 2011 11:19:24 -0500 Subject: Code Review - CR# 7030573 insufficient disk space for large file test Message-ID: <4EF4AA0C.1010204@oracle.com> The LargeFileAvailable regression test had intermittent failures when there was not sufficient space available to create a 7G temp file. This webrev presents a simple check to see if the available usable space is less than 7G and scales the test back accordingly. The original bug report suggests that the test be switched to use the current working directory rather than a temp file. I think that could be the wrong choice for an embedded system that might have the tests mounted from a remote file system. In that scenario, using the local temp file space provides a better solution for what this test is designed to check. http://cr.openjdk.java.net/~gadams/7030573/ From brandon.passanisi at oracle.com Fri Dec 23 17:30:12 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Fri, 23 Dec 2011 09:30:12 -0800 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EF2321A.2090004@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, , <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, , <4ED67166.7070303@oracle.com>, , <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com>, <4EEF8824.7030500@oracle.com>, <4EEFD2D2.4090305@oracle.com> <4EF2321A.2090004@oracle.com> Message-ID: <4EF4BAA4.7060501@oracle.com> Here's an updated webrev for review for 4802647, which also contains a fix for 7123424. 7123424, as noted below, is the newly filed bug regarding the same bug behavior for CopyOnWriteArrayList and CopyOnWriteArraySet. It seems best to combine the fix for both into one webrev, so this webrev for review is a reflection of this: Webrev URL: http://cr.openjdk.java.net/~bpassani/4802647_7123424/3/webrev/ Thanks. On 12/21/2011 11:23 AM, Brandon Passanisi wrote: > Yes, my intent was "extends AbstractSet" instead of "extends > NewAbstractCollection". I have reflected this in the updated > webrev below. Here's the information: > > Webrev URL: http://cr.openjdk.java.net/~bpassani/4802647/2/webrev/ > Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 > > 1. In MOAT.java, I changed NewAbstractSet to extend AbstractSet. > > 2. The changes in 1) resulted in finding out that AbstractSet has the > same bug behavior with removeAll(null). > AbstractSet.removeAll(Collection c) was updated accordingly. > > 3. I filed bug 7123424 to account for the same bug behavior found in > CopyOnWriteArrayList and CopyOnWriteArraySet. > > 4. It was advised that I skip the failing behavior of > CopyOnWriteArrayList and CopyOnWriteArraySet for > removeAll(null)/retainAll(null) in MOAT.java and provide a comment > about how the skip needs to be removed once bug 7123424 is fixed. > This is the reason for the instanceof checks that were recently added > and the added comments. > > Thanks. > > On 12/21/2011 7:52 AM, Jason Mehrens wrote: >> > Date: Tue, 20 Dec 2011 10:12:02 +1000 >> > From: david.holmes at oracle.com >> > To: brandon.passanisi at oracle.com >> > Subject: Re: Code Review Request for Bug #4802647 >> > CC: core-libs-dev at openjdk.java.net >> > >> > Brandon, >> > >> > I don't see the purpose of NewAbstractSet. It is identical to >> > NewAbstractCollection. >> >> I would assume the intent was "extends AbstractSet" instead of >> "extends NewAbstractCollection". >> >> Jason > -- Oracle Brandon Passanisi | Principle Member of Technical Staff Green Oracle Oracle is committed to developing practices and products that help protect the environment From brandon.passanisi at oracle.com Fri Dec 23 19:12:40 2011 From: brandon.passanisi at oracle.com (Brandon Passanisi) Date: Fri, 23 Dec 2011 11:12:40 -0800 Subject: Code review request for #6469160, #7088271 Message-ID: <4EF4D2A8.9000305@oracle.com> Hello core-libs. I was wondering of somebody could be please review the following fix for #6469160 and #7088271. The changes in the webrev fix both bugs. Information is below: Webrev URL: http://cr.openjdk.java.net/~bpassani/6469160_7088271/1/ Bug #6469160: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6469160 Bug #7088271: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7088271 Both bugs uncover the current behavior where using a 0 or 1 precision value with a float zero causes an ArrayIndexOutOfBoundsException. The current code in FormattedFloatingDecimal.java interprets the float zero as "0.0" in the case where precision is 0 or 1 and returns the length of it's characters as 3. Later in Formatter.addZeros(), the character array "0.0" is passed in, but a new array of only 1 character is allocated. When an System.arraycopy() is performed, the ArrayIndexOutOfBoundsException occurs. In fact, when run with "-esa" an AssertionError occurs at "assert (outPrec <= prec);" on line 3393 of Formatter.java. The fix is for FormatedFloatingDecimal.java to interpret the float zero as a single "0" because of the precision being set to 0 or 1. Since java has been throwing exceptions in these cases, I consulted with the output of C's printf to make sure that the outputted strings are the same. I updated the Formatter's Basic-X template of tests with a little over 20 test format strings that were causing exceptions without the change and the output of each is compared with the output from C's printf with the same format string. And, I ran all of the Basic-X tests to make sure there weren't any regressions in behavior. Thanks. -- Oracle Brandon Passanisi | Principle Member of Technical Staff Green Oracle Oracle is committed to developing practices and products that help protect the environment From huizhe.wang at oracle.com Fri Dec 23 21:27:18 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Fri, 23 Dec 2011 13:27:18 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo Message-ID: <4EF4F236.3080200@oracle.com> Hi All, We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ Thanks, Joe From david.holmes at oracle.com Fri Dec 23 21:55:47 2011 From: david.holmes at oracle.com (David Holmes) Date: Sat, 24 Dec 2011 07:55:47 +1000 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EF4BAA4.7060501@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, , <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, , <4ED67166.7070303@oracle.com>, , <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com>, <4EEF8824.7030500@oracle.com>, <4EEFD2D2.4090305@oracle.com> <4EF2321A.2090004@oracle.com> <4EF4BAA4.7060501@oracle.com> Message-ID: <4EF4F8E3.5020408@oracle.com> Hi Brandon, This looks okay to me. Just to clarify for other readers, the change to CopyOnWriteArrayList doesn't use Objects.requireNonNull because this code has to sync up with Doug Lea's jsr166 repository which runs on multiple version of the platform (some without requireNonNull). Also CopyOnWriteArraySet is fixed implicitly by the fix to CopyOnWriteArrayList. David On 24/12/2011 3:30 AM, Brandon Passanisi wrote: > Here's an updated webrev for review for 4802647, which also contains a > fix for 7123424. 7123424, as noted below, is the newly filed bug > regarding the same bug behavior for CopyOnWriteArrayList and > CopyOnWriteArraySet. It seems best to combine the fix for both into one > webrev, so this webrev for review is a reflection of this: > > Webrev URL: > http://cr.openjdk.java.net/~bpassani/4802647_7123424/3/webrev/ > > Thanks. > > On 12/21/2011 11:23 AM, Brandon Passanisi wrote: >> Yes, my intent was "extends AbstractSet" instead of "extends >> NewAbstractCollection". I have reflected this in the updated webrev >> below. Here's the information: >> >> Webrev URL: http://cr.openjdk.java.net/~bpassani/4802647/2/webrev/ >> Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 >> >> 1. In MOAT.java, I changed NewAbstractSet to extend AbstractSet. >> >> 2. The changes in 1) resulted in finding out that AbstractSet has the >> same bug behavior with removeAll(null). >> AbstractSet.removeAll(Collection c) was updated accordingly. >> >> 3. I filed bug 7123424 to account for the same bug behavior found in >> CopyOnWriteArrayList and CopyOnWriteArraySet. >> >> 4. It was advised that I skip the failing behavior of >> CopyOnWriteArrayList and CopyOnWriteArraySet for >> removeAll(null)/retainAll(null) in MOAT.java and provide a comment >> about how the skip needs to be removed once bug 7123424 is fixed. This >> is the reason for the instanceof checks that were recently added and >> the added comments. >> >> Thanks. >> >> On 12/21/2011 7:52 AM, Jason Mehrens wrote: >>> > Date: Tue, 20 Dec 2011 10:12:02 +1000 >>> > From: david.holmes at oracle.com >>> > To: brandon.passanisi at oracle.com >>> > Subject: Re: Code Review Request for Bug #4802647 >>> > CC: core-libs-dev at openjdk.java.net >>> > >>> > Brandon, >>> > >>> > I don't see the purpose of NewAbstractSet. It is identical to >>> > NewAbstractCollection. >>> >>> I would assume the intent was "extends AbstractSet" instead of >>> "extends NewAbstractCollection". >>> >>> Jason >> > From omajid at redhat.com Fri Dec 23 22:11:17 2011 From: omajid at redhat.com (Omair Majid) Date: Fri, 23 Dec 2011 17:11:17 -0500 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EF4F236.3080200@oracle.com> References: <4EF4F236.3080200@oracle.com> Message-ID: <4EF4FC85.8060703@redhat.com> On 12/23/2011 04:27 PM, Joe Wang wrote: > Hi All, > > We have prepared a jaxp update for 7u4. The listed changes have been > posted to the jdk7u-dev alias with "7u4 Request for approval for CR > 7121110 - JAXP 1.4.5 update 1 for 7u4". > > With this update, we are adding jaxp sources back into the jdk7 > repository, which means we are abandoning the jaxp bundle download > process. This is a significant change. We'd like to hear if you have any > concerns. If no objection, we'd like to push the change within the next > week. > In the IcedTea project, we have found this split of jaxp (and jaxws) sources into a separate tarball to be problematic for patching. In fact, we have added the sources into the jaxp tree in the icedtea forest: http://blog.fuseyism.com/index.php/2011/09/29/icedtea7-2-0-pre-release/ So this merge happening in the 7u4 forest(s) is great news for us! However, if you are looking for feedback from the wider community, may I suggest waiting for a longer period? Many people are away on vacation during the next week due to Christmas and New Year holidays. Thanks, Omair From jonathan.gibbons at oracle.com Fri Dec 23 22:31:06 2011 From: jonathan.gibbons at oracle.com (jonathan.gibbons at oracle.com) Date: Fri, 23 Dec 2011 22:31:06 +0000 Subject: hg: jdk8/tl/langtools: 7124605: typos in javac comments Message-ID: <20111223223110.6FA47477CE@hg.openjdk.java.net> Changeset: 116f68a5e677 Author: jjg Date: 2011-12-23 22:30 +0000 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/116f68a5e677 7124605: typos in javac comments Reviewed-by: ksrini ! test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java ! test/tools/javac/generics/inference/7086601/T7086601b.java ! test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java ! test/tools/javac/lambda/LambdaParserTest.java From huizhe.wang at oracle.com Sat Dec 24 01:38:46 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Fri, 23 Dec 2011 17:38:46 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EF4FC85.8060703@redhat.com> References: <4EF4F236.3080200@oracle.com> <4EF4FC85.8060703@redhat.com> Message-ID: <4EF52D26.509@oracle.com> On 12/23/2011 2:11 PM, Omair Majid wrote: > On 12/23/2011 04:27 PM, Joe Wang wrote: >> Hi All, >> >> We have prepared a jaxp update for 7u4. The listed changes have been >> posted to the jdk7u-dev alias with "7u4 Request for approval for CR >> 7121110 - JAXP 1.4.5 update 1 for 7u4". >> >> With this update, we are adding jaxp sources back into the jdk7 >> repository, which means we are abandoning the jaxp bundle download >> process. This is a significant change. We'd like to hear if you have any >> concerns. If no objection, we'd like to push the change within the next >> week. >> > > In the IcedTea project, we have found this split of jaxp (and jaxws) > sources into a separate tarball to be problematic for patching. In > fact, we have added the sources into the jaxp tree in the icedtea forest: > http://blog.fuseyism.com/index.php/2011/09/29/icedtea7-2-0-pre-release/ > > So this merge happening in the 7u4 forest(s) is great news for us! Very glad to know. Hope this would go through and we'll have the same structure. > > However, if you are looking for feedback from the wider community, may > I suggest waiting for a longer period? Many people are away on > vacation during the next week due to Christmas and New Year holidays. You're right. Let's wait for a couple more weeks. Thanks, Joe > > Thanks, > Omair From kelly.ohair at oracle.com Sat Dec 24 16:56:41 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Sat, 24 Dec 2011 08:56:41 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EF4F236.3080200@oracle.com> References: <4EF4F236.3080200@oracle.com> Message-ID: Looks great to me. There is still the issue of making sure the right people (like you :^) are the ones patching this code, so we know what we have matches the public JAXP project. -kto On Dec 23, 2011, at 1:27 PM, Joe Wang wrote: > Hi All, > > We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". > > With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. > > The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ > > Thanks, > Joe From sebastian.sickelmann at gmx.de Mon Dec 26 09:39:16 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Mon, 26 Dec 2011 10:39:16 +0100 Subject: Request for Review: Consistent Behavior of Exceptions Chaining and CR 7081804 Message-ID: <4EF840C4.5030407@gmx.de> Hi, one week ago (2011-12-15) [0] i asked for the downsides of changing the legacy Exceptions in core-libs. There where only one answer from "/Weijun Wang" who said that there may be serialisation issues. I created a webrev[1] /with the suggested change and tests. The dumps inside the test directories are created with [3a,3b]. Don't know if there is the possibility to introduce such In/Outputstreams to corelibs as well. @Sean Mullan: I updated the webrev[2] for the change in javax/xml/crypto to fit the excact behavior [0] http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008721.html [1] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/LegacyExceptions/webrev_0/index.html [2] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7081804_9/index.html [3a] https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/main/DumpExceptions.java [3b] https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/util/HexDumpOutputstream.java From weijun.wang at oracle.com Mon Dec 26 11:38:20 2011 From: weijun.wang at oracle.com (Weijun Wang) Date: Mon, 26 Dec 2011 19:38:20 +0800 Subject: Request for Review: Consistent Behavior of Exceptions Chaining and CR 7081804 In-Reply-To: <4EF840C4.5030407@gmx.de> References: <4EF840C4.5030407@gmx.de> Message-ID: <4EF85CAC.9030201@oracle.com> On 12/26/2011 05:39 PM, Sebastian Sickelmann wrote: > Hi, > > one week ago (2011-12-15) [0] i asked for the downsides of changing > the legacy Exceptions in core-libs. There where only one answer from > "/Weijun Wang" who said that there may be serialisation issues. I With your current solution still using the cause field inside the child class, there is no serialisation issue at all. > created a webrev[1] /with the suggested change and tests. The dumps > inside the test directories are created with [3a,3b]. Don't know if > there is the possibility to introduce such In/Outputstreams to I'm not sure the HexInputStream class is a good idea. There are quite a lot of different HEX output format, with different headers, sometimes ":" between successive HEX numbers, etc, etc. If the class is only able to recognize your own HexOutputStream, it might not be very useful. As for the output side, I use HexDumpEncoder. Of course, it's not a stream and it's sun-internal... -Max > corelibs as well. @Sean Mullan: I updated the webrev[2] for the > change in javax/xml/crypto to fit the excact behavior > > > [0] > http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008721.html > > > [1] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/LegacyExceptions/webrev_0/index.html > > > [2] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7081804_9/index.html > > > [3a] > https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/main/DumpExceptions.java > > > [3b] > https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/util/HexDumpOutputstream.java > > From sebastian.sickelmann at gmx.de Mon Dec 26 16:25:12 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Mon, 26 Dec 2011 17:25:12 +0100 Subject: Request for Review: Chain more Exceptions on RuntimeException Message-ID: <4EF89FE8.5000406@gmx.de> For my Pre New Years Eve event[0] (Close simple open loops) i'am searching a sponsor for this change[1]. It introduces longer exception-chains while using RuntimeException. -- Sebastian [0] http://codingwizard.wordpress.com/2011/12/26/closing-simple-open-loops-to-new-years-eve/ [1] http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/RuntimeException/webrev_0/index.html From sebastian.sickelmann at gmx.de Mon Dec 26 16:28:44 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Mon, 26 Dec 2011 17:28:44 +0100 Subject: Request for Review: Chain more Exceptions on RuntimeException In-Reply-To: <4EF89FE8.5000406@gmx.de> References: <4EF89FE8.5000406@gmx.de> Message-ID: <4EF8A0BC.8050006@gmx.de> Am 26.12.2011 17:25, schrieb Sebastian Sickelmann: > For my Pre New Years Eve event[0] (Close simple open loops) > > i'am searching a sponsor for this change[1]. > > It introduces longer exception-chains while using RuntimeException. > > -- Sebastian > > [0] > http://codingwizard.wordpress.com/2011/12/26/closing-simple-open-loops-to-new-years-eve/ > [1] > http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/RuntimeException/webrev_0/index.html The webrev is still uploading to my dropbox. This could take some while. I am sorry. -- Sebastian From huizhe.wang at oracle.com Tue Dec 27 18:21:28 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Tue, 27 Dec 2011 10:21:28 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: References: <4EF4F236.3080200@oracle.com> Message-ID: <4EFA0CA8.2000204@oracle.com> Thanks Kelly! Indeed, that was the original intention when you designed the bundle process. Besides the unfortunate download problem, it actually works great in terms of guaranteeing that we have one single editable source. Next, maybe we could start to work on migrating the jaxp project source into the jdk. But it's the holiday season, we don't have to think too hard :). In the meantime, we just have to make sure patches are applied to the jaxp project first (through JIRA report for example) since that's how our dev/test process is set up. --Joe On 12/24/2011 8:56 AM, Kelly O'Hair wrote: > Looks great to me. > > There is still the issue of making sure the right people (like you :^) are the ones patching this code, so we know > what we have matches the public JAXP project. > > -kto > > On Dec 23, 2011, at 1:27 PM, Joe Wang wrote: > >> Hi All, >> >> We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". >> >> With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. >> >> The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ >> >> Thanks, >> Joe From sebastian.sickelmann at gmx.de Tue Dec 27 19:13:33 2011 From: sebastian.sickelmann at gmx.de (Sebastian Sickelmann) Date: Tue, 27 Dec 2011 20:13:33 +0100 Subject: Request for Review: Consistent Behavior of Exceptions Chaining and CR 7081804 In-Reply-To: <4EF85CAC.9030201@oracle.com> References: <4EF840C4.5030407@gmx.de> <4EF85CAC.9030201@oracle.com> Message-ID: <4EFA18DD.103@gmx.de> Am 26.12.2011 12:38, schrieb Weijun Wang: > > > On 12/26/2011 05:39 PM, Sebastian Sickelmann wrote: >> Hi, >> >> one week ago (2011-12-15) [0] i asked for the downsides of changing >> the legacy Exceptions in core-libs. There where only one answer from >> "/Weijun Wang" who said that there may be serialisation issues. I > > With your current solution still using the cause field inside the > child class, there is no serialisation issue at all. I had a solution (for javax/xml/crypto) that removes the field. But that was far to complex for this simple goal. In this solution i discussed with Alan Bateman how we can check that the serialized form in jdk8 can also be deserialized by jdk7 and prio. I came to the solution that we can diff the jdk7 diff and the jdk8 diff. And if it's equals, every thing is fine. There is one minor error in this assumption. I think there is a cutom-serialization-flag so that we cannot compare the serialization result binary. So i had the idea to compare hexdumps to make the compare more "sematically" and the kind of the difference more visible/readable. Haven't done that. If someone had another good idea who we can regression test serialization-compatibility (even backward) please let us/me know. > >> created a webrev[1] /with the suggested change and tests. The dumps >> inside the test directories are created with [3a,3b]. Don't know if >> there is the possibility to introduce such In/Outputstreams to > > I'm not sure the HexInputStream class is a good idea. There are quite > a lot of different HEX output format, with different headers, > sometimes ":" between successive HEX numbers, etc, etc. If the class > is only able to recognize your own HexOutputStream, it might not be > very useful. > > As for the output side, I use HexDumpEncoder. Of course, it's not a > stream and it's sun-internal... Fine didn't know HexDumpEncoder till now. I will change the output to HexDumpEncoders version and modify my HexDumpInputStream to an HexDumpDecoder. I think an HexDumpDecoder that can only manage the internal HexDumpEncoders dumps is reasonable for the regression tests. > > -Max > > >> corelibs as well. @Sean Mullan: I updated the webrev[2] for the >> change in javax/xml/crypto to fit the excact behavior >> >> >> [0] >> http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008721.html >> >> >> >> [1] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/LegacyExceptions/webrev_0/index.html >> >> >> >> [2] >> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7081804_9/index.html >> >> >> >> [3a] >> https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/main/DumpExceptions.java >> >> >> >> [3b] >> https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/util/HexDumpOutputstream.java >> >> >> From kelly.ohair at oracle.com Tue Dec 27 20:46:23 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Tue, 27 Dec 2011 12:46:23 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFA0CA8.2000204@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFA0CA8.2000204@oracle.com> Message-ID: <6FCC8768-5974-4926-BC9F-E5322536535A@oracle.com> In terms of monitoring the changes made to the jaxp sources, being in it's own repository makes that easy. You can easily scan the changesets made to the repository and see when strange changesets appear at http://hg.openjdk.java.net/jdk8/jdk8/jaxp If we folded the jaxp sources into the jdk repository, that becomes harder, but has other benefits which will probably become more apparent as the jigsaw project gets integrated. The other issue is how dependent the jaxp sources become on newer features in the jdk8 javac or apis. Historically, your jaxp sources had to stay back on the older Java api and language, not sure how that will change going forward, or if it will. Again, that's a little easier when it's part of the jdk repository where the new apis are in the same repository. But we can deal with that when the time comes. -kto On Dec 27, 2011, at 10:21 AM, Joe Wang wrote: > Thanks Kelly! > > Indeed, that was the original intention when you designed the bundle process. Besides the unfortunate download problem, it actually works great in terms of guaranteeing that we have one single editable source. > > Next, maybe we could start to work on migrating the jaxp project source into the jdk. But it's the holiday season, we don't have to think too hard :). In the meantime, we just have to make sure patches are applied to the jaxp project first (through JIRA report for example) since that's how our dev/test process is set up. > > --Joe > > On 12/24/2011 8:56 AM, Kelly O'Hair wrote: >> Looks great to me. >> >> There is still the issue of making sure the right people (like you :^) are the ones patching this code, so we know >> what we have matches the public JAXP project. >> >> -kto >> >> On Dec 23, 2011, at 1:27 PM, Joe Wang wrote: >> >>> Hi All, >>> >>> We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". >>> >>> With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. >>> >>> The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ >>> >>> Thanks, >>> Joe From huizhe.wang at oracle.com Wed Dec 28 01:24:51 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Tue, 27 Dec 2011 17:24:51 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <6FCC8768-5974-4926-BC9F-E5322536535A@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFA0CA8.2000204@oracle.com> <6FCC8768-5974-4926-BC9F-E5322536535A@oracle.com> Message-ID: <4EFA6FE3.4090407@oracle.com> For now, I'm only monitoring commits at jaxp-sources.java.net. I know I'll have to watch for more aliases once we put the sources in. For the past experiences though, there weren't that much interest in patching jaxp. We got only a couple through JIRA and jaxp issuetracker. JDK8 modularization would definitely complicate the source structure. We'll know better probably by March next year when we have done some work. The endorsed mechanism is the main reason we stayed back on the older Java API and language. Indeed, once we put the sources in the same repository, it's probably harder to resist the temptation of new features. We can evaluate when it comes. -Joe On 12/27/2011 12:46 PM, Kelly O'Hair wrote: > In terms of monitoring the changes made to the jaxp sources, being in it's own repository makes that easy. > You can easily scan the changesets made to the repository and see when strange changesets appear at > http://hg.openjdk.java.net/jdk8/jdk8/jaxp > > If we folded the jaxp sources into the jdk repository, that becomes harder, but has other benefits which will > probably become more apparent as the jigsaw project gets integrated. > > The other issue is how dependent the jaxp sources become on newer features in the jdk8 javac or apis. > Historically, your jaxp sources had to stay back on the older Java api and language, not sure how that > will change going forward, or if it will. Again, that's a little easier when it's part of the jdk repository where > the new apis are in the same repository. But we can deal with that when the time comes. > > -kto > > On Dec 27, 2011, at 10:21 AM, Joe Wang wrote: > >> Thanks Kelly! >> >> Indeed, that was the original intention when you designed the bundle process. Besides the unfortunate download problem, it actually works great in terms of guaranteeing that we have one single editable source. >> >> Next, maybe we could start to work on migrating the jaxp project source into the jdk. But it's the holiday season, we don't have to think too hard :). In the meantime, we just have to make sure patches are applied to the jaxp project first (through JIRA report for example) since that's how our dev/test process is set up. >> >> --Joe >> >> On 12/24/2011 8:56 AM, Kelly O'Hair wrote: >>> Looks great to me. >>> >>> There is still the issue of making sure the right people (like you :^) are the ones patching this code, so we know >>> what we have matches the public JAXP project. >>> >>> -kto >>> >>> On Dec 23, 2011, at 1:27 PM, Joe Wang wrote: >>> >>>> Hi All, >>>> >>>> We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". >>>> >>>> With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. >>>> >>>> The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ >>>> >>>> Thanks, >>>> Joe From weijun.wang at oracle.com Wed Dec 28 02:20:04 2011 From: weijun.wang at oracle.com (Weijun Wang) Date: Wed, 28 Dec 2011 10:20:04 +0800 Subject: Request for Review: Consistent Behavior of Exceptions Chaining and CR 7081804 In-Reply-To: <4EFA18DD.103@gmx.de> References: <4EF840C4.5030407@gmx.de> <4EF85CAC.9030201@oracle.com> <4EFA18DD.103@gmx.de> Message-ID: <4EFA7CD4.2030309@oracle.com> On 12/28/2011 03:13 AM, Sebastian Sickelmann wrote: > Am 26.12.2011 12:38, schrieb Weijun Wang: >> >> >> On 12/26/2011 05:39 PM, Sebastian Sickelmann wrote: >>> Hi, >>> >>> one week ago (2011-12-15) [0] i asked for the downsides of changing >>> the legacy Exceptions in core-libs. There where only one answer from >>> "/Weijun Wang" who said that there may be serialisation issues. I >> >> With your current solution still using the cause field inside the >> child class, there is no serialisation issue at all. > I had a solution (for javax/xml/crypto) that removes the field. But that > was far to complex for this simple goal. > In this solution i discussed with Alan Bateman how we can check that the > serialized form in jdk8 can also be deserialized by jdk7 and prio. > I came to the solution that we can diff the jdk7 diff and the jdk8 diff. > And if it's equals, every thing is fine. There is one minor error in this > assumption. I think there is a cutom-serialization-flag so that we > cannot compare the serialization result binary. So i had the idea to > compare hexdumps to make the compare more "sematically" and the kind of > the difference more visible/readable. Haven't done that. If someone had > another good idea who we can regression test serialization-compatibility > (even backward) please let us/me know. I don't think you can compare the binary or hexdump, maybe the order of 2 fields can change. (is that possible?) It should be OK if you can serialize with one version and deserialize with the other. Given that all your changes are made on methods and not fields and all classes already have their serialVer field, I don't think there is a possibility that the serialization format would change. I had a test on a similar case: http://hg.openjdk.java.net/jdk8/tl/jdk/file/3c1ab134db71/test/sun/security/util/Oid/S11N.sh It's based on my belief that computers inside the Oracle network should see all versions of Java on /java/re/... Until now, this is still correct here. > >> >>> created a webrev[1] /with the suggested change and tests. The dumps >>> inside the test directories are created with [3a,3b]. Don't know if >>> there is the possibility to introduce such In/Outputstreams to >> >> I'm not sure the HexInputStream class is a good idea. There are quite >> a lot of different HEX output format, with different headers, >> sometimes ":" between successive HEX numbers, etc, etc. If the class >> is only able to recognize your own HexOutputStream, it might not be >> very useful. >> >> As for the output side, I use HexDumpEncoder. Of course, it's not a >> stream and it's sun-internal... > Fine didn't know HexDumpEncoder till now. I will change the output to > HexDumpEncoders version and modify my HexDumpInputStream to an > HexDumpDecoder. I think an HexDumpDecoder that can only manage the > internal HexDumpEncoders dumps is reasonable for the regression tests. Why not just serialize the byte[] objects into an ObjectOutputStream? I know a lot of people don't like binary files in a test, but the cryptic hexdump is no better than that. Thanks Max > >> >> -Max >> >> >>> corelibs as well. @Sean Mullan: I updated the webrev[2] for the >>> change in javax/xml/crypto to fit the excact behavior >>> >>> >>> [0] >>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-December/008721.html >>> >>> >>> >>> [1] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/LegacyExceptions/webrev_0/index.html >>> >>> >>> >>> [2] >>> http://dl.dropbox.com/u/43692695/oss-patches/openjdk8/NoSuchMechanismException/7081804_9/index.html >>> >>> >>> >>> [3a] >>> https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/main/DumpExceptions.java >>> >>> >>> >>> [3b] >>> https://github.com/picpromusic/incubator/blob/master/misc/inc-utils/src/inc/util/HexDumpOutputstream.java >>> >>> >>> > From chris.hegarty at oracle.com Wed Dec 28 09:22:10 2011 From: chris.hegarty at oracle.com (chris hegarty) Date: Wed, 28 Dec 2011 09:22:10 +0000 Subject: Code Review Request for Bug #4802647 In-Reply-To: <4EF4F8E3.5020408@oracle.com> References: <4EC7049B.2090605@oracle.com> <4EC9B517.2010200@oracle.com>, , <4ECA986C.8090500@oracle.com> <4ECAE589.7050401@oracle.com>, , <4ED67166.7070303@oracle.com>, , <4ED802BD.3030407@oracle.com> <4ED8A9A0.3000808@oracle.com>, <4EEF8824.7030500@oracle.com>, <4EEFD2D2.4090305@oracle.com> <4EF2321A.2090004@oracle.com> <4EF4BAA4.7060501@oracle.com> <4EF4F8E3.5020408@oracle.com> Message-ID: <4EFADFC2.3000809@oracle.com> On 23/12/2011 21:55, David Holmes wrote: > Hi Brandon, > > This looks okay to me. Thumbs up from me too. -Chris. > Just to clarify for other readers, the change to CopyOnWriteArrayList > doesn't use Objects.requireNonNull because this code has to sync up with > Doug Lea's jsr166 repository which runs on multiple version of the > platform (some without requireNonNull). > > Also CopyOnWriteArraySet is fixed implicitly by the fix to > CopyOnWriteArrayList. > > David > > On 24/12/2011 3:30 AM, Brandon Passanisi wrote: >> Here's an updated webrev for review for 4802647, which also contains a >> fix for 7123424. 7123424, as noted below, is the newly filed bug >> regarding the same bug behavior for CopyOnWriteArrayList and >> CopyOnWriteArraySet. It seems best to combine the fix for both into one >> webrev, so this webrev for review is a reflection of this: >> >> Webrev URL: >> http://cr.openjdk.java.net/~bpassani/4802647_7123424/3/webrev/ >> >> Thanks. >> >> On 12/21/2011 11:23 AM, Brandon Passanisi wrote: >>> Yes, my intent was "extends AbstractSet" instead of "extends >>> NewAbstractCollection". I have reflected this in the updated webrev >>> below. Here's the information: >>> >>> Webrev URL: http://cr.openjdk.java.net/~bpassani/4802647/2/webrev/ >>> Bug URL: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4802647 >>> >>> 1. In MOAT.java, I changed NewAbstractSet to extend AbstractSet. >>> >>> 2. The changes in 1) resulted in finding out that AbstractSet has the >>> same bug behavior with removeAll(null). >>> AbstractSet.removeAll(Collection c) was updated accordingly. >>> >>> 3. I filed bug 7123424 to account for the same bug behavior found in >>> CopyOnWriteArrayList and CopyOnWriteArraySet. >>> >>> 4. It was advised that I skip the failing behavior of >>> CopyOnWriteArrayList and CopyOnWriteArraySet for >>> removeAll(null)/retainAll(null) in MOAT.java and provide a comment >>> about how the skip needs to be removed once bug 7123424 is fixed. This >>> is the reason for the instanceof checks that were recently added and >>> the added comments. >>> >>> Thanks. >>> >>> On 12/21/2011 7:52 AM, Jason Mehrens wrote: >>>> > Date: Tue, 20 Dec 2011 10:12:02 +1000 >>>> > From: david.holmes at oracle.com >>>> > To: brandon.passanisi at oracle.com >>>> > Subject: Re: Code Review Request for Bug #4802647 >>>> > CC: core-libs-dev at openjdk.java.net >>>> > >>>> > Brandon, >>>> > >>>> > I don't see the purpose of NewAbstractSet. It is identical to >>>> > NewAbstractCollection. >>>> >>>> I would assume the intent was "extends AbstractSet" instead of >>>> "extends NewAbstractCollection". >>>> >>>> Jason >>> >> From Alan.Bateman at oracle.com Wed Dec 28 10:56:07 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 28 Dec 2011 10:56:07 +0000 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EF4F236.3080200@oracle.com> References: <4EF4F236.3080200@oracle.com> Message-ID: <4EFAF5C7.90509@oracle.com> On 23/12/2011 21:27, Joe Wang wrote: > Hi All, > > We have prepared a jaxp update for 7u4. The listed changes have been > posted to the jdk7u-dev alias with "7u4 Request for approval for CR > 7121110 - JAXP 1.4.5 update 1 for 7u4". > > With this update, we are adding jaxp sources back into the jdk7 > repository, which means we are abandoning the jaxp bundle download > process. This is a significant change. We'd like to hear if you have > any concerns. If no objection, we'd like to push the change within > the next week. > > The webrev is here: > http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ This is good news. So what about jdk8? I think the protocol with 7u is that changes go into 8 first. Also are you expecting to keep the code in 7u and 8 in sync? -Alan. From huizhe.wang at oracle.com Wed Dec 28 17:18:44 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Wed, 28 Dec 2011 09:18:44 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFAF5C7.90509@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFAF5C7.90509@oracle.com> Message-ID: <4EFB4F74.9010809@oracle.com> On 12/28/2011 2:56 AM, Alan Bateman wrote: > On 23/12/2011 21:27, Joe Wang wrote: >> Hi All, >> >> We have prepared a jaxp update for 7u4. The listed changes have been >> posted to the jdk7u-dev alias with "7u4 Request for approval for CR >> 7121110 - JAXP 1.4.5 update 1 for 7u4". >> >> With this update, we are adding jaxp sources back into the jdk7 >> repository, which means we are abandoning the jaxp bundle download >> process. This is a significant change. We'd like to hear if you have >> any concerns. If no objection, we'd like to push the change within >> the next week. >> >> The webrev is here: >> http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ > This is good news. So what about jdk8? I think the protocol with 7u is > that changes go into 8 first. Also are you expecting to keep the code > in 7u and 8 in sync? Kelly asked for 6-open and jdk8 as well. Since we're changing the jaxp bundle process, we thought we would do the same for 6-open and jdk8 once this works out. But we can take the change to jdk8 first if this is approved. The only question I had was that the jdk8 modularization would change the jaxp source structure. But Kelly thought that's not a problem. I guess we don't mind another big changeset :) -Joe > > -Alan. From gary.adams at oracle.com Wed Dec 28 18:00:51 2011 From: gary.adams at oracle.com (Gary Adams) Date: Wed, 28 Dec 2011 13:00:51 -0500 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFB4F74.9010809@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFAF5C7.90509@oracle.com> <4EFB4F74.9010809@oracle.com> Message-ID: <4EFB5953.7070901@oracle.com> I see in the webrev the removal of drops.dir from the ant build.xml. Should similar updates be applied to README-builds.html for ALT_DROPS_DIR and ALLOW_DOWNLOADS? Might be good to put a note in $(ALT_JDK_DEVTOOLS_PATH)/share/jdk8-drops indicating the files are now include directly in the jdk8 repos. On 12/28/11 12:18 PM, Joe Wang wrote: > On 12/28/2011 2:56 AM, Alan Bateman wrote: >> On 23/12/2011 21:27, Joe Wang wrote: >>> Hi All, >>> >>> We have prepared a jaxp update for 7u4. The listed changes have been posted >>> to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP >>> 1.4.5 update 1 for 7u4". >>> >>> With this update, we are adding jaxp sources back into the jdk7 repository, >>> which means we are abandoning the jaxp bundle download process. This is a >>> significant change. We'd like to hear if you have any concerns. If no >>> objection, we'd like to push the change within the next week. >>> >>> The webrev is here: >>> http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ >> This is good news. So what about jdk8? I think the protocol with 7u is that >> changes go into 8 first. Also are you expecting to keep the code in 7u and 8 >> in sync? > Kelly asked for 6-open and jdk8 as well. Since we're changing the jaxp bundle > process, we thought we would do the same for 6-open and jdk8 once this works > out. But we can take the change to jdk8 first if this is approved. The only > question I had was that the jdk8 modularization would change the jaxp source > structure. But Kelly thought that's not a problem. I guess we don't mind > another big changeset :) > > -Joe > >> >> -Alan. From lana.steuck at oracle.com Wed Dec 28 19:59:19 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:19 +0000 Subject: hg: jdk8/tl: 2 new changesets Message-ID: <20111228195919.EEA77477F0@hg.openjdk.java.net> Changeset: e1fc13802e0c Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/e1fc13802e0c Added tag jdk8-b18 for changeset 7010bd24cdd0 ! .hgtags Changeset: 237bc29afbfc Author: lana Date: 2011-12-23 16:36 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/rev/237bc29afbfc Merge From lana.steuck at oracle.com Wed Dec 28 19:59:21 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:21 +0000 Subject: hg: jdk8/tl/corba: 2 new changesets Message-ID: <20111228195925.38AD7477F1@hg.openjdk.java.net> Changeset: 46bd4a46a5a8 Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/46bd4a46a5a8 Added tag jdk8-b18 for changeset 312cf15d1657 ! .hgtags Changeset: e1366c5d84ef Author: lana Date: 2011-12-23 16:36 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/e1366c5d84ef Merge From lana.steuck at oracle.com Wed Dec 28 19:59:26 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:26 +0000 Subject: hg: jdk8/tl/jaxp: 2 new changesets Message-ID: <20111228195926.7985F477F2@hg.openjdk.java.net> Changeset: 5fb25931f1c2 Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/5fb25931f1c2 Added tag jdk8-b18 for changeset ebec6a7e8d4e ! .hgtags Changeset: dffeb62b1a7f Author: lana Date: 2011-12-23 16:36 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxp/rev/dffeb62b1a7f Merge From lana.steuck at oracle.com Wed Dec 28 19:59:31 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:31 +0000 Subject: hg: jdk8/tl/jaxws: 2 new changesets Message-ID: <20111228195931.27618477F3@hg.openjdk.java.net> Changeset: 72d410c3bab1 Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/72d410c3bab1 Added tag jdk8-b18 for changeset 54928c8850f5 ! .hgtags Changeset: b73b733214aa Author: lana Date: 2011-12-23 16:36 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jaxws/rev/b73b733214aa Merge From lana.steuck at oracle.com Wed Dec 28 19:59:35 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:35 +0000 Subject: hg: jdk8/tl/langtools: 3 new changesets Message-ID: <20111228195945.CC371477F4@hg.openjdk.java.net> Changeset: 3c71fcc22b99 Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/3c71fcc22b99 Added tag jdk8-b18 for changeset ab1b1cc78577 ! .hgtags Changeset: 77b2c066084c Author: lana Date: 2011-12-23 16:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/77b2c066084c Merge - src/share/classes/com/sun/tools/javac/main/JavacOption.java - src/share/classes/com/sun/tools/javac/main/OptionName.java - src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Changeset: 67512b631961 Author: lana Date: 2011-12-28 10:52 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/langtools/rev/67512b631961 Merge From lana.steuck at oracle.com Wed Dec 28 19:59:56 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 19:59:56 +0000 Subject: hg: jdk8/tl/hotspot: 70 new changesets Message-ID: <20111228200221.83B0B477F5@hg.openjdk.java.net> Changeset: da4182086289 Author: jcoomes Date: 2011-11-18 17:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/da4182086289 7113503: Bump the hs23 build number to 07 Reviewed-by: johnc Contributed-by: alejandro.murillo at oracle.com ! make/hotspot_version Changeset: 36b057451829 Author: dholmes Date: 2011-11-16 20:38 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/36b057451829 7110017: is_headless_jre should be updated to reflect the new location of awt toolkit libraries Reviewed-by: dholmes, dsamersoff Contributed-by: Chris Hegarty ! src/os/bsd/vm/os_bsd.cpp ! src/os/linux/vm/os_linux.cpp ! src/os/solaris/vm/os_solaris.cpp Changeset: 002cb3fc8256 Author: coleenp Date: 2011-11-18 17:26 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/002cb3fc8256 Merge Changeset: c17bc65648de Author: brutisso Date: 2011-11-21 08:02 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/c17bc65648de 7112308: Fix Visual Studio build for precompiled header Summary: Add the new path to precompiled.hpp in the project make file Reviewed-by: coleenp, dholmes, brutisso Contributed-by: rbackman ! make/windows/makefiles/projectcreator.make Changeset: 1d090cf33da6 Author: coleenp Date: 2011-11-21 10:22 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/1d090cf33da6 Merge Changeset: 242b4e0e6f73 Author: phh Date: 2011-11-29 09:21 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/242b4e0e6f73 7116189: Export JVM_SetNativeThreadName from Hotspot Summary: Added JVM_SetNativeThreadName to linker mapfiles on Solaris and Linux. Reviewed-by: dcubed, dholmes Contributed-by: michael.x.mcmahon at oracle.com ! make/linux/makefiles/mapfile-vers-debug ! make/linux/makefiles/mapfile-vers-product ! make/solaris/makefiles/mapfile-vers Changeset: 763f01599ff4 Author: phh Date: 2011-11-29 17:00 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/763f01599ff4 7116481: Commercial features in Hotspot must be gated by a switch Summary: Add -XX:+UnlockCommercialVMOptions to gate use of commercial feature switches in the same way as -XX:UnlockDiagnosticVMOptions gates use of diagnostic feature switches. Reviewed-by: jwilhelm, kamg ! src/share/vm/runtime/globals.cpp ! src/share/vm/runtime/globals.hpp ! src/share/vm/runtime/globals_extension.hpp Changeset: 358eca91be48 Author: phh Date: 2011-11-30 12:48 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/358eca91be48 7116730: Revert 7116481: Commercial features in Hotspot must be gated by a switch Summary: Revert 7116481 to current hsx/hotspot-main Reviewed-by: kamg ! src/share/vm/runtime/globals.cpp ! src/share/vm/runtime/globals.hpp ! src/share/vm/runtime/globals_extension.hpp Changeset: 81a08cd7f6a1 Author: coleenp Date: 2011-12-01 13:42 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/81a08cd7f6a1 Merge Changeset: a88de71c4e3a Author: tonyp Date: 2011-11-18 12:52 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/a88de71c4e3a 7097002: G1: remove a lot of unused / redundant code from the G1CollectorPolicy class Summary: Major cleanup of the G1CollectorPolicy class. It removes a lot of unused fields and methods and also consolidates replicated information (mainly various ways of counting the number of CSet regions) into one copy. Reviewed-by: johnc, brutisso ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp ! src/share/vm/gc_implementation/g1/g1RemSet.cpp ! src/share/vm/gc_implementation/g1/g1_globals.hpp Changeset: d06a2d7fcd5b Author: brutisso Date: 2011-11-21 07:47 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/d06a2d7fcd5b 7110718: -XX:MarkSweepAlwaysCompactCount=0 crashes the JVM Summary: Interpret MarkSweepAlwaysCompactCount < 1 as never do full compaction Reviewed-by: ysr, tonyp, jmasa, johnc ! src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp ! src/share/vm/memory/space.hpp Changeset: b5a5f30c483d Author: johnc Date: 2011-11-21 09:24 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/b5a5f30c483d 7110173: GCNotifier::pushNotification publishes stale data. Summary: GCNotifier::pushNotification() references GCMemoryManager::_last_gc_stat but is called from GCMemoryManager::gc_end() before GCMemoryManager::_last_gc_stat is set up using the values in GCMemoryManager::_current_gc_stat. As a result the GC notification code accesses unitialized or stale data. Move the notification call after GCMemoryManager::_las_gc_stat is set, but inside the same if-block. Reviewed-by: poonam, dholmes, fparain, mchung ! src/share/vm/services/memoryManager.cpp Changeset: 6071e0581859 Author: johnc Date: 2011-11-18 12:27 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/6071e0581859 7111795: G1: Various cleanups identified during walk through of changes for 6484965 Summary: Various cleanups and formatting changes identified during a code walk through of the changes for 6484965 ("G1: piggy-back liveness accounting phase on marking"). Reviewed-by: brutisso, tonyp ! src/share/vm/gc_implementation/g1/concurrentMark.cpp ! src/share/vm/gc_implementation/g1/heapRegion.hpp Changeset: 3a298e04d914 Author: tonyp Date: 2011-11-22 04:47 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/3a298e04d914 Merge Changeset: bca17e38de00 Author: jmasa Date: 2011-08-09 10:16 -0700 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/bca17e38de00 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads Summary: Select number of GC threads dynamically based on heap usage and number of Java threads Reviewed-by: johnc, ysr, jcoomes ! src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ! src/share/vm/gc_implementation/g1/collectionSetChooser.cpp ! src/share/vm/gc_implementation/g1/concurrentMark.cpp ! src/share/vm/gc_implementation/g1/concurrentMark.hpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp ! src/share/vm/gc_implementation/g1/g1RemSet.cpp ! src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp ! src/share/vm/gc_implementation/parNew/parNewGeneration.cpp ! src/share/vm/gc_implementation/parNew/parNewGeneration.hpp ! src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp ! src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp ! src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp ! src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.hpp ! src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp ! src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp ! src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp ! src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp ! src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ! src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp ! src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp ! src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp ! src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp ! src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp ! src/share/vm/memory/cardTableModRefBS.cpp ! src/share/vm/memory/cardTableRS.cpp ! src/share/vm/memory/sharedHeap.cpp ! src/share/vm/memory/sharedHeap.hpp ! src/share/vm/runtime/arguments.cpp ! src/share/vm/runtime/globals.hpp ! src/share/vm/runtime/thread.cpp ! src/share/vm/utilities/workgroup.cpp ! src/share/vm/utilities/workgroup.hpp ! src/share/vm/utilities/yieldingWorkgroup.cpp ! src/share/vm/utilities/yieldingWorkgroup.hpp Changeset: 00dd86e542eb Author: johnc Date: 2011-11-28 09:49 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/00dd86e542eb 7114303: G1: assert(_g1->mark_in_progress()) failed: shouldn't be here otherwise Summary: Race between the VM thread reading G1CollectedHeap::_mark_in_progress and it being set by the concurrent mark thread when concurrent marking is aborted by a full GC. Have the concurrent mark thread join the SuspendibleThreadSet before changing the marking state. Reviewed-by: tonyp, brutisso ! src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Changeset: dc467e8b2c5e Author: johnc Date: 2011-11-17 12:40 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/dc467e8b2c5e 7112743: G1: Reduce overhead of marking closure during evacuation pauses Summary: Parallelize the serial code that was used to mark objects reachable from survivor objects in the collection set. Some minor improvments in the timers used to track the freeing of the collection set along with some tweaks to PrintGCDetails. Reviewed-by: tonyp, brutisso ! src/share/vm/gc_implementation/g1/concurrentMark.cpp ! src/share/vm/gc_implementation/g1/concurrentMark.hpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp ! src/share/vm/gc_implementation/g1/g1RemSet.cpp ! src/share/vm/gc_implementation/g1/g1RemSet.hpp ! src/share/vm/gc_implementation/g1/heapRegion.hpp ! src/share/vm/oops/objArrayOop.hpp Changeset: ea640b5e949a Author: jmasa Date: 2011-11-22 14:18 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/ea640b5e949a 7106024: CMS: Removed unused code for precleaning in remark phase Summary: Remove dead code. Reviewed-by: stefank, ysr ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ! src/share/vm/memory/cardTableModRefBS.cpp ! src/share/vm/memory/cardTableModRefBS.hpp Changeset: 7913e93dca52 Author: jmasa Date: 2011-11-22 14:59 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/7913e93dca52 7112997: Remove obsolete code ResetObjectsClosure and VerifyUpdateClosure Summary: Remove obsolete code. Reviewed-by: brutisso, ysr, jcoomes ! src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp ! src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp ! src/share/vm/gc_implementation/shared/markSweep.hpp ! src/share/vm/gc_implementation/shared/markSweep.inline.hpp Changeset: 1bbf5b6fb7b0 Author: tonyp Date: 2011-12-02 08:52 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/1bbf5b6fb7b0 Merge ! src/share/vm/runtime/globals.hpp Changeset: 6de8c9ba5907 Author: jcoomes Date: 2011-12-02 15:11 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/6de8c9ba5907 Merge Changeset: aed8bf036ce2 Author: jcoomes Date: 2011-12-02 15:11 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/aed8bf036ce2 Added tag hs23-b07 for changeset 6de8c9ba5907 ! .hgtags Changeset: cf4dd13bbcd3 Author: jcoomes Date: 2011-12-02 21:10 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/cf4dd13bbcd3 7117536: new hotspot build - hs23-b08 Reviewed-by: johnc ! make/hotspot_version Changeset: cd00eaeebef6 Author: phh Date: 2011-12-05 12:50 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/cd00eaeebef6 7117389: Add a framework for vendor-specific command line switch extensions to Hotspot Summary: Add a file, globals_ext.hpp, containing a null interface, to be replaced by a vendor in altsrc as needed. Reviewed-by: coleenp, kamg, dholmes, johnc, jrose ! src/share/vm/runtime/globals.cpp ! src/share/vm/runtime/globals.hpp + src/share/vm/runtime/globals_ext.hpp ! src/share/vm/runtime/globals_extension.hpp Changeset: 8657ec177a14 Author: dcubed Date: 2011-12-05 14:55 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/8657ec177a14 7117748: SA_APPLE_BOOT_JAVA and ALWAYS_PASS_TEST_GAMMA settings should not be required on MacOS X Summary: Replace SA_APPLE_BOOT_JAVA with logic that checks the boot JDK for the location of JDI classes. ALWAYS_PASS_TEST_GAMMA is true by default on Darwin. Reviewed-by: kvn, swingler ! make/bsd/makefiles/buildtree.make ! make/bsd/makefiles/sa.make Changeset: 41cce03b29a8 Author: dcubed Date: 2011-12-06 05:28 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/41cce03b29a8 Merge Changeset: 03865c41c4f3 Author: vladidan Date: 2011-12-06 16:35 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/03865c41c4f3 Merge ! src/share/vm/runtime/globals.hpp Changeset: 55d777c0860a Author: dcubed Date: 2011-12-07 07:27 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/55d777c0860a 7118648: disable compressed oops by default on MacOS X until 7118647 is fixed Summary: UseCompressedOops is false by default on MacOS X; can still be set manually Reviewed-by: jmelvin, kvn, dholmes ! src/share/vm/runtime/arguments.cpp Changeset: e8fdaf4a66cb Author: kvn Date: 2011-11-10 20:17 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/e8fdaf4a66cb 7110586: C2 generates incorrect results Summary: Exact limit of empty loop calculated incorrectly. Reviewed-by: iveresov, never ! src/share/vm/opto/loopnode.cpp + test/compiler/7110586/Test7110586.java Changeset: 8c57262447d3 Author: kvn Date: 2011-11-14 18:38 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/8c57262447d3 7105605: Use EA info to optimize pointers compare Summary: optimize pointers compare using EA information. Reviewed-by: never, twisti ! src/share/vm/opto/c2_globals.hpp ! src/share/vm/opto/cfgnode.cpp ! src/share/vm/opto/escape.cpp ! src/share/vm/opto/escape.hpp Changeset: 6729bbc1fcd6 Author: twisti Date: 2011-11-16 01:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/6729bbc1fcd6 7003454: order constants in constant table by number of references in code Reviewed-by: kvn, never, bdelsart ! src/cpu/sparc/vm/assembler_sparc.hpp ! src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp ! src/cpu/sparc/vm/methodHandles_sparc.cpp ! src/cpu/sparc/vm/sharedRuntime_sparc.cpp ! src/cpu/sparc/vm/sparc.ad ! src/cpu/sparc/vm/vtableStubs_sparc.cpp ! src/cpu/x86/vm/assembler_x86.hpp ! src/cpu/x86/vm/stubGenerator_x86_64.cpp ! src/cpu/x86/vm/x86_32.ad ! src/cpu/x86/vm/x86_64.ad ! src/share/vm/adlc/adlparse.cpp ! src/share/vm/adlc/output_c.cpp ! src/share/vm/asm/assembler.hpp ! src/share/vm/opto/compile.cpp ! src/share/vm/opto/compile.hpp ! src/share/vm/opto/machnode.cpp ! src/share/vm/opto/matcher.hpp Changeset: 1bd45abaa507 Author: kvn Date: 2011-11-16 09:13 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/1bd45abaa507 6890673: Eliminate allocations immediately after EA Summary: Try to eliminate allocations and related locks immediately after escape analysis. Reviewed-by: never ! src/share/vm/opto/block.cpp ! src/share/vm/opto/callnode.cpp ! src/share/vm/opto/callnode.hpp ! src/share/vm/opto/compile.cpp ! src/share/vm/opto/escape.cpp ! src/share/vm/opto/gcm.cpp ! src/share/vm/opto/loopnode.cpp ! src/share/vm/opto/macro.cpp ! src/share/vm/opto/macro.hpp ! src/share/vm/opto/memnode.cpp ! src/share/vm/opto/memnode.hpp Changeset: 973293defacd Author: iveresov Date: 2011-11-16 19:42 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/973293defacd 7112085: assert(fr.interpreter_frame_expression_stack_size()==0) failed: only handle empty stacks Summary: Move the inlinee invoke notification callback into inlinee preamble Reviewed-by: kvn, never ! src/share/vm/c1/c1_GraphBuilder.cpp ! src/share/vm/c1/c1_Instruction.hpp ! src/share/vm/c1/c1_LIRGenerator.cpp ! src/share/vm/runtime/simpleThresholdPolicy.cpp ! src/share/vm/runtime/simpleThresholdPolicy.hpp ! test/compiler/6792161/Test6792161.java Changeset: a04a201f0f5a Author: twisti Date: 2011-11-17 04:07 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/a04a201f0f5a 7108383: JSR 292: JRuby bench_define_method_methods.rb: assert(slow_jvms != NULL) failed: miss path must not Reviewed-by: kvn, never ! src/share/vm/ci/ciMethod.hpp ! src/share/vm/opto/callGenerator.cpp ! src/share/vm/opto/callGenerator.hpp ! src/share/vm/opto/doCall.cpp Changeset: 59bc0d4d9ea3 Author: never Date: 2011-11-18 10:29 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/59bc0d4d9ea3 7110489: C1: 64-bit tiered with ForceUnreachable: assert(reachable(src)) failed: Address should be reachable Reviewed-by: kvn, iveresov, twisti ! src/cpu/x86/vm/assembler_x86.cpp ! src/cpu/x86/vm/methodHandles_x86.hpp ! src/cpu/x86/vm/stubGenerator_x86_64.cpp Changeset: 7793051af7d6 Author: twisti Date: 2011-11-21 00:57 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/7793051af7d6 7110058: change default for ScavengeRootsInCode to 2 Reviewed-by: kvn, never ! src/share/vm/runtime/globals.hpp Changeset: f03a3c8bd5e5 Author: roland Date: 2011-09-14 09:22 +0200 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/f03a3c8bd5e5 7077312: Provide a CALL effect for instruct declaration in the ad file Summary: abstracted way to declare that the MachNode has the effect of a call (kills caller save registers, preserves callee save registers) Reviewed-by: twisti, never ! src/share/vm/adlc/adlparse.cpp ! src/share/vm/adlc/adlparse.hpp ! src/share/vm/adlc/archDesc.cpp ! src/share/vm/adlc/formssel.cpp ! src/share/vm/adlc/formssel.hpp ! src/share/vm/adlc/output_h.cpp ! src/share/vm/opto/block.hpp ! src/share/vm/opto/idealGraphPrinter.cpp ! src/share/vm/opto/lcm.cpp ! src/share/vm/opto/machnode.hpp ! src/share/vm/opto/node.hpp Changeset: db2e64ca2d5a Author: roland Date: 2011-11-22 09:45 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/db2e64ca2d5a 7090968: Allow adlc register class to depend on runtime conditions Summary: allow reg_class definition as a function. Reviewed-by: kvn, never ! src/cpu/sparc/vm/sparc.ad ! src/cpu/x86/vm/x86_32.ad ! src/cpu/x86/vm/x86_64.ad ! src/share/vm/adlc/adlparse.cpp ! src/share/vm/adlc/archDesc.cpp ! src/share/vm/adlc/formsopt.cpp ! src/share/vm/adlc/formsopt.hpp ! src/share/vm/adlc/output_c.cpp ! src/share/vm/opto/matcher.hpp Changeset: cc81b9c09bbb Author: kvn Date: 2011-11-28 15:46 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/cc81b9c09bbb 7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE Summary: Fixed several EA issues with Connection Graph construction. Reviewed-by: never, twisti ! src/share/vm/ci/bcEscapeAnalyzer.cpp ! src/share/vm/ci/bcEscapeAnalyzer.hpp ! src/share/vm/compiler/compileBroker.cpp ! src/share/vm/opto/escape.cpp ! src/share/vm/opto/escape.hpp Changeset: 97825a4f7369 Author: iveresov Date: 2011-11-30 17:35 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/97825a4f7369 7116795: Tiered: enable by default for server Summary: Enable tiered compilation on server VM by default Reviewed-by: kvn, never ! make/jprt.properties ! src/cpu/sparc/vm/c2_globals_sparc.hpp ! src/cpu/x86/vm/c2_globals_x86.hpp Changeset: f745b2be3737 Author: kvn Date: 2011-12-02 21:37 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/f745b2be3737 7117282: assert(base == NULL || t_adr->isa_rawptr() || !phase->type(base) Summary: Delay memory node transformation until the memory is processed. Reviewed-by: iveresov, never ! src/share/vm/opto/memnode.cpp Changeset: 81f7362f7bed Author: kvn Date: 2011-12-08 10:27 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/81f7362f7bed Merge ! make/jprt.properties ! src/share/vm/runtime/globals.hpp Changeset: 4406629aa157 Author: johnc Date: 2011-12-02 12:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/4406629aa157 7114095: G1: assert(obj == oopDesc::load_decode_heap_oop(p)) failed: p should still be pointing to obj Summary: As a result of the changes for 4965777, the G1 reference field scanning closure could be applied to the discovered field of a reference object twice. The failing assert is too strong if the result of the first application of the closure is stolen, and the referenced object, evacuated by another worker thread. Reviewed-by: ysr, tonyp ! src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp Changeset: e37aedaedccd Author: tonyp Date: 2011-12-05 12:26 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/e37aedaedccd Merge Changeset: f1391adc6681 Author: stefank Date: 2011-11-28 10:19 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/f1391adc6681 7112034: Parallel CMS fails to properly mark reference objects Summary: Enabled reference processing when work stealing during concurrent marking Reviewed-by: jmasa, brutisso ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Changeset: f4414323345f Author: stefank Date: 2011-11-28 14:58 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/f4414323345f 7116081: USE_PRECOMPILED_HEADER=0 triggers a single threaded build of the JVM Summary: Changed the conditional to see if the precompiled header has been specified. Also, removed the unused PrecompiledOption. Reviewed-by: dholmes, brutisso ! make/bsd/makefiles/gcc.make ! make/bsd/makefiles/top.make ! make/linux/makefiles/gcc.make ! make/linux/makefiles/top.make ! make/solaris/makefiles/gcc.make Changeset: d23d2b18183e Author: tonyp Date: 2011-12-07 12:54 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/d23d2b18183e 7118202: G1: eden size unnecessarily drops to a minimum Summary: An integer underflow can cause the RSet lengths to be massively overpredicted which forces the eden size to the minimum. Reviewed-by: brutisso, johnc ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Changeset: e9b91fd07263 Author: jmasa Date: 2011-12-09 06:46 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/e9b91fd07263 Merge Changeset: 6d7d0790074d Author: jmasa Date: 2011-12-09 19:28 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/6d7d0790074d 7119584: UseParallelGC barrier task can be overwritten. Summary: Provoke a GC for a metadata allocation failure. Reviewed-by: johnc, iveresov ! src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp ! src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp Changeset: 3b688d6ff3d0 Author: fparain Date: 2011-12-14 04:30 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/3b688d6ff3d0 7104647: Adding a diagnostic command framework Reviewed-by: phh, dcubed ! src/share/vm/services/attachListener.cpp + src/share/vm/services/diagnosticArgument.cpp + src/share/vm/services/diagnosticArgument.hpp + src/share/vm/services/diagnosticCommand.cpp + src/share/vm/services/diagnosticCommand.hpp + src/share/vm/services/diagnosticFramework.cpp + src/share/vm/services/diagnosticFramework.hpp ! src/share/vm/services/jmm.h ! src/share/vm/services/management.cpp Changeset: 31f6f10e4379 Author: vladidan Date: 2011-12-14 20:06 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/31f6f10e4379 Merge Changeset: a2fef924d8e6 Author: amurillo Date: 2011-12-16 12:38 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/a2fef924d8e6 Merge ! .hgtags Changeset: 61165f53f165 Author: amurillo Date: 2011-12-16 12:37 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/61165f53f165 Added tag hs23-b08 for changeset a2fef924d8e6 ! .hgtags Changeset: 7e075537835d Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/7e075537835d Added tag jdk8-b18 for changeset 61165f53f165 ! .hgtags Changeset: 434acc838772 Author: amurillo Date: 2011-12-16 12:46 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/434acc838772 7122001: new hotspot build - hs23-b09 Reviewed-by: jcoomes ! make/hotspot_version Changeset: 3c648b9ad052 Author: stefank Date: 2011-12-14 12:15 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/3c648b9ad052 7121373: Clean up CollectedHeap::is_in Summary: Fixed G1CollectedHeap::is_in, added tests, cleaned up comments and made Space::is_in pure virtual. Reviewed-by: brutisso, tonyp, jcoomes ! src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp ! src/share/vm/gc_interface/collectedHeap.cpp ! src/share/vm/gc_interface/collectedHeap.hpp ! src/share/vm/memory/genCollectedHeap.cpp ! src/share/vm/memory/genCollectedHeap.hpp ! src/share/vm/memory/generation.hpp ! src/share/vm/memory/space.cpp ! src/share/vm/memory/space.hpp ! src/share/vm/oops/arrayOop.cpp ! src/share/vm/oops/arrayOop.hpp ! src/share/vm/prims/jni.cpp ! src/share/vm/utilities/quickSort.cpp ! src/share/vm/utilities/quickSort.hpp Changeset: fd2b426c30db Author: johnc Date: 2011-12-14 17:43 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/fd2b426c30db 7119908: G1: Cache CSet start region for each worker for subsequent reuse Summary: Cache workers' calculated starting heap region, used for parallel iteration over the collcection set, for subsequent reuse. Reviewed-by: tonyp, brutisso ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Changeset: 41406797186b Author: tonyp Date: 2011-12-16 02:14 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/41406797186b 7113012: G1: rename not-fully-young GCs as "mixed" Summary: Renamed partially-young GCs as mixed and fully-young GCs as young. Change all external output that includes those terms (GC log and GC ergo log) as well as any comments, fields, methods, etc. The changeset also includes very minor code tidying up (added some curly brackets). Reviewed-by: johnc, brutisso ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp ! src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp ! src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp ! src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp ! src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp Changeset: adedfbbf0360 Author: johnc Date: 2011-12-16 11:40 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/adedfbbf0360 7120038: G1: ParallelGCThreads==0 is broken Summary: Running G1 with ParallelGCThreads==0 results in various crashes and asserts. Most of these are caused by unguarded references to the worker threads array or an incorrect number of active workers. Reviewed-by: jmasa, tonyp ! src/share/vm/gc_implementation/g1/concurrentMark.cpp ! src/share/vm/gc_implementation/g1/concurrentMark.hpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Changeset: e7dead7e90af Author: johnc Date: 2011-12-19 10:02 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/e7dead7e90af 7117303: VM uses non-monotonic time source and complains that it is non-monotonic Summary: Replaces calls to os::javaTimeMillis(), which does not (and cannot) guarantee monotonicity, in GC code to an equivalent expression that uses os::javaTimeNanos(). os::javaTimeNanos is guaranteed monotonically non-decreasing if the underlying platform provides a monotonic time source. Changes in OS files are to make use of the newly defined constants in globalDefinitions.hpp. Reviewed-by: dholmes, ysr ! src/os/bsd/vm/os_bsd.cpp ! src/os/linux/vm/os_linux.cpp ! src/os/solaris/vm/os_solaris.cpp ! src/os/windows/vm/os_windows.cpp ! src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ! src/share/vm/memory/genCollectedHeap.cpp ! src/share/vm/memory/generation.hpp ! src/share/vm/memory/referenceProcessor.cpp ! src/share/vm/utilities/globalDefinitions.hpp Changeset: 129cd462ae89 Author: jmasa Date: 2011-12-20 12:27 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/129cd462ae89 Merge Changeset: 96ce4c27112f Author: coleenp Date: 2011-12-19 15:34 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/96ce4c27112f 7122939: TraceBytecodes broken with UseCompressedOops Summary: Disable verify_heapbase on sparc if TraceBytecodes because the latter uses r12 as a temp register Reviewed-by: coleenp, phh Contributed-by: Volker Simonis ! src/cpu/x86/vm/assembler_x86.cpp Changeset: 6c995c08526c Author: phh Date: 2011-12-19 15:50 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/6c995c08526c 7122880: Extend vendor-specific command interface to include manageable switches Summary: Add Flag::external_ext()/writable_ext(), both return false. Reviewed-by: coleenp, zgu ! src/share/vm/runtime/globals.cpp ! src/share/vm/runtime/globals.hpp ! src/share/vm/runtime/globals_ext.hpp ! src/share/vm/services/management.cpp Changeset: 4502fd5c7698 Author: phh Date: 2011-12-19 21:38 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/4502fd5c7698 Merge Changeset: 11c26bfcf8c7 Author: phh Date: 2011-12-21 15:48 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/11c26bfcf8c7 7091417: recvfrom's 6th input should be of type socklen_t Summary: Revamp class os's socket method formal args to match socket.h, insert casts in appropriate places, and copyin-copyout int*'s that s/b socklen_t*'s in jvm.cpp. Reviewed-by: coleenp, dholmes Contributed-by: erik.gahlin at oracle.com, rickard.backman at oracle.com, nils.loodin at oracle.com, markus.gronlund at oracle.com ! src/os/bsd/vm/jvm_bsd.h ! src/os/bsd/vm/os_bsd.inline.hpp ! src/os/linux/vm/jvm_linux.h ! src/os/linux/vm/os_linux.inline.hpp ! src/os/solaris/vm/jvm_solaris.h ! src/os/solaris/vm/os_solaris.cpp ! src/os/solaris/vm/os_solaris.inline.hpp ! src/os/windows/vm/jvm_windows.h ! src/os/windows/vm/os_windows.cpp ! src/share/vm/prims/jvm.cpp ! src/share/vm/runtime/os.hpp ! src/share/vm/utilities/ostream.cpp Changeset: c01e115b095e Author: coleenp Date: 2011-12-21 16:41 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/c01e115b095e 7064927: retransformClasses() does not pass in LocalVariableTable of a method Summary: Handle LVT attribute in the class file reconstitutor. Reviewed-by: phh, coleenp Contributed-by: thomaswue ! src/share/vm/prims/jvmtiClassFileReconstituter.cpp ! src/share/vm/prims/jvmtiClassFileReconstituter.hpp Changeset: d532160c55f7 Author: coleenp Date: 2011-12-21 18:22 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/d532160c55f7 Merge Changeset: 4b18532913c7 Author: vladidan Date: 2011-12-22 12:01 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/4b18532913c7 Merge ! src/os/solaris/vm/os_solaris.cpp ! src/os/windows/vm/os_windows.cpp Changeset: 4bcf61041217 Author: amurillo Date: 2011-12-23 15:24 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/4bcf61041217 Merge Changeset: 9232e0ecbc2c Author: amurillo Date: 2011-12-23 15:24 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/hotspot/rev/9232e0ecbc2c Added tag hs23-b09 for changeset 4bcf61041217 ! .hgtags From lana.steuck at oracle.com Wed Dec 28 20:00:51 2011 From: lana.steuck at oracle.com (lana.steuck at oracle.com) Date: Wed, 28 Dec 2011 20:00:51 +0000 Subject: hg: jdk8/tl/jdk: 19 new changesets Message-ID: <20111228200409.CB685477F7@hg.openjdk.java.net> Changeset: 134420afe9c2 Author: ngthomas Date: 2011-11-13 21:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/134420afe9c2 7109885: security baseline for 7u2 or above is not set correctly Reviewed-by: ccheung, igor, ohair ! make/common/shared/Sanity.gmk Changeset: 6f594239e9dc Author: ngthomas Date: 2011-11-15 23:33 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/6f594239e9dc 7112298: remove security baseline sanity check Reviewed-by: ccheung, igor, ohair ! make/common/shared/Sanity.gmk Changeset: fcc7cafa0027 Author: herrick Date: 2011-11-18 06:35 -0500 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/fcc7cafa0027 Merge - make/sun/rmi/rmi/mapfile-vers - src/share/classes/sun/security/pkcs/EncodingException.java - src/share/classes/sun/security/pkcs/PKCS10.java - src/share/classes/sun/security/pkcs/PKCS10Attribute.java - src/share/classes/sun/security/pkcs/PKCS10Attributes.java - src/share/classes/sun/security/util/BigInt.java - src/share/classes/sun/security/util/PathList.java - src/share/classes/sun/security/x509/CertAndKeyGen.java - src/share/native/sun/rmi/server/MarshalInputStream.c - test/java/net/DatagramSocket/ChangingAddress.java - test/sun/security/util/BigInt/BigIntEqualsHashCode.java Changeset: 526e99f06a59 Author: igor Date: 2011-12-06 16:31 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/526e99f06a59 Merge - test/java/io/FileDescriptor/FileChannelFDTest.java - test/java/io/etc/FileDescriptorSharing.java Changeset: 334bd51fb3f3 Author: igor Date: 2011-12-19 10:06 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/334bd51fb3f3 Merge - make/sun/motif12/reorder-i586 - make/sun/motif12/reorder-sparc - make/sun/motif12/reorder-sparcv9 - src/share/native/java/util/zip/zlib-1.2.3/ChangeLog - src/share/native/java/util/zip/zlib-1.2.3/README - src/share/native/java/util/zip/zlib-1.2.3/compress.c - src/share/native/java/util/zip/zlib-1.2.3/crc32.h - src/share/native/java/util/zip/zlib-1.2.3/deflate.c - src/share/native/java/util/zip/zlib-1.2.3/deflate.h - src/share/native/java/util/zip/zlib-1.2.3/gzio.c - src/share/native/java/util/zip/zlib-1.2.3/infback.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.h - src/share/native/java/util/zip/zlib-1.2.3/inffixed.h - src/share/native/java/util/zip/zlib-1.2.3/inflate.c - src/share/native/java/util/zip/zlib-1.2.3/inflate.h - src/share/native/java/util/zip/zlib-1.2.3/inftrees.c - src/share/native/java/util/zip/zlib-1.2.3/inftrees.h - src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java - src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff - src/share/native/java/util/zip/zlib-1.2.3/trees.c - src/share/native/java/util/zip/zlib-1.2.3/trees.h - src/share/native/java/util/zip/zlib-1.2.3/uncompr.c - src/share/native/java/util/zip/zlib-1.2.3/zadler32.c - src/share/native/java/util/zip/zlib-1.2.3/zconf.h - src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.2.3/zlib.h - src/share/native/java/util/zip/zlib-1.2.3/zutil.c - src/share/native/java/util/zip/zlib-1.2.3/zutil.h - src/solaris/classes/sun/awt/motif/AWTLockAccess.java - src/solaris/classes/sun/awt/motif/MFontPeer.java - src/solaris/classes/sun/awt/motif/MToolkit.java - src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java - src/solaris/classes/sun/awt/motif/MWindowAttributes.java - src/solaris/classes/sun/awt/motif/X11FontMetrics.java - src/solaris/native/sun/awt/MouseInfo.c - src/solaris/native/sun/awt/XDrawingArea.c - src/solaris/native/sun/awt/XDrawingArea.h - src/solaris/native/sun/awt/XDrawingAreaP.h - src/solaris/native/sun/awt/awt_Cursor.h - src/solaris/native/sun/awt/awt_KeyboardFocusManager.h - src/solaris/native/sun/awt/awt_MToolkit.c - src/solaris/native/sun/awt/awt_MToolkit.h - src/solaris/native/sun/awt/awt_MenuItem.h - src/solaris/native/sun/awt/awt_PopupMenu.h - src/solaris/native/sun/awt/awt_TopLevel.h - src/solaris/native/sun/awt/awt_Window.h - src/solaris/native/sun/awt/awt_mgrsel.c - src/solaris/native/sun/awt/awt_mgrsel.h - src/solaris/native/sun/awt/awt_motif.h - src/solaris/native/sun/awt/awt_wm.c - src/solaris/native/sun/awt/awt_wm.h - src/solaris/native/sun/awt/awt_xembed.h - src/solaris/native/sun/awt/awt_xembed_server.c - src/solaris/native/sun/awt/awt_xembed_server.h - test/java/util/ResourceBundle/Control/ExpirationTest.java - test/java/util/ResourceBundle/Control/ExpirationTest.sh Changeset: c6fab5332075 Author: cl Date: 2011-12-22 19:00 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c6fab5332075 Added tag jdk8-b18 for changeset 334bd51fb3f3 ! .hgtags Changeset: 7dbc53242c2a Author: art Date: 2011-12-07 17:45 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/7dbc53242c2a 7117008: Warnings cleanup day: reduce number of javac warnings in the sun.awt package Reviewed-by: anthony, denis, bagiras ! src/share/classes/sun/awt/AWTAutoShutdown.java ! src/share/classes/sun/awt/AppContext.java ! src/share/classes/sun/awt/CausedFocusEvent.java ! src/share/classes/sun/awt/DebugSettings.java ! src/share/classes/sun/awt/EmbeddedFrame.java ! src/share/classes/sun/awt/EventListenerAggregate.java - src/share/classes/sun/awt/FocusingTextField.java ! src/share/classes/sun/awt/HeadlessToolkit.java - src/share/classes/sun/awt/HorizBagLayout.java ! src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java ! src/share/classes/sun/awt/ModalityEvent.java - src/share/classes/sun/awt/OrientableFlowLayout.java ! src/share/classes/sun/awt/PaintEventDispatcher.java ! src/share/classes/sun/awt/PeerEvent.java ! src/share/classes/sun/awt/SunDisplayChanger.java ! src/share/classes/sun/awt/SunGraphicsCallback.java ! src/share/classes/sun/awt/SunToolkit.java ! src/share/classes/sun/awt/UngrabEvent.java - src/share/classes/sun/awt/VariableGridLayout.java - src/share/classes/sun/awt/VerticalBagLayout.java Changeset: 18925904efc2 Author: alexsch Date: 2011-12-12 15:33 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/18925904efc2 7105890: closed/javax/swing/JScrollBar/4708809/bug4708809.java deadlocks on MacOS Reviewed-by: alexp + test/javax/swing/JScrollBar/4708809/bug4708809.java Changeset: 44b26d6a55a6 Author: alexsch Date: 2011-12-13 15:32 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/44b26d6a55a6 7112931: closed/javax/swing/JTabbedPane/6416920/bug6416920.java fails on MacOS Reviewed-by: alexp + test/javax/swing/JTabbedPane/6416920/bug6416920.java Changeset: 70233f5e909c Author: alexsch Date: 2011-12-13 17:30 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/70233f5e909c 7120869: javax/swing/JScrollBar/4708809/bug4708809.java fails on Windows Summary: The robot auto-delay is increased to fix the test failing on Windows. Reviewed-by: alexp ! test/javax/swing/JScrollBar/4708809/bug4708809.java Changeset: 032a91abc540 Author: alexsch Date: 2011-12-13 18:38 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/032a91abc540 7116950: Reduce number of warnings in swing Reviewed-by: art ! src/share/classes/com/sun/java/swing/Painter.java ! src/share/classes/java/beans/PropertyDescriptor.java ! src/share/classes/javax/swing/AbstractButton.java ! src/share/classes/javax/swing/ActionMap.java ! src/share/classes/javax/swing/ActionPropertyChangeListener.java ! src/share/classes/javax/swing/AncestorNotifier.java ! src/share/classes/javax/swing/ArrayTable.java ! src/share/classes/javax/swing/Box.java ! src/share/classes/javax/swing/BoxLayout.java ! src/share/classes/javax/swing/ButtonGroup.java ! src/share/classes/javax/swing/ComponentInputMap.java ! src/share/classes/javax/swing/InputMap.java ! src/share/classes/javax/swing/JButton.java ! src/share/classes/javax/swing/JComponent.java ! src/share/classes/javax/swing/JLabel.java ! src/share/classes/javax/swing/JLayeredPane.java ! src/share/classes/javax/swing/JMenu.java ! src/share/classes/javax/swing/JMenuBar.java ! src/share/classes/javax/swing/JMenuItem.java ! src/share/classes/javax/swing/JPopupMenu.java ! src/share/classes/javax/swing/JRootPane.java ! src/share/classes/javax/swing/JSeparator.java ! src/share/classes/javax/swing/JToolTip.java ! src/share/classes/javax/swing/JTree.java ! src/share/classes/javax/swing/JWindow.java ! src/share/classes/javax/swing/MenuSelectionManager.java ! src/share/classes/javax/swing/Popup.java ! src/share/classes/javax/swing/RepaintManager.java ! src/share/classes/javax/swing/Timer.java ! src/share/classes/javax/swing/border/AbstractBorder.java ! src/share/classes/javax/swing/border/CompoundBorder.java ! src/share/classes/javax/swing/border/EmptyBorder.java ! src/share/classes/javax/swing/border/MatteBorder.java ! src/share/classes/javax/swing/border/TitledBorder.java ! src/share/classes/javax/swing/event/AncestorEvent.java ! src/share/classes/javax/swing/event/ChangeEvent.java ! src/share/classes/javax/swing/event/EventListenerList.java ! src/share/classes/javax/swing/event/ListDataEvent.java ! src/share/classes/javax/swing/event/MenuDragMouseEvent.java ! src/share/classes/javax/swing/event/MenuEvent.java ! src/share/classes/javax/swing/event/MenuKeyEvent.java ! src/share/classes/javax/swing/event/PopupMenuEvent.java ! src/share/classes/javax/swing/plaf/ComponentUI.java ! src/share/classes/javax/swing/text/BadLocationException.java ! src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Changeset: 282b2ce90afe Author: lana Date: 2011-12-16 12:12 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/282b2ce90afe Merge ! src/share/classes/java/beans/PropertyDescriptor.java - src/share/native/java/util/zip/zlib-1.2.3/ChangeLog - src/share/native/java/util/zip/zlib-1.2.3/README - src/share/native/java/util/zip/zlib-1.2.3/compress.c - src/share/native/java/util/zip/zlib-1.2.3/crc32.h - src/share/native/java/util/zip/zlib-1.2.3/deflate.c - src/share/native/java/util/zip/zlib-1.2.3/deflate.h - src/share/native/java/util/zip/zlib-1.2.3/gzio.c - src/share/native/java/util/zip/zlib-1.2.3/infback.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.c - src/share/native/java/util/zip/zlib-1.2.3/inffast.h - src/share/native/java/util/zip/zlib-1.2.3/inffixed.h - src/share/native/java/util/zip/zlib-1.2.3/inflate.c - src/share/native/java/util/zip/zlib-1.2.3/inflate.h - src/share/native/java/util/zip/zlib-1.2.3/inftrees.c - src/share/native/java/util/zip/zlib-1.2.3/inftrees.h - src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java - src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff - src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff - src/share/native/java/util/zip/zlib-1.2.3/trees.c - src/share/native/java/util/zip/zlib-1.2.3/trees.h - src/share/native/java/util/zip/zlib-1.2.3/uncompr.c - src/share/native/java/util/zip/zlib-1.2.3/zadler32.c - src/share/native/java/util/zip/zlib-1.2.3/zconf.h - src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.2.3/zlib.h - src/share/native/java/util/zip/zlib-1.2.3/zutil.c - src/share/native/java/util/zip/zlib-1.2.3/zutil.h - test/java/util/ResourceBundle/Control/ExpirationTest.java - test/java/util/ResourceBundle/Control/ExpirationTest.sh Changeset: 75bd7295c706 Author: bagiras Date: 2011-12-19 15:21 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/75bd7295c706 7117334: Warnings cleanup day: reduce number of javac warnings in the java.awt package Reviewed-by: art, denis, alexsch ! src/share/classes/java/awt/AWTEvent.java ! src/share/classes/java/awt/AWTEventMulticaster.java ! src/share/classes/java/awt/Component.java ! src/share/classes/java/awt/Font.java ! src/share/classes/java/awt/Toolkit.java ! src/share/classes/java/awt/image/ColorModel.java Changeset: d15f38f08ce9 Author: denis Date: 2011-12-19 16:44 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/d15f38f08ce9 7117011: Reduce number of warnings in sun/awt/windows and sun/awt/datatransfer Reviewed-by: art ! src/share/classes/sun/awt/datatransfer/DataTransferer.java ! src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java ! src/solaris/classes/sun/awt/X11/XClipboard.java ! src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java ! src/windows/classes/sun/awt/windows/WBufferStrategy.java ! src/windows/classes/sun/awt/windows/WChoicePeer.java ! src/windows/classes/sun/awt/windows/WClipboard.java ! src/windows/classes/sun/awt/windows/WComponentPeer.java ! src/windows/classes/sun/awt/windows/WDataTransferer.java ! src/windows/classes/sun/awt/windows/WDesktopProperties.java ! src/windows/classes/sun/awt/windows/WDialogPeer.java ! src/windows/classes/sun/awt/windows/WEmbeddedFrame.java ! src/windows/classes/sun/awt/windows/WFileDialogPeer.java ! src/windows/classes/sun/awt/windows/WFramePeer.java ! src/windows/classes/sun/awt/windows/WInputMethod.java ! src/windows/classes/sun/awt/windows/WMenuItemPeer.java ! src/windows/classes/sun/awt/windows/WPageDialog.java ! src/windows/classes/sun/awt/windows/WPageDialogPeer.java ! src/windows/classes/sun/awt/windows/WPrintDialog.java ! src/windows/classes/sun/awt/windows/WPrintDialogPeer.java ! src/windows/classes/sun/awt/windows/WToolkit.java ! src/windows/classes/sun/awt/windows/WWindowPeer.java Changeset: cded2429cdbf Author: anthony Date: 2011-12-20 12:48 +0300 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/cded2429cdbf 7122796: SunToolkit constructor should create the EventQueue for the Main AppContext Summary: Always create an EQ for the main AppContext in SunToolkit constructor Reviewed-by: art ! src/share/classes/sun/awt/AppContext.java ! src/share/classes/sun/awt/SunToolkit.java + test/java/awt/EventQueue/MainAppContext/MainAppContext.java Changeset: 94d7051cca13 Author: lana Date: 2011-12-20 15:26 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/94d7051cca13 Merge - src/share/classes/sun/awt/FocusingTextField.java - src/share/classes/sun/awt/HorizBagLayout.java - src/share/classes/sun/awt/OrientableFlowLayout.java - src/share/classes/sun/awt/VariableGridLayout.java - src/share/classes/sun/awt/VerticalBagLayout.java Changeset: 570f3d893596 Author: lana Date: 2011-12-20 15:27 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/570f3d893596 Merge - src/share/classes/com/sun/tools/jdi/LinkedHashMap.java Changeset: 6f19ff39cff4 Author: lana Date: 2011-12-23 16:38 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/6f19ff39cff4 Merge - src/share/classes/com/sun/tools/jdi/LinkedHashMap.java - src/share/classes/sun/awt/FocusingTextField.java - src/share/classes/sun/awt/HorizBagLayout.java - src/share/classes/sun/awt/OrientableFlowLayout.java - src/share/classes/sun/awt/VariableGridLayout.java - src/share/classes/sun/awt/VerticalBagLayout.java Changeset: 437255d15e76 Author: lana Date: 2011-12-28 10:51 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/437255d15e76 Merge - src/share/classes/sun/awt/FocusingTextField.java - src/share/classes/sun/awt/HorizBagLayout.java - src/share/classes/sun/awt/OrientableFlowLayout.java - src/share/classes/sun/awt/VariableGridLayout.java - src/share/classes/sun/awt/VerticalBagLayout.java From kelly.ohair at oracle.com Thu Dec 29 21:18:14 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Thu, 29 Dec 2011 13:18:14 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFB5953.7070901@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFAF5C7.90509@oracle.com> <4EFB4F74.9010809@oracle.com> <4EFB5953.7070901@oracle.com> Message-ID: <95399990-8083-4D68-8FA2-555C3A3D2426@oracle.com> Two repositories use this drops mechanism, jaxp and jaxws, when both are changed, I will address the readme file. -kto On Dec 28, 2011, at 10:00 AM, Gary Adams wrote: > I see in the webrev the removal of drops.dir from the ant build.xml. > Should similar updates be applied to README-builds.html for > ALT_DROPS_DIR and ALLOW_DOWNLOADS? > > Might be good to put a note in > $(ALT_JDK_DEVTOOLS_PATH)/share/jdk8-drops > indicating the files are now include directly > in the jdk8 repos. > > On 12/28/11 12:18 PM, Joe Wang wrote: >> On 12/28/2011 2:56 AM, Alan Bateman wrote: >>> On 23/12/2011 21:27, Joe Wang wrote: >>>> Hi All, >>>> >>>> We have prepared a jaxp update for 7u4. The listed changes have been posted to the jdk7u-dev alias with "7u4 Request for approval for CR 7121110 - JAXP 1.4.5 update 1 for 7u4". >>>> >>>> With this update, we are adding jaxp sources back into the jdk7 repository, which means we are abandoning the jaxp bundle download process. This is a significant change. We'd like to hear if you have any concerns. If no objection, we'd like to push the change within the next week. >>>> >>>> The webrev is here: http://cr.openjdk.java.net/~joehw/jaxp145u1-changeset/webrev/ >>> This is good news. So what about jdk8? I think the protocol with 7u is that changes go into 8 first. Also are you expecting to keep the code in 7u and 8 in sync? >> Kelly asked for 6-open and jdk8 as well. Since we're changing the jaxp bundle process, we thought we would do the same for 6-open and jdk8 once this works out. But we can take the change to jdk8 first if this is approved. The only question I had was that the jdk8 modularization would change the jaxp source structure. But Kelly thought that's not a problem. I guess we don't mind another big changeset :) >> >> -Joe >> >>> >>> -Alan. > From stuart.marks at oracle.com Fri Dec 30 00:38:45 2011 From: stuart.marks at oracle.com (stuart.marks at oracle.com) Date: Fri, 30 Dec 2011 00:38:45 +0000 Subject: hg: jdk8/tl/jdk: 7122061: add -Xlint:all -Werror to warning-free build steps Message-ID: <20111230003923.B5B754782C@hg.openjdk.java.net> Changeset: 3a7ea63302f8 Author: smarks Date: 2011-12-29 16:39 -0800 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3a7ea63302f8 7122061: add -Xlint:all -Werror to warning-free build steps Reviewed-by: chegar, alanb, dholmes, ohair ! make/com/sun/demo/jvmti/hprof/Makefile ! make/com/sun/java/browser/net/Makefile ! make/com/sun/tools/Makefile ! make/com/sun/tools/attach/Makefile ! make/com/sun/tracing/Makefile ! make/com/sun/tracing/dtrace/Makefile ! make/java/instrument/Makefile ! make/java/rmi/Makefile ! make/java/text/base/Makefile ! make/java/text/bidi/Makefile ! make/java/util/Makefile ! make/javax/accessibility/Makefile ! make/javax/others/Makefile ! make/javax/security/Makefile ! make/jpda/tty/Makefile ! make/sun/launcher/Makefile ! make/sun/serialver/Makefile ! make/sun/text/Makefile ! make/sun/util/Makefile From Alan.Bateman at oracle.com Fri Dec 30 14:02:27 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 30 Dec 2011 14:02:27 +0000 Subject: Request for review: 7123582: (launcher) display the -version and -XshowSettings In-Reply-To: <4EF491E8.9060401@oracle.COM> References: <4EF3E5D8.5000306@oracle.COM> <4EF44FD7.60807@oracle.com> <4EF491E8.9060401@oracle.COM> Message-ID: <4EFDC473.2030306@oracle.com> On 23/12/2011 14:36, Kumar Srinivasan wrote: > The others were part of the feature, but this one is a regression. > > These comprehensive tests become a pain in the future to determine > when a particular method maps to a CR, so we tend to use a > comment with CR in these places, but comments sometimes get lost > when shuffling code around, by naming the method with a CR makes > it self-explanatory. > > Kumar The tests will outlive the current bug database and not clear (at least not to me) how easy it will be to map these CR numbers to the bug information. In this case I probably would have named is something like runTestShowSettingsAndVersion and mentioned the CR in the comment if needed. However, this is your area and what you have is fine. -Alan. From Alan.Bateman at oracle.com Fri Dec 30 14:14:14 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 30 Dec 2011 14:14:14 +0000 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFB4F74.9010809@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFAF5C7.90509@oracle.com> <4EFB4F74.9010809@oracle.com> Message-ID: <4EFDC736.1090302@oracle.com> On 28/12/2011 17:18, Joe Wang wrote: > Kelly asked for 6-open and jdk8 as well. Since we're changing the jaxp > bundle process, we thought we would do the same for 6-open and jdk8 > once this works out. But we can take the change to jdk8 first if this > is approved. The only question I had was that the jdk8 modularization > would change the jaxp source structure. But Kelly thought that's not > a problem. I guess we don't mind another big changeset :) I think it's too early to know if modularization will require the jaxp source code to be restructured as modules. It would clearly be desirable, in particular if jaxp migrates completely. However, if there are still activity upstream (you mentioned monitoring commits at jaxp-sources.java.net) or some need to keep the 7u and 8 code in sync then it would complicate things a bit. -Alan From huizhe.wang at oracle.com Fri Dec 30 18:11:49 2011 From: huizhe.wang at oracle.com (Joe Wang) Date: Fri, 30 Dec 2011 10:11:49 -0800 Subject: 7121110 : JAXP 1.4.5 update 1 for 7u4 & jaxp source in jdk7 repo In-Reply-To: <4EFDC736.1090302@oracle.com> References: <4EF4F236.3080200@oracle.com> <4EFAF5C7.90509@oracle.com> <4EFB4F74.9010809@oracle.com> <4EFDC736.1090302@oracle.com> Message-ID: <4EFDFEE5.1080803@oracle.com> On 12/30/2011 6:14 AM, Alan Bateman wrote: > On 28/12/2011 17:18, Joe Wang wrote: >> Kelly asked for 6-open and jdk8 as well. Since we're changing the >> jaxp bundle process, we thought we would do the same for 6-open and >> jdk8 once this works out. But we can take the change to jdk8 first >> if this is approved. The only question I had was that the jdk8 >> modularization would change the jaxp source structure. But Kelly >> thought that's not a problem. I guess we don't mind another big >> changeset :) > I think it's too early to know if modularization will require the jaxp > source code to be restructured as modules. It would clearly be > desirable, in particular if jaxp migrates completely. However, if > there are still activity upstream (you mentioned monitoring > commits at jaxp-sources.java.net) or some need to keep the 7u and 8 code > in sync then it would complicate things a bit. Yeh, there are several undecided factors affecting jaxp project/source right now. If there's no absolute requirement for a jaxp update in jdk8, I would prefer we wait a couple of weeks for things to settle. -Joe > > -Alan From kelly.ohair at oracle.com Sat Dec 31 01:31:08 2011 From: kelly.ohair at oracle.com (Kelly O'Hair) Date: Fri, 30 Dec 2011 17:31:08 -0800 Subject: Known issue? java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java Message-ID: <31DA93C9-C289-4143-873B-E13071442822@oracle.com> Just wondering if anyone has seen this testcase failure. I'm using Fedora 9 x86. -kto -------------------------------------------------- TEST: java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java JDK under test: (/tmp/jprt/P1/143001.jprovino/testproduct/linux_i586_2.6-product) openjdk version "1.8.0-internal" OpenJDK Runtime Environment (build 1.8.0-internal-201112301430.jprovino.jprovino-ref-51-b00) OpenJDK Client VM (build 23.0-b08, mixed mode, sharing) ACTION: build -- Passed. Build successful REASON: User specified action: run build MulticastSendReceiveTests NetworkConfiguration TIME: 0.086 seconds messages: command: build MulticastSendReceiveTests NetworkConfiguration reason: User specified action: run build MulticastSendReceiveTests NetworkConfiguration elapsed time (seconds): 0.086 ACTION: compile -- Passed. Compilation successful REASON: .class file out of date or does not exist TIME: 0.085 seconds messages: command: compile /tmp/jprt/P1/143001.jprovino/source/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java reason: .class file out of date or does not exist elapsed time (seconds): 0.085 ACTION: build -- Passed. All files up to date REASON: Named class compiled on demand TIME: 0.0 seconds messages: command: build MulticastSendReceiveTests reason: Named class compiled on demand elapsed time (seconds): 0.0 ACTION: main -- Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Expected message not recieved REASON: User specified action: run main MulticastSendReceiveTests TIME: 5.056 seconds messages: command: main MulticastSendReceiveTests reason: User specified action: run main MulticastSendReceiveTests elapsed time (seconds): 5.056 STDOUT: Test DatagramChannel to INET socket join 225.4.5.6 @ virbr0 Send message from 192.168.122.1 -> group 225.4.5.6 (id=0x23b98c4a) Waiting to receive message STDERR: java.lang.RuntimeException: Expected message not recieved at MulticastSendReceiveTests.receiveDatagram(MulticastSendReceiveTests.java:99) at MulticastSendReceiveTests.test(MulticastSendReceiveTests.java:171) at MulticastSendReceiveTests.main(MulticastSendReceiveTests.java:229) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:474) at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:680) at java.lang.Thread.run(Thread.java:722) JavaTest Message: Test threw exception: java.lang.RuntimeException JavaTest Message: shutting down test TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Expected message not recieved -------------------------------------------------- From Alan.Bateman at oracle.com Sat Dec 31 10:31:28 2011 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 31 Dec 2011 10:31:28 +0000 Subject: Known issue? java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java In-Reply-To: <31DA93C9-C289-4143-873B-E13071442822@oracle.com> References: <31DA93C9-C289-4143-873B-E13071442822@oracle.com> Message-ID: <4EFEE480.2090603@oracle.com> On 31/12/2011 01:31, Kelly O'Hair wrote: > Just wondering if anyone has seen this testcase failure. > I'm using Fedora 9 x86. > > -kto > : > > Test DatagramChannel to INET socket > join 225.4.5.6 @ virbr0 > Send message from 192.168.122.1 -> group 225.4.5.6 (id=0x23b98c4a) > Waiting to receive message > STDERR: > java.lang.RuntimeException: Expected message not recieved > We've had test failures on systems with the ip6tables packet filter blocking IPv6 multicast packets but otherwise I can't think of any issues. In this case the interface is virbr0 so I assume this is a virtual environment. I think this may need going through the libvirt configuration as I assume the issue is that IPv4 multicast packets aren't being forwarded. -Alan. From Andrey.Pikalev at oracle.com Thu Dec 1 17:14:02 2011 From: Andrey.Pikalev at oracle.com (Andrey Pikalev) Date: Thu, 01 Dec 2011 17:14:02 -0000 Subject: 7116954: Misc warnings in java.beans/java.beans.context In-Reply-To: <4ED7B3B1.3010909@oracle.com> References: <4ED79844.9050707@oracle.com> <4ED7A536.4070804@oracle.com> <4ED7AC43.7040501@oracle.com> <4ED7B3B1.3010909@oracle.com> Message-ID: <4ED7B5B8.6000008@oracle.com> Typically JavaBeans changes went into Swing (now AWT) gate. I don't think this really matter where to push this time assuming the changes will be propagated to AWT repo in a few weeks. Thanks, Andrey. On 12/1/2011 9:04 PM, Alan Bateman wrote: > On 01/12/2011 16:33, Maurizio Cimadamore wrote: >> Updated version [1]. >> >> Changes: >> >> *) Beans.java:184 - generified PrivilegedAction >> *) Beans.java:284 - generified PrivilegedAction >> *) NameGenerator.java:108 - changed Object to Integer and removed >> following cast >> *) Introspector.java: added new fake local variable to reduce scope of >> @SuppressWarnings >> >> [1] - http://cr.openjdk.java.net/~mcimadamore/7116954.1/ >> > These changes look fine to me. > > Now the question is where to push this, jdk8/tl or jdk8/awt? My guess is > that the beans activity these days is very low these days so if jdk8/awt > doesn't see it for weeks then it wouldn't matter. Hopefully Sergey > Malenkov will chime. > > -Alan From henri.gomez at gmail.com Fri Dec 2 06:56:11 2011 From: henri.gomez at gmail.com (Henri Gomez) Date: Fri, 02 Dec 2011 06:56:11 -0000 Subject: webrevs.2 for macosx changes to jdk7u-osx In-Reply-To: <4ED831DA.8090609@oracle.com> References: <4ED77C17.8060003@oracle.com> <4ED7B560.1010606@oracle.com> <4ED7F3D0.2050106@oracle.com> <4ED824DA.2000600@oracle.com> <4ED82A36.7030400@oracle.com> <4ED831DA.8090609@oracle.com> Message-ID: Where is the Mercurial URL for jdk7u-osx ? 2011/12/2 David Holmes : > > > > On 2/12/2011 11:30 AM, Paul Hohensee wrote: >> >> I agree. Be a good idea to ask for review from all the affected teams. >> I _think_ core libs is the only one we missed, though. > > > My concern is that there are a number of platform specific changes being > made to java.* and javax.* classes (there are changes to sun.* as well but > that is less of a concern). > > http://cr.openjdk.java.net/~michaelm/7113349/4/jdk7u-osx/modified/ > > I would hope that we could find a way to not have to make platform specific > changes to such classes, and we need to be sure that the proposed changes do > not impact other platforms either in terms of functionality or performance. > > Thanks, > David > > >> Paul >> >> On 12/1/11 8:07 PM, David Holmes wrote: >>> >>> On 2/12/2011 7:38 AM, Dalibor Topic wrote: >>>> >>>> On 12/1/11 6:12 PM, Michael McMahon wrote: >>>>> >>>>> Kelly, >>>>> >>>>> Yes, that is correct. This push is initially just for jdk7u-osx, which >>>>> is a development forest. I'm not sure exactly what the procedure >>>>> will be yet >>>>> for the push into jdk7u-dev. >>>> >>>> >>>> There is no special procedure for pushing into jdk7u-osx that's >>>> different from >>>> the one for jdk7u-dev. You need to submit a bulk change request for >>>> approval first, >>>> someone (i.e. either me or Edvard) needs to approve it, then the push >>>> can happen >>>> - regardless whether that's jdk7u-dev or jdk7u-osx. >>> >>> >>> All the osx porting work is being discussed on the macosx-port-dev >>> mailing list. Most core-libs subscribers will not be on that list >>> (including me - which means my cc to that list will either bounce or >>> get held up). There are proposed changes to core Java classes that >>> should be explicitly reviewed and approved by the core-libs folk in my >>> opinion. >>> >>> David From henri.gomez at gmail.com Fri Dec 2 07:44:35 2011 From: henri.gomez at gmail.com (Henri Gomez) Date: Fri, 02 Dec 2011 07:44:35 -0000 Subject: webrevs.2 for macosx changes to jdk7u-osx In-Reply-To: <4ED87AA4.3030500@oracle.com> References: <4ED77C17.8060003@oracle.com> <4ED7B560.1010606@oracle.com> <4ED7F3D0.2050106@oracle.com> <4ED824DA.2000600@oracle.com> <4ED82A36.7030400@oracle.com> <4ED831DA.8090609@oracle.com> <4ED87AA4.3030500@oracle.com> Message-ID: >> Where is the Mercurial URL for jdk7u-osx ? > > > Same place as all the other repos :) > > http://hg.openjdk.java.net/jdk7u/jdk7u-osx/ Nice, I'll try to build this one also :) Cheers From martijnverburg at gmail.com Fri Dec 2 12:22:12 2011 From: martijnverburg at gmail.com (Martijn Verburg) Date: Fri, 02 Dec 2011 12:22:12 -0000 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <4ED8C221.7070603@oracle.com> References: <4ED8C221.7070603@oracle.com> Message-ID: FYI - The London JUG did have java.util.regex listed, but we didn't have time to produce a patch for that area, so no clash there - Cheers, M On 2 December 2011 12:18, Alan Bateman wrote: > > cc'ing core-libs-dev as that is the place to discuss these changes. I see on > the sign-up sheet [1] that omajid has signed up for java.lang, maybe you are > working together? I'll leave it to Stuart to say whether he wants to > refactor/other changes separated from the warnings changes. > > One thing I'm curious about is @SuppressWarnings("BooleanConstructorCall") > as it suggests that some other compiler, or maybe an extension in the > NetBeans javac? > > -Alan > > [1] > http://wikis.sun.com/display/OpenJDK/JDK8+warning+cleanup+day+%282011-12-01%29 > > > On 02/12/2011 11:06, David Schlosnagle wrote: >> >> I didn't have a chance to sign-up or submit during the official >> warnings cleanup day, but I'm hoping that you'll still accept patches. >> I do not have a bug number for this change. >> >> The webrev [1] below should resolve 208 warnings in the java.lang.* >> and java.util.** packages. I tried to stick to fixing warnings, but >> OCD kicked in while editing in NetBeans, so there are a few additional >> IDE warnings fixed as well for the modified files. For example, adding >> @Override on the relevant methods, removals of dead stores, conversion >> to Strings in switch, StringBuffer -> ?StringBuilder where localized (I >> realize lock elision in HotSpot and JRockit should make them >> practically equivalent, but NetBeans still complains and I assume >> there is still some unnecessary synchronization overhead). >> ConditionalSpecialCasing.java also has some slight refactoring to >> utilize the updated parameterized types. >> >> Additionally, there was one change to >> java.util.regex.Pattern#subFlag() that I'd like someone to review more >> carefully as it was previously falling through the last case, but I >> believe the last case should have had a break; to properly handle >> other flags. >> >> *** 3006,3015 **** >> --- 3014,3024 ---- >> ? ? ? ? ? ? ? case 'x': >> ? ? ? ? ? ? ? ? ? flags&= ~COMMENTS; >> ? ? ? ? ? ? ? ? ? break; >> ? ? ? ? ? ? ? case 'U': >> ? ? ? ? ? ? ? ? ? flags&= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE); >> + ? ? ? ? ? ? ? ? break; >> ? ? ? ? ? ? ? default: >> ? ? ? ? ? ? ? ? ? return; >> ? ? ? ? ? ? ? } >> >> If you want any of the additional cleanup removed from the patch or >> other changes, please let me know. >> >> [1]: http://dl.dropbox.com/u/23832908/openjdk/2011-12-01/index.html >> >> Files modified: >> ? ? java/lang/Boolean.java >> ? ? java/lang/Byte.java >> ? ? java/lang/Character.java >> ? ? java/lang/Class.java >> ? ? java/lang/ConditionalSpecialCasing.java >> ? ? java/lang/Double.java >> ? ? java/lang/Float.java >> ? ? java/lang/Integer.java >> ? ? java/lang/Long.java >> ? ? java/lang/Short.java >> ? ? java/lang/System.java >> ? ? java/lang/ThreadLocal.java >> ? ? java/lang/Void.java >> ? ? java/util/IllegalFormatConversionException.java >> ? ? java/util/Locale.java >> ? ? java/util/regex/Matcher.java >> ? ? java/util/regex/Pattern.java >> ? ? java/util/regex/PatternSyntaxException.java >> ? ? java/util/regex/UnicodeProp.java >> >> Thanks, >> Dave > > From mikeb01 at gmail.com Fri Dec 2 19:24:30 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Fri, 02 Dec 2011 19:24:30 -0000 Subject: Warnings Cleanup in java.util. (more from hack day) Message-ID: Hi, We had some late submissions from our hack day participants. 2 more patches. One (j.u.z.ZipEntry) is possibly a little more involved for a warnings fix. It removes a usage of deprecated Date APIs in favour of Calendar. However, the fix results in code that is very similar to Apache Harmony implementation. The other is a couple of fixes for generics (j.u.j.Manifest). Thanks to: - Prasannaa Regards, Michael Barker mikeb2701 -------------- next part -------------- diff -r 43a630f11af6 src/share/classes/java/util/jar/Manifest.java --- a/src/share/classes/java/util/jar/Manifest.java Wed Nov 30 13:11:16 2011 -0800 +++ b/src/share/classes/java/util/jar/Manifest.java Fri Dec 02 19:15:58 2011 +0000 @@ -30,6 +30,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.HashMap; import java.util.Iterator; @@ -51,7 +52,7 @@ private Attributes attr = new Attributes(); // manifest entries - private Map entries = new HashMap(); + private Map entries = new HashMap<>(); /** * Constructs a new, empty Manifest. @@ -148,20 +149,20 @@ // Write out the main attributes for the manifest attr.writeMain(dos); // Now write out the pre-entry attributes - Iterator it = entries.entrySet().iterator(); + Iterator> it = entries.entrySet().iterator(); while (it.hasNext()) { - Map.Entry e = (Map.Entry)it.next(); + Map.Entry e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); - String value = (String)e.getKey(); + String value = e.getKey(); if (value != null) { - byte[] vb = value.getBytes("UTF8"); - value = new String(vb, 0, 0, vb.length); + byte[] vb = value.getBytes(StandardCharsets.UTF_8); + value = new String(vb, 0, 0, StandardCharsets.UTF_8); } buffer.append(value); buffer.append("\r\n"); make72Safe(buffer); dos.writeBytes(buffer.toString()); - ((Attributes)e.getValue()).write(dos); + e.getValue().write(dos); } dos.flush(); } -------------- next part -------------- diff -r 43a630f11af6 src/share/classes/java/util/zip/ZipEntry.java --- a/src/share/classes/java/util/zip/ZipEntry.java Wed Nov 30 13:11:16 2011 -0800 +++ b/src/share/classes/java/util/zip/ZipEntry.java Fri Dec 02 19:12:54 2011 +0000 @@ -24,7 +24,7 @@ */ package java.util.zip; - +import java.util.Calendar; import java.util.Date; /** @@ -281,27 +281,33 @@ * Converts DOS time to Java time (number of milliseconds since epoch). */ private static long dosToJavaTime(long dtime) { - Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80), - (int)(((dtime >> 21) & 0x0f) - 1), - (int)((dtime >> 16) & 0x1f), - (int)((dtime >> 11) & 0x1f), - (int)((dtime >> 5) & 0x3f), - (int)((dtime << 1) & 0x3e)); - return d.getTime(); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, (int) ((dtime >> 25) & 0x7f) + 1980); + cal.set(Calendar.MONTH, (int) ((dtime >> 21) & 0x0f) - 1); + cal.set(Calendar.DATE, (int) (dtime >> 16) & 0x1f); + cal.set(Calendar.HOUR_OF_DAY, (int) (dtime >> 11) & 0x1f); + cal.set(Calendar.MINUTE, (int) (dtime >> 5) & 0x3f); + cal.set(Calendar.SECOND, (int) (dtime << 1) & 0x3e); + return cal.getTimeInMillis(); } /* * Converts Java time to DOS time. */ private static long javaToDosTime(long time) { - Date d = new Date(time); - int year = d.getYear() + 1900; + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(time); + int year = cal.get(Calendar.YEAR); if (year < 1980) { return (1 << 21) | (1 << 16); } - return (year - 1980) << 25 | (d.getMonth() + 1) << 21 | - d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 | - d.getSeconds() >> 1; + int month = cal.get(Calendar.MONTH) + 1; + return (year - 1980) << 25 + | month << 21 + | cal.get(Calendar.DAY_OF_MONTH) << 16 + | cal.get(Calendar.HOUR_OF_DAY) << 11 + | cal.get(Calendar.MINUTE) << 5 + | cal.get(Calendar.SECOND) >> 1; } /** From xiomara.jayasena at oracle.com Sat Dec 3 00:06:35 2011 From: xiomara.jayasena at oracle.com (Xiomara Jayasena) Date: Sat, 03 Dec 2011 00:06:35 -0000 Subject: Request for Review: Warnings cleanup in java.lang.*, java.util.** In-Reply-To: <4ED9042D.3000307@redhat.com> References: <4ED8C221.7070603@oracle.com 4ED9042D.3000307@redhat.com> Message-ID: Omair / Danesh, Here are the bug IDs: 7117605 Danesh 7117612 Omair Wiki has been updated. http://wikis.sun.com/display/OpenJDK/JDK8+warning+cleanup+day+%282011-12-01%29 -Xiomara > -----Original Message----- > From: Omair Majid [mailto:omajid at redhat.com] > Sent: Friday, December 02, 2011 9:00 AM > To: Alan Bateman > Cc: jdk8-dev at openjdk.java.net; core-libs-dev > Subject: Re: Request for Review: Warnings cleanup in java.lang.*, > java.util.** > > Hi, > > On 12/02/2011 07:18 AM, Alan Bateman wrote: > > > > cc'ing core-libs-dev as that is the place to discuss these changes. I > > see on the sign-up sheet [1] that omajid has signed up for java.lang, > > maybe you are working together? > > Unfortunately, David and I were not working together :( > > Anyway, here is my webrev for java.lang.* > http://cr.openjdk.java.net/~omajid/webrevs/warnings-day-2011/01/ > > Sorry about the delay, building and testing this took longer than I had > expected it to. Also, this patch only addresses the warnings pointed > out by javac. > > The classes java.lang.ThreadLocal and java.lang.ClassValue are not > included in the webrev. The fixes for ThreadLocal were basically > sprinkling @SuppressWarnings("unchecked") throughout and the fixes for > ClassValue looked slightly more complex when I tried to reduce the use > of rawtypes. I will post a separate webrev for those later. > > Cheers, > Omair From mikeb01 at gmail.com Sat Dec 3 22:32:30 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Sat, 03 Dec 2011 22:32:30 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDA8DCC.6040503@oracle.com> References: <4EDA8DCC.6040503@oracle.com> Message-ID: Hi Stuart, Thanks for picking up the review. > ?- java/util/jar/JarFile.java > ?- java/util/jar/Manifest.java [patch4] > ?- java/util/logging/LogManager.java [patch2] > ?- java/util/prefs/Preferences.java > ?- java/util/prefs/XmlSupport.java > ?- java/util/zip/ZipEntry.java [patch2] > > Did I get everything? I think you've addressed all the review comments that > have come in so far. (Other reviewers, please recheck the webrev!) Yep, that looks like all of them. > In addition, I have the following comments: > > JarFile.java -- > > 242 ? ? ? ? ? ? ? ? ZipEntry ze = (ZipEntry)enum_.nextElement(); > 621 ? ? ? ? ? ? ? ? ? ? ZipEntry ze = (ZipEntry) enum_.nextElement(); > 676 ? ? ? ? ? ? ? ? ? ? ZipEntry e = (ZipEntry) entries.nextElement(); > > I think these are all unnecessary casts now, since at 242 and 621 the return > type from nextElement is and at 676 it's JarEntry, and > JarEntry is a subclass of ZipEntry. So, these casts can probably be removed > even though they don't generate warnings. An alternative would be to change > the type of e at 676 to JarEntry; not sure if this would be better. > > LogManager.java -- > > 203 ? ? ? ? ? ? ? ? ? ? Logger.getGlobal().setLogManager(manager); > 204 ? ? ? ? ? ? ? ? ? ? manager.addLogger(Logger.getGlobal()); > > The doc recommends replacing mentions of the global field with a call to > getGlobal(), and this was done here, however sometimes what's in the doc > doesn't necessarily apply to library code. Can someone who's more familiar > with logging verify this change is correct? > > 418 ? ? Class ? clz = ClassLoader.getSystemClassLoader().loadClass(word); > 419 ? ? Handler hdl = (Handler) clz.newInstance(); > > Minor nit: extra space was before 'clz' in the original code, I think, to > make it line up with 'hdl'. Maybe spacing needs to be rearranged to keep > them lined up. (I see this a couple other places in the file, but it's not > too prevalent.) The alternative is to have a single space between the type > and the variable name. These all look sensible, I'll implement them. > Mike, if you end up needing to update this patch further, it might be > easiest if you just sent all the changes in a single patch file, i.e. the > output of 'hg diff'. I can then apply it to the tip and generate a webrev > quite easily. No problem. I'll drop a new patch in tomorrow. Mike. From mikeb01 at gmail.com Sun Dec 4 08:56:33 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Sun, 04 Dec 2011 08:56:33 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDA9866.4080708@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> Message-ID: Hi, > scan of the webrev. There are still a couple of raw type warnings in JarFile > and several more in other classes in these packages so it's possible you > don't have everything (I wasn't following that thread closely on jdk8-dev). Question on a rawtypes fix. In one case there is method defined as: public List getManifestDigests() { if (jv != null) { return jv.getManifestDigests(); } return new ArrayList(); } There is a rawtypes warning on the "new ArrayList()". I can put a specific type as the return value should match "jv.getManifestDigests()", which is public so shouldn't be changed. I can define it as "new ArrayList()" or add "@SuppressWarnings("rawtypes") // Need raw type to match public signature definition". Which would be the preferred approach? Mike. From mikeb01 at gmail.com Sun Dec 4 09:31:42 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Sun, 04 Dec 2011 09:31:42 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> Message-ID: > There is a rawtypes warning on the "new ArrayList()". ?I can put a > specific type as the return value should match > "jv.getManifestDigests()", which is public so shouldn't be changed. ?I Sorry that should read "I can't put a specific type... From mikeb01 at gmail.com Tue Dec 6 18:46:05 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Tue, 06 Dec 2011 18:46:05 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDCAFA3.30104@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> Message-ID: Hi, Attached is the latest LJC warnings patch. I've merged all of the changes into a single patch. The one I'm unsure of the comments on the @SuppressWarnings("deprecation") in the ZipEntry.java. I've been fairly terse and just mentioned that it's using the date methods/constructor. Regards, Michael Barker. On Mon, Dec 5, 2011 at 11:48 AM, Alan Bateman wrote: > On 04/12/2011 08:56, Michael Barker wrote: > > Hi, > > scan of the webrev. There are still a couple of raw type warnings in JarFile > and several more in other classes in these packages so it's possible you > don't have everything (I wasn't following that thread closely on jdk8-dev). > > Question on a rawtypes fix. In one case there is method defined as: > > public List getManifestDigests() { > if (jv != null) { > return jv.getManifestDigests(); > } > return new ArrayList(); > } > > There is a rawtypes warning on the "new ArrayList()". I can put a > specific type as the return value should match > "jv.getManifestDigests()", which is public so shouldn't be changed. I > can define it as "new ArrayList()" or add > "@SuppressWarnings("rawtypes") // Need raw type to match public > signature definition". Which would be the preferred approach? > > Mike. > > I suspect you just need to pull the latest changes because as part of > 7116722 [1], Chris has fixed JarVerifier's getManifestDigests to return > List. This should mean that JarFile.getManfiestDigest can be changed > to: > > ??? List getManifestDigests() { > ??????? ensureInitialization(); > > ??????? if (jv != null) { > ??????????? return jv.getManifestDigests(); > ??????? } > ??????? return new ArrayList(); > ??? } > > -Alan. > > [1] http://hg.openjdk.java.net/jdk8/tl/jdk/rev/3b8186aee592 -------------- next part -------------- diff -r da28826c5672 src/share/classes/java/util/jar/JarFile.java --- a/src/share/classes/java/util/jar/JarFile.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/jar/JarFile.java Tue Dec 06 18:34:37 2011 +0000 @@ -183,7 +183,7 @@ } else { man = new Manifest(super.getInputStream(manEntry)); } - manRef = new SoftReference(man); + manRef = new SoftReference<>(man); } } return man; @@ -233,13 +233,13 @@ * Returns an enumeration of the zip file entries. */ public Enumeration entries() { - final Enumeration enum_ = super.entries(); + final Enumeration enum_ = super.entries(); return new Enumeration() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } public JarFileEntry nextElement() { - ZipEntry ze = (ZipEntry)enum_.nextElement(); + ZipEntry ze = enum_.nextElement(); return new JarFileEntry(ze); } }; @@ -608,7 +608,7 @@ } // screen out entries which are never signed - final Enumeration enum_ = super.entries(); + final Enumeration enum_ = super.entries(); return new Enumeration() { ZipEntry entry; @@ -618,7 +618,7 @@ return true; } while (enum_.hasMoreElements()) { - ZipEntry ze = (ZipEntry) enum_.nextElement(); + ZipEntry ze = enum_.nextElement(); if (JarVerifier.isSigningRelated(ze.getName())) { continue; } @@ -649,7 +649,7 @@ * JAR file has no signed content. Is there a non-signing * code source? */ - Enumeration unsigned = unsignedEntryNames(); + Enumeration unsigned = unsignedEntryNames(); if (unsigned.hasMoreElements()) { return new CodeSource[]{JarVerifier.getUnsignedCS(url)}; } else { @@ -658,7 +658,7 @@ } private Enumeration unsignedEntryNames() { - final Enumeration entries = entries(); + final Enumeration entries = entries(); return new Enumeration() { String name; @@ -673,7 +673,7 @@ } while (entries.hasMoreElements()) { String value; - ZipEntry e = (ZipEntry) entries.nextElement(); + ZipEntry e = entries.nextElement(); value = e.getName(); if (e.isDirectory() || JarVerifier.isSigningRelated(value)) { continue; @@ -726,11 +726,11 @@ } } - List getManifestDigests() { + List getManifestDigests() { ensureInitialization(); if (jv != null) { return jv.getManifestDigests(); } - return new ArrayList(); + return new ArrayList(); } } diff -r da28826c5672 src/share/classes/java/util/jar/Manifest.java --- a/src/share/classes/java/util/jar/Manifest.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/jar/Manifest.java Tue Dec 06 18:34:37 2011 +0000 @@ -51,7 +51,7 @@ private Attributes attr = new Attributes(); // manifest entries - private Map entries = new HashMap(); + private Map entries = new HashMap<>(); /** * Constructs a new, empty Manifest. @@ -148,11 +148,11 @@ // Write out the main attributes for the manifest attr.writeMain(dos); // Now write out the pre-entry attributes - Iterator it = entries.entrySet().iterator(); + Iterator> it = entries.entrySet().iterator(); while (it.hasNext()) { - Map.Entry e = (Map.Entry)it.next(); + Map.Entry e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); - String value = (String)e.getKey(); + String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); @@ -161,7 +161,7 @@ buffer.append("\r\n"); make72Safe(buffer); dos.writeBytes(buffer.toString()); - ((Attributes)e.getValue()).write(dos); + e.getValue().write(dos); } dos.flush(); } diff -r da28826c5672 src/share/classes/java/util/logging/LogManager.java --- a/src/share/classes/java/util/logging/LogManager.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/logging/LogManager.java Tue Dec 06 18:34: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. // would deadlock with the LogManager.. - 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,8 +415,8 @@ for (int i = 0; i < names.length; i++) { String word = names[i]; try { - Class clz = ClassLoader.getSystemClassLoader().loadClass(word); - Handler hdl = (Handler) clz.newInstance(); + Class clz = ClassLoader.getSystemClassLoader().loadClass(word); + Handler hdl = (Handler) clz.newInstance(); try { // Check if there is a property defining the // this handler's level. @@ -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 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")) { diff -r da28826c5672 src/share/classes/java/util/prefs/Preferences.java --- a/src/share/classes/java/util/prefs/Preferences.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/prefs/Preferences.java Tue Dec 06 18:34:37 2011 +0000 @@ -413,7 +413,7 @@ * @throws IllegalArgumentException if the package has node preferences * node associated with it. */ - private static String nodeName(Class c) { + private static String nodeName(Class c) { if (c.isArray()) throw new IllegalArgumentException( "Arrays have no associated preferences node."); diff -r da28826c5672 src/share/classes/java/util/prefs/XmlSupport.java --- a/src/share/classes/java/util/prefs/XmlSupport.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/prefs/XmlSupport.java Tue Dec 06 18:34:37 2011 +0000 @@ -106,7 +106,7 @@ xmlRoot.setAttribute("type", (p.isUserNode() ? "user" : "system")); // Get bottom-up list of nodes from p to root, excluding root - List ancestors = new ArrayList(); + List ancestors = new ArrayList<>(); for (Preferences kid = p, dad = kid.parent(); dad != null; kid = dad, dad = kid.parent()) { @@ -116,7 +116,7 @@ for (int i=ancestors.size()-1; i >= 0; i--) { e.appendChild(doc.createElement("map")); e = (Element) e.appendChild(doc.createElement("node")); - e.setAttribute("name", ((Preferences)ancestors.get(i)).name()); + e.setAttribute("name", ancestors.get(i).name()); } putPreferencesInXml(e, doc, p, subTree); @@ -339,17 +339,17 @@ * @throws IOException if writing to the specified output stream * results in an IOException. */ - static void exportMap(OutputStream os, Map map) throws IOException { + static void exportMap(OutputStream os, Map map) throws IOException { Document doc = createPrefsDoc("map"); Element xmlMap = doc.getDocumentElement( ) ; xmlMap.setAttribute("MAP_XML_VERSION", MAP_XML_VERSION); - for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) { - Map.Entry e = (Map.Entry) i.next(); + for (Iterator> i = map.entrySet().iterator(); i.hasNext(); ) { + Map.Entry e = i.next(); Element xe = (Element) xmlMap.appendChild(doc.createElement("entry")); - xe.setAttribute("key", (String) e.getKey()); - xe.setAttribute("value", (String) e.getValue()); + xe.setAttribute("key", e.getKey()); + xe.setAttribute("value", e.getValue()); } writeDoc(doc, os); @@ -368,7 +368,7 @@ * @throws InvalidPreferencesFormatException Data on input stream does not * constitute a valid XML document with the mandated document type. */ - static void importMap(InputStream is, Map m) + static void importMap(InputStream is, Map m) throws IOException, InvalidPreferencesFormatException { try { diff -r da28826c5672 src/share/classes/java/util/zip/ZipEntry.java --- a/src/share/classes/java/util/zip/ZipEntry.java Mon Dec 05 12:24:17 2011 +0000 +++ b/src/share/classes/java/util/zip/ZipEntry.java Tue Dec 06 18:34:37 2011 +0000 @@ -281,6 +281,7 @@ * Converts DOS time to Java time (number of milliseconds since epoch). */ private static long dosToJavaTime(long dtime) { + @SuppressWarnings("deprecation") // Use of date constructor. Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80), (int)(((dtime >> 21) & 0x0f) - 1), (int)((dtime >> 16) & 0x1f), @@ -293,6 +294,7 @@ /* * Converts Java time to DOS time. */ + @SuppressWarnings("deprecation") // Use of date methods private static long javaToDosTime(long time) { Date d = new Date(time); int year = d.getYear() + 1900; From mikeb01 at gmail.com Wed Dec 7 08:43:10 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Wed, 07 Dec 2011 08:43:10 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDEB8FA.9060402@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> Message-ID: >> I looked at the updated patch and it looks fine to me. There are other >> classes >> in j.u.jar and j.u.logging that also have warnings but fixing the warnings I only submitted the ones that we managed to work on during the hack day. If the team is happy to continue accepting fresh patches for warnings, I'll encourage those that were involved to get an OCA signed and start fixing up the remaining warnings. We'll look to do another hack day again soon. > ?7117249: fix warnings in java.util.jar, .logging, .prefs, .zip > ?Reviewed-by: alanb, dholmes, forax, sherman, smarks > ?Contributed-by: London Java Community and Michael Barker > > > Since the changeset comment is baked for all eternity, :-) I wanted to make > sure I got it right before proceeding. But basically this is the last thing > that needs to be resolved before I can push in the changes. Let me know. All looks good to me. Mike. From mikeb01 at gmail.com Wed Dec 7 10:34:53 2011 From: mikeb01 at gmail.com (Michael Barker) Date: Wed, 07 Dec 2011 10:34:53 -0000 Subject: review of 7117249: java.util warnings patches from LJC/Mike Barker In-Reply-To: <4EDF3B5F.8030409@oracle.com> References: <4EDA8DCC.6040503@oracle.com> <4EDA9866.4080708@oracle.com> <4EDCAFA3.30104@oracle.com> <4EDE7F3C.8080403@oracle.com> <4EDEB8FA.9060402@oracle.com> <4EDF3B5F.8030409@oracle.com> Message-ID: > Michael - the Contributed-by line is usually the individual's name (+ mail > address) or a list of names (and their mail addresses). I think Stuart is > suggesting that this would be better than "London Java Community". Okay, no problem: Contributed-by: Prasannaa , Martijn Verburg , Goerge_Albrecht , Graham Allan , Michael Barker From robert.ottenhag at oracle.com Fri Dec 9 14:18:36 2011 From: robert.ottenhag at oracle.com (Robert Ottenhag) Date: Fri, 09 Dec 2011 14:18:36 -0000 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE10139.8020905@oracle.com> References: <4ED8D93A.5050600@oracle.com 4EE10139.8020905@oracle.com> Message-ID: <34278e49-efbc-4370-ab36-a50331a9ff65@default> Adding to the review of jmm.h, that is modified in both the jdk part and the hotspot part, these files should be identical, without any differences in whitespace. Also, regarding whitespace and indentation, the use TAB characters in many files in the jdk patch makes jcheck complain (when trying to import your patch locally), and should be replaced by spaces. Best regards, /Robert > -----Original Message----- > From: Paul Hohensee > Sent: Thursday, December 08, 2011 7:26 PM > To: Frederic Parain > Cc: serviceability-dev at openjdk.java.net; core-libs-dev at openjdk.java.net; > hotspot-runtime-dev at openjdk.java.net > Subject: Re: Request for Review (XXL): 7104647: Adding a diagnostic > command framework > > For the hotspot part at > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ > > Most of my comments are style-related. Nice job on the implementation > architecture. > > In attachListener.cpp: > > You might want to delete the first "return JNI_OK;" line, since the code > under > HAS_PENDING_EXCEPTION just falls through. > > In jmm.h: > > Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the > existing declarations. Add a newline just before it on line 322. > > > In diagnosticFramework.hpp: > > Fix indenting for lines 63-66, insert blank before "size_t" on line 48. > > Hotspot convention is that getter method names don't include a "get_" > prefix. > So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). > Similarly, getters such as is_enabled() should retrieve a field named > "_is_enabled" > rather than one named "enabled". You follow the "_is_enabled" convention > in other places such as GenDCmdArgument. Or you could use enabled() to > get the value of the _enabled field. > > Also generally, I'd use accessor methods in the implementation of more > complex member methods rather than access the underlying fields directly. > E.g. in GenDCmdArgument::read_value, I'd use is_set() and > set_is_set(true), > (set_is_set() is not actually defined, but should be) rather than directly > accessing _is_set. Though sometimes doing this is too much of a pain > with fields whose type is a template argument, as in the > DCmdArggument::parse_value() method in diagnosticArgument.cpp. > > For easy readability, it'd be nice to line up field names (the ones with > an > _ prefix) at the same column. > > On line 200, "instanciated" -> "instantiated" > > On line 218, I'd use "heap_allocated" rather than "heap" for the formal > arg name. > > On line 248, you could indent the text to start underneath "outputStream". > I generally find that indenting arguments lines (formal or actual) so > they line > up with the first argument position make the code more readable, but I'm > not > religious about it. > > On line 265, "instanciated" -> "instantiated" > > DCmdFactorys are members of a singly-linked list, right? If so, it'd be > good to > have a comment to that effect on the declaration of _next. > > On line 322, insert a blank before "true". You might fix this in other > places > where there's no blank between a comma in an argument list and the > following parameter value. > > > In diagnosticCommandFramework.cpp: > > The code from lines 80-95 and 105-120 is identical. Factor out? > > > In diagnosticArgument.cpp: > > On line 41, insert blanks before the actual arguments. (see above > generic comment) > > On line 77, the "if" is indented one space too many. > > > In management.cpp: > > I'd be consistent with having or not having a space between "while", > "if" and "for" > and the following "(" in this and your other code. Most hotspot code > has a space. > > > Thanks, > > Paul > > > On 12/2/11 8:57 AM, Frederic Parain wrote: > > Hi All, > > > > [Posting to serviceability-dev, runtime-dev and core-libs-dev > > because changes are pretty big and touch all these areas] > > > > Here's a framework for issuing diagnostics commands to the JVM. > > Diagnostic commands are actions executed inside the JVM mainly > > for monitoring or management purpose. This work has two parts. > > The first part is in the hotspot repository and contains the > > framework itself with two diagnostic commands. The second > > part is in the JDK repository and contains the command line > > utility to invoke diagnostic commands as well as the > > HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean > > extensions allow a remote client to discover and invoke > > diagnostic commands using a JMX connection. > > > > This changeset only contains two diagnostic commands, more > > commands will be added in the future, as a standalone effort > > to improve the monitoring and management services of the > > JVM, or as part of other projects. > > > > Webrevs are here: > > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ > > http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ > > > > Here's a technical description of this work: > > > > 1 - The Diagnostic Command Framework > > 1-1 Overview > > > > The diagnostic command framework is fully implemented in native code > > and relies on the HotSpot's internal exception mechanism. > > The rational of a pure native implementation is to be able to execute > > diagnostic commands even in critical situations like an OutOfMemory > > error. All diagnostic commands are registered in a single list, and two > > flags control the way a user can interact with them. The "hidden" flag > > prevents a diagnostic command from appearing in the list of available > > commands returned by the "help" command. However, it's still possible to > > get the detailed help message for a hidden command with the "help > > " syntax (but it requires to know the name of the hidden > > command). The second flag is "enabled" and it controls if a command can > > be invoked or not. When listed with the "help" commands, disabled > > commands appear with a "[disabled]" label in their description. If the > > user tries to invoke a disabled command, an error message is returned > > and the command is not run. This error message can be customized on a > > per command base. The framework just provides these two flags with their > > semantic, it doesn't provide any policy or mechanism to set or modify > > these flags. These actions will be delegated to the JVM or special > > diagnostic commands. > > > > 1-2 Implementation > > > > All diagnostic commands are implemented as subclasses of the DCmd class > > defined in services/diagnosticFramework.hpp. Here's the layout of the > > DCmd class and the list of methods that a new command has to define or > > overwrite: > > > > class DCmd { > > DCmd(outputStream *output); > > > > static const char *get_name(); > > > > static const char *get_description(); > > > > static const char *get_disabled_message(); > > > > static const char *get_impact(); > > > > static int get_num_arguments(); > > > > virtual void print_help(outputStream* out); > > > > virtual void parse(CmdLine* line, char delim, TRAPS); > > > > virtual void execute(TRAPS); > > > > virtual void reset(TRAPS); > > > > virtual void cleanup(); > > > > virtual GrowableArray* get_argument_name_array(); > > > > virtual GrowableArray* get_argument_info_array(); > > } > > > > A diagnostic command is always instantiated with an outputStream in > > parameter. This outputStream can point either to a file, a buffer or a > > socket (see the ostream.hpp file). > > > > The get_name() method returns the string that will identify the command > > (i.e. the string to put on the command line to invoke it). > > > > The get_description() methods returns the global description of the > > command. > > > > The get_disabled_message() returns the customized message to return when > > the command is disabled, without having to instantiate the command. > > > > The get_impact() returns a description of the intrusiveness of the > > diagnostic command on the Java Virtual Machine behavior. The rational > > for this method is that some diagnostic commands can seriously disrupt > > the behavior of the Java Virtual Machine (for instance a Thread Dump for > > an application with several tens of thousands of threads, or a Head Dump > > with a 40GB+ heap size) and other diagnostic commands have no serious > > impact on the JVM (for instance, getting the command line arguments or > > the JVM version). The recommended format for the description is > level>: [longer description], where the impact level is selected among > > this list: {low, medium, high}. The optional longer description can > > provide more specific details like the fact that Thread Dump impact > > depends on the heap size. > > > > The get_num_arguments() returns the number of options/arguments > > recognized by the diagnostic command. This method is only used by the > > JMX interface support (see below). > > > > The print_help() methods prints a detailed help on the outputStream > > passed in argument. The detailed help contains the list of all supported > > options with their type and description. > > > > The parse() method is in charge of parsing the command arguments. Each > > command is free to implement its own argument parser. However, an > > argument parser framework is provided (see section 1-3) to ease the > > implementation, but its use is optional. The parse method takes a > > delimiter character in argument, which is used to mark the limit between > > two arguments (typically invocation from jcmd will use a space character > > as a delimiter while invocation from the JVM command line parsing code > > will use a comma as a delimiter). > > > > The execute() method is naturally the one to invoke to get the > > diagnostic command executed. The parse() and the execute() methods are > > dissociated, so it's a possible perform the argument parsing in one > > thread, and delegate the execution to another thread, as long as the > > diagnostic command doesn't reference thread local variables. The > > framework allows several instances of the same diagnostic command to be > > executed in parallel. If for some reasons concurrent executions should > > not be allowed for a given diagnostic command, this is the > > responsibility of the diagnostic command implementor to enforce this > > rule, for instance by protecting the body of the execute() method with a > > global lock. > > > > The reset() method is used to initialize the internal fields of the > > diagnostic command or to reset the internal fields to their initial > > value to be able to re-use an already allocated diagnostic command > > instance. > > > > The cleanup() method is used to perform perform cleanup (like freeing of > > all memory allocated to store internal data). The DCmd extends the > > ResourceObj class, so when allocated in a ResourceArea, destructors > > cannot be used to perform cleanup. To ensure that cleanup is performed > > in all cases, it is recommended to create a DCmdMark instance for each > > DCmd instance. DCmdMark is a stack allocated object with a pointer to a > > DCmd instance. When the DCmdMark is destroyed, its destructor calls the > > cleanup() method of the DCmd instance it points to. If the DCmd instance > > has been allocated on the C-Heap, the DCmdMark will also free the memory > > allocated to store the DCmd instance. > > > > The get_argument_name_array() and get_argument_info_array() are related > > to the JMX interface of the diagnostic command framework, so they are > > described in section 3. > > > > 1-3 DCmdParser framework > > > > The DCmdParser class is an optional framework to help development of > > argument parsers. It provides many features required by the diagnostic > > command framework (generation of the help message or the argument > > descriptions for the JMX interface) but all these features can easily be > > re-implemented if a developer decides not to use the DCmdParser > > framework. > > > > The DCmdParser class is relying on the DCmdArgument template. This > > template must be used to define the different types of argument the > > parser will have to handle. When a new specialization of the template is > > done, three methods have to be provided: > > > > void parse_value(const char *str,size_t len,TRAPS); > > void init_value(TRAPS); > > void destroy_value(); > > > > The parse_value() method is used to convert a string into an argument > > value. The print_value() method is used to display the default value > > (support for the detailed help message). The init_value() method is used > > to initialize or reset the argument value. The destroy_value() method is > > a clean-up method (useful when the argument has allocated some C-Heap > > memory to store its value and this memory has to be freed before > > destroying the DCmdArgument instance). > > > > The DCmdParser makes a distinction between options and arguments. > > Options are identified by a key name that must appear on the command > > line, while argument are identified just by the position of the argument > > on the command line. Options use the = syntax. In case of > > boolean options, the '=' part of the syntax can be omitted to set > > the option to true. Arguments are just sequences characters delimited by > > a separator character. This separator can be specified at runtime when > > invoking the diagnostic command framework. If an argument contain a > > character that could be used as a delimiter, it's possible to enclose > > the argument between single or double quotes. Options are arguments are > > instantiated using the same DCmdArgument class but they're registered > > differently to the DCmdParser. > > > > The way to use the DCmdParser is to declare the parser and the > > option/arguments as fields of the diagnostic command class (which is > > itself a sub-class of the DCmd class), like this: > > > > > > class EchoDCmd : public DCmd { > > protected: > > DCmdParser _dcmdparser; > > > > DCmdArgument _required; > > > > DCmdArgument _intval; > > > > DCmdArgument _boolval; > > > > DCmdArgument _stringval; > > > > DCmdArgument _first_arg; > > > > DCmdArgument _second_arg; > > > > DCmdArgument _optional_arg; > > > > } > > > > The parser and the options/arguments must be initialized before the > > diagnostic command class, and the options/arguments have to be > > registered to the parser like this: > > > > EchoDCmd(outputStream *output) : DCmd(output), > > _stringval("-strval","a string argument","STRING",false), > > > > _boolval("-boolval","a boolean argument","BOOLEAN",false), > > > > _intval("-intval","an integer argument","INTEGER",false), > > > > _required("-req","a mandatory integer argument","INTEGER",true), > > > > _fist_arg("first argument","a string argument","STRING",true), > > > > _second_arg("second argument,"an integer argument,"INTEGER",true), > > > > _optional_arg("optional argument","an optional string > > argument","STRING","false") > > > > { > > > > _dcmdparser.add_dcmd_option(&_stringval) > > > > _dcmdparser.add_dcmd_option(&_boolval); > > > > _dcmdparser.add_dcmd_option(&_intval); > > > > _dcmdparser.add_dcmd_option(&_required); > > > > _dcmdparser.add_argument(&_first_arg); > > > > _dcmdparser.add_argument(&_second_arg); > > > > _dcmdparser.add_argument(&_optional_arg); > > }; > > > > The add_dcmd_argument()/ add_dcmd_option() method is used to add an > > argument/option to the parser. The option/argument constructor takes the > > name of the option/argument, its description, a string describing its > > type and a boolean to specify if the option/argument is mandatory or > > not. The parser doesn't support option/argument duplicates (having the > > same name) but the code currently doesn't check for duplicates.The order > > used to register options has no impact on the parser. However, the order > > used to register arguments is critical because the parser will use the > > same order to parse the command line. In the example above, the parser > > expects to have a first argument of type STRING (parsed using > > _first_arg), then a second argument of type INTEGER (parsed using > > _second_arg) and optionally a third parameter of type STRING (parsed > > using _optional_arg). A mandatory option or argument has to be specify > > every time the command is invoked. If it is missing, an exception is > > thrown at the end of the parsing. Optional arguments have to be > > registered after mandatory arguments. An optional argument will be > > considered for parsing only if all arguments before it (mandatory or > > not) have already been used to parse the command line. > > > > The DCmdParser and its DCmdArgument instances are embedded in the DCmd > > instance. The rational for this design is to limit the number of C-heap > > allocations but also to be able to pre-allocate diagnostic command > > instances for critical situations. If the process is running out of > > C-heap space, it's not possible to instantiate new diagnostic commands > > to troubleshoot the situation. By pre-allocating some diagnostic > > commands, it will be possible to run them even in this critical > > situation. Of course, the diagnostic command itself should not try to > > allocate memory during its execution, this prevents the diagnostic > > command to use variable length arguments like strings. By nature, > > pre-allocated diagnostic commands aim to be re-usable, this is the > > purpose of the reset() method which restores the default status of all > > arguments. > > > > 1-4 Internal invocation > > > > Using a diagnostic command from the JVM itself is pretty easy: > > instantiate the class and invoke the parse() method then the execute() > > method. A diagnostic command can be instantiated from inside the JVM > > even it is not registered. This is a difference with the external > > invocations (from jcmd or JMX) that require the command to be > registered. > > > > 2 - The JCmd interface > > > > Diagnostic commands can also be invoked from outside the JVM process, > > using the new 'jcmd' utility. The jcmd program uses the attach API > > to connect to the JVM, send requests and receive results. The > > jcmd utility must be launched on the same machine than the one running > > the JVM (its a local tool). Launched without arguments, jcmd displays a > > list of all JVMs running on the machine. The jcmd source code is in > > the jdk repository like other existing j* tools. > > > > To execute a diagnostic command in a particular JVM, the generic > > syntax is: > > > > jcmd [arguments] > > > > The attachListener has been modified to recognized the jcmd requests. > > When a jcmd request is identified, it is parsed to extract the command > > name. The JVM performs a look up of this command in a list of registered > > commands. To be executable by an external request, a diagnostic command > > has to be registered. The registration is performed with the DCmdFactory > > class (see services/management.cpp). > > > > 3 - The JMX interface > > > > The framework provides a JMX based interface to the diagnostic commands. > > This interface allows remote invocation of diagnostic commands through a > > JMX connection. > > > > 3-1 The interface > > > > The information related to the diagnostic commands are accessible > > through new methods added to the > > com.sun.management.HotspotDiagnosticMXBean: > > > > public List getDiagnosticCommands(); > > > > public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); > > > > public List getDiagnosticCommandInfo(List > > command); > > > > public List getDiagnosticCommandInfo(); > > > > public String execute(String commandLine) throws > > IllegalArgumentException ; > > > > public String execute(String cmd, String... arguments) > > throws IllegalArgumentException; > > > > > > The getDiagnosticCommands() method returns an array containing the names > > of the not-hidden registered diagnostic commands. > > > > The three getDiagnosticCommandInfo() methods return one or several > > diagnostic command descriptions using the DiagnosticCommandInfo class. > > > > The two execute() methods allow the user the invoke a diagnostic command > > in different ways. > > > > The DiagnosticCommandInfo class is describing a diagnostic command with > > the following information: > > > > public class DiagnosticCommandInfo { > > > > public String getName(); > > > > public String getDescription(); > > > > public String getImpact(); > > > > public boolean isEnabled(); > > > > public List getArgumentsInfo(); > > } > > > > The getName() method returns the name of the diagnostic command. This > > name is the one to use in execute() methods to invoke the diagnostic > > command. > > > > The getDescription() method returns a general description of the > > diagnostic command. > > > > The getImpact() method returns a description of the intrusiveness of > > diagnostic command. > > > > The isEnabled() method returns true if the method is enabled, false if > > it is disabled. A disabled method cannot be executed. > > > > The getArgumentsInfo() returns a list of descriptions for the options or > > arguments recognized by the diagnostic command. Each option/argument is > > described by a DiagnosticCommandArgumentInfo instance: > > > > public class DiagnosticCommandArgumentInfo { > > > > public String getName(); > > > > public String getDescription(); > > > > public String getType(); > > > > public String getDefault(); > > > > public boolean isMandatory(); > > > > public boolean isOption(); > > > > public int getPosition(); > > } > > > > If the DiagnosticCommandArgumentInfo instance describes an option, > > isOption() returns true and getPosition() returns -1. Otherwise, when > > the DiagnosticCommandArgumentInfo instance describes an argument, > > isOption() returns false and getPosition() returns the expected position > > for this argument. The position of an argument is defined relatively to > > all arguments passed on the command line, options are not considered > > when defining an argument position. The getDefault() method returns the > > default value of the argument if a default has been defined, otherwise > > it returns null. > > > > 3-2 The implementation > > > > The framework has been designed in a way that prevents diagnostic > > command developers to worry about the JMX interface. In addition to > > the methods described in section 1-2, a diagnostic command developer has > > to provide three methods: > > > > int get_num_arguments() > > > > which returns the number of option and arguments supported by the > > command. > > > > GrowableArray* get_argument_name_array() > > > > which provides the name of the arguments supported by the command. > > > > GrowableyArray* get_argument_info_array() > > > > which provides the description of each argument with a DCmdArgumentInfo > > instance. DCmdArgumentInfo is a C++ class used by the framework to > > generate the sun.com.management.DcmdArgumentInfo instances. This is done > > automatically and the diagnostic command developer doesn't need to know > > how to create Java objects from the runtime. > > > > 4 - The Diagnostic Commands > > > > To avoid name collisions between diagnostic commands coming from > > different projects, use of a flat name space should be avoided and > > a more structured organization is recommended. The framework itself > > doesn't depend on this organization, so it will be a set of rules > > defining a convention in the way commands are named. > > > > Diagnostic commands can easily organized in a hierarchical way, so the > > template for a command name can be: > > > > .[sub-domain.] > > > > This template can be extended with sub-sub-domains and so on. > > > > A special set of commands without domain will be reserved for the > > commands related to the diagnostic framework itself, like the "help" > > command. > > > > > > Thanks, > > > > Fred > > From serguei.spitsyn at oracle.com Tue Dec 13 09:43:39 2011 From: serguei.spitsyn at oracle.com (serguei.spitsyn at oracle.com) Date: Tue, 13 Dec 2011 09:43:39 -0000 Subject: Request for Review (XXL): 7104647: Adding a diagnostic command framework In-Reply-To: <4EE6243B.6070200@oracle.com> References: <4ED8D93A.5050600@oracle.com> <4EE10139.8020905@oracle.com> <4EE60FD4.3040404@oracle.com> <4EE6243B.6070200@oracle.com> Message-ID: <4EE71E3F.9010703@oracle.com> Hi Frederik, Your fix is already in a good shape! src/share/vm/services/management.cpp: It is better to have different diagnostic messages at lines 2181 and 2186 so that it is easy to find out what of the two lines caused an exception. The messages would be better to be more specific. The same applies to the lines 2221 and 2226. Indent must be aligned with the first argument above. 2178 oop cmd = JNIHandles::resolve_external_guard(command); 2179 if (cmd == NULL) { 2180 THROW_MSG(vmSymbols::java_lang_NullPointerException(), 2181 "Command line cannot be null."); 2182 } 2183 char* cmd_name = java_lang_String::as_utf8_string(cmd); 2184 if (cmd_name == NULL) { 2185 THROW_MSG(vmSymbols::java_lang_NullPointerException(), 2186 "Command line cannot be null."); 2187 } ... 2219 if (cmd == NULL) { 2220 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), 2221 "Command line cannot be null."); 2222 } 2223 char* cmdline = java_lang_String::as_utf8_string(cmd); 2224 if (cmdline == NULL) { 2225 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), 2226 "Command line cannot be null."); 2227 } The lines 2189 and 2194 look redundant: src/share/vm/services/diagnosticFramework.cpp: 2188 DCmd* dcmd = NULL; 2189 { 2190 DCmdFactory*factory = DCmdFactory::factory(cmd_name, strlen(cmd_name)); 2191 if (factory != NULL) { 2192 dcmd = factory->create_resource_instance(NULL); 2193 } 2194 } Indent is not correct at the lines 2205-2211: 2204 for (int i = 0; i< array->length(); i++) { 2205 infoArray[i].name = array->at(i)->name(); 2206 infoArray[i].description = array->at(i)->description(); 2207 infoArray[i].type = array->at(i)->type(); 2208 infoArray[i].default_string = array->at(i)->default_string(); 2209 infoArray[i].mandatory = array->at(i)->is_mandatory(); 2210 infoArray[i].option = array->at(i)->is_option(); 2211 infoArray[i].position = array->at(i)->position(); 2212 } Space is missed after 'while': 320 while(arg != NULL) { 326 while(arg != NULL) { Thanks, Serguei On 12/12/11 7:56 AM, Frederic Parain wrote: > Minor updates: > http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.04/ > > Fred > > On 12/12/11 03:29 PM, Frederic Parain wrote: >> Hi Paul, >> >> Thank you for the review. >> I've applied all your recommendations except the refactoring >> in diagnosticCommandFramework.cpp (too few lines can be really >> factored out without passing many arguments). >> >> New webrev is here: >> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.03/ >> >> Regards, >> >> Fred >> >> On 12/ 8/11 07:26 PM, Paul Hohensee wrote: >>> For the hotspot part at >>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>> >>> Most of my comments are style-related. Nice job on the implementation >>> architecture. >>> >>> In attachListener.cpp: >>> >>> You might want to delete the first "return JNI_OK;" line, since the >>> code >>> under >>> HAS_PENDING_EXCEPTION just falls through. >>> >>> In jmm.h: >>> >>> Be nice to indent "(JNIEnv" on lines 318, 319 and 325 the same as the >>> existing declarations. Add a newline just before it on line 322. >>> >>> >>> In diagnosticFramework.hpp: >>> >>> Fix indenting for lines 63-66, insert blank before "size_t" on line 48. >>> >>> Hotspot convention is that getter method names don't include a "get_" >>> prefix. >>> So, e.g., DCmdArgIter::get_key_addr() s/b DCmdArgIter::key_addr(). >>> Similarly, getters such as is_enabled() should retrieve a field named >>> "_is_enabled" >>> rather than one named "enabled". You follow the "_is_enabled" >>> convention >>> in other places such as GenDCmdArgument. Or you could use enabled() to >>> get the value of the _enabled field. >>> >>> Also generally, I'd use accessor methods in the implementation of more >>> complex member methods rather than access the underlying fields >>> directly. >>> E.g. in GenDCmdArgument::read_value, I'd use is_set() and >>> set_is_set(true), >>> (set_is_set() is not actually defined, but should be) rather than >>> directly >>> accessing _is_set. Though sometimes doing this is too much of a pain >>> with fields whose type is a template argument, as in the >>> DCmdArggument::parse_value() method in diagnosticArgument.cpp. >>> >>> For easy readability, it'd be nice to line up field names (the ones >>> with an >>> _ prefix) at the same column. >>> >>> On line 200, "instanciated" -> "instantiated" >>> >>> On line 218, I'd use "heap_allocated" rather than "heap" for the formal >>> arg name. >>> >>> On line 248, you could indent the text to start underneath >>> "outputStream". >>> I generally find that indenting arguments lines (formal or actual) so >>> they line >>> up with the first argument position make the code more readable, but >>> I'm >>> not >>> religious about it. >>> >>> On line 265, "instanciated" -> "instantiated" >>> >>> DCmdFactorys are members of a singly-linked list, right? If so, it'd be >>> good to >>> have a comment to that effect on the declaration of _next. >>> >>> On line 322, insert a blank before "true". You might fix this in other >>> places >>> where there's no blank between a comma in an argument list and the >>> following parameter value. >>> >>> >>> In diagnosticCommandFramework.cpp: >>> >>> The code from lines 80-95 and 105-120 is identical. Factor out? >>> >>> >>> In diagnosticArgument.cpp: >>> >>> On line 41, insert blanks before the actual arguments. (see above >>> generic comment) >>> >>> On line 77, the "if" is indented one space too many. >>> >>> >>> In management.cpp: >>> >>> I'd be consistent with having or not having a space between "while", >>> "if" and "for" >>> and the following "(" in this and your other code. Most hotspot code >>> has >>> a space. >>> >>> >>> Thanks, >>> >>> Paul >>> >>> >>> On 12/2/11 8:57 AM, Frederic Parain wrote: >>>> Hi All, >>>> >>>> [Posting to serviceability-dev, runtime-dev and core-libs-dev >>>> because changes are pretty big and touch all these areas] >>>> >>>> Here's a framework for issuing diagnostics commands to the JVM. >>>> Diagnostic commands are actions executed inside the JVM mainly >>>> for monitoring or management purpose. This work has two parts. >>>> The first part is in the hotspot repository and contains the >>>> framework itself with two diagnostic commands. The second >>>> part is in the JDK repository and contains the command line >>>> utility to invoke diagnostic commands as well as the >>>> HotSpotDiagnosticMXBean extensions. The HotSpotDiagnosticMXBean >>>> extensions allow a remote client to discover and invoke >>>> diagnostic commands using a JMX connection. >>>> >>>> This changeset only contains two diagnostic commands, more >>>> commands will be added in the future, as a standalone effort >>>> to improve the monitoring and management services of the >>>> JVM, or as part of other projects. >>>> >>>> Webrevs are here: >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.hotspot.00/ >>>> http://cr.openjdk.java.net/~fparain/7104647/webrev.jdk.00/ >>>> >>>> Here's a technical description of this work: >>>> >>>> 1 - The Diagnostic Command Framework >>>> 1-1 Overview >>>> >>>> The diagnostic command framework is fully implemented in native code >>>> and relies on the HotSpot's internal exception mechanism. >>>> The rational of a pure native implementation is to be able to execute >>>> diagnostic commands even in critical situations like an OutOfMemory >>>> error. All diagnostic commands are registered in a single list, and >>>> two >>>> flags control the way a user can interact with them. The "hidden" flag >>>> prevents a diagnostic command from appearing in the list of available >>>> commands returned by the "help" command. However, it's still >>>> possible to >>>> get the detailed help message for a hidden command with the "help >>>> " syntax (but it requires to know the name of the hidden >>>> command). The second flag is "enabled" and it controls if a command >>>> can >>>> be invoked or not. When listed with the "help" commands, disabled >>>> commands appear with a "[disabled]" label in their description. If the >>>> user tries to invoke a disabled command, an error message is returned >>>> and the command is not run. This error message can be customized on a >>>> per command base. The framework just provides these two flags with >>>> their >>>> semantic, it doesn't provide any policy or mechanism to set or modify >>>> these flags. These actions will be delegated to the JVM or special >>>> diagnostic commands. >>>> >>>> 1-2 Implementation >>>> >>>> All diagnostic commands are implemented as subclasses of the DCmd >>>> class >>>> defined in services/diagnosticFramework.hpp. Here's the layout of the >>>> DCmd class and the list of methods that a new command has to define or >>>> overwrite: >>>> >>>> class DCmd { >>>> DCmd(outputStream *output); >>>> >>>> static const char *get_name(); >>>> >>>> static const char *get_description(); >>>> >>>> static const char *get_disabled_message(); >>>> >>>> static const char *get_impact(); >>>> >>>> static int get_num_arguments(); >>>> >>>> virtual void print_help(outputStream* out); >>>> >>>> virtual void parse(CmdLine* line, char delim, TRAPS); >>>> >>>> virtual void execute(TRAPS); >>>> >>>> virtual void reset(TRAPS); >>>> >>>> virtual void cleanup(); >>>> >>>> virtual GrowableArray* get_argument_name_array(); >>>> >>>> virtual GrowableArray* get_argument_info_array(); >>>> } >>>> >>>> A diagnostic command is always instantiated with an outputStream in >>>> parameter. This outputStream can point either to a file, a buffer or a >>>> socket (see the ostream.hpp file). >>>> >>>> The get_name() method returns the string that will identify the >>>> command >>>> (i.e. the string to put on the command line to invoke it). >>>> >>>> The get_description() methods returns the global description of the >>>> command. >>>> >>>> The get_disabled_message() returns the customized message to return >>>> when >>>> the command is disabled, without having to instantiate the command. >>>> >>>> The get_impact() returns a description of the intrusiveness of the >>>> diagnostic command on the Java Virtual Machine behavior. The rational >>>> for this method is that some diagnostic commands can seriously disrupt >>>> the behavior of the Java Virtual Machine (for instance a Thread >>>> Dump for >>>> an application with several tens of thousands of threads, or a Head >>>> Dump >>>> with a 40GB+ heap size) and other diagnostic commands have no serious >>>> impact on the JVM (for instance, getting the command line arguments or >>>> the JVM version). The recommended format for the description is >>>> >>> level>: [longer description], where the impact level is selected among >>>> this list: {low, medium, high}. The optional longer description can >>>> provide more specific details like the fact that Thread Dump impact >>>> depends on the heap size. >>>> >>>> The get_num_arguments() returns the number of options/arguments >>>> recognized by the diagnostic command. This method is only used by the >>>> JMX interface support (see below). >>>> >>>> The print_help() methods prints a detailed help on the outputStream >>>> passed in argument. The detailed help contains the list of all >>>> supported >>>> options with their type and description. >>>> >>>> The parse() method is in charge of parsing the command arguments. Each >>>> command is free to implement its own argument parser. However, an >>>> argument parser framework is provided (see section 1-3) to ease the >>>> implementation, but its use is optional. The parse method takes a >>>> delimiter character in argument, which is used to mark the limit >>>> between >>>> two arguments (typically invocation from jcmd will use a space >>>> character >>>> as a delimiter while invocation from the JVM command line parsing code >>>> will use a comma as a delimiter). >>>> >>>> The execute() method is naturally the one to invoke to get the >>>> diagnostic command executed. The parse() and the execute() methods are >>>> dissociated, so it's a possible perform the argument parsing in one >>>> thread, and delegate the execution to another thread, as long as the >>>> diagnostic command doesn't reference thread local variables. The >>>> framework allows several instances of the same diagnostic command >>>> to be >>>> executed in parallel. If for some reasons concurrent executions should >>>> not be allowed for a given diagnostic command, this is the >>>> responsibility of the diagnostic command implementor to enforce this >>>> rule, for instance by protecting the body of the execute() method >>>> with a >>>> global lock. >>>> >>>> The reset() method is used to initialize the internal fields of the >>>> diagnostic command or to reset the internal fields to their initial >>>> value to be able to re-use an already allocated diagnostic command >>>> instance. >>>> >>>> The cleanup() method is used to perform perform cleanup (like >>>> freeing of >>>> all memory allocated to store internal data). The DCmd extends the >>>> ResourceObj class, so when allocated in a ResourceArea, destructors >>>> cannot be used to perform cleanup. To ensure that cleanup is performed >>>> in all cases, it is recommended to create a DCmdMark instance for each >>>> DCmd instance. DCmdMark is a stack allocated object with a pointer >>>> to a >>>> DCmd instance. When the DCmdMark is destroyed, its destructor calls >>>> the >>>> cleanup() method of the DCmd instance it points to. If the DCmd >>>> instance >>>> has been allocated on the C-Heap, the DCmdMark will also free the >>>> memory >>>> allocated to store the DCmd instance. >>>> >>>> The get_argument_name_array() and get_argument_info_array() are >>>> related >>>> to the JMX interface of the diagnostic command framework, so they are >>>> described in section 3. >>>> >>>> 1-3 DCmdParser framework >>>> >>>> The DCmdParser class is an optional framework to help development of >>>> argument parsers. It provides many features required by the diagnostic >>>> command framework (generation of the help message or the argument >>>> descriptions for the JMX interface) but all these features can >>>> easily be >>>> re-implemented if a developer decides not to use the DCmdParser >>>> framework. >>>> >>>> The DCmdParser class is relying on the DCmdArgument template. This >>>> template must be used to define the different types of argument the >>>> parser will have to handle. When a new specialization of the >>>> template is >>>> done, three methods have to be provided: >>>> >>>> void parse_value(const char *str,size_t len,TRAPS); >>>> void init_value(TRAPS); >>>> void destroy_value(); >>>> >>>> The parse_value() method is used to convert a string into an argument >>>> value. The print_value() method is used to display the default value >>>> (support for the detailed help message). The init_value() method is >>>> used >>>> to initialize or reset the argument value. The destroy_value() >>>> method is >>>> a clean-up method (useful when the argument has allocated some C-Heap >>>> memory to store its value and this memory has to be freed before >>>> destroying the DCmdArgument instance). >>>> >>>> The DCmdParser makes a distinction between options and arguments. >>>> Options are identified by a key name that must appear on the command >>>> line, while argument are identified just by the position of the >>>> argument >>>> on the command line. Options use the = syntax. In case of >>>> boolean options, the '=' part of the syntax can be omitted >>>> to set >>>> the option to true. Arguments are just sequences characters >>>> delimited by >>>> a separator character. This separator can be specified at runtime when >>>> invoking the diagnostic command framework. If an argument contain a >>>> character that could be used as a delimiter, it's possible to enclose >>>> the argument between single or double quotes. Options are arguments >>>> are >>>> instantiated using the same DCmdArgument class but they're registered >>>> differently to the DCmdParser. >>>> >>>> The way to use the DCmdParser is to declare the parser and the >>>> option/arguments as fields of the diagnostic command class (which is >>>> itself a sub-class of the DCmd class), like this: >>>> >>>> >>>> class EchoDCmd : public DCmd { >>>> protected: >>>> DCmdParser _dcmdparser; >>>> >>>> DCmdArgument _required; >>>> >>>> DCmdArgument _intval; >>>> >>>> DCmdArgument _boolval; >>>> >>>> DCmdArgument _stringval; >>>> >>>> DCmdArgument _first_arg; >>>> >>>> DCmdArgument _second_arg; >>>> >>>> DCmdArgument _optional_arg; >>>> >>>> } >>>> >>>> The parser and the options/arguments must be initialized before the >>>> diagnostic command class, and the options/arguments have to be >>>> registered to the parser like this: >>>> >>>> EchoDCmd(outputStream *output) : DCmd(output), >>>> _stringval("-strval","a string argument","STRING",false), >>>> >>>> _boolval("-boolval","a boolean argument","BOOLEAN",false), >>>> >>>> _intval("-intval","an integer argument","INTEGER",false), >>>> >>>> _required("-req","a mandatory integer argument","INTEGER",true), >>>> >>>> _fist_arg("first argument","a string argument","STRING",true), >>>> >>>> _second_arg("second argument,"an integer argument,"INTEGER",true), >>>> >>>> _optional_arg("optional argument","an optional string >>>> argument","STRING","false") >>>> >>>> { >>>> >>>> _dcmdparser.add_dcmd_option(&_stringval) >>>> >>>> _dcmdparser.add_dcmd_option(&_boolval); >>>> >>>> _dcmdparser.add_dcmd_option(&_intval); >>>> >>>> _dcmdparser.add_dcmd_option(&_required); >>>> >>>> _dcmdparser.add_argument(&_first_arg); >>>> >>>> _dcmdparser.add_argument(&_second_arg); >>>> >>>> _dcmdparser.add_argument(&_optional_arg); >>>> }; >>>> >>>> The add_dcmd_argument()/ add_dcmd_option() method is used to add an >>>> argument/option to the parser. The option/argument constructor >>>> takes the >>>> name of the option/argument, its description, a string describing its >>>> type and a boolean to specify if the option/argument is mandatory or >>>> not. The parser doesn't support option/argument duplicates (having the >>>> same name) but the code currently doesn't check for duplicates.The >>>> order >>>> used to register options has no impact on the parser. However, the >>>> order >>>> used to register arguments is critical because the parser will use the >>>> same order to parse the command line. In the example above, the parser >>>> expects to have a first argument of type STRING (parsed using >>>> _first_arg), then a second argument of type INTEGER (parsed using >>>> _second_arg) and optionally a third parameter of type STRING (parsed >>>> using _optional_arg). A mandatory option or argument has to be specify >>>> every time the command is invoked. If it is missing, an exception is >>>> thrown at the end of the parsing. Optional arguments have to be >>>> registered after mandatory arguments. An optional argument will be >>>> considered for parsing only if all arguments before it (mandatory or >>>> not) have already been used to parse the command line. >>>> >>>> The DCmdParser and its DCmdArgument instances are embedded in the DCmd >>>> instance. The rational for this design is to limit the number of >>>> C-heap >>>> allocations but also to be able to pre-allocate diagnostic command >>>> instances for critical situations. If the process is running out of >>>> C-heap space, it's not possible to instantiate new diagnostic commands >>>> to troubleshoot the situation. By pre-allocating some diagnostic >>>> commands, it will be possible to run them even in this critical >>>> situation. Of course, the diagnostic command itself should not try to >>>> allocate memory during its execution, this prevents the diagnostic >>>> command to use variable length arguments like strings. By nature, >>>> pre-allocated diagnostic commands aim to be re-usable, this is the >>>> purpose of the reset() method which restores the default status of all >>>> arguments. >>>> >>>> 1-4 Internal invocation >>>> >>>> Using a diagnostic command from the JVM itself is pretty easy: >>>> instantiate the class and invoke the parse() method then the execute() >>>> method. A diagnostic command can be instantiated from inside the JVM >>>> even it is not registered. This is a difference with the external >>>> invocations (from jcmd or JMX) that require the command to be >>>> registered. >>>> >>>> 2 - The JCmd interface >>>> >>>> Diagnostic commands can also be invoked from outside the JVM process, >>>> using the new 'jcmd' utility. The jcmd program uses the attach API >>>> to connect to the JVM, send requests and receive results. The >>>> jcmd utility must be launched on the same machine than the one running >>>> the JVM (its a local tool). Launched without arguments, jcmd >>>> displays a >>>> list of all JVMs running on the machine. The jcmd source code is in >>>> the jdk repository like other existing j* tools. >>>> >>>> To execute a diagnostic command in a particular JVM, the generic >>>> syntax is: >>>> >>>> jcmd [arguments] >>>> >>>> The attachListener has been modified to recognized the jcmd requests. >>>> When a jcmd request is identified, it is parsed to extract the command >>>> name. The JVM performs a look up of this command in a list of >>>> registered >>>> commands. To be executable by an external request, a diagnostic >>>> command >>>> has to be registered. The registration is performed with the >>>> DCmdFactory >>>> class (see services/management.cpp). >>>> >>>> 3 - The JMX interface >>>> >>>> The framework provides a JMX based interface to the diagnostic >>>> commands. >>>> This interface allows remote invocation of diagnostic commands >>>> through a >>>> JMX connection. >>>> >>>> 3-1 The interface >>>> >>>> The information related to the diagnostic commands are accessible >>>> through new methods added to the >>>> com.sun.management.HotspotDiagnosticMXBean: >>>> >>>> public List getDiagnosticCommands(); >>>> >>>> public DiagnosticCommandInfo getDiagnosticCommandInfo(String command); >>>> >>>> public List >>>> getDiagnosticCommandInfo(List >>>> command); >>>> >>>> public List getDiagnosticCommandInfo(); >>>> >>>> public String execute(String commandLine) throws >>>> IllegalArgumentException ; >>>> >>>> public String execute(String cmd, String... arguments) >>>> throws IllegalArgumentException; >>>> >>>> >>>> The getDiagnosticCommands() method returns an array containing the >>>> names >>>> of the not-hidden registered diagnostic commands. >>>> >>>> The three getDiagnosticCommandInfo() methods return one or several >>>> diagnostic command descriptions using the DiagnosticCommandInfo class. >>>> >>>> The two execute() methods allow the user the invoke a diagnostic >>>> command >>>> in different ways. >>>> >>>> The DiagnosticCommandInfo class is describing a diagnostic command >>>> with >>>> the following information: >>>> >>>> public class DiagnosticCommandInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getImpact(); >>>> >>>> public boolean isEnabled(); >>>> >>>> public List getArgumentsInfo(); >>>> } >>>> >>>> The getName() method returns the name of the diagnostic command. This >>>> name is the one to use in execute() methods to invoke the diagnostic >>>> command. >>>> >>>> The getDescription() method returns a general description of the >>>> diagnostic command. >>>> >>>> The getImpact() method returns a description of the intrusiveness of >>>> diagnostic command. >>>> >>>> The isEnabled() method returns true if the method is enabled, false if >>>> it is disabled. A disabled method cannot be executed. >>>> >>>> The getArgumentsInfo() returns a list of descriptions for the >>>> options or >>>> arguments recognized by the diagnostic command. Each >>>> option/argument is >>>> described by a DiagnosticCommandArgumentInfo instance: >>>> >>>> public class DiagnosticCommandArgumentInfo { >>>> >>>> public String getName(); >>>> >>>> public String getDescription(); >>>> >>>> public String getType(); >>>> >>>> public String getDefault(); >>>> >>>> public boolean isMandatory(); >>>> >>>> public boolean isOption(); >>>> >>>> public int getPosition(); >>>> } >>>> >>>> If the DiagnosticCommandArgumentInfo instance describes an option, >>>> isOption() returns true and getPosition() returns -1. Otherwise, when >>>> the DiagnosticCommandArgumentInfo instance describes an argument, >>>> isOption() returns false and getPosition() returns the expected >>>> position >>>> for this argument. The position of an argument is defined >>>> relatively to >>>> all arguments passed on the command line, options are not considered >>>> when defining an argument position. The getDefault() method returns >>>> the >>>> default value of the argument if a default has been defined, otherwise >>>> it returns null. >>>> >>>> 3-2 The implementation >>>> >>>> The framework has been designed in a way that prevents diagnostic >>>> command developers to worry about the JMX interface. In addition to >>>> the methods described in section 1-2, a diagnostic command >>>> developer has >>>> to provide three methods: >>>> >>>> int get_num_arguments() >>>> >>>> which returns the number of option and arguments supported by the >>>> command. >>>> >>>> GrowableArray* get_argument_name_array() >>>> >>>> which provides the name of the arguments supported by the command. >>>> >>>> GrowableyArray* get_argument_info_array() >>>> >>>> which provides the description of each argument with a >>>> DCmdArgumentInfo >>>> instance. DCmdArgumentInfo is a C++ class used by the framework to >>>> generate the sun.com.management.DcmdArgumentInfo instances. This is >>>> done >>>> automatically and the diagnostic command developer doesn't need to >>>> know >>>> how to create Java objects from the runtime. >>>> >>>> 4 - The Diagnostic Commands >>>> >>>> To avoid name collisions between diagnostic commands coming from >>>> different projects, use of a flat name space should be avoided and >>>> a more structured organization is recommended. The framework itself >>>> doesn't depend on this organization, so it will be a set of rules >>>> defining a convention in the way commands are named. >>>> >>>> Diagnostic commands can easily organized in a hierarchical way, so the >>>> template for a command name can be: >>>> >>>> .[sub-domain.] >>>> >>>> This template can be extended with sub-sub-domains and so on. >>>> >>>> A special set of commands without domain will be reserved for the >>>> commands related to the diagnostic framework itself, like the "help" >>>> command. >>>> >>>> >>>> Thanks, >>>> >>>> Fred >>>> >> > From paul.ciprich at gmail.com Tue Dec 13 14:44:15 2011 From: paul.ciprich at gmail.com (Paul Ciprich) Date: Tue, 13 Dec 2011 14:44:15 -0000 Subject: 100218: BigInteger staticRandom field In-Reply-To: References: Message-ID: All, I've created a bug report to address a scalability problem with BigInteger's staticRandom field. The problem is that the shared staticRandom field causes bottlenecks with parallel code. The proposed solution is to change the staticRandom field to a ThreadLocal and eliminate the bottleneck by giving each thread its own copy of the SecureRandom object. Bug 100218 contains a patch with the proposed change if it is deemed acceptable. Thanks, -Paul Ciprich From dmitry.degrave at sun.com Sun Dec 18 18:16:56 2011 From: dmitry.degrave at sun.com (dmitry.degrave at sun.com) Date: Sun, 18 Dec 2011 18:16:56 -0000 Subject: hg: jdk8/tl/corba: 7046238: new InitialContext(); hangs Message-ID: <20111218181649.AD06647753@hg.openjdk.java.net> Changeset: 052dda3b5ce3 Author: dmeetry Date: 2011-12-18 22:12 +0400 URL: http://hg.openjdk.java.net/jdk8/tl/corba/rev/052dda3b5ce3 7046238: new InitialContext(); hangs Summary: Synchronization on a single monitor for contactInfo parameters with identical hashCode() Reviewed-by: robm, skoppar ! src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java