From jonathan.gibbons at sun.com Tue Sep 1 00:24:22 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 01 Sep 2009 00:24:22 +0000 Subject: hg: jdk7/tl/langtools: 6877744: delete extraneous file Message-ID: <20090901002427.694A112937@hg.openjdk.java.net> Changeset: 4fa458c945ac Author: jjg Date: 2009-08-31 17:16 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/4fa458c945ac 6877744: delete extraneous file Reviewed-by: darcy - test/tools/javac/innerClassFile/Driver.java From jonathan.gibbons at sun.com Tue Sep 1 01:32:17 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 01 Sep 2009 01:32:17 +0000 Subject: hg: jdk7/tl/langtools: 6877751: test/tools/javac/6627362/T6627362.java fails Message-ID: <20090901013219.C46601293C@hg.openjdk.java.net> Changeset: 45301370bc5a Author: jjg Date: 2009-08-31 18:25 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/45301370bc5a 6877751: test/tools/javac/6627362/T6627362.java fails Reviewed-by: darcy ! test/tools/javac/6627362/T6627362.java From jonathan.gibbons at sun.com Tue Sep 1 02:50:20 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 01 Sep 2009 02:50:20 +0000 Subject: hg: jdk7/tl/langtools: 6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file Message-ID: <20090901025022.D2CED12941@hg.openjdk.java.net> Changeset: 5a72ba18c471 Author: jjg Date: 2009-08-31 19:43 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/5a72ba18c471 6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file Reviewed-by: darcy ! test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java From Ulf.Zibis at gmx.de Tue Sep 1 08:29:53 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Tue, 01 Sep 2009 10:29:53 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <20090831221217.2CEFA12912@hg.openjdk.java.net> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> Message-ID: <4A9CDB81.1050500@gmx.de> Martin, I like how you have enhanced javadoc for Character class. Some coments: - You more like uppercased hex literals, so we are 2. :-) - you have mixed value and {@code value}. I more like the latter, it's compact and better readable - you have mixed U+1234 and \u1234 style. Why? - often you use '\' for '\', but not ever (e.g. '\t'). I think we can use always '\'. There should not be so much developers in the world who can't decode ISO-8859-1 or UTF-xx. (aren't there many places in the JDK's javadoc where others have used ISO-8859-1 characters ?) - there are many "Character#xYz" or even "java.lang.Character#xYz" or " "java.lang.Abc#xYz" " links left. They could be truncated for better readability and smaller source size - I would like to see backwards-referring like: public static final int MIN_CODE_POINT = MIN_VALUE; public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; -Ulf Am 01.09.2009 00:11, martinrb at google.com schrieb: > Changeset: db5d6b4cbc11 > Author: martin > Date: 2009-08-31 15:00 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/db5d6b4cbc11 > > 6860431: Character.isSurrogate(char ch) > Summary: Add new method Character.isSurrogate(char ch) > Reviewed-by: sherman, darcy, okutsu > > From maurizio.cimadamore at sun.com Tue Sep 1 14:01:43 2009 From: maurizio.cimadamore at sun.com (maurizio.cimadamore at sun.com) Date: Tue, 01 Sep 2009 14:01:43 +0000 Subject: hg: jdk7/tl/langtools: 6650759: Inference of formal type parameter (unused in formal parameters) is not performed Message-ID: <20090901140148.62F2C12978@hg.openjdk.java.net> Changeset: dda7e13f09fb Author: mcimadamore Date: 2009-09-01 14:53 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/dda7e13f09fb 6650759: Inference of formal type parameter (unused in formal parameters) is not performed Summary: propagate inference constraints from 15.12.2.7 to 15.12.2.8 Reviewed-by: jjg ! src/share/classes/com/sun/tools/javac/code/Type.java ! src/share/classes/com/sun/tools/javac/comp/Infer.java ! test/tools/javac/generics/inference/6302954/T6476073.java ! test/tools/javac/generics/inference/6638712/T6638712b.out ! test/tools/javac/generics/inference/6638712/T6638712e.out + test/tools/javac/generics/inference/6650759/T6650759a.java + test/tools/javac/generics/inference/6650759/T6650759b.java + test/tools/javac/generics/inference/6650759/T6650759c.java + test/tools/javac/generics/inference/6650759/T6650759d.java + test/tools/javac/generics/inference/6650759/T6650759e.java + test/tools/javac/generics/inference/6650759/T6650759f.java + test/tools/javac/generics/inference/6650759/T6650759g.java + test/tools/javac/generics/inference/6650759/T6650759h.java + test/tools/javac/generics/inference/6650759/T6650759i.java + test/tools/javac/generics/inference/6650759/T6650759j.java + test/tools/javac/generics/inference/6650759/T6650759k.java + test/tools/javac/generics/inference/6650759/T6650759l.java + test/tools/javac/generics/inference/6650759/T6650759m.java + test/tools/javac/generics/inference/6650759/T6650759m.out From jonathan.gibbons at sun.com Tue Sep 1 18:43:17 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 01 Sep 2009 18:43:17 +0000 Subject: hg: jdk7/tl/langtools: 6877763: update langtools/test/Makefile for JPRT Message-ID: <20090901184328.8E6481298A@hg.openjdk.java.net> Changeset: 40a1327a5283 Author: jjg Date: 2009-09-01 11:35 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/40a1327a5283 6877763: update langtools/test/Makefile for JPRT Reviewed-by: ohair ! test/Makefile From Ulf.Zibis at gmx.de Wed Sep 2 01:55:16 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 03:55:16 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9CDB81.1050500@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> Message-ID: <4A9DD084.6010406@gmx.de> I have separated the "cosmetics": https://bugs.openjdk.java.net/attachment.cgi?id=140&action=diff https://bugs.openjdk.java.net/attachment.cgi?id=141&action=diff -Ulf Am 01.09.2009 10:29, Ulf Zibis schrieb: > Martin, > > I like how you have enhanced javadoc for Character class. > > Some comments: > - You more like uppercased hex literals, so we are 2. :-) > - you have mixed value and {@code value}. I more like the > latter, it's compact and better readable > - you have mixed U+1234 and \u1234 style. Why? > - often you use '\' for '\', but not ever (e.g. '\t'). I think we > can use always '\'. There should not be so much developers in the > world who can't decode ISO-8859-1 or UTF-xx. > (aren't there many places in the JDK's javadoc where others have used > ISO-8859-1 characters ?) > - there are many "Character#xYz" or even "java.lang.Character#xYz" or > " "java.lang.Abc#xYz" " links left. They could be truncated for better > readability and smaller source size > - I would like to see backwards-referring like: > public static final int MIN_CODE_POINT = MIN_VALUE; > public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; > > -Ulf > > > Am 01.09.2009 00:11, martinrb at google.com schrieb: >> Changeset: db5d6b4cbc11 >> Author: martin >> Date: 2009-08-31 15:00 -0700 >> URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/db5d6b4cbc11 >> >> 6860431: Character.isSurrogate(char ch) >> Summary: Add new method Character.isSurrogate(char ch) >> Reviewed-by: sherman, darcy, okutsu >> >> > > From martinrb at google.com Wed Sep 2 03:21:12 2009 From: martinrb at google.com (Martin Buchholz) Date: Tue, 1 Sep 2009 20:21:12 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9CDB81.1050500@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> Message-ID: <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> On Tue, Sep 1, 2009 at 01:29, Ulf Zibis wrote: > Martin, > > I like how you have enhanced javadoc for Character class. > > Some coments: > - You more like uppercased hex literals, so we are 2. :-) I like consistency more than I like either uppercase or lowercase. > > - you have mixed value and {@code value}. I more like the > latter, it's compact and better readable {@code is now the preferred way. I tried to modify the methods I changed, but didn't try to change the whole file. A brave person such as yourself could try to become "code janitor" for the whole jdk. - you have mixed U+1234 and \u1234 style. Why? They are different things. U+1234 describes a Unicode character or codepoint, while '\u1234' is a char (code unit, not code point). See Unicode glossary. > - often you use '\' for '\', but not ever (e.g. '\t'). I think we can > use always '\'. There should not be so much developers in the world who > can't decode ISO-8859-1 or UTF-xx. We try hard to keep source code ASCII. Sorry, the world is adopting UTF-8, but the transition is rather slow. Maybe in 10 years we can go UTF-8 everywhere. (aren't there many places in the JDK's javadoc where others have used > ISO-8859-1 characters ?) > - there are many "Character#xYz" or even "java.lang.Character#xYz" or " > "java.lang.Abc#xYz" " links left. They could be truncated for better > readability and smaller source size I agree. > > - I would like to see backwards-referring like: > public static final int MIN_CODE_POINT = MIN_VALUE; > public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; Those would work, but would add to the confusion between code points and UTF-16 code units. Notice how "MAX_VALUE + 1" looks like an oxymoron. Martin > > > -Ulf > > > Am 01.09.2009 00:11, martinrb at google.com schrieb: > >> Changeset: db5d6b4cbc11 >> Author: martin >> Date: 2009-08-31 15:00 -0700 >> URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/db5d6b4cbc11 >> >> 6860431: Character.isSurrogate(char ch) >> Summary: Add new method Character.isSurrogate(char ch) >> Reviewed-by: sherman, darcy, okutsu >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From uncle.alice at gmail.com Wed Sep 2 05:39:13 2009 From: uncle.alice at gmail.com (Alan Moore) Date: Tue, 1 Sep 2009 22:39:13 -0700 Subject: Regex named-group and backreference syntax Message-ID: Looking at the new named-capture feature, two things jump out at me. The first is that the rules governing group names make "0", "1", "2", etc. valid names. That's bound to cause confusion, as programmers use \k<1> in the regex, or $<1> in the replacement string, meaning them as ordinal backreferences. It will be even worse if they actually have a group named "1", which may or may not be the first (numbered) group. Does this ambiguity add any value to offset the potential confusion? Because it seems to me we could add even more value by disallowing names that start with digits. We could still allow \k<1> and $<1> and such as backreferences, but they would be aliases for \1 and $1 respectively. The advantage is that a backreference in one of those forms could be followed by another digit and there would be no danger of forming a different capture-group reference. For example, $10 could mean group(1) followed by zero, or group(10) if the regex has that many groups. If it's group(1) you want, you can escape the zero with a backslash to make that clear. But what if you really mean group(10) but there's no such group? You won't be notified of your error, because the Matcher assumes you meant group(1) plus "0". But with \k<1> and $<1> there's no ambiguity and no need to escape anything. My other concern is the syntax of backreferences in the replacement string: $. Surveying the other major players (i.e., named-capture-enabled regex flavors associated with popular programming languages), ${name} seems to be the most common syntax--though there aren't a whole lot of data points yet, I admit. Most significantly, .NET does it that way, and we're copying them on the rest of the named-group syntax already, so why not on this? Also, I don't know of any other flavor that uses the $ syntax. To summarize, I want to: - change the replacement-string backreference syntax from $ to ${name} - disallow group names starting with digits - allow backreferences of the form \k and ${n} where 'n' is one or more digits, but interpret them as ordinal instead of named references (and throw an exception if there's no such group). Thoughts? From Xueming.Shen at Sun.COM Wed Sep 2 07:15:13 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Wed, 02 Sep 2009 00:15:13 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: References: Message-ID: <4A9E1B81.9040008@sun.com> Hi Alan, It would be an "ambiguity" (and then confused) only if we had the \k and $ as the legally supported group reference syntax:-) That said I have to admit that it does not have any value-add to allow the a group name begins with a digit character. So if we have a consensus I would be happy to change the spec/implementation to dis-allow the digit letter started group name. I kinda disagree that the "rest of the named-group syntax" is copied from .Net. Actually it is the syntax from Perl 5.10.0/named capture buffer, in which the naming syntax is (?....) and to backreference it with the \k. I did not find a "reference of named capture buffer in replacement" from there. I did consider to use the .Net syntax, but finally decided to go with $ because it is more consistent with the (?...) and \k syntax. To allow \k and $ is a fine idea, it at least looks less "complicated" in replacement case. Sherman Alan Moore wrote: > Looking at the new named-capture feature, two things jump out at me. > The first is that the rules governing group names make "0", "1", "2", > etc. valid names. That's bound to cause confusion, as programmers use > \k<1> in the regex, or $<1> in the replacement string, meaning them as > ordinal backreferences. It will be even worse if they actually have a > group named "1", which may or may not be the first (numbered) group. > > Does this ambiguity add any value to offset the potential confusion? > Because it seems to me we could add even more value by disallowing > names that start with digits. We could still allow \k<1> and $<1> and > such as backreferences, but they would be aliases for \1 and $1 > respectively. The advantage is that a backreference in one of those > forms could be followed by another digit and there would be no danger > of forming a different capture-group reference. > > For example, $10 could mean group(1) followed by zero, or group(10) if > the regex has that many groups. If it's group(1) you want, you can > escape the zero with a backslash to make that clear. But what if you > really mean group(10) but there's no such group? You won't be > notified of your error, because the Matcher assumes you meant group(1) > plus "0". But with \k<1> and $<1> there's no ambiguity and no need to > escape anything. > > My other concern is the syntax of backreferences in the replacement > string: $. Surveying the other major players (i.e., > named-capture-enabled regex flavors associated with popular > programming languages), ${name} seems to be the most common > syntax--though there aren't a whole lot of data points yet, I admit. > Most significantly, .NET does it that way, and we're copying them on > the rest of the named-group syntax already, so why not on this? Also, > I don't know of any other flavor that uses the $ syntax. > > To summarize, I want to: > > - change the replacement-string backreference syntax from $ to ${name} > > - disallow group names starting with digits > > - allow backreferences of the form \k and ${n} where 'n' is one or > more digits, but interpret them as ordinal instead of named references > (and throw an exception if there's no such group). > > Thoughts? > From Ulf.Zibis at gmx.de Wed Sep 2 08:07:27 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 10:07:27 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> Message-ID: <4A9E27BF.8000905@gmx.de> Am 02.09.2009 05:21, Martin Buchholz schrieb: > > > On Tue, Sep 1, 2009 at 01:29, Ulf Zibis > wrote: > > > {@code is now the preferred way. I tried to modify the methods I changed, > but didn't try to change the whole file. You also have added old style, so I asked why you have mixed it: /** - * The minimum value of a Unicode surrogate code unit in the UTF-16 encoding. + * The minimum value of a Unicode surrogate code unit in the + * UTF-16 encoding, constant '\uD800'. * * @since 1.5 */ public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; > A brave person such as yourself could try to > become "code janitor" for the whole jdk. In this case it should be simple to replace ... against {@code ...} on the whole JDK. My problem is, that I don't have the CPU-power to build the JDK, and check the whole javadoc if it would have broken. > > > - you have mixed U+1234 and \u1234 style. Why? > > > They are different things. U+1234 describes a Unicode character or > codepoint, > while '\u1234' is a char (code unit, not code point). > See Unicode glossary. Yes, after a closer look I can see the point, so I corrected their usage where I thought, it was wrong. But what's about using {@code U+10000}, found for MIN_SUPPLEMENTARY_CODE_POINT javadoc ? "U+10000" is not valid java code, but I must admit, that it looks better than "0x010000" Maybe we must use U+10000 here. > > > - often you use '\' for '\', but not ever (e.g. '\t'). I think > we can use always '\'. There should not be so much developers in > the world who can't decode ISO-8859-1 or UTF-xx. > > > We try hard to keep source code ASCII. Sorry, the world is adopting > UTF-8, > but the transition is rather slow. Maybe in 10 years we can go UTF-8 > everywhere. I have been fallen into a trap: '\' *is* ASCII, it's '\u005C'. so is there any reason remaining on '\' ??? > > > > > - I would like to see backwards-referring like: > public static final int MIN_CODE_POINT = MIN_VALUE; > public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE > + 1; > > > Those would work, but would add to the confusion > between code points and UTF-16 code units. > Notice how "MAX_VALUE + 1" looks like an oxymoron. > ;-) But I don't have any problem as I don't have using Byte.MAX_VALUE + 1. The real source of the confusion is elsewhere, i.e. imagine we would have class Integer managing 16 + 32 bit values. Maybe it would become more clear adding MAX_SUPPLEMENTARY_CODE_POINT for *consistency* and having following order: (Note that I added " of type {@code int}", similar to description of MIN_VALUE.) /** * The minimum value of a * * Unicode code point, constant {@code U+0000} * of type {@code int}. * * @since 1.5 */ public static final int MIN_CODE_POINT = MIN_VALUE; /** * The minimum value of a * * Unicode supplementary code point, constant {@code U+10000} * of type {@code int}. * * @since 1.5 */ public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; /** * The maximum value of a * * Unicode code point, constant {@code U+10FFFF} * of type {@code int}. * * @since 1.5 */ public static final int MAX_CODE_POINT = 0X10FFFF; /** * The maximum value of a * * Unicode supplementary code point, constant {@code U+10FFFF} * of type {@code int}. * * @since 1.7 */ public static final int MAX_SUPPLEMENTARY_CODE_POINT = MAX_CODE_POINT; -Ulf > Martin > > > > > -Ulf > > > Am 01.09.2009 00:11, martinrb at google.com > schrieb: > > Changeset: db5d6b4cbc11 > Author: martin > Date: 2009-08-31 15:00 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/db5d6b4cbc11 > > 6860431: Character.isSurrogate(char ch) > Summary: Add new method Character.isSurrogate(char ch) > Reviewed-by: sherman, darcy, okutsu > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From uncle.alice at gmail.com Wed Sep 2 08:58:46 2009 From: uncle.alice at gmail.com (Alan Moore) Date: Wed, 2 Sep 2009 01:58:46 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: <4A9E1B81.9040008@sun.com> References: <4A9E1B81.9040008@sun.com> Message-ID: Hi Sherman, On Wed, Sep 2, 2009 at 12:15 AM, Xueming Shen wrote: > It would be an "ambiguity" (and then confused) only if we > had the \k and $ as the legally supported group > reference syntax:-) That said I have to admit that it does > not have any value-add to allow the a group name begins > with a digit character. So if we have a consensus I would > be happy to change the spec/implementation to dis-allow the > digit letter started group name. Yeah, "ambiguity" isn't really the right word for allowing all-digit group names. It's not so much that it's inherently confusing, just that it makes it easier than usual for people to confuse themselves. :-/ > I kinda disagree that the "rest of the named-group syntax" is > copied from .Net. Actually it is the syntax from Perl > 5.10.0/named capture buffer, in which the naming syntax is > (?....) and to backreference it with the \k. I did > not find a "reference of named capture buffer in replacement" > from there. I did consider to use the .Net syntax, but finally > decided to go with $ because it is more consistent with > the (?...) and \k syntax. Didn't Perl copy it from .NET (among others)? Perl didn't introduce named capture until v5.10, and now it supports all of the syntax variants found .NET and Python (which definitely had named groups before Perl). But wherever you got it from, the syntax is the same as .NET's, except for replacement-string backreferences. Anyway, I think consistency with other flavors is more important than internal consistency in this case. Every flavor uses angle brackets within the regex, but Perl uses $+{name} in the replacement string, while .NET and JRegex both use ${name}. I think anyone who comes over to java.util.regex with previous regex experience is more likely to expect that syntax than anything else. > To allow \k and $ is a fine idea, it at least looks less "complicated" > in replacement case. From Ulf.Zibis at gmx.de Wed Sep 2 09:42:26 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 11:42:26 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> Message-ID: <4A9E3E02.6050503@gmx.de> Am 02.09.2009 05:21, Martin Buchholz schrieb: > > > - I would like to see backwards-referring like: > public static final int MIN_CODE_POINT = MIN_VALUE; > public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE > + 1; > > > Those would work, but would add to the confusion > between code points and UTF-16 code units. > Notice how "MAX_VALUE + 1" looks like an oxymoron. > ;-) But I don't have any problem as I don't have using Byte.MAX_VALUE + 1. The real source of the confusion is elsewhere, i.e. imagine we would have class Integer managing 16 + 32 bit values. Maybe it would become more clear adding MAX_SUPPLEMENTARY_CODE_POINT for *consistency* and having following order: (Note that I added " of type {@code int}", similar to description of MIN_VALUE.) /** * The minimum value of a * * Unicode code point, constant {@code U+0000} * of type {@code int}. * * @since 1.5 */ public static final int MIN_CODE_POINT = MIN_VALUE; /** * The minimum value of a * * Unicode supplementary code point, constant {@code U+10000} * of type {@code int}. * * @since 1.5 */ public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; /** * The maximum value of a * * Unicode code point, constant {@code U+10FFFF} * of type {@code int}. * * @since 1.5 */ public static final int MAX_CODE_POINT = 0X10FFFF; /** * The maximum value of a * * Unicode supplementary code point, constant {@code U+10FFFF} * of type {@code int}. * * @since 1.7 */ public static final int MAX_SUPPLEMENTARY_CODE_POINT = MAX_CODE_POINT; Having following would be useful too: public static final byte MIN_ASCII = MIN_VALUE; public static final byte MAX_ASCII = Byte.MAX_VALUE; -Ulf -------------- next part -------------- An HTML attachment was scrubbed... URL: From martinrb at google.com Wed Sep 2 16:27:39 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 2 Sep 2009 09:27:39 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9E27BF.8000905@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> Message-ID: <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> On Wed, Sep 2, 2009 at 01:07, Ulf Zibis wrote: > Am 02.09.2009 05:21, Martin Buchholz schrieb: > > > > On Tue, Sep 1, 2009 at 01:29, Ulf Zibis wrote: > > > {@code is now the preferred way. I tried to modify the methods I changed, > but didn't try to change the whole file. > > > You also have added old style, so I asked why you have mixed it: > > /** > - * The minimum value of a Unicode surrogate code unit in the UTF-16 encoding. > + * The minimum value of a Unicode surrogate code unit in the > + * UTF-16 encoding, constant '\uD800'. > * > * @since 1.5 > */ > public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; > > I would have used {@code here if I could figure out how to make it work ("\" shows up literally in the generated output). > > A brave person such as yourself could try to > become "code janitor" for the whole jdk. > > > In this case it should be simple to replace ... against {@code > ...} on the whole JDK. My problem is, that I don't have the CPU-power to > build the JDK, and check the whole javadoc if it would have broken. > Building the javadoc requires a lot of memory - a javadoc bug - someone could try to fix that... - you have mixed U+1234 and \u1234 style. Why? They are different things. U+1234 describes a Unicode character or codepoint, while '\u1234' is a char (code unit, not code point). See Unicode glossary. Yes, after a closer look I can see the point, so I corrected their usage > where I thought, it was wrong. > But what's about using {@code U+10000}, found for > MIN_SUPPLEMENTARY_CODE_POINT javadoc ? > "U+10000" is not valid java code, but I must admit, that it looks better > than "0x010000" > Maybe we must use U+10000 here. > > > >> - often you use '\' for '\', but not ever (e.g. '\t'). I think we can >> use always '\'. There should not be so much developers in the world who >> can't decode ISO-8859-1 or UTF-xx. > > > We try hard to keep source code ASCII. Sorry, the world is adopting UTF-8, > but the transition is rather slow. Maybe in 10 years we can go UTF-8 > everywhere. > > > I have been fallen into a trap: '\' *is* ASCII, it's '\u005C'. so is > there any reason remaining on '\' ??? > \uXXXX has special meaning in java source files, even in comments. - I would like to see backwards-referring like: public static final int MIN_CODE_POINT = MIN_VALUE; > public static final int MIN_SUPPLEMENTARY_CODE_POINT = MAX_VALUE + 1; Those would work, but would add to the confusion between code points and UTF-16 code units. Notice how "MAX_VALUE + 1" looks like an oxymoron. ;-) > But I don't have any problem as I don't have using Byte.MAX_VALUE + 1. > The real source of the confusion is elsewhere, i.e. imagine we would have > class Integer managing 16 + 32 bit values. > > Maybe it would become more clear adding MAX_SUPPLEMENTARY_CODE_POINT for > *consistency* and having following order: > MAX_SUPPLEMENTARY_CODE_POINT would not be a bad thing to have, but not compelling enough for the effort involved with any change to java se. People who use these constants anyways have to understand the model - that code points are divided into bmp and supplementary. Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lloyd at redhat.com Wed Sep 2 16:40:09 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 02 Sep 2009 11:40:09 -0500 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> Message-ID: <4A9E9FE9.7060107@redhat.com> On 09/02/2009 11:27 AM, Martin Buchholz wrote: > On Wed, Sep 2, 2009 at 01:07, Ulf Zibis > wrote: > Am 02.09.2009 05:21, Martin Buchholz schrieb: >> On Tue, Sep 1, 2009 at 01:29, Ulf Zibis > > wrote: >> >> {@code is now the preferred way. I tried to modify the methods I >> changed, >> but didn't try to change the whole file. > > You also have added old style, so I asked why you have mixed it: > > /** > - * The minimum value of a Unicode surrogate code unit in the UTF-16 > encoding. > + * The minimum value of a Unicode surrogate code unit in the > + * UTF-16 encoding, constant '\uD800'. > * > * @since 1.5 > */ > public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; > > I would have used {@code here if I could figure out > how to make it work > ("\" shows up literally in the generated output). Why not just do {@code \uD800}? I'm like 60% sure that would work just fine. :-) - DML From mr at sun.com Wed Sep 2 16:43:40 2009 From: mr at sun.com (Mark Reinhold) Date: Wed, 02 Sep 2009 09:43:40 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: uncle.alice@gmail.com; Wed, 02 Sep 2009 01:58:46 PDT; Message-ID: <20090902164340.E5DF7A89@eggemoggin.niobe.net> > Date: Wed, 02 Sep 2009 01:58:46 -0700 > From: uncle.alice at gmail.com > On Wed, Sep 2, 2009 at 12:15 AM, Xueming Shen wrote: >> It would be an "ambiguity" (and then confused) only if we >> had the \k and $ as the legally supported group >> reference syntax:-) That said I have to admit that it does >> not have any value-add to allow the a group name begins >> with a digit character. So if we have a consensus I would >> be happy to change the spec/implementation to dis-allow the >> digit letter started group name. That seems reasonable to me. > ... > > Anyway, I think consistency with other flavors is more important than > internal consistency in this case. Every flavor uses angle brackets > within the regex, but Perl uses $+{name} in the replacement string, > while .NET and JRegex both use ${name}. I think anyone who comes over > to java.util.regex with previous regex experience is more likely to > expect that syntax than anything else. I think this line of reasoning has merit, though I'm not sure that JRegex is an interesting data point any more. Python uses yet a third replacement-string syntax, \g, so that's a data point in favor of angle brackets. The \g prefix, though, wouldn't fit that well with the rest of the existing Java replacement syntax. I'd say ${name} is the best option here given that it will be familiar, at least, to Perl and .NET developers. - Mark From martinrb at google.com Wed Sep 2 17:03:42 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 2 Sep 2009 10:03:42 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9E9FE9.7060107@redhat.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> Message-ID: <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd wrote: > On 09/02/2009 11:27 AM, Martin Buchholz wrote: > >> On Wed, Sep 2, 2009 at 01:07, Ulf Zibis > Ulf.Zibis at gmx.de>> wrote: >> Am 02.09.2009 05:21, Martin Buchholz schrieb: >> >>> On Tue, Sep 1, 2009 at 01:29, Ulf Zibis >> > wrote: >>> >>> {@code is now the preferred way. I tried to modify the methods I >>> changed, >>> but didn't try to change the whole file. >>> >> >> You also have added old style, so I asked why you have mixed it: >> >> /** >> - * The minimum value of a Unicode surrogate code unit in the UTF-16 >> encoding. >> + * The minimum value of a Unicode surrogate code unit in the >> + * UTF-16 encoding, constant '\uD800'. >> * >> * @since 1.5 >> */ >> public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; >> >> I would have used {@code here if I could figure out >> how to make it work >> ("\" shows up literally in the generated output). >> > > Why not just do {@code \uD800}? I'm like 60% sure that would work just > fine. :-) > I'm pretty sure it would fail. Prove me wrong! Searching the JDK sources for regex ^ *\*.*\\u[0-9a-fA-F]{4} is a good way to find javadoc bugs, e.g. http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() Martin > - DML > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lloyd at redhat.com Wed Sep 2 17:11:53 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 02 Sep 2009 12:11:53 -0500 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> Message-ID: <4A9EA759.3050804@redhat.com> On 09/02/2009 12:03 PM, Martin Buchholz wrote: > On Wed, Sep 2, 2009 at 09:40, David M. Lloyd > wrote: > Why not just do {@code \uD800}? I'm like 60% sure that would work > just fine. :-) > > > I'm pretty sure it would fail. Prove me wrong! > Searching the JDK sources for regex > ^ *\*.*\\u[0-9a-fA-F]{4} > is a good way to find javadoc bugs, e.g. > http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() Ah, you're right. It worked in my previewer but not in the actual javadoc. It's pretty bad that that sequence has special meaning but you can't escape a \ with another \. I guess in the worst case you could always do \u005CD800 or something like that. - DML From jonathan.gibbons at sun.com Wed Sep 2 17:29:18 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Wed, 02 Sep 2009 17:29:18 +0000 Subject: hg: jdk7/tl/langtools: 6874249: Check has duplicate local variable and field for "source" Message-ID: <20090902172924.4036112A6E@hg.openjdk.java.net> Changeset: 8d999cb7ec09 Author: jjg Date: 2009-09-02 10:20 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/8d999cb7ec09 6874249: Check has duplicate local variable and field for "source" Reviewed-by: mcimadamore ! src/share/classes/com/sun/tools/javac/comp/Check.java From gnu_andrew at member.fsf.org Wed Sep 2 17:55:49 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Wed, 2 Sep 2009 18:55:49 +0100 Subject: Regex named-group and backreference syntax In-Reply-To: <20090902164340.E5DF7A89@eggemoggin.niobe.net> References: <20090902164340.E5DF7A89@eggemoggin.niobe.net> Message-ID: <17c6771e0909021055r78d75d60i3dc80c61d64b4f00@mail.gmail.com> 2009/9/2 Mark Reinhold : >> Date: Wed, 02 Sep 2009 01:58:46 -0700 >> From: uncle.alice at gmail.com > >... > I'd say ${name} is the best option here given that it will be familiar, > at least, to Perl and .NET developers. > It's also used for substitution in shell and Makefiles :) > - Mark > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Mandy.Chung at Sun.COM Wed Sep 2 19:25:19 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Wed, 02 Sep 2009 12:25:19 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK Message-ID: <4A9EC69F.6000509@sun.com> This is related to 6857194: Add hotspot new perf counters to aid class loading performance measurement. It's useful to add performance counters in the library code so that perf data from the JDK and VM can be collected and output in a unified way (written in the jvmstat shared memory buffer). I add a simple sun.misc.PerfCounter class to maintain the list of perf counters for the library to use. This fix only instruments the class loading and jar/zip to collect simple basic metrics. Additional perf counters will be added in the future. Webrev: http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ Thanks Mandy From Ulf.Zibis at gmx.de Wed Sep 2 19:46:36 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 21:46:36 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> Message-ID: <4A9ECB9C.9060105@gmx.de> Am 02.09.2009 18:27, Martin Buchholz schrieb: > > > On Wed, Sep 2, 2009 at 01:07, Ulf Zibis > wrote: > > Am 02.09.2009 05:21, Martin Buchholz schrieb: > > /** > - * The minimum value of a Unicode surrogate code unit in the > UTF-16 encoding. > + * The minimum value of a Unicode surrogate code unit in the > + * UTF-16 encoding, constant '\uD800'. > * > * @since 1.5 > */ > public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; > > > I would have used {@code here if I could figure out > how to make it work > ("\" shows up literally in the generated output). Could this be seen as a bug? IMHO the {@code construct should be a 100% replaceable for . Any Bug Id ? > > > >> A brave person such as yourself could try to >> become "code janitor" for the whole jdk. > > In this case it should be simple to replace ... > against {@code ...} on the whole JDK. My problem is, that I don't > have the CPU-power to build the JDK, and check the whole javadoc > if it would have broken. > > > Building the javadoc requires a lot of memory - > a javadoc bug - someone could try to fix that... ... but as we see, simply replacing ... against {@code ...} in the whole JDK would not work. :-( > > Yes, after a closer look I can see the point, so I corrected their > usage where I thought, it was wrong. > But what's about using {@code U+10000}, found for > MIN_SUPPLEMENTARY_CODE_POINT javadoc ? > "U+10000" is not valid java code, but I must admit, that it looks > better than "0x010000" > Maybe we must use U+10000 here. > No answer. Does that mean, {@code U+10000} is valid? > >> - I would like to see backwards-referring like: public static final >> int MIN_CODE_POINT = MIN_VALUE; >> >> public static final int MIN_SUPPLEMENTARY_CODE_POINT = >> MAX_VALUE + 1; >> >> >> Those would work, but would add to the confusion >> between code points and UTF-16 code units. >> Notice how "MAX_VALUE + 1" looks like an oxymoron. >> > ;-) > But I don't have any problem as I don't have using Byte.MAX_VALUE + 1. > The real source of the confusion is elsewhere, i.e. imagine we > would have class Integer managing 16 + 32 bit values. > > Maybe it would become more clear adding > MAX_SUPPLEMENTARY_CODE_POINT for *consistency* and having > following order: > > > MAX_SUPPLEMENTARY_CODE_POINT would not be a bad thing to have, > but not compelling enough for the effort involved with any change to > java se. :-( ... but changing the order would decrease the confusion ? -Ulf -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ulf.Zibis at gmx.de Wed Sep 2 19:46:52 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 21:46:52 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9EA759.3050804@redhat.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> Message-ID: <4A9ECBAC.7060303@gmx.de> Am 02.09.2009 19:11, David M. Lloyd schrieb: > On 09/02/2009 12:03 PM, Martin Buchholz wrote: >> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd > > wrote: >> Why not just do {@code \uD800}? I'm like 60% sure that would work >> just fine. :-) >> >> >> I'm pretty sure it would fail. Prove me wrong! >> Searching the JDK sources for regex >> ^ *\*.*\\u[0-9a-fA-F]{4} >> is a good way to find javadoc bugs, e.g. >> http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() >> > > Ah, you're right. It worked in my previewer but not in the actual > javadoc. It's pretty bad that that sequence has special meaning but > you can't escape a \ with another \. I guess in the worst case you > could always do \u005CD800 or something like that. > Looks little better, but not much. Did somebody tried it (Martin)? If it works in a previewer, is there any chance to change the javadoc spec, staying backwards compatible? -Ulf From mr at sun.com Wed Sep 2 19:47:42 2009 From: mr at sun.com (Mark Reinhold) Date: Wed, 02 Sep 2009 12:47:42 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: gnu_andrew@member.fsf.org; Wed, 02 Sep 2009 18:55:49 BST; <17c6771e0909021055r78d75d60i3dc80c61d64b4f00@mail.gmail.com> Message-ID: <20090902194742.C8A3E1B37@eggemoggin.niobe.net> > Date: Wed, 02 Sep 2009 18:55:49 +0100 > From: Andrew John Hughes > 2009/9/2 Mark Reinhold : >> I'd say ${name} is the best option here given that it will be familiar, >> at least, to Perl and .NET developers. > > It's also used for substitution in shell and Makefiles :) That too! - Mark From Ulf.Zibis at gmx.de Wed Sep 2 20:12:10 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 22:12:10 +0200 Subject: hg: jdk7/tl/jdk: 16 new changesets In-Reply-To: <20090830070022.D6A6B12820@hg.openjdk.java.net> References: <20090830070022.D6A6B12820@hg.openjdk.java.net> Message-ID: <4A9ED19A.7050608@gmx.de> Am 30.08.2009 08:54, tim.bell at sun.com schrieb: > Changeset: 4c6a5ea563ba > Author: peytoia > Date: 2009-07-30 14:45 +0900 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/4c6a5ea563ba > > 6866243: Javadoc for java.lang.Character still refers to Unicode 4 instead of 5 > Reviewed-by: okutsu > > ! src/share/classes/java/lang/Character.java > There is still a reference to Unicode 4. See comment in method toUpperCaseCharArray(int codePoint). -Ulf From martinrb at google.com Wed Sep 2 20:29:16 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 2 Sep 2009 13:29:16 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9ECBAC.7060303@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> Message-ID: <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> On Wed, Sep 2, 2009 at 12:46, Ulf Zibis wrote: > Am 02.09.2009 19:11, David M. Lloyd schrieb: >> >> On 09/02/2009 12:03 PM, Martin Buchholz wrote: >>> >>> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd >> > wrote: >>> ? ?Why not just do {@code \uD800}? ?I'm like 60% sure that would work >>> ? ?just fine. :-) >>> >>> >>> I'm pretty sure it would fail. ? Prove me wrong! >>> Searching the JDK sources for regex >>> ^ *\*.*\\u[0-9a-fA-F]{4} >>> is a good way to find javadoc bugs, e.g. >>> http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() >> >> Ah, you're right. ?It worked in my previewer but not in the actual >> javadoc. ?It's pretty bad that that sequence has special meaning but you >> can't escape a \ with another \. ?I guess in the worst case you could always >> do \u005CD800 or something like that. >> > > Looks little better, but not much. Did somebody tried it (Martin)? Well.... learn something new every day. Let's turn this into a fix. It's yet another "turkish i" bug. http://cr.openjdk.java.net/~martin/webrevs/openjdk7/javadoc-unicode-escapes/ Xueming, please file a bug and review. Synopsis: Unreadable \uXXXX in javadoc Description: Replace \uXXXX by \u005CXXXX, or simply delete Martin > If it works in a previewer, is there any chance to change the javadoc spec, > staying backwards compatible? > > -Ulf > > > From Ulf.Zibis at gmx.de Wed Sep 2 21:58:25 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 02 Sep 2009 23:58:25 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> Message-ID: <4A9EEA81.8000501@gmx.de> Am 02.09.2009 22:29, Martin Buchholz schrieb: > On Wed, Sep 2, 2009 at 12:46, Ulf Zibis wrote: > >> Am 02.09.2009 19:11, David M. Lloyd schrieb: >> >>> On 09/02/2009 12:03 PM, Martin Buchholz wrote: >>> >>>> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd >>> > wrote: >>>> Why not just do {@code \uD800}? I'm like 60% sure that would work >>>> just fine. :-) >>>> >>>> >>>> I'm pretty sure it would fail. Prove me wrong! >>>> Searching the JDK sources for regex >>>> ^ *\*.*\\u[0-9a-fA-F]{4} >>>> is a good way to find javadoc bugs, e.g. >>>> http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() >>>> >>> Ah, you're right. It worked in my previewer but not in the actual >>> javadoc. It's pretty bad that that sequence has special meaning but you >>> can't escape a \ with another \. I guess in the worst case you could always >>> do \u005CD800 or something like that. >>> >>> >> Looks little better, but not much. Did somebody tried it (Martin)? >> > > Well.... learn something new every day. > Let's turn this into a fix. > It's yet another "turkish i" bug. > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/javadoc-unicode-escapes/ > > Xueming, please file a bug and review. > > Synopsis: Unreadable \uXXXX in javadoc > Description: Replace \uXXXX by \u005CXXXX, or simply delete > Doesn't {@code "t\u005Cu0131tle"} work too ? If not, can this be seen as a bug ? > Searching the JDK sources for regex > ^ *\*.*\\u[0-9a-fA-F]{4} Doesn't it make sense to cover all occurrences in JDK ? -Ulf From martinrb at google.com Wed Sep 2 22:10:04 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 2 Sep 2009 15:10:04 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9EEA81.8000501@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9EEA81.8000501@gmx.de> Message-ID: <1ccfd1c10909021510y41649b2ep650885c17a41ace5@mail.gmail.com> On Wed, Sep 2, 2009 at 14:58, Ulf Zibis wrote: > Am 02.09.2009 22:29, Martin Buchholz schrieb: > Doesn't {@code "t\u005Cu0131tle"} work too ? I think so. This would make it easier to globally replace with {@code. Here's a bit of Emacs Lisp to get you started: (defun tt-code () (interactive) (query-replace-regexp "<\\(tt\\|code\\)>\\([^<>\\\\]+\\)" "{@code \\2}")) >> Searching the JDK sources for regex >> ^ *\*.*\\u[0-9a-fA-F]{4} > > > Doesn't it make sense to cover all occurrences in JDK ? In non-public javadoc (that is, javadoc which is usually read directly instead of via the generated html) it is mostly harmless, and more readable as well. Martin From Xueming.Shen at Sun.COM Wed Sep 2 22:21:12 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Wed, 02 Sep 2009 15:21:12 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: <20090902194742.C8A3E1B37@eggemoggin.niobe.net> References: <20090902194742.C8A3E1B37@eggemoggin.niobe.net> Message-ID: <4A9EEFD8.3060002@sun.com> RFE#6878475 has been filed to trace this issue. At this point we are going to update the doc and implementation to (1)disallow the group name started with digit character (2)use ${name} for the group reference in replacement string. The \k and ${n} can leave for further discussion (whether or not we really need this NEW feature, while there is existing syntax that can do the job just fine). Sherman Mark Reinhold wrote: >> Date: Wed, 02 Sep 2009 18:55:49 +0100 >> From: Andrew John Hughes >> > > >> 2009/9/2 Mark Reinhold : >> >>> I'd say ${name} is the best option here given that it will be familiar, >>> at least, to Perl and .NET developers. >>> >> It's also used for substitution in shell and Makefiles :) >> > > That too! > > - Mark > From Ulf.Zibis at gmx.de Wed Sep 2 22:46:24 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 03 Sep 2009 00:46:24 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909021510y41649b2ep650885c17a41ace5@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9EEA81.8000501@gmx.de> <1ccfd1c10909021510y41649b2ep650885c17a41ace5@mail.gmail.com> Message-ID: <4A9EF5C0.60509@gmx.de> Am 03.09.2009 00:10, Martin Buchholz schrieb: > On Wed, Sep 2, 2009 at 14:58, Ulf Zibis wrote: > >> Doesn't {@code "t\u005Cu0131tle"} work too ? >> > > I think so. So can I securely replace all occurrences of ... by {@code ...} using \u005CuXXXX in Character.java ? -Ulf From irisg at alum.mit.edu Wed Sep 2 23:04:14 2009 From: irisg at alum.mit.edu (irisg at alum.mit.edu) Date: Wed, 2 Sep 2009 16:04:14 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9EC69F.6000509@sun.com> References: <4A9EC69F.6000509@sun.com> Message-ID: <000301ca2c21$b1395d30$13ac1790$@mit.edu> Hi, Mandy. > This is related to 6857194: Add hotspot new perf counters to aid class > loading performance measurement. [ ... ] > Webrev: > http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ Looks good. iris From forax at univ-mlv.fr Wed Sep 2 23:52:25 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 03 Sep 2009 01:52:25 +0200 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <000301ca2c21$b1395d30$13ac1790$@mit.edu> References: <4A9EC69F.6000509@sun.com> <000301ca2c21$b1395d30$13ac1790$@mit.edu> Message-ID: <4A9F0539.2070104@univ-mlv.fr> Le 03/09/2009 01:04, irisg at alum.mit.edu a ?crit : > Hi, Mandy. > > >> This is related to 6857194: Add hotspot new perf counters to aid class >> loading performance measurement. >> > [ ... ] > > >> Webrev: >> http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ >> > Looks good. > > iris > In PerfCounter.java, - static field perf should be final. - newConstantPerfCounter() seems unused, it's perhaps for a future usage ? - newPerfCounter(String) should be declared with default visibility (not private), currently the compiler generates useless accessors (access$000 etc). - fields private String name; private LongBuffer lb; should be declared final to avoid race problem, even if I'am not sure this can happen here because all PerfCounter constructor calls are done in a block i.e under the protection of a lock. R?mi From uncle.alice at gmail.com Wed Sep 2 23:46:31 2009 From: uncle.alice at gmail.com (Alan Moore) Date: Wed, 2 Sep 2009 16:46:31 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: <4A9EEFD8.3060002@sun.com> References: <20090902194742.C8A3E1B37@eggemoggin.niobe.net> <4A9EEFD8.3060002@sun.com> Message-ID: On Wed, Sep 2, 2009 at 3:21 PM, Xueming Shen wrote: > > RFE#6878475 has been filed to trace this issue. > > At this point we are going to update the doc and implementation to > (1)disallow the group name started with digit character > (2)use ${name} for the group reference in replacement string. Great! Thank you. > The \k and ${n} can leave for further discussion (whether or not we > really need this NEW feature, while there is existing syntax that can > do the job just fine). Agreed--it's a separate issue. But at least now we'll have the option. From David.Holmes at Sun.COM Thu Sep 3 00:08:03 2009 From: David.Holmes at Sun.COM (David Holmes - Sun Microsystems) Date: Thu, 03 Sep 2009 10:08:03 +1000 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9EC69F.6000509@sun.com> References: <4A9EC69F.6000509@sun.com> Message-ID: <4A9F08E3.8020406@sun.com> Hi Mandy, Mandy Chung said the following on 09/03/09 05:25: > This is related to 6857194: Add hotspot new perf counters to aid class > loading performance measurement. > > It's useful to add performance counters in the library code so that perf > data from the JDK and VM can be collected and output in a unified way > (written in the jvmstat shared memory buffer). I add a simple > sun.misc.PerfCounter class to maintain the list of perf counters for the > library to use. This fix only instruments the class loading and jar/zip > to collect simple basic metrics. Additional perf counters will be > added in the future. > > Webrev: > http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ What is the performance overhead here? This seems like a lot of extra code if you don't want to read the counters. Is there not some way to only conditionally enable them? We're sticking in a lot of System.nanoTime() calls and on some systems it isn't necessarily cheap eg Windows - see 6440250. Even if it is cheap, there are potentially a lot of them in classloading intensive situations. David From Alan.Bateman at Sun.COM Thu Sep 3 08:54:55 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 03 Sep 2009 09:54:55 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9EC69F.6000509@sun.com> References: <4A9EC69F.6000509@sun.com> Message-ID: <4A9F845F.9060809@sun.com> Mandy Chung wrote: > This is related to 6857194: Add hotspot new perf counters to aid class > loading performance measurement. > > It's useful to add performance counters in the library code so that > perf data from the JDK and VM can be collected and output in a unified > way (written in the jvmstat shared memory buffer). I add a simple > sun.misc.PerfCounter class to maintain the list of perf counters for > the library to use. This fix only instruments the class loading and > jar/zip to collect simple basic metrics. Additional perf counters > will be added in the future. > > Webrev: > http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ > > Thanks > Mandy It's good to see the use of the instrumentation buffer extended to the libraries. I'm not sure how sun.misc.Perf behaves when running with -XX:-UsePerfData. You've probably checked this anyway, but just in case... It would be good to include a comment to define the meaning of each of the counters. For example, in ClassLoader.loadClass, it's not clear if you mean to include the time to check if the class has already been loaded (just on that one, if the lookup is not meant to be included then it would reduce the calls to nanoTimes a bit). Is it necessary to have separate counters for zip and JAR? If I'm reading this correctly, then zipFiles and jarFiles will both be incremented when a JAR file is opened - is that right? I agree with R?mi's comment that perf, name, and lb can be final. Would addElapsedTime(start) be better named as addElapsedTimeFrom(start) to make it clear that it doesn't add "start" to the elapsed time, but rather the elapsed time from the given starting time? This might sound crazy, but do the updates need to be synchronized? I don't think there is any synchronization in the VM. I agree with David's concern about the overhead of the calls to nanoTimes (which I'm sure you are measuring) but for the synchronization there are places where both a counter and an elapsed time are updated. -Alan. From forax at univ-mlv.fr Thu Sep 3 09:48:09 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 03 Sep 2009 11:48:09 +0200 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F845F.9060809@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> Message-ID: <4A9F90D9.9070301@univ-mlv.fr> Le 03/09/2009 10:54, Alan Bateman a ?crit : > Mandy Chung wrote: >> This is related to 6857194: Add hotspot new perf counters to aid >> class loading performance measurement. >> >> It's useful to add performance counters in the library code so that >> perf data from the JDK and VM can be collected and output in a >> unified way (written in the jvmstat shared memory buffer). I add a >> simple sun.misc.PerfCounter class to maintain the list of perf >> counters for the library to use. This fix only instruments the class >> loading and jar/zip to collect simple basic metrics. Additional >> perf counters will be added in the future. >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ >> >> Thanks >> Mandy > It's good to see the use of the instrumentation buffer extended to the > libraries. > > I'm not sure how sun.misc.Perf behaves when running with > -XX:-UsePerfData. You've probably checked this anyway, but just in > case... > > It would be good to include a comment to define the meaning of each of > the counters. For example, in ClassLoader.loadClass, it's not clear if > you mean to include the time to check if the class has already been > loaded (just on that one, if the lookup is not meant to be included > then it would reduce the calls to nanoTimes a bit). > > Is it necessary to have separate counters for zip and JAR? If I'm > reading this correctly, then zipFiles and jarFiles will both be > incremented when a JAR file is opened - is that right? > > I agree with R?mi's comment that perf, name, and lb can be final. > > Would addElapsedTime(start) be better named as > addElapsedTimeFrom(start) to make it clear that it doesn't add "start" > to the elapsed time, but rather the elapsed time from the given > starting time? > > This might sound crazy, but do the updates need to be synchronized? I > don't think there is any synchronization in the VM. I agree with > David's concern about the overhead of the calls to nanoTimes (which > I'm sure you are measuring) but for the synchronization there are > places where both a counter and an elapsed time are updated. Hi Alan, Classloading is now done in parallele, zip and jar can be loaded by different threads. "for the synchronization there are places where both a counter and an elapsed time are updated" => the problem is that these synchronisations are done on two different monitors. I don't see how to remove them easily. Furthermore I think that all synchronized can not be easily replaced by some atomics operations (unsafe.put* or unsafe.compareAndSwap) because long in a ByteBuffer aren't volatile. Perhaps with the Doug Lea's Fences (scheduled to be introduced in jdk7) but I'm not sure. > > -Alan. R?mi From Alan.Bateman at Sun.COM Thu Sep 3 09:56:04 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 03 Sep 2009 10:56:04 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F90D9.9070301@univ-mlv.fr> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> Message-ID: <4A9F92B4.6080201@sun.com> R?mi Forax wrote: > : > Hi Alan, > Classloading is now done in parallele, zip and jar can be loaded by > different threads. > > "for the synchronization there are places where both a counter and an > elapsed time are updated" > => the problem is that these synchronisations are done on two > different monitors. > I don't see how to remove them easily. > > Furthermore I think that all synchronized can not be easily replaced > by some atomics operations > (unsafe.put* or unsafe.compareAndSwap) because long in a ByteBuffer > aren't volatile. > Perhaps with the Doug Lea's Fences (scheduled to be introduced in > jdk7) but I'm not sure. I understand - I'm just posing the question because correctness isn't a major issue here and perhaps the trade-off could be considered. -Alan. From forax at univ-mlv.fr Thu Sep 3 10:59:48 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 03 Sep 2009 12:59:48 +0200 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F92B4.6080201@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> <4A9F92B4.6080201@sun.com> Message-ID: <4A9FA1A4.4000401@univ-mlv.fr> Le 03/09/2009 11:56, Alan Bateman a ?crit : > R?mi Forax wrote: >> : >> Hi Alan, >> Classloading is now done in parallele, zip and jar can be loaded by >> different threads. >> >> "for the synchronization there are places where both a counter and an >> elapsed time are updated" >> => the problem is that these synchronisations are done on two >> different monitors. >> I don't see how to remove them easily. >> >> Furthermore I think that all synchronized can not be easily replaced >> by some atomics operations >> (unsafe.put* or unsafe.compareAndSwap) because long in a ByteBuffer >> aren't volatile. >> Perhaps with the Doug Lea's Fences (scheduled to be introduced in >> jdk7) but I'm not sure. > I understand - I'm just posing the question because correctness isn't > a major issue here and perhaps the trade-off could be considered. > > -Alan. Writing longs on a 32 bits system leads to really surprising results :) R?mi From Ulf.Zibis at gmx.de Thu Sep 3 13:22:33 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 03 Sep 2009 15:22:33 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9CDB81.1050500@gmx.de> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> Message-ID: <4A9FC319.3030508@gmx.de> Am 02.09.2009 22:29, Martin Buchholz schrieb: > On Wed, Sep 2, 2009 at 12:46, Ulf Zibis wrote: > >> Am 02.09.2009 19:11, David M. Lloyd schrieb: >> >>> On 09/02/2009 12:03 PM, Martin Buchholz wrote: >>> >>>> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd >>> > wrote: >>>> Why not just do {@code \uD800}? I'm like 60% sure that would work >>>> just fine. :-) >>>> >>>> >>>> I'm pretty sure it would fail. Prove me wrong! >>>> Searching the JDK sources for regex >>>> ^ *\*.*\\u[0-9a-fA-F]{4} >>>> is a good way to find javadoc bugs, e.g. >>>> http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() >>>> >>> Ah, you're right. It worked in my previewer but not in the actual >>> javadoc. It's pretty bad that that sequence has special meaning but you >>> can't escape a \ with another \. I guess in the worst case you could always >>> do \u005CD800 or something like that. >>> >>> >> Looks little better, but not much. Did somebody tried it (Martin)? >> > > Well.... learn something new every day. > Let's turn this into a fix. > It's yet another "turkish i" bug. > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/javadoc-unicode-escapes/ > > Xueming, please file a bug and review. > > Synopsis: Unreadable \uXXXX in javadoc > Description: Replace \uXXXX by \u005CXXXX, or simply delete > > BTW regarding javadoc of class String: - replace(char,char) and replace(CharSequence,CharSequence) should refer to one another by @see.... - replace(CharSequence,CharSequence) should state, if original is returned in case of no match. -Ulf From gnu_andrew at member.fsf.org Thu Sep 3 14:43:23 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 3 Sep 2009 15:43:23 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F90D9.9070301@univ-mlv.fr> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> Message-ID: <17c6771e0909030743l4a861ccwfdef158ea48962e6@mail.gmail.com> 2009/9/3 R?mi Forax : > Le 03/09/2009 10:54, Alan Bateman a ?crit : >> >> Mandy Chung wrote: >>> >>> This is related to 6857194: Add hotspot new perf counters to aid class >>> loading performance measurement. >>> >>> It's useful to add performance counters in the library code so that perf >>> data from the JDK and VM can be collected and output in a unified way >>> (written in the jvmstat shared memory buffer). ?I add a simple >>> sun.misc.PerfCounter class to maintain the list of perf counters for the >>> library to use. ?This fix only instruments the class loading and jar/zip to >>> collect simple basic metrics. ? Additional perf counters will be added in >>> the future. >>> >>> Webrev: >>> ? ?http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ >>> >>> Thanks >>> Mandy >> >> It's good to see the use of the instrumentation buffer extended to the >> libraries. >> >> I'm not sure how sun.misc.Perf behaves when running with -XX:-UsePerfData. >> You've probably checked this anyway, but just in case... >> >> It would be good to include a comment to define the meaning of each of the >> counters. For example, in ClassLoader.loadClass, it's not clear if you mean >> to include the time to check if the class has already been loaded (just on >> that one, if the lookup is not meant to be included then it would reduce the >> calls to nanoTimes a bit). >> >> Is it necessary to have separate counters for zip and JAR? If I'm reading >> this correctly, then zipFiles and jarFiles will both be incremented when a >> JAR file is opened - is that right? >> >> I agree with R?mi's comment that perf, name, and lb can be final. >> >> Would addElapsedTime(start) be better named as addElapsedTimeFrom(start) >> to make it clear that it doesn't add "start" to the elapsed time, but rather >> the elapsed time from the given starting time? >> >> This might sound crazy, but do the updates need to be synchronized? I >> don't think there is any synchronization in the VM. I agree with David's >> concern about the overhead of the calls to nanoTimes (which I'm sure you are >> measuring) but for the synchronization there are places where both a counter >> and an elapsed time are updated. > > Hi Alan, > Classloading is now done in parallele, zip and jar can be loaded by > different threads. > > "for the synchronization there are places where both a counter and an > elapsed time are updated" > => the problem is that these synchronisations are done on two different > monitors. > ? ? ?I don't see how to remove them easily. > > Furthermore I think that all synchronized can not be easily replaced by some > atomics operations > (unsafe.put* or unsafe.compareAndSwap) because long in a ByteBuffer aren't > volatile. > Perhaps with the Doug Lea's Fences (scheduled to be introduced in jdk7) but > I'm not sure. > >> >> -Alan. > > R?mi > The use of synchronized at present seems flawed as only the set methods are protected and not the get. So lb.get could be called while in an lb.put call. I don't see the reason for using a LongBuffer either, as only index 0 is ever used. Why not use an AtomicLong? What is the purpose of d3dAvailable? I don't know this piece of code so I'm not sure what it's counting, but it will presumably be zero forever on non-Windows systems. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Alan.Bateman at Sun.COM Thu Sep 3 15:44:22 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 03 Sep 2009 16:44:22 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <17c6771e0909030743l4a861ccwfdef158ea48962e6@mail.gmail.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> <17c6771e0909030743l4a861ccwfdef158ea48962e6@mail.gmail.com> Message-ID: <4A9FE456.5040409@sun.com> Andrew John Hughes wrote: > : > The use of synchronized at present seems flawed as only the set > methods are protected and not the get. So lb.get could be called > while in an lb.put call. I don't see the reason for using a > LongBuffer either, as only index 0 is ever used. Why not use an > AtomicLong? > The LongBuffer is a direct buffer with a reference to memory in the PerfData instrumentation buffer. This is the shared memory that jvmstat clients (jstat, VisualVM , ..) will attach to in order to monitor the VM. > What is the purpose of d3dAvailable? I don't know this piece of code > so I'm not sure what it's counting, but it will presumably be zero > forever on non-Windows systems. > Mandy can say more about this, but it essentially allows jstat to see if the target VM is using the D3D pipeline or not. -Alan. From Mandy.Chung at Sun.COM Thu Sep 3 16:13:01 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Thu, 03 Sep 2009 09:13:01 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9FE456.5040409@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> <17c6771e0909030743l4a861ccwfdef158ea48962e6@mail.gmail.com> <4A9FE456.5040409@sun.com> Message-ID: <4A9FEB0D.3040403@sun.com> Alan Bateman wrote: > Andrew John Hughes wrote: >> : >> The use of synchronized at present seems flawed as only the set >> methods are protected and not the get. So lb.get could be called >> while in an lb.put call. I don't see the reason for using a >> LongBuffer either, as only index 0 is ever used. Why not use an >> AtomicLong? >> > The LongBuffer is a direct buffer with a reference to memory in the > PerfData instrumentation buffer. This is the shared memory that > jvmstat clients (jstat, VisualVM , ..) will attach to in order to > monitor the VM. I can add synchronized in the get method. The PerfData instrumentation buffer is designed to be read by another process such as jstat tool so that we can monitor a running VM without interfering its execution. > >> What is the purpose of d3dAvailable? I don't know this piece of code >> so I'm not sure what it's counting, but it will presumably be zero >> forever on non-Windows systems. >> > Mandy can say more about this, but it essentially allows jstat to see > if the target VM is using the D3D pipeline or not. > Exactly. D3D pipeline is not always available on all Windows machines and it depends on the graphic board, the OS version, and other configuration. We have been doing startup performance measurement on various systems and there is perf difference with D3D available or not. Adding a counter (it should be a constant counter) to indicate if D3D pipeline is available would be useful. Note that d3dAvailable is only added when running on Windows. On Solaris/Linux, ClientCounters class will not be initialized and thus d3dAvailable is not added. I should add a comment to describe about platform-specific counters or optional counters. Mandy > -Alan. From gnu_andrew at member.fsf.org Thu Sep 3 17:34:18 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 3 Sep 2009 18:34:18 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9FEB0D.3040403@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> <4A9F90D9.9070301@univ-mlv.fr> <17c6771e0909030743l4a861ccwfdef158ea48962e6@mail.gmail.com> <4A9FE456.5040409@sun.com> <4A9FEB0D.3040403@sun.com> Message-ID: <17c6771e0909031034k24e70919qf5cc9f107e492acc@mail.gmail.com> 2009/9/3 Mandy Chung : > Alan Bateman wrote: >> >> Andrew John Hughes wrote: >>> >>> : >>> The use of synchronized at present seems flawed as only the set >>> methods are protected and not the get. ?So lb.get could be called >>> while in an lb.put call. ?I don't see the reason for using a >>> LongBuffer either, as only index 0 is ever used. ?Why not use an >>> AtomicLong? >>> >> >> The LongBuffer is a direct buffer with a reference to memory in the >> PerfData instrumentation buffer. This is the shared memory that jvmstat >> clients (jstat, VisualVM , ..) will attach to in order to monitor the VM. > > I can add synchronized in the get method. ?The PerfData instrumentation > buffer is designed to be read by another process such as jstat tool so that > we can monitor a running VM without ?interfering its execution. I see now it's been generated from the Perf class so I can understand why the LongBuffer is being used. As to locking get(), it gets a little more interesting if the values are being retrieved from a different process. However, presumably the get() method is invoked on the VM being probed rather than the VM running jstat, etc. otherwise the wrong buffer would be read. So the lock should still serve its purpose. >> >>> What is the purpose of d3dAvailable? ?I don't know this piece of code >>> so I'm not sure what it's counting, but it will presumably be zero >>> forever on non-Windows systems. >>> >> >> Mandy can say more about this, but it essentially allows jstat to see if >> the target VM is using the D3D pipeline or not. >> > Exactly. ?D3D pipeline is not always available on all Windows machines and > it depends on the graphic board, the OS version, and other configuration. > ?We have been doing startup performance measurement on various systems and > there is perf difference with D3D available or not. ?Adding a counter (it > should be a constant counter) to indicate if D3D pipeline is available would > be useful. > > Note that d3dAvailable is only added when running on Windows. ?On > Solaris/Linux, ClientCounters class will not be initialized and thus > d3dAvailable is not added. ?I should add a comment to describe about > platform-specific counters or optional counters. > Thanks, this makes sense now. > Mandy >> >> -Alan. > > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Xueming.Shen at Sun.COM Thu Sep 3 17:49:38 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 03 Sep 2009 10:49:38 -0700 Subject: Regex named-group and backreference syntax In-Reply-To: References: <20090902194742.C8A3E1B37@eggemoggin.niobe.net> <4A9EEFD8.3060002@sun.com> Message-ID: <4AA001B2.6080103@sun.com> Hi Guess you might be interested to help review the change for this RFE, here is the webrev. http://cr.openjdk.java.net/~sherman/6878475/webrev Since this is an API update, the change will need to go through a review process before it can be integrated into the workspace, so it might take a little while. Regards, Sherman Alan Moore wrote: > On Wed, Sep 2, 2009 at 3:21 PM, Xueming Shen wrote: > >> RFE#6878475 has been filed to trace this issue. >> >> At this point we are going to update the doc and implementation to >> (1)disallow the group name started with digit character >> (2)use ${name} for the group reference in replacement string. >> > > Great! Thank you. > > >> The \k and ${n} can leave for further discussion (whether or not we >> really need this NEW feature, while there is existing syntax that can >> do the job just fine). >> > > Agreed--it's a separate issue. But at least now we'll have the option. > From Mandy.Chung at Sun.COM Thu Sep 3 18:02:02 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Thu, 03 Sep 2009 11:02:02 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F845F.9060809@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F845F.9060809@sun.com> Message-ID: <4AA0049A.6050900@sun.com> Alan Bateman wrote: > Mandy Chung wrote: >> This is related to 6857194: Add hotspot new perf counters to aid >> class loading performance measurement. >> >> It's useful to add performance counters in the library code so that >> perf data from the JDK and VM can be collected and output in a >> unified way (written in the jvmstat shared memory buffer). I add a >> simple sun.misc.PerfCounter class to maintain the list of perf >> counters for the library to use. This fix only instruments the class >> loading and jar/zip to collect simple basic metrics. Additional >> perf counters will be added in the future. >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ >> >> Thanks >> Mandy > It's good to see the use of the instrumentation buffer extended to the > libraries. > > I'm not sure how sun.misc.Perf behaves when running with > -XX:-UsePerfData. You've probably checked this anyway, but just in > case... Adding -XX:-UsePerfData option works fine but I am yet to understand the logics since this should be different than the case with a small PerfDataMemorySize where the perf counters are still created but in the C heap. I'm looking into the hotspot perfdata implementation further. > > It would be good to include a comment to define the meaning of each of > the counters. For example, in ClassLoader.loadClass, it's not clear if > you mean to include the time to check if the class has already been > loaded (just on that one, if the lookup is not meant to be included > then it would reduce the calls to nanoTimes a bit). > As David points out the high number of calls to System.nanoTime, I should refine the fix not to include the lookup time. I'll update the fix and also describes the meaning of each counter. > Is it necessary to have separate counters for zip and JAR? If I'm > reading this correctly, then zipFiles and jarFiles will both be > incremented when a JAR file is opened - is that right? > That's right, both zipFiles and jarFiles counters are incremented. > I agree with R?mi's comment that perf, name, and lb can be final. > Agreed. > Would addElapsedTime(start) be better named as > addElapsedTimeFrom(start) to make it clear that it doesn't add "start" > to the elapsed time, but rather the elapsed time from the given > starting time? > Ok. > This might sound crazy, but do the updates need to be synchronized? I > don't think there is any synchronization in the VM. I agree with > David's concern about the overhead of the calls to nanoTimes (which > I'm sure you are measuring) but for the synchronization there are > places where both a counter and an elapsed time are updated. > Yes, I ran the server benchmarks on Windows XP that shows negligible overhead. I have to rerun the solaris-i586 measurement as I got some high standard deviation. I'm composing my reply to David's email. With the synchronization, we might miss some updates. It's a tradeoff between correctness and performance overhead (I have to find out the reasons why it was decided not to have synchronization in the hotspot implementation). Is the counter update a fast operation - updating the direct buffer? I think so and thus this should not cause high lock contention on the PerfCounter. Thanks Mandy > -Alan. From martinrb at google.com Thu Sep 3 18:10:42 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 11:10:42 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4A9FC319.3030508@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> Message-ID: <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> I agree that the spec can be clarified. Another case is the similar http://java.sun.com/javase/6/docs/api/java/lang/String.html#replace(char, char) which states "Returns a new string", but then goes on to contradict itself, although the meaning is clear. Webrev please. Martin On Thu, Sep 3, 2009 at 06:22, Ulf Zibis wrote: > > > Am 02.09.2009 22:29, Martin Buchholz schrieb: >> >> On Wed, Sep 2, 2009 at 12:46, Ulf Zibis wrote: >> >>> >>> Am 02.09.2009 19:11, David M. Lloyd schrieb: >>> >>>> >>>> On 09/02/2009 12:03 PM, Martin Buchholz wrote: >>>> >>>>> >>>>> On Wed, Sep 2, 2009 at 09:40, David M. Lloyd >>>> > wrote: >>>>> ? Why not just do {@code \uD800}? ?I'm like 60% sure that would work >>>>> ? just fine. :-) >>>>> >>>>> >>>>> I'm pretty sure it would fail. ? Prove me wrong! >>>>> Searching the JDK sources for regex >>>>> ^ *\*.*\\u[0-9a-fA-F]{4} >>>>> is a good way to find javadoc bugs, e.g. >>>>> >>>>> http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase() >>>>> >>>> >>>> Ah, you're right. ?It worked in my previewer but not in the actual >>>> javadoc. ?It's pretty bad that that sequence has special meaning but you >>>> can't escape a \ with another \. ?I guess in the worst case you could >>>> always >>>> do \u005CD800 or something like that. >>>> >>>> >>> >>> Looks little better, but not much. Did somebody tried it (Martin)? >>> >> >> Well.... learn something new every day. >> Let's turn this into a fix. >> It's yet another "turkish i" bug. >> >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/javadoc-unicode-escapes/ >> >> Xueming, please file a bug and review. >> >> Synopsis: Unreadable \uXXXX in javadoc >> Description: Replace \uXXXX by \u005CXXXX, or simply delete >> >> > > BTW regarding javadoc of class String: > - replace(char,char) and replace(CharSequence,CharSequence) should refer to > one another by @see.... > - replace(CharSequence,CharSequence) should state, if original is returned > in case of no match. > > -Ulf > > > > From Mandy.Chung at Sun.COM Thu Sep 3 18:36:48 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Thu, 03 Sep 2009 11:36:48 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9F08E3.8020406@sun.com> References: <4A9EC69F.6000509@sun.com> <4A9F08E3.8020406@sun.com> Message-ID: <4AA00CC0.9000402@sun.com> David Holmes - Sun Microsystems wrote: > Hi Mandy, > > Mandy Chung said the following on 09/03/09 05:25: >> This is related to 6857194: Add hotspot new perf counters to aid >> class loading performance measurement. >> >> It's useful to add performance counters in the library code so that >> perf data from the JDK and VM can be collected and output in a >> unified way (written in the jvmstat shared memory buffer). I add a >> simple sun.misc.PerfCounter class to maintain the list of perf >> counters for the library to use. This fix only instruments the class >> loading and jar/zip to collect simple basic metrics. Additional >> perf counters will be added in the future. >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ > > What is the performance overhead here? This seems like a lot of extra > code if you don't want to read the counters. Is there not some way to > only conditionally enable them? I ran the server benchmarks and the Windows XP result shows negligible difference. I'm rerunning my solaris-i586 measurement (I got high diff in the standard deviation from my previous runs). Windows XP SP 3 Intel Core 2 CPU @3.0Ghz, 1.96 GB RAM ============================================================================== mchung.baseline.server: Benchmark Samples Mean Stdev Geomean Weight reference_server 11 7591.49 38.91 jetstream 11 125.58 1.24 0.10 scimark 11 619.94 4.86 0.15 specjbb2000 11 94540.14 493.47 0.15 specjbb2005 11 43320.15 193.86 0.25 specjvm98 11 577.06 1.74 0.15 volano25 11 45661.45 1146.69 0.20 ============================================================================== mchung.perfcounters: Benchmark Samples Mean Stdev %Diff P Significant reference_server 11 7588.94 48.89 -0.03 0.893 * jetstream 11 125.57 0.88 -0.00 0.990 * scimark 11 616.95 5.78 -0.48 0.203 * specjbb2000 11 94040.74 385.93 -0.53 0.016 * specjbb2005 11 43166.00 191.27 -0.36 0.075 * specjvm98 11 577.39 1.69 0.06 0.654 * volano25 11 46119.64 1259.95 1.00 0.383 * ============================================================================== * - Not Significant: A non-zero %Diff for the mean could be noise. If the %Diff is 0, an actual difference may still exist. In either case, more samples would be needed to detect an actual difference in sample means. To provide a way to enable I can't think of a better way other than adding the conditional check in the new calls I add. > > We're sticking in a lot of System.nanoTime() calls and on some systems > it isn't necessarily cheap eg Windows - see 6440250. Even if it is > cheap, there are potentially a lot of them in classloading intensive > situations. > Thanks for the CR#. FYI. The hotspot VM has a "sun.os.hrt.frequency" perf counter to store the QueryPerformanceFrequency. The system used for the benchmark runs has the value of 2,992,550,000. I am going to find a system using ACPI PMT and run the benchmarks to measure its overhead after revising the fix to reduce the number of System.nanoTime() calls. Thanks Mandy > David From martinrb at google.com Thu Sep 3 18:47:30 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 11:47:30 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters Message-ID: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> Taking this discussion public. It has happened that concurrently there are two fixes in progress for long suffering RFE http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 Given the number of votes and support in third party java zip packages, jdk should certainly support it. Sherman has a webrev here: http://cr.openjdk.java.net/~sherman/zipflush/webrev/ Brandon Long at Google has contributed an implementation that has a webrev here: http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Z_SYNC_FLUSH/ I've been doing some reviewing and thinking about this myself. The zlib and Deflater API is hard to understand. It seems to me that the proper place to specify the flushing behavior is when calling setInput, not when calling one of the deflate methods. I'm imagining something like setInput(byte[]b, int off, int len, int flags) or more java-esque enum FlushingBehavior { NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, FINISH } setInput(byte[]b, int off, int len, FlushingBehavior) Martin On Thu, Aug 27, 2009 at 23:46, Xueming Shen wrote: > Another long over-due zip RFE > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 > with 93 votes. > > Background info: > > zlib has following 6 allowed flush values when invoking deflate()/inflate > > #define Z_NO_FLUSH ? ? ?0 > #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ > #define Z_SYNC_FLUSH ? ?2 > #define Z_FULL_FLUSH ? ?3 > #define Z_FINISH ? ? ? ?4 > #define Z_BLOCK ? ? ? ? 5 > > The values are not really used by inflate(), so we only need to worry about > the > deflate(). > > Our implementation now uses Z_NO_FLUSH for all deflation except when > "finish()" > is invoked, in which case we use Z_FINISH. > > When Z_NO_FLUSH is used, the deflater may accumulate/pend/hold input data in > its internal > buffer for better compression (in which the existing output data might not > be a "complete" > block), some applications (as those mentioned in the bug report)however > might need to flush > all pending data out so the output data is a "complete" block, therefor the > corresponding > de-compressor can work on those data. > > Z_SYNC_FLUSH and Z_FULL_FLUSH achieve this. The difference is that the > "full_flush" will > reset the existing hash table and start a new one for the coming new data, > which is really > not very useful. And the only difference compared to current "reset()" is > the reset() will > need to reallocate the memory, not a big deal. > > See zlib.h for more details (?) > > The change in Deflater is actually relatively easy, see the webrev > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > I would like to hear your opinion on > > (1)I'm proposing to simply add a "flush()" method to support the > Z_SYNC_FLUSH only. The > alternative is to have a flush(int) method + 2 constant sync_flush and > full_flush) > > (2)What should we do to the flush() method in DeflaterOutputStream class. > Ideally it should > be overridden like in the webrev, with API doc to explain that it does 2 > things (1) flush > the deflater (2)flush the underlying outputstream, I believe this is what > the developer is > expecting and what the API should have been implemented at first place. > However this definitely > is an "incompatible" change, given the existing "flush the underlying os > only" behavior has > been in place for decade. I just wonder which approach we should take. I > tend to leave it > un-touched and do our best to "educate" the developer to go with > > ?79 ? ? static class FlushableDOS extends DeflaterOutputStream { > ?80 ? ? ? ? public FlushableDOS(OutputStream out) { > ?81 ? ? ? ? ? ? super(out); > ?82 ? ? ? ? } > ?83 ?84 ? ? ? ? public void flush() throws IOException { > ?85 ? ? ? ? ? ? int len = 0; > ?86 ? ? ? ? ? ? while ((len = def.flush(buf, 0, buf.length)) > 0) { > ?87 ? ? ? ? ? ? ? ? out.write(buf, 0, len); > ?88 ? ? ? ? ? ? } > ?89 ? ? ? ? ? ? out.flush(); > ?90 ? ? ? ? } > ?91 ? ? } > > We can add something in the class description to explain about the "flush" > > (3)During the debug, I noticed the InflaterInputStream.available() issue. > The method is currently specified as "0 if EOF 1 otherwise", which does not > look right. The BufferedReader.readLine() in test case Flush()is blocked in > StreamDecoder#325, the inReady() at ln#323 keeps returning true for the > inputstream (InflaterInputStream). I believe this available() should be > specified/implemented as > > 0 if EOF, in.available() if inf.needInput() is true, otherwise 1. > > Opinion? This is going to be a separate bugid, if we agree to fix it. Btw, > how to write above spec in English?:-) > > Sherman > > > > > > > > > > > From Ulf.Zibis at gmx.de Thu Sep 3 19:51:39 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 03 Sep 2009 21:51:39 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> Message-ID: <4AA01E4B.8020500@gmx.de> Am 03.09.2009 20:10, Martin Buchholz schrieb: > I agree that the spec can be clarified. > Another case is the similar > > http://java.sun.com/javase/6/docs/api/java/lang/String.html#replace(char, char) > > which states "Returns a new string", but then goes on to contradict itself, > although the meaning is clear. > > Webrev please. > > Martin, I was in the assumption, that you could add this clarification to your CR as you are involved anyway on finishing the javadoc of String. As you may be know, webrev script is a pain for me, as I'm on Windows. CYGWIN is buggy in that case, so each 2nd time I try this, Windows comes to hang because of C heap overflow. I like to finish the Character class and file the changes via patch on https://bugs.openjdk.java.net. So I would be happy If you could answer my question, if replacing all occurrences of ... by {@code ...} using \u005CuXXXX is secure. -Ulf From Xueming.Shen at Sun.COM Thu Sep 3 22:02:51 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 03 Sep 2009 15:02:51 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <20090903204137.GB15971@google.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> Message-ID: <4AA03D0B.1030206@sun.com> Same as the proposed spec/impl change to InflaterInputStream.isAvailable(), it is also a risky/incompatible change to override DeflaterOutputStream.flush() method to flush the underlying deflater. Existing apps that are using DOS.flush() (directly or in-directly) will not be happy to see the overall compression ratio gets worse after migrating to JDK7. I don't have any data to back this assumption, given DOS has been used for decade, this risk for sure is real. This of course contradicts to the request of this RFE which expects/assumes that the DOS.flush() should sync_flush the underlying deflater. Basically the change in Deflater alone is "good" enough to provide A solution for this issue (developer currently has to use nasty/hack workaround), it's easy to override DOS.flush (and/or IIS.isAvailble()) to whatever you like if the existing is not what you want. Having said that, I still hope the consensus is that we should just do the RIGHT thing:-) As you said, the only benefit of adding a pair of syncFlush()/flushed is to match the existing finish()/finished, personally I feel the finish()/finished() control flow() is "complicated" enough, why add another one. Still fell the best choice is to simply expose what the zlib provides, I'm still debating with myself if the Z_FINISH should be included as one of the flush options as well, someone might prefer not to use that finish()/finished() control flow... Sherman Brandon Long wrote: > On 09/03/09 Martin Buchholz uttered the following other thing: > >> The zlib and Deflater API is hard to understand. >> It seems to me that the proper place to specify the flushing behavior is >> when calling setInput, not when calling one of the deflate methods. >> >> I'm imagining something like >> setInput(byte[]b, int off, int len, int flags) >> or more java-esque >> enum FlushingBehavior { >> NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, FINISH } >> setInput(byte[]b, int off, int len, FlushingBehavior) >> > > Looking at DeflaterOutputStream, setInput is called in write, but flush > is in a very separate place. > > We're using this to implement a compressed line oriented network > protocol, and so we're likely to have buffering (multiple writes) and > then a flush when we're done, we're not building up the entire response > and calling write just once. > > So, I'm not sure how you'd get the expected "stream" behavior out of > DeflaterOutputStream if you put the flushing behavior on setInput. > > Having Deflater.deflate take a flush type more closely mimics the > zlib/jzlib deflate function. Having a separate flush call more closely > matches finish/finished on the API. > > GNU's classpath "fixes" this behavior, and their API is a flush call on > Deflater (though no flushed, so they're Deflater.deflate probably loops) > > Looking at Android's JDK, it has the same bug as the OpenJDK (no flush). > > Anyways, after Martin's review, I changed it to syncFlush and passed > tightened up some other things.. and dropped the > InflaterInputStream.available change which was similar to yours (he felt > that would be harder to get in). I guess it partially depends on > whether we're targetting OpenJDK 6 or 7. > > Brandon > > >> Martin >> >> On Thu, Aug 27, 2009 at 23:46, Xueming Shen wrote: >> >>> Another long over-due zip RFE >>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 >>> with 93 votes. >>> >>> Background info: >>> >>> zlib has following 6 allowed flush values when invoking deflate()/inflate >>> >>> #define Z_NO_FLUSH 0 >>> #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ >>> #define Z_SYNC_FLUSH 2 >>> #define Z_FULL_FLUSH 3 >>> #define Z_FINISH 4 >>> #define Z_BLOCK 5 >>> >>> The values are not really used by inflate(), so we only need to worry about >>> the >>> deflate(). >>> >>> Our implementation now uses Z_NO_FLUSH for all deflation except when >>> "finish()" >>> is invoked, in which case we use Z_FINISH. >>> >>> When Z_NO_FLUSH is used, the deflater may accumulate/pend/hold input data in >>> its internal >>> buffer for better compression (in which the existing output data might not >>> be a "complete" >>> block), some applications (as those mentioned in the bug report)however >>> might need to flush >>> all pending data out so the output data is a "complete" block, therefor the >>> corresponding >>> de-compressor can work on those data. >>> >>> Z_SYNC_FLUSH and Z_FULL_FLUSH achieve this. The difference is that the >>> "full_flush" will >>> reset the existing hash table and start a new one for the coming new data, >>> which is really >>> not very useful. And the only difference compared to current "reset()" is >>> the reset() will >>> need to reallocate the memory, not a big deal. >>> >>> See zlib.h for more details (?) >>> >>> The change in Deflater is actually relatively easy, see the webrev >>> >>> http://cr.openjdk.java.net/~sherman/zipflush/webrev >>> >>> I would like to hear your opinion on >>> >>> (1)I'm proposing to simply add a "flush()" method to support the >>> Z_SYNC_FLUSH only. The >>> alternative is to have a flush(int) method + 2 constant sync_flush and >>> full_flush) >>> >>> (2)What should we do to the flush() method in DeflaterOutputStream class. >>> Ideally it should >>> be overridden like in the webrev, with API doc to explain that it does 2 >>> things (1) flush >>> the deflater (2)flush the underlying outputstream, I believe this is what >>> the developer is >>> expecting and what the API should have been implemented at first place. >>> However this definitely >>> is an "incompatible" change, given the existing "flush the underlying os >>> only" behavior has >>> been in place for decade. I just wonder which approach we should take. I >>> tend to leave it >>> un-touched and do our best to "educate" the developer to go with >>> >>> 79 static class FlushableDOS extends DeflaterOutputStream { >>> 80 public FlushableDOS(OutputStream out) { >>> 81 super(out); >>> 82 } >>> 83 84 public void flush() throws IOException { >>> 85 int len = 0; >>> 86 while ((len = def.flush(buf, 0, buf.length)) > 0) { >>> 87 out.write(buf, 0, len); >>> 88 } >>> 89 out.flush(); >>> 90 } >>> 91 } >>> >>> We can add something in the class description to explain about the "flush" >>> >>> (3)During the debug, I noticed the InflaterInputStream.available() issue. >>> The method is currently specified as "0 if EOF 1 otherwise", which does not >>> look right. The BufferedReader.readLine() in test case Flush()is blocked in >>> StreamDecoder#325, the inReady() at ln#323 keeps returning true for the >>> inputstream (InflaterInputStream). I believe this available() should be >>> specified/implemented as >>> >>> 0 if EOF, in.available() if inf.needInput() is true, otherwise 1. >>> >>> Opinion? This is going to be a separate bugid, if we agree to fix it. Btw, >>> how to write above spec in English?:-) >>> >>> Sherman >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> > > From martinrb at google.com Thu Sep 3 22:15:33 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 15:15:33 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4AA01E4B.8020500@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> Message-ID: <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> On Thu, Sep 3, 2009 at 12:51, Ulf Zibis wrote: > Am 03.09.2009 20:10, Martin Buchholz schrieb: > I like to finish the Character class and file the changes via patch on > https://bugs.openjdk.java.net. So I would be happy If you could answer my > question, if replacing all occurrences of ... by {@code ...} > using ?\u005CuXXXX is secure. Here is my recommendation: I think it is worthwhile to convert => {@code I have been doing this in files that I "own", but have not tried to make a more pervasive change. I support such a more pervasive change, but it should be done with a script that gets a fair amount of scrutiny first, and will have to be restricted to those parts of the jdk that are truly maintained by the openjdk team, not code for which the true master lives elsewhere. I think we could get agreement to change at least core libraries. As part of this project, you would need to be able to run full builds including the javadoc, and verify that the output html is not damaged by the process. You could ignore a particular ... snippet if the text in between contains troublesome characters such as \ & < > @ Martin From blong at google.com Thu Sep 3 20:41:37 2009 From: blong at google.com (Brandon Long) Date: Thu, 3 Sep 2009 13:41:37 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> Message-ID: <20090903204137.GB15971@google.com> On 09/03/09 Martin Buchholz uttered the following other thing: > The zlib and Deflater API is hard to understand. > It seems to me that the proper place to specify the flushing behavior is > when calling setInput, not when calling one of the deflate methods. > > I'm imagining something like > setInput(byte[]b, int off, int len, int flags) > or more java-esque > enum FlushingBehavior { > NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, FINISH } > setInput(byte[]b, int off, int len, FlushingBehavior) Looking at DeflaterOutputStream, setInput is called in write, but flush is in a very separate place. We're using this to implement a compressed line oriented network protocol, and so we're likely to have buffering (multiple writes) and then a flush when we're done, we're not building up the entire response and calling write just once. So, I'm not sure how you'd get the expected "stream" behavior out of DeflaterOutputStream if you put the flushing behavior on setInput. Having Deflater.deflate take a flush type more closely mimics the zlib/jzlib deflate function. Having a separate flush call more closely matches finish/finished on the API. GNU's classpath "fixes" this behavior, and their API is a flush call on Deflater (though no flushed, so they're Deflater.deflate probably loops) Looking at Android's JDK, it has the same bug as the OpenJDK (no flush). Anyways, after Martin's review, I changed it to syncFlush and passed tightened up some other things.. and dropped the InflaterInputStream.available change which was similar to yours (he felt that would be harder to get in). I guess it partially depends on whether we're targetting OpenJDK 6 or 7. Brandon > Martin > > On Thu, Aug 27, 2009 at 23:46, Xueming Shen wrote: > > Another long over-due zip RFE > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 > > with 93 votes. > > > > Background info: > > > > zlib has following 6 allowed flush values when invoking deflate()/inflate > > > > #define Z_NO_FLUSH ? ? ?0 > > #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ > > #define Z_SYNC_FLUSH ? ?2 > > #define Z_FULL_FLUSH ? ?3 > > #define Z_FINISH ? ? ? ?4 > > #define Z_BLOCK ? ? ? ? 5 > > > > The values are not really used by inflate(), so we only need to worry about > > the > > deflate(). > > > > Our implementation now uses Z_NO_FLUSH for all deflation except when > > "finish()" > > is invoked, in which case we use Z_FINISH. > > > > When Z_NO_FLUSH is used, the deflater may accumulate/pend/hold input data in > > its internal > > buffer for better compression (in which the existing output data might not > > be a "complete" > > block), some applications (as those mentioned in the bug report)however > > might need to flush > > all pending data out so the output data is a "complete" block, therefor the > > corresponding > > de-compressor can work on those data. > > > > Z_SYNC_FLUSH and Z_FULL_FLUSH achieve this. The difference is that the > > "full_flush" will > > reset the existing hash table and start a new one for the coming new data, > > which is really > > not very useful. And the only difference compared to current "reset()" is > > the reset() will > > need to reallocate the memory, not a big deal. > > > > See zlib.h for more details (?) > > > > The change in Deflater is actually relatively easy, see the webrev > > > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > > > I would like to hear your opinion on > > > > (1)I'm proposing to simply add a "flush()" method to support the > > Z_SYNC_FLUSH only. The > > alternative is to have a flush(int) method + 2 constant sync_flush and > > full_flush) > > > > (2)What should we do to the flush() method in DeflaterOutputStream class. > > Ideally it should > > be overridden like in the webrev, with API doc to explain that it does 2 > > things (1) flush > > the deflater (2)flush the underlying outputstream, I believe this is what > > the developer is > > expecting and what the API should have been implemented at first place. > > However this definitely > > is an "incompatible" change, given the existing "flush the underlying os > > only" behavior has > > been in place for decade. I just wonder which approach we should take. I > > tend to leave it > > un-touched and do our best to "educate" the developer to go with > > > > ?79 ? ? static class FlushableDOS extends DeflaterOutputStream { > > ?80 ? ? ? ? public FlushableDOS(OutputStream out) { > > ?81 ? ? ? ? ? ? super(out); > > ?82 ? ? ? ? } > > ?83 ?84 ? ? ? ? public void flush() throws IOException { > > ?85 ? ? ? ? ? ? int len = 0; > > ?86 ? ? ? ? ? ? while ((len = def.flush(buf, 0, buf.length)) > 0) { > > ?87 ? ? ? ? ? ? ? ? out.write(buf, 0, len); > > ?88 ? ? ? ? ? ? } > > ?89 ? ? ? ? ? ? out.flush(); > > ?90 ? ? ? ? } > > ?91 ? ? } > > > > We can add something in the class description to explain about the "flush" > > > > (3)During the debug, I noticed the InflaterInputStream.available() issue. > > The method is currently specified as "0 if EOF 1 otherwise", which does not > > look right. The BufferedReader.readLine() in test case Flush()is blocked in > > StreamDecoder#325, the inReady() at ln#323 keeps returning true for the > > inputstream (InflaterInputStream). I believe this available() should be > > specified/implemented as > > > > 0 if EOF, in.available() if inf.needInput() is true, otherwise 1. > > > > Opinion? This is going to be a separate bugid, if we agree to fix it. Btw, > > how to write above spec in English?:-) > > > > Sherman > > > > > > > > > > > > > > > > > > > > > > -- "I think, therefore, I am confused." -- RAW http://www.fiction.net/blong/ From blong at google.com Thu Sep 3 22:19:44 2009 From: blong at google.com (Brandon Long) Date: Thu, 3 Sep 2009 15:19:44 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA03D0B.1030206@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> Message-ID: <20090903221944.GB10024@google.com> On 09/03/09 Xueming Shen uttered the following other thing: > > Same as the proposed spec/impl change to > InflaterInputStream.isAvailable(), it is also a risky/incompatible > change to override DeflaterOutputStream.flush() method to flush the > underlying deflater. Existing apps > that are using DOS.flush() (directly or in-directly) will not be happy > to see the overall compression ratio gets > worse after migrating to JDK7. I don't have any data to back this > assumption, given DOS has been used for > decade, this risk for sure is real. This of course contradicts to the > request of this RFE which expects/assumes > that the DOS.flush() should sync_flush the underlying deflater. > > Basically the change in Deflater alone is "good" enough to provide A > solution for this issue (developer currently > has to use nasty/hack workaround), it's easy to override DOS.flush > (and/or IIS.isAvailble()) to whatever you > like if the existing is not what you want. Having said that, I still > hope the consensus is that we should just do > the RIGHT thing:-) Agreed, I hope making it do the right thing is the result. People wrote an entire pure-java implementation of zlib to work around this problem. I was the fourth team at Google to run into it separately. I don't think anyone who explicitly calls "flush" will get what the expect. And I wouldn't expect the overall compression ratio to get that much worse, unless you are calling flush a really large amount of time. Z_FULL_FLUSH would be a much bigger change, and clearly the wrong thing to do on a DeflaterOutputStream.flush. > As you said, the only benefit of adding a pair of syncFlush()/flushed is > to match the existing finish()/finished, > personally I feel the finish()/finished() control flow() is > "complicated" enough, why add another one. Still fell > the best choice is to simply expose what the zlib provides, I'm still > debating with myself if the Z_FINISH should > be included as one of the flush options as well, someone might prefer > not to use that finish()/finished() control > flow... The biggest challenge is that you have to loop your calls to deflate with FLUSH (and FINISH) till it completes, and knowing when you're done is complicated, the finished/flushed methods simplify that... but if the entire api was updated, its possible it could be reworked to make the external looping unnecessary... though that may involve using more memory and maybe cpu by using a growable output buffer instead of the fixed size output byte array. Anyways, hence the "stick to the minimal changes that match the existing API", if someone decides that there needs to be a java.util.zip2 (java.util.compress?) that fixes up the whole API to make a cleaner programmatic interface, that's way beyond my scope. Brandon > Sherman > > Brandon Long wrote: >> On 09/03/09 Martin Buchholz uttered the following other thing: >> >>> The zlib and Deflater API is hard to understand. >>> It seems to me that the proper place to specify the flushing behavior is >>> when calling setInput, not when calling one of the deflate methods. >>> >>> I'm imagining something like >>> setInput(byte[]b, int off, int len, int flags) >>> or more java-esque >>> enum FlushingBehavior { >>> NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, FINISH } >>> setInput(byte[]b, int off, int len, FlushingBehavior) >>> >> >> Looking at DeflaterOutputStream, setInput is called in write, but flush >> is in a very separate place. >> >> We're using this to implement a compressed line oriented network >> protocol, and so we're likely to have buffering (multiple writes) and >> then a flush when we're done, we're not building up the entire response >> and calling write just once. >> >> So, I'm not sure how you'd get the expected "stream" behavior out of >> DeflaterOutputStream if you put the flushing behavior on setInput. >> >> Having Deflater.deflate take a flush type more closely mimics the >> zlib/jzlib deflate function. Having a separate flush call more closely >> matches finish/finished on the API. >> >> GNU's classpath "fixes" this behavior, and their API is a flush call on >> Deflater (though no flushed, so they're Deflater.deflate probably loops) >> >> Looking at Android's JDK, it has the same bug as the OpenJDK (no flush). >> >> Anyways, after Martin's review, I changed it to syncFlush and passed >> tightened up some other things.. and dropped the >> InflaterInputStream.available change which was similar to yours (he felt >> that would be harder to get in). I guess it partially depends on >> whether we're targetting OpenJDK 6 or 7. >> >> Brandon >> >>> Martin >>> >>> On Thu, Aug 27, 2009 at 23:46, Xueming Shen wrote: >>> >>>> Another long over-due zip RFE >>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 >>>> with 93 votes. >>>> >>>> Background info: >>>> >>>> zlib has following 6 allowed flush values when invoking deflate()/inflate >>>> >>>> #define Z_NO_FLUSH 0 >>>> #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ >>>> #define Z_SYNC_FLUSH 2 >>>> #define Z_FULL_FLUSH 3 >>>> #define Z_FINISH 4 >>>> #define Z_BLOCK 5 >>>> >>>> The values are not really used by inflate(), so we only need to worry about >>>> the >>>> deflate(). >>>> >>>> Our implementation now uses Z_NO_FLUSH for all deflation except when >>>> "finish()" >>>> is invoked, in which case we use Z_FINISH. >>>> >>>> When Z_NO_FLUSH is used, the deflater may accumulate/pend/hold input data in >>>> its internal >>>> buffer for better compression (in which the existing output data might not >>>> be a "complete" >>>> block), some applications (as those mentioned in the bug report)however >>>> might need to flush >>>> all pending data out so the output data is a "complete" block, therefor the >>>> corresponding >>>> de-compressor can work on those data. >>>> >>>> Z_SYNC_FLUSH and Z_FULL_FLUSH achieve this. The difference is that the >>>> "full_flush" will >>>> reset the existing hash table and start a new one for the coming new data, >>>> which is really >>>> not very useful. And the only difference compared to current "reset()" is >>>> the reset() will >>>> need to reallocate the memory, not a big deal. >>>> >>>> See zlib.h for more details (?) >>>> >>>> The change in Deflater is actually relatively easy, see the webrev >>>> >>>> http://cr.openjdk.java.net/~sherman/zipflush/webrev >>>> >>>> I would like to hear your opinion on >>>> >>>> (1)I'm proposing to simply add a "flush()" method to support the >>>> Z_SYNC_FLUSH only. The >>>> alternative is to have a flush(int) method + 2 constant sync_flush and >>>> full_flush) >>>> >>>> (2)What should we do to the flush() method in DeflaterOutputStream class. >>>> Ideally it should >>>> be overridden like in the webrev, with API doc to explain that it does 2 >>>> things (1) flush >>>> the deflater (2)flush the underlying outputstream, I believe this is what >>>> the developer is >>>> expecting and what the API should have been implemented at first place. >>>> However this definitely >>>> is an "incompatible" change, given the existing "flush the underlying os >>>> only" behavior has >>>> been in place for decade. I just wonder which approach we should take. I >>>> tend to leave it >>>> un-touched and do our best to "educate" the developer to go with >>>> >>>> 79 static class FlushableDOS extends DeflaterOutputStream { >>>> 80 public FlushableDOS(OutputStream out) { >>>> 81 super(out); >>>> 82 } >>>> 83 84 public void flush() throws IOException { >>>> 85 int len = 0; >>>> 86 while ((len = def.flush(buf, 0, buf.length)) > 0) { >>>> 87 out.write(buf, 0, len); >>>> 88 } >>>> 89 out.flush(); >>>> 90 } >>>> 91 } >>>> >>>> We can add something in the class description to explain about the "flush" >>>> >>>> (3)During the debug, I noticed the InflaterInputStream.available() issue. >>>> The method is currently specified as "0 if EOF 1 otherwise", which does not >>>> look right. The BufferedReader.readLine() in test case Flush()is blocked in >>>> StreamDecoder#325, the inReady() at ln#323 keeps returning true for the >>>> inputstream (InflaterInputStream). I believe this available() should be >>>> specified/implemented as >>>> >>>> 0 if EOF, in.available() if inf.needInput() is true, otherwise 1. >>>> >>>> Opinion? This is going to be a separate bugid, if we agree to fix it. Btw, >>>> how to write above spec in English?:-) >>>> >>>> Sherman >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >> >> -- "Have been unavoidably detained by the world. Expect us when you see us." -- Neil Gaiman, _Stardust_ http://www.fiction.net/blong/ From martinrb at google.com Thu Sep 3 23:06:38 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 16:06:38 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA03D0B.1030206@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> Message-ID: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> Here are review comments on your webrev http://cr.openjdk.java.net/~sherman/zipflush/webrev --- 308 * Returns actual number of bytes of compressed data. => 308 * Returns actual number of bytes of compressed data written to the output buffer. --- {@linke needsInput() needsInput} => {@link #needsInput()} --- accumualte => accumulate (yes, I know this is zlib's typo) --- achieve the maximize => achieve the best --- comparessed => compressed --- 358 * so far (In particular the{@link #needInput needInput} returns {code@ true} add missing space code@ => @code needInput => needsInput --- 178 public int available() throws IOException { 179 ensureOpen(); 180 if (reachEOF) { 181 return 0; 182 } else { 183 if (inf.needsInput()) 184 return in.available(); Even if you could deal with the compatibility problems of applications relying on the 1/0 existing specified behavior, this code seems wrong because an inflater might possibly shrink the input. Maybe you can use something like deflateBounds? --- 8 if ("-client".equals(args[0])) Confusing, because of hotspot flag with same name. Are you trying to find a launcher bug? How about "client" instead of "-client"? Better yet, implement Flush as a single java program. --- Martin From martinrb at google.com Thu Sep 3 23:32:58 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 16:32:58 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA03D0B.1030206@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> Message-ID: <1ccfd1c10909031632r4842b841p9ca6d081ee25e72b@mail.gmail.com> A related mini-rfe would be to provide access to zlib's deflateBounds so that a caller can produce an appropriately sized buffer for deflation. From Xueming.Shen at Sun.COM Thu Sep 3 23:31:49 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 03 Sep 2009 16:31:49 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> Message-ID: <4AA051E5.5060605@sun.com> Thanks for the comment. webrev has been updated accordingly. Flush class is a quick hack to verify the change, it needs to be auto run one if putback. We might want to separate the proposed "incompatible" change of DOS.flush() into a separate rfe/bug, if we can not have a consensus if we should change the existing/default behavior, and integrate the change of Deflater first after we all agree on the interface. IIS.isAvailable() definitely is a separate issue. Sherman Martin Buchholz wrote: > Here are review comments on your webrev > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > --- > > 308 * Returns actual number of bytes of compressed data. > => > 308 * Returns actual number of bytes of compressed data written > to the output buffer. > > --- > > {@linke needsInput() needsInput} > => > {@link #needsInput()} > > --- > > accumualte => accumulate > > (yes, I know this is zlib's typo) > > --- > > achieve the maximize => achieve the best > > --- > > comparessed => compressed > > --- > > 358 * so far (In particular the{@link #needInput needInput} > returns {code@ true} > > add missing space > code@ => @code > needInput => needsInput > > --- > 178 public int available() throws IOException { > 179 ensureOpen(); > 180 if (reachEOF) { > 181 return 0; > 182 } else { > 183 if (inf.needsInput()) > 184 return in.available(); > > Even if you could deal with the compatibility problems of applications > relying on the 1/0 existing specified behavior, this code > seems wrong because an inflater might possibly shrink the input. > Maybe you can use something like deflateBounds? > --- > 8 if ("-client".equals(args[0])) > > Confusing, because of hotspot flag with same name. > Are you trying to find a launcher bug? > How about "client" instead of "-client"? > > Better yet, implement Flush as a single java program. > > --- > Martin > From martinrb at google.com Thu Sep 3 23:55:22 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 16:55:22 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA051E5.5060605@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> Message-ID: <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> On Thu, Sep 3, 2009 at 16:31, Xueming Shen wrote: > Thanks for the comment. webrev has been updated accordingly. Flush class is > a quick hack to verify the > change, it needs to be auto run one if putback. Perhaps you would like to take Brandon's test InflateIn_DeflateOut.java? > We might want to separate the proposed "incompatible" change of DOS.flush() > into a separate rfe/bug, Aside from incompatibility, some users might want SYNC_FLUSH, some might want FULL_FLUSH. I think it's too big a change. So just add a new method on DeflaterOutputStream to sync flush current output. > if we can not have a consensus if we should change the existing/default > behavior, and integrate the change > of Deflater first after we all agree on the interface. IIS.isAvailable() > definitely is a separate issue. I think others have tried and failed to change the behavior of various isAvailable methods in the past. Compatibility sucks, but users love it. --- Given that you, Xueming are the current nominal owner of java.util.zip, and we can't include both fixes in the JDK, perhaps you would like to drive this, while getting input from us, and being able to use anything from our fix? Martin From martinrb at google.com Fri Sep 4 00:24:08 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 17:24:08 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA051E5.5060605@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> Message-ID: <1ccfd1c10909031724u22e365a0m14cea3b685686956@mail.gmail.com> The obvious alternative to built-in zlib in the jdk is jzlib http://www.jcraft.com/jzlib/ a pure-java implementation of zlib under an apparently GPL-compatible license that does support flush modes. Some people are using it for that reason. Non-scientific benchmarks at Google suggest it is twice as slow as JDK Deflater, so we may not want to throw out C zlib just yet. Martin From blong at google.com Fri Sep 4 00:08:59 2009 From: blong at google.com (Brandon Long) Date: Thu, 3 Sep 2009 17:08:59 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> Message-ID: <20090904000859.GC10024@google.com> On 09/03/09 Martin Buchholz uttered the following other thing: > > --- > 178 public int available() throws IOException { > 179 ensureOpen(); > 180 if (reachEOF) { > 181 return 0; > 182 } else { > 183 if (inf.needsInput()) > 184 return in.available(); > > Even if you could deal with the compatibility problems of applications > relying on the 1/0 existing specified behavior, this code > seems wrong because an inflater might possibly shrink the input. > Maybe you can use something like deflateBounds? My version just returned 1 in this case, though even that might not be true, but it was no worse than the current always return 1. Its a pretty grey area, maybe deflateBounds would get closer to the truth. Another option would be to try and to inflate a single byte or some bounded number. Brandon -- "Its much more fun to be sand than oil in the machinery of life." http://www.fiction.net/blong/ From Xueming.Shen at Sun.COM Fri Sep 4 00:55:26 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 03 Sep 2009 17:55:26 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909031724u22e365a0m14cea3b685686956@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031724u22e365a0m14cea3b685686956@mail.gmail.com> Message-ID: <4AA0657E.7060903@sun.com> Martin Buchholz wrote: > The obvious alternative to built-in zlib > in the jdk is jzlib > > http://www.jcraft.com/jzlib/ > > a pure-java implementation of zlib > under an apparently GPL-compatible license > that does support flush modes. > Some people are using it for that reason. > > Non-scientific benchmarks at Google suggest > it is twice as slow as JDK Deflater, > so we may not want to throw out C zlib just yet. > > jzlib owner claims the number one reason we have zlib in this world is java deflater does not export zlib's sync_flush and the previous maintainer refused to add it after so many years:-) no, you can't throw out the c zlib even after we have a java version benchmarked faster (in 8?), vm and pack still need the native version. From Ulf.Zibis at gmx.de Fri Sep 4 01:37:49 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 04 Sep 2009 03:37:49 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> Message-ID: <4AA06F6D.2080809@gmx.de> Am 04.09.2009 00:15, Martin Buchholz schrieb: > On Thu, Sep 3, 2009 at 12:51, Ulf Zibis wrote: > >> Am 03.09.2009 20:10, Martin Buchholz schrieb: >> > > >> I like to finish the Character class and file the changes via patch on >> https://bugs.openjdk.java.net. So I would be happy If you could answer my >> question, if replacing all occurrences of ... by {@code ...} >> using \u005CuXXXX is secure. >> > > Here is my recommendation: > > I think it is worthwhile to convert => {@code > I have tried {@code '\u005CuD800'} in Character.java and thanks NetBeans I easily could create a partly-JDK javadoc (on about 100 classes) in surprising short time. The resulting html works fine / is not damaged (in Firefox). Thanks for your motivation. BTW, in String class there are some warnings: @spec is an unknown tag. In Character class you have inserted a typo: '\u007f'" at method valueOf(char) (the additional " ) > I have been doing this in files that I "own", > but have not tried to make a more pervasive change. > I support such a more pervasive change, > but it should be done with a script that gets a fair amount > of scrutiny first, and will have to be restricted to those > parts of the jdk that are truly maintained by the openjdk team, > not code for which the true master lives elsewhere. > I think we could get agreement to change at least core libraries. > > As part of this project, you would need to be able to run > full builds Yes, I should start working on Linux. I guess it would take me 3-4 week to setup a full running system, which fully satisfies my needs. For this reason I'm hesitating, because I want to progress with my charset ideas as fast as possible. On the other hand, it would be worthwhile there are some people who keep developing on Windows to assure, that java stays working on Windows, even under unusual JDK development. ;-) (BTW, I've found and filed several Windows related bugs regarding NetBeans) -Ulf P.S.: You have the habit to use rare English vocabulary, especially in this post, so I profit in increasing my knowledge in English. From martinrb at google.com Fri Sep 4 01:52:52 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 18:52:52 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4AA06F6D.2080809@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> Message-ID: <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> On Thu, Sep 3, 2009 at 18:37, Ulf Zibis wrote: > Am 04.09.2009 00:15, Martin Buchholz schrieb: > In Character class you have inserted a typo: '\u007f'" at method > valueOf(char) (the additional " ) When you say "you", I assume you are using the "royal you". That change was actually made by Joe Darcy. Martin From martinrb at google.com Fri Sep 4 02:05:00 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 3 Sep 2009 19:05:00 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> Message-ID: <1ccfd1c10909031905j634b184dy83a17e18558cfb05@mail.gmail.com> Joe, here's a fix for the stray double quote. I've used {@code with \u005C with the hope of making Ulf happy. As usual, we'll need bug filed, etc... diff --git a/src/share/classes/java/lang/Character.java b/src/share/classes/java/lang/Character.java --- a/src/share/classes/java/lang/Character.java +++ b/src/share/classes/java/lang/Character.java @@ -2587,9 +2587,9 @@ * significantly better space and time performance by caching * frequently requested values. * - * This method will always cache values in the range '\u0000' - * to '\u007f'", inclusive, and may cache other values outside - * of this range. + * This method will always cache values in the range {@code + * '\u005Cu0000'} to {@code '\u005Cu007f'}, inclusive, and may + * cache other values outside of this range. * * @param c a char value. * @return a Character instance representing c. From weijun.wang at sun.com Fri Sep 4 07:09:45 2009 From: weijun.wang at sun.com (weijun.wang at sun.com) Date: Fri, 04 Sep 2009 07:09:45 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090904071039.9227012BD5@hg.openjdk.java.net> Changeset: ee5300e1835a Author: weijun Date: 2009-09-04 14:58 +0800 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ee5300e1835a 6876328: different names for the same digest algorithms breaks jarsigner Reviewed-by: mullan ! src/share/classes/sun/security/tools/JarSigner.java + test/sun/security/tools/jarsigner/nameclash.sh Changeset: 98ad1322051e Author: weijun Date: 2009-09-04 14:59 +0800 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/98ad1322051e 6871847: AlgorithmId.get("SHA256withECDSA") not available Reviewed-by: vinnie ! src/share/classes/sun/security/x509/AlgorithmId.java + test/sun/security/x509/AlgorithmId/SHA256withECDSA.java From Ulf.Zibis at gmx.de Fri Sep 4 09:14:53 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 04 Sep 2009 11:14:53 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> Message-ID: <4AA0DA8D.9070408@gmx.de> Am 04.09.2009 03:52, Martin Buchholz schrieb: > When you say "you", I assume you are using the "royal you". > That change was actually made by Joe Darcy. > > Martin > Oops sorry, I only recognized javadoc update from 1.6.0_14 to 1.7.0 b70, so as this particular change was in similar flavour of your changes in 6860431, I actually and regrettably erroneously thought, that You personally was the author. I receive my just deserts, it's cold and raining today. -Ulf From martinrb at google.com Fri Sep 4 15:10:21 2009 From: martinrb at google.com (Martin Buchholz) Date: Fri, 4 Sep 2009 08:10:21 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4AA0DA8D.9070408@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> <4AA0DA8D.9070408@gmx.de> Message-ID: <1ccfd1c10909040810i3bdeb991l34e165b299477d1f@mail.gmail.com> On Fri, Sep 4, 2009 at 02:14, Ulf Zibis wrote: > Oops sorry, I only recognized javadoc update from 1.6.0_14 to 1.7.0 b70, Do you know about "hg blame" ? From Ulf.Zibis at gmx.de Fri Sep 4 19:04:33 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 04 Sep 2009 21:04:33 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909040810i3bdeb991l34e165b299477d1f@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> <4AA0DA8D.9070408@gmx.de> <1ccfd1c10909040810i3bdeb991l34e165b299477d1f@mail.gmail.com> Message-ID: <4AA164C1.20507@gmx.de> Am 04.09.2009 17:10, Martin Buchholz schrieb: > On Fri, Sep 4, 2009 at 02:14, Ulf Zibis wrote: > > >> Oops sorry, I only recognized javadoc update from 1.6.0_14 to 1.7.0 b70, >> > > Do you know about "hg blame" ? > Good idea. :-) I rarely used it. Thanks for remembering me. -Ulf From joe.darcy at sun.com Fri Sep 4 20:19:49 2009 From: joe.darcy at sun.com (joe.darcy at sun.com) Date: Fri, 04 Sep 2009 20:19:49 +0000 Subject: hg: jdk7/tl/jdk: 6873951: test/java/lang/reflect/Generics/Probe.java fails. Message-ID: <20090904202035.25AB812FEA@hg.openjdk.java.net> Changeset: c34f92a47245 Author: darcy Date: 2009-09-04 13:11 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/c34f92a47245 6873951: test/java/lang/reflect/Generics/Probe.java fails. Reviewed-by: alanb ! test/java/lang/reflect/Generics/Probe.java From Joe.Darcy at Sun.COM Fri Sep 4 20:34:26 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Fri, 04 Sep 2009 13:34:26 -0700 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <1ccfd1c10909031905j634b184dy83a17e18558cfb05@mail.gmail.com> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <1ccfd1c10909031515o77fc310fn844d372ee03b4925@mail.gmail.com> <4AA06F6D.2080809@gmx.de> <1ccfd1c10909031852v2a09e439y4010841598d28a6e@mail.gmail.com> <1ccfd1c10909031905j634b184dy83a17e18558cfb05@mail.gmail.com> Message-ID: <4AA179D2.7050407@sun.com> Hello. Martin Buchholz wrote: > Joe, here's a fix for the stray double quote. > Mea culpa! > I've used {@code with \u005C with the hope of making Ulf happy. > > As usual, we'll need bug filed, etc... > I've filed bug 6879368 "Remove stray quote in Character javadoc" for this issue. > diff --git a/src/share/classes/java/lang/Character.java > b/src/share/classes/java/lang/Character.java > --- a/src/share/classes/java/lang/Character.java > +++ b/src/share/classes/java/lang/Character.java > @@ -2587,9 +2587,9 @@ > * significantly better space and time performance by caching > * frequently requested values. > * > - * This method will always cache values in the range '\u0000' > - * to '\u007f'", inclusive, and may cache other values outside > - * of this range. > + * This method will always cache values in the range {@code > + * '\u005Cu0000'} to {@code '\u005Cu007f'}, inclusive, and may > + * cache other values outside of this range. > * > * @param c a char value. > * @return a Character instance representing c. > I approve this going back. Thanks, -Joe From martinrb at google.com Fri Sep 4 20:59:01 2009 From: martinrb at google.com (martinrb at google.com) Date: Fri, 04 Sep 2009 20:59:01 +0000 Subject: hg: jdk7/tl/jdk: 6879368: Remove stray quote in Character javadoc Message-ID: <20090904205940.3BF69E013@hg.openjdk.java.net> Changeset: 704296144175 Author: martin Date: 2009-09-04 13:44 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/704296144175 6879368: Remove stray quote in Character javadoc Summary: Remove stray quote in Character.valueOf javadoc, using Ulf's \u005CuXXXX technique Reviewed-by: darcy ! src/share/classes/java/lang/Character.java From Xueming.Shen at Sun.COM Fri Sep 4 22:18:56 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Fri, 04 Sep 2009 15:18:56 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> Message-ID: <4AA19250.2060803@sun.com> I would like to take the conservative (read compatible) approach for this issue. (1)expose zlib's flush mode Z_NO_FLUSH, Z_SYNC_FLUSH and Z_FULL_FLUSH (2)add deflate(byte[] b, int off, int len, int flush) (3)document the existing deflate() continues to use Z_NO_FLUSH (4)add DeflaterOutputStream.flush(int flushmode) and leave DeflaterOutputStream.flush() un-touched. http://cr.openjdk.java.net/~sherman/zipflush/webrev So the sophisticated Deflater/DeflaterOutputStream user can now use all 3 flush flavors by using the newly added APIs explicitly. "naive" Deflater/DOS user (means no need for the sync/full_flush) and existing application can continue live with/use the existing API without any compatibility concern. The only disadvantage of this approach is the "in-direct flush" use scenario (means the DOS is passed around and the inherited flush() is invoked by other wrapping classes) will not be benefited from this change, they have to override the flush() methold before passing the DOS object around, like what I do in the test case Flush() static class MyDeflaterOutputStream extends DeflaterOutputStream { public MyDeflaterOutputStream(OutputStream out) { super(out); } public void flush() throws IOException { flush(Deflater.SYNC_FLUSH); } } A little inconvenient, but seen like worth the price of being compatible, for now. And we still have the choice to do whatever we want to do with this method in the future should the feedback show I'm wrong and the compatibility does not matter. Opinion? If you guys agree (please also review the webrev) I can start the "process". Sherman From blong at google.com Fri Sep 4 22:57:14 2009 From: blong at google.com (Brandon Long) Date: Fri, 4 Sep 2009 15:57:14 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA19250.2060803@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> Message-ID: <20090904225714.GB26286@google.com> In the new Deflater.deflate, you are checking valid flush values against NO_FLUSH twice (and missing FULL_FLUSH) The new DeflaterOutputStream.flush, you loop as long as some output is generated, which can call deflate an extra time. Normally, code that does this loops until there is no def.needsInput and the output is less than the size of the output buffer. I would have thought it would have generated extra output, but then the loop would never finish... so I guess this must work. Overall, I'm least happy with #4, since I feel it leaves a bug. flush() on a stream should flush everything I've written to the stream. This bug is that it currently doesn't, and this doesn't fix it. It makes it possible for people to fix it (which isn't possible currently without using a completely separate implementation), but it doesn't fix the bug. Brandon On 09/04/09 Xueming Shen uttered the following other thing: > > I would like to take the conservative (read compatible) approach for > this issue. > > (1)expose zlib's flush mode Z_NO_FLUSH, Z_SYNC_FLUSH and Z_FULL_FLUSH > (2)add deflate(byte[] b, int off, int len, int flush) > (3)document the existing deflate() continues to use Z_NO_FLUSH > (4)add DeflaterOutputStream.flush(int flushmode) > and leave DeflaterOutputStream.flush() un-touched. > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > So the sophisticated Deflater/DeflaterOutputStream user can now use all > 3 flush flavors > by using the newly added APIs explicitly. "naive" Deflater/DOS user > (means no need for > the sync/full_flush) and existing application can continue live with/use > the existing API > without any compatibility concern. The only disadvantage of this > approach is the > "in-direct flush" use scenario (means the DOS is passed around and the > inherited flush() > is invoked by other wrapping classes) will not be benefited from this > change, they have > to override the flush() methold before passing the DOS object around, > like what I do > in the test case Flush() > > static class MyDeflaterOutputStream extends DeflaterOutputStream { > public MyDeflaterOutputStream(OutputStream out) { > super(out); > } > > public void flush() throws IOException { > flush(Deflater.SYNC_FLUSH); > } > } > > A little inconvenient, but seen like worth the price of being > compatible, for now. And we > still have the choice to do whatever we want to do with this method in > the future should the > feedback show I'm wrong and the compatibility does not matter. > > Opinion? If you guys agree (please also review the webrev) I can start > the "process". > > Sherman > > -- "Quantum Mechanics: The dreams stuff is made of" -- Steven Wright http://www.fiction.net/blong/ From Xueming.Shen at Sun.COM Sat Sep 5 01:02:08 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Fri, 04 Sep 2009 18:02:08 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <20090904225714.GB26286@google.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> Message-ID: <4AA1B890.7000703@sun.com> Thanks for the comments. Brandon Long wrote: > In the new Deflater.deflate, you are checking valid flush values against > NO_FLUSH twice (and missing FULL_FLUSH) > good catch, a bad copy/paste. More unit tests will be written to catch this kind of problem after we finalize the APIs. > The new DeflaterOutputStream.flush, you loop as long as some output is > generated, which can call deflate an extra time. Normally, code that > does this loops until there is no def.needsInput and the output is less > than the size of the output buffer. I would have thought it would have > generated extra output, but then the loop would never finish... so I > guess this must work. > > The current code works. But your suggestion of using len < b.length (actually it means zlib's availble_out > 0) seems a better and correct approach, which can same an extra round. A quick scan of the zlib deflate/flush_pending shows it should work, I will update to that after give the code a more careful read and run some tests. Given each/every write() loops till needsInput() returns true, I don't think we need to consider this in flush(). > Overall, I'm least happy with #4, since I feel it leaves a bug. flush() > on a stream should flush everything I've written to the stream. This > bug is that it currently doesn't, and this doesn't fix it. It makes it > possible for people to fix it (which isn't possible currently without > using a completely separate implementation), but it doesn't fix the bug. > Understood and "agreed":-) I'm wiling to change position under more pressure:-) And we can add that anytime. It's better than put it in now and have to take it out later or add in some ugly workaround. Sherman > Brandon > > On 09/04/09 Xueming Shen uttered the following other thing: > >> I would like to take the conservative (read compatible) approach for >> this issue. >> >> (1)expose zlib's flush mode Z_NO_FLUSH, Z_SYNC_FLUSH and Z_FULL_FLUSH >> (2)add deflate(byte[] b, int off, int len, int flush) >> (3)document the existing deflate() continues to use Z_NO_FLUSH >> (4)add DeflaterOutputStream.flush(int flushmode) >> and leave DeflaterOutputStream.flush() un-touched. >> >> http://cr.openjdk.java.net/~sherman/zipflush/webrev >> >> So the sophisticated Deflater/DeflaterOutputStream user can now use all >> 3 flush flavors >> by using the newly added APIs explicitly. "naive" Deflater/DOS user >> (means no need for >> the sync/full_flush) and existing application can continue live with/use >> the existing API >> without any compatibility concern. The only disadvantage of this >> approach is the >> "in-direct flush" use scenario (means the DOS is passed around and the >> inherited flush() >> is invoked by other wrapping classes) will not be benefited from this >> change, they have >> to override the flush() methold before passing the DOS object around, >> like what I do >> in the test case Flush() >> >> static class MyDeflaterOutputStream extends DeflaterOutputStream { >> public MyDeflaterOutputStream(OutputStream out) { >> super(out); >> } >> >> public void flush() throws IOException { >> flush(Deflater.SYNC_FLUSH); >> } >> } >> >> A little inconvenient, but seen like worth the price of being >> compatible, for now. And we >> still have the choice to do whatever we want to do with this method in >> the future should the >> feedback show I'm wrong and the compatibility does not matter. >> >> Opinion? If you guys agree (please also review the webrev) I can start >> the "process". >> >> Sherman >> >> >> > > From martinrb at google.com Sat Sep 5 01:21:33 2009 From: martinrb at google.com (Martin Buchholz) Date: Fri, 4 Sep 2009 18:21:33 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA1B890.7000703@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> Message-ID: <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> On Fri, Sep 4, 2009 at 18:02, Xueming Shen wrote: > Thanks for the comments. > > Brandon Long wrote: >> >> In the new Deflater.deflate, you are checking valid flush values against >> NO_FLUSH twice (and missing FULL_FLUSH) >> > > good catch, a bad copy/paste. More unit tests will be written to catch this > kind of problem after > we finalize the APIs. > >> The new DeflaterOutputStream.flush, you loop as long as some output is >> generated, which can call deflate an extra time. ?Normally, code that >> does this loops until there is no def.needsInput and the output is less >> than the size of the output buffer. ?I would have thought it would have >> generated extra output, but then the loop would never finish... so I >> guess this must work. >> >> > > The current code works. ?But your suggestion of using len < b.length > (actually it means zlib's > availble_out > ?0) seems a better and correct approach, which can same an > extra round. A > quick scan of the zlib deflate/flush_pending shows it should work, I will > update to that > after give the code a more careful read and run some tests. Given each/every > write() loops > till needsInput() returns true, I don't think we need to consider this in > flush(). > >> Overall, I'm least happy with #4, since I feel it leaves a bug. ?flush() >> on a stream should flush everything I've written to the stream. ?This >> bug is that it currently doesn't, and this doesn't fix it. ?It makes it >> possible for people to fix it (which isn't possible currently without >> using a completely separate implementation), but it doesn't fix the bug. >> I think "bug" is going too far. There are OutputStreams that can't dispose of previously read data without reading some more first. It depends on the transformation. DeflaterOutputStream is in a gray area - it "could" write all the data to its underlying stream, but at the cost of sacrificing some compression (which is its purpose). > Understood and "agreed":-) I'm wiling to change position under more > pressure:-) ?And we > can add that anytime. It's better than put it in now and have to take it out > later or add in some > ugly workaround. Maybe we should understand the risk. Doing a SYNC_FLUSH on every DOS.flush() won't cause the compression/decompression to "break", you will just have very slow and very bad compression. How bad could it be? Suppose we test with random data, and doing a SYNC_FLUSH on every byte? Presumably the "compressed" output will be larger than the input by some factor. If that factor is close to 1, then it's probably OK...It's "only" a performance problem. Anyways, I am leaning towards changing DOS to do the Right Thing. Martin From blong at google.com Sat Sep 5 07:23:50 2009 From: blong at google.com (Brandon Long) Date: Sat, 5 Sep 2009 00:23:50 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <20090903204137.GB15971@google.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> Message-ID: On Fri, Sep 4, 2009 at 6:21 PM, Martin Buchholz wrote: > On Fri, Sep 4, 2009 at 18:02, Xueming Shen wrote: >>> Overall, I'm least happy with #4, since I feel it leaves a bug. ?flush() >>> on a stream should flush everything I've written to the stream. ?This >>> bug is that it currently doesn't, and this doesn't fix it. ?It makes it >>> possible for people to fix it (which isn't possible currently without >>> using a completely separate implementation), but it doesn't fix the bug. > > I think "bug" is going too far. ?There are OutputStreams that can't dispose > of previously read data without reading some more first. ?It depends on > the transformation. ?DeflaterOutputStream is in a gray area - > it "could" write all the data to its underlying stream, but at the cost of > sacrificing some compression (which is its purpose). I think you're saying read when you mean write... and what is the point of calling flush if it doesn't mean to actually flush what I wrote? As for bug, how about : http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4077821 and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4032746 Which both speak that it breaks the OutputStream interface (and both were closed as "not reproducible?) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 The doc for Flushable.flush says: Flushes this stream by writing any buffered output to the underlying stream. I think the lack of flush actually working on a DeflaterOutputStream is the bug that we're attempting to fix. >> Understood and "agreed":-) I'm wiling to change position under more >> pressure:-) ?And we >> can add that anytime. It's better than put it in now and have to take it out >> later or add in some >> ugly workaround. > > Maybe we should understand the risk. ?Doing a SYNC_FLUSH on every > DOS.flush() won't cause the compression/decompression to "break", > you will just have very slow and very bad compression. > How bad could it be? ?Suppose we test with random data, > and doing a SYNC_FLUSH on every byte? ?Presumably the "compressed" > output will ?be larger than the input by some factor. ?If that factor > is close to 1, > then it's probably OK...It's "only" a performance problem. > > Anyways, I am leaning towards changing DOS to do the Right Thing. I imagine that doing it on every byte would be horrible, but I imagine there is some trade-off point at some number of bytes, past which it won't make much difference. Running some tests, it usually takes about 50 bytes between flushes before the compression is "reasonable", and it achieves equivalent to "no flushes" at about 500-2000 bytes, depending on input (at level 6, at least). At less than 10 bytes, the compressed stream is larger. Lots of variability, though. Brandon From alan.bateman at sun.com Sat Sep 5 15:07:05 2009 From: alan.bateman at sun.com (alan.bateman at sun.com) Date: Sat, 05 Sep 2009 15:07:05 +0000 Subject: hg: jdk7/tl/jdk: 4 new changesets Message-ID: <20090905150831.EE952E07F@hg.openjdk.java.net> Changeset: 3f87b755b1c8 Author: alanb Date: 2009-09-04 18:15 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/3f87b755b1c8 6873621: (file) FileStore.supportsFileAttributeView(Class type) returns wrong result Reviewed-by: andrew ! src/share/sample/nio/file/Xdd.java ! src/solaris/classes/sun/nio/fs/LinuxFileStore.java ! src/solaris/classes/sun/nio/fs/SolarisFileStore.java ! src/solaris/classes/sun/nio/fs/UnixFileStore.java ! src/windows/classes/sun/nio/fs/WindowsFileStore.java ! test/java/nio/file/FileStore/Basic.java Changeset: 05ea733a7ae2 Author: alanb Date: 2009-09-04 18:17 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/05ea733a7ae2 6868627: (spec) Files.walkFileTree doesn't make it clear that uncaught errors and exceptions are propagated Reviewed-by: sherman ! src/share/classes/java/nio/file/Files.java ! src/share/classes/java/nio/file/SimpleFileVisitor.java Changeset: 87a2ef2439bc Author: alanb Date: 2009-09-04 22:22 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/87a2ef2439bc 6432567: PIT : com/sun/jdi/BadHandshakeTest.java fails due to java.net.ConnectException Reviewed-by: tbell, ohair, dcubed, andrew ! src/share/transport/socket/socketTransport.c ! test/com/sun/jdi/BadHandshakeTest.java Changeset: 7afdf9d0bc2c Author: alanb Date: 2009-09-05 15:57 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7afdf9d0bc2c Merge From martinrb at google.com Sat Sep 5 16:24:05 2009 From: martinrb at google.com (Martin Buchholz) Date: Sat, 5 Sep 2009 09:24:05 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> Message-ID: <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> On Sat, Sep 5, 2009 at 00:23, Brandon Long wrote: > On Fri, Sep 4, 2009 at 6:21 PM, Martin Buchholz wrote: >> On Fri, Sep 4, 2009 at 18:02, Xueming Shen wrote: >>>> Overall, I'm least happy with #4, since I feel it leaves a bug. ?flush() >>>> on a stream should flush everything I've written to the stream. ?This >>>> bug is that it currently doesn't, and this doesn't fix it. ?It makes it >>>> possible for people to fix it (which isn't possible currently without >>>> using a completely separate implementation), but it doesn't fix the bug. >> >> I think "bug" is going too far. ?There are OutputStreams that can't dispose >> of previously read data without reading some more first. ?It depends on >> the transformation. ?DeflaterOutputStream is in a gray area - >> it "could" write all the data to its underlying stream, but at the cost of >> sacrificing some compression (which is its purpose). > > I think you're saying read when you mean write... and what is the > point of calling flush if it doesn't mean to actually flush what I > wrote? I was thinking from the OutputStream's point of view - it "reads" data when its "write" method is invoked. I guess "receive" is a better word. Suppose you have a ByteSwappingOutputStream whose contract was to swap every other pair of bytes. If it has received an odd number of bytes, its flush method cannot write the last byte, because it needs another byte first. You can interpret flush's contract as saying to write all buffered output that is "ready" to go out *unmodified* - it might not be expected that flush() causes different bytes to be written just so that they can be written *now*. But we are proposing that DOS.flush() does in fact modify the bytes written, possibly in a way that violates DOS's contract, which is to compress the data. Although DeflaterOutputStream's contract is not really clear - is its contract to maximally compress the output, or merely to produce output that can be read later by an Inflater? That said, I still lean towards changing DOS.flush as suggested, but I also understand why conservative maintainers might not. > As for bug, how about : > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4077821 > > and > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4032746 Those are some ancient bugs! ... that I don't recall having looked at in my years of part-time maintenance of java.util.zip. Martin > > Which both speak that it breaks the OutputStream interface (and both > were closed as "not reproducible?) > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4206909 > > The doc for Flushable.flush says: > ? ? ? ? ? Flushes this stream by writing any buffered output to the > underlying stream. > > I think the lack of flush actually working on a DeflaterOutputStream > is the bug that we're attempting to fix. From Ulf.Zibis at gmx.de Sat Sep 5 19:54:30 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Sat, 05 Sep 2009 21:54:30 +0200 Subject: hg: jdk7/tl/jdk: 6879368: Remove stray quote in Character javadoc In-Reply-To: <20090904205940.3BF69E013@hg.openjdk.java.net> References: <20090904205940.3BF69E013@hg.openjdk.java.net> Message-ID: <4AA2C1F6.8000403@gmx.de> Am 04.09.2009 22:59, martinrb at google.com schrieb: > Changeset: 704296144175 > Author: martin > Date: 2009-09-04 13:44 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/704296144175 > > 6879368: Remove stray quote in Character javadoc > Summary: Remove stray quote in Character.valueOf javadoc, using Ulf's \u005CuXXXX technique > Reviewed-by: darcy > > ! src/share/classes/java/lang/Character.java > > > To be accurate: It's David M. Lloyd's technique! -Ulf From Ulf.Zibis at gmx.de Sun Sep 6 21:31:28 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Sun, 06 Sep 2009 23:31:28 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4AA01E4B.8020500@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> Message-ID: <4AA42A30.6080703@gmx.de> Cosmetics for class Character is finished (there have been javadoc errors in String+AbstractStringbuilder too): https://bugs.openjdk.java.net/attachment.cgi?id=145&action=diff -Ulf Am 03.09.2009 21:51, Ulf Zibis schrieb: > Am 03.09.2009 20:10, Martin Buchholz schrieb: >> I agree that the spec can be clarified. >> Another case is the similar >> >> http://java.sun.com/javase/6/docs/api/java/lang/String.html#replace(char, >> char) >> >> which states "Returns a new string", but then goes on to contradict >> itself, >> although the meaning is clear. >> >> Webrev please. >> >> > > Martin, > > I was in the assumption, that you could add this clarification to your > CR as you are involved anyway on finishing the javadoc of String. As > you may be know, webrev script is a pain for me, as I'm on Windows. > CYGWIN is buggy in that case, so each 2nd time I try this, Windows > comes to hang because of C heap overflow. > > I like to finish the Character class and file the changes via patch on > https://bugs.openjdk.java.net. So I would be happy If you could answer > my question, if replacing all occurrences of ... by > {@code ...} using \u005CuXXXX is secure. > > -Ulf > > > From Ulf.Zibis at gmx.de Mon Sep 7 12:30:03 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Mon, 07 Sep 2009 14:30:03 +0200 Subject: hg: jdk7/tl/jdk: 6860431: Character.isSurrogate(char ch) In-Reply-To: <4AA42A30.6080703@gmx.de> References: <20090831221217.2CEFA12912@hg.openjdk.java.net> <1ccfd1c10909012021g78d4fa3cx5f6ab0792c3ba688@mail.gmail.com> <4A9E27BF.8000905@gmx.de> <1ccfd1c10909020927v74fe5ceekc91f4e4a4724a273@mail.gmail.com> <4A9E9FE9.7060107@redhat.com> <1ccfd1c10909021003o7b060a23ge700680cd75b07bf@mail.gmail.com> <4A9EA759.3050804@redhat.com> <4A9ECBAC.7060303@gmx.de> <1ccfd1c10909021329i34005b1bi5816e695d71a174d@mail.gmail.com> <4A9FC319.3030508@gmx.de> <1ccfd1c10909031110p6d38eb9dv9787ff88f3b4d1b7@mail.gmail.com> <4AA01E4B.8020500@gmx.de> <4AA42A30.6080703@gmx.de> Message-ID: <4AA4FCCB.3010107@gmx.de> Am 06.09.2009 23:31, Ulf Zibis schrieb: > Cosmetics for class Character is finished (there have been javadoc > errors in String+AbstractStringbuilder too): > https://bugs.openjdk.java.net/attachment.cgi?id=145&action=diff > Update: https://bugs.openjdk.java.net/attachment.cgi?id=146&action=diff Benefit from package private helpers: https://bugs.openjdk.java.net/attachment.cgi?id=147&action=diff Removed usages of class Surrogate where ever possible: https://bugs.openjdk.java.net/attachment.cgi?id=148&action=diff -Ulf From Ulf.Zibis at gmx.de Mon Sep 7 13:01:00 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Mon, 07 Sep 2009 15:01:00 +0200 Subject: review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios In-Reply-To: <4A9578C4.8060801@sun.com> References: <4A95079A.8080803@gmx.de> <4A9578C4.8060801@sun.com> Message-ID: <4AA5040C.8050701@gmx.de> Am 26.08.2009 20:02, Xueming Shen schrieb: > Ulf, > > "get rid of sun.nio.cs.Surrogate" itself is not a sufficient enough > reason to add bunch of new supplementary > support related APIs into Character and CharBuffer classes. You > probably need to demonstrate more use > scenarios to show/prove why these new APIs are needed, why they can > not be easily achieved by using existing > APIs and especially you should ask yourself first if these APIs > will/should be used/needed by "general public" > or they are just "specifically" needed by your current > application/project. I have made a search for "surrogate" on sun.font and sun.text.* packages. I've found > 400 matches. In search on java.* I found another 291 matches. Looking deeper in the classes you can find many use scenarios. E.g. class sun.text.normalizer.UTF16 more ore less is a duplicate of sun.nio.cs.Surrogate. > > I'm not saying we can NOT add isBMP() (I know icu4j's UCharacter class > does have one), just > believe it's arguably not necessary. > > Same as the pair > > -- static char highSurrogate(int codePoint); --> sun.text.normalizer.UTF16.getLeadSurrogate(int char32) > -- static char lowSurrogate(int codePoint); --> sun.text.normalizer.UTF16.getTrailSurrogate(int char32) > -- CharBuffer.putCodePoint(int) Maybe it would be better to add appendCodePoint(int cp) to Charsequence, of something similar. See: sun.text.normalizer.UTF16.append(StringBuffer target, int char32) See: java.text.CharacterIterator.CodePointIterator -Ulf From tim.bell at sun.com Mon Sep 7 16:44:52 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 16:44:52 +0000 Subject: hg: jdk7/tl: Added tag jdk7-b71 for changeset 4c36e9853dda Message-ID: <20090907164453.2B39CE0F1@hg.openjdk.java.net> Changeset: 378f57273f09 Author: xdono Date: 2009-09-03 10:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/378f57273f09 Added tag jdk7-b71 for changeset 4c36e9853dda ! .hgtags From tim.bell at sun.com Mon Sep 7 16:51:22 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 16:51:22 +0000 Subject: hg: jdk7/tl/corba: 4 new changesets Message-ID: <20090907165126.8A819E0F8@hg.openjdk.java.net> Changeset: 8001ba2bf10d Author: andrew Date: 2009-08-20 01:28 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/8001ba2bf10d 6873059: Explicitly use -source 6 -target 6 when compiling with the boot jdk javac Summary: The bootstrap javac currently uses the default source and targets of the boot javac Reviewed-by: jjg, ohair ! make/common/shared/Defs-java.gmk Changeset: 04414f276160 Author: xdono Date: 2009-08-24 17:25 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/04414f276160 Merge Changeset: 3f1ef7f899ea Author: andrew Date: 2009-09-01 23:44 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/3f1ef7f899ea 6878106: Synchronize CORBA and JDK makefiles where possible Summary: Add recent changes to the JDK makefile to the CORBA makefile Reviewed-by: jjg, never ! make/common/shared/Defs-java.gmk Changeset: c793a3120926 Author: xdono Date: 2009-09-03 10:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/c793a3120926 Added tag jdk7-b71 for changeset 3f1ef7f899ea ! .hgtags From tim.bell at sun.com Mon Sep 7 16:59:41 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 16:59:41 +0000 Subject: hg: jdk7/tl/hotspot: Added tag jdk7-b71 for changeset 50a95aa4a247 Message-ID: <20090907165947.3A9F5E0FF@hg.openjdk.java.net> Changeset: 6e6427f797c0 Author: xdono Date: 2009-09-03 10:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/6e6427f797c0 Added tag jdk7-b71 for changeset 50a95aa4a247 ! .hgtags From tim.bell at sun.com Mon Sep 7 17:15:50 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 17:15:50 +0000 Subject: hg: jdk7/tl/jaxp: Added tag jdk7-b71 for changeset ff94d8ce0dad Message-ID: <20090907171552.7AF24E104@hg.openjdk.java.net> Changeset: 37c805b6156f Author: xdono Date: 2009-09-03 10:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxp/rev/37c805b6156f Added tag jdk7-b71 for changeset ff94d8ce0dad ! .hgtags From tim.bell at sun.com Mon Sep 7 17:22:01 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 17:22:01 +0000 Subject: hg: jdk7/tl/jaxws: Added tag jdk7-b71 for changeset 03314cf56a72 Message-ID: <20090907172204.27D39E109@hg.openjdk.java.net> Changeset: 4c990aa99bc0 Author: xdono Date: 2009-09-03 10:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxws/rev/4c990aa99bc0 Added tag jdk7-b71 for changeset 03314cf56a72 ! .hgtags From tim.bell at sun.com Mon Sep 7 17:29:02 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 17:29:02 +0000 Subject: hg: jdk7/tl/jdk: 9 new changesets Message-ID: <20090907173119.D25E8E10E@hg.openjdk.java.net> Changeset: 80368890a2a0 Author: andrew Date: 2009-08-18 19:50 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/80368890a2a0 6873059: Explicitly use -source 6 -target 6 when compiling with the boot jdk javac Summary: The bootstrap javac currently uses the default source and targets of the boot javac Reviewed-by: ohair ! make/common/shared/Defs-java.gmk Changeset: 43465920bf47 Author: xdono Date: 2009-08-18 19:53 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/43465920bf47 Merge - test/java/util/concurrent/ConcurrentLinkedQueue/ConcurrentQueueLoops.java - test/java/util/concurrent/ConcurrentLinkedQueue/LoopHelpers.java Changeset: b3aac0db5586 Author: tbell Date: 2009-08-21 12:12 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b3aac0db5586 6705913: freetype_versioncheck.exe - Unable To Locate Component Summary: Update freetype_versioncheck to deal with newer Visual Studio releases Reviewed-by: ohair ! make/tools/freetypecheck/Makefile ! make/tools/freetypecheck/freetypecheck.c Changeset: e0b26d347302 Author: xdono Date: 2009-08-24 17:26 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e0b26d347302 Merge Changeset: b3f3240135f0 Author: xdono Date: 2009-09-01 13:03 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b3f3240135f0 Merge - src/share/classes/sun/nio/ch/AbstractFuture.java Changeset: ce3fde68c495 Author: xdono Date: 2009-09-03 10:53 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ce3fde68c495 Added tag jdk7-b71 for changeset b3f3240135f0 ! .hgtags Changeset: ed0863629d28 Author: tbell Date: 2009-09-03 18:32 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ed0863629d28 Merge - src/share/native/java/util/zip/zlib-1.1.3/ChangeLog - src/share/native/java/util/zip/zlib-1.1.3/README - src/share/native/java/util/zip/zlib-1.1.3/compress.c - src/share/native/java/util/zip/zlib-1.1.3/deflate.c - src/share/native/java/util/zip/zlib-1.1.3/deflate.h - src/share/native/java/util/zip/zlib-1.1.3/doc/algorithm.doc - src/share/native/java/util/zip/zlib-1.1.3/example.c - src/share/native/java/util/zip/zlib-1.1.3/gzio.c - src/share/native/java/util/zip/zlib-1.1.3/infblock.c - src/share/native/java/util/zip/zlib-1.1.3/infblock.h - src/share/native/java/util/zip/zlib-1.1.3/infcodes.c - src/share/native/java/util/zip/zlib-1.1.3/infcodes.h - src/share/native/java/util/zip/zlib-1.1.3/inffast.c - src/share/native/java/util/zip/zlib-1.1.3/inffast.h - src/share/native/java/util/zip/zlib-1.1.3/inffixed.h - src/share/native/java/util/zip/zlib-1.1.3/inflate.c - src/share/native/java/util/zip/zlib-1.1.3/inftrees.c - src/share/native/java/util/zip/zlib-1.1.3/inftrees.h - src/share/native/java/util/zip/zlib-1.1.3/infutil.c - src/share/native/java/util/zip/zlib-1.1.3/infutil.h - src/share/native/java/util/zip/zlib-1.1.3/minigzip.c - src/share/native/java/util/zip/zlib-1.1.3/trees.c - src/share/native/java/util/zip/zlib-1.1.3/trees.h - src/share/native/java/util/zip/zlib-1.1.3/uncompr.c - src/share/native/java/util/zip/zlib-1.1.3/zadler32.c - src/share/native/java/util/zip/zlib-1.1.3/zconf.h - src/share/native/java/util/zip/zlib-1.1.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.1.3/zlib.h - src/share/native/java/util/zip/zlib-1.1.3/zutil.c - src/share/native/java/util/zip/zlib-1.1.3/zutil.h - test/java/util/concurrent/LinkedBlockingQueue/LastElement.java - test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java Changeset: 658a4255c797 Author: tbell Date: 2009-09-04 17:07 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/658a4255c797 Merge Changeset: abb69e8b1774 Author: tbell Date: 2009-09-06 23:14 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/abb69e8b1774 Merge From tim.bell at sun.com Mon Sep 7 17:44:03 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Mon, 07 Sep 2009 17:44:03 +0000 Subject: hg: jdk7/tl/langtools: 2 new changesets Message-ID: <20090907174410.44916E11F@hg.openjdk.java.net> Changeset: d434aa041b52 Author: xdono Date: 2009-09-03 10:53 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/d434aa041b52 Added tag jdk7-b71 for changeset 33c8c38e1757 ! .hgtags Changeset: 90c28923e449 Author: tbell Date: 2009-09-03 18:34 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/90c28923e449 Merge - test/tools/javac/innerClassFile/Driver.java - test/tools/javac/meth/InvokeMH_BAD68.java - test/tools/javac/meth/InvokeMH_BAD72.java - test/tools/javac/quid/QuotedIdent_BAD61.java - test/tools/javac/quid/QuotedIdent_BAD62.java - test/tools/javac/quid/QuotedIdent_BAD63.java From Xueming.Shen at Sun.COM Mon Sep 7 18:27:27 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Mon, 07 Sep 2009 11:27:27 -0700 Subject: review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios In-Reply-To: <4AA5040C.8050701@gmx.de> References: <4A95079A.8080803@gmx.de> <4A9578C4.8060801@sun.com> <4AA5040C.8050701@gmx.de> Message-ID: <4AA5508F.1090307@sun.com> Ulf, sun.text.normalizer might not be a good example, it is "independent third-party" package we licensed. Usually we try our best to keep this kind of package as-is, for maintenance reason, you don't want to make the trivial update allover the places again and again whenever there is a version upgrade. Yes, I did make some modification when dropped in the package when I was the owner years ago, that was for functionally better fit with the rest of the code and mostly for better performance (especially faster startup). You should be able to "smell" that is part of the icu4j, so it has its own utf16 handling:-) sherman Ulf Zibis wrote: > > Looking deeper in the classes you can find many use scenarios. > E.g. class sun.text.normalizer.UTF16 more ore less is a duplicate of > sun.nio.cs.Surrogate. > >> >> I'm not saying we can NOT add isBMP() (I know icu4j's UCharacter >> class does have one), just >> believe it's arguably not necessary. >> >> Same as the pair >> >> -- static char highSurrogate(int codePoint); > > --> sun.text.normalizer.UTF16.getLeadSurrogate(int char32) > >> -- static char lowSurrogate(int codePoint); > > --> sun.text.normalizer.UTF16.getTrailSurrogate(int char32) > >> -- CharBuffer.putCodePoint(int) > > Maybe it would be better to add appendCodePoint(int cp) to > Charsequence, of something similar. > See: sun.text.normalizer.UTF16.append(StringBuffer target, int char32) > See: java.text.CharacterIterator.CodePointIterator > > > > -Ulf > > From Ulf.Zibis at gmx.de Mon Sep 7 19:44:23 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Mon, 07 Sep 2009 21:44:23 +0200 Subject: review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios In-Reply-To: <4AA5508F.1090307@sun.com> References: <4A95079A.8080803@gmx.de> <4A9578C4.8060801@sun.com> <4AA5040C.8050701@gmx.de> <4AA5508F.1090307@sun.com> Message-ID: <4AA56297.2040501@gmx.de> Sherman, thanks for insisting on icu4j. I must admit, I newer heard about it. :-( I took a short look on http://icu-project.org/download/4.2.html#ICU4J etc. Very interesting stuff. Now I'm thinking: why they don't use Character class? Do they miss those 3..4 methods? ;-) May be it's time to talk with them, so they could reduce their footprint, which would reduce JDK footprint in a row. -Ulf Am 07.09.2009 20:27, Xueming Shen schrieb: > > Ulf, > > sun.text.normalizer might not be a good example, it is "independent > third-party" package we licensed. Usually > we try our best to keep this kind of package as-is, for maintenance > reason, you don't want to make the trivial > update allover the places again and again whenever there is a version > upgrade. Yes, I did make some modification > when dropped in the package when I was the owner years ago, that was > for functionally better fit with the rest > of the code and mostly for better performance (especially faster > startup). You should be able to "smell" that is > part of the icu4j, so it has its own utf16 handling:-) > > sherman > > > Ulf Zibis wrote: >> >> Looking deeper in the classes you can find many use scenarios. >> E.g. class sun.text.normalizer.UTF16 more ore less is a duplicate of >> sun.nio.cs.Surrogate. >> >>> >>> I'm not saying we can NOT add isBMP() (I know icu4j's UCharacter >>> class does have one), just >>> believe it's arguably not necessary. >>> >>> Same as the pair >>> >>> -- static char highSurrogate(int codePoint); >> >> --> sun.text.normalizer.UTF16.getLeadSurrogate(int char32) >> >>> -- static char lowSurrogate(int codePoint); >> >> --> sun.text.normalizer.UTF16.getTrailSurrogate(int char32) >> >>> -- CharBuffer.putCodePoint(int) >> >> Maybe it would be better to add appendCodePoint(int cp) to >> Charsequence, of something similar. >> See: sun.text.normalizer.UTF16.append(StringBuffer target, int char32) >> See: java.text.CharacterIterator.CodePointIterator >> >> >> >> -Ulf >> >> > > From jonathan.gibbons at sun.com Tue Sep 8 18:20:35 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 08 Sep 2009 18:20:35 +0000 Subject: hg: jdk7/tl/langtools: 6419701: DefaultFileManager clean up: URI.create; ... Message-ID: <20090908182040.7DCC1E24D@hg.openjdk.java.net> Changeset: 35e29f51a7c3 Author: jjg Date: 2009-09-08 11:12 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/35e29f51a7c3 6419701: DefaultFileManager clean up: URI.create 6483788: DefaultFileManager.ZipFileObject.toUri() fails to escape space characters 6501502: JSR 199: FileObject.toUri should return file:///c:/ or file:/c:/ not file://c:/ 6877206: JavaFileObject.toUri returns bogus URI (win) 6877223: tests @ignored because of issues with File.toURI on Windows Reviewed-by: mcimadamore, alanb ! src/share/classes/com/sun/tools/javac/file/BaseFileObject.java ! src/share/classes/com/sun/tools/javac/file/JavacFileManager.java ! src/share/classes/com/sun/tools/javac/file/RegularFileObject.java ! src/share/classes/com/sun/tools/javac/file/SymbolArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java ! src/share/classes/com/sun/tools/javac/jvm/ClassReader.java ! src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java ! test/tools/javac/Diagnostics/6769027/tester.properties ! test/tools/javac/api/6440333/T6440333.java ! test/tools/javac/api/Sibling.java + test/tools/javac/api/T6483788.java + test/tools/javac/api/T6501502.java + test/tools/javac/api/T6877206.java From jonathan.gibbons at sun.com Tue Sep 8 18:38:59 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 08 Sep 2009 18:38:59 +0000 Subject: hg: jdk7/tl/langtools: 6879346: files have Windows newlines Message-ID: <20090908183904.4E176E254@hg.openjdk.java.net> Changeset: dd98acd9f717 Author: jjg Date: 2009-09-08 11:29 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/dd98acd9f717 6879346: files have Windows newlines Reviewed-by: darcy ! src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml ! test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java ! test/com/sun/javadoc/testCRLineSeparator/pkg/MyClass.java ! test/com/sun/javadoc/testHref/package-list ! test/com/sun/javadoc/testLinkOption/testNewLineInLink/package.html ! test/com/sun/javadoc/testNoPackagesFile/TestNoPackagesFile.java ! test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java ! test/com/sun/javadoc/testRelativeLinks/pkg/package.html ! test/com/sun/javadoc/testTaglets/TestTaglets.java ! test/com/sun/javadoc/testWarnings/pkg/package.html ! test/tools/javah/SubClassConsts.win From jonathan.gibbons at sun.com Tue Sep 8 18:52:20 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 08 Sep 2009 18:52:20 +0000 Subject: hg: jdk7/tl/langtools: 6879371: javap does not close internal default file manager Message-ID: <20090908185225.9D5B1E259@hg.openjdk.java.net> Changeset: 261c54b2312e Author: jjg Date: 2009-09-08 11:43 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/261c54b2312e 6879371: javap does not close internal default file manager Reviewed-by: darcy ! src/share/classes/com/sun/tools/javap/JavapTask.java + test/tools/javap/T6879371.java From mandy.chung at sun.com Tue Sep 8 20:12:35 2009 From: mandy.chung at sun.com (mandy.chung at sun.com) Date: Tue, 08 Sep 2009 20:12:35 +0000 Subject: hg: jdk7/tl/jdk: 7 new changesets Message-ID: <20090908201437.B63FAE2D9@hg.openjdk.java.net> Changeset: fdf11ce72e8e Author: mchung Date: 2009-08-06 11:25 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/fdf11ce72e8e 4917309: (cl) Reduce internal usage of ClassNotFoundExceptions during class-loading Summary: Change findBootstrapClass to return null instead of throwing CNFE if class not found Reviewed-by: alanb, dholmes, iris ! src/share/classes/java/lang/ClassLoader.java ! src/share/javavm/export/jvm.h ! src/share/native/java/lang/ClassLoader.c Changeset: 3323e6c925f9 Author: mchung Date: 2009-08-06 16:35 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/3323e6c925f9 6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader Summary: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader Reviewed-by: ksrini ! src/share/bin/java.h ! src/solaris/bin/java_md.c ! src/windows/bin/java_md.c Changeset: 1f1c824e6244 Author: mchung Date: 2009-08-24 10:33 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/1f1c824e6244 Merge - src/share/classes/com/sun/crypto/provider/JarVerifier.java - src/share/classes/javax/swing/plaf/basic/DesktopIconMover.java - src/share/classes/sun/nio/ch/AbstractFuture.java - src/share/classes/sun/security/pkcs11/JarVerifier.java - src/windows/classes/sun/security/mscapi/JarVerifier.java Changeset: 799731b1cd03 Author: mchung Date: 2009-08-27 12:58 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/799731b1cd03 Merge - src/share/native/java/util/zip/zlib-1.1.3/ChangeLog - src/share/native/java/util/zip/zlib-1.1.3/README - src/share/native/java/util/zip/zlib-1.1.3/compress.c - src/share/native/java/util/zip/zlib-1.1.3/deflate.c - src/share/native/java/util/zip/zlib-1.1.3/deflate.h - src/share/native/java/util/zip/zlib-1.1.3/doc/algorithm.doc - src/share/native/java/util/zip/zlib-1.1.3/example.c - src/share/native/java/util/zip/zlib-1.1.3/gzio.c - src/share/native/java/util/zip/zlib-1.1.3/infblock.c - src/share/native/java/util/zip/zlib-1.1.3/infblock.h - src/share/native/java/util/zip/zlib-1.1.3/infcodes.c - src/share/native/java/util/zip/zlib-1.1.3/infcodes.h - src/share/native/java/util/zip/zlib-1.1.3/inffast.c - src/share/native/java/util/zip/zlib-1.1.3/inffast.h - src/share/native/java/util/zip/zlib-1.1.3/inffixed.h - src/share/native/java/util/zip/zlib-1.1.3/inflate.c - src/share/native/java/util/zip/zlib-1.1.3/inftrees.c - src/share/native/java/util/zip/zlib-1.1.3/inftrees.h - src/share/native/java/util/zip/zlib-1.1.3/infutil.c - src/share/native/java/util/zip/zlib-1.1.3/infutil.h - src/share/native/java/util/zip/zlib-1.1.3/minigzip.c - src/share/native/java/util/zip/zlib-1.1.3/trees.c - src/share/native/java/util/zip/zlib-1.1.3/trees.h - src/share/native/java/util/zip/zlib-1.1.3/uncompr.c - src/share/native/java/util/zip/zlib-1.1.3/zadler32.c - src/share/native/java/util/zip/zlib-1.1.3/zconf.h - src/share/native/java/util/zip/zlib-1.1.3/zcrc32.c - src/share/native/java/util/zip/zlib-1.1.3/zlib.h - src/share/native/java/util/zip/zlib-1.1.3/zutil.c - src/share/native/java/util/zip/zlib-1.1.3/zutil.h - test/java/util/concurrent/LinkedBlockingQueue/LastElement.java - test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java Changeset: dfb5cf81d8cd Author: mchung Date: 2009-09-03 16:09 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/dfb5cf81d8cd Merge Changeset: b9b7f56bdfa3 Author: mchung Date: 2009-09-04 15:44 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b9b7f56bdfa3 Merge Changeset: 466915134131 Author: mchung Date: 2009-09-08 12:59 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/466915134131 Merge From jonathan.gibbons at sun.com Tue Sep 8 21:07:28 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 08 Sep 2009 21:07:28 +0000 Subject: hg: jdk7/tl/langtools: 5093723: REGRESSION: ClassCastException in SingleIndexWriter Message-ID: <20090908210735.49896E2E4@hg.openjdk.java.net> Changeset: ebb6ad5a95bb Author: jjg Date: 2009-09-08 13:53 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/ebb6ad5a95bb 5093723: REGRESSION: ClassCastException in SingleIndexWriter Reviewed-by: jjg Contributed-by: ahe at google.com ! src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java ! src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties + test/com/sun/javadoc/5093723/DocumentedClass.java + test/com/sun/javadoc/5093723/T5093723.java + test/com/sun/javadoc/5093723/UndocumentedClass.java From jonathan.gibbons at sun.com Tue Sep 8 21:19:13 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 08 Sep 2009 21:19:13 +0000 Subject: hg: jdk7/tl/langtools: 6709246: ClassCastException in javadoc Message-ID: <20090908211923.6C716E2EB@hg.openjdk.java.net> Changeset: 071a4e36cd87 Author: jjg Date: 2009-09-08 14:08 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/071a4e36cd87 6709246: ClassCastException in javadoc Reviewed-by: jjg Contributed-by: ahe at google.com ! src/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java + test/tools/javadoc/annotations/missing/Main.java + test/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java From martinrb at google.com Tue Sep 8 23:39:09 2009 From: martinrb at google.com (martinrb at google.com) Date: Tue, 08 Sep 2009 23:39:09 +0000 Subject: hg: jdk7/tl/jdk: 6850958: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit Message-ID: <20090908233956.9A942E308@hg.openjdk.java.net> Changeset: 0d50d40a4a39 Author: martin Date: 2009-09-08 14:33 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/0d50d40a4a39 6850958: Honor -XX:OnOutOfMemoryError when array size exceeds VM limit Summary: Test hotspot/jvmti fix 6850957 using ProcessBuilder test infrastructure Reviewed-by: tbell, dholmes, alanb, ysr ! test/java/lang/ProcessBuilder/Basic.java From martinrb at google.com Wed Sep 9 01:52:40 2009 From: martinrb at google.com (Martin Buchholz) Date: Tue, 8 Sep 2009 18:52:40 -0700 Subject: review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios In-Reply-To: <4AA56297.2040501@gmx.de> References: <4A95079A.8080803@gmx.de> <4A9578C4.8060801@sun.com> <4AA5040C.8050701@gmx.de> <4AA5508F.1090307@sun.com> <4AA56297.2040501@gmx.de> Message-ID: <1ccfd1c10909081852t1b31e4ccv20121c625591373e@mail.gmail.com> I wish there had been more collaboration between the jdk developers (including myself) and the icu developers in the past. There has certainly been a fair amount of duplication of effort in the character encoding area. >>> Maybe it would be better to add appendCodePoint(int cp) to Charsequence, >>> of something similar. You only get one chance to get an interface right, unfortunately. Martin From Ulf.Zibis at gmx.de Wed Sep 9 11:21:53 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Wed, 09 Sep 2009 13:21:53 +0200 Subject: review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios In-Reply-To: <1ccfd1c10909081852t1b31e4ccv20121c625591373e@mail.gmail.com> References: <4A95079A.8080803@gmx.de> <4A9578C4.8060801@sun.com> <4AA5040C.8050701@gmx.de> <4AA5508F.1090307@sun.com> <4AA56297.2040501@gmx.de> <1ccfd1c10909081852t1b31e4ccv20121c625591373e@mail.gmail.com> Message-ID: <4AA78FD1.1020509@gmx.de> Am 09.09.2009 03:52, Martin Buchholz schrieb: > I wish there had been more collaboration between the > jdk developers (including myself) and the icu > developers in the past. There has certainly been > a fair amount of duplication of effort in the > character encoding area. > > >>>> Maybe it would be better to add appendCodePoint(int cp) to Charsequence, >>>> of something similar. >>>> > > You only get one chance to get an interface right, unfortunately. > Shame on me, I temporarily forgot this. :-[ -Ulf From sean.mullan at sun.com Wed Sep 9 16:52:58 2009 From: sean.mullan at sun.com (sean.mullan at sun.com) Date: Wed, 09 Sep 2009 16:52:58 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090909165352.6752BE36B@hg.openjdk.java.net> Changeset: 8252729d51a3 Author: mullan Date: 2009-09-09 09:54 -0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/8252729d51a3 6745437: Add option to only check revocation of end-entity certificate in a chain of certificates 6869739: Cannot check revocation of single certificate without validating the entire chain Reviewed-by: xuelei + src/share/classes/sun/security/action/GetBooleanSecurityPropertyAction.java ! src/share/classes/sun/security/provider/certpath/Builder.java ! src/share/classes/sun/security/provider/certpath/CertId.java ! src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java ! src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java ! src/share/classes/sun/security/provider/certpath/ForwardBuilder.java + src/share/classes/sun/security/provider/certpath/OCSP.java ! src/share/classes/sun/security/provider/certpath/OCSPChecker.java ! src/share/classes/sun/security/provider/certpath/OCSPRequest.java ! src/share/classes/sun/security/provider/certpath/OCSPResponse.java ! src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java ! src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java ! src/share/classes/sun/security/x509/AccessDescription.java Changeset: 7b85ef3d752e Author: mullan Date: 2009-09-09 09:59 -0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7b85ef3d752e Merge From Xueming.Shen at Sun.COM Wed Sep 9 18:54:35 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Wed, 09 Sep 2009 11:54:35 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> Message-ID: <4AA7F9EB.5090200@sun.com> Martin, Brandon, Alan I still believe the best choice at this moment is to be a little more conservative, given the DOS.flush() has been working in this behavior for decade. The proposed methods are good enough to serve the functionality required, I don't think it is worth breaking the compatibility in this case simply because "it would be better...". We definitely can consider to change the position should the feedback show this is not the case. I will start the CCC if you guys are OK with the latest wording. The doc has been changed "slightly" compared to last version, thanks for the comment from all of you. http://cr.openjdk.java.net/~sherman/zipflush/webrev Sherman From blong at google.com Wed Sep 9 19:34:39 2009 From: blong at google.com (Brandon Long) Date: Wed, 9 Sep 2009 12:34:39 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA7F9EB.5090200@sun.com> References: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> Message-ID: <20090909193439.GA23862@google.com> I really don't understand this. I think just about everyone would expect that flush on an output stream means send all the data I've written. There are a large number of people who have stumbled on this bug and several others, and the fact that it wasn't fixed when it was discovered 10 years ago is justification for not fixing it now? I imagine a lot of people will stumble on this in the future, instead of it just working as expected. This is up against some unknown fraction of people who are for some reason happy with the current broken behavior, and would dislike paying a 10-50% penalty in compression because their code calls flush when they don't actually need to? At the very least, this misfeature needs to be called out in the documentation for the DeflaterOutputStream class. Brandon On 09/09/09 Xueming Shen uttered the following other thing: > Martin, Brandon, Alan > > I still believe the best choice at this moment is to be a little more > conservative, given the DOS.flush() has been > working in this behavior for decade. The proposed methods are good > enough to serve the functionality required, > I don't think it is worth breaking the compatibility in this case simply > because "it would be better...". We definitely > can consider to change the position should the feedback show this is not > the case. > > I will start the CCC if you guys are OK with the latest wording. The doc > has been changed "slightly" compared to > last version, thanks for the comment from all of you. > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > Sherman -- "I need to either get a new hard drive or clean my home dir." -- Mark Notarus http://www.fiction.net/blong/ From Joe.Darcy at Sun.COM Wed Sep 9 20:40:48 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 13:40:48 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? Message-ID: <4AA812D0.309@sun.com> Hello. For JDK 7, I think it is high-time the platform included a class like java.util.Objects to hold commonly-written utility methods. For example, a two-argument static equals method that returned true if both arguments are null, returns false is one argument is null, and otherwise returns the result of calling arg1.equals(arg2) (6797535 "Add shared two argument static equals method to the platform"). A static hashCode method returning 0 for null and the value of arg.hashCode() has also been suggested. A set of static int compareTo(int, int) static int compareTo(long, long) .... methods probably belongs somewhere in the platform too. What other utility methods would have broad enough use and applicability to go into a common java.util class? -Joe From Alan.Bateman at Sun.COM Wed Sep 9 20:57:17 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Wed, 09 Sep 2009 21:57:17 +0100 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA7F9EB.5090200@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> Message-ID: <4AA816AD.7090306@sun.com> Xueming Shen wrote: > Martin, Brandon, Alan > > I still believe the best choice at this moment is to be a little more > conservative, given the DOS.flush() has been > working in this behavior for decade. The proposed methods are good > enough to serve the functionality required, > I don't think it is worth breaking the compatibility in this case > simply because "it would be better...". We definitely > can consider to change the position should the feedback show this is > not the case. > > I will start the CCC if you guys are OK with the latest wording. The > doc has been changed "slightly" compared to > last version, thanks for the comment from all of you. > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > Sherman The Deflater proposal feels right and fits well with the existing API. The DeflaterOutputStream.flush(int) proposal is workable but it will clearly be a hard sell to get developers to extend DeflaterOutputStream and override the no-arg flush method (which they will need to do to get this to work with existing code/libraries). How you considered overriding the flush() method to use Z_SYNC_FLUSH but have some way to restore existing behavior in the event that it causes severe performance or other issues for someone migrating an existing application to jdk7? I hate suggesting yet another system property to get us out of jail. Aside from an application calling flush a lot, are there any other behavioral implications (say for GZIPOutputStream?). -Alan. From gnu_andrew at member.fsf.org Wed Sep 9 21:22:04 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Wed, 9 Sep 2009 22:22:04 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> 2009/9/9 Joe Darcy : > Hello. > > For JDK 7, I think it is high-time the platform included a class like > java.util.Objects to hold commonly-written utility methods. ?For example, a > two-argument static equals method that returned true if both arguments are > null, returns false is one argument is null, and otherwise returns the > result of calling arg1.equals(arg2) ?(6797535 "Add shared two argument > static equals method to the platform"). > > A static hashCode method returning 0 for null and the value of > arg.hashCode() has also been suggested. > > A set of > > ? static int compareTo(int, int) > ? static int compareTo(long, long) > ? .... > > methods probably belongs somewhere in the platform too. > > What other utility methods would have broad enough use and applicability to > go into a common java.util class? > > -Joe > Given you've listed utility methods for two Object methods, equals and hashCode, toString seems an obvious one to handle as well: public static String toString(Object o) throws IllegalAccessException { Class c = o.getClass(); StringBuilder b = new StringBuilder(c.getName()); b.append("["); for (Field f : c.getDeclaredFields()) { f.setAccessible(true); b.append(f.getName() + "=" + f.get()); b.append(","); } b.replace(b.length() - 1, b.length(), "]"); return b.toString(); } Maybe there's also a useful utility implementation of clone too, but I can't think of one offhand. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Xueming.Shen at Sun.COM Wed Sep 9 21:19:30 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Wed, 09 Sep 2009 14:19:30 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <20090909193439.GA23862@google.com> References: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <20090909193439.GA23862@google.com> Message-ID: <4AA81BE2.5080702@sun.com> I sometime too feels the same frustration when get kicked by the compatibility, especially if you have to back out hundreds of lines of code just because it is "incompatible". I guess someone said it right a while ago, the compatibility sucks, but yes, MOST end user/developer like it. I disagree with the statement that "we are not fixing it". As I said in my last email, the proposed change does address the issue and provide a reasonable solution to the problem that can't not be solved with the existing APIs. My understanding of the key issue here is that the existing DeflaterOutputStream and Deflater do not provide the method(s) to sync_flush the underlying deflater, which is a must for some use scenario. I believe most developers should be happy as long as such methods are provided, it is NOT necessary to be the flush(). Yes, the justification for me to go with the conservative approach here is exactly the "behavior has been in this way for 10 years". Let me share my consideration here again. For existing running application, the DOS.flush() has not been working the way someone might expect for decade, so I don't think there is any application is sitting tightly and patiently over there for years to just wait for us to "fix" the DOS.flush() behavior and their app will then magically work as "expected". They either go with the ugly workaround or go use jzlib. For developer that are waiting this to be fix so that they can simply use the default zlib included in java in their application, the proposed solution just works fine, use the flush(int) when needed, they have to explicitly invoke A flush method anyway, why it can not be the flush(int) (or say, why it must be the flush()). The only benefit of having a sync_flush flush() in DOS is that you don't have to override the default flush() when you have to pass the DOS around and "flush()" will be invoked "indirectly" by other part/layer of the code. The price to pay for this "convenience" is the incompatibility. The applications that works for years might suddenly experience the "regression" when migrated to JDK7. We DONT know if there are really such applications there and how important they are until we hit it real world. At this point, the merit of doing this seems not worth it. I can see other benefit of doing this. If we change the behavior of DOS.flush() in JDK7 and do not see lots of "regression" complain over there, it will be then easy to backport part of the change (means the DOS.flush() only) into 6 releases. I agree it might be a better to have some thing in the DOS api to explain the situation, how about to have a note like below to add into the flush(int) API doc.

Note: The inherited flush() method only flushes the output stream without flushing the compressor(), it should be overridden to do flush(Deflater.SYNC_FLUSH) or flush(Deflate.FULL_FLUSH) if desirable. sherman Brandon Long wrote: > I really don't understand this. I think just about everyone would > expect that flush on an output stream means send all the data I've > written. There are a large number of people who have stumbled on this > bug and several others, and the fact that it wasn't fixed when it was > discovered 10 years ago is justification for not fixing it now? > > I imagine a lot of people will stumble on this in the future, instead of > it just working as expected. > > This is up against some unknown fraction of people who are for some > reason happy with the current broken behavior, and would dislike paying > a 10-50% penalty in compression because their code calls flush when they > don't actually need to? > > At the very least, this misfeature needs to be called out in the > documentation for the DeflaterOutputStream class. > > Brandon > > On 09/09/09 Xueming Shen uttered the following other thing: > >> Martin, Brandon, Alan >> >> I still believe the best choice at this moment is to be a little more >> conservative, given the DOS.flush() has been >> working in this behavior for decade. The proposed methods are good >> enough to serve the functionality required, >> I don't think it is worth breaking the compatibility in this case simply >> because "it would be better...". We definitely >> can consider to change the position should the feedback show this is not >> the case. >> >> I will start the CCC if you guys are OK with the latest wording. The doc >> has been changed "slightly" compared to >> last version, thanks for the comment from all of you. >> >> http://cr.openjdk.java.net/~sherman/zipflush/webrev >> >> Sherman >> > > From martinrb at google.com Wed Sep 9 21:30:04 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 14:30:04 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <20090909193439.GA23862@google.com> References: <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <20090909193439.GA23862@google.com> Message-ID: <1ccfd1c10909091430r1812d1b8l73365683ad1c98d5@mail.gmail.com> JDK has often chosen compatibility over doing something Right. I think the risk of performance degradation due to frequent calls to flush() is higher than one might think at first. Calls to flush may be made on one's behalf by some middleware between the user and the DOS. E.g. someone might wrap an auto-flushing PrintStream around a DOS, which causes surprisingly many calls to flush (Although see java puzzler "Char'ed beyond recognition") Venerable System.out is an example of an auto-flushing PrintStream. As I said previously, I am a bit on the fence with this issue myself, but given Xueming's reluctance, let's agree to do things his way. Users (like Google) who want this functionality *now* will need to develop a private version of this change in any case for use with java 6. Martin On Wed, Sep 9, 2009 at 12:34, Brandon Long wrote: > I really don't understand this. ?I think just about everyone would > expect that flush on an output stream means send all the data I've > written. ?There are a large number of people who have stumbled on this > bug and several others, and the fact that it wasn't fixed when it was > discovered 10 years ago is justification for not fixing it now? > > I imagine a lot of people will stumble on this in the future, instead of > it just working as expected. > > This is up against some unknown fraction of people who are for some > reason happy with the current broken behavior, and would dislike paying > a 10-50% penalty in compression because their code calls flush when they > don't actually need to? > > At the very least, this misfeature needs to be called out in the > documentation for the DeflaterOutputStream class. > > Brandon > > On 09/09/09 Xueming Shen uttered the following other thing: >> Martin, Brandon, Alan >> >> I still believe the best choice at this moment is to be a little more >> conservative, given the DOS.flush() has been >> working in this behavior for decade. The proposed methods are good >> enough to serve the functionality required, >> I don't think it is worth breaking the compatibility in this case simply >> because "it would be better...". We definitely >> can consider to change the position should the feedback show this is not >> the case. >> >> I will start the CCC if you guys are OK with the latest wording. The doc >> has been changed "slightly" compared to >> last version, thanks for the comment from all of you. >> >> http://cr.openjdk.java.net/~sherman/zipflush/webrev >> >> Sherman > > -- > ?"I need to either get a new hard drive or clean my home dir." > ? ? ? ?-- Mark Notarus > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.fiction.net/blong/ > From lance.andersen at sun.com Wed Sep 9 21:53:09 2009 From: lance.andersen at sun.com (lance.andersen at sun.com) Date: Wed, 09 Sep 2009 21:53:09 +0000 Subject: hg: jdk7/tl/jdk: 6737212: Fixed javadoc warning messages in RowSet classes Message-ID: <20090909215352.F154BE392@hg.openjdk.java.net> Changeset: f1eb4c28b313 Author: lancea Date: 2009-09-09 20:15 -0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f1eb4c28b313 6737212: Fixed javadoc warning messages in RowSet classes Reviewed-by: darcy ! src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java ! src/share/classes/com/sun/rowset/JoinRowSetImpl.java ! src/share/classes/com/sun/rowset/internal/WebRowSetXmlReader.java ! src/share/classes/javax/sql/rowset/BaseRowSet.java From mlists at juma.me.uk Wed Sep 9 22:26:46 2009 From: mlists at juma.me.uk (Ismael Juma) Date: Wed, 9 Sep 2009 22:26:46 +0000 (UTC) Subject: What methods should go into a java.util.Objects class in JDK 7? References: <4AA812D0.309@sun.com> Message-ID: Joe Darcy writes: > A static hashCode method returning 0 for null and the value of > arg.hashCode() has also been suggested. > > A set of > > static int compareTo(int, int) > static int compareTo(long, long) > .... > > methods probably belongs somewhere in the platform too. Although I think a java.util.Objects is probably a good idea, the compareTo methods for primitives should probably go to their own primitive class and be called compare to match the one in Double: public static int compare(double d1, double d2) Best, Ismael From forax at univ-mlv.fr Wed Sep 9 23:29:18 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 10 Sep 2009 01:29:18 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <4AA83A4E.7000901@univ-mlv.fr> Le 09/09/2009 22:40, Joe Darcy a ?crit : > Hello. > > For JDK 7, I think it is high-time the platform included a class like > java.util.Objects to hold commonly-written utility methods. For > example, a two-argument static equals method that returned true if > both arguments are null, returns false is one argument is null, and > otherwise returns the result of calling arg1.equals(arg2) (6797535 > "Add shared two argument static equals method to the platform"). > > A static hashCode method returning 0 for null and the value of > arg.hashCode() has also been suggested. > > A set of > > static int compareTo(int, int) > static int compareTo(long, long) > .... > > methods probably belongs somewhere in the platform too. > > What other utility methods would have broad enough use and > applicability to go into a common java.util class? > > -Joe Some hashCode builder like: http://commons.apache.org/lang/api/org/apache/commons/lang/builder/HashCodeBuilder.html (without the methods that use reflection). It will force all VMs to have a better escape analysis :) R?mi From kevinb at google.com Wed Sep 9 23:25:57 2009 From: kevinb at google.com (Kevin Bourrillion) Date: Wed, 9 Sep 2009 16:25:57 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> Message-ID: <108fcdeb0909091625h5cc8c370t5d0a16445d7eb46a@mail.gmail.com> -1 on reflection-based stuff in the Objects class. equal() and hashCode() are the only two things we saw fit to include in our Objects class, and actually, our hashCode() is identical to Arrays.hashCode() (but is varargs). http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Objects.html Please do add the compare() methods to all the rest of the wrapper types; we would use those a lot. When it comes to cloning, I tried very hard once to provide something useful -- a "clone any object without knowing its concrete type" method -- and it was a disaster. A total mess of reflection, and no one wanted to use it anyway. Cloning in Java is discredited. So I'm left with only equal() for your new Objects class. By the way, the best implementation is a == b || (a != null && a.equals(b)). On Wed, Sep 9, 2009 at 2:22 PM, Andrew John Hughes < gnu_andrew at member.fsf.org> wrote: > 2009/9/9 Joe Darcy : > > Hello. > > > > For JDK 7, I think it is high-time the platform included a class like > > java.util.Objects to hold commonly-written utility methods. For example, > a > > two-argument static equals method that returned true if both arguments > are > > null, returns false is one argument is null, and otherwise returns the > > result of calling arg1.equals(arg2) (6797535 "Add shared two argument > > static equals method to the platform"). > > > > A static hashCode method returning 0 for null and the value of > > arg.hashCode() has also been suggested. > > > > A set of > > > > static int compareTo(int, int) > > static int compareTo(long, long) > > .... > > > > methods probably belongs somewhere in the platform too. > > > > What other utility methods would have broad enough use and applicability > to > > go into a common java.util class? > > > > -Joe > > > > Given you've listed utility methods for two Object methods, equals and > hashCode, toString seems an obvious one to handle as well: > > public static String toString(Object o) > throws IllegalAccessException > { > Class c = o.getClass(); > StringBuilder b = new StringBuilder(c.getName()); > b.append("["); > for (Field f : c.getDeclaredFields()) > { > f.setAccessible(true); > b.append(f.getName() + "=" + f.get()); > b.append(","); > } > b.replace(b.length() - 1, b.length(), "]"); > return b.toString(); > } > > Maybe there's also a useful utility implementation of clone too, but I > can't think of one offhand. > -- > Andrew :-) > > Free Java Software Engineer > Red Hat, Inc. (http://www.redhat.com) > > Support Free Java! > Contribute to GNU Classpath and the OpenJDK > http://www.gnu.org/software/classpath > http://openjdk.java.net > > PGP Key: 94EFD9D8 (http://subkeys.pgp.net) > Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 > -- Kevin Bourrillion @ Google internal: http://go/javalibraries google-collections.googlecode.com google-guice.googlecode.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Joe.Darcy at Sun.COM Wed Sep 9 23:36:41 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 16:36:41 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <108fcdeb0909091625h5cc8c370t5d0a16445d7eb46a@mail.gmail.com> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <108fcdeb0909091625h5cc8c370t5d0a16445d7eb46a@mail.gmail.com> Message-ID: <4AA83C09.30700@sun.com> Kevin Bourrillion wrote: > -1 on reflection-based stuff in the Objects class. > > equal() and hashCode() are the only two things we saw fit to include > in our Objects class, and actually, our hashCode() is identical to > Arrays.hashCode() (but is varargs). > > http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Objects.html Hmm, java.util.Arrays.{hashCode, deepHashCode} could be changed to be var-args methods in JDK 7. Possibly the toString methods on Object[] would benefit from being var-args too. > > Please do add the compare() methods to all the rest of the wrapper > types; we would use those a lot. I was considering putting all the compare/compareTo methods for primitives in one class; that way the type of the operands doesn't have to be expressed in a typically call site. > > When it comes to cloning, I tried very hard once to provide something > useful -- a "clone any object without knowing its concrete type" > method -- and it was a disaster. A total mess of reflection, and no > one wanted to use it anyway. Cloning in Java is discredited. > > So I'm left with only equal() for your new Objects class. By the way, > the best implementation is a == b || (a != null && a.equals(b)). Thanks for the tip, -Joe > > > > On Wed, Sep 9, 2009 at 2:22 PM, Andrew John Hughes > > wrote: > > 2009/9/9 Joe Darcy >: > > Hello. > > > > For JDK 7, I think it is high-time the platform included a class > like > > java.util.Objects to hold commonly-written utility methods. For > example, a > > two-argument static equals method that returned true if both > arguments are > > null, returns false is one argument is null, and otherwise > returns the > > result of calling arg1.equals(arg2) (6797535 "Add shared two > argument > > static equals method to the platform"). > > > > A static hashCode method returning 0 for null and the value of > > arg.hashCode() has also been suggested. > > > > A set of > > > > static int compareTo(int, int) > > static int compareTo(long, long) > > .... > > > > methods probably belongs somewhere in the platform too. > > > > What other utility methods would have broad enough use and > applicability to > > go into a common java.util class? > > > > -Joe > > > > Given you've listed utility methods for two Object methods, equals and > hashCode, toString seems an obvious one to handle as well: > > public static String toString(Object o) > throws IllegalAccessException > { > Class c = o.getClass(); > StringBuilder b = new StringBuilder(c.getName()); > b.append("["); > for (Field f : c.getDeclaredFields()) > { > f.setAccessible(true); > b.append(f.getName() + "=" + f.get()); > b.append(","); > } > b.replace(b.length() - 1, b.length(), "]"); > return b.toString(); > } > > Maybe there's also a useful utility implementation of clone too, but I > can't think of one offhand. > -- > Andrew :-) > > Free Java Software Engineer > Red Hat, Inc. (http://www.redhat.com) > > Support Free Java! > Contribute to GNU Classpath and the OpenJDK > http://www.gnu.org/software/classpath > http://openjdk.java.net > > PGP Key: 94EFD9D8 (http://subkeys.pgp.net) > Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 > > > > > -- > Kevin Bourrillion @ Google > internal: http://go/javalibraries > google-collections.googlecode.com > > google-guice.googlecode.com > From forax at univ-mlv.fr Wed Sep 9 23:48:44 2009 From: forax at univ-mlv.fr (=?UTF-8?B?UsOpbWkgRm9yYXg=?=) Date: Thu, 10 Sep 2009 01:48:44 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> Message-ID: <4AA83EDC.4090100@univ-mlv.fr> Le 09/09/2009 23:22, Andrew John Hughes a ?crit : > Given you've listed utility methods for two Object methods, equals and > hashCode, toString seems an obvious one to handle as well: > > public static String toString(Object o) > throws IllegalAccessException > { > Class c = o.getClass(); > StringBuilder b = new StringBuilder(c.getName()); > b.append("["); > for (Field f : c.getDeclaredFields()) > { > f.setAccessible(true); > b.append(f.getName() + "=" + f.get()); > b.append(","); > } > b.replace(b.length() - 1, b.length(), "]"); > return b.toString(); > } > > Maybe there's also a useful utility implementation of clone too, but I > can't think of one offhand. > Arghhh, b.append(f.getName() + "=" + f.get()); shoud be b.append(f.getName()).append("=").append(f.get(o)); And I think there is a problem if the object has no field. R?mi From gnu_andrew at member.fsf.org Wed Sep 9 23:43:57 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 10 Sep 2009 00:43:57 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA83EDC.4090100@univ-mlv.fr> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <4AA83EDC.4090100@univ-mlv.fr> Message-ID: <17c6771e0909091643o1fe399edt4b29b2632f9fe12e@mail.gmail.com> 2009/9/10 R?mi Forax : > Le 09/09/2009 23:22, Andrew John Hughes a ?crit : >> >> Given you've listed utility methods for two Object methods, equals and >> hashCode, toString seems an obvious one to handle as well: >> >> public static String toString(Object o) >> ? throws IllegalAccessException >> { >> ? Class ?c = o.getClass(); >> ? StringBuilder b = new StringBuilder(c.getName()); >> ? b.append("["); >> ? for (Field f : c.getDeclaredFields()) >> ? { >> ? ? f.setAccessible(true); >> ? ? b.append(f.getName() + "=" + f.get()); >> ? ? b.append(","); >> ? } >> ? b.replace(b.length() - 1, b.length(), "]"); >> ? return b.toString(); >> } >> >> Maybe there's also a useful utility implementation of clone too, but I >> can't think of one offhand. >> > > Arghhh, > > b.append(f.getName() + "=" + f.get()); > > shoud be > > b.append(f.getName()).append("=").append(f.get(o)); > > > And I think there is a problem if the object has no field. > > R?mi > Yeah, it was meant to be just a proof of concept, not bulletproof efficient code for actual use, but thanks for the code review :) Gives output something like: Utils[bing=5,boom=boom,isDone=false] I end up writing so many toString methods that are return getClass().getName() + "[field1=" + field + ",field2=" + field2 + "]"; that it would make things easier. Not as efficient as implementing it yourself, agreed, but I find I usually call these methods only when debugging anyway. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From forax at univ-mlv.fr Thu Sep 10 00:04:08 2009 From: forax at univ-mlv.fr (=?UTF-8?B?UsOpbWkgRm9yYXg=?=) Date: Thu, 10 Sep 2009 02:04:08 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <17c6771e0909091643o1fe399edt4b29b2632f9fe12e@mail.gmail.com> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <4AA83EDC.4090100@univ-mlv.fr> <17c6771e0909091643o1fe399edt4b29b2632f9fe12e@mail.gmail.com> Message-ID: <4AA84278.7060403@univ-mlv.fr> Le 10/09/2009 01:43, Andrew John Hughes a ?crit : > 2009/9/10 R?mi Forax: > >> Le 09/09/2009 23:22, Andrew John Hughes a ?crit : >> >>> Given you've listed utility methods for two Object methods, equals and >>> hashCode, toString seems an obvious one to handle as well: >>> >>> public static String toString(Object o) >>> throws IllegalAccessException >>> { >>> Class c = o.getClass(); >>> StringBuilder b = new StringBuilder(c.getName()); >>> b.append("["); >>> for (Field f : c.getDeclaredFields()) >>> { >>> f.setAccessible(true); >>> b.append(f.getName() + "=" + f.get()); >>> b.append(","); >>> } >>> b.replace(b.length() - 1, b.length(), "]"); >>> return b.toString(); >>> } >>> >>> Maybe there's also a useful utility implementation of clone too, but I >>> can't think of one offhand. >>> >>> >> Arghhh, >> >> b.append(f.getName() + "=" + f.get()); >> >> shoud be >> >> b.append(f.getName()).append("=").append(f.get(o)); >> >> >> And I think there is a problem if the object has no field. >> >> R?mi >> >> > Yeah, it was meant to be just a proof of concept, not bulletproof > efficient code for actual use, but thanks for the code review :) > Gives output something like: Utils[bing=5,boom=boom,isDone=false] > I end up writing so many toString methods that are return > getClass().getName() + "[field1=" + field + ",field2=" + field2 + "]"; > that it would make things easier. Not as efficient as implementing it > yourself, agreed, but I find I usually call these methods only when > debugging anyway. > I agree about the debugging purpose, that why I don't agree with Kevin when he said that java.util.Objects should not use reflection. Perhaps the method can be renamed to: toDebugString. R?mi PS: the code above also forget inherited fields. From scolebourne at joda.org Wed Sep 9 23:54:33 2009 From: scolebourne at joda.org (Stephen Colebourne) Date: Thu, 10 Sep 2009 00:54:33 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> 2009/9/9 Joe Darcy : > What other utility methods would have broad enough use and applicability to > go into a common java.util class? Well, my first selection is here http://www.jroller.com/scolebourne/entry/jdk_7_method_suggestions To keep the discussion here valid too, I'll paste it below: Stephen JDK 7 utility methods There is lots of prior art in the field of general utility method libraries for Java. Perhaps the best known is Apache Commons Lang. Lets choose some methods (other than string utilities) that might be appropriate for the JDK from ObjectUtils. 1) Null-safe equals check. boolean Objects.equals(Object object1, Object object2) Returns true if both are null, or both are non-null and equal. 2) Null-safe hash code. int Objects.hashCode(Object object) Returns the hash code of the object, or zero if the object is null. 3) Null-safe toString. String Objects.toString(Object object) Returns the toString of the object, or "" if the object is null. 4) Null-safe toString with specified default. String Objects.toString(Object object, String defaultStr) Returns the toString of the object, or defaultStr if the object is null. 5) Null-safe object defaulting. T Objects.defaultNull(T object, T defaultValue) Returns the object, or defaultValue if the object is null. (Of course, the Elvis operator is a much clearer approach for this common case...) 6) Get maximum and minimum. T Objects.max(T comparable1, T comparable2) T Objects.min(T comparable1, T comparable2) Returns the maximum/minimum object, returning the non-null object if either is null, or null if both are null. Generics allow the return type to check the input is also a Comparable. These would appear to be the obvious methods to add to an Objects utility class. The following are missing methods on Integer/Long: 7) Compare two primitives. int Byte.compare(byte value1, byte value2) int Short.compare(short value1, short value2) int Integer.compare(int value1, int value2) int Long.compare(long value1, long value2) Safely returns the comparison (-1/0/1) indicator for two primitives. (These methods already exist on Float/Double). The methods from SystemUtils can be very useful in reducing arbitrary strings in code: 8) Get common environment variables. File System.getJavaIoTempDir() File System.getJavaHomeDir() File System.getUserHomeDir() File System.getUserDir() Returns the java environment variables. There are lots more in SystemUtils that could be added. Some more null handling methods for primitives - again, Elvis would be a better solution: 9) Convert wrapper to primitive avoiding NPE. boolean Boolean.booleanValue(Boolean obj, boolean defaultValue) char Character.charValue(Character obj, char defaultValue) byte Byte.byteValue(Byte obj) byte Byte.byteValue(Byte obj, byte defaultValue) short Short.shortValue(Short obj) short Short.shortValue(Short obj, short defaultValue) int Integer.intValue(Integer obj) int Integer.intValue(Integer obj, int defaultValue) long Long.longValue(Long obj) long Long.longValue(Long obj, long defaultValue) float Float.floatValue(Float obj) float Float.floatValue(Float obj, float defaultValue) double Double.doubleValue(Double obj) double Double.doubleValue(Double obj, double defaultValue) Safe ways to convert a wrapper to a primitive. The numeric ones return zero if the default argument isn't specified. There is also a case for methods to convert arrays of wrappers to arrays of primitives. These should probably be on a Booleans utility class as per BooleanUtils. 10) Boolean methods for clearer code. boolean Booleans.isTrue(Boolean booleanObj) boolean Booleans.isFalse(Boolean booleanObj) Return true as per the method name, false if null. boolean Booleans.isNotTrue(Boolean booleanObj) boolean Booleans.isNotFalse(Boolean booleanObj) Return true as per the method name, true if null. 11) Negate handling null. Boolean Booleans.negate(Boolean booleanObj) TRUE returns FALSE, FALSE returns TRUE, null returns null. 11) Boolean arithmetic. boolean Booleans.and(boolean[] array) boolean Booleans.or(boolean[] array) boolean Booleans.xor(boolean[] array) boolean Booleans.and(Boolean[] array) boolean Booleans.or(Boolean[] array) boolean Booleans.xor(Boolean[] array) Performs the stated binary maths. 12) Character comparison. boolean Character.equalsIgnoreCase(char ch1, char ch2) Compares two characters ignoring case. These should be constants for empty arrays on common classes: 13) Empty array constants. Boolean[] Boolean.EMPTY_ARRAY boolean[] Boolean.EMPTY_PRIMITIVE_ARRAY Character[] Character.EMPTY_ARRAY char[] Character.EMPTY_PRIMITIVE_ARRAY Byte[] Byte.EMPTY_ARRAY byte[] Byte.EMPTY_PRIMITIVE_ARRAY Short[] Short.EMPTY_ARRAY short[] Short.EMPTY_PRIMITIVE_ARRAY Integer[] Integer.EMPTY_ARRAY int[] Integer.EMPTY_PRIMITIVE_ARRAY Long[] Long.EMPTY_ARRAY long[] Long.EMPTY_PRIMITIVE_ARRAY Float[] Float.EMPTY_ARRAY float[] Float.EMPTY_PRIMITIVE_ARRAY Double[] Double.EMPTY_ARRAY double[] Double.EMPTY_PRIMITIVE_ARRAY String[] String.EMPTY_ARRAY Class[] Class.EMPTY_ARRAY Object[] Objects.EMPTY_OBJECT_ARRAY Return true as per the method name, true if null. Or a better solution might be a method on Class: T[] Class.emptyArray(); This allows code like: Boolean.class.emptyArray(); 14) Array size. boolean Arrays.isEmpty(Object[] array) int Arrays.size(Object[] array) Where a null array is empty/size-zero. 15) Collection size. boolean Collections.isEmpty(Collection coll) int Collections.size(Collection coll) boolean Collections.isEmpty(Map map) int Collections.size(Map map) Where a null collection is empty/size-zero. Or, even better, add a new interface Sized with a single method to get the size. This would be retrofitted to Collection, Map, String and arrays (of course, technically, thats a language change...). And some Class utilities for less NPEs when outputting the class name in debugging: 16) NPE safe way to get class name. String Class.getName(Class cls) String Class.getSimpleName(Class cls) String Class.getPackageName(Class cls) Returns the class name, or null if the input is null. Again, the null-safe operators would avoid this kind of specific method. Locale could do with some love, as per LocaleUtils: 17) Parse a locale string. Locale parse(String localeStr) Parses the locale string to a locale. 16) Country/Language lists. List Locale.countriesByLanguage(String langaugeStr) List Locale.languagesByCountry(String countryStr) Extracts just countries or languages. A better solution would be two new classes Country and Language. These would be useful in other places in the JDK, where a locale is used and it should be a country or language. And the big one that I've missed - safe maths, as per Joda-Time FieldUtils: 18) Add/subtract/multiply/cast safely. int Math.safeToInt(long value) int Math.safeNegate(int value) long Math.safeNegate(long value) int Math.safeAdd(int value1, int value2) long Math.safeAdd(long value1, int value2) long Math.safeAdd(long value1, long value2) int Math.safeSubtract(int value1, int value2) long Math.safeSubtract(long value1, int value2) long Math.safeSubtract(long value1, long value2) int Math.safeMultiply(int value1, int value2) long Math.safeMultiply(long value1, int value2) long Math.safeMultiply(long value1, long value2) These perform the specified mathematical operation, but throw ArithmeticException, rather than failing quietly, if overflow occurs. I should also note that there are a whole heap of BigDecimal, BigInteger and String utilities that could be added. From martinrb at google.com Thu Sep 10 00:04:10 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 17:04:10 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> Message-ID: <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> Google would like to contribute implementations of the methods below. Here's a webrev: http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ We have tests (not yet included) but they would need to be jtreg-ified. Is there any junit support yet for jtreg? Martin On Wed, Sep 9, 2009 at 16:54, Stephen Colebourne wrote: > 2009/9/9 Joe Darcy : > The following are missing methods on Integer/Long: > > 7) Compare two primitives. > int Byte.compare(byte value1, byte value2) > int Short.compare(short value1, short value2) > int Integer.compare(int value1, int value2) > int Long.compare(long value1, long value2) > Safely returns the comparison (-1/0/1) indicator for two primitives. > (These methods already exist on Float/Double). From martinrb at google.com Thu Sep 10 00:15:48 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 17:15:48 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> Here's a bunch of static hashCode methods for primitives: http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ This doesn't include a public static int hashCode(object x) { return x == null ? 0 : x.hashCode(); } that I think was also being asked for, and which might be a candidate for Objects. Martin From Joe.Darcy at Sun.COM Thu Sep 10 00:34:57 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 17:34:57 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> Message-ID: <4AA849B1.1090005@sun.com> Martin Buchholz wrote: > Google would like to contribute implementations of the methods below. > Here's a webrev: > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ > Wherever these compare methods go, into the N wrapper classes or into java.util.Compare, I think the instance method compareTo should be rewritten in terms of the new static compare. In particular, 422 public int compareTo(Short anotherShort) { 423 return this.value - anotherShort.value; 424 } should get replaced with 422 public int compareTo(Short anotherShort) { 423 return compare(this.value, anotherShort.value); 424 } This consolidates the comparison logic in a single method per type and reuses the existing implementation tests. (Later in JDK 7, a set of "unsignedCompare" methods are possible additions to the platform too.) > We have tests (not yet included) but they would need to be jtreg-ified. > Is there any junit support yet for jtreg? > No. Once the home of the new methods is determined, I'll file a ccc request so these changes can go back after any additional testing is settled. Thanks, -Joe > Martin > > On Wed, Sep 9, 2009 at 16:54, Stephen Colebourne wrote: > >> 2009/9/9 Joe Darcy : >> The following are missing methods on Integer/Long: >> >> 7) Compare two primitives. >> int Byte.compare(byte value1, byte value2) >> int Short.compare(short value1, short value2) >> int Integer.compare(int value1, int value2) >> int Long.compare(long value1, long value2) >> Safely returns the comparison (-1/0/1) indicator for two primitives. >> (These methods already exist on Float/Double). >> From martinrb at google.com Thu Sep 10 00:35:10 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 17:35:10 -0700 Subject: Race condition in Class.getName() Message-ID: <1ccfd1c10909091735ndf28f91j1813c26203a60967@mail.gmail.com> It is believed that the java memory model allows Class.getName() to return null. This is one of those methods with an intentional data race. Probably this has not been seen in practice because only a perverse or adversarial runtime would load the "name" field twice, out-of-order, as it seems to be allowed to. diff --git a/src/share/classes/java/lang/Class.java b/src/share/classes/java/lang/Class.java --- a/src/share/classes/java/lang/Class.java +++ b/src/share/classes/java/lang/Class.java @@ -565,8 +565,9 @@ * represented by this object. */ public String getName() { + String name = this.name; if (name == null) - name = getName0(); + this.name = name = getName0(); return name; } Martin From Joe.Darcy at Sun.COM Thu Sep 10 00:40:10 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 17:40:10 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> Message-ID: <4AA84AEA.7050008@sun.com> Martin Buchholz wrote: > Here's a bunch of static hashCode methods for primitives: > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ > Hmm, I'd be more inclined to group these methods into Objects as part of a "universal hash" functionality. > This doesn't include a > > public static int hashCode(object x) { return x == null ? 0 : x.hashCode(); } > > that I think was also being asked for, and which might be a candidate > for Objects. Yes, I was thinking of that method for Objects. -Joe PS This talk of hashing remind me of a small spec cleanup: 4245470 algorithm of java.lang.Byte.hashCode() is not specified http://bugs.sun.com/view_bug.do?bug_id=4245470 From forax at univ-mlv.fr Thu Sep 10 00:54:13 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 10 Sep 2009 02:54:13 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> Message-ID: <4AA84E35.4060207@univ-mlv.fr> Le 10/09/2009 02:15, Martin Buchholz a ?crit : > Here's a bunch of static hashCode methods for primitives: > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ > > This doesn't include a > > public static int hashCode(object x) { return x == null ? 0 : x.hashCode(); } > > that I think was also being asked for, and which might be a candidate > for Objects. > > Martin > Martin, You forget java.lang.Boolean in your patch set :) R?mi From martinrb at google.com Thu Sep 10 01:08:48 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 18:08:48 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA849B1.1090005@sun.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> <4AA849B1.1090005@sun.com> Message-ID: <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> On Wed, Sep 9, 2009 at 17:34, Joe Darcy wrote: > Martin Buchholz wrote: >> >> Google would like to contribute implementations of the methods below. >> Here's a webrev: >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ >> > > Wherever these compare methods go, into the N wrapper classes or into > java.util.Compare, Given the precedent of Double.compare(double,double) and Float.compare(float,float), I think the compare methods need to go into the primitive wrapper classes. I think the instance method compareTo should be rewritten > in terms of the new static compare. ?In particular, > > 422 ? ? public int compareTo(Short anotherShort) { > 423 ? ? ? ? return this.value - anotherShort.value; > 424 ? ? } > > should get replaced with > > 422 ? ? public int compareTo(Short anotherShort) { > 423 ? ? ? ? return compare(this.value, anotherShort.value); > 424 ? ? } As you wish. Webrev updated. http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ > This consolidates the comparison logic in a single method per type and > reuses the existing implementation tests. > (Later in JDK 7, a set of "unsignedCompare" methods are possible additions > to the platform too.) > >> We have tests (not yet included) but they would need to be jtreg-ified. >> Is there any junit support yet for jtreg? >> > > No. > > Once the home of the new methods is determined, I'll file a ccc request so > these changes can go back after any additional testing is settled. There's not a whole lot of testing work here, but we will provide it if it CCC is approved. Martin From Joe.Darcy at Sun.COM Thu Sep 10 01:34:32 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 18:34:32 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> <4AA849B1.1090005@sun.com> <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> Message-ID: <4AA857A8.1010700@sun.com> Martin Buchholz wrote: > On Wed, Sep 9, 2009 at 17:34, Joe Darcy wrote: > >> Martin Buchholz wrote: >> >>> Google would like to contribute implementations of the methods below. >>> Here's a webrev: >>> >>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ >>> >>> >> Wherever these compare methods go, into the N wrapper classes or into >> java.util.Compare, >> > > Given the precedent of Double.compare(double,double) and > Float.compare(float,float), I think the compare methods need > to go into the primitive wrapper classes. > > I think the instance method compareTo should be rewritten > >> in terms of the new static compare. In particular, >> >> 422 public int compareTo(Short anotherShort) { >> 423 return this.value - anotherShort.value; >> 424 } >> >> should get replaced with >> >> 422 public int compareTo(Short anotherShort) { >> 423 return compare(this.value, anotherShort.value); >> 424 } >> > > As you wish. > > Webrev updated. > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ > I approve these changes in an engineering sense; they are a fix for bug 6582946 Add suite of compare(T, T) methods for ints, longs etc >> This consolidates the comparison logic in a single method per type and >> reuses the existing implementation tests. >> > > > >> (Later in JDK 7, a set of "unsignedCompare" methods are possible additions >> to the platform too.) >> >> >>> We have tests (not yet included) but they would need to be jtreg-ified. >>> Is there any junit support yet for jtreg? >>> >>> >> No. >> >> Once the home of the new methods is determined, I'll file a ccc request so >> these changes can go back after any additional testing is settled. >> > > There's not a whole lot of testing work here, but we will provide it if > it CCC is approved. > > I've created a ccc for this and will let you know when it is approved. -Joe From martinrb at google.com Thu Sep 10 02:11:28 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 19:11:28 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA84E35.4060207@univ-mlv.fr> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84E35.4060207@univ-mlv.fr> Message-ID: <1ccfd1c10909091911l67ffaf66xf0bb3733f4071224@mail.gmail.com> On Wed, Sep 9, 2009 at 17:54, R?mi Forax wrote: > Le 10/09/2009 02:15, Martin Buchholz a ?crit : >> >> Here's a bunch of static hashCode methods for primitives: >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ >> >> This doesn't include a >> >> public static int hashCode(object x) { return x == null ? 0 : >> x.hashCode(); } >> >> that I think was also being asked for, and which might be a candidate >> for Objects. >> >> Martin >> > > Martin, > You forget java.lang.Boolean in your patch set :) R?mi, merci beaucoup. Les Booleans, je les avaient oubli?e. Mes patchs pour les classes wrapper, tous les deux, maintenant incluent Boolean. http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ Martin > R?mi > From martinrb at google.com Thu Sep 10 02:28:15 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 19:28:15 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA84AEA.7050008@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> Message-ID: <1ccfd1c10909091928o2797106bqf433af4bc6adb294@mail.gmail.com> I've updated the hashCode patch to include Booleans and similar refactoring as in compare. We could do worse than to do hashCode in a totally analogous fashion to compare, but I could also see them incorporated into a static HashCodes class. If you put one into Objects, then the primitive hashCode methods wouldn't belong in there, defeating your aim of keeping them together. Probably we want to have hash code combining methods. Sigh... nothing is ever easy. Martin On Wed, Sep 9, 2009 at 17:40, Joe Darcy wrote: > Martin Buchholz wrote: >> >> Here's a bunch of static hashCode methods for primitives: >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ >> > > Hmm, I'd be more inclined to group these methods into Objects as part of a > "universal hash" functionality. > >> This doesn't include a >> >> public static int hashCode(object x) { return x == null ? 0 : >> x.hashCode(); } >> >> that I think was also being asked for, and which might be a candidate >> for Objects. > > Yes, I was thinking of that method for Objects. > > -Joe > > PS This talk of hashing remind me of a small spec cleanup: > 4245470 algorithm of java.lang.Byte.hashCode() is not specified > http://bugs.sun.com/view_bug.do?bug_id=4245470 > From martinrb at google.com Thu Sep 10 02:42:29 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 9 Sep 2009 19:42:29 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA84AEA.7050008@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> Message-ID: <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> On Wed, Sep 9, 2009 at 17:40, Joe Darcy wrote: > > PS This talk of hashing remind me of a small spec cleanup: > 4245470 algorithm of java.lang.Byte.hashCode() is not specified > http://bugs.sun.com/view_bug.do?bug_id=4245470 > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode-spec/ Martin From Joe.Darcy at Sun.COM Thu Sep 10 03:01:37 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Wed, 09 Sep 2009 20:01:37 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> Message-ID: <4AA86C11.7080409@sun.com> Martin Buchholz wrote: > On Wed, Sep 9, 2009 at 17:40, Joe Darcy wrote: > >> PS This talk of hashing remind me of a small spec cleanup: >> 4245470 algorithm of java.lang.Byte.hashCode() is not specified >> http://bugs.sun.com/view_bug.do?bug_id=4245470 >> >> > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode-spec/ > > Martin > I'll work on the archeology to verify this behavior has been consistent over time and thus is reasonable to tighten the spec in these cases. -Joe From reinier at zwitserloot.com Thu Sep 10 03:45:09 2009 From: reinier at zwitserloot.com (Reinier Zwitserloot) Date: Thu, 10 Sep 2009 05:45:09 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? Message-ID: <505CEA25-1E45-40BC-BFF9-EC0959E6EC05@zwitserloot.com> Late to the thread, so many one-liners to various ideas uttered on the list: -- This is great stuff folks. As long as I get my String.join (or Collections.join, or Arrays.join, or Whatever.join, as long as there's a join!), of course :) -- The compareTo methods for Integer/Short/Byte/Long (Character?) should clearly go in the respective wrapper classes for consistency's sake, but there's nothing in the way of ALSO making a utilities class of sorts that contains all the primitive compareTo methods as well, if that seems useful. -- A trick I'm reverting to rather a lot of late is to find my own jar file by getting a URL to my own class file as a resource, resolved against my own class, and then parsing this URL for the jar bit of it. (MyClassName.class.getResource("MyClassName.class")). There are a bunch of caveats here, mostly revolving around the notion that you may not have been loaded as a jar file, but as a directory, or via the network, or from a database, or who knows how? - but that's what returning "null" is for, surely. Something to consider, though I'm not entirely convinced this hack should be made legitimate by turning it into a library method. I doubt it's a good fit for Objects, in any case. -- Whatever hashCode() implementation is decided on, it should probably mirror the way IDEs generate it when you ask them to. Specifically: Use deepHashCode for object arrays. Yes, this means you'll get StackOverflows if an array contains itself. This is either (A) the correct action, or (B) ArrayList is broken, as it has the same behaviour. Split up longs via XOR, and doubles via toLongBits -> XOR. There's loads of alternative algorithms that purport to be more efficient, but without specific domain knowledge, xor is hard to beat. Project Lombok sticks to this plan, which is mostly derived from Effective Java, IIRC. Same goes for equals and toString. -- How does Joe Average Java Programmer tell the difference between Objects.equals(), which simply adds null friendliness, and a reflection-based pseudo-automagical hashCode builder? -- Changing Arrays.deepEquals and friends to varargs has the same problem as Arrays.asList for 'list literals': What do list literals and null- friendly equals/hashCode/toString implements have to do with arrays? Nothing. There's a reason google went out of their way to dress up "ImmutableList.of(a, b, c);" as a library, after all. Even without the Collections.unmodifiableList() wrapper call, Arrays.asList() is unwieldly and a pretty bad implementation leakage - you're trying to build an immutable list; the fact that you're doing so by varargsing your arguments into an array and turning THAT into a list is not something you should be confronted with when reading code. I'd much prefer a solution that did not involve java.util.Arrays. -- toString() is not supposed to be something you ever rely upon, and I furthermore have a rather hard time imagining anybody can possibly be relying on the random-esque default toString() implementation, which combines a memory pointer with a class name. So, would it be an option to change toString()'s implementation to do the sane thing? Arrays.toString (deepToString? That can cause StackOverflows...) for arrays, and some reflection-based magic otherwise? Changing equals() and hashCode() is not so simply modified without causing serious backwards compatibility issues, unfortunately. --Reinier Zwitserloot -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikro2nd at gmail.com Thu Sep 10 08:24:16 2009 From: mikro2nd at gmail.com (Mike Morris) Date: Thu, 10 Sep 2009 10:24:16 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <4AA8B7B0.5070009@gmail.com> Joe Darcy wrote: > For JDK 7, I think it is high-time the platform included a class like > java.util.Objects to hold commonly-written utility methods. For ... > What other utility methods would have broad enough use and applicability > to go into a common java.util class? Ah! Let's just go back to coding in C, then. I cannot see any justification for everything and the kitchen-sink being glommed into the Java APIs. If people want these sort of static methods, they're pretty-much all available in other libraries (Apache Commons, etc.) Must they /really/ be added to the morass that the Java APIs have become? (Sorry: As a non-contributor I probably don't have the mana to make such a comment, but this proposal really punches a lot of my buttons.) -- mike morris :: mikro2nd (at) gmail (dot) com http://mikro2nd.net/ http://mikro2nd.net/blog/planb/ http://mikro2nd.net/blog/mike/ This email is [X]bloggable [ ]ask-first [ ]private From Ulf.Zibis at gmx.de Thu Sep 10 08:56:28 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 10 Sep 2009 10:56:28 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA84278.7060403@univ-mlv.fr> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <4AA83EDC.4090100@univ-mlv.fr> <17c6771e0909091643o1fe399edt4b29b2632f9fe12e@mail.gmail.com> <4AA84278.7060403@univ-mlv.fr> Message-ID: <4AA8BF3C.7080601@gmx.de> Am 10.09.2009 02:04, R?mi Forax schrieb: > Le 10/09/2009 01:43, Andrew John Hughes a ?crit : > I agree about the debugging purpose, that why I don't agree > with Kevin when he said that java.util.Objects should not use > reflection. > > Perhaps the method can be renamed to: toDebugString. > > R?mi > PS: the code above also forget inherited fields. > Maybe another class: java.util.Debug / DebugHelpers / DebugUtils I guess, there are many ideas around to fill such a class with useful things. -Ulf From Ulf.Zibis at gmx.de Thu Sep 10 09:43:45 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 10 Sep 2009 11:43:45 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> Message-ID: <4AA8CA51.8000705@gmx.de> Am 10.09.2009 01:54, Stephen Colebourne schrieb: > > There is also a case for methods to convert arrays of wrappers to > arrays of primitives. > +1 - I guess, you mean also vice versa - Maybe would become superfluous, if HotSpot internally would compile to primitive arrays. (just a raw thought) 19) re-usability of java.nio.Buffer (saves multiple instantiation): - X-Buffer#clear(x[] buf); clears all pointers - X-Buffer#reset(x[] buf); only resets pos to mark (maybe limit to array size), allows to process different data in same/similar/synchronous manner. -Ulf From Ulf.Zibis at gmx.de Thu Sep 10 09:45:24 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 10 Sep 2009 11:45:24 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> Message-ID: <4AA8CAB4.5060403@gmx.de> Am 10.09.2009 02:04, Martin Buchholz schrieb: > Is there any junit support yet for jtreg? > +1 to have this. -Ulf From Ulf.Zibis at gmx.de Thu Sep 10 09:58:24 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 10 Sep 2009 11:58:24 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> Message-ID: <4AA8CDC0.4000004@gmx.de> Am 10.09.2009 02:15, Martin Buchholz schrieb: > Here's a bunch of static hashCode methods for primitives: > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ > Can't this be solved by extending auto-boxing capabilities? : long l = 1234567890; int hash = l.hashCode(); -Ulf From Ulf.Zibis at gmx.de Thu Sep 10 11:07:16 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Thu, 10 Sep 2009 13:07:16 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <505CEA25-1E45-40BC-BFF9-EC0959E6EC05@zwitserloot.com> References: <505CEA25-1E45-40BC-BFF9-EC0959E6EC05@zwitserloot.com> Message-ID: <4AA8DDE4.8050909@gmx.de> Am 10.09.2009 05:45, Reinier Zwitserloot schrieb: > > A trick I'm reverting to rather a lot of late is to find my own jar > file by getting a URL to my own class file as a resource, resolved > against my own class, and then parsing this URL for the jar bit of it. > (MyClassName.class.getResource("MyClassName.class")). There are a > bunch of caveats here, mostly revolving around the notion that you may > not have been loaded as a jar file, but as a directory, or via the > network, or from a database, or who knows how? - but that's what > returning "null" is for, surely. Something to consider, though I'm not > entirely convinced this hack should be made legitimate by turning it > into a library method. I doubt it's a good fit for Objects, in any case. I guess you mean: MyClassName.class.getResource("MyClassSimpleName.class") I would like File(URI uri) to accept jar URI's, so it would be possible to get a nio channel access to a jared resource. Or even better: MyClassName.class.getResourceAsChannel("MyResourceName")) -Ulf From gnu_andrew at member.fsf.org Thu Sep 10 13:01:24 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 10 Sep 2009 14:01:24 +0100 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> Message-ID: <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> 2009/4/29 Martin Buchholz : > Since writing this, I have learned, to my horror, that the > behavior of the -C flag differs from the behavior in tar in that > > - -C is not sticky - it applies only to the one following argument > > - the path is relative to the JDK's current directory, not the > previous -C directory. > > despite assurances from jar(1) > > ? ? ? ? ?-C ?dir > ? ? ? ? ? ? Temporarily changes directories (cd dir) during execution of the > ? ? ? ? ? ? jar command while processing the following inputfiles argument. > ? ? ? ? ? ? Its operation is intended to be similar to the -C option of the > ? ? ? ? ? ? UNIX tar utility. > > If you squint, you can see that it says "argument", not "arguments". > > Martin > > On Mon, Apr 27, 2009 at 17:54, Martin Buchholz wrote: >> ?I believe the better fix would be >> to eviscerate the code that handles the "-C" flag and do it right, > > >> Someone who cares about the Makefiles can also try to remove the >> 16000 gratuitous -C flags that makes jar's life "jar hell". >> >> Martin >> > Martin, Thanks a lot for this patch. We've seen good speedups with it applied. The thread here reads very strangely; did a number of mails go to a different mail list or only to private mail addresses? There's also seems to be no mention of this being applied to OpenJDK6: http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/b35f1e5075a4 That changeset seems to have been merged together with several others; was there a reason the changesets were not imported individually so as to retain the history? Thanks, -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From gnu_andrew at member.fsf.org Thu Sep 10 13:11:16 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 10 Sep 2009 14:11:16 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA8BF3C.7080601@gmx.de> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <4AA83EDC.4090100@univ-mlv.fr> <17c6771e0909091643o1fe399edt4b29b2632f9fe12e@mail.gmail.com> <4AA84278.7060403@univ-mlv.fr> <4AA8BF3C.7080601@gmx.de> Message-ID: <17c6771e0909100611p7af03905v60051d36bf4cf1de@mail.gmail.com> 2009/9/10 Ulf Zibis : > Am 10.09.2009 02:04, R?mi Forax schrieb: >> >> Le 10/09/2009 01:43, Andrew John Hughes a ?crit : ?I agree about the >> debugging purpose, that why I don't agree >> with Kevin when he said that java.util.Objects should not use >> reflection. >> >> Perhaps the method can be renamed to: toDebugString. >> >> R?mi >> PS: the code above also forget inherited fields. >> > Maybe another class: java.util.Debug / DebugHelpers / DebugUtils > > I guess, there are many ideas around to fill such a class with useful > things. > > > -Ulf > > > Yeah you are probably right, my suggestion seems to come from a different avenue than the others here. It's probably because personally I've never used library method to do such simple null checks; it might have fixed a few bugs for me along the road, but I just prefer to check such things locally than add in the overhead of a method call. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From gnu_andrew at member.fsf.org Thu Sep 10 13:12:10 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 10 Sep 2009 14:12:10 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA8CA51.8000705@gmx.de> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <4AA8CA51.8000705@gmx.de> Message-ID: <17c6771e0909100612k83b1168o3c3bb651a7f93ceb@mail.gmail.com> 2009/9/10 Ulf Zibis : > Am 10.09.2009 01:54, Stephen Colebourne schrieb: >> >> There is also a case for methods to convert arrays of wrappers to >> arrays of primitives. >> > > +1 > - I guess, you mean also vice versa > - Maybe would become superfluous, if HotSpot internally would compile to > primitive arrays. (just a raw thought) > Except that what's being proposed here results in a spec. change and will be available regardless of VM. We shouldn't go on relying on features of certain VMs. There are other VMs than HotSpot you know! :) > 19) re-usability of java.nio.Buffer (saves multiple instantiation): > - X-Buffer#clear(x[] buf); clears all pointers > - X-Buffer#reset(x[] buf); only resets pos to mark (maybe limit to array > size), allows to process different data in same/similar/synchronous manner. > > -Ulf > > > > > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From martinrb at google.com Thu Sep 10 15:01:11 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 10 Sep 2009 08:01:11 -0700 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> Message-ID: <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> Hi Andrew, I don't recall all the details, but I probably backported all-at-once because it was a little easier for me to do so - it reflected the engineering that was actually done. I care more about the quality of the openjdk7 mercurial history. In this case the information *is* available to allow a future maintainer to do archaeological investigations. I agree it would have been a little cleaner to backport each change individually. You also correctly notice that not all discussions end up on core-libs-dev. In part this is a cultural heritage - tradition is private, not public, peer review. I have been trying, and have been encouraging others, to make discussions more public, even when we might perceive them to be uninteresting to others. (What can be said about a backport, except whether it's worth doing, one might think.) Thanks for the culture change prodding. Martin On Thu, Sep 10, 2009 at 06:01, Andrew John Hughes wrote: > 2009/4/29 Martin Buchholz : >> Since writing this, I have learned, to my horror, that the >> behavior of the -C flag differs from the behavior in tar in that >> >> - -C is not sticky - it applies only to the one following argument >> >> - the path is relative to the JDK's current directory, not the >> previous -C directory. >> >> despite assurances from jar(1) >> >> ? ? ? ? ?-C ?dir >> ? ? ? ? ? ? Temporarily changes directories (cd dir) during execution of the >> ? ? ? ? ? ? jar command while processing the following inputfiles argument. >> ? ? ? ? ? ? Its operation is intended to be similar to the -C option of the >> ? ? ? ? ? ? UNIX tar utility. >> >> If you squint, you can see that it says "argument", not "arguments". >> >> Martin >> >> On Mon, Apr 27, 2009 at 17:54, Martin Buchholz wrote: >>> ?I believe the better fix would be >>> to eviscerate the code that handles the "-C" flag and do it right, >> >> >>> Someone who cares about the Makefiles can also try to remove the >>> 16000 gratuitous -C flags that makes jar's life "jar hell". >>> >>> Martin >>> >> > > Martin, > > Thanks a lot for this patch. ?We've seen good speedups with it applied. > > The thread here reads very strangely; did a number of mails go to a > different mail list or only to private mail addresses? > There's also seems to be no mention of this being applied to OpenJDK6: > http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/b35f1e5075a4 > That changeset seems to have been merged together with several others; > was there a reason the changesets were not imported individually so as > to retain the history? > > Thanks, > -- > Andrew :-) > > Free Java Software Engineer > Red Hat, Inc. (http://www.redhat.com) > > Support Free Java! > Contribute to GNU Classpath and the OpenJDK > http://www.gnu.org/software/classpath > http://openjdk.java.net > > PGP Key: 94EFD9D8 (http://subkeys.pgp.net) > Fingerprint: F8EF F1EA 401E 2E60 15FA ?7927 142C 2591 94EF D9D8 > From gnu_andrew at member.fsf.org Thu Sep 10 15:17:01 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Thu, 10 Sep 2009 16:17:01 +0100 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> Message-ID: <17c6771e0909100817h3ad22efbjb1c5f92e1dd7642e@mail.gmail.com> 2009/9/10 Martin Buchholz : > Hi Andrew, > > I don't recall all the details, but I probably backported all-at-once > because it was a little easier for me to do so - it reflected the > engineering that was actually done. ? I care more about > the quality of the openjdk7 mercurial history. ?In this case > the information *is* available to allow a future maintainer > to do archaeological investigations. ?I agree it would have > been a little cleaner to backport each change individually. > Yeah, the OpenJDK6 version history is already a complete mess, so I don't suppose it makes that much difference :) Neither are ideal because everything before b24 is missing from OpenJDK7 too. The problem was more that this was never mentioned in the thread, so we didn't pick up on this until Andrew Haley spotted it today. I remember reading the thread at the time, but because there was no apparent conclusion publicly, I missed out on it actually being committed and wasn't just another patch in a big pile of pending stuff... > You also correctly notice that not all discussions end up > on core-libs-dev. ?In part this is a cultural heritage - tradition > is private, not public, peer review. ?I have been trying, > and have been encouraging others, to make discussions > more public, even when we might perceive them to be > uninteresting to others. ?(What can be said about a backport, > except whether it's worth doing, one might think.) > > Thanks for the culture change prodding. > I'm aware of this endemic culture at Sun (see http://blog.fuseyism.com/index.php/2009/09/08/im-so-tired/), and I very much appreciate your efforts to do things publicly. Believe me, it hasn't gone unnoticed, and the prodding was aimed more at the authors of the missing messages in that thread... :) FWIW, I'm pretty sure I'm not alone in saying I'd much prefer to receive these 'uninteresting' mails. There are plenty of mailing lists and mail filters to allow us to cherry-pick what we want to read, but we can't recreate missing e-mails. > Martin > > On Thu, Sep 10, 2009 at 06:01, Andrew John > Hughes wrote: >> 2009/4/29 Martin Buchholz : >>> Since writing this, I have learned, to my horror, that the >>> behavior of the -C flag differs from the behavior in tar in that >>> >>> - -C is not sticky - it applies only to the one following argument >>> >>> - the path is relative to the JDK's current directory, not the >>> previous -C directory. >>> >>> despite assurances from jar(1) >>> >>> ? ? ? ? ?-C ?dir >>> ? ? ? ? ? ? Temporarily changes directories (cd dir) during execution of the >>> ? ? ? ? ? ? jar command while processing the following inputfiles argument. >>> ? ? ? ? ? ? Its operation is intended to be similar to the -C option of the >>> ? ? ? ? ? ? UNIX tar utility. >>> >>> If you squint, you can see that it says "argument", not "arguments". >>> >>> Martin >>> >>> On Mon, Apr 27, 2009 at 17:54, Martin Buchholz wrote: >>>> ?I believe the better fix would be >>>> to eviscerate the code that handles the "-C" flag and do it right, >>> >>> >>>> Someone who cares about the Makefiles can also try to remove the >>>> 16000 gratuitous -C flags that makes jar's life "jar hell". >>>> >>>> Martin >>>> >>> >> >> Martin, >> >> Thanks a lot for this patch. ?We've seen good speedups with it applied. >> >> The thread here reads very strangely; did a number of mails go to a >> different mail list or only to private mail addresses? >> There's also seems to be no mention of this being applied to OpenJDK6: >> http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/b35f1e5075a4 >> That changeset seems to have been merged together with several others; >> was there a reason the changesets were not imported individually so as >> to retain the history? >> >> Thanks, >> -- >> Andrew :-) >> >> Free Java Software Engineer >> Red Hat, Inc. (http://www.redhat.com) >> >> Support Free Java! >> Contribute to GNU Classpath and the OpenJDK >> http://www.gnu.org/software/classpath >> http://openjdk.java.net >> >> PGP Key: 94EFD9D8 (http://subkeys.pgp.net) >> Fingerprint: F8EF F1EA 401E 2E60 15FA ?7927 142C 2591 94EF D9D8 >> > -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From aph at redhat.com Thu Sep 10 15:25:53 2009 From: aph at redhat.com (Andrew Haley) Date: Thu, 10 Sep 2009 16:25:53 +0100 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <17c6771e0909100817h3ad22efbjb1c5f92e1dd7642e@mail.gmail.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> <17c6771e0909100817h3ad22efbjb1c5f92e1dd7642e@mail.gmail.com> Message-ID: <4AA91A81.4040908@redhat.com> Andrew John Hughes wrote: > FWIW, I'm pretty sure I'm not alone in saying I'd much prefer to > receive these 'uninteresting' mails. This particular back-port mail would have been very interesting to us, since it has a huge impact on build times on some architectures. Andrew. From Joe.Darcy at Sun.COM Thu Sep 10 15:58:42 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Thu, 10 Sep 2009 08:58:42 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA8B7B0.5070009@gmail.com> References: <4AA812D0.309@sun.com> <4AA8B7B0.5070009@gmail.com> Message-ID: <4AA92232.5000107@sun.com> Mike Morris wrote: > Joe Darcy wrote: > >> For JDK 7, I think it is high-time the platform included a class like >> java.util.Objects to hold commonly-written utility methods. For > ... >> What other utility methods would have broad enough use and >> applicability to go into a common java.util class? > > Ah! Let's just go back to coding in C, then. I cannot see any > justification for everything and the kitchen-sink being glommed into > the Java APIs. If people want these sort of static methods, they're > pretty-much all available in other libraries (Apache Commons, etc.) The methods being discussed are generaly short and while easy to write, all of them aren't so easy to write that they cannot have bugs. To me, the existence of these methods in multiple other libraries argues for putting robust version of them in the JDK since it is not worthwhile adding a library dependency just to get a static two argument equals method. -Joe From schulz at e-spirit.de Thu Sep 10 07:37:39 2009 From: schulz at e-spirit.de (Schulz, Stefan) Date: Thu, 10 Sep 2009 09:37:39 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? Message-ID: <7D2077BFF677D2429DDDEE095D9A48AC13259F4A@osiris2.e-spirit.de> > So I'm left with only equal() for your new Objects class. By the way, > the best implementation is a == b || (a != null && a.equals(b)). I disagree, as this one does not handle arrays properly. I'd either like equal to handle deep equality on arrays or have a deepEqual utility method that takes arbitrary objects. Cheers, Stefan From martinrb at google.com Thu Sep 10 16:34:15 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 10 Sep 2009 09:34:15 -0700 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <4AA91A81.4040908@redhat.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> <17c6771e0909100817h3ad22efbjb1c5f92e1dd7642e@mail.gmail.com> <4AA91A81.4040908@redhat.com> Message-ID: <1ccfd1c10909100934i6c6a6a28v2c461b9a4d3ad499@mail.gmail.com> On Thu, Sep 10, 2009 at 08:25, Andrew Haley wrote: > Andrew John Hughes wrote: > >> FWIW, I'm pretty sure I'm not alone in saying I'd much prefer to >> receive these 'uninteresting' mails. > > This particular back-port mail would have been very interesting to > us, since it has a huge impact on build times on some architectures. The mercurial history of openjdk6 is sadly incomplete, even when compared to openjdk7. But going forward, we have hg in place, and anyone who is managing a downstream release probably should be examining recent changesets anyways. Humans are flaky; hg is going to be a more reliable source of what's gone in. Martin From Joe.Darcy at Sun.COM Thu Sep 10 16:53:53 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Thu, 10 Sep 2009 09:53:53 -0700 Subject: PATCH: Tired of waiting for rt.jar to build? In-Reply-To: <1ccfd1c10909100934i6c6a6a28v2c461b9a4d3ad499@mail.gmail.com> References: <1ccfd1c10904271754s6f56feafub82c97c80109f023@mail.gmail.com> <1ccfd1c10904291325p5f3b40e8y36e214e54f82a1a9@mail.gmail.com> <17c6771e0909100601v1779eadaqec6bc7f4071a44fb@mail.gmail.com> <1ccfd1c10909100801m529824a6rb184fb8cb95cd33@mail.gmail.com> <17c6771e0909100817h3ad22efbjb1c5f92e1dd7642e@mail.gmail.com> <4AA91A81.4040908@redhat.com> <1ccfd1c10909100934i6c6a6a28v2c461b9a4d3ad499@mail.gmail.com> Message-ID: <4AA92F21.3060305@sun.com> Martin Buchholz wrote: > On Thu, Sep 10, 2009 at 08:25, Andrew Haley wrote: > >> Andrew John Hughes wrote: >> >> >>> FWIW, I'm pretty sure I'm not alone in saying I'd much prefer to >>> receive these 'uninteresting' mails. >>> >> This particular back-port mail would have been very interesting to >> us, since it has a huge impact on build times on some architectures. >> > > The mercurial history of openjdk6 is sadly incomplete, > even when compared to openjdk7. > Due to efforts by Kelly, OpenJDK 6 has Mercurial history since it branched off from OpenJDK 7. Given the original use of teamware, there is not fully accurate changeset-level reconstruction from the beginning, but there is at least build-level information for all OpenJDK 6 builds. -Joe From Xueming.Shen at Sun.COM Thu Sep 10 18:47:54 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 10 Sep 2009 11:47:54 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA816AD.7090306@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> Message-ID: <4AA949DA.9010707@sun.com> I think we have enough discussion on this topic, it's time to make a final decision. Seems like we are all happy on the changes in Deflater and new DOS.flush(mode), the only difference is whether or not we should change the existing behavior of DOS.flush() should use Z_SYNC_FLUSH by default. Brandon is very firm on the "yes" side, strongly believe this is a MUST. Martin is on the fence, leaning towards "yes" Sherman is on the "no" side So if there is no other vote coming with strong opinion, your vote will be important:-) Are you also leaning to "yes" or "strongly" suggesting a yes? I need strong "yes" to change my mind. The current proposal has the advantage of still keeping the door open to change the behavior if the new APIs really can not make the developer to achieve what they want to do or someone can present a strong case that the compatibility is really not a concern (we are all assuming there are some applications over there might be broken by this). The latest webrev is at http://cr.openjdk.java.net/~sherman/zipflush/webrev I added a note to describe the behavior of DOS.flush(), as Brandon suggested as his "at the very least". Sherman Alan Bateman wrote: > The Deflater proposal feels right and fits well with the existing API. > The DeflaterOutputStream.flush(int) proposal is workable but it will > clearly be a hard sell to get developers to extend > DeflaterOutputStream and override the no-arg flush method (which they > will need to do to get this to work with existing code/libraries). How > you considered overriding the flush() method to use Z_SYNC_FLUSH but > have some way to restore existing behavior in the event that it causes > severe performance or other issues for someone migrating an existing > application to jdk7? I hate suggesting yet another system property to > get us out of jail. Aside from an application calling flush a lot, are > there any other behavioral implications (say for GZIPOutputStream?). > > -Alan. > > > > From blong at google.com Thu Sep 10 19:52:09 2009 From: blong at google.com (Brandon Long) Date: Thu, 10 Sep 2009 12:52:09 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA949DA.9010707@sun.com> References: <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> Message-ID: <20090910195209.GA9731@google.com> The only use case that can't be worked around is if someone is relying on code which either sub-classes DeflaterOutputStream or uses a non-injected DeflaterOutputStream, where they can't replace it with a fixed version. Both of these use cases probably aren't that common, since if they ever needed a working flush, they would have had to work around this bug a while back. Brandon On 09/10/09 Xueming Shen uttered the following other thing: > I think we have enough discussion on this topic, it's time to make a > final decision. Seems like we are all happy on the > changes in Deflater and new DOS.flush(mode), the only difference is > whether or not we should change the existing > behavior of DOS.flush() should use Z_SYNC_FLUSH by default. > > Brandon is very firm on the "yes" side, strongly believe this is a MUST. > Martin is on the fence, leaning towards "yes" > Sherman is on the "no" side > > So if there is no other vote coming with strong opinion, your vote will > be important:-) Are you also leaning to "yes" > or "strongly" suggesting a yes? I need strong "yes" to change my mind. > > The current proposal has the advantage of still keeping the door open to > change the behavior if the new APIs > really can not make the developer to achieve what they want to do or > someone can present a strong case that > the compatibility is really not a concern (we are all assuming there are > some applications over there might be broken by this). > > The latest webrev is at > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > I added a note to describe the behavior of DOS.flush(), as Brandon > suggested as his "at the very least". > > Sherman > > Alan Bateman wrote: >> The Deflater proposal feels right and fits well with the existing API. >> The DeflaterOutputStream.flush(int) proposal is workable but it will >> clearly be a hard sell to get developers to extend >> DeflaterOutputStream and override the no-arg flush method (which they >> will need to do to get this to work with existing code/libraries). How >> you considered overriding the flush() method to use Z_SYNC_FLUSH but >> have some way to restore existing behavior in the event that it causes >> severe performance or other issues for someone migrating an existing >> application to jdk7? I hate suggesting yet another system property to >> get us out of jail. Aside from an application calling flush a lot, are >> there any other behavioral implications (say for GZIPOutputStream?). >> >> -Alan. >> >> >> >> -- "I'd like to take this opportunity to thank all my code reviewers. Without you ignoring my requests, I couldn't have made the list." -- Wei-Hwa Huang From david.lloyd at redhat.com Thu Sep 10 20:58:18 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Thu, 10 Sep 2009 15:58:18 -0500 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA949DA.9010707@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> Message-ID: <4AA9686A.4070608@redhat.com> On 09/10/2009 01:47 PM, Xueming Shen wrote: > I think we have enough discussion on this topic, it's time to make a > final decision. Seems like we are all happy on the > changes in Deflater and new DOS.flush(mode), the only difference is > whether or not we should change the existing > behavior of DOS.flush() should use Z_SYNC_FLUSH by default. The question is, is there really such code out there? It can't really have any useful semantics that I can see. My irrelevant vote is firmly on "yes" for this. - DML From Xueming.Shen at Sun.COM Thu Sep 10 21:51:55 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Thu, 10 Sep 2009 14:51:55 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA9686A.4070608@redhat.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AA9686A.4070608@redhat.com> Message-ID: <4AA974FB.5050201@sun.com> David M. Lloyd wrote: > On 09/10/2009 01:47 PM, Xueming Shen wrote: >> I think we have enough discussion on this topic, it's time to make a >> final decision. Seems like we are all happy on the >> changes in Deflater and new DOS.flush(mode), the only difference is >> whether or not we should change the existing >> behavior of DOS.flush() should use Z_SYNC_FLUSH by default. > > The question is, is there really such code out there? It can't really > have any useful semantics that I can see. My irrelevant vote is > firmly on "yes" for this. > > - DML -The question is, is there really such code out there? I honestly don't know, this is why it is called "compatibility risk", similar to the investment risk in the stock market, you lose or gain only after you put the real money in:-) Though my feeling is it is very "likely" this change is going to break someone's code given DOS is designed/implemented to be easily used as a "normal" OutputStream. -It can't really have any useful semantics that I can see DOS abstracts two functionalities, a deflater and an output stream, both the deflater and output stream have their own "flush" semantics. A flush on the deflater changes the final output, degrades the compression, basically it changes the "function" of the deflater. A flush on the OutputStream however is supposed to push out the "buffered" output (accumulated for whatever reason, mostly for the i/o performance), it does not change the final result/output. So arguably it should not be a too bad idea to also provide two types of "flush" to flush the deflater and/or to flush the output stream, the existing DOS.flush() "accidentally" provides the semantics of the outputstream's flush(), with the help of the newly added flush(mode), now the developer have the choice of doing whatever "flush" they want to do. Agree it's arguable that if the stream type of flush is really needed for DOS in real world, we can debate what should be the default behavior (the most useful scenario) of the DOS.flush() , if we are designing/implementing a new DOS class. The question we need to answer now is should we change the existing default behavior of DOS.flush(), all existing/running/working application that uses DOS today is based on (happy with) the assumption/expectation that it does a "outputstream flush", it does not change the final compression output. So while we fix the problem of "can't not flush the deflater of the DOS", do we have to or say is it worthing to break the expectation of all existing users. Some time even a "byte" difference of the output result is a BIG deal. Every vote counts:-) sherman From david.lloyd at redhat.com Thu Sep 10 22:13:19 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Thu, 10 Sep 2009 17:13:19 -0500 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA974FB.5050201@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AA9686A.4070608@redhat.com> <4AA974FB.5050201@sun.com> Message-ID: <4AA979FF.5060708@redhat.com> On 09/10/2009 04:51 PM, Xueming Shen wrote: > David M. Lloyd wrote: >> On 09/10/2009 01:47 PM, Xueming Shen wrote: >>> I think we have enough discussion on this topic, it's time to make a >>> final decision. Seems like we are all happy on the >>> changes in Deflater and new DOS.flush(mode), the only difference is >>> whether or not we should change the existing >>> behavior of DOS.flush() should use Z_SYNC_FLUSH by default. >> >> The question is, is there really such code out there? It can't really >> have any useful semantics that I can see. My irrelevant vote is >> firmly on "yes" for this. >> >> - DML > -The question is, is there really such code out there? > > I honestly don't know, this is why it is called "compatibility risk", > similar to the investment risk in the stock market, you > lose or gain only after you put the real money in:-) Though my feeling > is it is very "likely" this change is going to break > someone's code given DOS is designed/implemented to be easily used as a > "normal" OutputStream. > > -It can't really have any useful semantics that I can see > > DOS abstracts two functionalities, a deflater and an output stream, both > the deflater and output stream have their own > "flush" semantics. A flush on the deflater changes the final output, > degrades the compression, basically it changes the > "function" of the deflater. A flush on the OutputStream however is > supposed to push out the "buffered" output (accumulated > for whatever reason, mostly for the i/o performance), it does not change > the final result/output. So arguably it should not be > a too bad idea to also provide two types of "flush" to flush the > deflater and/or to flush the output stream, the existing > DOS.flush() "accidentally" provides the semantics of the outputstream's > flush(), with the help of the newly added flush(mode), > now the developer have the choice of doing whatever "flush" they want to > do. This is not unusual in the JDK or elsewhere - that a stream calls the underlying stream's flush() method I mean - and I think in the (unlikely) event that someone wants to flush the underlying stream only, they could simply call .flush() directly on that stream. And furthermore, if they want to *prevent* the flush() method from calling the underlying flush(), they can simply interpose a FlushIgnoringOutputStream which changes flush() to a no-op and passes other calls through. So I'd say "no" to having a separate flush method that does *that*. That all said, I guess I should qualify my "yes" with the statement that if the final decision were ultimately "no", it would be really, really trivial for someone to subclass or wrap DOS with a version which does the full sync flush instead of the pass-thru that your current webrev has. And come to think of it, if you're going to provide your own deflater (which often happens) you need to subclass DOS anyway to avoid leaking Deflaters on stream close (since the "usesDefaultDeflater"-based auto-cleanup mechanism is defeated in this case). So maybe it wouldn't be so bad to leave it as is... - DML From forax at univ-mlv.fr Thu Sep 10 22:32:51 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Fri, 11 Sep 2009 00:32:51 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909091911l67ffaf66xf0bb3733f4071224@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84E35.4060207@univ-mlv.fr> <1ccfd1c10909091911l67ffaf66xf0bb3733f4071224@mail.gmail.com> Message-ID: <4AA97E93.5000506@univ-mlv.fr> Le 10/09/2009 04:11, Martin Buchholz a ?crit : > On Wed, Sep 9, 2009 at 17:54, R?mi Forax wrote: > >> Le 10/09/2009 02:15, Martin Buchholz a ?crit : >> >>> Here's a bunch of static hashCode methods for primitives: >>> >>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ >>> >>> This doesn't include a >>> >>> public static int hashCode(object x) { return x == null ? 0 : >>> x.hashCode(); } >>> >>> that I think was also being asked for, and which might be a candidate >>> for Objects. >>> >>> Martin >>> >>> >> Martin, >> You forget java.lang.Boolean in your patch set :) >> > R?mi, merci beaucoup. > Les Booleans, je les avaient oubli?e. > > Mes patchs pour les classes wrapper, > tous les deux, maintenant incluent Boolean. > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode/ > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ > > Martin > Wow, you're able to write in French. From now onwards, I will write my email to you in French :) R?mi > >> R?mi >> >> From Joe.Darcy at Sun.COM Thu Sep 10 22:48:29 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Thu, 10 Sep 2009 15:48:29 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA86C11.7080409@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> Message-ID: <4AA9823D.60507@sun.com> On 09/09/09 08:01 PM, Joe Darcy wrote: > Martin Buchholz wrote: >> On Wed, Sep 9, 2009 at 17:40, Joe Darcy wrote: >> >>> PS This talk of hashing remind me of a small spec cleanup: >>> 4245470 algorithm of java.lang.Byte.hashCode() is not specified >>> http://bugs.sun.com/view_bug.do?bug_id=4245470 >>> >>> >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode-spec/ >> >> Martin >> > > I'll work on the archeology to verify this behavior has been > consistent over time and thus is reasonable to tighten the spec in > these cases. > > -Joe Martin, I noticed that the Character class should be similarly tightened: /** * Returns a hash code for this {@code Character}; equal to the result * of invoking {@code intValue()}. * * @return a hash code value for this {@code Character} */ public int hashCode() I've done some checking and all of the following Sun JDKs implement the "intValue" hashCode for Byte, Character, and Short: 1.1 1.2 1.3.0 1.3.1 1,4.0 1.4.1 1.4.2 1.5 1.6 so I think a change to all three wrapper classes is safe to go back from a behavioral compatibility perspective :-) -Joe From martinrb at google.com Thu Sep 10 23:40:25 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 10 Sep 2009 16:40:25 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA9823D.60507@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> Message-ID: <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> On Thu, Sep 10, 2009 at 15:48, Joe Darcy wrote: > On 09/09/09 08:01 PM, Joe Darcy wrote: > I noticed that the Character class should be similarly tightened: Right you are. Webrev regenerated. Martin From Joe.Darcy at Sun.COM Thu Sep 10 23:48:00 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Thu, 10 Sep 2009 16:48:00 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> Message-ID: <4AA99030.8040904@sun.com> Martin Buchholz wrote: > On Thu, Sep 10, 2009 at 15:48, Joe Darcy wrote: > >> On 09/09/09 08:01 PM, Joe Darcy wrote: >> I noticed that the Character class should be similarly tightened: >> > > Right you are. Webrev regenerated. > > Martin > One typo inherited from my earlier suggestion (mea culpa!): as the Character class is not a java.lang.Number, it does not have an intValue method. Character does have a charValue method and referring to that method in the specification of hashCode should suffice. I approve this change going back with the correction to the Character class. Thanks, -Joe From martinrb at google.com Thu Sep 10 23:56:29 2009 From: martinrb at google.com (Martin Buchholz) Date: Thu, 10 Sep 2009 16:56:29 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA99030.8040904@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> Message-ID: <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> On Thu, Sep 10, 2009 at 16:48, Joe Darcy wrote: > Martin Buchholz wrote: >> >> On Thu, Sep 10, 2009 at 15:48, Joe Darcy wrote: >> >>> >>> On 09/09/09 08:01 PM, Joe Darcy wrote: >>> I noticed that the Character class should be similarly tightened: >>> >> >> Right you are. ?Webrev regenerated. >> >> Martin >> > > One typo inherited from my earlier suggestion (mea culpa!): as the Character > class is not a java.lang.Number, it does not have an intValue method. > ?Character does have a charValue method and referring to that method in the > specification of hashCode should suffice. > > I approve this change going back with the correction to the Character class. Oops! so many little mistakes. Webrev regenerated. Martin From scolebourne at joda.org Fri Sep 11 00:01:47 2009 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 11 Sep 2009 01:01:47 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA812D0.309@sun.com> References: <4AA812D0.309@sun.com> Message-ID: <4AA9936B.5000006@joda.org> Joe Darcy wrote: > What other utility methods would have broad enough use and applicability > to go into a common java.util class? Joe, You've asked for a call for ideas, but not given any indication of process. Are you going to evaluate everything that comes in and pick the best a la Coin? Or allow anyone to send in patches? Who decides what is in and what is out? Since its obviously not going to be decided by a Java SE 7 JSR, it would be useful to know the answers, before we all waste lots of time on discussions about methods that might or might not be used. Stephen From Joe.Darcy at Sun.COM Fri Sep 11 00:03:47 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Thu, 10 Sep 2009 17:03:47 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> Message-ID: <4AA993E3.20506@sun.com> Martin Buchholz wrote: > On Thu, Sep 10, 2009 at 16:48, Joe Darcy wrote: >> Martin Buchholz wrote: >>> On Thu, Sep 10, 2009 at 15:48, Joe Darcy wrote: >>> >>>> On 09/09/09 08:01 PM, Joe Darcy wrote: >>>> I noticed that the Character class should be similarly tightened: >>>> >>> Right you are. Webrev regenerated. >>> >>> Martin >>> >> One typo inherited from my earlier suggestion (mea culpa!): as the Character >> class is not a java.lang.Number, it does not have an intValue method. >> Character does have a charValue method and referring to that method in the >> specification of hashCode should suffice. >> >> I approve this change going back with the correction to the Character class. > > Oops! so many little mistakes. Webrev regenerated. Looks good. -Joe From Ulf.Zibis at gmx.de Fri Sep 11 07:00:40 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 11 Sep 2009 09:00:40 +0200 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> Message-ID: <4AA9F598.9050703@gmx.de> Am 11.09.2009 01:56, Martin Buchholz schrieb: > On Thu, Sep 10, 2009 at 16:48, Joe Darcy wrote: > >> I approve this change going back with the correction to the Character >> class. >> > > Oops! so many little mistakes. Webrev regenerated. > Is that webrev public anywhere ? (Hopefully you consider my "cosmetics" and some of my changes from [1] some day) -Ulf [1] https://bugs.openjdk.java.net/show_bug.cgi?id=100104 From David.Holmes at Sun.COM Fri Sep 11 08:57:12 2009 From: David.Holmes at Sun.COM (David Holmes - Sun Microsystems) Date: Fri, 11 Sep 2009 18:57:12 +1000 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA9F598.9050703@gmx.de> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> <4AA9F598.9050703@gmx.de> Message-ID: <4AAA10E8.3010103@sun.com> Ulf Zibis said the following on 09/11/09 17:00: > Am 11.09.2009 01:56, Martin Buchholz schrieb: >> On Thu, Sep 10, 2009 at 16:48, Joe Darcy wrote: >> >>> I approve this change going back with the correction to the Character >>> class. >>> >> Oops! so many little mistakes. Webrev regenerated. >> > > Is that webrev public anywhere ? All Martin's webrevs are public: http://cr.openjdk.java.net/~martin/webrevs/openjdk7/ This one was: http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode -David > (Hopefully you consider my "cosmetics" and some of my changes from [1] > some day) > > -Ulf > > [1] https://bugs.openjdk.java.net/show_bug.cgi?id=100104 > > From Alan.Bateman at Sun.COM Fri Sep 11 09:42:13 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Fri, 11 Sep 2009 10:42:13 +0100 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AA949DA.9010707@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> Message-ID: <4AAA1B75.6060309@sun.com> Xueming Shen wrote: > I think we have enough discussion on this topic, it's time to make a > final decision. Seems like we are all happy on the > changes in Deflater and new DOS.flush(mode), the only difference is > whether or not we should change the existing > behavior of DOS.flush() should use Z_SYNC_FLUSH by default. > > Brandon is very firm on the "yes" side, strongly believe this is a MUST. > Martin is on the fence, leaning towards "yes" > Sherman is on the "no" side > > So if there is no other vote coming with strong opinion, your vote > will be important:-) Are you also leaning to "yes" > or "strongly" suggesting a yes? I need strong "yes" to change my mind. This is tough call. It is clearly desirable to change flush() to work the way that developers expect. On the other hand there is always risk with changing long-standing behavior. The risk here is probably low but it's impossible to quantify. Martin makes a good observation that it may cause problems for code that wraps the stream with an auto-flushing PrintStream or PrintWriter. You also made a good observation that just changing the number of bytes written could cause breakage (in some fragile environment) - we just don't know! So on balance, I think you are probably right to take the conservative line on this one. I know you've had enough discussion on this but I wonder if you might be open to considering new constructors for DeflaterOutputStream (and maybe GZIPOutputStream) as an alternative to the flush(int) method. This might fit better with this API, in particular for cases where the intended usage is known. It could be as simple as a "boolean syncFlush" parameter to indicate how uncompressed buffered bytes are handled when flushing (default to false for existing constructors so existing behavior preserved). The boolean parameter is just an opening bid - clearly there are alternatives. The point is that it makes it easy and more obvious as how to get a DeflaterOutputStream suitable for interactive cases. -Alan. From Vladimir.Yaroslavskiy at Sun.COM Fri Sep 11 10:35:22 2009 From: Vladimir.Yaroslavskiy at Sun.COM (Vladimir Yaroslavskiy) Date: Fri, 11 Sep 2009 14:35:22 +0400 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort Message-ID: <4AAA27EA.8090902@Sun.COM> Hello All, I'd like to share with you new Dual-Pivot Quicksort which is faster than the known implementations (theoretically and experimental). I'd like to propose to replace the JDK's Quicksort implementation by new one. Description ----------- The classical Quicksort algorithm uses the following scheme: 1. Pick an element P, called a pivot, from the array. 2. Reorder the array so that all elements, which are less than the pivot, come before the pivot and all elements greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot element is in its final position. 3. Recursively sort the sub-array of lesser elements and the sub-array of greater elements. The invariant of classical Quicksort is: [ <= p | >= p ] There are several modifications of the schema: [ < p | = p | > p ] or [ = p | < p | > p | = p ] But all of them use *one* pivot. The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: 1. Pick an elements P1, P2, called pivots from the array. 2. Assume that P1 <= P2, otherwise swap it. 3. Reorder the array into three parts: those less than the smaller pivot, those larger than the larger pivot, and in between are those elements between (or equal to) the two pivots. 4. Recursively sort the sub-arrays. The invariant of the Dual-Pivot Quicksort is: [ < P1 | P1 <= & <= P2 } > P2 ] The new Quicksort is faster than current implementation of Quicksort in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. The full description of the Dual-Pivot Quicksort you can find on my page: http://iaroslavski.narod.ru/quicksort Performance tests ----------------- Here is result of running on different types of input data: Client VM all 85% organ 0..1 0..4 random ascend descend equal equal pipes random 010101 random Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 Server VM all 85% organ 0..1 0..4 random ascend descend equal equal pipes random 010101 random Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 The a lot of other tests have been run under client and server mode. The most interesting is BentleyBasher test framework. It runs battery of tests for all cases: { 100, 1000, 10000, 1000000 } x { sawtooth, rand, stagger, plateau, shuffle } x { ident, reverse, reverse_front, reverse_back, sort, dither} where 100, ... , 1000000 - array length sawtooth: x[i] =i%m rand: x[i] = rand() % m stagger: x[i] = (i*m + i) % n plateau: x[i] = min(i, m) shuffle: x[i] = rand()%m? (j+=2): (k+=2) ident(x) - a copy of x reverse(x, 0, n) - reversed copy reverse_front(x, 0, n/2) - front half reversed reverse_back(x, n/2, n) - back half reversed sort(x) - an ordered copy dither(x) - add i%5 to x[i] Here is the result of execution: Server VM: http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html Client VM: http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html Mathematical investigations --------------------------- It is proved that for the Dual-Pivot Quicksort the average number of comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) respectively. Full mathematical proof see in attached proof.txt and proof_add.txt files. Theoretical results are also confirmed by experimental counting of the operations. Diff between current and new implementation of Quicksort -------------------------------------------------------- Here is the link to the diff for java.util.Arrays class: http://cr.openjdk.java.net/~alanb/6880672/webrev.00 If you like to look and play with new algorithm, please, take attached class DualPivotQuicksort.java Feedback -------- Also I'd like to share a feedback from Joshua Bloch and Jon Bentley who spent a lot of time investigating this algorithm, who gave me many advices and tips how to make new Quicksort better. -------- Original Message -------- Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 Date: Thu, 10 Sep 2009 07:20:11 -0700 From: Joshua Bloch Jon also says that Vladimir should make every reasonable improvement to the basic method before checking in the code. In his words, "It would be horrible to put the new code into the library, and then have someone else come along and speed it up by another 20% by using standard techniques." I believe it's not unlikely that this code may end up getting ported to many languages and widely deployed in much the manner of Bentley and McIlroy's fine sort (which is nearing 20 successful years in the field). Jon will help Vladimir do this. -------- Original Message -------- Subject: Dual-Pivot Quicksort: Next Steps Date: Wed, 09 Sep 2009 15:02:25 -0400 From: Jon Bentley Vladimir, Josh, I *finally* feel like I understand what is going on. Now that I (think that) I see it, it seems straightforward and obvious. Tony Hoare developed Quicksort in the early 1960s. I was very proud to make minor contributions to a particularly clean (binary) quicksort in the mid 1980s, to a relatively straightforward, industrial strength Quicksort with McIlroy in the early 1990s, and then to algorithms and data structures for strings with Sedgewick in the mid 1990s. I think that Vladimir's contributions to Quicksort go way beyond anything that I've ever done, and rank up there with Hoare's original design and Sedgewick's analysis. I feel so privileged to play a very, very minor role in helping Vladimir with the most excellent work! ----------------------------------------------- Let me know, if you have any questions/comments. Thank you, Vladimir -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: proof_add.txt URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: DualPivotQuicksort.java URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: proof.txt URL: From forax at univ-mlv.fr Fri Sep 11 13:32:08 2009 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Fri, 11 Sep 2009 15:32:08 +0200 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA27EA.8090902@Sun.COM> References: <4AAA27EA.8090902@Sun.COM> Message-ID: <4AAA5158.8060202@univ-mlv.fr> just my two cents : In the loop tagged "sorting" and "equals element", a[k] can be stored in a local variable to avoid to recompute it several time. The algorithm use two constants: 37 and 13, I think they should be declared as private static final. R?mi Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : > Hello All, > > I'd like to share with you new Dual-Pivot Quicksort which is > faster than the known implementations (theoretically and > experimental). I'd like to propose to replace the JDK's > Quicksort implementation by new one. > > Description > ----------- > The classical Quicksort algorithm uses the following scheme: > > 1. Pick an element P, called a pivot, from the array. > 2. Reorder the array so that all elements, which are less than > the pivot, come before the pivot and all elements greater than > the pivot come after it (equal values can go either way). After > this partitioning, the pivot element is in its final position. > 3. Recursively sort the sub-array of lesser elements and the > sub-array of greater elements. > > The invariant of classical Quicksort is: > > [ <= p | >= p ] > > There are several modifications of the schema: > > [ < p | = p | > p ] or [ = p | < p | > p | = p ] > > But all of them use *one* pivot. > > The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: > > 1. Pick an elements P1, P2, called pivots from the array. > 2. Assume that P1 <= P2, otherwise swap it. > 3. Reorder the array into three parts: those less than the smaller > pivot, those larger than the larger pivot, and in between are > those elements between (or equal to) the two pivots. > 4. Recursively sort the sub-arrays. > > The invariant of the Dual-Pivot Quicksort is: > > [ < P1 | P1 <= & <= P2 } > P2 ] > > The new Quicksort is faster than current implementation of Quicksort > in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. > > The full description of the Dual-Pivot Quicksort you can find > on my page: http://iaroslavski.narod.ru/quicksort > > Performance tests > ----------------- > Here is result of running on different types of input data: > > Client VM all 85% organ 0..1 0..4 > random ascend descend equal equal pipes random 010101 > random > Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 > Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 > > Server VM all 85% organ 0..1 0..4 > random ascend descend equal equal pipes random 010101 > random > Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 > Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 > > The a lot of other tests have been run under client and server mode. > The most interesting is BentleyBasher test framework. It runs battery > of tests for all cases: > > { 100, 1000, 10000, 1000000 } x > { sawtooth, rand, stagger, plateau, shuffle } x > { ident, reverse, reverse_front, reverse_back, sort, dither} > > where > > 100, ... , 1000000 - array length > > sawtooth: x[i] =i%m > rand: x[i] = rand() % m > stagger: x[i] = (i*m + i) % n > plateau: x[i] = min(i, m) > shuffle: x[i] = rand()%m? (j+=2): (k+=2) > > ident(x) - a copy of x > reverse(x, 0, n) - reversed copy > reverse_front(x, 0, n/2) - front half reversed > reverse_back(x, n/2, n) - back half reversed > sort(x) - an ordered copy > dither(x) - add i%5 to x[i] > > Here is the result of execution: > Server VM: > http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html > > Client VM: > http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html > > > Mathematical investigations > --------------------------- > It is proved that for the Dual-Pivot Quicksort the average number of > comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), > whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) > respectively. Full mathematical proof see in attached proof.txt > and proof_add.txt files. Theoretical results are also confirmed > by experimental counting of the operations. > > Diff between current and new implementation of Quicksort > -------------------------------------------------------- > > Here is the link to the diff for java.util.Arrays class: > http://cr.openjdk.java.net/~alanb/6880672/webrev.00 > > If you like to look and play with new algorithm, > please, take attached class DualPivotQuicksort.java > > Feedback > -------- > > Also I'd like to share a feedback from Joshua Bloch and > Jon Bentley who spent a lot of time investigating this > algorithm, who gave me many advices and tips how to > make new Quicksort better. > > -------- Original Message -------- > Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 > Date: Thu, 10 Sep 2009 07:20:11 -0700 > From: Joshua Bloch > > Jon also says that Vladimir should make every reasonable improvement to > the basic method before checking in the code. In his words, "It would be > horrible to put the new code into the library, and then have someone > else come along and speed it up by another 20% by using standard > techniques." I believe it's not unlikely that this code may end up > getting ported to many languages and widely deployed in much the manner > of Bentley and McIlroy's fine sort (which is nearing 20 successful years > in the field). Jon will help Vladimir do this. > > -------- Original Message -------- > Subject: Dual-Pivot Quicksort: Next Steps > Date: Wed, 09 Sep 2009 15:02:25 -0400 > From: Jon Bentley > > Vladimir, Josh, > I *finally* feel like I understand what is going on. Now that I > (think that) I see it, it seems straightforward and obvious. > Tony Hoare developed Quicksort in the early 1960s. I was very > proud to make minor contributions to a particularly clean (binary) > quicksort in the mid 1980s, to a relatively straightforward, industrial > strength Quicksort with McIlroy in the early 1990s, and then to > algorithms and data structures for strings with Sedgewick in the mid > 1990s. > I think that Vladimir's contributions to Quicksort go way beyond > anything that I've ever done, and rank up there with Hoare's original > design and Sedgewick's analysis. I feel so privileged to play a very, > very minor role in helping Vladimir with the most excellent work! > > ----------------------------------------------- > > Let me know, if you have any questions/comments. > > Thank you, > Vladimir From Ulf.Zibis at gmx.de Fri Sep 11 13:41:04 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 11 Sep 2009 15:41:04 +0200 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA27EA.8090902@Sun.COM> References: <4AAA27EA.8090902@Sun.COM> Message-ID: <4AAA5370.3010704@gmx.de> Very interesting stuff. Does one have tried (theoretically and/or experimental) P1+P2+P3, P1+P2+P3+P2, ... segmentation ? Maybe coefficient A has a minimum below 0.8. -Ulf Am 11.09.2009 12:35, Vladimir Yaroslavskiy schrieb: > Hello All, > > I'd like to share with you new Dual-Pivot Quicksort which is > faster than the known implementations (theoretically and > experimental). I'd like to propose to replace the JDK's > Quicksort implementation by new one. > > Description > ----------- > The classical Quicksort algorithm uses the following scheme: > > 1. Pick an element P, called a pivot, from the array. > 2. Reorder the array so that all elements, which are less than > the pivot, come before the pivot and all elements greater than > the pivot come after it (equal values can go either way). After > this partitioning, the pivot element is in its final position. > 3. Recursively sort the sub-array of lesser elements and the > sub-array of greater elements. > > The invariant of classical Quicksort is: > > [ <= p | >= p ] > > There are several modifications of the schema: > > [ < p | = p | > p ] or [ = p | < p | > p | = p ] > > But all of them use *one* pivot. > > The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: > > 1. Pick an elements P1, P2, called pivots from the array. > 2. Assume that P1 <= P2, otherwise swap it. > 3. Reorder the array into three parts: those less than the smaller > pivot, those larger than the larger pivot, and in between are > those elements between (or equal to) the two pivots. > 4. Recursively sort the sub-arrays. > > The invariant of the Dual-Pivot Quicksort is: > > [ < P1 | P1 <= & <= P2 } > P2 ] > > The new Quicksort is faster than current implementation of Quicksort > in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. > > The full description of the Dual-Pivot Quicksort you can find > on my page: http://iaroslavski.narod.ru/quicksort > > Performance tests > ----------------- > Here is result of running on different types of input data: > > Client VM all 85% organ 0..1 0..4 > random ascend descend equal equal pipes random 010101 > random > Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 > Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 > > Server VM all 85% organ 0..1 0..4 > random ascend descend equal equal pipes random 010101 > random > Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 > Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 > > The a lot of other tests have been run under client and server mode. > The most interesting is BentleyBasher test framework. It runs battery > of tests for all cases: > > { 100, 1000, 10000, 1000000 } x > { sawtooth, rand, stagger, plateau, shuffle } x > { ident, reverse, reverse_front, reverse_back, sort, dither} > > where > > 100, ... , 1000000 - array length > > sawtooth: x[i] =i%m > rand: x[i] = rand() % m > stagger: x[i] = (i*m + i) % n > plateau: x[i] = min(i, m) > shuffle: x[i] = rand()%m? (j+=2): (k+=2) > > ident(x) - a copy of x > reverse(x, 0, n) - reversed copy > reverse_front(x, 0, n/2) - front half reversed > reverse_back(x, n/2, n) - back half reversed > sort(x) - an ordered copy > dither(x) - add i%5 to x[i] > > Here is the result of execution: > Server VM: > http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html > > Client VM: > http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html > > > Mathematical investigations > --------------------------- > It is proved that for the Dual-Pivot Quicksort the average number of > comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), > whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) > respectively. Full mathematical proof see in attached proof.txt > and proof_add.txt files. Theoretical results are also confirmed > by experimental counting of the operations. > > Diff between current and new implementation of Quicksort > -------------------------------------------------------- > > Here is the link to the diff for java.util.Arrays class: > http://cr.openjdk.java.net/~alanb/6880672/webrev.00 > > If you like to look and play with new algorithm, > please, take attached class DualPivotQuicksort.java > > Feedback > -------- > > Also I'd like to share a feedback from Joshua Bloch and > Jon Bentley who spent a lot of time investigating this > algorithm, who gave me many advices and tips how to > make new Quicksort better. > > -------- Original Message -------- > Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 > Date: Thu, 10 Sep 2009 07:20:11 -0700 > From: Joshua Bloch > > Jon also says that Vladimir should make every reasonable improvement to > the basic method before checking in the code. In his words, "It would be > horrible to put the new code into the library, and then have someone > else come along and speed it up by another 20% by using standard > techniques." I believe it's not unlikely that this code may end up > getting ported to many languages and widely deployed in much the manner > of Bentley and McIlroy's fine sort (which is nearing 20 successful years > in the field). Jon will help Vladimir do this. > > -------- Original Message -------- > Subject: Dual-Pivot Quicksort: Next Steps > Date: Wed, 09 Sep 2009 15:02:25 -0400 > From: Jon Bentley > > Vladimir, Josh, > I *finally* feel like I understand what is going on. Now that I > (think that) I see it, it seems straightforward and obvious. > Tony Hoare developed Quicksort in the early 1960s. I was very > proud to make minor contributions to a particularly clean (binary) > quicksort in the mid 1980s, to a relatively straightforward, industrial > strength Quicksort with McIlroy in the early 1990s, and then to > algorithms and data structures for strings with Sedgewick in the mid > 1990s. > I think that Vladimir's contributions to Quicksort go way beyond > anything that I've ever done, and rank up there with Hoare's original > design and Sedgewick's analysis. I feel so privileged to play a very, > very minor role in helping Vladimir with the most excellent work! > > ----------------------------------------------- > > Let me know, if you have any questions/comments. > > Thank you, > Vladimir From iaroslavski at mail.ru Fri Sep 11 13:42:12 2009 From: iaroslavski at mail.ru (Vladimir Iaroslavski) Date: Fri, 11 Sep 2009 17:42:12 +0400 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA5370.3010704@gmx.de> References: <4AAA27EA.8090902@Sun.COM> <4AAA5370.3010704@gmx.de> Message-ID: <4AAA53B4.20702@mail.ru> Hi Ulf, Sure, I have tried it, see: -------- Original Message -------- Subject: Re: Dual-Pivot Quicksort Analysis Date: Wed, 09 Sep 2009 18:45:46 +0400 From: Vladimir Yaroslavskiy Organization: Sun Microsystems, Inc. To: Jon Bentley CC: Joshua Bloch Hello, I've converted the pseudocode into Java and here is the result: I counted the comps and swaps for array with length n = 2'000'000, did it 77 times and took the average value: Classic Quicksort: comps - 52254956 swaps - 26277985 Dual-Pivot Quicksort: comps - 52246553 swaps - 20977937 These values correlate with math proof: the number of comps the same (2*n*ln(n)) and ratio for swaps is 20977937/26277985 = 0.7983 (theoretical is 0.8/1.0 = 0.8). I don't have "few words" explanation wh ythe new algorithm is quicker, just the ratio swaps/comps/partitions is better for Dual-Pivot Quicksort. If we consider common case when we have (k-1) pivots and divide an array into k parts, we can ask, if the case k=3 (Dual-Pivot Quicksort) is the best? May be k=4,5 are better? It's easy to define recurrence relation for the count of operations when k=3,4,... but mathematical conclusion will be too complex. But to find out the answer for this question, I run pseudocode (in Java, see attached class) for k=4,5 and got: Quicksort with 3 pivots/4 parts: comps - 54399943 swaps - 24224254 Quicksort with 4 pivots/5 parts: comps - 57241615 swaps - 28659728 So, you can see that "3 pivots/4 parts" is better than Classic Quicksort for swaps only, "4 pivots/5 parts" is the looser, and "Dual-Pivot Quicksort" is real winner. I feel it is expectable result: if we have many pivots we spent a lot of time on sorting them and dividing into more parts doesn't save. In case with 2 pivots, we use only 1 comparison and 1/2 swaps to sort it out. BTW, the dividing into 3 parts instead of two also shows better results for MergeSort (but it's not actual for JDK because TimSort is faster). Ulf Zibis wrote: > Very interesting stuff. > > Does one have tried (theoretically and/or experimental) P1+P2+P3, > P1+P2+P3+P2, ... segmentation ? > Maybe coefficient A has a minimum below 0.8. > > -Ulf > > Am 11.09.2009 12:35, Vladimir Yaroslavskiy schrieb: >> Hello All, >> >> I'd like to share with you new Dual-Pivot Quicksort which is >> faster than the known implementations (theoretically and >> experimental). I'd like to propose to replace the JDK's >> Quicksort implementation by new one. >> >> Description >> ----------- >> The classical Quicksort algorithm uses the following scheme: >> >> 1. Pick an element P, called a pivot, from the array. >> 2. Reorder the array so that all elements, which are less than >> the pivot, come before the pivot and all elements greater than >> the pivot come after it (equal values can go either way). After >> this partitioning, the pivot element is in its final position. >> 3. Recursively sort the sub-array of lesser elements and the >> sub-array of greater elements. >> >> The invariant of classical Quicksort is: >> >> [ <= p | >= p ] >> >> There are several modifications of the schema: >> >> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >> >> But all of them use *one* pivot. >> >> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >> >> 1. Pick an elements P1, P2, called pivots from the array. >> 2. Assume that P1 <= P2, otherwise swap it. >> 3. Reorder the array into three parts: those less than the smaller >> pivot, those larger than the larger pivot, and in between are >> those elements between (or equal to) the two pivots. >> 4. Recursively sort the sub-arrays. >> >> The invariant of the Dual-Pivot Quicksort is: >> >> [ < P1 | P1 <= & <= P2 } > P2 ] >> >> The new Quicksort is faster than current implementation of Quicksort >> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >> >> The full description of the Dual-Pivot Quicksort you can find >> on my page: http://iaroslavski.narod.ru/quicksort >> >> Performance tests >> ----------------- >> Here is result of running on different types of input data: >> >> Client VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 >> >> Server VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 >> >> The a lot of other tests have been run under client and server mode. >> The most interesting is BentleyBasher test framework. It runs battery >> of tests for all cases: >> >> { 100, 1000, 10000, 1000000 } x >> { sawtooth, rand, stagger, plateau, shuffle } x >> { ident, reverse, reverse_front, reverse_back, sort, dither} >> >> where >> >> 100, ... , 1000000 - array length >> >> sawtooth: x[i] =i%m >> rand: x[i] = rand() % m >> stagger: x[i] = (i*m + i) % n >> plateau: x[i] = min(i, m) >> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >> >> ident(x) - a copy of x >> reverse(x, 0, n) - reversed copy >> reverse_front(x, 0, n/2) - front half reversed >> reverse_back(x, n/2, n) - back half reversed >> sort(x) - an ordered copy >> dither(x) - add i%5 to x[i] >> >> Here is the result of execution: >> Server VM: >> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >> >> Client VM: >> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >> >> >> Mathematical investigations >> --------------------------- >> It is proved that for the Dual-Pivot Quicksort the average number of >> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >> respectively. Full mathematical proof see in attached proof.txt >> and proof_add.txt files. Theoretical results are also confirmed >> by experimental counting of the operations. >> >> Diff between current and new implementation of Quicksort >> -------------------------------------------------------- >> >> Here is the link to the diff for java.util.Arrays class: >> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >> >> If you like to look and play with new algorithm, >> please, take attached class DualPivotQuicksort.java >> >> Feedback >> -------- >> >> Also I'd like to share a feedback from Joshua Bloch and >> Jon Bentley who spent a lot of time investigating this >> algorithm, who gave me many advices and tips how to >> make new Quicksort better. >> >> -------- Original Message -------- >> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >> Date: Thu, 10 Sep 2009 07:20:11 -0700 >> From: Joshua Bloch >> >> Jon also says that Vladimir should make every reasonable improvement to >> the basic method before checking in the code. In his words, "It would be >> horrible to put the new code into the library, and then have someone >> else come along and speed it up by another 20% by using standard >> techniques." I believe it's not unlikely that this code may end up >> getting ported to many languages and widely deployed in much the manner >> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >> in the field). Jon will help Vladimir do this. >> >> -------- Original Message -------- >> Subject: Dual-Pivot Quicksort: Next Steps >> Date: Wed, 09 Sep 2009 15:02:25 -0400 >> From: Jon Bentley >> >> Vladimir, Josh, >> I *finally* feel like I understand what is going on. Now that I >> (think that) I see it, it seems straightforward and obvious. >> Tony Hoare developed Quicksort in the early 1960s. I was very >> proud to make minor contributions to a particularly clean (binary) >> quicksort in the mid 1980s, to a relatively straightforward, industrial >> strength Quicksort with McIlroy in the early 1990s, and then to >> algorithms and data structures for strings with Sedgewick in the mid >> 1990s. >> I think that Vladimir's contributions to Quicksort go way beyond >> anything that I've ever done, and rank up there with Hoare's original >> design and Sedgewick's analysis. I feel so privileged to play a very, >> very minor role in helping Vladimir with the most excellent work! >> >> ----------------------------------------------- >> >> Let me know, if you have any questions/comments. >> >> Thank you, >> Vladimir From iaroslavski at mail.ru Fri Sep 11 13:43:36 2009 From: iaroslavski at mail.ru (Vladimir Iaroslavski) Date: Fri, 11 Sep 2009 17:43:36 +0400 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA5158.8060202@univ-mlv.fr> References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> Message-ID: <4AAA5408.8050706@mail.ru> sure, will do it R?mi Forax wrote: > just my two cents : > In the loop tagged "sorting" and "equals element", > a[k] can be stored in a local variable to avoid to recompute it several > time. > > The algorithm use two constants: 37 and 13, > I think they should be declared as private static final. > > R?mi > > Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >> Hello All, >> >> I'd like to share with you new Dual-Pivot Quicksort which is >> faster than the known implementations (theoretically and >> experimental). I'd like to propose to replace the JDK's >> Quicksort implementation by new one. >> >> Description >> ----------- >> The classical Quicksort algorithm uses the following scheme: >> >> 1. Pick an element P, called a pivot, from the array. >> 2. Reorder the array so that all elements, which are less than >> the pivot, come before the pivot and all elements greater than >> the pivot come after it (equal values can go either way). After >> this partitioning, the pivot element is in its final position. >> 3. Recursively sort the sub-array of lesser elements and the >> sub-array of greater elements. >> >> The invariant of classical Quicksort is: >> >> [ <= p | >= p ] >> >> There are several modifications of the schema: >> >> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >> >> But all of them use *one* pivot. >> >> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >> >> 1. Pick an elements P1, P2, called pivots from the array. >> 2. Assume that P1 <= P2, otherwise swap it. >> 3. Reorder the array into three parts: those less than the smaller >> pivot, those larger than the larger pivot, and in between are >> those elements between (or equal to) the two pivots. >> 4. Recursively sort the sub-arrays. >> >> The invariant of the Dual-Pivot Quicksort is: >> >> [ < P1 | P1 <= & <= P2 } > P2 ] >> >> The new Quicksort is faster than current implementation of Quicksort >> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >> >> The full description of the Dual-Pivot Quicksort you can find >> on my page: http://iaroslavski.narod.ru/quicksort >> >> Performance tests >> ----------------- >> Here is result of running on different types of input data: >> >> Client VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 >> >> Server VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 >> >> The a lot of other tests have been run under client and server mode. >> The most interesting is BentleyBasher test framework. It runs battery >> of tests for all cases: >> >> { 100, 1000, 10000, 1000000 } x >> { sawtooth, rand, stagger, plateau, shuffle } x >> { ident, reverse, reverse_front, reverse_back, sort, dither} >> >> where >> >> 100, ... , 1000000 - array length >> >> sawtooth: x[i] =i%m >> rand: x[i] = rand() % m >> stagger: x[i] = (i*m + i) % n >> plateau: x[i] = min(i, m) >> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >> >> ident(x) - a copy of x >> reverse(x, 0, n) - reversed copy >> reverse_front(x, 0, n/2) - front half reversed >> reverse_back(x, n/2, n) - back half reversed >> sort(x) - an ordered copy >> dither(x) - add i%5 to x[i] >> >> Here is the result of execution: >> Server VM: >> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >> >> Client VM: >> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >> >> >> Mathematical investigations >> --------------------------- >> It is proved that for the Dual-Pivot Quicksort the average number of >> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >> respectively. Full mathematical proof see in attached proof.txt >> and proof_add.txt files. Theoretical results are also confirmed >> by experimental counting of the operations. >> >> Diff between current and new implementation of Quicksort >> -------------------------------------------------------- >> >> Here is the link to the diff for java.util.Arrays class: >> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >> >> If you like to look and play with new algorithm, >> please, take attached class DualPivotQuicksort.java >> >> Feedback >> -------- >> >> Also I'd like to share a feedback from Joshua Bloch and >> Jon Bentley who spent a lot of time investigating this >> algorithm, who gave me many advices and tips how to >> make new Quicksort better. >> >> -------- Original Message -------- >> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >> Date: Thu, 10 Sep 2009 07:20:11 -0700 >> From: Joshua Bloch >> >> Jon also says that Vladimir should make every reasonable improvement to >> the basic method before checking in the code. In his words, "It would be >> horrible to put the new code into the library, and then have someone >> else come along and speed it up by another 20% by using standard >> techniques." I believe it's not unlikely that this code may end up >> getting ported to many languages and widely deployed in much the manner >> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >> in the field). Jon will help Vladimir do this. >> >> -------- Original Message -------- >> Subject: Dual-Pivot Quicksort: Next Steps >> Date: Wed, 09 Sep 2009 15:02:25 -0400 >> From: Jon Bentley >> >> Vladimir, Josh, >> I *finally* feel like I understand what is going on. Now that I >> (think that) I see it, it seems straightforward and obvious. >> Tony Hoare developed Quicksort in the early 1960s. I was very >> proud to make minor contributions to a particularly clean (binary) >> quicksort in the mid 1980s, to a relatively straightforward, industrial >> strength Quicksort with McIlroy in the early 1990s, and then to >> algorithms and data structures for strings with Sedgewick in the mid >> 1990s. >> I think that Vladimir's contributions to Quicksort go way beyond >> anything that I've ever done, and rank up there with Hoare's original >> design and Sedgewick's analysis. I feel so privileged to play a very, >> very minor role in helping Vladimir with the most excellent work! >> >> ----------------------------------------------- >> >> Let me know, if you have any questions/comments. >> >> Thank you, >> Vladimir From Ulf.Zibis at gmx.de Fri Sep 11 13:47:16 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Fri, 11 Sep 2009 15:47:16 +0200 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA5158.8060202@univ-mlv.fr> References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> Message-ID: <4AAA54E4.7090107@gmx.de> Am 11.09.2009 15:32, R?mi Forax schrieb: > just my two cents : > In the loop tagged "sorting" and "equals element", > a[k] can be stored in a local variable to avoid to recompute it > several time. I add 2 cents more: Doesn't HotSpot see this, and optimize accordingly? IMO: It's time that javac should do such optimization, as there are less optimized VM's in the world. -Ulf > > The algorithm use two constants: 37 and 13, > I think they should be declared as private static final. > > R?mi > > > Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >> Hello All, >> >> I'd like to share with you new Dual-Pivot Quicksort which is >> faster than the known implementations (theoretically and >> experimental). I'd like to propose to replace the JDK's >> Quicksort implementation by new one. >> >> Description >> ----------- >> The classical Quicksort algorithm uses the following scheme: >> >> 1. Pick an element P, called a pivot, from the array. >> 2. Reorder the array so that all elements, which are less than >> the pivot, come before the pivot and all elements greater than >> the pivot come after it (equal values can go either way). After >> this partitioning, the pivot element is in its final position. >> 3. Recursively sort the sub-array of lesser elements and the >> sub-array of greater elements. >> >> The invariant of classical Quicksort is: >> >> [ <= p | >= p ] >> >> There are several modifications of the schema: >> >> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >> >> But all of them use *one* pivot. >> >> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >> >> 1. Pick an elements P1, P2, called pivots from the array. >> 2. Assume that P1 <= P2, otherwise swap it. >> 3. Reorder the array into three parts: those less than the smaller >> pivot, those larger than the larger pivot, and in between are >> those elements between (or equal to) the two pivots. >> 4. Recursively sort the sub-arrays. >> >> The invariant of the Dual-Pivot Quicksort is: >> >> [ < P1 | P1 <= & <= P2 } > P2 ] >> >> The new Quicksort is faster than current implementation of Quicksort >> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >> >> The full description of the Dual-Pivot Quicksort you can find >> on my page: http://iaroslavski.narod.ru/quicksort >> >> Performance tests >> ----------------- >> Here is result of running on different types of input data: >> >> Client VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 >> 2.49 >> >> Server VM all 85% organ 0..1 0..4 >> random ascend descend equal equal pipes random 010101 >> random >> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 >> 3.39 >> >> The a lot of other tests have been run under client and server mode. >> The most interesting is BentleyBasher test framework. It runs battery >> of tests for all cases: >> >> { 100, 1000, 10000, 1000000 } x >> { sawtooth, rand, stagger, plateau, shuffle } x >> { ident, reverse, reverse_front, reverse_back, sort, dither} >> >> where >> >> 100, ... , 1000000 - array length >> >> sawtooth: x[i] =i%m >> rand: x[i] = rand() % m >> stagger: x[i] = (i*m + i) % n >> plateau: x[i] = min(i, m) >> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >> >> ident(x) - a copy of x >> reverse(x, 0, n) - reversed copy >> reverse_front(x, 0, n/2) - front half reversed >> reverse_back(x, n/2, n) - back half reversed >> sort(x) - an ordered copy >> dither(x) - add i%5 to x[i] >> >> Here is the result of execution: >> Server VM: >> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >> >> Client VM: >> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >> >> >> Mathematical investigations >> --------------------------- >> It is proved that for the Dual-Pivot Quicksort the average number of >> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >> respectively. Full mathematical proof see in attached proof.txt >> and proof_add.txt files. Theoretical results are also confirmed >> by experimental counting of the operations. >> >> Diff between current and new implementation of Quicksort >> -------------------------------------------------------- >> >> Here is the link to the diff for java.util.Arrays class: >> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >> >> If you like to look and play with new algorithm, >> please, take attached class DualPivotQuicksort.java >> >> Feedback >> -------- >> >> Also I'd like to share a feedback from Joshua Bloch and >> Jon Bentley who spent a lot of time investigating this >> algorithm, who gave me many advices and tips how to >> make new Quicksort better. >> >> -------- Original Message -------- >> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >> Date: Thu, 10 Sep 2009 07:20:11 -0700 >> From: Joshua Bloch >> >> Jon also says that Vladimir should make every reasonable improvement to >> the basic method before checking in the code. In his words, "It would be >> horrible to put the new code into the library, and then have someone >> else come along and speed it up by another 20% by using standard >> techniques." I believe it's not unlikely that this code may end up >> getting ported to many languages and widely deployed in much the manner >> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >> in the field). Jon will help Vladimir do this. >> >> -------- Original Message -------- >> Subject: Dual-Pivot Quicksort: Next Steps >> Date: Wed, 09 Sep 2009 15:02:25 -0400 >> From: Jon Bentley >> >> Vladimir, Josh, >> I *finally* feel like I understand what is going on. Now that I >> (think that) I see it, it seems straightforward and obvious. >> Tony Hoare developed Quicksort in the early 1960s. I was very >> proud to make minor contributions to a particularly clean (binary) >> quicksort in the mid 1980s, to a relatively straightforward, industrial >> strength Quicksort with McIlroy in the early 1990s, and then to >> algorithms and data structures for strings with Sedgewick in the mid >> 1990s. >> I think that Vladimir's contributions to Quicksort go way beyond >> anything that I've ever done, and rank up there with Hoare's original >> design and Sedgewick's analysis. I feel so privileged to play a very, >> very minor role in helping Vladimir with the most excellent work! >> >> ----------------------------------------------- >> >> Let me know, if you have any questions/comments. >> >> Thank you, >> Vladimir > > From iaroslavski at mail.ru Fri Sep 11 14:27:25 2009 From: iaroslavski at mail.ru (Vladimir Iaroslavski) Date: Fri, 11 Sep 2009 18:27:25 +0400 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA54E4.7090107@gmx.de> References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> <4AAA54E4.7090107@gmx.de> Message-ID: <4AAA5E4D.6050909@mail.ru> Hi, I've tried to use local variable int ak = a[k] in the loop and not found saving of time. There are 3 occurrences of a[k] in each loop, but only two can be changed because third comes after line: swap(a, k, great--); As summary: I'm changing only hardcoded constant by private static final variables. Thank you, Vladimir Ulf Zibis wrote: > Am 11.09.2009 15:32, R?mi Forax schrieb: >> just my two cents : >> In the loop tagged "sorting" and "equals element", >> a[k] can be stored in a local variable to avoid to recompute it >> several time. > > I add 2 cents more: > Doesn't HotSpot see this, and optimize accordingly? > IMO: It's time that javac should do such optimization, as there are less > optimized VM's in the world. > > -Ulf > > >> >> The algorithm use two constants: 37 and 13, >> I think they should be declared as private static final. >> >> R?mi >> >> >> Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >>> Hello All, >>> >>> I'd like to share with you new Dual-Pivot Quicksort which is >>> faster than the known implementations (theoretically and >>> experimental). I'd like to propose to replace the JDK's >>> Quicksort implementation by new one. >>> >>> Description >>> ----------- >>> The classical Quicksort algorithm uses the following scheme: >>> >>> 1. Pick an element P, called a pivot, from the array. >>> 2. Reorder the array so that all elements, which are less than >>> the pivot, come before the pivot and all elements greater than >>> the pivot come after it (equal values can go either way). After >>> this partitioning, the pivot element is in its final position. >>> 3. Recursively sort the sub-array of lesser elements and the >>> sub-array of greater elements. >>> >>> The invariant of classical Quicksort is: >>> >>> [ <= p | >= p ] >>> >>> There are several modifications of the schema: >>> >>> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >>> >>> But all of them use *one* pivot. >>> >>> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >>> >>> 1. Pick an elements P1, P2, called pivots from the array. >>> 2. Assume that P1 <= P2, otherwise swap it. >>> 3. Reorder the array into three parts: those less than the smaller >>> pivot, those larger than the larger pivot, and in between are >>> those elements between (or equal to) the two pivots. >>> 4. Recursively sort the sub-arrays. >>> >>> The invariant of the Dual-Pivot Quicksort is: >>> >>> [ < P1 | P1 <= & <= P2 } > P2 ] >>> >>> The new Quicksort is faster than current implementation of Quicksort >>> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >>> >>> The full description of the Dual-Pivot Quicksort you can find >>> on my page: http://iaroslavski.narod.ru/quicksort >>> >>> Performance tests >>> ----------------- >>> Here is result of running on different types of input data: >>> >>> Client VM all 85% organ 0..1 0..4 >>> random ascend descend equal equal pipes random 010101 >>> random >>> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >>> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 >>> 2.49 >>> >>> Server VM all 85% organ 0..1 0..4 >>> random ascend descend equal equal pipes random 010101 >>> random >>> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >>> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 >>> 3.39 >>> >>> The a lot of other tests have been run under client and server mode. >>> The most interesting is BentleyBasher test framework. It runs battery >>> of tests for all cases: >>> >>> { 100, 1000, 10000, 1000000 } x >>> { sawtooth, rand, stagger, plateau, shuffle } x >>> { ident, reverse, reverse_front, reverse_back, sort, dither} >>> >>> where >>> >>> 100, ... , 1000000 - array length >>> >>> sawtooth: x[i] =i%m >>> rand: x[i] = rand() % m >>> stagger: x[i] = (i*m + i) % n >>> plateau: x[i] = min(i, m) >>> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >>> >>> ident(x) - a copy of x >>> reverse(x, 0, n) - reversed copy >>> reverse_front(x, 0, n/2) - front half reversed >>> reverse_back(x, n/2, n) - back half reversed >>> sort(x) - an ordered copy >>> dither(x) - add i%5 to x[i] >>> >>> Here is the result of execution: >>> Server VM: >>> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >>> >>> Client VM: >>> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >>> >>> >>> Mathematical investigations >>> --------------------------- >>> It is proved that for the Dual-Pivot Quicksort the average number of >>> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >>> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >>> respectively. Full mathematical proof see in attached proof.txt >>> and proof_add.txt files. Theoretical results are also confirmed >>> by experimental counting of the operations. >>> >>> Diff between current and new implementation of Quicksort >>> -------------------------------------------------------- >>> >>> Here is the link to the diff for java.util.Arrays class: >>> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >>> >>> If you like to look and play with new algorithm, >>> please, take attached class DualPivotQuicksort.java >>> >>> Feedback >>> -------- >>> >>> Also I'd like to share a feedback from Joshua Bloch and >>> Jon Bentley who spent a lot of time investigating this >>> algorithm, who gave me many advices and tips how to >>> make new Quicksort better. >>> >>> -------- Original Message -------- >>> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >>> Date: Thu, 10 Sep 2009 07:20:11 -0700 >>> From: Joshua Bloch >>> >>> Jon also says that Vladimir should make every reasonable improvement to >>> the basic method before checking in the code. In his words, "It would be >>> horrible to put the new code into the library, and then have someone >>> else come along and speed it up by another 20% by using standard >>> techniques." I believe it's not unlikely that this code may end up >>> getting ported to many languages and widely deployed in much the manner >>> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >>> in the field). Jon will help Vladimir do this. >>> >>> -------- Original Message -------- >>> Subject: Dual-Pivot Quicksort: Next Steps >>> Date: Wed, 09 Sep 2009 15:02:25 -0400 >>> From: Jon Bentley >>> >>> Vladimir, Josh, >>> I *finally* feel like I understand what is going on. Now that I >>> (think that) I see it, it seems straightforward and obvious. >>> Tony Hoare developed Quicksort in the early 1960s. I was very >>> proud to make minor contributions to a particularly clean (binary) >>> quicksort in the mid 1980s, to a relatively straightforward, industrial >>> strength Quicksort with McIlroy in the early 1990s, and then to >>> algorithms and data structures for strings with Sedgewick in the mid >>> 1990s. >>> I think that Vladimir's contributions to Quicksort go way beyond >>> anything that I've ever done, and rank up there with Hoare's original >>> design and Sedgewick's analysis. I feel so privileged to play a very, >>> very minor role in helping Vladimir with the most excellent work! >>> >>> ----------------------------------------------- >>> >>> Let me know, if you have any questions/comments. >>> >>> Thank you, >>> Vladimir From straxus at gmail.com Fri Sep 11 14:39:11 2009 From: straxus at gmail.com (Ryan Slobojan) Date: Fri, 11 Sep 2009 10:39:11 -0400 Subject: What methods should go into a java.util.Objects class in JDK 7? Message-ID: <9F2CEE46-89BD-407C-B68C-00B819ABAE73@gmail.com> > Hello. > > For JDK 7, I think it is high-time the platform included a class like > java.util.Objects to hold commonly-written utility methods. For > example, a two-argument static equals method that returned true if > both > arguments are null, returns false is one argument is null, and > otherwise > returns the result of calling arg1.equals(arg2) (6797535 "Add shared > two argument static equals method to the platform"). > > A static hashCode method returning 0 for null and the value of > arg.hashCode() has also been suggested. > > A set of > > static int compareTo(int, int) > static int compareTo(long, long) > .... > > methods probably belongs somewhere in the platform too. > > What other utility methods would have broad enough use and > applicability > to go into a common java.util class? > > -Joe Hi, As a note, I've just put up an article about this on InfoQ soliciting feedback from the wider Java community: http://www.infoq.com/news/2009/09/jdk7-java-utils-object Thanks, Ryan Slobojan From Mandy.Chung at Sun.COM Fri Sep 11 18:14:10 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Fri, 11 Sep 2009 11:14:10 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4A9EC69F.6000509@sun.com> References: <4A9EC69F.6000509@sun.com> Message-ID: <4AAA9372.3070200@Sun.com> Alan, David, Remi, Iris, Thanks for the review and the revised webrev at: http://cr.openjdk.java.net/~mchung/6878481/webrev.01/ I incorporate the comments you have and minimize the number of System.nanoTime() calls and also remove the number of opened jars perf counters. Please let me know if you have further comments. I added /usepmtimer in boot.ini on my system (thanks David for the suggestion). The performance run shows insignificant perf impact. Windows XP SP 3 Intel Core 2 CPU @3.0Ghz, 1.96 GB RAM ============================================================================== mchung.baseline.server: Benchmark Samples Mean Stdev Geomean Weight reference_server 20 7615.99 123.75 jetstream 20 131.78 29.37 0.10 scimark 20 618.00 6.35 0.15 specjbb2000 20 93732.74 540.37 0.15 specjbb2005 20 43062.47 182.61 0.25 specjvm98 20 575.46 1.94 0.15 volano25 20 46464.90 1164.30 0.20 ============================================================================== mchung.perfcounters: Benchmark Samples Mean Stdev %Diff P Significant reference_server 20 7575.65 34.80 -0.53 0.174 * jetstream 20 124.67 1.88 -5.40 0.293 * scimark 20 619.47 5.19 0.24 0.426 * specjbb2000 20 93573.49 663.77 -0.17 0.411 * specjbb2005 20 43095.83 190.47 0.08 0.575 * specjvm98 20 576.44 3.05 0.17 0.233 * volano25 20 46064.85 1034.46 -0.86 0.258 * ============================================================================== * - Not Significant: A non-zero %Diff for the mean could be noise. If the %Diff is 0, an actual difference may still exist. In either case, more samples would be needed to detect an actual difference in sample means. Thanks Mandy Mandy Chung wrote: > This is related to 6857194: Add hotspot new perf counters to aid class > loading performance measurement. > > It's useful to add performance counters in the library code so that perf > data from the JDK and VM can be collected and output in a unified way > (written in the jvmstat shared memory buffer). I add a simple > sun.misc.PerfCounter class to maintain the list of perf counters for the > library to use. This fix only instruments the class loading and jar/zip > to collect simple basic metrics. Additional perf counters will be > added in the future. > > Webrev: > http://cr.openjdk.java.net/~mchung/6878481/webrev.00/ > > Thanks > Mandy From graehl at isi.edu Fri Sep 11 19:09:48 2009 From: graehl at isi.edu (Jonathan Graehl) Date: Fri, 11 Sep 2009 19:09:48 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with new =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ=?= References: <4AAA27EA.8090902@Sun.COM> Message-ID: Nice. > int third = len / div; > > // "medians" > int m1 = left + third; > int m2 = right - third; > > if (m1 <= left) { > m1 = left + 1; > } > if (m2 >= right) { > m2 = right - 1; > } I'd suggest this instead: int third = len / div; third=third>0?third:1; // "medians" int m1 = left + third; int m2 = right - third; From lgeller at feedroom.com Fri Sep 11 19:14:16 2009 From: lgeller at feedroom.com (Leonid Geller) Date: Fri, 11 Sep 2009 19:14:16 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with new =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ=?= References: <4AAA27EA.8090902@Sun.COM> Message-ID: As an observation, why not expand the new algorithm to N-Pivot where N = round(ln(array length)). This should lower the average sort cost even lower. From Joe.Darcy at Sun.COM Fri Sep 11 20:04:50 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Fri, 11 Sep 2009 13:04:50 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA993E3.20506@sun.com> References: <4AA812D0.309@sun.com> <1ccfd1c10909091715w431554fldf2e9f7f7ce17599@mail.gmail.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> <4AA993E3.20506@sun.com> Message-ID: <4AAAAD62.70805@sun.com> Joe Darcy wrote: > Martin Buchholz wrote: >> On Thu, Sep 10, 2009 at 16:48, Joe Darcy wrote: >>> Martin Buchholz wrote: >>>> On Thu, Sep 10, 2009 at 15:48, Joe Darcy wrote: >>>> >>>>> On 09/09/09 08:01 PM, Joe Darcy wrote: >>>>> I noticed that the Character class should be similarly tightened: >>>>> >>>> Right you are. Webrev regenerated. >>>> >>>> Martin >>>> >>> One typo inherited from my earlier suggestion (mea culpa!): as the >>> Character >>> class is not a java.lang.Number, it does not have an intValue method. >>> Character does have a charValue method and referring to that method >>> in the >>> specification of hashCode should suffice. >>> >>> I approve this change going back with the correction to the >>> Character class. >> >> Oops! so many little mistakes. Webrev regenerated. > > Looks good. > > -Joe > Martin, Just to be clear, I approve this change of tightening the hashCode specifications for Byte, Short, and Character going back into JDK 7. Thanks, -Joe From Joe.Darcy at Sun.COM Fri Sep 11 20:07:31 2009 From: Joe.Darcy at Sun.COM (Joseph D. Darcy) Date: Fri, 11 Sep 2009 13:07:31 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA857A8.1010700@sun.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> <4AA849B1.1090005@sun.com> <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> <4AA857A8.1010700@sun.com> Message-ID: <4AAAAE03.5010002@sun.com> Joe Darcy wrote: > Martin Buchholz wrote: >> On Wed, Sep 9, 2009 at 17:34, Joe Darcy wrote: >> >>> Martin Buchholz wrote: >>> >>>> Google would like to contribute implementations of the methods below. >>>> Here's a webrev: >>>> >>>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ >>>> >>>> >>> Wherever these compare methods go, into the N wrapper classes or into >>> java.util.Compare, >>> >> >> Given the precedent of Double.compare(double,double) and >> Float.compare(float,float), I think the compare methods need >> to go into the primitive wrapper classes. >> >> I think the instance method compareTo should be rewritten >> >>> in terms of the new static compare. In particular, >>> >>> 422 public int compareTo(Short anotherShort) { >>> 423 return this.value - anotherShort.value; >>> 424 } >>> >>> should get replaced with >>> >>> 422 public int compareTo(Short anotherShort) { >>> 423 return compare(this.value, anotherShort.value); >>> 424 } >>> >> >> As you wish. >> >> Webrev updated. >> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ >> > > I approve these changes in an engineering sense; they are a fix for bug > > 6582946 Add suite of compare(T, T) methods for ints, longs etc > >>> This consolidates the comparison logic in a single method per type and >>> reuses the existing implementation tests. >>> >> >> >> >>> (Later in JDK 7, a set of "unsignedCompare" methods are possible >>> additions >>> to the platform too.) >>> >>> >>>> We have tests (not yet included) but they would need to be >>>> jtreg-ified. >>>> Is there any junit support yet for jtreg? >>>> >>>> >>> No. >>> >>> Once the home of the new methods is determined, I'll file a ccc >>> request so >>> these changes can go back after any additional testing is settled. >>> >> >> There's not a whole lot of testing work here, but we will provide it if >> it CCC is approved. >> >> > I've created a ccc for this and will let you know when it is approved. > > -Joe > Martin, The paperwork has been handled; I approve your set of compare methods going back. Thanks, -Joe From Xueming.Shen at Sun.COM Fri Sep 11 21:05:04 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Fri, 11 Sep 2009 14:05:04 -0700 Subject: Codereview request for #6881337 Message-ID: <4AAABB80.9060203@sun.com> Martin, Would you please help review the change? http://cr.openjdk.java.net/~sherman/6881337/webrev Somehow the development team messed up our change in ZipEntry.java in b64 in their putback. This fix is to restore the api/impl. The bug report probably has not been pushed out yet. Here is the copy/paste. Thanks, Sherman *Synopsis*: ZipEntry.setComment() was accidentally changed back to old spec/impl in jdk7-b64 CrPrint: http://bt2ws.central.sun.com/CrPrint?id=6881337 Monaco: http://monaco.sfbay.sun.com/detail.jsf?cr=6881337 *Change Request ID*: 6881337 *Synopsis*: ZipEntry.setComment() was accidentally changed back to old spec/impl in jdk7-b64 Product: java Category: java Subcategory: classes_util_jarzip Type: Defect Subtype: Status: 5-Cause Known Substatus: Priority: 3-Medium Introduced In Release: Introduced In Build: Responsible Manager: frances.ho at sun.com Responsible Engineer: xueming.shen at sun.com Initial Evaluator: java_util_bugs at sun.com Keywords: === *Description* ============================================================ Yes - I agree that this is part of a mismerge made by me, while getting the change needed for kernel to setTime, I also took 1.6 version of setComment, which was unrelated. You should restore setComment to its previous form. /Andy Xueming Shen wrote: > > It appears the deployment team might have "accidentally" changed it back to the old spec/impl > > while fixing their problem #6625963 "3 months ago", see the diff at > > > > http://hg.openjdk.java.net/jdk7/jdk7/jdk/diff/9053bcc8eef0/src/share/classes/java/util/zip/ZipEntry.java > > > > The changeset summary/tag in the ZipEntry.java is > > > > 6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7 > > > > (I'm not sure if this is accurate or not) > > > > Andy, you are listed as the owner of this fix, can you confirm? > > > > Sherman > > > > Dmitry Miltsov wrote: > > > >> >> Hello Xueming, >> >> >> >> According to CCC 4244499 the following assertion was removed for the spec >> >> on java.util.zip.ZipEntry since b57: >> >> "Throws: IllegalArgumentException - if the length of the specified comment >> >> string is greater than 0xFFFF bytes" >> >> >> >> However since b64 this assertion has returned to the ZipEntry specification and >> >> is contradicting to the new assertion "If the length of the specified comment >> >> string is greater than 0xFFFF bytes after encoding, only the first 0xFFFF bytes >> >> are output to the ZIP file entry." >> >> >> >> Could you please clarify the issue ? Also it seems that the returned assertion >> >> about IllegalArgumentException has not been approved through the CCC process. >> >> >> >> Thanks, >> >> Dmitry >> *** (#1 of 1): 2009-09-11 18:48:33 GMT+00:00 xueming.shen at sun.com === *Public Comments* ======================================================== === *Comments* =============================================================== === *Evaluation* ============================================================= Need to restore the spec and the implementation. *** (#1 of 1): 2009-09-11 18:49:36 GMT+00:00 xueming.shen at sun.com === *Suggested Fix* ========================================================== === *Workaround* ============================================================= === *Justification* ========================================================== Priority changed from [] to [3-Medium] regression xueming.shen at sun.com 2009-09-11 18:48:33 GMT *** (#1 of 1): 2009-09-11 18:48:33 GMT+00:00 xueming.shen at sun.com === *Additional Details* ===================================================== Targeted Release: 7 Commit To Fix In Build: Fixed In Build: Integrated In Build: Verified In Build: See Also: Duplicate of: Hooks: Hook1: Hook2: Hook3: Hook4: Hook5: Hook6: Interest List: Program Management: Root Cause: Is a Security Vulnerability?: No Fix Affects Documentation: No Fix Affects Localization: No Reported by: === *History* ================================================================ Date Submitted: 2009-09-11 18:48:32 GMT+00:00 Submitted By: xueming.shen at sun.com Status Changed Date Updated Updated By 5-Cause Known 2009-09-11 18:49:36 GMT+00:00 xueming.shen at sun.com === *Solution* =============================================================== From martinrb at google.com Fri Sep 11 22:34:33 2009 From: martinrb at google.com (Martin Buchholz) Date: Fri, 11 Sep 2009 15:34:33 -0700 Subject: Codereview request for #6881337 In-Reply-To: <4AAABB80.9060203@sun.com> References: <4AAABB80.9060203@sun.com> Message-ID: <1ccfd1c10909111534j5dee631r17910c19f9c120d1@mail.gmail.com> Approved. (It would be nice for all changes to openjdk7 core libraries to leave a trace on core-libs-dev, so that they can get review here.) Martin On Fri, Sep 11, 2009 at 14:05, Xueming Shen wrote: > Martin, > > Would you please help review the change? > > http://cr.openjdk.java.net/~sherman/6881337/webrev > > Somehow the development team messed up our change in ZipEntry.java in b64 in > their putback. This fix is to restore the api/impl. > The bug report probably has not been pushed out yet. Here is the copy/paste. > > Thanks, > Sherman > > *Synopsis*: ZipEntry.setComment() was accidentally changed back to old > spec/impl in jdk7-b64 > > CrPrint: http://bt2ws.central.sun.com/CrPrint?id=6881337 > Monaco: http://monaco.sfbay.sun.com/detail.jsf?cr=6881337 > > ? ?*Change Request ID*: 6881337 > > *Synopsis*: ZipEntry.setComment() was accidentally changed back to old > spec/impl in jdk7-b64 > > ?Product: java > ?Category: java > ?Subcategory: classes_util_jarzip > ?Type: Defect > ?Subtype: ?Status: 5-Cause Known > ?Substatus: ?Priority: 3-Medium > ?Introduced In Release: ?Introduced In Build: ?Responsible Manager: > frances.ho at sun.com > ?Responsible Engineer: xueming.shen at sun.com > ?Initial Evaluator: java_util_bugs at sun.com > ?Keywords: > === *Description* > ============================================================ > Yes - I agree that this is part of a mismerge made by me, while getting the > change needed for kernel to setTime, I also took 1.6 version of setComment, > which was unrelated. > You should restore setComment to its previous form. > > /Andy > > Xueming Shen wrote: > > >> > It appears the deployment team might have "accidentally" changed it back >> > to the old spec/impl >> > while fixing their problem #6625963 "3 months ago", see the diff at >> > >> > >> > http://hg.openjdk.java.net/jdk7/jdk7/jdk/diff/9053bcc8eef0/src/share/classes/java/util/zip/ZipEntry.java >> > >> > The changeset summary/tag in the ZipEntry.java is >> > >> > 6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7 >> > >> > (I'm not sure if this is accurate or not) >> > >> > Andy, you are listed as the owner of this fix, can you confirm? >> > >> > Sherman >> > >> > Dmitry Miltsov wrote: >> > >> >>> >>> >> Hello Xueming, >>> >> >>> >> According to CCC 4244499 the following assertion was removed for the >>> >> spec >>> >> on java.util.zip.ZipEntry since b57: >>> >> "Throws: IllegalArgumentException - if the length of the specified >>> >> comment >>> >> string is greater than 0xFFFF bytes" >>> >> >>> >> However since b64 this assertion has returned to the ZipEntry >>> >> specification and >>> >> is contradicting to the new assertion "If the length of the specified >>> >> comment >>> >> string is greater than 0xFFFF bytes after encoding, only the first >>> >> 0xFFFF bytes >>> >> are output to the ZIP file entry." >>> >> >>> >> Could you please clarify the issue ? Also it seems that the returned >>> >> assertion >>> >> about IllegalArgumentException has not been approved through the CCC >>> >> process. >>> >> >>> >> Thanks, >>> >> Dmitry >>> > > *** (#1 of 1): 2009-09-11 18:48:33 GMT+00:00 xueming.shen at sun.com > > > === *Public Comments* > ======================================================== > > === *Comments* > =============================================================== > > === *Evaluation* > ============================================================= > Need to restore the spec and the implementation. > > *** (#1 of 1): 2009-09-11 18:49:36 GMT+00:00 xueming.shen at sun.com > > > === *Suggested Fix* > ========================================================== > > === *Workaround* > ============================================================= > > === *Justification* > ========================================================== > Priority changed from [] to [3-Medium] > regression > xueming.shen at sun.com 2009-09-11 18:48:33 GMT > > *** (#1 of 1): 2009-09-11 18:48:33 GMT+00:00 xueming.shen at sun.com > > > === *Additional Details* > ===================================================== > ? ? ? Targeted Release: 7 > ? ? ? Commit To Fix In Build: ? ? ? Fixed In Build: ? ? ? Integrated In > Build: ? ? ? Verified In Build: ?See Also: ?Duplicate of: ?Hooks: > ? ? ? Hook1: ? ? ? Hook2: ? ? ? Hook3: ? ? ? Hook4: ? ? ? Hook5: > Hook6: ?Interest List: ?Program Management: ?Root Cause: ?Is a Security > Vulnerability?: No > ?Fix Affects Documentation: No > ?Fix Affects Localization: No > ?Reported by: > === *History* > ================================================================ > ? ? ? Date Submitted: 2009-09-11 18:48:32 GMT+00:00 > ? ? ? Submitted By: xueming.shen at sun.com > > ? ? ? Status Changed ? ?Date Updated ? ? ? ? ? ? ? ? ?Updated By > ? ? ? 5-Cause Known ? ? 2009-09-11 18:49:36 GMT+00:00 xueming.shen at sun.com > > > === *Solution* > =============================================================== > > > From vadim123 at gmail.com Fri Sep 11 22:48:56 2009 From: vadim123 at gmail.com (Vadim Ponomarenko) Date: Fri, 11 Sep 2009 22:48:56 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with new =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ=?= References: <4AAA27EA.8090902@Sun.COM> Message-ID: Vladimir Yaroslavskiy writes: > I'd like to share with you new Dual-Pivot Quicksort which is > faster than the known implementations (theoretically and > experimental). I'd like to propose to replace the JDK's > Quicksort implementation by new one. This is a great idea; as a mathematician I immediately want to generalize it. Unfortunately, I lack the computing skill to test my generalization in practice. Suppose that instead of 2 pivots we have m (randomly chosen) pivots, where m=sqrt(n+1)-1. Step 1: Sort the m pivots, recursively. Step 2: Build a balanced binary tree from the pivots. Step 3: Sort the remaining n-m elements into (m+1) categories, using the BBT. Step 4: Sort each of the (m+1) categories, recursively. Let S(n) denote the number of steps needed for this algorithm. Calculating roughly: Step 1 requires S(m) steps. Step 2 requires m steps (it is easy since the pivots are already sorted). Step 3 requires (n-m)(log m) comparisons. Step 4 requires, on average, (m+1)S((n-m)/(m+1)) steps. m was chosen so that (n-m)/(m+1)=m, so S(n)=(m+2)S(m)+m+(n-m)(log m) <= (m+2) S(m)+ n log m. Crudely, we replace both m and m+2 by sqrt(n), to get as approximation: S(n) <= 0.5 n log n + n^0.5 [ 0.25 n^0.5 log n + n^0.25 [ 0.125 n^0.25 log n +...]]] = 0.5 n log n [1 + 0.5 + 0.25 + ...] = n log n. This appears to be better than 2 n log n. This argument can be made precise (the only really questionable issue is replacing m+2 by m) by first getting a crude but correct upper bound for 2S(m), which gets absorbed into the -mlogm term. Unfortunately, I'm not up to the detailed comparison vs. swap analysis as done by Mr. Yaroslavskiy, but it seems to me that, if nothing else, having an efficient algorithm to partition the non-pivot elements should provide a savings. Vadim Ponomarenko Dept. of Mathematics and Statistics San Diego State University From neal at gafter.com Fri Sep 11 23:08:49 2009 From: neal at gafter.com (Neal Gafter) Date: Fri, 11 Sep 2009 16:08:49 -0700 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: References: <4AAA27EA.8090902@Sun.COM> Message-ID: <15e8b9d20909111608u4e463176rf8021f5ed866420a@mail.gmail.com> Vadim- It would be very interesting if something along these lines could be made practical. It isn't obvious how to do step (3) in place. Either you end up allocating extra storage to do it, in which case you might as well have used a merge sort, or you end up doing some extra shuffling around of the data, in which case it is probably more expensive than the dual-partition version. Perhaps there is some technique I'm not thinking of. Cheers, Neal On Fri, Sep 11, 2009 at 3:48 PM, Vadim Ponomarenko wrote: > Vladimir Yaroslavskiy writes: > > I'd like to share with you new Dual-Pivot Quicksort which is > > faster than the known implementations (theoretically and > > experimental). I'd like to propose to replace the JDK's > > Quicksort implementation by new one. > > This is a great idea; as a mathematician I immediately want to generalize > it. > Unfortunately, I lack the computing skill to test my generalization in > practice. > > Suppose that instead of 2 pivots we have m (randomly chosen) pivots, where > m=sqrt(n+1)-1. > Step 1: Sort the m pivots, recursively. > Step 2: Build a balanced binary tree from the pivots. > Step 3: Sort the remaining n-m elements into (m+1) categories, using the > BBT. > Step 4: Sort each of the (m+1) categories, recursively. > > Let S(n) denote the number of steps needed for this algorithm. Calculating > roughly: > Step 1 requires S(m) steps. > Step 2 requires m steps (it is easy since the pivots are already sorted). > Step 3 requires (n-m)(log m) comparisons. > Step 4 requires, on average, (m+1)S((n-m)/(m+1)) steps. > > m was chosen so that (n-m)/(m+1)=m, so S(n)=(m+2)S(m)+m+(n-m)(log m) <= > (m+2) > S(m)+ n log m. Crudely, we replace both m and m+2 by sqrt(n), to get as > approximation: > S(n) <= 0.5 n log n + n^0.5 [ 0.25 n^0.5 log n + n^0.25 [ 0.125 n^0.25 log > n > +...]]] = 0.5 n log n [1 + 0.5 + 0.25 + ...] = n log n. This appears to > be > better than 2 n log n. This argument can be made precise (the only really > questionable issue is replacing m+2 by m) by first getting a crude but > correct upper bound for 2S(m), which gets absorbed into the -mlogm term. > > Unfortunately, I'm not up to the detailed comparison vs. swap analysis as > done by Mr. Yaroslavskiy, but it seems to me that, if nothing else, having > an efficient algorithm to partition the non-pivot elements should provide a > savings. > > Vadim Ponomarenko > Dept. of Mathematics and Statistics > San Diego State University > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Xueming.Shen at Sun.COM Fri Sep 11 23:13:30 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Fri, 11 Sep 2009 16:13:30 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AAA1B75.6060309@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA03D0B.1030206@sun.com> <1ccfd1c10909031606w28309d4cj4f6ea9309264db7c@mail.gmail.com> <4AA051E5.5060605@sun.com> <1ccfd1c10909031655r187530cap6871c15b8f595e57@mail.gmail.com> <4AA19250.2060803@sun.com> <20090904225714.GB26286@google.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> Message-ID: <4AAAD99A.4050505@sun.com> I'm definitely open for any better choice, I'm not in hurry to close this one up. Sure, I hope we can reach a consensus before I go on vacation this weekend:-) So here is the planB alan is proposing, no API doc added yet, but you should know what it means. I will add the doc in later if we agree on this approach. http://cr.openjdk.java.net/~sherman/zipflush/webrev.planB/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html We probably should figure out want to do with the GZipOutputStream...it probably needs something as well...we can figure out it later. So, Martin, Brandon, David and anyone interested, Is this something you guys can accept ? It makes the life easy for developer that needs the sync_flush for the flush(), you don't need to override/subclass anything, just makes it clear what you want when creating the DOS by picking the appropriate constructor, nothing more. Since we keep the default behavior un-changed, it is also compatible:-) It does not add the the full_sync, sure we can consider to use a enum instead of the boolean parameter, but since no one is asking for it now and the enum looks a little "too modern" compared to the rest of the API, we might want to stay with the simple "boolean doSyncFlush". Opinion? sherman Funny, I was "beaten up" today for one of my other changes, I was literally asked "where was it documented/highlighted that this fix was going to introduce an incompatibility", for a much much "less" incompatible change:-) Alan Bateman wrote: > Xueming Shen wrote: >> I think we have enough discussion on this topic, it's time to make a >> final decision. Seems like we are all happy on the >> changes in Deflater and new DOS.flush(mode), the only difference is >> whether or not we should change the existing >> behavior of DOS.flush() should use Z_SYNC_FLUSH by default. >> >> Brandon is very firm on the "yes" side, strongly believe this is a MUST. >> Martin is on the fence, leaning towards "yes" >> Sherman is on the "no" side >> >> So if there is no other vote coming with strong opinion, your vote >> will be important:-) Are you also leaning to "yes" >> or "strongly" suggesting a yes? I need strong "yes" to change my mind. > This is tough call. It is clearly desirable to change flush() to work > the way that developers expect. On the other hand there is always risk > with changing long-standing behavior. The risk here is probably low > but it's impossible to quantify. Martin makes a good observation that > it may cause problems for code that wraps the stream with an > auto-flushing PrintStream or PrintWriter. You also made a good > observation that just changing the number of bytes written could cause > breakage (in some fragile environment) - we just don't know! So on > balance, I think you are probably right to take the conservative line > on this one. > > I know you've had enough discussion on this but I wonder if you might > be open to considering new constructors for DeflaterOutputStream (and > maybe GZIPOutputStream) as an alternative to the flush(int) method. > This might fit better with this API, in particular for cases where the > intended usage is known. It could be as simple as a "boolean > syncFlush" parameter to indicate how uncompressed buffered bytes are > handled when flushing (default to false for existing constructors so > existing behavior preserved). The boolean parameter is just an > opening bid - clearly there are alternatives. The point is that it > makes it easy and more obvious as how to get a DeflaterOutputStream > suitable for interactive cases. > > -Alan. From vadim123 at gmail.com Fri Sep 11 23:17:33 2009 From: vadim123 at gmail.com (Vadim Ponomarenko) Date: Fri, 11 Sep 2009 23:17:33 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot =?utf-8?b?CVF1aWNrc29ydA==?= References: <4AAA27EA.8090902@Sun.COM> <15e8b9d20909111608u4e463176rf8021f5ed866420a@mail.gmail.com> Message-ID: > Vadim-It would be very interesting if something along these lines could be made practical.? It isn't obvious how to do step (3) in place.? Either you end up allocating extra storage to do it, in which case you might as well have used a merge sort, or you end up doing some extra shuffling around of the data, in which case it is probably more expensive than the dual-partition version.? Perhaps there is some technique I'm not thinking of.Cheers,Neal I didn't think of space requirements, but naively it seems to me that the two-pivot method of categorizing the non-pivot elements in place (which admittedly I don't entirely understand) would work just as well with the m-pivot method. From Joe.Darcy at Sun.COM Fri Sep 11 23:25:31 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Fri, 11 Sep 2009 16:25:31 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AA9936B.5000006@joda.org> References: <4AA812D0.309@sun.com> <4AA9936B.5000006@joda.org> Message-ID: <4AAADC6B.7070807@sun.com> Stephen Colebourne wrote: > Joe Darcy wrote: >> What other utility methods would have broad enough use and >> applicability to go into a common java.util class? > > Joe, > You've asked for a call for ideas, but not given any indication of > process. Are you going to evaluate everything that comes in and pick > the best a la Coin? Or allow anyone to send in patches? Those options are not mutually exclusive; patches are welcome subject to the usual terms and conditions. > Who decides what is in and what is out? This is a little side project of mine and I wanted to get some feedback before preparing a formal change for review, possibly including patches from others. -Joe From xueming.shen at sun.com Fri Sep 11 23:45:15 2009 From: xueming.shen at sun.com (xueming.shen at sun.com) Date: Fri, 11 Sep 2009 23:45:15 +0000 Subject: hg: jdk7/tl/jdk: 6881337: ZipEntry.setComment() was accidentally changed back to old spec/impl in jdk7-b64 Message-ID: <20090911234603.9E71112044@hg.openjdk.java.net> Changeset: 46406871599c Author: sherman Date: 2009-09-11 16:36 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/46406871599c 6881337: ZipEntry.setComment() was accidentally changed back to old spec/impl in jdk7-b64 Summary: restored the correct spec and implementation of setComment Reviewed-by: martin ! src/share/classes/java/util/zip/ZipEntry.java From Joe.Darcy at Sun.COM Fri Sep 11 23:48:48 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Fri, 11 Sep 2009 16:48:48 -0700 Subject: Race condition in Class.getName() In-Reply-To: <1ccfd1c10909091735ndf28f91j1813c26203a60967@mail.gmail.com> References: <1ccfd1c10909091735ndf28f91j1813c26203a60967@mail.gmail.com> Message-ID: <4AAAE1E0.6020200@sun.com> Martin Buchholz wrote: > It is believed that the java memory model allows Class.getName() > to return null. > This is one of those methods with an intentional data race. > Probably this has not been seen in practice because only > a perverse or adversarial runtime would load the "name" field > twice, out-of-order, as it seems to be allowed to. > > diff --git a/src/share/classes/java/lang/Class.java > b/src/share/classes/java/lang/Class.java > --- a/src/share/classes/java/lang/Class.java > +++ b/src/share/classes/java/lang/Class.java > @@ -565,8 +565,9 @@ > * represented by this object. > */ > public String getName() { > + String name = this.name; > if (name == null) > - name = getName0(); > + this.name = name = getName0(); > return name; > } > > Martin > Hello. The change looks fine to me. Do you want a bug filed, etc.? -Joe From martinrb at google.com Sat Sep 12 00:22:50 2009 From: martinrb at google.com (Martin Buchholz) Date: Fri, 11 Sep 2009 17:22:50 -0700 Subject: Race condition in Class.getName() In-Reply-To: <4AAAE1E0.6020200@sun.com> References: <1ccfd1c10909091735ndf28f91j1813c26203a60967@mail.gmail.com> <4AAAE1E0.6020200@sun.com> Message-ID: <1ccfd1c10909111722k6920b384ub1848c1a8d7ac1d@mail.gmail.com> On Fri, Sep 11, 2009 at 16:48, Joe Darcy wrote: > Martin Buchholz wrote: >> >> It is believed that the java memory model allows Class.getName() >> to return null. >> This is one of those methods with an intentional data race. >> Probably this has not been seen in practice because only >> a perverse or adversarial runtime would load the "name" field >> twice, out-of-order, as it seems to be allowed to. >> >> diff --git a/src/share/classes/java/lang/Class.java >> b/src/share/classes/java/lang/Class.java >> --- a/src/share/classes/java/lang/Class.java >> +++ b/src/share/classes/java/lang/Class.java >> @@ -565,8 +565,9 @@ >> ? ? ?* ? ? ? ? ?represented by this object. >> ? ? ?*/ >> ? ? public String getName() { >> + ? ? ? ?String name = this.name; >> ? ? ? ? if (name == null) >> - ? ? ? ? ? ?name = getName0(); >> + ? ? ? ? ? ?this.name = name = getName0(); >> ? ? ? ? return name; >> ? ? } >> >> Martin >> > > Hello. > > The change looks fine to me. ?Do you want a bug filed, etc.? Yup. I will commit as soon as I get a bug + synopsis. From Joe.Darcy at Sun.COM Sat Sep 12 00:37:09 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Fri, 11 Sep 2009 17:37:09 -0700 Subject: Race condition in Class.getName() In-Reply-To: <1ccfd1c10909111722k6920b384ub1848c1a8d7ac1d@mail.gmail.com> References: <1ccfd1c10909091735ndf28f91j1813c26203a60967@mail.gmail.com> <4AAAE1E0.6020200@sun.com> <1ccfd1c10909111722k6920b384ub1848c1a8d7ac1d@mail.gmail.com> Message-ID: <4AAAED35.8080809@sun.com> Martin Buchholz wrote: > On Fri, Sep 11, 2009 at 16:48, Joe Darcy wrote: > >> Martin Buchholz wrote: >> >>> It is believed that the java memory model allows Class.getName() >>> to return null. >>> This is one of those methods with an intentional data race. >>> Probably this has not been seen in practice because only >>> a perverse or adversarial runtime would load the "name" field >>> twice, out-of-order, as it seems to be allowed to. >>> >>> diff --git a/src/share/classes/java/lang/Class.java >>> b/src/share/classes/java/lang/Class.java >>> --- a/src/share/classes/java/lang/Class.java >>> +++ b/src/share/classes/java/lang/Class.java >>> @@ -565,8 +565,9 @@ >>> * represented by this object. >>> */ >>> public String getName() { >>> + String name = this.name; >>> if (name == null) >>> - name = getName0(); >>> + this.name = name = getName0(); >>> return name; >>> } >>> >>> Martin >>> >>> >> Hello. >> >> The change looks fine to me. Do you want a bug filed, etc.? >> > > Yup. I will commit as soon as I get a bug + synopsis. > 6881442 (reflect) Race condition in Class.getName() -Joe From gokdogan at gmail.com Sat Sep 12 10:20:03 2009 From: gokdogan at gmail.com (Goktug Gokdogan) Date: Sat, 12 Sep 2009 13:20:03 +0300 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <108fcdeb0909091625h5cc8c370t5d0a16445d7eb46a@mail.gmail.com> References: <4AA812D0.309@sun.com> <17c6771e0909091422n57ed252bh4749571a07d2dd41@mail.gmail.com> <108fcdeb0909091625h5cc8c370t5d0a16445d7eb46a@mail.gmail.com> Message-ID: Similarly, I've previously written reflection-based #clone, #equals, and #fillRandomData methods working on POJOs. They were useful especially in testing the data binding codes, ie. X original = new X();, fillRandomData(original); mapper.toGUI( clone(original) ); //Clone object so original data can not be modified X rv = new X(); mapper.fromGUI(rv); assertTrue( equals(original, rv) ); But I can not imagine much use in a production code. If other use cases can be suggested, we could consider putting into Objects class. On Thu, Sep 10, 2009 at 2:25 AM, Kevin Bourrillion wrote: > -1 on reflection-based stuff in the Objects class. > > equal() and hashCode() are the only two things we saw fit to include in our > Objects class, and actually, our hashCode() is identical to > Arrays.hashCode() (but is varargs). > > > http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Objects.html > > Please do add the compare() methods to all the rest of the wrapper types; > we would use those a lot. > > When it comes to cloning, I tried very hard once to provide something > useful -- a "clone any object without knowing its concrete type" method -- > and it was a disaster. A total mess of reflection, and no one wanted to use > it anyway. Cloning in Java is discredited. > > So I'm left with only equal() for your new Objects class. By the way, the > best implementation is a == b || (a != null && a.equals(b)). > > > > > On Wed, Sep 9, 2009 at 2:22 PM, Andrew John Hughes < > gnu_andrew at member.fsf.org> wrote: > >> 2009/9/9 Joe Darcy : >> > Hello. >> > >> > For JDK 7, I think it is high-time the platform included a class like >> > java.util.Objects to hold commonly-written utility methods. For >> example, a >> > two-argument static equals method that returned true if both arguments >> are >> > null, returns false is one argument is null, and otherwise returns the >> > result of calling arg1.equals(arg2) (6797535 "Add shared two argument >> > static equals method to the platform"). >> > >> > A static hashCode method returning 0 for null and the value of >> > arg.hashCode() has also been suggested. >> > >> > A set of >> > >> > static int compareTo(int, int) >> > static int compareTo(long, long) >> > .... >> > >> > methods probably belongs somewhere in the platform too. >> > >> > What other utility methods would have broad enough use and applicability >> to >> > go into a common java.util class? >> > >> > -Joe >> > >> >> Given you've listed utility methods for two Object methods, equals and >> hashCode, toString seems an obvious one to handle as well: >> >> public static String toString(Object o) >> throws IllegalAccessException >> { >> Class c = o.getClass(); >> StringBuilder b = new StringBuilder(c.getName()); >> b.append("["); >> for (Field f : c.getDeclaredFields()) >> { >> f.setAccessible(true); >> b.append(f.getName() + "=" + f.get()); >> b.append(","); >> } >> b.replace(b.length() - 1, b.length(), "]"); >> return b.toString(); >> } >> >> Maybe there's also a useful utility implementation of clone too, but I >> can't think of one offhand. >> -- >> Andrew :-) >> >> Free Java Software Engineer >> Red Hat, Inc. (http://www.redhat.com) >> >> Support Free Java! >> Contribute to GNU Classpath and the OpenJDK >> http://www.gnu.org/software/classpath >> http://openjdk.java.net >> >> PGP Key: 94EFD9D8 (http://subkeys.pgp.net) >> Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 >> > > > > -- > Kevin Bourrillion @ Google > internal: http://go/javalibraries > google-collections.googlecode.com > google-guice.googlecode.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gokdogan at gmail.com Sat Sep 12 11:43:24 2009 From: gokdogan at gmail.com (Goktug Gokdogan) Date: Sat, 12 Sep 2009 14:43:24 +0300 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA5E4D.6050909@mail.ru> References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> <4AAA54E4.7090107@gmx.de> <4AAA5E4D.6050909@mail.ru> Message-ID: My absolutely non-scientific preliminary tests indicate Arrays.sort performs better with the same input (5000 items) in nearly all runs (-client). public static void main(String[] args) { final int n = 5000; int[] array = new int[n]; int[] array2 = new int[n]; Random random = new Random(); for (int i = 0; i < n; i++) { int r = random.nextInt(n); array[i] = r; array2[i] = r; } long st1 = System.nanoTime(); Arrays.sort(array2); long st2 = System.nanoTime(); DualPivotQuicksort.sort(array); long end = System.nanoTime(); System.out.println(st2 - st1); System.out.println(end - st2); } I tried changing which sort runs first, but the results did not change. Over 100.000 items, dual-pivot consistently beats Arrays.sort. Well, this test is not a good reference though :) On Fri, Sep 11, 2009 at 5:27 PM, Vladimir Iaroslavski wrote: > Hi, > > I've tried to use local variable int ak = a[k] in the loop > and not found saving of time. There are 3 occurrences of a[k] > in each loop, but only two can be changed because third > comes after line: swap(a, k, great--); > > As summary: I'm changing only hardcoded constant by > private static final variables. > > Thank you, > Vladimir > > > Ulf Zibis wrote: > >> Am 11.09.2009 15:32, R?mi Forax schrieb: >> >>> just my two cents : >>> In the loop tagged "sorting" and "equals element", >>> a[k] can be stored in a local variable to avoid to recompute it several >>> time. >>> >> >> I add 2 cents more: >> Doesn't HotSpot see this, and optimize accordingly? >> IMO: It's time that javac should do such optimization, as there are less >> optimized VM's in the world. >> >> -Ulf >> >> >> >>> The algorithm use two constants: 37 and 13, >>> I think they should be declared as private static final. >>> >>> R?mi >>> >>> >>> Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >>> >>>> Hello All, >>>> >>>> I'd like to share with you new Dual-Pivot Quicksort which is >>>> faster than the known implementations (theoretically and >>>> experimental). I'd like to propose to replace the JDK's >>>> Quicksort implementation by new one. >>>> >>>> Description >>>> ----------- >>>> The classical Quicksort algorithm uses the following scheme: >>>> >>>> 1. Pick an element P, called a pivot, from the array. >>>> 2. Reorder the array so that all elements, which are less than >>>> the pivot, come before the pivot and all elements greater than >>>> the pivot come after it (equal values can go either way). After >>>> this partitioning, the pivot element is in its final position. >>>> 3. Recursively sort the sub-array of lesser elements and the >>>> sub-array of greater elements. >>>> >>>> The invariant of classical Quicksort is: >>>> >>>> [ <= p | >= p ] >>>> >>>> There are several modifications of the schema: >>>> >>>> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >>>> >>>> But all of them use *one* pivot. >>>> >>>> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >>>> >>>> 1. Pick an elements P1, P2, called pivots from the array. >>>> 2. Assume that P1 <= P2, otherwise swap it. >>>> 3. Reorder the array into three parts: those less than the smaller >>>> pivot, those larger than the larger pivot, and in between are >>>> those elements between (or equal to) the two pivots. >>>> 4. Recursively sort the sub-arrays. >>>> >>>> The invariant of the Dual-Pivot Quicksort is: >>>> >>>> [ < P1 | P1 <= & <= P2 } > P2 ] >>>> >>>> The new Quicksort is faster than current implementation of Quicksort >>>> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >>>> >>>> The full description of the Dual-Pivot Quicksort you can find >>>> on my page: http://iaroslavski.narod.ru/quicksort >>>> >>>> Performance tests >>>> ----------------- >>>> Here is result of running on different types of input data: >>>> >>>> Client VM all 85% organ 0..1 0..4 >>>> random ascend descend equal equal pipes random 010101 >>>> random >>>> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >>>> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 >>>> >>>> Server VM all 85% organ 0..1 0..4 >>>> random ascend descend equal equal pipes random 010101 >>>> random >>>> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >>>> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 >>>> >>>> The a lot of other tests have been run under client and server mode. >>>> The most interesting is BentleyBasher test framework. It runs battery >>>> of tests for all cases: >>>> >>>> { 100, 1000, 10000, 1000000 } x >>>> { sawtooth, rand, stagger, plateau, shuffle } x >>>> { ident, reverse, reverse_front, reverse_back, sort, dither} >>>> >>>> where >>>> >>>> 100, ... , 1000000 - array length >>>> >>>> sawtooth: x[i] =i%m >>>> rand: x[i] = rand() % m >>>> stagger: x[i] = (i*m + i) % n >>>> plateau: x[i] = min(i, m) >>>> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >>>> >>>> ident(x) - a copy of x >>>> reverse(x, 0, n) - reversed copy >>>> reverse_front(x, 0, n/2) - front half reversed >>>> reverse_back(x, n/2, n) - back half reversed >>>> sort(x) - an ordered copy >>>> dither(x) - add i%5 to x[i] >>>> >>>> Here is the result of execution: >>>> Server VM: >>>> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >>>> Client VM: >>>> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >>>> >>>> Mathematical investigations >>>> --------------------------- >>>> It is proved that for the Dual-Pivot Quicksort the average number of >>>> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >>>> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >>>> respectively. Full mathematical proof see in attached proof.txt >>>> and proof_add.txt files. Theoretical results are also confirmed >>>> by experimental counting of the operations. >>>> >>>> Diff between current and new implementation of Quicksort >>>> -------------------------------------------------------- >>>> >>>> Here is the link to the diff for java.util.Arrays class: >>>> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >>>> >>>> If you like to look and play with new algorithm, >>>> please, take attached class DualPivotQuicksort.java >>>> >>>> Feedback >>>> -------- >>>> >>>> Also I'd like to share a feedback from Joshua Bloch and >>>> Jon Bentley who spent a lot of time investigating this >>>> algorithm, who gave me many advices and tips how to >>>> make new Quicksort better. >>>> >>>> -------- Original Message -------- >>>> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >>>> Date: Thu, 10 Sep 2009 07:20:11 -0700 >>>> From: Joshua Bloch >>>> >>>> Jon also says that Vladimir should make every reasonable improvement to >>>> the basic method before checking in the code. In his words, "It would be >>>> horrible to put the new code into the library, and then have someone >>>> else come along and speed it up by another 20% by using standard >>>> techniques." I believe it's not unlikely that this code may end up >>>> getting ported to many languages and widely deployed in much the manner >>>> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >>>> in the field). Jon will help Vladimir do this. >>>> >>>> -------- Original Message -------- >>>> Subject: Dual-Pivot Quicksort: Next Steps >>>> Date: Wed, 09 Sep 2009 15:02:25 -0400 >>>> From: Jon Bentley >>>> >>>> Vladimir, Josh, >>>> I *finally* feel like I understand what is going on. Now that I >>>> (think that) I see it, it seems straightforward and obvious. >>>> Tony Hoare developed Quicksort in the early 1960s. I was very >>>> proud to make minor contributions to a particularly clean (binary) >>>> quicksort in the mid 1980s, to a relatively straightforward, industrial >>>> strength Quicksort with McIlroy in the early 1990s, and then to >>>> algorithms and data structures for strings with Sedgewick in the mid >>>> 1990s. >>>> I think that Vladimir's contributions to Quicksort go way beyond >>>> anything that I've ever done, and rank up there with Hoare's original >>>> design and Sedgewick's analysis. I feel so privileged to play a very, >>>> very minor role in helping Vladimir with the most excellent work! >>>> >>>> ----------------------------------------------- >>>> >>>> Let me know, if you have any questions/comments. >>>> >>>> Thank you, >>>> Vladimir >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From gokdogan at gmail.com Sat Sep 12 12:13:17 2009 From: gokdogan at gmail.com (Goktug Gokdogan) Date: Sat, 12 Sep 2009 15:13:17 +0300 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> <4AAA54E4.7090107@gmx.de> <4AAA5E4D.6050909@mail.ru> Message-ID: Sorry :( . Please ignore previous post. Warming-up yield to better results in dual-pivot's favor. On Sat, Sep 12, 2009 at 2:43 PM, Goktug Gokdogan wrote: > My absolutely non-scientific preliminary tests indicate Arrays.sort > performs better with the same input (5000 items) in nearly all runs > (-client). > public static void main(String[] args) { > final int n = 5000; > int[] array = new int[n]; > int[] array2 = new int[n]; > Random random = new Random(); > for (int i = 0; i < n; i++) { > int r = random.nextInt(n); > array[i] = r; > array2[i] = r; > } > > long st1 = System.nanoTime(); > Arrays.sort(array2); > long st2 = System.nanoTime(); > DualPivotQuicksort.sort(array); > long end = System.nanoTime(); > System.out.println(st2 - st1); > System.out.println(end - st2); > } > > I tried changing which sort runs first, but the results did not change. > Over 100.000 items, dual-pivot consistently beats Arrays.sort. > > Well, this test is not a good reference though :) > > On Fri, Sep 11, 2009 at 5:27 PM, Vladimir Iaroslavski > wrote: > >> Hi, >> >> I've tried to use local variable int ak = a[k] in the loop >> and not found saving of time. There are 3 occurrences of a[k] >> in each loop, but only two can be changed because third >> comes after line: swap(a, k, great--); >> >> As summary: I'm changing only hardcoded constant by >> private static final variables. >> >> Thank you, >> Vladimir >> >> >> Ulf Zibis wrote: >> >>> Am 11.09.2009 15:32, R?mi Forax schrieb: >>> >>>> just my two cents : >>>> In the loop tagged "sorting" and "equals element", >>>> a[k] can be stored in a local variable to avoid to recompute it several >>>> time. >>>> >>> >>> I add 2 cents more: >>> Doesn't HotSpot see this, and optimize accordingly? >>> IMO: It's time that javac should do such optimization, as there are less >>> optimized VM's in the world. >>> >>> -Ulf >>> >>> >>> >>>> The algorithm use two constants: 37 and 13, >>>> I think they should be declared as private static final. >>>> >>>> R?mi >>>> >>>> >>>> Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >>>> >>>>> Hello All, >>>>> >>>>> I'd like to share with you new Dual-Pivot Quicksort which is >>>>> faster than the known implementations (theoretically and >>>>> experimental). I'd like to propose to replace the JDK's >>>>> Quicksort implementation by new one. >>>>> >>>>> Description >>>>> ----------- >>>>> The classical Quicksort algorithm uses the following scheme: >>>>> >>>>> 1. Pick an element P, called a pivot, from the array. >>>>> 2. Reorder the array so that all elements, which are less than >>>>> the pivot, come before the pivot and all elements greater than >>>>> the pivot come after it (equal values can go either way). After >>>>> this partitioning, the pivot element is in its final position. >>>>> 3. Recursively sort the sub-array of lesser elements and the >>>>> sub-array of greater elements. >>>>> >>>>> The invariant of classical Quicksort is: >>>>> >>>>> [ <= p | >= p ] >>>>> >>>>> There are several modifications of the schema: >>>>> >>>>> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >>>>> >>>>> But all of them use *one* pivot. >>>>> >>>>> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >>>>> >>>>> 1. Pick an elements P1, P2, called pivots from the array. >>>>> 2. Assume that P1 <= P2, otherwise swap it. >>>>> 3. Reorder the array into three parts: those less than the smaller >>>>> pivot, those larger than the larger pivot, and in between are >>>>> those elements between (or equal to) the two pivots. >>>>> 4. Recursively sort the sub-arrays. >>>>> >>>>> The invariant of the Dual-Pivot Quicksort is: >>>>> >>>>> [ < P1 | P1 <= & <= P2 } > P2 ] >>>>> >>>>> The new Quicksort is faster than current implementation of Quicksort >>>>> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >>>>> >>>>> The full description of the Dual-Pivot Quicksort you can find >>>>> on my page: http://iaroslavski.narod.ru/quicksort >>>>> >>>>> Performance tests >>>>> ----------------- >>>>> Here is result of running on different types of input data: >>>>> >>>>> Client VM all 85% organ 0..1 >>>>> 0..4 >>>>> random ascend descend equal equal pipes random 010101 >>>>> random >>>>> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 >>>>> 2.18 >>>>> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 >>>>> 2.49 >>>>> >>>>> Server VM all 85% organ 0..1 >>>>> 0..4 >>>>> random ascend descend equal equal pipes random 010101 >>>>> random >>>>> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 >>>>> 3.41 >>>>> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 >>>>> 3.39 >>>>> >>>>> The a lot of other tests have been run under client and server mode. >>>>> The most interesting is BentleyBasher test framework. It runs battery >>>>> of tests for all cases: >>>>> >>>>> { 100, 1000, 10000, 1000000 } x >>>>> { sawtooth, rand, stagger, plateau, shuffle } x >>>>> { ident, reverse, reverse_front, reverse_back, sort, dither} >>>>> >>>>> where >>>>> >>>>> 100, ... , 1000000 - array length >>>>> >>>>> sawtooth: x[i] =i%m >>>>> rand: x[i] = rand() % m >>>>> stagger: x[i] = (i*m + i) % n >>>>> plateau: x[i] = min(i, m) >>>>> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >>>>> >>>>> ident(x) - a copy of x >>>>> reverse(x, 0, n) - reversed copy >>>>> reverse_front(x, 0, n/2) - front half reversed >>>>> reverse_back(x, n/2, n) - back half reversed >>>>> sort(x) - an ordered copy >>>>> dither(x) - add i%5 to x[i] >>>>> >>>>> Here is the result of execution: >>>>> Server VM: >>>>> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >>>>> Client VM: >>>>> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >>>>> >>>>> Mathematical investigations >>>>> --------------------------- >>>>> It is proved that for the Dual-Pivot Quicksort the average number of >>>>> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >>>>> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >>>>> respectively. Full mathematical proof see in attached proof.txt >>>>> and proof_add.txt files. Theoretical results are also confirmed >>>>> by experimental counting of the operations. >>>>> >>>>> Diff between current and new implementation of Quicksort >>>>> -------------------------------------------------------- >>>>> >>>>> Here is the link to the diff for java.util.Arrays class: >>>>> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >>>>> >>>>> If you like to look and play with new algorithm, >>>>> please, take attached class DualPivotQuicksort.java >>>>> >>>>> Feedback >>>>> -------- >>>>> >>>>> Also I'd like to share a feedback from Joshua Bloch and >>>>> Jon Bentley who spent a lot of time investigating this >>>>> algorithm, who gave me many advices and tips how to >>>>> make new Quicksort better. >>>>> >>>>> -------- Original Message -------- >>>>> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >>>>> Date: Thu, 10 Sep 2009 07:20:11 -0700 >>>>> From: Joshua Bloch >>>>> >>>>> Jon also says that Vladimir should make every reasonable improvement to >>>>> the basic method before checking in the code. In his words, "It would >>>>> be >>>>> horrible to put the new code into the library, and then have someone >>>>> else come along and speed it up by another 20% by using standard >>>>> techniques." I believe it's not unlikely that this code may end up >>>>> getting ported to many languages and widely deployed in much the manner >>>>> of Bentley and McIlroy's fine sort (which is nearing 20 successful >>>>> years >>>>> in the field). Jon will help Vladimir do this. >>>>> >>>>> -------- Original Message -------- >>>>> Subject: Dual-Pivot Quicksort: Next Steps >>>>> Date: Wed, 09 Sep 2009 15:02:25 -0400 >>>>> From: Jon Bentley >>>>> >>>>> Vladimir, Josh, >>>>> I *finally* feel like I understand what is going on. Now that I >>>>> (think that) I see it, it seems straightforward and obvious. >>>>> Tony Hoare developed Quicksort in the early 1960s. I was very >>>>> proud to make minor contributions to a particularly clean (binary) >>>>> quicksort in the mid 1980s, to a relatively straightforward, industrial >>>>> strength Quicksort with McIlroy in the early 1990s, and then to >>>>> algorithms and data structures for strings with Sedgewick in the mid >>>>> 1990s. >>>>> I think that Vladimir's contributions to Quicksort go way beyond >>>>> anything that I've ever done, and rank up there with Hoare's original >>>>> design and Sedgewick's analysis. I feel so privileged to play a very, >>>>> very minor role in helping Vladimir with the most excellent work! >>>>> >>>>> ----------------------------------------------- >>>>> >>>>> Let me know, if you have any questions/comments. >>>>> >>>>> Thank you, >>>>> Vladimir >>>>> >>>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gokdogan at gmail.com Sat Sep 12 16:22:41 2009 From: gokdogan at gmail.com (Goktug Gokdogan) Date: Sat, 12 Sep 2009 19:22:41 +0300 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot In-Reply-To: References: Message-ID: In fact, at first I intentionally skipped the warming-up code, thinking that use of non-jvm optimized code could give some idea if more fine-tuning required in the implementation. Then I realized that results also includes the class loading times :(. So I added code that will just load classes by sorting an empty array. After change Array.sort was still giving competitive results at 1000 items. (points to my previous theory about fine-tuning?) Finally, I decided give the code into hot-spots ingenious hands, dual-pivot sorted 5000 items in about %35 shorter times.Good job! 2009/9/12 Vladimir Iaroslavski > Hello, > > As you mentioned, warm up is needed. > Add just several lines as here: > ... > Random random = new Random(); > > DualPivotQuicksort.sort(array); > DualPivotQuicksort.sort(array); > Arrays.sort(array2); > Arrays.sort(array2); > > for (int i = 0; i < n; i++) { > int r = random.nextInt(n); > array[i] = r; > array2[i] = r; > } > ... > after that I see ratio of time: > > 943761 - Arrays > 534816 - DualPivotQuicksort > > do you? > > In original your version where you have only one call > of Quicksorts, a lot of time is spent for loading classes. > > And I also note that it is better to run algorithms many times > (say, 50-100 times) and take average (or minimum) time. > > Thank you, > Vladimir > > P.S. Benchmarking in Java is "Dark Art" > > -----Original Message----- > From: Goktug Gokdogan > To: Vladimir Iaroslavski > Date: Sat, 12 Sep 2009 15:13:17 +0300 > Subject: Re: Replacement of Quicksort in java.util.Arrays with new > Dual-Pivot > Quicksort > > > Sorry :( . Please ignore previous post. Warming-up yield to better > results > > in dual-pivot's favor. > > > > On Sat, Sep 12, 2009 at 2:43 PM, Goktug Gokdogan > wrote: > > > > > My absolutely non-scientific preliminary tests indicate Arrays.sort > > > performs better with the same input (5000 items) in nearly all runs > > > (-client). > > > public static void main(String[] args) { > > > final int n = 5000; > > > int[] array = new int[n]; > > > int[] array2 = new int[n]; > > > Random random = new Random(); > > > for (int i = 0; i < n; i++) { > > > int r = random.nextInt(n); > > > array[i] = r; > > > array2[i] = r; > > > } > > > > > > long st1 = System.nanoTime(); > > > Arrays.sort(array2); > > > long st2 = System.nanoTime(); > > > DualPivotQuicksort.sort(array); > > > long end = System.nanoTime(); > > > System.out.println(st2 - st1); > > > System.out.println(end - st2); > > > } > > > > > > I tried changing which sort runs first, but the results did not change. > > > Over 100.000 items, dual-pivot consistently beats Arrays.sort. > > > > > > Well, this test is not a good reference though :) > > > > > > On Fri, Sep 11, 2009 at 5:27 PM, Vladimir Iaroslavski < > iaroslavski at mail.ru > > > > wrote: > > > > > >> Hi, > > >> > > >> I've tried to use local variable int ak = a[k] in the loop > > >> and not found saving of time. There are 3 occurrences of a[k] > > >> in each loop, but only two can be changed because third > > >> comes after line: swap(a, k, great--); > > >> > > >> As summary: I'm changing only hardcoded constant by > > >> private static final variables. > > >> > > >> Thank you, > > >> Vladimir > > >> > > >> Ulf Zibis wrote: > > >> > > >>> Am 11.09.2009 15:32, R?mi Forax schrieb: > > >>> > > >>>> just my two cents : > > >>>> In the loop tagged "sorting" and "equals element", > > >>>> a[k] can be stored in a local variable to avoid to recompute it > several > > >>>> time. > > >>> > > >>> I add 2 cents more: > > >>> Doesn't HotSpot see this, and optimize accordingly? > > >>> IMO: It's time that javac should do such optimization, as there are > less > > >>> optimized VM's in the world. > > >>> > > >>> -Ulf > > >>> > > >>>> The algorithm use two constants: 37 and 13, > > >>>> I think they should be declared as private static final. > > >>>> > > >>>> R?mi > > >>>> > > >>>> Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : > > >>>> > > >>>>> Hello All, > > >>>>> > > >>>>> I'd like to share with you new Dual-Pivot Quicksort which is > > >>>>> faster than the known implementations (theoretically and > > >>>>> experimental). I'd like to propose to replace the JDK's > > >>>>> Quicksort implementation by new one. > > >>>>> > > >>>>> Description > > >>>>> ----------- > > >>>>> The classical Quicksort algorithm uses the following scheme: > > >>>>> > > >>>>> 1. Pick an element P, called a pivot, from the array. > > >>>>> 2. Reorder the array so that all elements, which are less than > > >>>>> the pivot, come before the pivot and all elements greater than > > >>>>> the pivot come after it (equal values can go either way). After > > >>>>> this partitioning, the pivot element is in its final position. > > >>>>> 3. Recursively sort the sub-array of lesser elements and the > > >>>>> sub-array of greater elements. > > >>>>> > > >>>>> The invariant of classical Quicksort is: > > >>>>> > > >>>>> [ <= p | >= p ] > > >>>>> > > >>>>> There are several modifications of the schema: > > >>>>> > > >>>>> [ < p | = p | > p ] or [ = p | < p | > p | = p ] > > >>>>> > > >>>>> But all of them use *one* pivot. > > >>>>> > > >>>>> The new Dual-Pivot Quicksort uses *two* pivots elements in this > manner: > > >>>>> > > >>>>> 1. Pick an elements P1, P2, called pivots from the array. > > >>>>> 2. Assume that P1 <= P2, otherwise swap it. > > >>>>> 3. Reorder the array into three parts: those less than the smaller > > >>>>> pivot, those larger than the larger pivot, and in between are > > >>>>> those elements between (or equal to) the two pivots. > > >>>>> 4. Recursively sort the sub-arrays. > > >>>>> > > >>>>> The invariant of the Dual-Pivot Quicksort is: > > >>>>> > > >>>>> [ < P1 | P1 <= & <= P2 } > P2 ] > > >>>>> > > >>>>> The new Quicksort is faster than current implementation of > Quicksort > > >>>>> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. > > >>>>> > > >>>>> The full description of the Dual-Pivot Quicksort you can find > > >>>>> on my page: http://iaroslavski.narod.ru/quicksort > > >>>>> > > >>>>> Performance tests > > >>>>> ----------------- > > >>>>> Here is result of running on different types of input data: > > >>>>> > > >>>>> Client VM all 85% organ 0..1 > > >>>>> 0..4 > > >>>>> random ascend descend equal equal pipes random 010101 > > >>>>> random > > >>>>> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 > > >>>>> 2.18 > > >>>>> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 > > >>>>> 2.49 > > >>>>> > > >>>>> Server VM all 85% organ 0..1 > > >>>>> 0..4 > > >>>>> random ascend descend equal equal pipes random 010101 > > >>>>> random > > >>>>> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 > > >>>>> 3.41 > > >>>>> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 > > >>>>> 3.39 > > >>>>> > > >>>>> The a lot of other tests have been run under client and server > mode. > > >>>>> The most interesting is BentleyBasher test framework. It runs > battery > > >>>>> of tests for all cases: > > >>>>> > > >>>>> { 100, 1000, 10000, 1000000 } x > > >>>>> { sawtooth, rand, stagger, plateau, shuffle } x > > >>>>> { ident, reverse, reverse_front, reverse_back, sort, dither} > > >>>>> > > >>>>> where > > >>>>> > > >>>>> 100, ... , 1000000 - array length > > >>>>> > > >>>>> sawtooth: x[i] =i%m > > >>>>> rand: x[i] = rand() % m > > >>>>> stagger: x[i] = (i*m + i) % n > > >>>>> plateau: x[i] = min(i, m) > > >>>>> shuffle: x[i] = rand()%m? (j+=2): (k+=2) > > >>>>> > > >>>>> ident(x) - a copy of x > > >>>>> reverse(x, 0, n) - reversed copy > > >>>>> reverse_front(x, 0, n/2) - front half reversed > > >>>>> reverse_back(x, n/2, n) - back half reversed > > >>>>> sort(x) - an ordered copy > > >>>>> dither(x) - add i%5 to x[i] > > >>>>> > > >>>>> Here is the result of execution: > > >>>>> Server VM: > > >>>>> > http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html > > >>>>> Client VM: > > >>>>> > http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html > > >>>>> > > >>>>> Mathematical investigations > > >>>>> --------------------------- > > >>>>> It is proved that for the Dual-Pivot Quicksort the average number > of > > >>>>> comparisons is 2*n*ln(n), the average number of swaps is > 0.8*n*ln(n), > > >>>>> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) > > >>>>> respectively. Full mathematical proof see in attached proof.txt > > >>>>> and proof_add.txt files. Theoretical results are also confirmed > > >>>>> by experimental counting of the operations. > > >>>>> > > >>>>> Diff between current and new implementation of Quicksort > > >>>>> -------------------------------------------------------- > > >>>>> > > >>>>> Here is the link to the diff for java.util.Arrays class: > > >>>>> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 > > >>>>> > > >>>>> If you like to look and play with new algorithm, > > >>>>> please, take attached class DualPivotQuicksort.java > > >>>>> > > >>>>> Feedback > > >>>>> -------- > > >>>>> > > >>>>> Also I'd like to share a feedback from Joshua Bloch and > > >>>>> Jon Bentley who spent a lot of time investigating this > > >>>>> algorithm, who gave me many advices and tips how to > > >>>>> make new Quicksort better. > > >>>>> > > >>>>> -------- Original Message -------- > > >>>>> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 > > >>>>> Date: Thu, 10 Sep 2009 07:20:11 -0700 > > >>>>> From: Joshua Bloch > > >>>>> > > >>>>> Jon also says that Vladimir should make every reasonable > improvement to > > >>>>> the basic method before checking in the code. In his words, "It > would > > >>>>> be > > >>>>> horrible to put the new code into the library, and then have > someone > > >>>>> else come along and speed it up by another 20% by using standard > > >>>>> techniques." I believe it's not unlikely that this code may end up > > >>>>> getting ported to many languages and widely deployed in much the > manner > > >>>>> of Bentley and McIlroy's fine sort (which is nearing 20 successful > > >>>>> years > > >>>>> in the field). Jon will help Vladimir do this. > > >>>>> > > >>>>> -------- Original Message -------- > > >>>>> Subject: Dual-Pivot Quicksort: Next Steps > > >>>>> Date: Wed, 09 Sep 2009 15:02:25 -0400 > > >>>>> From: Jon Bentley > > >>>>> > > >>>>> Vladimir, Josh, > > >>>>> I *finally* feel like I understand what is going on. Now that > I > > >>>>> (think that) I see it, it seems straightforward and obvious. > > >>>>> Tony Hoare developed Quicksort in the early 1960s. I was very > > >>>>> proud to make minor contributions to a particularly clean (binary) > > >>>>> quicksort in the mid 1980s, to a relatively straightforward, > industrial > > >>>>> strength Quicksort with McIlroy in the early 1990s, and then to > > >>>>> algorithms and data structures for strings with Sedgewick in the > mid > > >>>>> 1990s. > > >>>>> I think that Vladimir's contributions to Quicksort go way > beyond > > >>>>> anything that I've ever done, and rank up there with Hoare's > original > > >>>>> design and Sedgewick's analysis. I feel so privileged to play a > very, > > >>>>> very minor role in helping Vladimir with the most excellent work! > > >>>>> > > >>>>> ----------------------------------------------- > > >>>>> > > >>>>> Let me know, if you have any questions/comments. > > >>>>> > > >>>>> Thank you, > > >>>>> Vladimir > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jjb at google.com Sat Sep 12 18:52:12 2009 From: jjb at google.com (Joshua Bloch) Date: Sat, 12 Sep 2009 11:52:12 -0700 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA27EA.8090902@Sun.COM> References: <4AAA27EA.8090902@Sun.COM> Message-ID: <17b2302a0909121152v421611a8l4a3d25357991bb0e@mail.gmail.com> To amplify my previous statement, I think this is a great piece of work! Vladimir is to be commended. I also think that it may well get substantially faster as Vladimir continues to make minor algorithmic modifications. Jon Bentley has made many fine suggestions that Vladimir will try out.There are also some lower-level performance tweaks that may well yield improved performance (e.g., eliminate the div parameter from dualPivotQuicksort, eliminate the division from algorithm). It is, of course, possible that this performance work won't yield significant benefits, but I suspect otherwise. Josh P.S. When all of this is done, the code could use some minor reformatting to match JDK standards, but I wouldn't worry about this until the performance work is done. -------------- next part -------------- An HTML attachment was scrubbed... URL: From martinrb at google.com Sat Sep 12 21:45:20 2009 From: martinrb at google.com (Martin Buchholz) Date: Sat, 12 Sep 2009 14:45:20 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AAAD99A.4050505@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> Message-ID: <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> On Fri, Sep 11, 2009 at 16:13, Xueming Shen wrote: > > I'm definitely open for any better choice, I'm not in hurry to close this > one up. Sure, I hope we can > reach a consensus before I go on vacation this weekend:-) > > So here is the planB alan is proposing, no API doc added yet, but you should > know what it means. I will add the doc > in later if we agree on this approach. > > http://cr.openjdk.java.net/~sherman/zipflush/webrev.planB/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html I vote for this approach - i.e. plan B as proposed by Alan. I no longer advocate making partial flush the default, as a result of my own arguments for the other side. The use case for full flush is partial recoverability from future corruption of the data. If the competing java zib libraries are supporting this flush variant, we probably should too, for completeness. David wrote: > This is not unusual in the JDK or elsewhere - that a stream calls the underlying stream's flush() method I mean - and I think in the (unlikely) event that someone wants to flush the underlying stream only, they could simply call .flush() directly on that stream. David: In this case the deflater is not an "underlying stream", and the proposal was to have flush() change the nature of the bytes written, while normally OutputStream.flush merely causes the same bytes to be written more promptly. Martin "Every change is an incompatible change" > > We probably should figure out want to do with the GZipOutputStream...it > probably needs something as well...we can figure > out it later. > > So, Martin, Brandon, David and anyone interested, > > Is this something you guys can accept ? It makes the life easy for developer > that needs the sync_flush for the flush(), > you don't need to override/subclass anything, just makes it clear what you > want when creating the DOS by picking > the appropriate constructor, nothing more. Since we keep the default > behavior un-changed, it is also compatible:-) > > It does not add the the full_sync, sure we can consider to use a enum > instead of the boolean parameter, but since > no one is asking for it now and the enum looks a little "too modern" > compared to the rest of the API, we might > want to stay with the simple "boolean doSyncFlush". > > Opinion? > > sherman > > Funny, I was "beaten up" today for one of my other changes, I was literally > asked "where was it documented/highlighted > that this fix was going to introduce an incompatibility", for a much much > "less" incompatible change:-) > > > Alan Bateman wrote: >> >> Xueming Shen wrote: >>> >>> I think we have enough discussion on this topic, it's time to make a >>> final decision. Seems like we are all happy on the >>> changes in Deflater and new DOS.flush(mode), the only difference is >>> whether or not we should change the existing >>> behavior of DOS.flush() should use Z_SYNC_FLUSH by default. >>> >>> Brandon is very firm on the "yes" side, strongly believe this is a MUST. >>> Martin is on the fence, leaning towards "yes" >>> Sherman is on the "no" side >>> >>> So if there is no other vote coming with strong opinion, your vote will >>> be important:-) Are you also leaning to "yes" >>> or "strongly" suggesting a yes? I need ?strong "yes" to change my mind. >> >> This is tough call. It is clearly desirable to change flush() to work the >> way that developers expect. On the other hand there is always risk with >> changing long-standing behavior. The risk here is probably low but it's >> impossible to quantify. Martin makes a good observation that it may cause >> problems for code that wraps the stream with an auto-flushing PrintStream or >> PrintWriter. You also made a good observation that just changing the number >> of bytes written could cause breakage (in some fragile environment) - we >> just don't know! So on balance, I think you are probably right to take the >> conservative line on this one. >> >> I know you've had enough discussion on this but I wonder if you might be >> open to considering new constructors for DeflaterOutputStream (and maybe >> GZIPOutputStream) as an alternative to the flush(int) method. This might fit >> better with this API, in particular for cases where the intended usage is >> known. It could be as simple as a "boolean syncFlush" parameter to indicate >> how uncompressed buffered bytes are handled when flushing (default to false >> for existing constructors so existing behavior preserved). ?The boolean >> parameter is just an opening bid - clearly there are alternatives. The point >> is that it makes it easy and more obvious as how to get a >> DeflaterOutputStream suitable for interactive cases. >> >> -Alan. > > From martinrb at google.com Sat Sep 12 22:32:32 2009 From: martinrb at google.com (martinrb at google.com) Date: Sat, 12 Sep 2009 22:32:32 +0000 Subject: hg: jdk7/tl/jdk: 6881442: (reflect) Race condition in Class.getName() Message-ID: <20090912223309.8736A12067@hg.openjdk.java.net> Changeset: 020a0fed38c9 Author: martin Date: 2009-09-12 15:30 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/020a0fed38c9 6881442: (reflect) Race condition in Class.getName() Summary: only read "name" field racily once Reviewed-by: darcy ! src/share/classes/java/lang/Class.java From Alan.Bateman at Sun.COM Sun Sep 13 08:07:15 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Sun, 13 Sep 2009 09:07:15 +0100 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4AAA9372.3070200@Sun.com> References: <4A9EC69F.6000509@sun.com> <4AAA9372.3070200@Sun.com> Message-ID: <4AACA833.9030204@sun.com> Mandy Chung wrote: > Alan, David, Remi, Iris, > > Thanks for the review and the revised webrev at: > http://cr.openjdk.java.net/~mchung/6878481/webrev.01/ > > I incorporate the comments you have and minimize the number of > System.nanoTime() calls and also remove the number of opened jars perf > counters. Please let me know if you have further comments. This looks much better, in particular the overhead in ClassLoader is much reduced. Also, I see you've removed the special counter for JAR files, which make sense. Minor nit but I assume you can initialize perf as: private static final Perf perf = AccessController.doPrivileged(new Perf.GetPerfAction()); Also minor nit: in the javadoc of the PerfCounter's public methods - I assume you meant to use /** instead of /*. Method naming is hard (and often subjective) but there are updates like this: PerfCounter.getParentDelegationTime.inc(t1 - t0); which might be easier to read as: PerfCounter.getParentDelegationCounter().addTime(t1 - t0) Also: PerfCounter.getZipFileCount().inc(); which might be cleaer as: PerfCounter.getZipFileCounter().increment(); Just a suggestion of course. Otherwise, looks okay to me and I'm looking forward to seeing the output once these changes are in. -Alan. From gokdogan at gmail.com Sun Sep 13 15:23:57 2009 From: gokdogan at gmail.com (Goktug Gokdogan) Date: Sun, 13 Sep 2009 18:23:57 +0300 Subject: Replacement of Quicksort in java.util.Arrays with new Dual-Pivot Quicksort In-Reply-To: <4AAA5E4D.6050909@mail.ru> References: <4AAA27EA.8090902@Sun.COM> <4AAA5158.8060202@univ-mlv.fr> <4AAA54E4.7090107@gmx.de> <4AAA5E4D.6050909@mail.ru> Message-ID: I reviewed the code. A few simple tricks helped me to speed-up code in my tests:1. Falling back-to insertion sort at <17 instead of <27 (JDK 6 Arrays.sort falls back <7) 2. (a[great] > pivot2) test is more likely to fail compared to (k < great) in the while loop, so exchange them (ie. use while (a[great] > pivot2 && k < great)). These two changes together improved performance around 4-5 percent in my laptop. Hopefully, I will dig algorithm further for other suggestions; if I can spare more time this week. Congratulations again for your algorithm! Goktug On Fri, Sep 11, 2009 at 5:27 PM, Vladimir Iaroslavski wrote: > Hi, > > I've tried to use local variable int ak = a[k] in the loop > and not found saving of time. There are 3 occurrences of a[k] > in each loop, but only two can be changed because third > comes after line: swap(a, k, great--); > > As summary: I'm changing only hardcoded constant by > private static final variables. > > Thank you, > Vladimir > > > Ulf Zibis wrote: > >> Am 11.09.2009 15:32, R?mi Forax schrieb: >> >>> just my two cents : >>> In the loop tagged "sorting" and "equals element", >>> a[k] can be stored in a local variable to avoid to recompute it several >>> time. >>> >> >> I add 2 cents more: >> Doesn't HotSpot see this, and optimize accordingly? >> IMO: It's time that javac should do such optimization, as there are less >> optimized VM's in the world. >> >> -Ulf >> >> >> >>> The algorithm use two constants: 37 and 13, >>> I think they should be declared as private static final. >>> >>> R?mi >>> >>> >>> Le 11/09/2009 12:35, Vladimir Yaroslavskiy a ?crit : >>> >>>> Hello All, >>>> >>>> I'd like to share with you new Dual-Pivot Quicksort which is >>>> faster than the known implementations (theoretically and >>>> experimental). I'd like to propose to replace the JDK's >>>> Quicksort implementation by new one. >>>> >>>> Description >>>> ----------- >>>> The classical Quicksort algorithm uses the following scheme: >>>> >>>> 1. Pick an element P, called a pivot, from the array. >>>> 2. Reorder the array so that all elements, which are less than >>>> the pivot, come before the pivot and all elements greater than >>>> the pivot come after it (equal values can go either way). After >>>> this partitioning, the pivot element is in its final position. >>>> 3. Recursively sort the sub-array of lesser elements and the >>>> sub-array of greater elements. >>>> >>>> The invariant of classical Quicksort is: >>>> >>>> [ <= p | >= p ] >>>> >>>> There are several modifications of the schema: >>>> >>>> [ < p | = p | > p ] or [ = p | < p | > p | = p ] >>>> >>>> But all of them use *one* pivot. >>>> >>>> The new Dual-Pivot Quicksort uses *two* pivots elements in this manner: >>>> >>>> 1. Pick an elements P1, P2, called pivots from the array. >>>> 2. Assume that P1 <= P2, otherwise swap it. >>>> 3. Reorder the array into three parts: those less than the smaller >>>> pivot, those larger than the larger pivot, and in between are >>>> those elements between (or equal to) the two pivots. >>>> 4. Recursively sort the sub-arrays. >>>> >>>> The invariant of the Dual-Pivot Quicksort is: >>>> >>>> [ < P1 | P1 <= & <= P2 } > P2 ] >>>> >>>> The new Quicksort is faster than current implementation of Quicksort >>>> in JDK (L. Bentley and M. Douglas McIlroy) and classical Quicksort. >>>> >>>> The full description of the Dual-Pivot Quicksort you can find >>>> on my page: http://iaroslavski.narod.ru/quicksort >>>> >>>> Performance tests >>>> ----------------- >>>> Here is result of running on different types of input data: >>>> >>>> Client VM all 85% organ 0..1 0..4 >>>> random ascend descend equal equal pipes random 010101 >>>> random >>>> Dual-Pivot: 16.83 5.31 5.47 0.35 0.68 10.59 1.06 1.02 2.18 >>>> Bentley's: 19.77 9.08 10.13 0.63 1.12 13.22 1.63 1.08 2.49 >>>> >>>> Server VM all 85% organ 0..1 0..4 >>>> random ascend descend equal equal pipes random 010101 >>>> random >>>> Dual-Pivot: 23.94 6.68 6.63 0.43 0.62 17.14 1.42 1.96 3.41 >>>> Bentley's: 25.20 10.18 10.32 2.07 1.33 16.72 2.95 1.82 3.39 >>>> >>>> The a lot of other tests have been run under client and server mode. >>>> The most interesting is BentleyBasher test framework. It runs battery >>>> of tests for all cases: >>>> >>>> { 100, 1000, 10000, 1000000 } x >>>> { sawtooth, rand, stagger, plateau, shuffle } x >>>> { ident, reverse, reverse_front, reverse_back, sort, dither} >>>> >>>> where >>>> >>>> 100, ... , 1000000 - array length >>>> >>>> sawtooth: x[i] =i%m >>>> rand: x[i] = rand() % m >>>> stagger: x[i] = (i*m + i) % n >>>> plateau: x[i] = min(i, m) >>>> shuffle: x[i] = rand()%m? (j+=2): (k+=2) >>>> >>>> ident(x) - a copy of x >>>> reverse(x, 0, n) - reversed copy >>>> reverse_front(x, 0, n/2) - front half reversed >>>> reverse_back(x, n/2, n) - back half reversed >>>> sort(x) - an ordered copy >>>> dither(x) - add i%5 to x[i] >>>> >>>> Here is the result of execution: >>>> Server VM: >>>> http://spreadsheets.google.com/pub?key=t_EAWUkQ4mD3BIbOv8Fa-AQ&output=html >>>> Client VM: >>>> http://spreadsheets.google.com/pub?key=tdiMo8xleTxd23nKUObcz0Q&single=true&gid=0&output=html >>>> >>>> Mathematical investigations >>>> --------------------------- >>>> It is proved that for the Dual-Pivot Quicksort the average number of >>>> comparisons is 2*n*ln(n), the average number of swaps is 0.8*n*ln(n), >>>> whereas classical Quicksort algorithm has 2*n*ln(n) and 1*n*ln(n) >>>> respectively. Full mathematical proof see in attached proof.txt >>>> and proof_add.txt files. Theoretical results are also confirmed >>>> by experimental counting of the operations. >>>> >>>> Diff between current and new implementation of Quicksort >>>> -------------------------------------------------------- >>>> >>>> Here is the link to the diff for java.util.Arrays class: >>>> http://cr.openjdk.java.net/~alanb/6880672/webrev.00 >>>> >>>> If you like to look and play with new algorithm, >>>> please, take attached class DualPivotQuicksort.java >>>> >>>> Feedback >>>> -------- >>>> >>>> Also I'd like to share a feedback from Joshua Bloch and >>>> Jon Bentley who spent a lot of time investigating this >>>> algorithm, who gave me many advices and tips how to >>>> make new Quicksort better. >>>> >>>> -------- Original Message -------- >>>> Subject: Re: Integration of new Dual-Pivot Quicksort into JDK 7 >>>> Date: Thu, 10 Sep 2009 07:20:11 -0700 >>>> From: Joshua Bloch >>>> >>>> Jon also says that Vladimir should make every reasonable improvement to >>>> the basic method before checking in the code. In his words, "It would be >>>> horrible to put the new code into the library, and then have someone >>>> else come along and speed it up by another 20% by using standard >>>> techniques." I believe it's not unlikely that this code may end up >>>> getting ported to many languages and widely deployed in much the manner >>>> of Bentley and McIlroy's fine sort (which is nearing 20 successful years >>>> in the field). Jon will help Vladimir do this. >>>> >>>> -------- Original Message -------- >>>> Subject: Dual-Pivot Quicksort: Next Steps >>>> Date: Wed, 09 Sep 2009 15:02:25 -0400 >>>> From: Jon Bentley >>>> >>>> Vladimir, Josh, >>>> I *finally* feel like I understand what is going on. Now that I >>>> (think that) I see it, it seems straightforward and obvious. >>>> Tony Hoare developed Quicksort in the early 1960s. I was very >>>> proud to make minor contributions to a particularly clean (binary) >>>> quicksort in the mid 1980s, to a relatively straightforward, industrial >>>> strength Quicksort with McIlroy in the early 1990s, and then to >>>> algorithms and data structures for strings with Sedgewick in the mid >>>> 1990s. >>>> I think that Vladimir's contributions to Quicksort go way beyond >>>> anything that I've ever done, and rank up there with Hoare's original >>>> design and Sedgewick's analysis. I feel so privileged to play a very, >>>> very minor role in helping Vladimir with the most excellent work! >>>> >>>> ----------------------------------------------- >>>> >>>> Let me know, if you have any questions/comments. >>>> >>>> Thank you, >>>> Vladimir >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.lloyd at redhat.com Sun Sep 13 15:49:50 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Sun, 13 Sep 2009 10:49:50 -0500 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> Message-ID: <4AAD149E.2020906@redhat.com> On 09/12/2009 04:45 PM, Martin Buchholz wrote: > On Fri, Sep 11, 2009 at 16:13, Xueming Shen wrote: > David wrote: >> This is not unusual in the JDK or elsewhere - that a stream calls the underlying stream's flush() method I mean - and I think in the (unlikely) event that someone wants to flush the underlying stream only, they could simply call .flush() directly on that stream. > > David: In this case the deflater is not an "underlying stream", and the proposal was to > have flush() change the nature of the bytes written, while normally OutputStream.flush merely causes > the same bytes to be written more promptly. In this paragraph I was referring to the real underlying OutputStream though, not the Deflater (afaict the existing implementation just calls through to the underlying stream currently). The second paragraph is where I talk about the Deflater. And anyway I change my vote from "yes-kinda-no-but-qualified-yes" in favor of the plan B patch which I like a lot. - DML From oleg.anashkin at gmail.com Sun Sep 13 16:32:09 2009 From: oleg.anashkin at gmail.com (Oleg Anashkin) Date: Sun, 13 Sep 2009 16:32:09 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with new =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ=?= References: <4AAA27EA.8090902@Sun.COM> Message-ID: Hello Vladimir, First thing that came to mind - have you thought about extrapolating this approach to more pivots? If 2-pivot algorithm is faster than 1-pivot, then 3-pivot might be even faster, right? Can the number of pivots be chosen as a function of array size (to mitigate overhead)? Thanks, Oleg From Alan.Bateman at Sun.COM Sun Sep 13 17:11:16 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Sun, 13 Sep 2009 18:11:16 +0100 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> Message-ID: <4AAD27B4.4040507@sun.com> Martin Buchholz wrote: > : > The use case for full flush is partial recoverability from future corruption > of the data. If the competing java zib libraries are supporting this > flush variant, > we probably should too, for completeness. > It's worth considering although we get into detail as to how the flush mode is expressed in the constructor (an int is awkward because of the existing size parameter, and java.util.zip was well into adolescence when enums were introduced). The other option is to just ignore it as the proposed Deflater.deflate method supports full flush and it's not too difficult to create your own OutputStream that uses Deflater. -Alan. From David.Holmes at Sun.COM Sun Sep 13 23:08:21 2009 From: David.Holmes at Sun.COM (David Holmes - Sun Microsystems) Date: Mon, 14 Sep 2009 09:08:21 +1000 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4AACA833.9030204@sun.com> References: <4A9EC69F.6000509@sun.com> <4AAA9372.3070200@Sun.com> <4AACA833.9030204@sun.com> Message-ID: <4AAD7B65.7010109@sun.com> Just to add 2c to Alan's method naming comments: Alan Bateman said the following on 09/13/09 18:07: > Method naming is hard (and often subjective) but there are updates like > this: > PerfCounter.getParentDelegationTime.inc(t1 - t0); > which might be easier to read as: > PerfCounter.getParentDelegationCounter().addTime(t1 - t0) There's always a problem with method naming when a thing can be both a counter and a time-tracker. I would agree to use context specific methods even at the expense of some redundancy in the public API eg: addTime(long interval) addElapsedTimeFrom(long startTime) > Also: > PerfCounter.getZipFileCount().inc(); > which might be cleaer as: > PerfCounter.getZipFileCounter().increment(); I'd also suggest (in a convention used elsewhere eg java.util.concurrent.atomic.*) that you reserve increment() for addition of 1 and use add(long val) for the general case. > Just a suggestion of course. Otherwise, looks okay to me and I'm looking > forward to seeing the output once these changes are in. Agreed - all looks good. Thanks, David From Mandy.Chung at Sun.COM Mon Sep 14 01:31:03 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Sun, 13 Sep 2009 18:31:03 -0700 Subject: Review Request for 6878481: Add performance counters in the JDK In-Reply-To: <4AAD7B65.7010109@sun.com> References: <4A9EC69F.6000509@sun.com> <4AAA9372.3070200@Sun.com> <4AACA833.9030204@sun.com> <4AAD7B65.7010109@sun.com> Message-ID: <4AAD9CD7.8030405@sun.com> Alan, David, Thanks for the review. Comments inlined below. Alan Bateman wrote: > Minor nit but I assume you can initialize perf as: > private static final Perf perf = > AccessController.doPrivileged(new Perf.GetPerfAction()); Fixed. David Holmes wrote: > Just to add 2c to Alan's method naming comments: > > Alan Bateman said the following on 09/13/09 18:07: >> Method naming is hard (and often subjective) but there are updates >> like this: >> PerfCounter.getParentDelegationTime.inc(t1 - t0); >> which might be easier to read as: >> PerfCounter.getParentDelegationCounter().addTime(t1 - t0) > > > There's always a problem with method naming when a thing can be both a > counter and a time-tracker. I would agree to use context specific > methods even at the expense of some redundancy in the public API eg: > > addTime(long interval) > addElapsedTimeFrom(long startTime) > >> Also: >> PerfCounter.getZipFileCount().inc(); >> which might be cleaer as: >> PerfCounter.getZipFileCounter().increment(); > > I'd also suggest (in a convention used elsewhere eg > java.util.concurrent.atomic.*) that you reserve increment() for > addition of 1 and use add(long val) for the general case. > I agree that addTime(long interval), increment(), and add(long val) are better method names. I'll make the change. As for PerfCounter.getParentDelegationTime() vs getParentDelegationCounter(), I would prefer to keep getParentDelegationTime as the method name so that it's clear that this counter is a time tracker. Similarly, it's clear that getZipFileCount() is a counter to keep track of zip file count. Thanks Mandy From Mandy.Chung at Sun.COM Mon Sep 14 01:32:29 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Sun, 13 Sep 2009 18:32:29 -0700 Subject: Review Request for 6879044 Message-ID: <4AAD9D2D.6000502@sun.com> 6879044: Eliminate the dependency of logging from the JRE core/awt/swing classes Webrev: http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ Summary: 1. A new sun.util.logging.PlatformLogger class that will handle the log messages in a similar way as Logger but it will only delegate to java.util.logging only when it is enabled. LogManager and LogRecord are modified to support the platform loggers. The users of PlatformLogger will continue to run if java.util.logging classes do not exist. 2. AWT, 2D, Swing, and a few java.util classes are modified to use PlatformLogger instead of Logger. Although many files are modified, the change is mostly replacement with classname. AWT statically creates a number of loggers. Running a simple AWT Framer application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 loggers on windows-i586. SwingSet2 creates a total of 85 loggers including a few non-awt ones on solaris-i586 and 35 on windows-i586). Although the memory usage might not be very high (especially with this fix), I don't see the need of having many fine-grained loggers. This fix doesn't address this the number of AWT loggers. I file a separate CR (6880089) to revisit it. Startup Performance: This change does not have significant startup performance improvement, as expected. However, it does reduce the number of loaded classes (Framer app loads 16 fewer classes and jedit loads 13 fewer classes). Thanks Mandy From son.two at gmail.com Mon Sep 14 03:44:27 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Mon, 14 Sep 2009 07:44:27 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AAD9D2D.6000502@sun.com> References: <4AAD9D2D.6000502@sun.com> Message-ID: <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> On Mon, Sep 14, 2009 at 5:32 AM, Mandy Chung wrote: > 6879044: Eliminate the dependency of logging from the JRE core/awt/swing > classes > > Webrev: > ?http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ > > Summary: > 1. A new sun.util.logging.PlatformLogger class that will handle the log > messages in a similar way as Logger but it will only delegate to > java.util.logging only when it is enabled. ?LogManager and LogRecord are > modified to support the platform loggers. ?The users of PlatformLogger will > continue to run if java.util.logging classes do not exist. evaluation for 6879044 says: Add a PlatformLogger class that mimics the default logging behavior (output the log message to System.err with simple formatting) and creates a java.util.logging.Logger only when the logging facility is used by the application or a user-defined configuration is supplied. which of two descriptions is correct one? Also I wonder if it is ok to get possible better modularization by adding dependency to Sun's internal API into public packages. > 2. AWT, 2D, Swing, and a few java.util classes are modified to use > PlatformLogger instead of Logger. ?Although many files are modified, the > change is mostly replacement with classname. Well, at least in AWTEvent you have changed static initialization of logger to lazy one. Perhaps it is better to keep a static one to minimize your changes. Oleg. > > AWT statically creates a number of loggers. Running a simple AWT Framer > application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 loggers > on windows-i586. SwingSet2 creates a total of 85 loggers including a few > non-awt ones on solaris-i586 and 35 on windows-i586). > Although the memory usage might not be very high (especially with this fix), > I don't see the need of having many fine-grained loggers. ?This fix doesn't > address this the number of AWT loggers. I file a separate CR (6880089) to > revisit it. > > Startup Performance: > This change does not have significant startup performance improvement, as > expected. ?However, it does reduce the number of loaded classes (Framer app > loads 16 fewer classes and jedit loads 13 fewer classes). > > > Thanks > Mandy > > > From Xueming.Shen at Sun.COM Mon Sep 14 04:12:22 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Sun, 13 Sep 2009 21:12:22 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AAD27B4.4040507@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> <4AAD27B4.4040507@sun.com> Message-ID: <4AADC2A6.2090909@sun.com> The ZOutputStream of the "competing" jzlib has its "flush" control in its write() method, it invokes "defalter.deflate()" with a "flush" parameter, the "flush"parameter is a protected instance variable of the ZOutputStream class with a default value of z_no_flush. So its subclass can set whatever value is desirable. Its default "flush()" does the same thing we do, out.flush():-) So obviously all the "happy" jzlib users do not feel too bad to write their own subclass to achieve whatever they can not get from our DOS/deflater. While I still feel my original proposal is very close what the jzlib offers. I'm happy with Alan's approach, and I suggest we simply do the z_no_flush/z_sync_flush. It should not be too difficult for sophisticated developer to write their own DOS with the new deflater class. sherman Alan Bateman wrote: > Martin Buchholz wrote: >> : >> The use case for full flush is partial recoverability from future >> corruption >> of the data. If the competing java zib libraries are supporting this >> flush variant, >> we probably should too, for completeness. >> > It's worth considering although we get into detail as to how the flush > mode is expressed in the constructor (an int is awkward because of the > existing size parameter, and java.util.zip was well into adolescence > when enums were introduced). The other option is to just ignore it as > the proposed Deflater.deflate method supports full flush and it's not > too difficult to create your own OutputStream that uses Deflater. > > -Alan. From Alan.Bateman at Sun.COM Mon Sep 14 09:17:07 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Mon, 14 Sep 2009 10:17:07 +0100 Subject: Review Request for 6879044 In-Reply-To: <4AAD9D2D.6000502@sun.com> References: <4AAD9D2D.6000502@sun.com> Message-ID: <4AAE0A13.3080709@sun.com> Mandy Chung wrote: > 6879044: Eliminate the dependency of logging from the JRE > core/awt/swing classes > > Webrev: > http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ The approach seems reasonable to me. It is a bit strange to redirect the platform logging to j.u.logging if something up the stack starts logging but I think we can live with this because these loggers are for debugging purposes. The changes to the AWT code are mostly mechanical, so I've only skimmed these (assuming that someone from the AWT team with do a detailed check). Have you tested this with a security manager set? I'm just wondering if PlatformLogger's static initializer should do the property lookup in a doPrivileged block. Also in the LoggerProxy for the line separator (BTW: lineSeparator can be final). Is isLoggingEnabled() used anywhere? I can't see it and wonder if it should be removed. If it is used, then I assume it needs to be synchronized with redirectPlatformLoggers. You allow the PlatformLoggers to be GC'ed but the entries will remain in the loggers map. I don't think this is a big deal because the AWT classes will not be unloaded but might be worth putting a note in a comment to re-visit this some time. The static initializer in the forwarding proxy seems a bit messy. It might look neater if changed to something like: private static final Class loggerClass = getClass("java.lang.Logger"); private static final Method getLoggerMethod = getMethod(loggerClass, "getLogger", String.class); where getClass does the Class.forName, returning null if CNF, getMethod returns null if passed a null class, etc. Minor nit but there are a few style/formatting issues in PlatformLogger. For example, in JavaLogger there isn't a blank line between methods. It might be worthing taking a pass over this to have it as neat as possible. Do you have a bugID to track updating the http protocol handler? Jessie did push some changes to eliminate the static dependency on logging and it would be good if that code used PlatformLogger. -Alan. From Weijun.Wang at Sun.COM Mon Sep 14 12:40:53 2009 From: Weijun.Wang at Sun.COM (Max (Weijun) Wang) Date: Mon, 14 Sep 2009 20:40:53 +0800 Subject: Date precision on Windows Message-ID: Hi All Recently one of my Kerberos tests always reports "replay detected" error. Turns out the time precision on Windows is quite low. I've written this tiny program. It calls new Date().getTime() as fast as possible and try to see if the output is continuous: class A { public static void main(String[] rags) throws Exception { int[] x = new int[100]; long l = new java.util.Date().getTime(); while (true) { long m = new java.util.Date().getTime(); if (m - l >= 100) break; x[(int)(m-l)]++; } for (int i=0; i<100; i++) { System.out.printf("%5d %d\n", i, x[i]); } } } On Linux and Solaris, there are only 2 to 5 zeros in the output, which shows the time is quite continuous on these systems. However, on Windows (a x64 system), only 1/16th are non zeros, which shows the maximum precision on Windows looks like 16 millisec. Can this be enhanced? Thanks Max From aph at redhat.com Mon Sep 14 13:27:35 2009 From: aph at redhat.com (Andrew Haley) Date: Mon, 14 Sep 2009 14:27:35 +0100 Subject: Date precision on Windows In-Reply-To: References: Message-ID: <4AAE44C7.5000208@redhat.com> Max (Weijun) Wang wrote: > Recently one of my Kerberos tests always reports "replay detected" > error. Turns out the time precision on Windows is quite low. > > I've written this tiny program. It calls new Date().getTime() as fast as > possible and try to see if the output is continuous: > > class A { > public static void main(String[] rags) throws Exception { > int[] x = new int[100]; > long l = new java.util.Date().getTime(); > while (true) { > long m = new java.util.Date().getTime(); > if (m - l >= 100) break; > x[(int)(m-l)]++; > } > for (int i=0; i<100; i++) { > System.out.printf("%5d %d\n", i, x[i]); > } > } > } > > On Linux and Solaris, there are only 2 to 5 zeros in the output, which > shows the time is quite continuous on these systems. However, on Windows > (a x64 system), only 1/16th are non zeros, which shows the maximum > precision on Windows looks like 16 millisec. Please, someone tell me Windows isn't still using the old 18.2 Hz DOS timer for its system clock. Nooooo.... Andrew. From Alan.Bateman at Sun.COM Mon Sep 14 13:38:23 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Mon, 14 Sep 2009 14:38:23 +0100 Subject: Date precision on Windows In-Reply-To: References: Message-ID: <4AAE474F.4070608@sun.com> Max (Weijun) Wang wrote: > Hi All > > Recently one of my Kerberos tests always reports "replay detected" > error. Turns out the time precision on Windows is quite low. > > I've written this tiny program. It calls new Date().getTime() as fast > as possible and try to see if the output is continuous: > > class A { > public static void main(String[] rags) throws Exception { > int[] x = new int[100]; > long l = new java.util.Date().getTime(); > while (true) { > long m = new java.util.Date().getTime(); > if (m - l >= 100) break; > x[(int)(m-l)]++; > } > for (int i=0; i<100; i++) { > System.out.printf("%5d %d\n", i, x[i]); > } > } > } > > On Linux and Solaris, there are only 2 to 5 zeros in the output, which > shows the time is quite continuous on these systems. However, on > Windows (a x64 system), only 1/16th are non zeros, which shows the > maximum precision on Windows looks like 16 millisec. > > Can this be enhanced? > > Thanks > Max > David Holmes has a good write-up on this topic here: http://blogs.sun.com/dholmes/entry/inside_the_hotspot_vm_clocks (the no-arg Date constructor uses System.currentTimeMillis) -Alan. From jeroen at sumatra.nl Mon Sep 14 13:42:23 2009 From: jeroen at sumatra.nl (Jeroen Frijters) Date: Mon, 14 Sep 2009 15:42:23 +0200 Subject: Date precision on Windows In-Reply-To: <4AAE44C7.5000208@redhat.com> References: <4AAE44C7.5000208@redhat.com> Message-ID: Andrew Haley wrote: > Please, someone tell me Windows isn't still using the old 18.2 Hz DOS > timer for its system clock. Nooooo.... Not that it is true, but why would that be bad? By default (most) multi core/cpu Windows systems run at a 15 ms timer interrupt interval (10 ms for single cpu/core systems), but programs can request a smaller interval (down to 1 ms). Running the timer interrupt at a lower frequency helps if you care about throughput and/or battery life. Regards, Jeroen From Vladimir.Yaroslavskiy at Sun.COM Mon Sep 14 15:07:30 2009 From: Vladimir.Yaroslavskiy at Sun.COM (Vladimir Yaroslavskiy) Date: Mon, 14 Sep 2009 19:07:30 +0400 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort: improvements In-Reply-To: References: Message-ID: <4AAE5C32.1060502@Sun.COM> Hi Team, Thank you very much for your feedback and comments! I collect here all hints and tips for improvement of the new algorithm. New version of Quicksort is attached. And now my investigations: 1. [Jon Bentley] > Use the median of 2k+1 elements for pivots. > We can choose a sample of five elements, sort them, and then > partition around the 2nd and 4th sorted elements. Yes, this helps, I can't say that we win a lot of time in general, but it works really faster for input data like this 012012012..., 012301230..., 01234012340.... And more important thing: this approach allows me to eliminate "div" parameter in the implementation. As it was suggested, I take middle 5 elements with indexes: s, 2s, 3s, 4s, 5s (where s is length/6), sort them and take 2s and 4s elements as pivots. Also I don't need to compare pivots because they are sorted. 2. [Jon Bentley] > How about doing a test for pivot1 == pivot2, and then > separately handling that special case? equal elements. Right now, the > inner loop in the "// sorting" section compares every element both to > pivot1 and pivot2. Good catch! It reduces time of sorting equal elements (or almost equal) from 347 to 228 and doesn't change time for other cases. 3. [Jon Bentley] > Vladimir is currently using the first scheme that we tried. > I wonder if it might be faster (or clearer) to try an invariant like > | < | M | ? | M | > | > where M denotes middle elements with the property > Pivot1 <= M <= Pivot2 > Vladimir, do you think that you might be able to get a better invariant? Sure, I tried other invariant like this: | < | M | > | ? | but it is slower than current. 4.1 [Oleg Anashkin] > First thing that came to mind - have you thought about extrapolating this > approach to more pivots? If 2-pivot algorithm is faster than 1-pivot, then > 3-pivot might be even faster, right? Can the number of pivots be chosen as > a function of array size (to mitigate overhead)? and 4.2 [Leonid Geller] > As an observation, why not expand the new algorithm to N-Pivot > where N = round(ln(array length)). > This should lower the average sort cost even lower. Here is the experimental results for several pivots. It's easy to define recurrence relation and write code to count the comparisons and swap: Classic Quicksort: comps - 52254956 swaps - 26277985 Dual-Pivot Quicksort: comps - 52246553 swaps - 20977937 Quicksort with 3 pivots: comps - 54399943 swaps - 24224254 Quicksort with 4 pivots: comps - 57241615 swaps - 28659728 You can see that "3 pivots" is better than Classic Quicksort for swaps only, "4 pivots" is the looser, and "Dual-Pivot Quicksort" is real winner. If we have many pivots we spent a lot of time on sorting them and dividing into more parts doesn't save. In case with 2 pivots, we use only 1 comparison and 1/2 swaps to sort it out. 5. [R?mi Forax] > The algorithm use two constants: 37 and 13, > I think they should be declared as private static final. The constants are: 27 (not 37) and 13, and I made it as private static final int. (but 27 is changed to 17, see below) 6. [R?mi Forax] > In the loop tagged "sorting" and "equals element", a[k] can be > stored in a local variable to avoid to recompute it several time. Adding a local variable doesn't save time, but it was done in the line of other improvement (see below). Thank you for pointing to it! 7. [Vladimir Yaroslavskiy] I very often look at swap function and don't like it. I tried to eliminate it and add these 3 lines into the code as inline, but no effect. Then I looked from other side, we have a lot of code such as: for (int k=0; ...) { if (a[k] < ...) { swap(a, k, less++) } ... } You can see that we retrieve a[k] many times, so I suggest doing it like this without swap function: for (int k=0; ...) { int ak = a[k] if (ak < ...) { a[k] = a[less]; a[less++] = ak; } ... } What we have achieve: 1. No swap function call 2. Two assignments instead of three 3. No local variable temp This approach shows very nice results especially for server mode: new: 100 / old: 126 8. [Jonathan Graehl] > suggest this: > int third = len / div; > third=third>0?third:1; Very elegant, but unfortunately I could not apply this, because the schema of choosing pivot elements has been changed. 9. [Goktug Gokdogan] > 1. Falling back-to insertion sort at < 17 instead of < 27. > 2. (a[great] > pivot2) test is more likely to fail compared to > (k < great) in the while loop, so exchange them (ie. use > while (a[great] > pivot2 && k < great)). I tried 17 as boundary for insertion sort: in some cases it is better, in other no. But in average I don't see that time is increased. I set up 17 in new version. Note that in my first version the value was 17, but later it was changed to 25 -> 27. while (a[great] > pivot2 && k < great)) - we win 3-4% ! Thank you! ------------------------------------------------------------------ I hope that I don't miss something what you suggested. If you find missed items or have other comments/suggestions, please, let me know. And the end I would like provide the execution times for standard input data (all times should be divided by 1000 to get seconds): Client VM Server VM random random dpq: 16221 dpq: 19893 jdk: 20162 jdk: 24199 ascendant ascendant dpq: 5686 dpq: 7952 jdk: 9414 jdk: 11748 descendant descendant dpq: 5921 dpq: 7924 jdk: 9736 jdk: 11777 all equal all equal dpq: 261 dpq: 500 jdk: 734 jdk: 1140 repeated 50 repeated 50 dpq: 3450 dpq: 4239 jdk: 4207 jdk: 5874 organ pipes organ pipes dpq: 9364 dpq: 11451 jdk: 12858 jdk: 16534 random 01 random 01 dpq: 1474 dpq: 1423 jdk: 1747 jdk: 2591 010101 010101 dpq: 1092 dpq: 1052 jdk: 1140 jdk: 2076 012012 012012 dpq: 771 dpq: 1035 jdk: 1220 jdk: 1980 012301 012301 dpq: 1140 dpq: 1393 jdk: 1606 jdk: 2876 012340 012340 dpq: 1464 dpq: 1826 jdk: 1947 jdk: 3366 random 4 random 4 dpq: 1855 dpq: 2423 jdk: 2258 jdk: 3148 random 1000 random 1000 dpq: 8008 dpq: 9213 jdk: 8521 jdk: 10363 You can see that now Dual-Pivots Quicksort wins in all nominations (in previous letter it looses in server mode in few cases). Alan, I'll send you updated Arrays.java little bit later. Thank you, Vladimir -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: DualPivotQuicksort753.java URL: From Artem.Ananiev at Sun.COM Mon Sep 14 10:08:55 2009 From: Artem.Ananiev at Sun.COM (Artem Ananiev) Date: Mon, 14 Sep 2009 14:08:55 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AAD9D2D.6000502@sun.com> References: <4AAD9D2D.6000502@sun.com> Message-ID: <4AAE1637.70005@sun.com> Mandy Chung wrote: > 6879044: Eliminate the dependency of logging from the JRE core/awt/swing > classes > > Webrev: > http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ > > Summary: > 1. A new sun.util.logging.PlatformLogger class that will handle the log > messages in a similar way as Logger but it will only delegate to > java.util.logging only when it is enabled. LogManager and LogRecord are > modified to support the platform loggers. The users of PlatformLogger > will continue to run if java.util.logging classes do not exist. > > 2. AWT, 2D, Swing, and a few java.util classes are modified to use > PlatformLogger instead of Logger. Although many files are modified, the > change is mostly replacement with classname. I have quickly looked through AWT/2D changes and haven't found anything suspicious. A funny typo is noticed in X11 key logging (see XToolkit or XWindow for examples): logger name is sun.awt.X11.kye instead of sun.awt.X11.key - but anyway it's not your fault :) > AWT statically creates a number of loggers. Running a simple AWT Framer > application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 > loggers on windows-i586. SwingSet2 creates a total of 85 loggers > including a few non-awt ones on solaris-i586 and 35 on windows-i586). > Although the memory usage might not be very high (especially with this > fix), I don't see the need of having many fine-grained loggers. This > fix doesn't address this the number of AWT loggers. I file a separate CR > (6880089) to revisit it. Thanks. > Startup Performance: > This change does not have significant startup performance improvement, > as expected. However, it does reduce the number of loaded classes > (Framer app loads 16 fewer classes and jedit loads 13 fewer classes). > > > Thanks > Mandy Thanks, Artem From Yuri.Nesterenko at Sun.COM Mon Sep 14 10:22:09 2009 From: Yuri.Nesterenko at Sun.COM (Yuri Nesterenko) Date: Mon, 14 Sep 2009 14:22:09 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AAE1637.70005@sun.com> References: <4AAD9D2D.6000502@sun.com> <4AAE1637.70005@sun.com> Message-ID: <4AAE1951.6040907@sun.com> Artem Ananiev wrote: > > Mandy Chung wrote: >> 6879044: Eliminate the dependency of logging from the JRE >> core/awt/swing classes > ... > I have quickly looked through AWT/2D changes and haven't found anything > suspicious. A funny typo is noticed in X11 key logging (see XToolkit or > XWindow for examples): logger name is sun.awt.X11.kye instead of > sun.awt.X11.key - but anyway it's not your fault :) It's not a typo, it's a decision!!! I forgot why I did it though but there was a good reason. ...Oh, there it is: it's extremely easy to find in the code full of everything "key". -yan From opinali at gmail.com Mon Sep 14 15:18:31 2009 From: opinali at gmail.com (Osvaldo Doederlein) Date: Mon, 14 Sep 2009 12:18:31 -0300 Subject: Date precision on Windows In-Reply-To: References: <4AAE44C7.5000208@redhat.com> Message-ID: Windows 7 seems to be better, check my last comente here: http://javafx-jira.kenai.com/browse/JFXC-3357 A+ Osvaldo 2009/9/14 Jeroen Frijters > Andrew Haley wrote: > > Please, someone tell me Windows isn't still using the old 18.2 Hz DOS > > timer for its system clock. Nooooo.... > > Not that it is true, but why would that be bad? > > By default (most) multi core/cpu Windows systems run at a 15 ms timer > interrupt interval (10 ms for single cpu/core systems), but programs can > request a smaller interval (down to 1 ms). > > Running the timer interrupt at a lower frequency helps if you care about > throughput and/or battery life. > > Regards, > Jeroen > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.bateman at sun.com Mon Sep 14 17:03:40 2009 From: alan.bateman at sun.com (alan.bateman at sun.com) Date: Mon, 14 Sep 2009 17:03:40 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090914170432.B75AF1210B@hg.openjdk.java.net> Changeset: 060c4c7082ef Author: alanb Date: 2009-09-14 15:29 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/060c4c7082ef 6529758: JVMTI Waiters demo crashes. Double free. Reviewed-by: ohair, tbell ! src/share/demo/jvmti/waiters/Agent.cpp ! src/share/demo/jvmti/waiters/Agent.hpp ! src/share/demo/jvmti/waiters/Monitor.cpp ! src/share/demo/jvmti/waiters/Monitor.hpp Changeset: aac01ec2cec4 Author: alanb Date: 2009-09-14 17:47 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/aac01ec2cec4 6876541: (file) Files.walkFileTree(...): no SecurityException if read access to the starting file is denied Reviewed-by: chegar ! src/share/classes/java/nio/file/FileTreeWalker.java ! src/share/classes/java/nio/file/Files.java + test/java/nio/file/Files/WalkWithSecurity.java + test/java/nio/file/Files/denyAll.policy + test/java/nio/file/Files/grantAll.policy + test/java/nio/file/Files/grantTopOnly.policy From Mandy.Chung at Sun.COM Mon Sep 14 17:19:14 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Mon, 14 Sep 2009 10:19:14 -0700 Subject: Review Request for 6879044 In-Reply-To: <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> Message-ID: <4AAE7B12.5000403@Sun.com> Oleg Sukhodolsky wrote: > On Mon, Sep 14, 2009 at 5:32 AM, Mandy Chung wrote: >> 6879044: Eliminate the dependency of logging from the JRE core/awt/swing >> classes >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ >> >> Summary: >> 1. A new sun.util.logging.PlatformLogger class that will handle the log >> messages in a similar way as Logger but it will only delegate to >> java.util.logging only when it is enabled. LogManager and LogRecord are >> modified to support the platform loggers. The users of PlatformLogger will >> continue to run if java.util.logging classes do not exist. > > evaluation for 6879044 says: > > Add a PlatformLogger class that mimics the default logging behavior > (output the log message to System.err with simple formatting) and > creates a java.util.logging.Logger only when the logging facility is > used by the application or a user-defined configuration is supplied. > > which of two descriptions is correct one? Both are correct. Can you elaborate what issue;/confusion you see between the descriptions? The class description of sun.util.logging.PlatformLogger has the details: http://cr.openjdk.java.net/~mchung/6879044/webrev.00/src/share/classes/sun/util/logging/PlatformLogger.java.html > Also I wonder if it is ok to get possible better modularization by > adding dependency to Sun's internal API into public packages. This fix is to eliminate the dependency to logging API. This internal PlatformLogger class is an implementation class only used by the JRE and always be present. Does this answer your question? >> 2. AWT, 2D, Swing, and a few java.util classes are modified to use >> PlatformLogger instead of Logger. Although many files are modified, the >> change is mostly replacement with classname. > > Well, at least in AWTEvent you have changed static initialization of > logger to lazy one. > Perhaps it is better to keep a static one to minimize your changes. This fix shows one way of lazy initializing an AWT logger to be referenced when fixing 6880089. The AWTEvent log messages are only output in the error conditions. In the normal cases, no message will be logged in this logger is not needed. I would expect that the fix for 6880089 may make some AWT loggers to be initialized lazily as this one. Thanks for the review. Mandy > Oleg. >> AWT statically creates a number of loggers. Running a simple AWT Framer >> application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 loggers >> on windows-i586. SwingSet2 creates a total of 85 loggers including a few >> non-awt ones on solaris-i586 and 35 on windows-i586). >> Although the memory usage might not be very high (especially with this fix), >> I don't see the need of having many fine-grained loggers. This fix doesn't >> address this the number of AWT loggers. I file a separate CR (6880089) to >> revisit it. >> >> Startup Performance: >> This change does not have significant startup performance improvement, as >> expected. However, it does reduce the number of loaded classes (Framer app >> loads 16 fewer classes and jedit loads 13 fewer classes). >> >> >> Thanks >> Mandy >> >> >> From kevin.walls at sun.com Mon Sep 14 19:57:06 2009 From: kevin.walls at sun.com (kevin.walls at sun.com) Date: Mon, 14 Sep 2009 19:57:06 +0000 Subject: hg: jdk7/tl/jdk: 6842838: 64-bit failure in handling invalid manifest in launcher. Message-ID: <20090914195748.B8D6712176@hg.openjdk.java.net> Changeset: eb19c5dc52bf Author: kevinw Date: 2009-09-14 20:55 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/eb19c5dc52bf 6842838: 64-bit failure in handling invalid manifest in launcher. Summary: Don't compare with hard-coded 32-bit -1 when checking zip fields. Reviewed-by: ksrini ! src/share/bin/parse_manifest.c + test/tools/launcher/6842838/CreateBadJar.java + test/tools/launcher/6842838/Test6842838.sh From lgeller at feedroom.com Mon Sep 14 20:14:11 2009 From: lgeller at feedroom.com (Leonid Geller) Date: Mon, 14 Sep 2009 20:14:11 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ6?= improvements References: <4AAE5C32.1060502@Sun.COM> Message-ID: Remarkable performance improvements! The next step to make this "jdk" material is to implement the DPQ using collections and generics. Then offer an API to pass a comparator class or insure the sortable data structure implements comparable interface. From gnu_andrew at member.fsf.org Mon Sep 14 20:19:35 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Mon, 14 Sep 2009 21:19:35 +0100 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AAD9D2D.6000502@sun.com> References: <4AAD9D2D.6000502@sun.com> Message-ID: <17c6771e0909141319w433d93bfma77cdb695cc8abb@mail.gmail.com> 2009/9/14 Mandy Chung : > 6879044: Eliminate the dependency of logging from the JRE core/awt/swing > classes > > Webrev: > ?http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ > > Summary: > 1. A new sun.util.logging.PlatformLogger class that will handle the log > messages in a similar way as Logger but it will only delegate to > java.util.logging only when it is enabled. ?LogManager and LogRecord are > modified to support the platform loggers. ?The users of PlatformLogger will > continue to run if java.util.logging classes do not exist. > > 2. AWT, 2D, Swing, and a few java.util classes are modified to use > PlatformLogger instead of Logger. ?Although many files are modified, the > change is mostly replacement with classname. > > AWT statically creates a number of loggers. Running a simple AWT Framer > application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 loggers > on windows-i586. SwingSet2 creates a total of 85 loggers including a few > non-awt ones on solaris-i586 and 35 on windows-i586). > Although the memory usage might not be very high (especially with this fix), > I don't see the need of having many fine-grained loggers. ?This fix doesn't > address this the number of AWT loggers. I file a separate CR (6880089) to > revisit it. > > Startup Performance: > This change does not have significant startup performance improvement, as > expected. ?However, it does reduce the number of loaded classes (Framer app > loads 16 fewer classes and jedit loads 13 fewer classes). > > > Thanks > Mandy > > > I'm curious as to why some of the initialisations are lazy and some are eager. Notably AWTEvent is changed from eager to lazy: public abstract class AWTEvent extends EventObject { - private static final Logger log = Logger.getLogger("java.awt.AWTEvent"); + private static volatile PlatformLogger log; + ... + + // log fine message to the java.awt.AWTEvent logger + private static void fine(String msg, Throwable t) { + if (log == null) { + log = PlatformLogger.getLogger("java.awt.AWTEvent"); + } + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(msg, t); + } + } + Although the use of volatile should ensure the correct ordering of operations, there is still the possibility of a minor race here as the if condition and its body are not atomic; thus there could be multiple calls to PlatformLogger.getLogger should a thread be interrupted between the check and the assignment. Why not just use a straightforward static assignment to a final variable as before? Is it really that unlikely that fine() will be called that we need not initialise this early?. At the very least consider using the lazy holder idiom over volatile. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From mandy.chung at sun.com Mon Sep 14 20:44:22 2009 From: mandy.chung at sun.com (mandy.chung at sun.com) Date: Mon, 14 Sep 2009 20:44:22 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090914204454.07EA912181@hg.openjdk.java.net> Changeset: c7e469ae3edb Author: mchung Date: 2009-09-14 13:37 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/c7e469ae3edb 6878481: Add performance counters in the JDK Summary: Added new performance counters in the JDK to track performance metrics Reviewed-by: alanb, dholmes, iris, forax, andrew ! make/java/java/FILES_java.gmk ! src/share/classes/java/lang/ClassLoader.java ! src/share/classes/java/net/URLClassLoader.java ! src/share/classes/java/util/zip/ZipFile.java + src/share/classes/sun/misc/PerfCounter.java ! src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java Changeset: 0a3244fe7142 Author: mchung Date: 2009-09-14 13:38 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/0a3244fe7142 Merge From jjb at google.com Mon Sep 14 21:30:26 2009 From: jjb at google.com (Joshua Bloch) Date: Mon, 14 Sep 2009 14:30:26 -0700 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort: improvements In-Reply-To: References: <4AAE5C32.1060502@Sun.COM> Message-ID: <17b2302a0909141430m60f7348dv5bf79405ca217808@mail.gmail.com> Leonid, I don't think Dual Pivot Quicksort for List is necessary or appropriate. Recall that Arrays.sort and Collections.sort are defined to be stable sorts, which Quicksort is not. Also, I just replaced them with TimSort, which gives a very healthy performance boost. I do think it would be an interesting experiment to run Dual Pivot Quicksort on object reference arrays, and TimSort on primitive arrays, but I don't think we'll end up putting either into the JDK. Josh On Mon, Sep 14, 2009 at 1:14 PM, Leonid Geller wrote: > Remarkable performance improvements! > The next step to make this "jdk" material is to implement the DPQ using > collections and generics. Then offer an API to pass a comparator class or > insure > the sortable data structure implements comparable interface. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at sun.com Tue Sep 15 00:15:42 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 15 Sep 2009 00:15:42 +0000 Subject: hg: jdk7/tl/langtools: 6881317: regression: NPE in CloseableURLClassLoader Message-ID: <20090915001550.EA9F612199@hg.openjdk.java.net> Changeset: f8be8bf150c3 Author: jjg Date: 2009-09-14 17:13 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/f8be8bf150c3 6881317: regression: NPE in CloseableURLClassLoader Reviewed-by: darcy ! src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java From daniel.daugherty at sun.com Tue Sep 15 00:51:16 2009 From: daniel.daugherty at sun.com (daniel.daugherty at sun.com) Date: Tue, 15 Sep 2009 00:51:16 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090915005310.1407B121AA@hg.openjdk.java.net> Changeset: f0182203084a Author: dcubed Date: 2009-09-14 18:45 -0600 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f0182203084a 6862295: JDWP threadid changes during debugging session (leading to ingored breakpoints) Summary: New test for the above fix. Reviewed-by: tbell + test/com/sun/jdi/BreakpointWithFullGC.sh Changeset: f78b7d9973b7 Author: dcubed Date: 2009-09-14 18:54 -0600 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f78b7d9973b7 Merge From son.two at gmail.com Tue Sep 15 03:04:10 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Tue, 15 Sep 2009 07:04:10 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AAE7B12.5000403@Sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> Message-ID: <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> On Mon, Sep 14, 2009 at 9:19 PM, Mandy Chung wrote: > Oleg Sukhodolsky wrote: >> >> On Mon, Sep 14, 2009 at 5:32 AM, Mandy Chung wrote: >>> >>> 6879044: Eliminate the dependency of logging from the JRE core/awt/swing >>> classes >>> >>> Webrev: >>> ?http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ >>> >>> Summary: >>> 1. A new sun.util.logging.PlatformLogger class that will handle the log >>> messages in a similar way as Logger but it will only delegate to >>> java.util.logging only when it is enabled. ?LogManager and LogRecord are >>> modified to support the platform loggers. ?The users of PlatformLogger >>> will >>> continue to run if java.util.logging classes do not exist. >> >> evaluation for 6879044 says: >> >> Add a PlatformLogger class that mimics the default logging behavior >> (output the log message to System.err with simple formatting) and >> creates a java.util.logging.Logger only when the logging facility is >> used by the application or a user-defined configuration is supplied. >> >> which of two descriptions is correct one? > > Both are correct. ?Can you elaborate what issue;/confusion you see between > the descriptions? I thought that it is possible to log int a file using default logger, thus I was surprised that description of PlatformLogger says about System.err. I'd expect PlatformLogger to be a wrapper around the default logger, and as far as I can see from provided sources it is. > The class description of sun.util.logging.PlatformLogger has the details: > http://cr.openjdk.java.net/~mchung/6879044/webrev.00/src/share/classes/sun/util/logging/PlatformLogger.java.html > >> Also I wonder if it is ok to get possible better modularization by >> adding dependency to Sun's internal API into public packages. > > This fix is to eliminate the dependency to logging API. ? This internal > PlatformLogger class is an implementation class only used by the JRE and > always be present. ?Does this answer your question? internal PlatformLogger is present in Sun's implementation of JRE only, so such changes will complicate porting JRE implementation. Also I wonder how big logging module is, what advantage we do receive by removing dependency on it? How many Mb we do not need to load in this case? >>> 2. AWT, 2D, Swing, and a few java.util classes are modified to use >>> PlatformLogger instead of Logger. ?Although many files are modified, the >>> change is mostly replacement with classname. >> >> Well, at least in AWTEvent you have changed static initialization of >> logger to lazy one. >> Perhaps it is better to keep a static one to minimize your changes. > > This fix shows one way of lazy initializing an AWT logger to be referenced > when fixing 6880089. ?The AWTEvent log messages are only output in the error > conditions. ?In the normal cases, no message will be logged in this logger > is not needed. ? I would expect that the fix for 6880089 may make some AWT > loggers to be initialized lazily as this one. I'd suggest to keep all logger's initialization as is to simplify the fix. Oleg. > > Thanks for the review. > Mandy > >> Oleg. >>> >>> AWT statically creates a number of loggers. Running a simple AWT Framer >>> application with JDK 7 b71 creates 79 loggers on solaris-i586 and 34 >>> loggers >>> on windows-i586. SwingSet2 creates a total of 85 loggers including a few >>> non-awt ones on solaris-i586 and 35 on windows-i586). >>> Although the memory usage might not be very high (especially with this >>> fix), >>> I don't see the need of having many fine-grained loggers. ?This fix >>> doesn't >>> address this the number of AWT loggers. I file a separate CR (6880089) to >>> revisit it. >>> >>> Startup Performance: >>> This change does not have significant startup performance improvement, as >>> expected. ?However, it does reduce the number of loaded classes (Framer >>> app >>> loads 16 fewer classes and jedit loads 13 fewer classes). >>> >>> >>> Thanks >>> Mandy >>> >>> >>> > From aph at redhat.com Tue Sep 15 08:40:14 2009 From: aph at redhat.com (Andrew Haley) Date: Tue, 15 Sep 2009 09:40:14 +0100 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort: improvements In-Reply-To: <4AAE5C32.1060502@Sun.COM> References: <4AAE5C32.1060502@Sun.COM> Message-ID: <4AAF52EE.30204@redhat.com> One thing that occurred to me, and I'm sorry if this question has been asked already but I couldn't find it: TINY_SIZE, the threshold for insertion sorting, has gone up from 7 to 17. Does this mean that sorting arrays of this size is now slower? Andrew. From Vladimir.Yaroslavskiy at Sun.COM Tue Sep 15 10:07:31 2009 From: Vladimir.Yaroslavskiy at Sun.COM (Vladimir Yaroslavskiy) Date: Tue, 15 Sep 2009 14:07:31 +0400 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort: improvements In-Reply-To: <4AAF52EE.30204@redhat.com> References: <4AAE5C32.1060502@Sun.COM> <4AAF52EE.30204@redhat.com> Message-ID: <4AAF6763.1040309@Sun.COM> Hello Andrew, It means that the threshold = 7 is optimal for combination: insertion sort + Bentley's implementation, and 17 - for Insertion + Dual-Pivot Quicksort. I can add that for Dual-Pivot Quicksort old threshold = 7 shows slower results than 17. Other values, such as 25, 27, show similar times as 17, and I choose last one. Sorting arrays of tiny size (<= 6) is the sorting by insertion algorithm and the times are the same in both implementations. Sorting arrays of small size (7 <= & <= 16) is faster by my implementation (~5-10%) Thank you, Vladimir Andrew Haley wrote: > One thing that occurred to me, and I'm sorry if this question has been > asked already but I couldn't find it: > > TINY_SIZE, the threshold for insertion sorting, has gone up from 7 to 17. > Does this mean that sorting arrays of this size is now slower? > > Andrew. From Vladimir.Yaroslavskiy at Sun.COM Tue Sep 15 10:33:20 2009 From: Vladimir.Yaroslavskiy at Sun.COM (Vladimir Yaroslavskiy) Date: Tue, 15 Sep 2009 14:33:20 +0400 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot In-Reply-To: References: Message-ID: <4AAF6D70.4050809@Sun.COM> Hi, I've asked about TimSort vs. Dual-Pivot Quicksort. As Joshua said, these algorithms are for different purposes: TimSort (and MergeSort) for sorting complex objects, because it is stable (doesn't change the order of equal elements), and Quicksort is for primitive types. And these algorithms shows the best results in own fields: int java.lang.Integer random random dpq: 16063 dpq: 10403 tim: 36806 tim: 9281 jdk: 21907 jdk: 9953 ascendant ascendant dpq: 5558 dpq: 498 tim: 322 tim: 203 jdk: 8304 jdk: 797 descendant descendant dpq: 5762 dpq: 6077 tim: 605 tim: 235 jdk: 8383 jdk: 5718 all equal all equal dpq: 255 dpq: 577 tim: 326 tim: 297 jdk: 604 jdk: 1125 organ pipes organ pipes dpq: 8999 dpq: 6002 tim: 1758 tim: 1283 jdk: 11636 jdk: 5155 random 01 random 01 dpq: 1431 dpq: 8017 tim: 11495 tim: 2717 jdk: 1552 jdk: 8547 Thanks, Vladimir Date: Mon, 14 Sep 2009 14:30:26 -0700 From: Joshua Bloch Subject: Re: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort: improvements To: Leonid Geller Cc: core-libs-dev at openjdk.java.net Leonid, I don't think Dual Pivot Quicksort for List is necessary or appropriate. Recall that Arrays.sort and Collections.sort are defined to be stable sorts, which Quicksort is not. Also, I just replaced them with TimSort, which gives a very healthy performance boost. I do think it would be an interesting experiment to run Dual Pivot Quicksort on object reference arrays, and TimSort on primitive arrays, but I don't think we'll end up putting either into the JDK. Josh From martinrb at google.com Tue Sep 15 18:02:00 2009 From: martinrb at google.com (Martin Buchholz) Date: Tue, 15 Sep 2009 11:02:00 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AAAAE03.5010002@sun.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> <4AA849B1.1090005@sun.com> <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> <4AA857A8.1010700@sun.com> <4AAAAE03.5010002@sun.com> Message-ID: <1ccfd1c10909151102r460396fct103b032023311606@mail.gmail.com> I added a test case, as I half-promised, http://cr.openjdk.java.net/~martin/webrevs/openjdk7/compare/ This test is particularly uninteresting. I'll commit soon even if I don't get any review comments. Martin On Fri, Sep 11, 2009 at 13:07, Joseph D. Darcy wrote: > Joe Darcy wrote: > > The paperwork has been handled; I approve your set of compare methods going > back. > > Thanks, > > -Joe > From martinrb at google.com Tue Sep 15 18:03:10 2009 From: martinrb at google.com (Martin Buchholz) Date: Tue, 15 Sep 2009 11:03:10 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AAAAD62.70805@sun.com> References: <4AA812D0.309@sun.com> <4AA84AEA.7050008@sun.com> <1ccfd1c10909091942p41683f0bl46d901126c61e8d5@mail.gmail.com> <4AA86C11.7080409@sun.com> <4AA9823D.60507@sun.com> <1ccfd1c10909101640r465ac11albc414bf6573c215b@mail.gmail.com> <4AA99030.8040904@sun.com> <1ccfd1c10909101656sdcc6643uf4ff06cf76b05f30@mail.gmail.com> <4AA993E3.20506@sun.com> <4AAAAD62.70805@sun.com> Message-ID: <1ccfd1c10909151103xf9f0c06p40a0f72ef092968e@mail.gmail.com> > Martin, > > Just to be clear, I approve this change of tightening the hashCode > specifications for Byte, Short, and Character going back into JDK 7. I added a test case, as I half-promised, http://cr.openjdk.java.net/~martin/webrevs/openjdk7/hashCode-spec/ This test is particularly uninteresting. I'll commit soon even if I don't get any review comments. Martin From Mandy.Chung at Sun.COM Tue Sep 15 18:43:55 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Tue, 15 Sep 2009 11:43:55 -0700 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <17c6771e0909141319w433d93bfma77cdb695cc8abb@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <17c6771e0909141319w433d93bfma77cdb695cc8abb@mail.gmail.com> Message-ID: <4AAFE06B.5080000@Sun.com> Hi Andrew, > Why not just use a straightforward static assignment to a final > variable as before? A simple AWT app creates 79 loggers on solaris-i586 and 34 loggers on windows-i586. SwingSet2 creates a total of 85 loggers on solaris-i586 and 35 on windows-i586. Improvement on client startup performance and memory footprint has always been one of our top features in the past releases. As I noted in CR 6880089 (Revisit the number of AWT loggers to reduce the memory usage), there is no strong reason why we need such fine-grained loggers. I fixed AWTEvent since it's one obvious candidate for lazy initialization. With my fix, I reduced the number of loggers by 4. Alex Potochkin also brought up a consistency issue that will be addressed by 6880089 or a new CR. > Is it really that unlikely that fine() will be > called that we need not initialise this early? AWT team, can you confirm? > At the very least consider using the lazy holder idiom over volatile. Good point. Mandy Andrew John Hughes wrote: > 2009/9/14 Mandy Chung : > > I'm curious as to why some of the initialisations are lazy and some > are eager. Notably AWTEvent is changed from eager to lazy: > > public abstract class AWTEvent extends EventObject { > - private static final Logger log = Logger.getLogger("java.awt.AWTEvent"); > + private static volatile PlatformLogger log; > + > ... > + > + // log fine message to the java.awt.AWTEvent logger > + private static void fine(String msg, Throwable t) { > + if (log == null) { > + log = PlatformLogger.getLogger("java.awt.AWTEvent"); > + } > + if (log.isLoggable(PlatformLogger.FINE)) { > + log.fine(msg, t); > + } > + } > + > > > Although the use of volatile should ensure the correct ordering of > operations, there is still the possibility of a minor race here as the > if condition and its body are not atomic; thus there could be multiple > calls to PlatformLogger.getLogger should a thread be interrupted > between the check and the assignment. > > Why not just use a straightforward static assignment to a final > variable as before? Is it really that unlikely that fine() will be > called that we need not initialise this early?. At the very least > consider using the lazy holder idiom over volatile. From Mandy.Chung at Sun.COM Tue Sep 15 19:13:08 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Tue, 15 Sep 2009 12:13:08 -0700 Subject: Review Request for 6879044 In-Reply-To: <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> Message-ID: <4AAFE744.4050009@Sun.com> Oleg Sukhodolsky wrote: > On Mon, Sep 14, 2009 at 9:19 PM, Mandy Chung wrote: > > I thought that it is possible to log int a file using default logger, Not the default logging configuration. > thus I was surprised that > description of PlatformLogger says about System.err. I'd expect > PlatformLogger to be a wrapper around the default logger, > and as far as I can see from provided sources it is. System.err is the default configuration that ConsoleHandler will output to. The default handler specified in /lib/logging.properties is: # By default we only configure a ConsoleHandler, which will only # show messages at the INFO and above levels. handlers= java.util.logging.ConsoleHandler # To also add the FileHandler, use the following line instead. #handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler If you want to log to a file, you need to supply a logging.properties to alter the handles property. If you specify -Djava.util.logging.config.file=, all log messages will go to the file as described by your logging.properties. The only difference with the fix is that the platform loggers doesn't check if the /lib/logging.properties is modified. > internal PlatformLogger is present in Sun's implementation of JRE > only, so such changes will > complicate porting JRE implementation. How does it complicate the porting? The issue we are dealing with is that the JDK is big and deeply interconnected [1]. A command-line hello program loads 300 classes and a Framer (awt version of helloworld) loads 834 classes running with JDK 7 b71. Without module support (JSR 294 + jigsaw) - like we are today, continual JDK development could cause startup of a simple awt app to load over 1000 classes very easily (I actually recalled that one point in time it was over 1000 classes but we put a fix to reduce the number of loaded classes). > Also I wonder how big logging > module is, what advantage we do receive > by removing dependency on it? How many Mb we do not need to load in this case? Not only the MB of the java.util.logging classes but the classes they pull in at runtime. > I'd suggest to keep all logger's initialization as is to simplify the fix. My goal is to reduce the number of logger instances created at startup. In addition, I think the fix is very simple. As I mentioned in my reply to Andrew, Alex Potochkin also brought up a consistency issue that will be addressed by 6880089 or a new CR. I'm ok to take out the lazy initialization of AWT loggers in my fix as long as the AWT team is going to fix 6880089 soon. Artem, Alex, what do you think? Thanks Mandy [1] http://blogs.sun.com/mr/entry/massive_monolithic_jdk From jonathan.gibbons at sun.com Tue Sep 15 19:22:02 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Tue, 15 Sep 2009 19:22:02 +0000 Subject: hg: jdk7/tl/langtools: 6882235: invalid exponent causes silent javac crash Message-ID: <20090915192203.BF6CB1221C@hg.openjdk.java.net> Changeset: 9dd34ed62341 Author: jjg Date: 2009-09-15 12:20 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/9dd34ed62341 6882235: invalid exponent causes silent javac crash Reviewed-by: darcy ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java + test/tools/javac/T6882235.java + test/tools/javac/T6882235.out From Mandy.Chung at Sun.COM Tue Sep 15 23:26:40 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Tue, 15 Sep 2009 16:26:40 -0700 Subject: Review Request for 6879044 In-Reply-To: <4AAE0A13.3080709@sun.com> References: <4AAD9D2D.6000502@sun.com> <4AAE0A13.3080709@sun.com> Message-ID: <4AB022B0.5080901@Sun.com> Alan, Thanks for the review. I'll send out a new webrev to incorporate your feedback. Yes, I file a CR for the http protocol handler: 6882384: Update http protocol handler to use PlatformLogger Several 2D and sun.font classes are refactored in the 2D repository that will be integrated for b74. Some classes I modified in the 2D repo are not in TL repo. To simplify the integration, I file a new CR 6882376 for the core-libs changes including changes in java.util classes that will go in TL repo that I think I can make b73. The AWT/2D/Swing changes will go in 2D repo as a fix for 6879044. I'll generate two new webrevs to separate the core-libs and awt/2d/swing stuff for the review. Thanks Mandy Alan Bateman wrote: > Mandy Chung wrote: >> 6879044: Eliminate the dependency of logging from the JRE >> core/awt/swing classes >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ > The approach seems reasonable to me. It is a bit strange to redirect the > platform logging to j.u.logging if something up the stack starts logging > but I think we can live with this because these loggers are for > debugging purposes. > > The changes to the AWT code are mostly mechanical, so I've only skimmed > these (assuming that someone from the AWT team with do a detailed check). > > Have you tested this with a security manager set? I'm just wondering if > PlatformLogger's static initializer should do the property lookup in a > doPrivileged block. Also in the LoggerProxy for the line separator (BTW: > lineSeparator can be final). > > Is isLoggingEnabled() used anywhere? I can't see it and wonder if it > should be removed. If it is used, then I assume it needs to be > synchronized with redirectPlatformLoggers. > > You allow the PlatformLoggers to be GC'ed but the entries will remain in > the loggers map. I don't think this is a big deal because the AWT > classes will not be unloaded but might be worth putting a note in a > comment to re-visit this some time. > > The static initializer in the forwarding proxy seems a bit messy. It > might look neater if changed to something like: > private static final Class loggerClass = > getClass("java.lang.Logger"); private static > final Method getLoggerMethod = getMethod(loggerClass, "getLogger", > String.class); > where getClass does the Class.forName, returning null if CNF, getMethod > returns null if passed a null class, etc. > > Minor nit but there are a few style/formatting issues in PlatformLogger. > For example, in JavaLogger there isn't a blank line between methods. It > might be worthing taking a pass over this to have it as neat as possible. > > Do you have a bugID to track updating the http protocol handler? Jessie > did push some changes to eliminate the static dependency on logging and > it would be good if that code used PlatformLogger. > > -Alan. From jonathan.gibbons at sun.com Wed Sep 16 01:37:26 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Wed, 16 Sep 2009 01:37:26 +0000 Subject: hg: jdk7/tl/langtools: 6860965: Project Coin: binary literals; ... Message-ID: <20090916013728.7A9981224D@hg.openjdk.java.net> Changeset: 69eaccd3ea85 Author: jjg Date: 2009-09-15 18:36 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/69eaccd3ea85 6860965: Project Coin: binary literals 6860973: Project Coin: Underscores in literals Summary: [Portions contributed by Bruce Chapman] Reviewed-by: darcy ! src/share/classes/com/sun/tools/javac/code/Source.java ! src/share/classes/com/sun/tools/javac/parser/Scanner.java ! src/share/classes/com/sun/tools/javac/resources/compiler.properties ! test/tools/javac/enum/6384542/T6384542.out + test/tools/javac/literals/BadBinaryLiterals.6.out + test/tools/javac/literals/BadBinaryLiterals.7.out + test/tools/javac/literals/BadBinaryLiterals.java + test/tools/javac/literals/BadUnderscoreLiterals.6.out + test/tools/javac/literals/BadUnderscoreLiterals.7.out + test/tools/javac/literals/BadUnderscoreLiterals.java + test/tools/javac/literals/BinaryLiterals.java + test/tools/javac/literals/UnderscoreLiterals.java From daniel.daugherty at sun.com Wed Sep 16 04:13:28 2009 From: daniel.daugherty at sun.com (daniel.daugherty at sun.com) Date: Wed, 16 Sep 2009 04:13:28 +0000 Subject: hg: jdk7/tl/jdk: 6882363: 4/4 typos in java.util.logging javadocs Message-ID: <20090916041404.D86C512266@hg.openjdk.java.net> Changeset: e8c2dd4b8bac Author: dcubed Date: 2009-09-15 22:11 -0600 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e8c2dd4b8bac 6882363: 4/4 typos in java.util.logging javadocs Summary: Fix typos, some grammar and some inconsistencies in phrasing. Reviewed-by: tbell ! src/share/classes/java/util/logging/ErrorManager.java ! src/share/classes/java/util/logging/FileHandler.java ! src/share/classes/java/util/logging/Formatter.java ! src/share/classes/java/util/logging/Handler.java ! src/share/classes/java/util/logging/Level.java ! src/share/classes/java/util/logging/LogRecord.java ! src/share/classes/java/util/logging/Logger.java ! src/share/classes/java/util/logging/LoggingMXBean.java ! src/share/classes/java/util/logging/MemoryHandler.java ! src/share/classes/java/util/logging/StreamHandler.java From Anthony.Petrov at Sun.COM Wed Sep 16 10:38:15 2009 From: Anthony.Petrov at Sun.COM (Anthony Petrov) Date: Wed, 16 Sep 2009 14:38:15 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AAFE06B.5080000@Sun.com> References: <4AAD9D2D.6000502@sun.com> <17c6771e0909141319w433d93bfma77cdb695cc8abb@mail.gmail.com> <4AAFE06B.5080000@Sun.com> Message-ID: <4AB0C017.8040203@sun.com> Hi Mandy, On 09/15/2009 10:43 PM, Mandy Chung wrote: > > Is it really that unlikely that fine() will be > > called that we need not initialise this early? > > AWT team, can you confirm? I didn't examine this particular AWTEvent class. I can confirm that in many places we call the fine() method directly. In most cases we only wrap the call with an if (logger.isLoggable(...)) when the string that we log contains some expressions (obviously, for performance reasons.) -- best regards, Anthony From scolebourne at joda.org Wed Sep 16 11:33:33 2009 From: scolebourne at joda.org (Stephen Colebourne) Date: Wed, 16 Sep 2009 12:33:33 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <1ccfd1c10909151102r460396fct103b032023311606@mail.gmail.com> References: <4AA812D0.309@sun.com> <4b4f45e00909091654t7891127bh24cc1df9c38bec7d@mail.gmail.com> <1ccfd1c10909091704i1f4f75dfm4ae1988d0903cd99@mail.gmail.com> <4AA849B1.1090005@sun.com> <1ccfd1c10909091808s772d454epfe7a1057ccb9ca9f@mail.gmail.com> <4AA857A8.1010700@sun.com> <4AAAAE03.5010002@sun.com> <1ccfd1c10909151102r460396fct103b032023311606@mail.gmail.com> Message-ID: <4b4f45e00909160433w1c78fa3ct4ae06b35f368ea72@mail.gmail.com> 2009/9/15 Martin Buchholz : > This test is particularly uninteresting. I'll commit soon even if I > don't get any review comments. * Returns a hash code for this {@code Byte}; equal to the result * of invoking {@code intValue()}. Doesn't this mean that the added part about intValue() will appear in the summary text for the method in Javadoc? I'd consider the 'how the method operates' to be detail, not summary, so would prefer: * Returns a hash code for this {@code Byte}. * The hash code is equal to the result of invoking {@code intValue()}. Stephen From Joel.Kamentz at sas.com Wed Sep 16 15:20:18 2009 From: Joel.Kamentz at sas.com (Joel Kamentz) Date: Wed, 16 Sep 2009 11:20:18 -0400 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <9F2CEE46-89BD-407C-B68C-00B819ABAE73@gmail.com> References: <9F2CEE46-89BD-407C-B68C-00B819ABAE73@gmail.com> Message-ID: <15412A37E8C9574393B24ADD991FAA760B8AD21D9A@MERCMBX14.na.sas.com> It's more for I/O, not general Object, but some methods which I almost ALWAYS use in a project are null-safe canonicalization and null-safe close methods. static File canonical(File f) { if (f == null) return null; try { return f.getCanonicalFile(); } catch (IOException e) { return f.getAbsoluteFile(); } } static void close(Reader s) { if (s == null) return; try { s.close(); } catch (IOException e) {} } static void close(Writer s) { if (s == null) return; try { s.close(); } catch (IOException e) {} } static void close(InputStream s) { if (s == null) return; try { s.close(); } catch (IOException e) {} } ... repeat for other stream types as necessary, like ZipFile, RandomAccessFile, etc. because no common inheritance In some projects I've changed the above to instead have the pattern of static IOException close(InputStream s) { if (s != null) { try { s.close(); } catch (IOException e) { return e; } } return null; } IMO, these are quite general in use as one should always clean up and close after I/O, but if the rest of it succeeded, one rarely cares if the close method hiccups: InputStream s = null; try { s = new FileInputStream(...); ... } catch (IOException e) { // if handling instead of throwing to caller } finally { close(s); } I also think join methods would be useful for strings / collections of strings or similar. Other things I often do are: Attempt to convert an URL to a local file, taking into account that it might be wrappered by jar:, that File.toURL doesn't process %20 and the like, etc. Delete files or sub-trees, catching exceptions and instead just return success / failure. Copy an InputStream to an OutputStream with supplied byte buffer (or allocate one internally). General file (or stream or ?) copying utility methods might be useful. Sometimes I want strings sorted case-insensitively, but without losing case (or during equals comparison). Joel -----Original Message----- From: core-libs-dev-bounces at openjdk.java.net [mailto:core-libs-dev-bounces at openjdk.java.net] On Behalf Of Ryan Slobojan Sent: Friday, September 11, 2009 10:39 AM To: core-libs-dev at openjdk.java.net Subject: Re: What methods should go into a java.util.Objects class in JDK 7? > Hello. > > For JDK 7, I think it is high-time the platform included a class like > java.util.Objects to hold commonly-written utility methods. For > example, a two-argument static equals method that returned true if > both > arguments are null, returns false is one argument is null, and > otherwise > returns the result of calling arg1.equals(arg2) (6797535 "Add shared > two argument static equals method to the platform"). > > A static hashCode method returning 0 for null and the value of > arg.hashCode() has also been suggested. > > A set of > > static int compareTo(int, int) > static int compareTo(long, long) > .... > > methods probably belongs somewhere in the platform too. > > What other utility methods would have broad enough use and > applicability > to go into a common java.util class? > > -Joe Hi, As a note, I've just put up an article about this on InfoQ soliciting feedback from the wider Java community: http://www.infoq.com/news/2009/09/jdk7-java-utils-object Thanks, Ryan Slobojan From david.lloyd at redhat.com Wed Sep 16 15:29:08 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 16 Sep 2009 10:29:08 -0500 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <15412A37E8C9574393B24ADD991FAA760B8AD21D9A@MERCMBX14.na.sas.com> References: <9F2CEE46-89BD-407C-B68C-00B819ABAE73@gmail.com> <15412A37E8C9574393B24ADD991FAA760B8AD21D9A@MERCMBX14.na.sas.com> Message-ID: <4AB10444.6060501@redhat.com> On 09/16/2009 10:20 AM, Joel Kamentz wrote: > It's more for I/O, not general Object, but some methods which I almost ALWAYS use in a project are null-safe canonicalization and null-safe close methods. Yeah I think that these would belong in an I/O package. That said... > static File canonical(File f) { > if (f == null) return null; > try { return f.getCanonicalFile(); } > catch (IOException e) { return f.getAbsoluteFile(); } > } No comment, other than to check out the NIO list archives and/or the current source tree which may already allow you to do this. > static void close(Reader s) { > if (s == null) return; > try { s.close(); } > catch (IOException e) {} > } These would be better written as a single "close(Closeable c)". Also, swallowing the exception is the wrong thing to do; at the very least it should be logged. > ... repeat for other stream types as necessary, like ZipFile, RandomAccessFile, etc. because no common inheritance These *should* all be fixed now to implement Closeable IIRC. > Delete files or sub-trees, catching exceptions and instead just return success / failure. > > Copy an InputStream to an OutputStream with supplied byte buffer (or allocate one internally). General file (or stream or ?) copying utility methods might be useful. Definitely in the I/O realm, ask Alan on the NIO list. The delete thing might already be done :) - DML From i30817 at gmail.com Wed Sep 16 15:55:15 2009 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 16 Sep 2009 16:55:15 +0100 Subject: core-libs-dev Digest, Vol 29, Issue 40 In-Reply-To: References: Message-ID: <212322090909160855i2316d75ibb02d2f6bd90e055@mail.gmail.com> This won't be used anyway, now with arm, but the more general way, you method his more useful in this variation. The exception are oddball classes like Sockets and all the SQL classes, images (dispose()) that are not closeable, even if the acquire native resources. static List close(Closeable ... s) { if (s != null) { List exceptions = new ArrayList(); for(Closeable s1 : s){ try { s.close(); } catch (IOException e) { exceptions.add(e); } } return exceptions; } return Collections.emptyList(); } From i30817 at gmail.com Wed Sep 16 16:03:17 2009 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 16 Sep 2009 17:03:17 +0100 Subject: core-libs-dev Digest, Vol 29, Issue 40 In-Reply-To: <212322090909160855i2316d75ibb02d2f6bd90e055@mail.gmail.com> References: <212322090909160855i2316d75ibb02d2f6bd90e055@mail.gmail.com> Message-ID: <212322090909160903scf8604cs69c09ed2122cf2be@mail.gmail.com> I'd like a way to produce a File that is known to be valid from a existing File assumed to be valid and a String. The string would be mangled if needed according to the file system (truncating too large name, eliminating forbidden characters) per file system installed. I currently use this, but it not optimal obviously. Also i recall the exception if the filesystem invariants were transgressed was mysterious. public static File getSafeFileSystemFile(File parent, String child) throws IOException { if (parent.isDirectory() || parent.mkdirs()) { String parentPath = parent.getCanonicalPath(); String childPath = whiteList.matcher(child).replaceAll(" "); //-1 is seperator int maxLen = 255 - parentPath.length() - 1; if (childPath.length() > maxLen) { int extensionSeparator = childPath.lastIndexOf('.'); String extension = ""; if (extensionSeparator != -1) { extension = childPath.substring(extensionSeparator, childPath.length()); maxLen -= extension.length(); } int i = maxLen - 1; while (childPath.charAt(i) != ' ' && i > 0) { i--; } while (childPath.charAt(i) == ' ' && i > 0) { i--; } if (i == 0) { childPath = childPath.substring(0, maxLen - 1); } else { childPath = childPath.substring(0, i + 1); } return new File(parentPath + File.separator + childPath + extension); } return new File(parent, childPath); } else { throw new IllegalArgumentException("The parent file path given is not writable or the file not a directory"); } } Deleting a file is a chore now, since deleting a normal file and deleting a directory, is somewhat different, and to delete directory we have to delete the containing files in a recursion. I'm sure that in some filesytems this could be more efficient if done in the api. From Alan.Bateman at Sun.COM Wed Sep 16 16:08:37 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Wed, 16 Sep 2009 17:08:37 +0100 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <15412A37E8C9574393B24ADD991FAA760B8AD21D9A@MERCMBX14.na.sas.com> References: <9F2CEE46-89BD-407C-B68C-00B819ABAE73@gmail.com> <15412A37E8C9574393B24ADD991FAA760B8AD21D9A@MERCMBX14.na.sas.com> Message-ID: <4AB10D85.8040402@sun.com> Joel Kamentz wrote: > : > } > > static void close(InputStream s) { > if (s == null) return; > try { s.close(); } > catch (IOException e) {} > } > > ... repeat for other stream types as necessary, like ZipFile, RandomAccessFile, etc. because no common inheritance > Just on this one, maybe you are looking for java.io.Closeable? ZipFile was updated to implement it a while back. Then again, perhaps Closeable is too general because you wouldn't want to do this with output or other writable streams (because of possible data loss if the close needs to flush buffered bytes and it fails). > : > > Attempt to convert an URL to a local file, taking into account that it might be wrappered by jar:, that File.toURL doesn't process %20 and the like, etc. > File.toURL is deprecated. You might want to look at File.toURI. > Delete files or sub-trees, catching exceptions and instead just return success / failure. > This one comes up a lot and has been addressed in the file system API work in jdk7. So if you have a File f you can replace f.delete() with f.toPath().delete() and it will do what you want. Recursive delete is relatively easy too, using Files.walkFileTree. There's an example in the javadoc that does this (look in java.nio.file.FileVisitor). > Copy an InputStream to an OutputStream with supplied byte buffer (or allocate one internally). General file (or stream or ?) copying utility methods might be useful. > File copy is supported in the file system API. Look at Path.copyTo. It has options to indicate if the target file should be replaced, if file attributes should be copied, etc. In the nio repository there are prototype java.io.Inputs and java.io.Outputs classes that define static methods for useful/common tasks like reading all bytes or lines from a file or input stream. There is also a method to copy all bytes from an input stream to an output stream. It's on my list to finish this off and get them into jdk7. -Alan. From Alan.Bateman at Sun.COM Wed Sep 16 16:10:52 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Wed, 16 Sep 2009 17:10:52 +0100 Subject: core-libs-dev Digest, Vol 29, Issue 40 In-Reply-To: <212322090909160855i2316d75ibb02d2f6bd90e055@mail.gmail.com> References: <212322090909160855i2316d75ibb02d2f6bd90e055@mail.gmail.com> Message-ID: <4AB10E0C.6070907@sun.com> Paulo Levi wrote: > This won't be used anyway, now with arm, but the more general way, you > method his more useful in this variation. The exception are oddball > classes like Sockets and all the SQL classes, images (dispose()) that > are not closeable, java.net.Socket and a few other classes have been retrofitted to implement Closeable in jdk7. -Alan. From assembling.signals at yandex.ru Wed Sep 16 21:03:57 2009 From: assembling.signals at yandex.ru (assembling signals) Date: Thu, 17 Sep 2009 01:03:57 +0400 Subject: Enum modernization proposal Message-ID: <142581253135037@webmail127.yandex.ru> Hello everyone! I want to propose an enum-enhancing feature, which would not require any changes to the language spec and would work as a drop-in replacement for the old pseudo-enum concept (final static int ...) (First of all, is this topic the right one for this mailing list?) General benefits are: - Doesn't break API-compatibility: suited as drop-in replacement; - Not mandatory: use, if you want it (same as in the type annotations proposal, don't know the JSR); - Later improvement in usability possible by adjusting tools and IDEs, such as checks for legacy code concerning correctness of return values; - Whole APIs (even the whole JDK) could be enhances using one of these proposals. In the following examples I use an "enum" which declares three values ( SOME_STATE_[ONE|TWO|THREE] ) What do you think of the proposals? Is it suitable to be considered for JDK7? Best regards, Ivan G Shevchenko, University of Essen, 2009-09-16. -- assembling dot signals at yandex dot ru ===== old: ======================================== Declaration: public final static int SOME_STATE_ONE = 1; public final static int SOME_STATE_TWO = 2; public final static int SOME_STATE_THREE = 3; Usage: public void setState(int state){ System.out.println("state is: " + state); } public int getState(){ return state; } Drawbacks: - Types not distinguishable during runtime, not even during design time; - No validation possible. ===== proposal ONE: ======================================== Declaration: // CHANGE 1: Use @EnumType for declaration @EnumType("StateType") public final static int SOME_STATE_ONE = 1; @EnumType("StateType") public final static int SOME_STATE_TWO = 2; @EnumType("StateType") public final static int SOME_STATE_THREE = 3; Usage: // CHANGE 2a: Use @EnumArg for argument usage public void setState(@EnumArg("StateType") int state){ System.out.println("state is: " + EnumUtils.nameFor(state)); } // CHANGE 2b: Use @EnumReturn for return value usage @EnumReturn("StateType") public int getState(){ return state; } Benefits: Using an utility API, following can be done: - Enum type's names may be retrieved; - Enum values' names may be retrieved; - Input arguments can be validated. ===== Proposal TWO: ======================================== Declaration: // CHANGE: Use a tag class @EnumTypeDecl public final class StateType { } @EnumType(StateType.class) public final static int SOME_STATE_ONE = 1; @EnumType(StateType.class) public final static int SOME_STATE_TWO = 2; @EnumType(StateType.class) public final static int SOME_STATE_THREE = 3; Usage: public void setState(@EnumArg(StateType.class) int state){ System.out.println("state is: " + EnumUtils.nameFor(state)); } @EnumReturn(StateType.class) public int getState(){ return state; } Benefits: (same as proposal ONE, plus) - Because of the tag class, can be refactored correctly; - IDE-helpers such as "go to type" will work, without the need to change IDEs. ===== Proposal THREE: ======================================== Declaration: // CHANGE 1: Use a real enum ("adapter enum") with real enum values @EnumTypeDecl public enum StateType { SOME_STATE_ONE, SOME_STATE_TWO, SOME_STATE_THREE; } // CHANGE 2: Specify not only the enum type, // bus also real values @EnumType(StateType.class, StateType.SOME_STATE_ONE) public final static int SOME_STATE_ONE = 1; @EnumType(StateType.class, StateType.SOME_STATE_TWO) public final static int SOME_STATE_TWO = 2; @EnumType(StateType.class, StateType.SOME_STATE_THREE) public final static int SOME_STATE_THREE = 3; Usage for legacy code (which requires API commpatibility): public void setState(@EnumArg(StateType.class) int state){ System.out.println("state is: " + EnumUtils.nameFor(state)); } @EnumReturn(StateType.class) public int getState(){ return state; } // CHANGE 3: Usage for new code: public void setState(StateType state){ System.out.println("state is: " + state); } public StateType getState(){ return state; } Benefits: (same as proposal TWO, plus) - New code, using a legacy API "just works" as usual, using the adapter enum; - Utility API could provide even more convenience when using legacy APIs, now that enum values are also named. From david.lloyd at redhat.com Wed Sep 16 21:06:49 2009 From: david.lloyd at redhat.com (David M. Lloyd) Date: Wed, 16 Sep 2009 16:06:49 -0500 Subject: Enum modernization proposal In-Reply-To: <142581253135037@webmail127.yandex.ru> References: <142581253135037@webmail127.yandex.ru> Message-ID: <4AB15369.7010504@redhat.com> Java has had "real" enums since Java 5: http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html - DML On 09/16/2009 04:03 PM, assembling signals wrote: > Hello everyone! > > I want to propose an enum-enhancing feature, which would not require > any changes to the language spec and would work as a drop-in > replacement for the old pseudo-enum concept (final static int ...) > > (First of all, is this topic the right one for this mailing list?) > > General benefits are: > - Doesn't break API-compatibility: suited as drop-in replacement; > - Not mandatory: use, if you want it (same as in the type > annotations proposal, don't know the JSR); > - Later improvement in usability possible by adjusting tools and > IDEs, such as checks for legacy code concerning correctness > of return values; > - Whole APIs (even the whole JDK) could be enhances using one of > these proposals. > > In the following examples I use an "enum" which declares three values > ( SOME_STATE_[ONE|TWO|THREE] ) > > What do you think of the proposals? > Is it suitable to be considered for JDK7? > > Best regards, Ivan G Shevchenko, University of Essen, 2009-09-16. > -- assembling dot signals at yandex dot ru > > ===== old: ======================================== > > Declaration: > > public final static int SOME_STATE_ONE = 1; > public final static int SOME_STATE_TWO = 2; > public final static int SOME_STATE_THREE = 3; > > Usage: > > public void setState(int state){ > System.out.println("state is: " + state); > } > > public int getState(){ > return state; > } > > Drawbacks: > - Types not distinguishable during runtime, not even during > design time; > - No validation possible. > > ===== proposal ONE: ======================================== > > Declaration: > > // CHANGE 1: Use @EnumType for declaration > @EnumType("StateType") > public final static int SOME_STATE_ONE = 1; > @EnumType("StateType") > public final static int SOME_STATE_TWO = 2; > @EnumType("StateType") > public final static int SOME_STATE_THREE = 3; > > Usage: > > // CHANGE 2a: Use @EnumArg for argument usage > public void setState(@EnumArg("StateType") int state){ > System.out.println("state is: " + EnumUtils.nameFor(state)); > } > > // CHANGE 2b: Use @EnumReturn for return value usage > @EnumReturn("StateType") > public int getState(){ > return state; > } > > Benefits: > Using an utility API, following can be done: > - Enum type's names may be retrieved; > - Enum values' names may be retrieved; > - Input arguments can be validated. > > ===== Proposal TWO: ======================================== > > Declaration: > > // CHANGE: Use a tag class > @EnumTypeDecl > public final class StateType { } > > @EnumType(StateType.class) > public final static int SOME_STATE_ONE = 1; > @EnumType(StateType.class) > public final static int SOME_STATE_TWO = 2; > @EnumType(StateType.class) > public final static int SOME_STATE_THREE = 3; > > Usage: > > public void setState(@EnumArg(StateType.class) int state){ > System.out.println("state is: " + EnumUtils.nameFor(state)); > } > > @EnumReturn(StateType.class) > public int getState(){ > return state; > } > > Benefits: > (same as proposal ONE, plus) > - Because of the tag class, can be refactored correctly; > - IDE-helpers such as "go to type" will work, without the need to > change IDEs. > > ===== Proposal THREE: ======================================== > > Declaration: > > // CHANGE 1: Use a real enum ("adapter enum") with real enum values > @EnumTypeDecl > public enum StateType { > SOME_STATE_ONE, SOME_STATE_TWO, SOME_STATE_THREE; > } > > // CHANGE 2: Specify not only the enum type, > // bus also real values > @EnumType(StateType.class, StateType.SOME_STATE_ONE) > public final static int SOME_STATE_ONE = 1; > @EnumType(StateType.class, StateType.SOME_STATE_TWO) > public final static int SOME_STATE_TWO = 2; > @EnumType(StateType.class, StateType.SOME_STATE_THREE) > public final static int SOME_STATE_THREE = 3; > > Usage for legacy code (which requires API commpatibility): > > public void setState(@EnumArg(StateType.class) int state){ > System.out.println("state is: " + EnumUtils.nameFor(state)); > } > > @EnumReturn(StateType.class) > public int getState(){ > return state; > } > > // CHANGE 3: > Usage for new code: > > public void setState(StateType state){ > System.out.println("state is: " + state); > } > > public StateType getState(){ > return state; > } > > Benefits: > (same as proposal TWO, plus) > - New code, using a legacy API "just works" as usual, using the > adapter enum; > - Utility API could provide even more convenience when using legacy > APIs, now that enum values are also named. From Mandy.Chung at Sun.COM Thu Sep 17 00:38:19 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Wed, 16 Sep 2009 17:38:19 -0700 Subject: Review Request for 6879044 In-Reply-To: <4AAD9D2D.6000502@sun.com> References: <4AAD9D2D.6000502@sun.com> Message-ID: <4AB184FB.7080603@sun.com> Here are the new webrevs: core-libs changes that include java.util.Currency: http://cr.openjdk.java.net/~mchung/6882376/webrev.00/ - Added a new jtreg test - Cleaned up PlatformLogger.java per Alan's feedback. awt/2d/swing changes: http://cr.openjdk.java.net/~mchung/6879044/webrev.01/ - Keep the logger in AWTEvent.java and Cursor.java be statically initialized. - I updated 6880089 to consider lazy initialization or reduce to a few loggers vs 85 on unix and 35 on windows. I decide to leave it to the fix for 6880089 to make a consistent change. Files other than the one listed above are not changed since the last version. Thanks Mandy Mandy Chung wrote: > 6879044: Eliminate the dependency of logging from the JRE > core/awt/swing classes > > Webrev: > http://cr.openjdk.java.net/~mchung/6879044/webrev.00/ > > Summary: > 1. A new sun.util.logging.PlatformLogger class that will handle the > log messages in a similar way as Logger but it will only delegate to > java.util.logging only when it is enabled. LogManager and LogRecord > are modified to support the platform loggers. The users of > PlatformLogger will continue to run if java.util.logging classes do > not exist. > > 2. AWT, 2D, Swing, and a few java.util classes are modified to use > PlatformLogger instead of Logger. Although many files are modified, > the change is mostly replacement with classname. > > AWT statically creates a number of loggers. Running a simple AWT > Framer application with JDK 7 b71 creates 79 loggers on solaris-i586 > and 34 loggers on windows-i586. SwingSet2 creates a total of 85 > loggers including a few non-awt ones on solaris-i586 and 35 on > windows-i586). > Although the memory usage might not be very high (especially with this > fix), I don't see the need of having many fine-grained loggers. This > fix doesn't address this the number of AWT loggers. I file a separate > CR (6880089) to revisit it. > > Startup Performance: > This change does not have significant startup performance improvement, > as expected. However, it does reduce the number of loaded classes > (Framer app loads 16 fewer classes and jedit loads 13 fewer classes). > > > Thanks > Mandy > > From son.two at gmail.com Thu Sep 17 02:43:16 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Thu, 17 Sep 2009 06:43:16 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AAFE744.4050009@Sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> Message-ID: <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> On Tue, Sep 15, 2009 at 11:13 PM, Mandy Chung wrote: > > > Oleg Sukhodolsky wrote: >> >> On Mon, Sep 14, 2009 at 9:19 PM, Mandy Chung wrote: >> >> I thought that it is possible to log int a file using default logger, > > Not the default logging configuration. > >> thus I was surprised that >> description of PlatformLogger says about System.err. ?I'd expect >> PlatformLogger to be a wrapper around the default logger, >> and as far as I can see from provided sources it is. > > System.err is the default configuration that ConsoleHandler will output to. > ?The default handler specified in /lib/logging.properties is: > > # By default we only configure a ConsoleHandler, which will only > # show messages at the INFO and above levels. > handlers= java.util.logging.ConsoleHandler > > # To also add the FileHandler, use the following line instead. > #handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler > > If you want to log to a file, you need to supply a logging.properties to > alter the handles property. ? If you specify > -Djava.util.logging.config.file=, all log messages > will go to the file as described by your logging.properties. The only > difference with the fix is that the platform loggers doesn't check if the > /lib/logging.properties is modified. > >> internal PlatformLogger is present in Sun's implementation of JRE >> only, so such changes will >> complicate porting JRE implementation. > > How does it complicate the porting? I'm not sure that IBM's or some other's version of JDK is allowed to contain such classes, thus it may be harder to port our RI to their implementation . > The issue we are dealing with is that the JDK is big and deeply > interconnected [1]. ?A command-line hello program loads 300 classes and a > Framer (awt version of helloworld) loads 834 classes running with JDK 7 b71. > > Without module support ?(JSR 294 + jigsaw) - like we are today, continual > JDK development could cause startup of a simple awt app to load over 1000 > classes very easily (I actually recalled that one point in time it was over > 1000 classes but we put a fix to reduce the number of loaded classes). What if an application will use logging? How many Logger.getLogger() user need to add to his(her) code to completely initialize logging and make your changes useless? How often we will have user's code which doesn't use logging? Why we have to remove all usages of logging in our code instead of changing logging package to be more startup friendly? Oleg. >> Also I wonder how big logging >> module is, what advantage we do receive >> by removing dependency on it? ?How many Mb we do not need to load in this >> case? > > Not only the MB of the java.util.logging classes but the classes they pull > in at runtime. > >> I'd suggest to keep all logger's initialization as is to simplify the fix. > > My goal is to reduce the number of logger instances created at startup. ?In > addition, I think the fix is very simple. ?As I mentioned in my reply to > Andrew, Alex Potochkin also brought up a consistency issue that will be > addressed by 6880089 or a new CR. > > I'm ok to take out the lazy initialization of AWT loggers in my fix as long > as the AWT team is going to fix 6880089 soon. ?Artem, Alex, what do you > think? > > Thanks > Mandy > > [1] http://blogs.sun.com/mr/entry/massive_monolithic_jdk > From frederic.martini at gmail.com Thu Sep 17 07:16:50 2009 From: frederic.martini at gmail.com (=?ISO-8859-1?Q?Fr=E9d=E9ric_Martini?=) Date: Thu, 17 Sep 2009 09:16:50 +0200 Subject: C system() equivalent method. Message-ID: Hello (before to start, sorry for my bad english) I have seen in the last JDK's build that ProcessBuilder allow to manage the process I/O more efficiently. In particular, the inheritIO() set the subprocess standard I/O to be the same as those of the current Java process, and offer a behavior "equivalent" to the standard C library function system(). This is very great an usefull ! But there is another BIG difference between ProcessBuilder and the C library function system() : ProcessBuilder execute an application, and C system() evaluate a command-line using the OS's shell. So C's system() can use a lot of OS's specific syntax ($ENV or %ENV%, * ?, pipe, redirect, etc...) witch is incorrect on a ProcessBuilder (because this syntax is not interpreted but directly passed to the application). This is a common misunderstanding for Java's developer... My proposal simply consist to add a method that create a ProcessBuilder pre-filled with a shell command's line, by invoking the OS's shell ("/bin/sh" on Unixes, "command.com" on Win9x, "cmd.exe" on WinNT, etc. ? ) in order to evaluate a more complex command-line. A "basic" implementation can be like this : ====================================================================== /** * Create a new ProcessBuilder initialized to call an OS's * specific command-line. */ public static ProcessBuilder createShellFor(String commandLine) { String osName = System.getProperty("os.name"); if (osName.startsWith("Windows")) { if (osName.startsWith("Windows 95") || osName.startsWith("Windows 98") || osName.startsWith("Windows Me") ) { return new ProcessBuilder("command.com", "/C", commandLine); } return new ProcessBuilder("cmd.exe", "/C", commandLine); } return new ProcessBuilder("/bin/sh", "-c", commandLine); } ====================================================================== This method can be improved with more specific code depending on OS. And a "system()" method with a behavior really equivalent to the standard C library function system(), like this : ====================================================================== /** * Executes a command specified in 'commandLine' by calling * the OS shell program, and returns after the command has been completed. * @param commandLine The command-line to execute, using OS shell. * @return the exit value of the subprocess */ public static int system(String commandLine) throws IOException, InterruptedException { final Process process = createShellFor(commandLine).inheritIO().start(); try { return process.waitFor(); } finally { process.destroy(); } } ====================================================================== So, more complex and specific command-line can be used directly, like in lots of others languages... Thanks for reading, Fred From Alan.Bateman at Sun.COM Thu Sep 17 08:56:42 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 17 Sep 2009 09:56:42 +0100 Subject: Review Request for 6879044 In-Reply-To: <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> Message-ID: <4AB1F9CA.40309@sun.com> Oleg Sukhodolsky wrote: > On Tue, Sep 15, 2009 at 11:13 PM, Mandy Chung wrote: > >> : >>> complicate porting JRE implementation. >>> >> How does it complicate the porting? >> > > I'm not sure that IBM's or some other's version of JDK is allowed to > contain such > classes, thus it may be harder to port our RI to their implementation . > I don't see a problem here. These are implementation classes (you'll see that AWT already makes use of lot of implementation classes from sun.awt, sun.security, sun.java2d, and more). Furthermore, these changes aren't introducing any platform dependent or native code that increases porting efforts. If there are ports that already remove these loggers then the effort, once Mandy's changes are in, isn't any different. : > Why we have to remove all usages of logging in our code instead of > changing logging package to be > more startup friendly? > I haven't seen any proposals to eliminate the logging but rather the suggestion is that this logging should be re-examined because there are way too many loggers created at startup. For example, one of the suggestions that Mandy has put in 6880089 [1] is that there be a logger per core component rather than class. -Alan. [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6880089 From son.two at gmail.com Thu Sep 17 09:20:35 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Thu, 17 Sep 2009 13:20:35 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AB1F9CA.40309@sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> Message-ID: <271e55d20909170220i73d31a2do43b8dcf750f792d1@mail.gmail.com> On Thu, Sep 17, 2009 at 12:56 PM, Alan Bateman wrote: > Oleg Sukhodolsky wrote: >> >> On Tue, Sep 15, 2009 at 11:13 PM, Mandy Chung wrote: >> >>> >>> : >>>> >>>> complicate porting JRE implementation. >>>> >>> >>> How does it complicate the porting? >>> >> >> I'm not sure that IBM's or some other's version of JDK is allowed to >> contain such >> classes, thus it may be harder to port our RI to their implementation . >> > > I don't see a problem here. These are implementation classes (you'll see > that AWT already makes use of lot of implementation classes from sun.awt, > sun.security, sun.java2d, and more). Furthermore, these changes aren't > introducing any platform dependent or native code that increases porting > efforts. If there are ports that already remove these loggers then the > effort, once Mandy's changes are in, isn't any different. Ok, they just add one more issue to solve for porters :) >> Why we have to remove all usages of logging in our code instead of >> changing logging package to be >> more startup friendly? >> > > I haven't seen any proposals to eliminate the logging but rather the > suggestion is that this logging should be re-examined because there are way > too many loggers created at startup. For example, one of the suggestions > that Mandy has put in 6880089 [1] is that there be a logger per core > component rather than class. By "remove all usages of logging" I meant "remove all usages of standard logging package". And, again, I do not understand why we can not change the logging package instead (perhaps we can not, but no body has explained why). BTW if we can change the logging package to resolve this problem for our code, such changes will also help to other java developers. Also since it look like all suggested changes are about startup performance it would be nice to see results of performance testing which would prove that suggested changes will help, and show what kind of applications will benefit from the changes. Without such results we can not be sure that the changes will help and they can be treated as "premature optimization" Oleg. > > -Alan. > > [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6880089 > > > From Anthony.Petrov at Sun.COM Thu Sep 17 10:01:13 2009 From: Anthony.Petrov at Sun.COM (Anthony Petrov) Date: Thu, 17 Sep 2009 14:01:13 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AB1F9CA.40309@sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> Message-ID: <4AB208E9.8020900@sun.com> On 09/17/2009 12:56 PM, Alan Bateman wrote: > I haven't seen any proposals to eliminate the logging but rather the > suggestion is that this logging should be re-examined because there are > way too many loggers created at startup. For example, one of the > suggestions that Mandy has put in 6880089 [1] is that there be a logger > per core component rather than class. I have to say that that is not the best possible solution. For instance, the sun.awt.X11 classes have many different loggers: for focus-related code, for insets-related code, and so on. If a developer debugs a particular kind of problem, (s)he doesn't need to look through all the garbage that other loggers generate: it's just enough to enable a particular logging facility (such as the "sun.awt.X11.insets.XDecoratedPeer" for example) and examine what (s)he really needs. Combining all the output to just one logger will make debugging a nightmare. I would second to Oleg: improving the performance/design of the existing logging classes at java.util.logging package would help all applications at once. -- best regards, Anthony From Alan.Bateman at Sun.COM Thu Sep 17 10:08:55 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 17 Sep 2009 11:08:55 +0100 Subject: Review Request for 6879044 In-Reply-To: <4AB184FB.7080603@sun.com> References: <4AAD9D2D.6000502@sun.com> <4AB184FB.7080603@sun.com> Message-ID: <4AB20AB7.1020506@sun.com> Mandy Chung wrote: > Here are the new webrevs: > > core-libs changes that include java.util.Currency: > http://cr.openjdk.java.net/~mchung/6882376/webrev.00/ > > - Added a new jtreg test > - Cleaned up PlatformLogger.java per Alan's feedback. This looks much better. A couple of additional comments: I see the lookup of the logging properties is now in a doPrivileged block - do you need to do the same for the line.separator? In LoggerProxy, should levelValue and effectiveLevel be volatile? In JavaLogger.getMethod I see that you return null if the method is not found. Should it be better to throw an InternalError or AssertionError here? That is, if java.util.logging is present then something is seriously wrong is the Logger methods don't exist. Otherwise, I think I'm okay with this. -Alan. From Alan.Bateman at Sun.COM Thu Sep 17 10:43:06 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 17 Sep 2009 11:43:06 +0100 Subject: Review Request for 6879044 In-Reply-To: <4AB208E9.8020900@sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> Message-ID: <4AB212BA.6040405@sun.com> Anthony Petrov wrote: > : > I have to say that that is not the best possible solution. For > instance, the sun.awt.X11 classes have many different loggers: for > focus-related code, for insets-related code, and so on. If a developer > debugs a particular kind of problem, (s)he doesn't need to look > through all the garbage that other loggers generate: it's just enough > to enable a particular logging facility (such as the > "sun.awt.X11.insets.XDecoratedPeer" for example) and examine what > (s)he really needs. > Combining all the output to just one logger will make debugging a > nightmare. > > I would second to Oleg: improving the performance/design of the > existing logging classes at java.util.logging package would help all > applications at once. I'm not familiar with the AWT implementation to have a strong view as to how 6880089 is addressed. However, Mandy does raise a good question as to why there is a need for so many loggers. I think one mail mentioned there 85 loggers setup when running simple "hello world" Framer test. Maybe they can be created lazily; maybe some of them aren't needed, but at least there is a bug created so that someone can re-visit this. I agree that any improvements to j.u.logging would be welcome too but that doesn't solve the desire to decouple the dependency. For example, if the libraries are broken up into a set of fine grain modules then why would I need to have a logging module installed to run a simple client application? -Alan. From son.two at gmail.com Thu Sep 17 11:17:56 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Thu, 17 Sep 2009 15:17:56 +0400 Subject: Review Request for 6879044 In-Reply-To: <4AB212BA.6040405@sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> Message-ID: <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> On Thu, Sep 17, 2009 at 2:43 PM, Alan Bateman wrote: > Anthony Petrov wrote: >> >> : >> I have to say that that is not the best possible solution. For instance, >> the sun.awt.X11 classes have many different loggers: for focus-related code, >> for insets-related code, and so on. If a developer debugs a particular kind >> of problem, (s)he doesn't need to look through all the garbage that other >> loggers generate: it's just enough to enable a particular logging facility >> (such as the >> "sun.awt.X11.insets.XDecoratedPeer" for example) and examine what (s)he >> really needs. >> Combining all the output to just one logger will make debugging a >> nightmare. >> >> I would second to Oleg: improving the performance/design of the existing >> logging classes at java.util.logging package would help all applications at >> once. > > I'm not familiar with the AWT implementation to have a strong view as to how > 6880089 is addressed. However, Mandy does raise a good question as to why > there is a need for so many loggers. I think one mail mentioned there 85 > loggers setup when running simple "hello world" Framer test. Maybe they can > be created lazily; maybe some of them aren't needed, but at least there is a > bug created so that someone can re-visit this. I agree that any improvements > to j.u.logging would be welcome too but that doesn't solve the desire to > decouple the dependency. imho removing dependency on j.u.logging for me looks as strange as removing dependency on j.l.Object or java.util.* :) > For example, if the libraries are broken up into a > set of fine grain modules then why would I need to have a logging module > installed to run a simple client application? Perhaps because most application use logging ;) From son.two at gmail.com Thu Sep 17 11:32:45 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Thu, 17 Sep 2009 15:32:45 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AB21B68.90603@sun.com> References: <4AAD9D2D.6000502@sun.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> Message-ID: <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> On Thu, Sep 17, 2009 at 3:20 PM, Igor Nekrestyanov wrote: > >> imho removing dependency on j.u.logging for me looks as strange as >> removing >> dependency on j.l.Object or java.util.* :) >> >> >>> >>> For example, if the libraries are broken up into a >>> set of fine grain modules then why would I need to have a logging module >>> installed to run a simple client application? >>> >> >> Perhaps because most application use logging ;) >> > > But in general it is useful for developers only. Agree, but if the application uses logging (which is disabled of course) it anyway initialize the logging and has the same problem as AWT or 2D have now. > Why end user need it unless it wants to debug/trace? the end-user doesn't need logging, but application may contain it any way. Oleg. > > -igor > > From mlists at juma.me.uk Thu Sep 17 12:00:57 2009 From: mlists at juma.me.uk (Ismael Juma) Date: Thu, 17 Sep 2009 12:00:57 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot References: <4AAF6D70.4050809@Sun.COM> Message-ID: Hi Vladimir, Vladimir Yaroslavskiy writes: > random 01 random 01 > dpq: 1431 dpq: 8017 > tim: 11495 tim: 2717 > jdk: 1552 jdk: 8547 Is the size of the int array different than the size of the j.l.Integer array? I ask because I would be surprised if timsort were that much faster when sorting an array of j.l.Integers versus sorting an array of ints. Best, Ismael From Anthony.Petrov at Sun.COM Thu Sep 17 12:38:28 2009 From: Anthony.Petrov at Sun.COM (Anthony Petrov) Date: Thu, 17 Sep 2009 16:38:28 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> Message-ID: <4AB22DC4.2050106@sun.com> On 09/17/2009 03:32 PM, Oleg Sukhodolsky wrote: >>> imho removing dependency on j.u.logging for me looks as strange as >>> removing >>> dependency on j.l.Object or java.util.* :) >>> >>> >>>> For example, if the libraries are broken up into a >>>> set of fine grain modules then why would I need to have a logging module >>>> installed to run a simple client application? >>>> >>> Perhaps because most application use logging ;) >>> >> But in general it is useful for developers only. > > Agree, but if the application uses logging (which is disabled of course) > it anyway initialize the logging and has the same problem as AWT or 2D have now. > >> Why end user need it unless it wants to debug/trace? > > the end-user doesn't need logging, but application may contain it any way. The fix simply introduces a lightweight version of the logging facility. Still, we didn't see any figures demonstrating a possible performance gain, or memory-usage optimization, or download size reduction. These would be very interesting to look over. -- best regards, Anthony From Igor.Nekrestyanov at Sun.COM Thu Sep 17 11:17:55 2009 From: Igor.Nekrestyanov at Sun.COM (Igor Nekrestyanov) Date: Thu, 17 Sep 2009 04:17:55 -0700 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AB208E9.8020900@sun.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> Message-ID: <4AB21AE3.8090207@sun.com> > I would second to Oleg: improving the performance/design of the > existing logging classes at java.util.logging package would help all > applications at once. That certainly will be best thing to do but unfortunately it is not easy (possible?) maintaining backward compatibility. Several people had been looking into this in the past. Please feel free to advise if you see how it can be improved. -igor From Igor.Nekrestyanov at Sun.COM Thu Sep 17 11:20:08 2009 From: Igor.Nekrestyanov at Sun.COM (Igor Nekrestyanov) Date: Thu, 17 Sep 2009 04:20:08 -0700 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <271e55d20909132044k3b6b7a5bw86e87a5e21a2c34e@mail.gmail.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> Message-ID: <4AB21B68.90603@sun.com> > imho removing dependency on j.u.logging for me looks as strange as removing > dependency on j.l.Object or java.util.* :) > > >> For example, if the libraries are broken up into a >> set of fine grain modules then why would I need to have a logging module >> installed to run a simple client application? >> > > Perhaps because most application use logging ;) > But in general it is useful for developers only. Why end user need it unless it wants to debug/trace? -igor From Mandy.Chung at Sun.COM Thu Sep 17 17:54:10 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Thu, 17 Sep 2009 10:54:10 -0700 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <4AAE7B12.5000403@Sun.com> <271e55d20909142004r4b566cdawfe935115bd099e9d@mail.gmail.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> Message-ID: <4AB277C2.8030603@Sun.com> Oleg, Anthony, You all raise good questions and we shall focus on the problem we want to fix by 6879044 and 6882376. It's important to separate the discussion for this fix vs the startup performance improvement. I hope below clears up some confusion and this review request is for addressing problem described in (1). (1) The problem is to decouple the dependency on logging from some JRE components. FYI. The jigsaw project page [1] provides links to the good background why we're doing that. Mark gave a very good overview and demo of Project jigsaw at JavaOne General Technical Session[2]. Logging is one candidate module if the libraries are broken up into a set of fine grained modules. The fix for 6882376 provides the internal support for JRE implementation to eliminate their dependency on logging. Alan and Naoto reviewed the fix. As for the AWT/2D/Swing changes, 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes, When the libraries are broken into modules, are you saying that the client module should require the logging module to exist? On the other hand, as Alan explained, why would a user need to have a logging module installed to run a simple client application? Artem and Dmitri reviewed the fix. If you have another proposal of decoupling the dependency, I would be interested too. (2) Startup performance improvement The suggested change does not have a signifcant startup performance as expected (as I mentioned in the bug report). It does load fewer classes (~16 classes) which isn't bad. My apology if I confuse you when we mixed it in this review request. I have done some performance analysis [3] [4] to determine what opportunity the jigsaw module system could implement and the estimate of the startup time improvement we could possibly get. Decoupling dependency is an important step to modularize the JDK while the startup gain may not be materialized until the module system is in place. (3) AWT loggers The AWT loggers are for debugging purpose. I understand the advantage of fine-grained loggers to have a fine-grained control of the debugging output. It's a tradeoff between performance (time and memory) and such debugging ability. I would argue that this fine-grained debugging ability is nice to have but isn't necessary to be available in the production environment. You should consider some way to enable such debuggability but disabled by default to minimize the performance overhead such as lazily creating these logger. sun.font only enables logging when -Dsun.java2d.debugfonts=true system property is set to true. This should be revisited - see 6880089 [5]. (4) Performance and design of java.util.logging I totally agree with that the performance and design of j.u.logging should be improved. If you have any idea and solution, your contribution would be appreciated. In fact, I would hope that we could have something like DTrace [6] that tracing code can be added in the implementation but no overhead is paid if the probes are not enabled [7]. Thanks Mandy [1] http://openjdk.java.net/projects/jigsaw/ [2] http://java.sun.com/javaone/2009/playlist.jsp?pid=24494811001&autoStart=on [3] http://mail.openjdk.java.net/pipermail/jigsaw-dev/2009-July/000181.html [4] http://cr.openjdk.java.net/~mchung/startup_measurement/perfdata.summary.b64 [5] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6880089 [6] http://www.sun.com/bigadmin/content/dtrace/index.jsp [7] https://btrace.dev.java.net/ From tim.bell at sun.com Thu Sep 17 18:09:07 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Thu, 17 Sep 2009 18:09:07 +0000 Subject: hg: jdk7/tl: 2 new changesets Message-ID: <20090917180908.0077C12342@hg.openjdk.java.net> Changeset: 4079d923a501 Author: peterz Date: 2009-08-31 14:10 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/rev/4079d923a501 6844267: Nimbus generator depends on JIBX Summary: Nimbus generator now uses JAXB instead of JIBX Reviewed-by: jasper ! README-builds.html Changeset: 0d7e03b426df Author: yan Date: 2009-09-09 00:49 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/0d7e03b426df Merge From tim.bell at sun.com Thu Sep 17 18:09:47 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Thu, 17 Sep 2009 18:09:47 +0000 Subject: hg: jdk7/tl/hotspot: 31 new changesets Message-ID: <20090917181049.9CCD412349@hg.openjdk.java.net> Changeset: a05ea7791ee3 Author: trims Date: 2009-08-21 20:38 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/a05ea7791ee3 6873236: Fork HS16 to HS17 - renumber Major and build numbers of JVM Summary: Update the Major and build numbers for HS17 fork Reviewed-by: jcoomes ! make/hotspot_version Changeset: 1760a1cbed36 Author: dcubed Date: 2009-08-11 11:57 -0600 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/1760a1cbed36 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive Summary: Refactor JNIHandles::checked_resolve_jmethod_id() into fast and paranoid parts. Reviewed-by: never, alanb ! src/share/vm/prims/jniCheck.cpp ! src/share/vm/runtime/jniHandles.hpp Changeset: 6ab1d6ece8bd Author: apangin Date: 2009-08-17 15:03 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/6ab1d6ece8bd Merge Changeset: 585222cadf79 Author: apangin Date: 2009-08-19 15:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/585222cadf79 Merge Changeset: a774e1abbe85 Author: trims Date: 2009-08-21 20:39 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/a774e1abbe85 Merge Changeset: 046932b72aa2 Author: never Date: 2009-08-14 00:02 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/046932b72aa2 6862956: PhaseIdealLoop should have a CFG verification mode Reviewed-by: kvn, twisti ! src/share/vm/opto/compile.cpp ! src/share/vm/opto/domgraph.cpp ! src/share/vm/opto/loopnode.cpp ! src/share/vm/opto/loopnode.hpp ! src/share/vm/opto/phase.cpp ! src/share/vm/opto/phase.hpp Changeset: 1a81ea4b45d4 Author: kvn Date: 2009-08-14 12:23 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/1a81ea4b45d4 6869822: assert(Universe::narrow_oop_shift() == 0,"use unscaled narrow oop") Summary: Replace the assert with narrow_oop_shift set to 0. Reviewed-by: never, jcoomes ! src/share/vm/memory/universe.cpp Changeset: a70508bb21c3 Author: never Date: 2009-08-14 15:53 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/a70508bb21c3 6862863: C2 compiler fails in elide_copy() Reviewed-by: kvn ! src/share/vm/opto/chaitin.hpp ! src/share/vm/opto/postaloc.cpp Changeset: 55784fd95fe3 Author: never Date: 2009-08-14 15:55 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/55784fd95fe3 Merge Changeset: 7c14587118b3 Author: never Date: 2009-08-14 22:11 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/7c14587118b3 Merge Changeset: c8e2135f7e30 Author: cfang Date: 2009-08-17 09:48 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/c8e2135f7e30 6829127: Deoptimization Failure on Specjvm98 _227_mtrt with -XX:+DeoptimizeALot since Hs11 b01 Summary: Make sure the control word is correct in deopt_blob after restore_result_registers Reviewed-by: kvn, never ! src/cpu/x86/vm/sharedRuntime_x86_32.cpp Changeset: 662f330d7275 Author: cfang Date: 2009-08-17 12:11 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/662f330d7275 6866651: Regression: simple int sum crashes jvm (build 1.6.0_14-b08 and 1.7.0-ea-b59) Summary: delay dead code elimination in set_req_X to make it safe Reviewed-by: kvn, never ! src/share/vm/opto/phaseX.cpp + test/compiler/6866651/Test.java Changeset: d0acbc302e14 Author: never Date: 2009-08-17 14:45 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/d0acbc302e14 6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc Reviewed-by: twisti, cfang ! src/cpu/sparc/vm/c1_Defs_sparc.hpp ! src/cpu/sparc/vm/c1_FrameMap_sparc.cpp ! src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp ! src/share/vm/includeDB_compiler1 + test/compiler/6795465/Test6795465.java Changeset: cd18bd5e667c Author: never Date: 2009-08-19 18:54 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/cd18bd5e667c 6873777: FPU control word optimization still performed with SSE Reviewed-by: kvn ! src/share/vm/opto/compile.cpp Changeset: 357d4e2eb4dd Author: kvn Date: 2009-08-19 19:05 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/357d4e2eb4dd 6873799: enable escape analysis by default Summary: enable escape analysis by default Reviewed-by: never ! src/share/vm/opto/c2_globals.hpp Changeset: 72088be4b386 Author: cfang Date: 2009-08-20 12:42 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/72088be4b386 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit Summary: use PcDesc to keep record of the reexecute bit instead of using DebugInfoStreams Reviewed-by: kvn, never, twisti ! agent/src/share/classes/sun/jvm/hotspot/code/DebugInfoReadStream.java ! agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java ! agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java ! agent/src/share/classes/sun/jvm/hotspot/code/ScopeDesc.java ! src/share/vm/classfile/javaClasses.cpp ! src/share/vm/code/debugInfo.hpp ! src/share/vm/code/debugInfoRec.cpp ! src/share/vm/code/nmethod.cpp ! src/share/vm/code/pcDesc.cpp ! src/share/vm/code/pcDesc.hpp ! src/share/vm/code/scopeDesc.cpp ! src/share/vm/code/scopeDesc.hpp ! src/share/vm/opto/callnode.cpp ! src/share/vm/prims/jvmtiCodeBlobEvents.cpp ! src/share/vm/runtime/vframe.hpp ! src/share/vm/runtime/vmStructs.cpp Changeset: 82bd76d4d7f2 Author: kvn Date: 2009-08-24 11:13 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/82bd76d4d7f2 6873800: enable compressed oops by default Summary: enable compressed oops by default Reviewed-by: never, ysr ! src/share/vm/runtime/arguments.cpp Changeset: cdb8b7c37ac1 Author: never Date: 2009-08-24 22:26 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/cdb8b7c37ac1 6875329: fix for 6795465 broke exception handler cloning Reviewed-by: kvn ! src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp ! src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Changeset: aba04734b61e Author: kvn Date: 2009-08-25 13:08 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/aba04734b61e Merge Changeset: 05f89f00a864 Author: jmasa Date: 2009-08-24 10:36 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/05f89f00a864 6798898: CMS: bugs related to class unloading Summary: Override should_remember_klasses() and remember_klass() as needed. Reviewed-by: ysr, jcoomes ! src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp ! src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp ! src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep ! src/share/vm/memory/iterator.cpp ! src/share/vm/memory/iterator.hpp ! src/share/vm/memory/referenceProcessor.cpp Changeset: e1fdf4fd34dc Author: tonyp Date: 2009-08-19 12:53 -0400 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/e1fdf4fd34dc 6871111: G1: remove the concurrent overhead tracker Summary: Removing the concurrent overhead tracker from G1, along with the GC overhead reporter and the G1AccountConcurrentOverhead (both of which rely on the the concurrent overhead tracker). Reviewed-by: iveresov, johnc ! src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp ! src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp ! src/share/vm/gc_implementation/g1/concurrentMark.cpp ! src/share/vm/gc_implementation/g1/concurrentMark.hpp ! src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp ! src/share/vm/gc_implementation/g1/concurrentZFThread.cpp ! src/share/vm/gc_implementation/g1/concurrentZFThread.hpp ! 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/g1MMUTracker.cpp ! src/share/vm/gc_implementation/g1/g1MMUTracker.hpp ! src/share/vm/gc_implementation/g1/g1_globals.hpp ! src/share/vm/gc_implementation/includeDB_gc_g1 ! src/share/vm/gc_implementation/includeDB_gc_shared - src/share/vm/gc_implementation/shared/coTracker.cpp - src/share/vm/gc_implementation/shared/coTracker.hpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp Changeset: ead53f6b615d Author: tonyp Date: 2009-08-24 13:52 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/ead53f6b615d Merge - src/share/vm/gc_implementation/shared/coTracker.cpp - src/share/vm/gc_implementation/shared/coTracker.hpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp Changeset: b37c246bf7ce Author: jcoomes Date: 2009-08-11 15:37 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/b37c246bf7ce 6861660: OopMapBlock count/size confusion Reviewed-by: tonyp, iveresov ! src/share/vm/classfile/classFileParser.cpp ! src/share/vm/classfile/classFileParser.hpp ! src/share/vm/memory/oopFactory.cpp ! src/share/vm/memory/oopFactory.hpp ! src/share/vm/oops/instanceKlass.cpp ! src/share/vm/oops/instanceKlass.hpp ! src/share/vm/oops/instanceKlassKlass.cpp ! src/share/vm/oops/instanceKlassKlass.hpp ! src/share/vm/oops/instanceRefKlass.cpp Changeset: 9eebd3ac74cf Author: jcoomes Date: 2009-08-13 16:22 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/9eebd3ac74cf 6845368: large objects cause a crash or unexpected exception Reviewed-by: jmasa, iveresov ! src/share/vm/classfile/classFileParser.cpp ! src/share/vm/classfile/classFileParser.hpp ! src/share/vm/memory/oopFactory.cpp ! src/share/vm/memory/oopFactory.hpp ! src/share/vm/oops/instanceKlass.cpp ! src/share/vm/oops/instanceKlass.hpp ! src/share/vm/oops/instanceKlassKlass.cpp ! src/share/vm/oops/instanceKlassKlass.hpp ! src/share/vm/oops/instanceRefKlass.cpp + test/gc/6845368/bigobj.java Changeset: 8624da129f0b Author: apetrusenko Date: 2009-08-31 05:27 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/8624da129f0b 6841313: G1: dirty cards of survivor regions in parallel Reviewed-by: tonyp, iveresov ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1_globals.hpp ! src/share/vm/memory/cardTableModRefBS.cpp ! src/share/vm/memory/cardTableModRefBS.hpp Changeset: 8b46c4d82093 Author: ysr Date: 2009-09-02 00:04 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/8b46c4d82093 4957990: Perm heap bloat in JVM Summary: Treat ProfileData in MDO's as a source of weak, not strong, roots. Fixes the bug for stop-world collection -- the case of concurrent collection will be fixed separately. Reviewed-by: jcoomes, jmasa, kvn, never ! src/share/vm/code/nmethod.cpp ! src/share/vm/code/nmethod.hpp ! src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp ! src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp ! src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ! src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp ! src/share/vm/gc_implementation/g1/g1MarkSweep.cpp ! src/share/vm/gc_implementation/includeDB_gc_parallelScavenge ! 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/psMarkSweep.cpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ! src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp ! src/share/vm/gc_implementation/shared/markSweep.cpp ! src/share/vm/gc_implementation/shared/markSweep.hpp ! src/share/vm/gc_interface/collectedHeap.hpp ! src/share/vm/includeDB_core ! src/share/vm/interpreter/interpreterRuntime.cpp ! src/share/vm/interpreter/interpreterRuntime.hpp ! src/share/vm/memory/genMarkSweep.cpp ! src/share/vm/memory/iterator.hpp ! src/share/vm/oops/methodDataOop.cpp ! src/share/vm/oops/methodDataOop.hpp ! src/share/vm/runtime/globals.hpp ! src/share/vm/runtime/sweeper.cpp Changeset: 2c79770d1f6e Author: tonyp Date: 2009-07-30 16:22 -0400 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/2c79770d1f6e 6819085: G1: use larger and/or user settable region size Summary: Instead of the region size being hard-coded, allow the user to set it. Reviewed-by: jmasa, johnc, apetrusenko ! 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/g1_globals.hpp ! src/share/vm/gc_implementation/g1/heapRegion.cpp ! src/share/vm/gc_implementation/g1/heapRegion.hpp ! src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp ! src/share/vm/gc_implementation/g1/sparsePRT.cpp ! src/share/vm/gc_implementation/g1/sparsePRT.hpp ! src/share/vm/gc_implementation/includeDB_gc_g1 Changeset: b1606b3c0a8a Author: apetrusenko Date: 2009-09-04 05:31 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/b1606b3c0a8a Merge ! src/share/vm/code/nmethod.cpp - src/share/vm/gc_implementation/shared/coTracker.cpp - src/share/vm/gc_implementation/shared/coTracker.hpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp - src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp Changeset: b1f5ced5da21 Author: jcoomes Date: 2009-09-03 19:21 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/b1f5ced5da21 6879076: disable jprt sync after builds are done Reviewed-by: kamg, dholmes ! make/jprt.properties Changeset: 68ef3fdcdb76 Author: ysr Date: 2009-09-10 16:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/68ef3fdcdb76 6872136: CMS: confusing message may be printed when a collector is switched off implicitly Summary: Fix CDS/CMS option overrides related to iCMS option CMSIncrementalMode; explicate overrides to error stream. Reviewed-by: coleenp ! src/share/vm/runtime/arguments.cpp Changeset: a94714c55065 Author: trims Date: 2009-09-15 20:44 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/a94714c55065 Merge From tim.bell at sun.com Thu Sep 17 18:12:35 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Thu, 17 Sep 2009 18:12:35 +0000 Subject: hg: jdk7/tl/jdk: 30 new changesets Message-ID: <20090917181908.4B32E12352@hg.openjdk.java.net> Changeset: 559fb14d0ae9 Author: anthony Date: 2009-08-27 16:42 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/559fb14d0ae9 6780496: Javaw process taking up 80-90 percent of CPU time! Summary: The transparency effects get enabled on showing, and disabled on hiding a window Reviewed-by: art, dcherepanov ! src/windows/native/sun/windows/awt_Dialog.cpp ! src/windows/native/sun/windows/awt_Frame.cpp ! src/windows/native/sun/windows/awt_Window.cpp ! src/windows/native/sun/windows/awt_Window.h Changeset: 7599cca4fe5e Author: dcherepanov Date: 2009-08-27 17:04 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7599cca4fe5e 6852051: Getting Null Pointer Exception when displaying message for TrayIcon on Opensolaris Reviewed-by: anthony ! src/share/classes/java/awt/Component.java Changeset: 911a82b4901f Author: dcherepanov Date: 2009-08-27 17:06 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/911a82b4901f 6854898: Frame is located at the negative coordinates instead of origin for Solaris 10 CDE Reviewed-by: art, anthony ! src/solaris/classes/sun/awt/X11/XErrorHandler.java ! src/solaris/classes/sun/awt/X11/XToolkit.java Changeset: d5ac8fb96d13 Author: anthony Date: 2009-08-28 19:34 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d5ac8fb96d13 6689468: test/closed/java/awt/Component/VisibleHwInLwContTest/VisibleHwInLwContTest.html fails Summary: The addNotify() checks whether the component is actually hidden, and hides the peer appropriately if needed Reviewed-by: art, dcherepanov ! src/share/classes/java/awt/Component.java Changeset: d755ace580b2 Author: yan Date: 2009-09-04 14:50 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d755ace580b2 6871299: Shift+Tab no longer generates a KEY_TYPED event; used to with JRE 1.5 Summary: Add XK_ISO_Left_Tab -> VK_TAB rule Reviewed-by: dcherepanov ! src/solaris/classes/sun/awt/X11/XKeysym.java ! src/solaris/classes/sun/awt/X11/keysym2ucs.h Changeset: 5a584fbcc712 Author: yan Date: 2009-09-09 00:48 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/5a584fbcc712 Merge Changeset: a48c15bcf64f Author: rupashka Date: 2009-08-14 13:18 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/a48c15bcf64f 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style) Reviewed-by: alexp ! src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java ! src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java ! src/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java ! src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java + test/com/sun/java/swing/plaf/windows/Test6824600.java Changeset: fa334ff12794 Author: alexp Date: 2009-08-19 17:24 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/fa334ff12794 6872492: JLayer sources contain wrong header Reviewed-by: rupashka ! src/share/classes/javax/swing/JLayer.java ! src/share/classes/javax/swing/plaf/LayerUI.java Changeset: 3e36c9abb569 Author: yan Date: 2009-08-20 23:30 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/3e36c9abb569 Merge - test/java/util/concurrent/ConcurrentLinkedQueue/ConcurrentQueueLoops.java - test/java/util/concurrent/ConcurrentLinkedQueue/LoopHelpers.java Changeset: e8d93257cf7e Author: rupashka Date: 2009-08-21 16:59 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e8d93257cf7e 6579827: vista : JSlider on JColorchooser is not properly render or can't be seen completely. Reviewed-by: peterz ! src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java + test/javax/swing/JSlider/6579827/bug6579827.java Changeset: d07bd8fa89e4 Author: rupashka Date: 2009-08-24 18:21 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d07bd8fa89e4 6849266: closed/javax/swing/JFileChooser/6484091/bug6484091.java fails on solaris 10 sparc Reviewed-by: peterz + test/javax/swing/JFileChooser/6484091/bug6484091.java Changeset: 799439873bf9 Author: alexp Date: 2009-08-24 19:22 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/799439873bf9 6824395: Several Swing core components prevent using them in wrapper classes Reviewed-by: peterz ! src/share/classes/javax/swing/JEditorPane.java ! src/share/classes/javax/swing/JLayer.java ! src/share/classes/javax/swing/JList.java ! src/share/classes/javax/swing/JTable.java ! src/share/classes/javax/swing/JTextField.java ! src/share/classes/javax/swing/JTree.java ! src/share/classes/javax/swing/plaf/LayerUI.java ! src/share/classes/javax/swing/text/JTextComponent.java ! src/share/classes/sun/swing/SwingUtilities2.java + test/javax/swing/JLayer/6824395/bug6824395.java ! test/javax/swing/JLayer/SerializationTest/SerializationTest.java Changeset: 4914723317b9 Author: peytoia Date: 2009-08-31 12:55 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/4914723317b9 6851214: (tz) New Jordan rule creates a failure for SimpleTimeZone parsing post tzdata2009h Reviewed-by: okutsu ! src/share/classes/java/util/SimpleTimeZone.java + test/java/util/TimeZone/ListTimeZones.java Changeset: 7aa6cb832991 Author: peytoia Date: 2009-08-31 14:50 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7aa6cb832991 6872467: (tz) Support tzdata2009l Reviewed-by: okutsu ! make/sun/javazic/tzdata/VERSION ! make/sun/javazic/tzdata/africa ! make/sun/javazic/tzdata/antarctica ! make/sun/javazic/tzdata/asia ! make/sun/javazic/tzdata/australasia ! make/sun/javazic/tzdata/backward ! make/sun/javazic/tzdata/etcetera ! make/sun/javazic/tzdata/europe ! make/sun/javazic/tzdata/factory ! make/sun/javazic/tzdata/iso3166.tab ! make/sun/javazic/tzdata/leapseconds ! make/sun/javazic/tzdata/northamerica ! make/sun/javazic/tzdata/pacificnew ! make/sun/javazic/tzdata/solar87 ! make/sun/javazic/tzdata/solar88 ! make/sun/javazic/tzdata/solar89 ! make/sun/javazic/tzdata/southamerica ! make/sun/javazic/tzdata/systemv ! make/sun/javazic/tzdata/zone.tab Changeset: 92b6482e7719 Author: peytoia Date: 2009-08-31 14:53 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/92b6482e7719 6456628: (tz) Default timezone is incorrectly set occasionally on Linux Reviewed-by: okutsu ! src/solaris/native/java/util/TimeZone_md.c Changeset: f7d606ca25a9 Author: peterz Date: 2009-08-31 13:46 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f7d606ca25a9 6802944: Nimbus initialization is too slow Reviewed-by: jasper ! make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/DefaultsGenerator.java ! src/share/classes/javax/swing/plaf/nimbus/Defaults.template ! src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java ! src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java ! src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Changeset: 7e7153da24ef Author: peterz Date: 2009-08-31 13:56 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7e7153da24ef 6844267: Nimbus generator depends on JIBX Summary: Nimbus generator now uses JAXB instead of JIBX Reviewed-by: jasper ! README ! make/common/Sanity.gmk ! make/common/shared/Defs.gmk ! make/common/shared/Sanity-Settings.gmk ! make/common/shared/Sanity.gmk ! make/javax/swing/plaf/Makefile - make/javax/swing/plaf/nimbus/Makefile ! make/tools/Makefile + make/tools/generate_nimbus/Makefile + make/tools/src/build/tools/generatenimbus/Generator.java + make/tools/src/build/tools/generatenimbus/ObjectFactory.java + make/tools/src/build/tools/generatenimbus/Paint.java + make/tools/src/build/tools/generatenimbus/PainterGenerator.java + make/tools/src/build/tools/generatenimbus/Shape.java + make/tools/src/build/tools/generatenimbus/SynthModel.java + make/tools/src/build/tools/generatenimbus/UIDefault.java + make/tools/src/build/tools/generatenimbus/UIStyle.java + make/tools/src/build/tools/generatenimbus/Utils.java - make/tools/swing-nimbus/Makefile - make/tools/swing-nimbus/classes/org/jdesktop/beans/AbstractBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BezierControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BlendingMode.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Canvas.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/ControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Designer.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/DoubleBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/EllipseShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/GraphicsHelper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Layer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/LayerContainer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PaintedShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PathShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/RectangleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/SimpleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/TemplateLayer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/DropShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/Effect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtilsTemp.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/OuterGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/ShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/font/Typeface.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/CanvasMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/ColorMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/DimensionMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/InsetsMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/AbstractGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Gradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/GradientStop.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Matte.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/PaintModel.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/RadialGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Texture.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasUIDefaults.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/DefaultsGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/Generator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/GeneratorUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/ObjectCodeConvertors.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/PainterGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/TemplateWriter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/HasUIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/PainterBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIColor.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIComponent.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDimension.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIFont.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIcon.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIconRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIInsets.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIPaint.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIProperty.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIState.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStateType.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/BorderMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassConverter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/FontMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/UIPropertyMapper.java Changeset: e7d311b4ae94 Author: alexp Date: 2009-08-31 18:39 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e7d311b4ae94 6872503: JLayer event handling should be rewritten Reviewed-by: art ! src/share/classes/javax/swing/JLayer.java + test/javax/swing/JLayer/6872503/bug6872503.java Changeset: 9d8f551780d5 Author: peytoia Date: 2009-09-01 15:39 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/9d8f551780d5 6830423: Unified Ext B character not displayed with Dialog font Reviewed-by: okutsu ! src/windows/classes/sun/awt/windows/fontconfig.properties Changeset: 37c33432e98a Author: peytoia Date: 2009-09-01 15:42 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/37c33432e98a 6838887: (tz) Add UTC and Yerevan to tzmappings Reviewed-by: okutsu ! src/windows/lib/tzmappings Changeset: 5780cff2763c Author: peytoia Date: 2009-09-01 16:15 +0900 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/5780cff2763c 6856390: RFE : sequence.allfonts.UTF-8.ja for Windows fontconfig.properties Reviewed-by: okutsu ! src/windows/classes/sun/awt/windows/fontconfig.properties Changeset: 4f819e2e0bfc Author: peterz Date: 2009-09-01 15:34 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/4f819e2e0bfc 6387579: Usage of package-private class as parameter of a method (javax.swing.tree.DefaultTreeSelectionModel) Reviewed-by: rupashka ! src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Changeset: 935814bd43a6 Author: alexp Date: 2009-09-01 18:51 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/935814bd43a6 6875153: JLayer.isOptimizedDrawingEnabled() throws NPE for null glass pane set Reviewed-by: rupashka ! src/share/classes/javax/swing/JLayer.java ! src/share/classes/javax/swing/plaf/LayerUI.java + test/javax/swing/JLayer/6875153/bug6875153.java Changeset: 281fbd82a971 Author: alexp Date: 2009-09-02 17:47 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/281fbd82a971 6797139: JButton title is truncating for some strings irrespective of preferred size. Reviewed-by: peterz ! src/share/classes/javax/swing/SwingUtilities.java ! src/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java ! src/share/classes/sun/swing/MenuItemLayoutHelper.java ! src/share/classes/sun/swing/SwingUtilities2.java + test/javax/swing/SwingUtilities/6797139/bug6797139.java Changeset: ff468ef27959 Author: gsm Date: 2009-09-07 12:27 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ff468ef27959 6699856: Creating text in a JTextPane using Chinese text causes undesired behavior Reviewed-by: peterz ! src/share/classes/javax/swing/JEditorPane.java ! src/share/classes/javax/swing/JTextPane.java ! src/share/classes/javax/swing/text/JTextComponent.java Changeset: 01c46cb72eb7 Author: rupashka Date: 2009-09-07 15:09 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/01c46cb72eb7 6589634: Unable to view focus on "Up one level", "create new folder" etc. of JFileChooser Dialog Reviewed-by: peterz, loneid ! src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Changeset: d73a741a7ea1 Author: malenkov Date: 2009-09-08 14:08 +0400 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d73a741a7ea1 6868185: 2 JCK api/java_beans/Introspector/ tests fails starting from jdk7 b66 Reviewed-by: peterz ! src/share/classes/com/sun/beans/finder/BeanInfoFinder.java Changeset: e289c06b6d36 Author: yan Date: 2009-09-09 00:51 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e289c06b6d36 Merge - make/javax/swing/plaf/nimbus/Makefile - make/tools/swing-nimbus/Makefile - make/tools/swing-nimbus/classes/org/jdesktop/beans/AbstractBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BezierControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BlendingMode.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Canvas.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/ControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Designer.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/DoubleBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/EllipseShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/GraphicsHelper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Layer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/LayerContainer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PaintedShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PathShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/RectangleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/SimpleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/TemplateLayer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/DropShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/Effect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtilsTemp.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/OuterGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/ShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/font/Typeface.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/CanvasMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/ColorMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/DimensionMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/InsetsMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/AbstractGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Gradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/GradientStop.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Matte.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/PaintModel.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/RadialGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Texture.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasUIDefaults.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/DefaultsGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/Generator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/GeneratorUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/ObjectCodeConvertors.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/PainterGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/TemplateWriter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/HasUIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/PainterBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIColor.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIComponent.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDimension.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIFont.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIcon.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIconRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIInsets.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIPaint.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIProperty.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIState.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStateType.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/BorderMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassConverter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/FontMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/UIPropertyMapper.java Changeset: 460639b036f3 Author: yan Date: 2009-09-15 23:41 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/460639b036f3 Merge - make/javax/swing/plaf/nimbus/Makefile - make/tools/swing-nimbus/Makefile - make/tools/swing-nimbus/classes/org/jdesktop/beans/AbstractBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BezierControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/BlendingMode.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Canvas.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/ControlPoint.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Designer.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/DoubleBean.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/EllipseShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/GraphicsHelper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/Layer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/LayerContainer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PaintedShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/PathShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/RectangleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/SimpleShape.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/TemplateLayer.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/DropShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/Effect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/EffectUtilsTemp.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/InnerShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/OuterGlowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/effects/ShadowEffect.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/font/Typeface.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/CanvasMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/ColorMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/DimensionMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/jibxhelpers/InsetsMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/AbstractGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Gradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/GradientStop.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Matte.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/PaintModel.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/RadialGradient.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/paint/Texture.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasPath.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasResources.java - make/tools/swing-nimbus/classes/org/jdesktop/swingx/designer/utils/HasUIDefaults.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/DefaultsGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/Generator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/GeneratorUtils.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/ObjectCodeConvertors.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/PainterGenerator.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/generator/TemplateWriter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/CustomUIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/HasUIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/PainterBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/SynthModel.jibx.xml - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIBorder.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIColor.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIComponent.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDefault.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIDimension.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIFont.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIcon.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIIconRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIInsets.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIPaint.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIProperty.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIRegion.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIState.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStateType.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/UIStyle.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/BorderMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassConverter.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/ClassMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/FontMapper.java - make/tools/swing-nimbus/classes/org/jdesktop/synthdesigner/synthmodel/jibxhelpers/UIPropertyMapper.java Changeset: 81b85ea694f8 Author: tbell Date: 2009-09-16 09:23 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/81b85ea694f8 Merge From son.two at gmail.com Fri Sep 18 02:45:40 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Fri, 18 Sep 2009 06:45:40 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AB277C2.8030603@Sun.com> References: <4AAD9D2D.6000502@sun.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> <4AB277C2.8030603@Sun.com> Message-ID: <271e55d20909171945l48544a5cjf6a61d36362285fa@mail.gmail.com> Hi Mandy, On Thu, Sep 17, 2009 at 9:54 PM, Mandy Chung wrote: > Oleg, Anthony, > > You all raise good questions and we shall focus on the problem we want to > fix by 6879044 and ?6882376. ? It's important to separate the discussion for > this fix vs the startup performance improvement. ?I hope below clears up > some confusion and this review request is for addressing problem described > in (1). > > (1) The problem is to decouple the dependency on logging from some JRE > components. > > FYI. The jigsaw project page [1] provides links to the good background why > we're doing that. ?Mark gave a very good overview and demo of Project jigsaw > at JavaOne General Technical Session[2]. > > Logging is one candidate module if the libraries are broken up into a set of > fine grained modules. ? The fix for 6882376 provides the internal support > for JRE implementation to eliminate their dependency on logging. ?Alan and > Naoto reviewed the fix. > > As for the AWT/2D/Swing changes, > ? 6879044: Eliminate the dependency on logging from the AWT/2D/Swing > classes, > > When the libraries are broken into modules, are you saying that the client > module should require the logging module to exist? ?On the other hand, as > Alan explained, why would a user need to have a logging module installed to > run a simple client application? Ok, so this fix is only about modules. But why AWT should not depend on logging module? The qiestion is: how many application we want to run doesn't use logging& Because if an application uses logging there is no reasons for AWT to not use it. Please note that even if logging is turned off, the application still needs logging package/module. So, though end-user doesn't need logging output she may need logging module to run the application. So, it is really important to understand what number of application will get advantage of suggested changes. Second question is: how big logging module is going to be? How big the benefit for end-user will be? I'm asking so many question mainly because the changes you suggested create rather unnatural code (we can not use standard logging machinery any more), so such changes should be well-justified. With best regards, Oleg. > Artem and Dmitri reviewed the fix. ? If you have another proposal of > decoupling the dependency, I would be interested too. > > (2) Startup performance improvement > > The suggested change does not have a signifcant startup performance as > expected (as I mentioned in the bug report). ?It does load fewer classes > (~16 classes) which isn't bad. ?My apology if I confuse you when we mixed it > in this review request. > > I have done some performance analysis [3] [4] to determine what opportunity > the jigsaw module system could implement and the estimate of the startup > time improvement we could possibly get. ?Decoupling dependency is an > important step to modularize the JDK while the startup gain may not be > materialized until the module system is in place. > > (3) AWT loggers > > The AWT loggers are for debugging purpose. ?I understand the advantage of > fine-grained loggers to have a fine-grained control of the debugging output. > ?It's a tradeoff between performance (time and memory) and such debugging > ability. ?I would argue that this fine-grained debugging ability is nice to > have but isn't necessary to be available in the production environment. ?You > should consider some way to enable such debuggability but disabled by > default to minimize the performance overhead such as lazily creating these > logger. ?sun.font only enables logging when -Dsun.java2d.debugfonts=true > system property is set to true. ?This should be revisited - see 6880089 [5]. > > (4) Performance and design of java.util.logging > > I totally agree with that the performance and design of j.u.logging should > be improved. ?If you have any idea and solution, your contribution would be > appreciated. ?In fact, I would hope that we could have something like DTrace > [6] that tracing code can be added in the implementation but no overhead is > paid if the probes are not enabled [7]. > > Thanks > Mandy > > [1] http://openjdk.java.net/projects/jigsaw/ > [2] > http://java.sun.com/javaone/2009/playlist.jsp?pid=24494811001&autoStart=on > [3] http://mail.openjdk.java.net/pipermail/jigsaw-dev/2009-July/000181.html > [4] > http://cr.openjdk.java.net/~mchung/startup_measurement/perfdata.summary.b64 > [5] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6880089 > [6] http://www.sun.com/bigadmin/content/dtrace/index.jsp > [7] https://btrace.dev.java.net/ > From jean-christophe.collet at sun.com Fri Sep 18 09:04:02 2009 From: jean-christophe.collet at sun.com (jean-christophe.collet at sun.com) Date: Fri, 18 Sep 2009 09:04:02 +0000 Subject: hg: jdk7/tl/jdk: 6737819: sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost Message-ID: <20090918090436.38E6612454@hg.openjdk.java.net> Changeset: ee68feef41d2 Author: jccollet Date: 2009-09-18 10:51 +0200 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/ee68feef41d2 6737819: sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost Summary: Move default nonProxyHosts from hardcoded to property default value Reviewed-by: chegar ! src/share/classes/java/net/doc-files/net-properties.html ! src/share/classes/sun/net/spi/DefaultProxySelector.java ! src/share/lib/net.properties + test/java/net/ProxySelector/B6737819.java From Vladimir.Yaroslavskiy at Sun.COM Fri Sep 18 10:53:02 2009 From: Vladimir.Yaroslavskiy at Sun.COM (Vladimir Yaroslavskiy) Date: Fri, 18 Sep 2009 14:53:02 +0400 Subject: Replacement of Quicksort in java.util.Arrays with Dual-Pivot Quicksort In-Reply-To: References: Message-ID: <4AB3668E.2070001@Sun.COM> > Date: Thu, 17 Sep 2009 12:00:57 +0000 (UTC) > From: Ismael Juma > Subject: Re: Replacement of Quicksort in java.util.Arrays with Dual-Pivot > To: core-libs-dev at openjdk.java.net > > Hi Vladimir, > > Vladimir Yaroslavskiy writes: >> random 01 random 01 >> dpq: 1431 dpq: 8017 >> tim: 11495 tim: 2717 >> jdk: 1552 jdk: 8547 > > Is the size of the int array different than the size of the j.l.Integer array? I > ask because I would be surprised if timsort were that much faster when sorting > an array of j.l.Integers versus sorting an array of ints. > > Best, > Ismael Hello Ismael, You are right, the arrays were different: int array was 2'000'000 and Integer array was 200'000 (and test was run 50 times) - if I remember correctly. Now I've run test on the same length 2'000'000 arrays 50 times, see the result (client VM): int random Integer random dpq: 16222 dpq: 166313 tim: 36022 tim: 147783 jdk: 20699 jdk: 133578 Thank you, Vladimir From mlists at juma.me.uk Fri Sep 18 10:59:12 2009 From: mlists at juma.me.uk (Ismael Juma) Date: Fri, 18 Sep 2009 10:59:12 +0000 (UTC) Subject: Replacement of Quicksort in java.util.Arrays with =?utf-8?b?RHVhbC1QaXZvdAlRdWlja3NvcnQ=?= References: <4AB3668E.2070001@Sun.COM> Message-ID: Hey Vladimir, Vladimir Yaroslavskiy writes: > You are right, the arrays were different: int array was 2'000'000 > and Integer array was 200'000 (and test was run 50 times) - if I > remember correctly. Great, that makes sense. > Now I've run test on the same length 2'000'000 arrays 50 times, > see the result (client VM): > > int random Integer random > dpq: 16222 dpq: 166313 > tim: 36022 tim: 147783 > jdk: 20699 jdk: 133578 Thank you. Ismael From ahughes at redhat.com Fri Sep 18 11:24:01 2009 From: ahughes at redhat.com (ahughes at redhat.com) Date: Fri, 18 Sep 2009 11:24:01 +0000 Subject: hg: jdk7/tl/jdk: 6882745: Add DISABLE_INTREE_EC option to make new EC provider optional. Message-ID: <20090918112448.4509712468@hg.openjdk.java.net> Changeset: 39c15c0a71f7 Author: andrew Date: 2009-09-10 19:04 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/39c15c0a71f7 6882745: Add DISABLE_INTREE_EC option to make new EC provider optional. Summary: Don't build the ec subdirectory when DISABLE_INTREE_EC is defined. Reviewed-by: vinnie ! make/sun/security/Makefile From tim.bell at sun.com Fri Sep 18 16:27:14 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:27:14 +0000 Subject: hg: jdk7/tl: Added tag jdk7-b72 for changeset 0d7e03b426df Message-ID: <20090918162715.46E7112494@hg.openjdk.java.net> Changeset: 4c4fe09fb670 Author: xdono Date: 2009-09-17 13:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/4c4fe09fb670 Added tag jdk7-b72 for changeset 0d7e03b426df ! .hgtags From tim.bell at sun.com Fri Sep 18 16:27:45 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:27:45 +0000 Subject: hg: jdk7/tl/corba: Added tag jdk7-b72 for changeset c793a3120926 Message-ID: <20090918162747.6A4FD12499@hg.openjdk.java.net> Changeset: 12991b453239 Author: xdono Date: 2009-09-17 13:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/12991b453239 Added tag jdk7-b72 for changeset c793a3120926 ! .hgtags From tim.bell at sun.com Fri Sep 18 16:29:15 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:29:15 +0000 Subject: hg: jdk7/tl/hotspot: Added tag jdk7-b72 for changeset a94714c55065 Message-ID: <20090918162923.A45D61249E@hg.openjdk.java.net> Changeset: 1e5f0e56d242 Author: xdono Date: 2009-09-17 13:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/1e5f0e56d242 Added tag jdk7-b72 for changeset a94714c55065 ! .hgtags From tim.bell at sun.com Fri Sep 18 16:32:57 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:32:57 +0000 Subject: hg: jdk7/tl/jaxp: Added tag jdk7-b72 for changeset 37c805b6156f Message-ID: <20090918163259.BDEBA124A3@hg.openjdk.java.net> Changeset: 93dfa6e0fe76 Author: xdono Date: 2009-09-17 13:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxp/rev/93dfa6e0fe76 Added tag jdk7-b72 for changeset 37c805b6156f ! .hgtags From tim.bell at sun.com Fri Sep 18 16:33:32 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:33:32 +0000 Subject: hg: jdk7/tl/jaxws: Added tag jdk7-b72 for changeset 4c990aa99bc0 Message-ID: <20090918163335.CF608124A8@hg.openjdk.java.net> Changeset: d79f0d601c2b Author: xdono Date: 2009-09-17 13:46 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxws/rev/d79f0d601c2b Added tag jdk7-b72 for changeset 4c990aa99bc0 ! .hgtags From tim.bell at sun.com Fri Sep 18 16:34:32 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:34:32 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090918163545.6099B124AD@hg.openjdk.java.net> Changeset: f09a2bfba691 Author: xdono Date: 2009-09-17 13:47 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f09a2bfba691 Added tag jdk7-b72 for changeset 460639b036f3 ! .hgtags Changeset: f119e21c0ca7 Author: tbell Date: 2009-09-18 08:47 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f119e21c0ca7 Merge From tim.bell at sun.com Fri Sep 18 16:38:22 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Fri, 18 Sep 2009 16:38:22 +0000 Subject: hg: jdk7/tl/langtools: 2 new changesets Message-ID: <20090918163829.C000A124B2@hg.openjdk.java.net> Changeset: bfad32768345 Author: xdono Date: 2009-09-17 13:47 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/bfad32768345 Added tag jdk7-b72 for changeset 261c54b2312e ! .hgtags Changeset: 5dd400fd62d9 Author: tbell Date: 2009-09-18 08:48 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/5dd400fd62d9 Merge From Mandy.Chung at Sun.COM Fri Sep 18 20:19:44 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Fri, 18 Sep 2009 13:19:44 -0700 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <271e55d20909171945l48544a5cjf6a61d36362285fa@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <4AAFE744.4050009@Sun.com> <271e55d20909161943v651a1006tff17cfd2542c4974@mail.gmail.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> <4AB277C2.8030603@Sun.com> <271e55d20909171945l48544a5cjf6a61d36362285fa@mail.gmail.com> Message-ID: <4AB3EB60.7050600@sun.com> Hi Oleg, A better question to ask is who and how the logging information AWT is used for. The AWT team confirms that the AWT loggers are for debugging purpose used by the awt developers. As specified in the Requirements chapter for the Java Logging Spec (JSR-47) [1], the central goal of the logging API is to support maintaining and servicing software at customer sites. Adding debugging code in the awt implementation using logging API is reasonable but it's not the requirement for the logging API. If there were a better option to add debugging code, I believe you have no problem changing the awt debugging code not to use the logging API. Server-type applications are typical use cases that logging information is very important and useful for diagnosis in the field - long running apps, hard to reproduce problems until running for many days/months. It is hard to imagine how the logging information is important in client applications. But you seem to know many client applications use the logging API that I would also be interested to follow up with their requirements. > > Ok, so this fix is only about modules. But why AWT should not depend > on logging module? > The qiestion is: how many application we want to run doesn't use > logging& Because if an application > uses logging there is no reasons for AWT to not use it. Please note > that even if logging is turned > off, the application still needs logging package/module. So, though > end-user doesn't need logging output > she may need logging module to run the application. This is exactly why we want to decouple the dependency on logging. When an application uses logging, the application knows clearly what module they require and that's fine. When an application doesn't logging, if the awt component requires logging for debugging purpose only, it increases the download size, footprint and startup performance (class lookup time, loading, init, etc) - please see my performance analysis report; otherwise, it's not fruitful to discuss the details in this thread without the background info. Just to mention it what we care about. > So, it is really > important to understand > what number of application will get advantage of suggested changes. > > You are suggesting the client applications always have a dependency on logging. Many client team engineers are happy to see the dependency on logging being eliminated from the client stack requirement and approve this fix :) > Second question is: how big logging module is going to be? How big the > benefit for end-user will be? > > The size of the logging API is not big (~90K) but the size is not the only one factor determining what benefit the end-user will have. It's not necessary to logging API as one single module and details are to be worked out. Subscribe to the jigsaw project to follow the discussion and progress there. Serviceability includes other API as well. If awt started using other serviceability API (java.lang.management, java.lang.instrument) for whatever reason, your argument would apply there as well. I don't think you wanted the awt module depends on all the serviceability APIs. > I'm asking so many question mainly because the changes you suggested > create rather unnatural code (we can not > use standard logging machinery any more), so such changes should be > well-justified. > > That's what we pay for to modularize the JDK after many years of JDK development without module support in the platform. Otherwise, if there were module support in the platform, you would consider very carefully when adding a dependency on another module. If you have further issue, I suggest to start a different thread on the awt-dev alias. Thanks Mandy [1] http://jcp.org/aboutJava/communityprocess/first/jsr047/index.html From assembling.signals at yandex.ru Fri Sep 18 21:14:48 2009 From: assembling.signals at yandex.ru (assembling signals) Date: Sat, 19 Sep 2009 01:14:48 +0400 Subject: Enum modernization proposal Message-ID: <320281253308488@webmail126.yandex.ru> (sent again, now with CC to mailing list) Sorry, you got me wrong. JDK is using tons of "pseudo enums" such as: static final int OPAQUE = ... static final int BITMASK = ... static final int TRANSLUCENT = ... (from java.awt.Transparency) Using those is unhandy: Those int's have no type, have no value validation. At runtime, they apear as usual integers. My proposal is an enhancement for legacy APIs. 17.09.09, 01:06, "David M. Lloyd" : > Java has had "real" enums since Java 5: > http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html > - DML From christopher.hegarty at sun.com Fri Sep 18 21:21:56 2009 From: christopher.hegarty at sun.com (christopher.hegarty at sun.com) Date: Fri, 18 Sep 2009 21:21:56 +0000 Subject: hg: jdk7/tl/jdk: 3 new changesets Message-ID: <20090918212320.2ACA81252D@hg.openjdk.java.net> Changeset: c9cbd2a09fd4 Author: chegar Date: 2009-09-18 16:24 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/c9cbd2a09fd4 6882609: Move default InMemoryCookieStore to java.net Summary: remove static dependency on sun.net.www.protocol.http Reviewed-by: alanb, jccollet ! make/sun/net/FILES_java.gmk ! src/share/classes/java/net/CookieManager.java + src/share/classes/java/net/InMemoryCookieStore.java - src/share/classes/sun/net/www/protocol/http/InMemoryCookieStore.java Changeset: 9cd7133ea287 Author: chegar Date: 2009-09-18 22:18 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/9cd7133ea287 6882594: Remove static dependancy on NTLM authentication Reviewed-by: alanb, weijun ! make/sun/net/FILES_java.gmk ! src/share/classes/sun/net/www/protocol/http/AuthCache.java ! src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java + src/share/classes/sun/net/www/protocol/http/AuthScheme.java ! src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java ! src/share/classes/sun/net/www/protocol/http/BasicAuthentication.java ! src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java ! src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java + src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java ! src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java ! src/solaris/classes/sun/net/www/protocol/http/NTLMAuthentication.java ! src/windows/classes/sun/net/www/protocol/http/NTLMAuthentication.java Changeset: 45a343706f73 Author: chegar Date: 2009-09-18 22:19 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/45a343706f73 Merge From mandy.chung at sun.com Sat Sep 19 01:51:57 2009 From: mandy.chung at sun.com (mandy.chung at sun.com) Date: Sat, 19 Sep 2009 01:51:57 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090919015248.8C8E8125E7@hg.openjdk.java.net> Changeset: d3281fa8e46c Author: mchung Date: 2009-09-17 14:24 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d3281fa8e46c 6882376: Add internal support for JRE implementation to eliminate the dependency on logging Summary: Added sun.util.logging.PlatformLogger for JRE implementation to log messages. Reviewed-by: alanb, naoto ! make/java/logging/Makefile ! src/share/classes/java/util/Currency.java ! src/share/classes/java/util/jar/Attributes.java ! src/share/classes/java/util/logging/LogManager.java ! src/share/classes/java/util/logging/LogRecord.java ! src/share/classes/sun/util/LocaleServiceProviderPool.java + src/share/classes/sun/util/logging/PlatformLogger.java ! src/windows/classes/java/util/prefs/WindowsPreferences.java + test/sun/util/logging/PlatformLoggerTest.java Changeset: 7b4e73ca6fd7 Author: mchung Date: 2009-09-18 17:27 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7b4e73ca6fd7 Merge From java.net at freetocreate.org Sat Sep 19 03:53:28 2009 From: java.net at freetocreate.org (Rob Leland) Date: Fri, 18 Sep 2009 23:53:28 -0400 Subject: hg: jdk7/tl/jdk: 2 new changesets In-Reply-To: <20090919015248.8C8E8125E7@hg.openjdk.java.net> References: <20090919015248.8C8E8125E7@hg.openjdk.java.net> Message-ID: <4AB455B8.7040409@freetocreate.org> ..Mandy, Three questions. Then the JavaDocs says : > This enables the runtime components to eliminate the > static dependency of the logging facility .... > In addition, the PlatformLogger API can be used if the logging > module does not exist. What use case required this ? Is this meant to be similar to Apache commons-logging which also has a basic logging functionality ? >-import java.util.logging.Logger; >+import sun.util.logging.PlatformLogger; And lastly it seems counter intuitive that a dependency would be change from a java.* -> sun.*, why not add it under the java.* tree ? On 9/18/2009 9:51 PM, mandy.chung at sun.com wrote: > Changeset: d3281fa8e46c > Author: mchung > Date: 2009-09-17 14:24 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d3281fa8e46c > > 6882376: Add internal support for JRE implementation to eliminate the > dependency on logging > Summary: Added sun.util.logging.PlatformLogger for JRE implementation > to log messages. > Reviewed-by: alanb, naoto > > ! make/java/logging/Makefile > ! src/share/classes/java/util/Currency.java > ! src/share/classes/java/util/jar/Attributes.java > ! src/share/classes/java/util/logging/LogManager.java > ! src/share/classes/java/util/logging/LogRecord.java > ! src/share/classes/sun/util/LocaleServiceProviderPool.java > + src/share/classes/sun/util/logging/PlatformLogger.java > ! src/windows/classes/java/util/prefs/WindowsPreferences.java > + test/sun/util/logging/PlatformLoggerTest.java > > Changeset: 7b4e73ca6fd7 > Author: mchung > Date: 2009-09-18 17:27 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7b4e73ca6fd7 > > Merge > > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4439 (20090918) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From son.two at gmail.com Sat Sep 19 03:59:47 2009 From: son.two at gmail.com (Oleg Sukhodolsky) Date: Sat, 19 Sep 2009 07:59:47 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <4AB3EB60.7050600@sun.com> References: <4AAD9D2D.6000502@sun.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> <4AB277C2.8030603@Sun.com> <271e55d20909171945l48544a5cjf6a61d36362285fa@mail.gmail.com> <4AB3EB60.7050600@sun.com> Message-ID: <271e55d20909182059y4610d01at4cc8a2a935aa6cff@mail.gmail.com> HI Mandy, On Sat, Sep 19, 2009 at 12:19 AM, Mandy Chung wrote: > Hi Oleg, > > A better question to ask is who and how the logging information AWT is used > for. ? The AWT team confirms that the AWT loggers are for debugging purpose > used by the awt developers. ?As specified in the Requirements chapter for > the Java Logging Spec (JSR-47) [1], the central goal of the logging API is > to support maintaining and servicing software at customer sites. ? Adding > debugging code in the awt implementation using logging API is reasonable but > it's not the requirement for the logging API. ?If there were a better option > to add debugging code, I believe you have no problem changing the awt > debugging code not to use the logging API. > > Server-type applications are typical use cases that logging information is > very important and useful for diagnosis in the field - long running apps, > hard to reproduce problems until running for many days/months. ?It is hard > to imagine how the logging information is important in client applications. as ex-AWT developer I can confirm that there were number of cases when logging had helped us to diagnose problem on client's site. Even though you usually do not need to run an application for a long time to reproduce a problem it can be very hard to reproduce it because the problem depends on window manager and other environment which is hard to re-create. > ? But you seem to know many client applications use the logging API that I > would also be interested to follow up with their requirements. I do not know many client applications which uses logging API (because I have never write real client application) and it is hard to say if it uses logging or not. I hoped that you who saying that suggested changes will help to client application has some statistic to confirm your expectation >> Ok, so this fix is only about modules. ?But why AWT should not depend >> on logging module? >> The qiestion is: how many application we want to run doesn't use >> logging& Because if an application >> uses logging there is no reasons for AWT to not use it. ?Please note >> that even if logging is turned >> off, the application still needs logging package/module. ?So, though >> end-user doesn't need logging output >> she may need logging module to run the application. > > This is exactly why we want to decouple the dependency on logging. ?When an > application uses logging, the application knows clearly what module they > require and that's fine. ?When an application doesn't logging, if the awt > component requires logging for debugging purpose only, it increases the > download size, footprint and startup performance (class lookup time, > loading, init, etc) - please see my performance analysis report; otherwise, > it's not fruitful to discuss the details in this thread without the > background info. ?Just to mention it what we care about. I have found only two links to some performance analysis: http://mail.openjdk.java.net/pipermail/jigsaw-dev/2009-July/000181.html http://cr.openjdk.java.net/~mchung/startup_measurement/perfdata.summary.b64 but they say about -Xverify and -Xshare and do not understand how they can be related to our topic :( If they do, please explain (I have never been an expert in this area :( Or, if I missed something could you please point me what I have missed. >> So, it is really >> important to understand >> what number of application will get advantage of suggested changes. >> >> > > You are suggesting the client applications always have a dependency on > logging. ? Many client team engineers are happy to see the dependency on > logging being eliminated from the client stack requirement and approve this > fix :) I do not see how this can be considered as prove that the changes will help client applications. Unless we have some statistic it is all just our guess (which, as we know, usually wrong ;) >> Second question is: how big logging module is going to be? How big the >> benefit for end-user will be? >> >> > > The size of the logging API is not big (~90K) but the size is not the only > one factor determining what benefit the end-user will have. what other factors do you know? > ?It's not > necessary to logging API as one single module and details are to be worked > out. ? Subscribe to the jigsaw project to follow the discussion and progress > there. ? Serviceability includes other API as well. ?If awt started using > other serviceability API (java.lang.management, java.lang.instrument) for > whatever reason, your argument would apply there as well. ?I don't think you > wanted the awt module depends on all the serviceability APIs. I agree that usage of any API should be done after careful consideration. Logging API provides us exactly what we need (ability to create log of an application executed on client) this is why we started to use it. >> I'm asking so many question mainly because the changes you suggested >> create rather unnatural code (we can not >> use standard logging machinery any more), so such changes should be >> well-justified. >> >> > > That's what we pay for to modularize the JDK after many years of JDK > development without module support in the platform. ?Otherwise, if there > were module support in the platform, you would consider very carefully when > adding a dependency on another module. perhaps you are right, but in case of logging I would expect that we'd use it anyway. Oleg. > > If you have further issue, I suggest to start a different thread on the > awt-dev alias. > > Thanks > Mandy > [1] http://jcp.org/aboutJava/communityprocess/first/jsr047/index.html > From leland at speakeasy.net Sat Sep 19 03:46:55 2009 From: leland at speakeasy.net (Rob Leland) Date: Fri, 18 Sep 2009 23:46:55 -0400 Subject: hg: jdk7/tl/jdk: 2 new changesets In-Reply-To: <20090919015248.8C8E8125E7@hg.openjdk.java.net> References: <20090919015248.8C8E8125E7@hg.openjdk.java.net> Message-ID: <4AB4542F.9030408@speakeasy.net> ..Mandy, Three questions. -import java.util.logging.Logger; +import sun.util.logging.PlatformLogger; It seems counter intuitive that a dependency would be change from a java.* -> sun.* since this the OpenJDK ,why not add it to java.util.log.* ? Then the JavaDocs says : This enables the runtime components to eliminate the static dependency of the logging facility .... In addition, the PlatformLogger API can be used if the logging module does not exist. What use case required this ? Then is this meant to be similar to Apache commons-logging which also has a basic logging functionality ? On 9/18/2009 9:51 PM, mandy.chung at sun.com wrote: > Changeset: d3281fa8e46c > Author: mchung > Date: 2009-09-17 14:24 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d3281fa8e46c > > 6882376: Add internal support for JRE implementation to eliminate the dependency on logging > Summary: Added sun.util.logging.PlatformLogger for JRE implementation to log messages. > Reviewed-by: alanb, naoto > > ! make/java/logging/Makefile > ! src/share/classes/java/util/Currency.java > ! src/share/classes/java/util/jar/Attributes.java > ! src/share/classes/java/util/logging/LogManager.java > ! src/share/classes/java/util/logging/LogRecord.java > ! src/share/classes/sun/util/LocaleServiceProviderPool.java > + src/share/classes/sun/util/logging/PlatformLogger.java > ! src/windows/classes/java/util/prefs/WindowsPreferences.java > + test/sun/util/logging/PlatformLoggerTest.java > > Changeset: 7b4e73ca6fd7 > Author: mchung > Date: 2009-09-18 17:27 -0700 > URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7b4e73ca6fd7 > > Merge > > > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4439 (20090918) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andrei.Dmitriev at Sun.COM Mon Sep 21 08:49:17 2009 From: Andrei.Dmitriev at Sun.COM (Andrei Dmitriev) Date: Mon, 21 Sep 2009 12:49:17 +0400 Subject: [OpenJDK 2D-Dev] Review Request for 6879044 In-Reply-To: <271e55d20909182059y4610d01at4cc8a2a935aa6cff@mail.gmail.com> References: <4AAD9D2D.6000502@sun.com> <4AB1F9CA.40309@sun.com> <4AB208E9.8020900@sun.com> <4AB212BA.6040405@sun.com> <271e55d20909170417x2bb1495bu6d93216c5141501e@mail.gmail.com> <4AB21B68.90603@sun.com> <271e55d20909170432s2c4e5f18sa7d3291f6e789dcb@mail.gmail.com> <4AB277C2.8030603@Sun.com> <271e55d20909171945l48544a5cjf6a61d36362285fa@mail.gmail.com> <4AB3EB60.7050600@sun.com> <271e55d20909182059y4610d01at4cc8a2a935aa6cff@mail.gmail.com> Message-ID: <4AB73E0D.3000600@sun.com> Hi Mandy, Oleg, I'm going to summarize pros and cons of this change just to make judge (basically for myself). 1) we can't expect a significant memory gain (the numbers are ~90Kb). That's a minus. 2) we decouple awt/swing/2d with logging package which is a Plus in a view of jigsaw. See 6) for more. 3) we don't have time measures for this change. That's a minus. 4) nobody measured anything else than Framer and SwingSet. That's a minus. 5) we lose flexibility on debugging. That's a minus. 6) this fix don't decouple anything else awt/swing/2d. I made a grep on "Logger.getLogger" and there are entries from xml, jmx, etc. That means we have to deal with them as well too (as it causes the class to be loaded anyway), if we aware of jigsaw. 7) In most cases AWT initiates classes statically but basically may want to do that lazily. That's minus. I'd consider initialization in CTOR at first and see the impact. Believe SwingSet would show enough here. If not, that's the reason to go further to... well to check if the Java property set. Now, I don't see the evaluation is completed to make the decision. And if we could modify client code in the way that Framer will never initialize or/and load Logger (et al) classes so we achieved the goal. Thanks, Andrei Oleg Sukhodolsky wrote: > HI Mandy, > > On Sat, Sep 19, 2009 at 12:19 AM, Mandy Chung wrote: > >> Hi Oleg, >> >> A better question to ask is who and how the logging information AWT is used >> for. The AWT team confirms that the AWT loggers are for debugging purpose >> used by the awt developers. As specified in the Requirements chapter for >> the Java Logging Spec (JSR-47) [1], the central goal of the logging API is >> to support maintaining and servicing software at customer sites. Adding >> debugging code in the awt implementation using logging API is reasonable but >> it's not the requirement for the logging API. If there were a better option >> to add debugging code, I believe you have no problem changing the awt >> debugging code not to use the logging API. >> >> Server-type applications are typical use cases that logging information is >> very important and useful for diagnosis in the field - long running apps, >> hard to reproduce problems until running for many days/months. It is hard >> to imagine how the logging information is important in client applications. >> > > as ex-AWT developer I can confirm that there were number of cases when > logging had helped us to diagnose problem on client's site. Even > though you usually > do not need to run an application for a long time to reproduce a problem > it can be very hard to reproduce it because the problem depends on > window manager > and other environment which is hard to re-create. > > >> But you seem to know many client applications use the logging API that I >> would also be interested to follow up with their requirements. >> > > I do not know many client applications which uses logging API (because I have > never write real client application) and it is hard to say if it uses > logging or not. > I hoped that you who saying that suggested changes will help to client > application > has some statistic to confirm your expectation > > >>> Ok, so this fix is only about modules. But why AWT should not depend >>> on logging module? >>> The qiestion is: how many application we want to run doesn't use >>> logging& Because if an application >>> uses logging there is no reasons for AWT to not use it. Please note >>> that even if logging is turned >>> off, the application still needs logging package/module. So, though >>> end-user doesn't need logging output >>> she may need logging module to run the application. >>> >> This is exactly why we want to decouple the dependency on logging. When an >> application uses logging, the application knows clearly what module they >> require and that's fine. When an application doesn't logging, if the awt >> component requires logging for debugging purpose only, it increases the >> download size, footprint and startup performance (class lookup time, >> loading, init, etc) - please see my performance analysis report; otherwise, >> it's not fruitful to discuss the details in this thread without the >> background info. Just to mention it what we care about. >> > > I have found only two links to some performance analysis: > > http://mail.openjdk.java.net/pipermail/jigsaw-dev/2009-July/000181.html > http://cr.openjdk.java.net/~mchung/startup_measurement/perfdata.summary.b64 > > but they say about -Xverify and -Xshare and do not understand how they > can be related > to our topic :( If they do, please explain (I have never been an > expert in this area :( > Or, if I missed something could you please point me what I have missed. > > >>> So, it is really >>> important to understand >>> what number of application will get advantage of suggested changes. >>> >>> >>> >> You are suggesting the client applications always have a dependency on >> logging. Many client team engineers are happy to see the dependency on >> logging being eliminated from the client stack requirement and approve this >> fix :) >> > > I do not see how this can be considered as prove that the changes will > help client applications. > Unless we have some statistic it is all just our guess (which, as we > know, usually wrong ;) > > >>> Second question is: how big logging module is going to be? How big the >>> benefit for end-user will be? >>> >>> >>> >> The size of the logging API is not big (~90K) but the size is not the only >> one factor determining what benefit the end-user will have. >> > > what other factors do you know? > > >> It's not >> necessary to logging API as one single module and details are to be worked >> out. Subscribe to the jigsaw project to follow the discussion and progress >> there. Serviceability includes other API as well. If awt started using >> other serviceability API (java.lang.management, java.lang.instrument) for >> whatever reason, your argument would apply there as well. I don't think you >> wanted the awt module depends on all the serviceability APIs. >> > > I agree that usage of any API should be done after careful consideration. > Logging API provides us exactly what we need (ability to create log of > an application > executed on client) this is why we started to use it. > > >>> I'm asking so many question mainly because the changes you suggested >>> create rather unnatural code (we can not >>> use standard logging machinery any more), so such changes should be >>> well-justified. >>> >>> >>> >> That's what we pay for to modularize the JDK after many years of JDK >> development without module support in the platform. Otherwise, if there >> were module support in the platform, you would consider very carefully when >> adding a dependency on another module. >> > > perhaps you are right, but in case of logging I would expect that we'd use it > anyway. > > Oleg. > > >> If you have further issue, I suggest to start a different thread on the >> awt-dev alias. >> >> Thanks >> Mandy >> [1] http://jcp.org/aboutJava/communityprocess/first/jsr047/index.html >> >> From vincent.ryan at sun.com Mon Sep 21 22:16:14 2009 From: vincent.ryan at sun.com (vincent.ryan at sun.com) Date: Mon, 21 Sep 2009 22:16:14 +0000 Subject: hg: jdk7/tl/jdk: 6884175: CR cleanup for 6840752: Provide out-of-the-box support for ECC algorithms Message-ID: <20090921221715.ED322126A6@hg.openjdk.java.net> Changeset: 845fefff00a4 Author: vinnie Date: 2009-09-21 23:01 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/845fefff00a4 6884175: CR cleanup for 6840752: Provide out-of-the-box support for ECC algorithms Reviewed-by: wetmore ! make/sun/security/ec/Makefile ! make/sun/security/other/Makefile ! src/share/classes/sun/security/ec/ECDHKeyAgreement.java ! src/share/classes/sun/security/ec/ECDSASignature.java ! src/share/classes/sun/security/ec/ECKeyPairGenerator.java ! src/share/classes/sun/security/ec/SunEC.java ! src/share/classes/sun/security/ec/SunECEntries.java ! src/share/native/sun/security/ec/ECC_JNI.cpp - src/share/native/sun/security/ec/ec.c + src/share/native/sun/security/ec/impl/ec.c + src/share/native/sun/security/ec/impl/ec.h + src/share/native/sun/security/ec/impl/ec2.h + src/share/native/sun/security/ec/impl/ec2_163.c + src/share/native/sun/security/ec/impl/ec2_193.c + src/share/native/sun/security/ec/impl/ec2_233.c + src/share/native/sun/security/ec/impl/ec2_aff.c + src/share/native/sun/security/ec/impl/ec2_mont.c + src/share/native/sun/security/ec/impl/ec_naf.c + src/share/native/sun/security/ec/impl/ecc_impl.h + src/share/native/sun/security/ec/impl/ecdecode.c + src/share/native/sun/security/ec/impl/ecl-curve.h + src/share/native/sun/security/ec/impl/ecl-exp.h + src/share/native/sun/security/ec/impl/ecl-priv.h + src/share/native/sun/security/ec/impl/ecl.c + src/share/native/sun/security/ec/impl/ecl.h + src/share/native/sun/security/ec/impl/ecl_curve.c + src/share/native/sun/security/ec/impl/ecl_gf.c + src/share/native/sun/security/ec/impl/ecl_mult.c + src/share/native/sun/security/ec/impl/ecp.h + src/share/native/sun/security/ec/impl/ecp_192.c + src/share/native/sun/security/ec/impl/ecp_224.c + src/share/native/sun/security/ec/impl/ecp_256.c + src/share/native/sun/security/ec/impl/ecp_384.c + src/share/native/sun/security/ec/impl/ecp_521.c + src/share/native/sun/security/ec/impl/ecp_aff.c + src/share/native/sun/security/ec/impl/ecp_jac.c + src/share/native/sun/security/ec/impl/ecp_jm.c + src/share/native/sun/security/ec/impl/ecp_mont.c + src/share/native/sun/security/ec/impl/logtab.h + src/share/native/sun/security/ec/impl/mp_gf2m-priv.h + src/share/native/sun/security/ec/impl/mp_gf2m.c + src/share/native/sun/security/ec/impl/mp_gf2m.h + src/share/native/sun/security/ec/impl/mpi-config.h + src/share/native/sun/security/ec/impl/mpi-priv.h + src/share/native/sun/security/ec/impl/mpi.c + src/share/native/sun/security/ec/impl/mpi.h + src/share/native/sun/security/ec/impl/mplogic.c + src/share/native/sun/security/ec/impl/mplogic.h + src/share/native/sun/security/ec/impl/mpmontg.c + src/share/native/sun/security/ec/impl/mpprime.h + src/share/native/sun/security/ec/impl/oid.c + src/share/native/sun/security/ec/impl/secitem.c + src/share/native/sun/security/ec/impl/secoidt.h ! test/sun/security/ec/TestEC.java + test/sun/security/ec/certs/sunlabscerts.pem + test/sun/security/ec/keystore + test/sun/security/ec/truststore ! test/sun/security/pkcs11/ec/ReadCertificates.java ! test/sun/security/pkcs11/sslecc/CipherTest.java From weijun.wang at sun.com Tue Sep 22 02:03:40 2009 From: weijun.wang at sun.com (weijun.wang at sun.com) Date: Tue, 22 Sep 2009 02:03:40 +0000 Subject: hg: jdk7/tl/jdk: 6877357: IPv6 address does not work Message-ID: <20090922020417.316C0126D0@hg.openjdk.java.net> Changeset: 81dffe63c913 Author: weijun Date: 2009-09-22 10:01 +0800 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/81dffe63c913 6877357: IPv6 address does not work Reviewed-by: xuelei, alanb ! src/share/classes/sun/security/krb5/KrbKdcReq.java + test/sun/security/krb5/IPv6.java From joe.darcy at sun.com Tue Sep 22 04:09:19 2009 From: joe.darcy at sun.com (joe.darcy at sun.com) Date: Tue, 22 Sep 2009 04:09:19 +0000 Subject: hg: jdk7/tl/langtools: 6884227: Clarify ordering requirements of javax.lang.model.TypeElement.getEnclosedElements Message-ID: <20090922040921.9BEFB126E5@hg.openjdk.java.net> Changeset: 789ee1acf107 Author: darcy Date: 2009-09-21 21:08 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/789ee1acf107 6884227: Clarify ordering requirements of javax.lang.model.TypeElement.getEnclosedElements Reviewed-by: ahe ! src/share/classes/javax/lang/model/element/TypeElement.java From Joe.Darcy at Sun.COM Tue Sep 22 04:44:17 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Mon, 21 Sep 2009 21:44:17 -0700 Subject: Code review request for 6468534 "(reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes" Message-ID: <4AB85621.1030807@sun.com> Hello. Please review my simple fix below for 6468534 "(reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes." As documented in the JLS, "It is a compile-time error if a generic class is a direct or indirect subclass of |Throwable|." http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.2 Therefore, it is at most vacuously true for the {Constructor, Method}.getGenericExceptionTypes to state "If an exception type is a parameterized type..." and it would be clearer if this text were deleted. -Joe --- old/src/share/classes/java/lang/reflect/Constructor.java 2009-09-21 21:42:21.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Constructor.java 2009-09-21 21:42:20.000000000 -0700 @@ -275,10 +275,6 @@ * Returns an array of length 0 if the underlying method declares * no exceptions in its {@code throws} clause. * - *

If an exception type is a parameterized type, the {@code Type} - * object returned for it must accurately reflect the actual type - * parameters used in the source code. - * *

If an exception type is a type variable or a parameterized * type, it is created. Otherwise, it is resolved. * --- old/src/share/classes/java/lang/reflect/Method.java 2009-09-21 21:42:22.000000000 -0700 +++ new/src/share/classes/java/lang/reflect/Method.java 2009-09-21 21:42:21.000000000 -0700 @@ -317,10 +317,6 @@ * Returns an array of length 0 if the underlying method declares * no exceptions in its {@code throws} clause. * - *

If an exception type is a parameterized type, the {@code Type} - * object returned for it must accurately reflect the actual type - * parameters used in the source code. - * *

If an exception type is a type variable or a parameterized * type, it is created. Otherwise, it is resolved. * From Alan.Bateman at Sun.COM Tue Sep 22 08:00:29 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Tue, 22 Sep 2009 09:00:29 +0100 Subject: hg: jdk7/tl/jdk: 2 new changesets In-Reply-To: <4AB4542F.9030408@speakeasy.net> References: <20090919015248.8C8E8125E7@hg.openjdk.java.net> <4AB4542F.9030408@speakeasy.net> Message-ID: <4AB8841D.2000907@sun.com> Rob Leland wrote: > ..Mandy, > > Three questions. > > -import java.util.logging.Logger; > +import sun.util.logging.PlatformLogger; > > It seems counter intuitive that a dependency would be change > from a java.* -> sun.* since this the OpenJDK ,why not add it to > java.util.log.* ? This change-set isn't adding a new public API but rather is only adding an internal class that other components of the runtime can use to avoid a direct dependency on j.u.logging. -Alan. From jandam at crcdata.cz Tue Sep 22 11:26:05 2009 From: jandam at crcdata.cz (Janda Martin) Date: Tue, 22 Sep 2009 13:26:05 +0200 (CEST) Subject: System.identityHashCode performance In-Reply-To: <21838673.421253618353762.JavaMail.root@zs.crcpraha> Message-ID: <20250801.441253618765760.JavaMail.root@zs.crcpraha> I would like to ask about any plans of speed improvements to "System.identityHashCode" or "IdentityHashMap" I use EclipseLink and it uses IdentityHashMap for storing entities and their clones. In my case System.identityHashCode consumes 54% of time during insert data to database. There are lots of other project using IdentityHashMap and identityHashCode. Thank you very much Martin PS sorry for my english From Thomas.Hawtin at Sun.COM Tue Sep 22 11:35:36 2009 From: Thomas.Hawtin at Sun.COM (Tom Hawtin) Date: Tue, 22 Sep 2009 12:35:36 +0100 Subject: System.identityHashCode performance In-Reply-To: <20250801.441253618765760.JavaMail.root@zs.crcpraha> References: <20250801.441253618765760.JavaMail.root@zs.crcpraha> Message-ID: <4AB8B688.7020104@sun.com> Janda Martin wrote: > I would like to ask about any plans of speed improvements to "System.identityHashCode" or "IdentityHashMap" > > I use EclipseLink and it uses IdentityHashMap for storing entities and their clones. > > In my case System.identityHashCode consumes 54% of time during insert data to database. There are lots of other project using IdentityHashMap and identityHashCode. CR 6378256 seems to cover this for the client/C1 compiler. Presumably the server/C2 compiler already intrinsifies the method. It's been in "fix understood" for a couple of years... http://bugs.sun.com/view_bug.do?bug_id=6378256 Tom Hawtin From Ulf.Zibis at gmx.de Tue Sep 22 11:42:17 2009 From: Ulf.Zibis at gmx.de (Ulf Zibis) Date: Tue, 22 Sep 2009 13:42:17 +0200 Subject: System.identityHashCode performance In-Reply-To: <4AB8B688.7020104@sun.com> References: <20250801.441253618765760.JavaMail.root@zs.crcpraha> <4AB8B688.7020104@sun.com> Message-ID: <4AB8B819.1060207@gmx.de> Janda, you could provide a/the patch to force the fix of this bug. See: http://openjdk.java.net/contribute/ -Ulf Am 22.09.2009 13:35, Tom Hawtin schrieb: > Janda Martin wrote: >> I would like to ask about any plans of speed improvements to >> "System.identityHashCode" or "IdentityHashMap" >> >> I use EclipseLink and it uses IdentityHashMap for storing entities >> and their clones. >> >> In my case System.identityHashCode consumes 54% of time during insert >> data to database. There are lots of other project using >> IdentityHashMap and identityHashCode. > > CR 6378256 seems to cover this for the client/C1 compiler. Presumably > the server/C2 compiler already intrinsifies the method. It's been in > "fix understood" for a couple of years... > > http://bugs.sun.com/view_bug.do?bug_id=6378256 > > Tom Hawtin > > From Christian.Thalinger at Sun.COM Tue Sep 22 11:47:44 2009 From: Christian.Thalinger at Sun.COM (Christian Thalinger) Date: Tue, 22 Sep 2009 13:47:44 +0200 Subject: System.identityHashCode performance In-Reply-To: <4AB8B688.7020104@sun.com> References: <20250801.441253618765760.JavaMail.root@zs.crcpraha> <4AB8B688.7020104@sun.com> Message-ID: <4AB8B960.10101@Sun.COM> Tom Hawtin wrote: > Janda Martin wrote: >> I would like to ask about any plans of speed improvements to "System.identityHashCode" or "IdentityHashMap" >> >> I use EclipseLink and it uses IdentityHashMap for storing entities and their clones. >> >> In my case System.identityHashCode consumes 54% of time during insert data to database. There are lots of other project using IdentityHashMap and identityHashCode. > > CR 6378256 seems to cover this for the client/C1 compiler. Presumably > the server/C2 compiler already intrinsifies the method. It's been in > "fix understood" for a couple of years... > > http://bugs.sun.com/view_bug.do?bug_id=6378256 Martin, are you having performance problems with client or server compiler? -- Christian From christopher.hegarty at sun.com Tue Sep 22 13:51:10 2009 From: christopher.hegarty at sun.com (christopher.hegarty at sun.com) Date: Tue, 22 Sep 2009 13:51:10 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090922135200.99A751275B@hg.openjdk.java.net> Changeset: 023063a403ed Author: chegar Date: 2009-09-22 14:42 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/023063a403ed 6882654: Remove dependency on java.util.concurrent from KeepAlive implementaion Reviewed-by: michaelm ! src/share/classes/sun/net/www/http/KeepAliveCache.java ! src/share/classes/sun/net/www/http/KeepAliveStream.java ! src/share/classes/sun/net/www/http/KeepAliveStreamCleaner.java Changeset: 44ccaa4bb8a0 Author: chegar Date: 2009-09-22 14:49 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/44ccaa4bb8a0 6882384: Update http protocol handler to use PlatformLogger Reviewed-by: jccollet, alanb ! src/share/classes/sun/net/www/http/HttpCapture.java ! src/share/classes/sun/net/www/http/HttpClient.java ! src/share/classes/sun/net/www/protocol/http/HttpLogFormatter.java ! src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java ! src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java ! src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java ! src/share/classes/sun/util/logging/PlatformLogger.java From jandam at crcdata.cz Tue Sep 22 13:52:39 2009 From: jandam at crcdata.cz (Janda Martin) Date: Tue, 22 Sep 2009 15:52:39 +0200 (CEST) Subject: System.identityHashCode performance Message-ID: <6198702.631253627559259.JavaMail.root@zs.crcpraha> It was on JDK 1.6.0_u16 client compiler. Persisting about 2 000 "large" entities (~45 attributes) and 200 000 entities (~4 attributes) in one transaction (tuned with: batch writes, cache all statements, batch size = 200, bind all parameters) Profiler: JProfiler version 4.2.4 I'm not "JDK" guru so I'm not able to make a patch. I just found that there is used RegisterNatives in Object.hashCode, but not in System.identityHashCode. Thank you. ----- Original Message ----- From: "Christian Thalinger" To: "Tom Hawtin" Cc: "Janda Martin" , core-libs-dev at openjdk.java.net Sent: Tuesday, September 22, 2009 1:47:44 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: Re: System.identityHashCode performance Tom Hawtin wrote: > Janda Martin wrote: >> I would like to ask about any plans of speed improvements to "System.identityHashCode" or "IdentityHashMap" >> >> I use EclipseLink and it uses IdentityHashMap for storing entities and their clones. >> >> In my case System.identityHashCode consumes 54% of time during insert data to database. There are lots of other project using IdentityHashMap and identityHashCode. > > CR 6378256 seems to cover this for the client/C1 compiler. Presumably > the server/C2 compiler already intrinsifies the method. It's been in > "fix understood" for a couple of years... > > http://bugs.sun.com/view_bug.do?bug_id=6378256 Martin, are you having performance problems with client or server compiler? -- Christian From kevin.walls at sun.com Tue Sep 22 16:17:22 2009 From: kevin.walls at sun.com (kevin.walls at sun.com) Date: Tue, 22 Sep 2009 16:17:22 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090922161810.7485412766@hg.openjdk.java.net> Changeset: b8004f6f4812 Author: kevinw Date: 2009-09-22 17:01 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b8004f6f4812 6882768: (launcher) test for 6842838 is broken Summary: Testcase correction. Reviewed-by: ksrini ! test/tools/launcher/6842838/Test6842838.sh Changeset: f708138c9aca Author: kevinw Date: 2009-09-22 17:16 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f708138c9aca Merge From Alan.Bateman at Sun.COM Tue Sep 22 16:51:54 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Tue, 22 Sep 2009 17:51:54 +0100 Subject: Code review request for 6468534 "(reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes" In-Reply-To: <4AB85621.1030807@sun.com> References: <4AB85621.1030807@sun.com> Message-ID: <4AB900AA.6030805@sun.com> Joe Darcy wrote: > Hello. > > Please review my simple fix below for 6468534 "(reflect) Exception > types cannot be parameterized, rephrase getGenericExceptionTypes." > > As documented in the JLS, "It is a compile-time error if a generic > class is a direct or indirect subclass of |Throwable|." > > http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.2 > > Therefore, it is at most vacuously true for the {Constructor, > Method}.getGenericExceptionTypes to state "If an exception type is a > parameterized type..." and it would be clearer if this text were deleted. > > -Joe > > --- old/src/share/classes/java/lang/reflect/Constructor.java > 2009-09-21 21:42:21.000000000 -0700 > +++ new/src/share/classes/java/lang/reflect/Constructor.java > 2009-09-21 21:42:20.000000000 -0700 > @@ -275,10 +275,6 @@ > * Returns an array of length 0 if the underlying method declares > * no exceptions in its {@code throws} clause. > * > - *

If an exception type is a parameterized type, the {@code Type} > - * object returned for it must accurately reflect the actual type > - * parameters used in the source code. > - * > *

If an exception type is a type variable or a parameterized > * type, it is created. Otherwise, it is resolved. > * > --- old/src/share/classes/java/lang/reflect/Method.java 2009-09-21 > 21:42:22.000000000 -0700 > +++ new/src/share/classes/java/lang/reflect/Method.java 2009-09-21 > 21:42:21.000000000 -0700 > @@ -317,10 +317,6 @@ > * Returns an array of length 0 if the underlying method declares > * no exceptions in its {@code throws} clause. > * > - *

If an exception type is a parameterized type, the {@code Type} > - * object returned for it must accurately reflect the actual type > - * parameters used in the source code. > - * > *

If an exception type is a type variable or a parameterized > * type, it is created. Otherwise, it is resolved. > * This looks reasonable to me. BTW: are there inconsistent indenting in these files? In Constructor it looks like getTypeParameters and getGenericExceptionTypes is mis-aligned. getGenericExceptionTypes in Method.java. -Alan. From Xueming.Shen at Sun.COM Tue Sep 22 20:03:00 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Tue, 22 Sep 2009 13:03:00 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AB9279E.8030701@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA1B890.7000703@sun.com> <1ccfd1c10909041821w12905254w1a3515e9b42d2ee3@mail.gmail.com> <1ccfd1c10909050924v656431d0j527558cb8ef9502f@mail.gmail.com> <4AA7F9EB.5090200@sun.com> <4AA816AD.7090306@sun.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> <4AAD27B4.4040507@sun.com> <4AB865BE.40109@sun.com> <4AB91A06.3070409@sun.com> <4AB9279E.8030701@sun.com> Message-ID: <4AB92D74.7080702@sun.com> Thanks Alan! The webrev has been updated accordingly to address your comments (use syncFlush instead of doSyncFlush and those suggestions for Deflater.java). http://cr.openjdk.java.net/~sherman/zipflush/webrev Sherman PS. There was a "take2" for DOS that I think might be more consistent with the existing APIs, but it might be the time to focus on one approach. If you're interested the "take2" is at http://cr.openjdk.java.net/~sherman/zipflush/webrev.take2/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html Alan Bateman wrote: > Welcome back (for some reason I thought you were gone for two weeks). > > It would be best to send the proposal to the mailing list so that > others can comment. > > Personally, I don't like exposing the flush mode to subclasses but you > are right that it is more consistent with the original design. If > this approach is chosen then I would suggest that the flush > implementation make a copy of the flush mode before testing and using > it. Also, the new constructors will need to say that they initialize > the flush mode based on the parameter (since it can change on the > fly). BTW: What is the reason for renaming the parameter to flushDef. > I prefer "syncFlush" over "doSyncFlush". > > I'm happy with Deflater. In the description of SYNC_FLUSH I would > suggest changing the "," into a ";" or else make it into two > sentences. In the new deflate method the description of NO_FLUSH needs > a comma after "accumulate" for it to flow well. Similar issue in the > SYNC_FLUSH description where you need a comma after "is flushed". > There is also a typo [ comparssed :-) ] > > -Alan. > > From joe.darcy at sun.com Tue Sep 22 23:11:07 2009 From: joe.darcy at sun.com (joe.darcy at sun.com) Date: Tue, 22 Sep 2009 23:11:07 +0000 Subject: hg: jdk7/tl/jdk: 6468534: (reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes. Message-ID: <20090922231202.85783127D6@hg.openjdk.java.net> Changeset: c715b68cdcaf Author: darcy Date: 2009-09-22 16:11 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/c715b68cdcaf 6468534: (reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes. Reviewed-by: alanb ! src/share/classes/java/lang/reflect/Constructor.java ! src/share/classes/java/lang/reflect/Method.java From Mandy.Chung at Sun.COM Tue Sep 22 23:47:15 2009 From: Mandy.Chung at Sun.COM (Mandy Chung) Date: Tue, 22 Sep 2009 16:47:15 -0700 Subject: hg: jdk7/tl/jdk: 2 new changesets In-Reply-To: <4AB4542F.9030408@speakeasy.net> References: <20090919015248.8C8E8125E7@hg.openjdk.java.net> <4AB4542F.9030408@speakeasy.net> Message-ID: <4AB96203.5080406@Sun.com> Hi Rob, Rob Leland wrote: > ..Mandy, > > Three questions. > > -import java.util.logging.Logger; > +import sun.util.logging.PlatformLogger; > > It seems counter intuitive that a dependency would be change > from a java.* -> sun.* since this the OpenJDK ,why not add it to > java.util.log.* ? Alan answered this question (thanks Alan). sun.util.logging.PlatformLogger is a private unsupported API added for internal JDK implementation use. > Then the JavaDocs says : > This enables the runtime components to eliminate the > static dependency of the logging facility .... > In addition, the PlatformLogger API can be used if the logging > module does not exist. > > What use case required this ? > > Then is this meant to be similar to Apache commons-logging which also > has a basic logging functionality ? No. PlatformLogger is not designed to provide basic logging functionality but instead as a proxy to avoid direct dependency on java.util.logging for internal use. I guess the last sentence caused the confusion. Mandy > On 9/18/2009 9:51 PM, mandy.chung at sun.com wrote: >> Changeset: d3281fa8e46c >> Author: mchung >> Date: 2009-09-17 14:24 -0700 >> URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d3281fa8e46c >> >> 6882376: Add internal support for JRE implementation to eliminate the dependency on logging >> Summary: Added sun.util.logging.PlatformLogger for JRE implementation to log messages. >> Reviewed-by: alanb, naoto >> >> ! make/java/logging/Makefile >> ! src/share/classes/java/util/Currency.java >> ! src/share/classes/java/util/jar/Attributes.java >> ! src/share/classes/java/util/logging/LogManager.java >> ! src/share/classes/java/util/logging/LogRecord.java >> ! src/share/classes/sun/util/LocaleServiceProviderPool.java >> + src/share/classes/sun/util/logging/PlatformLogger.java >> ! src/windows/classes/java/util/prefs/WindowsPreferences.java >> + test/sun/util/logging/PlatformLoggerTest.java >> >> Changeset: 7b4e73ca6fd7 >> Author: mchung >> Date: 2009-09-18 17:27 -0700 >> URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/7b4e73ca6fd7 >> >> Merge >> >> >> >> >> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4439 (20090918) __________ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com >> >> >> >> >> > From martinrb at google.com Wed Sep 23 01:40:37 2009 From: martinrb at google.com (martinrb at google.com) Date: Wed, 23 Sep 2009 01:40:37 +0000 Subject: hg: jdk7/tl/jdk: 2 new changesets Message-ID: <20090923014109.01775127ED@hg.openjdk.java.net> Changeset: bbb543254c63 Author: martin Date: 2009-09-22 18:30 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bbb543254c63 4245470: algorithm of java.lang.Byte.hashCode() is not specified Summary: Specify some hashCode methods are equivalent to intValue Reviewed-by: darcy ! src/share/classes/java/lang/Byte.java ! src/share/classes/java/lang/Character.java ! src/share/classes/java/lang/Short.java + test/java/lang/HashCode.java Changeset: eb92c939b8a7 Author: martin Date: 2009-09-22 18:30 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/eb92c939b8a7 6582946: Add suite of compare(T, T) methods for ints, longs etc Reviewed-by: darcy Contributed-by: kevinb at google.com ! 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/Integer.java ! src/share/classes/java/lang/Long.java ! src/share/classes/java/lang/Short.java + test/java/lang/Compare.java From Joe.Darcy at Sun.COM Wed Sep 23 02:36:39 2009 From: Joe.Darcy at Sun.COM (Joe Darcy) Date: Tue, 22 Sep 2009 19:36:39 -0700 Subject: What methods should go into a java.util.Objects class in JDK 7? In-Reply-To: <4AAADC6B.7070807@sun.com> References: <4AA812D0.309@sun.com> <4AA9936B.5000006@joda.org> <4AAADC6B.7070807@sun.com> Message-ID: <4AB989B7.5030101@sun.com> Joe Darcy wrote: > Stephen Colebourne wrote: >> Joe Darcy wrote: >>> What other utility methods would have broad enough use and >>> applicability to go into a common java.util class? >> >> Joe, >> You've asked for a call for ideas, but not given any indication of >> process. Are you going to evaluate everything that comes in and pick >> the best a la Coin? Or allow anyone to send in patches? > > Those options are not mutually exclusive; patches are welcome subject > to the usual terms and conditions. > >> Who decides what is in and what is out? > > This is a little side project of mine and I wanted to get some > feedback before preparing a formal change for review, possibly > including patches from others. > > -Joe I'm getting caught up after the JVM Languages Summit and will post some java.util.Objects code for review in the near future. -Joe From martinrb at google.com Wed Sep 23 06:29:47 2009 From: martinrb at google.com (Martin Buchholz) Date: Tue, 22 Sep 2009 23:29:47 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4AB92D74.7080702@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> <4AAD27B4.4040507@sun.com> <4AB865BE.40109@sun.com> <4AB91A06.3070409@sun.com> <4AB9279E.8030701@sun.com> <4AB92D74.7080702@sun.com> Message-ID: <1ccfd1c10909222329y1c2d9fe0s845baecd4a4efe6d@mail.gmail.com> [+ Brandon] Sherman, Here are some review comments on "take1" Overall, looks good. This low-level API will be annoying to use, but that's mostly unavoidable. ---- typos: @linke sinze ---- source files contain TABs, no longer permitted ---- is denigrated in favor of @code ---- I don't think you really meant to include ./Flush.java in the webrev ---- {@link Deflater.SYNC_FLUSH} => {@link Deflater#SYNC_FLUSH} ---- Please use a Google copyright in InflateIn_DeflateOut ---- Martin On Tue, Sep 22, 2009 at 13:03, Xueming Shen wrote: > > Thanks Alan! > > The webrev has been updated accordingly to address your comments (use > syncFlush instead of > doSyncFlush and those suggestions for Deflater.java). > > http://cr.openjdk.java.net/~sherman/zipflush/webrev > > Sherman > > PS. There was a "take2" for DOS that I think might be more consistent with > the existing APIs, but it might be the > time to focus on one approach. If you're interested the "take2" is at > > http://cr.openjdk.java.net/~sherman/zipflush/webrev.take2/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html > > Alan Bateman wrote: >> >> Welcome back (for some reason I thought you were gone for two weeks). >> >> It would be best to send the proposal to the mailing list so that others >> can comment. >> >> Personally, I don't like exposing the flush mode to subclasses but you are >> right that it is more consistent with the original design. ?If this approach >> is chosen then I would suggest that the flush implementation make a copy of >> the flush mode before testing and using it. Also, the new constructors will >> need to say that they initialize the flush mode based on the parameter >> (since it can change on the fly). BTW: What is the reason for renaming the >> parameter to flushDef. I prefer "syncFlush" over "doSyncFlush". >> >> I'm happy with Deflater. In the description of SYNC_FLUSH I would suggest >> changing the "," into a ";" or else make it into two sentences. In the new >> deflate method the description of NO_FLUSH needs a comma after "accumulate" >> for it to flow well. Similar issue in the SYNC_FLUSH description where you >> need a comma after "is flushed". There is also a typo [ comparssed :-) ] >> >> -Alan. >> >> > > From ptisnovs at redhat.com Wed Sep 23 10:23:33 2009 From: ptisnovs at redhat.com (Pavel Tisnovsky) Date: Wed, 23 Sep 2009 12:23:33 +0200 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java Message-ID: <4AB9F725.5000704@redhat.com> Hi, two-lines patch for regression test java/net/MulticastSocket/SetOutgoingIf.java is exposed at http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ The test machine (where this test fails) has six network interfaces, but only two of them, namely eth2 and virbr0, can be used to send multicast packets. But the test does not check interface attributes and tries to use _ALL_ network interfaces (excluding loopback device, of course) to send and then receive multicast packets. It fails, but the failure message depends on current network interface order (order is not guaranteed) returned by NetworkInterface.getNetworkInterfaces(). Patch check, if the given network interface is able to send multicast packets. I think, the patch could be applied to OpenJDK6 too. Pavel Tisnovsky From Alan.Bateman at Sun.COM Wed Sep 23 11:01:17 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Wed, 23 Sep 2009 12:01:17 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4AB9F725.5000704@redhat.com> References: <4AB9F725.5000704@redhat.com> Message-ID: <4AB9FFFD.2050303@sun.com> Pavel Tisnovsky wrote: > Hi, > > two-lines patch for regression test > java/net/MulticastSocket/SetOutgoingIf.java is exposed at > http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ > > The test machine (where this test fails) has six network interfaces, > but only two of them, namely eth2 and virbr0, can be used to send > multicast packets. But the test does not check interface attributes > and tries to use _ALL_ network interfaces (excluding loopback device, > of course) to send and then receive multicast packets. > > It fails, but the failure message depends on current network interface > order (order is not guaranteed) returned by > NetworkInterface.getNetworkInterfaces(). Patch check, if the given > network interface is able to send multicast packets. > > I think, the patch could be applied to OpenJDK6 too. > > Pavel Tisnovsky Pavel - this looks good me, although I think you should send it to net-dev. To make it more reliable you could also check isUp as getNetworkInterface may enumerate network interfaces that are down. -Alan. From Christopher.Hegarty at Sun.COM Wed Sep 23 12:20:06 2009 From: Christopher.Hegarty at Sun.COM (Christopher Hegarty -Sun Microsystems Ireland) Date: Wed, 23 Sep 2009 13:20:06 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4AB9FFFD.2050303@sun.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> Message-ID: <4ABA1276.6090506@sun.com> [cc'ing net-dev] Alan Bateman wrote: > Pavel Tisnovsky wrote: >> Hi, >> >> two-lines patch for regression test >> java/net/MulticastSocket/SetOutgoingIf.java is exposed at >> http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ >> >> The test machine (where this test fails) has six network interfaces, >> but only two of them, namely eth2 and virbr0, can be used to send >> multicast packets. But the test does not check interface attributes >> and tries to use _ALL_ network interfaces (excluding loopback device, >> of course) to send and then receive multicast packets. >> >> It fails, but the failure message depends on current network interface >> order (order is not guaranteed) returned by >> NetworkInterface.getNetworkInterfaces(). Patch check, if the given >> network interface is able to send multicast packets. >> >> I think, the patch could be applied to OpenJDK6 too. >> >> Pavel Tisnovsky > Pavel - this looks good me, although I think you should send it to > net-dev. To make it more reliable you could also check isUp as > getNetworkInterface may enumerate network interfaces that are down. I agree with Alan here, it is best to check isUp also. Alan created the following bug for this: 6884837: "test/java/net/MulticastSocket/SetOutgoingIf.java should check if interfaces are up/support multicast" I see you have push access, so if you make the appropriate changes (mentioned above) I can review the webrev and you can use the above bug number and description to push the changeset. -Chris. P.S. I wonder if we have a similar issue with some of the other multicasting tests? > > -Alan. > > From ptisnovs at redhat.com Wed Sep 23 12:38:06 2009 From: ptisnovs at redhat.com (Pavel Tisnovsky) Date: Wed, 23 Sep 2009 14:38:06 +0200 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABA1276.6090506@sun.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> Message-ID: <4ABA16AE.6010401@redhat.com> Christopher, thank you for your answer. I'll update the test and make the webrev. FYI: in fact, the test java/net/MulticastSocket/Test.java fails too on my machine, but I just not (yet) investigated the issue. It fails with exception java.net.SocketException: Cannot assign requested address. Pavel Christopher Hegarty -Sun Microsystems Ireland wrote: > [cc'ing net-dev] > > Alan Bateman wrote: >> Pavel Tisnovsky wrote: >>> Hi, >>> >>> two-lines patch for regression test >>> java/net/MulticastSocket/SetOutgoingIf.java is exposed at >>> http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ >>> >>> The test machine (where this test fails) has six network interfaces, >>> but only two of them, namely eth2 and virbr0, can be used to send >>> multicast packets. But the test does not check interface attributes >>> and tries to use _ALL_ network interfaces (excluding loopback device, >>> of course) to send and then receive multicast packets. >>> >>> It fails, but the failure message depends on current network >>> interface order (order is not guaranteed) returned by >>> NetworkInterface.getNetworkInterfaces(). Patch check, if the given >>> network interface is able to send multicast packets. >>> >>> I think, the patch could be applied to OpenJDK6 too. >>> >>> Pavel Tisnovsky >> Pavel - this looks good me, although I think you should send it to >> net-dev. To make it more reliable you could also check isUp as >> getNetworkInterface may enumerate network interfaces that are down. > > I agree with Alan here, it is best to check isUp also. > > Alan created the following bug for this: > 6884837: "test/java/net/MulticastSocket/SetOutgoingIf.java should check > if interfaces are up/support multicast" > > I see you have push access, so if you make the appropriate changes > (mentioned above) I can review the webrev and you can use the above bug > number and description to push the changeset. > > -Chris. > > P.S. I wonder if we have a similar issue with some of the other > multicasting tests? > >> >> -Alan. >> >> From aph at redhat.com Wed Sep 23 13:21:01 2009 From: aph at redhat.com (Andrew Haley) Date: Wed, 23 Sep 2009 14:21:01 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABA1276.6090506@sun.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> Message-ID: <4ABA20BD.4030305@redhat.com> Christopher Hegarty -Sun Microsystems Ireland wrote: > [cc'ing net-dev] > > Alan Bateman wrote: >> Pavel Tisnovsky wrote: >>> Hi, >>> >>> two-lines patch for regression test >>> java/net/MulticastSocket/SetOutgoingIf.java is exposed at >>> http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ >>> >>> The test machine (where this test fails) has six network interfaces, >>> but only two of them, namely eth2 and virbr0, can be used to send >>> multicast packets. But the test does not check interface attributes >>> and tries to use _ALL_ network interfaces (excluding loopback device, >>> of course) to send and then receive multicast packets. >>> >>> It fails, but the failure message depends on current network >>> interface order (order is not guaranteed) returned by >>> NetworkInterface.getNetworkInterfaces(). Patch check, if the given >>> network interface is able to send multicast packets. >>> >>> I think, the patch could be applied to OpenJDK6 too. >>> >>> Pavel Tisnovsky >> Pavel - this looks good me, although I think you should send it to >> net-dev. To make it more reliable you could also check isUp as >> getNetworkInterface may enumerate network interfaces that are down. > > I agree with Alan here, it is best to check isUp also. > > Alan created the following bug for this: > 6884837: "test/java/net/MulticastSocket/SetOutgoingIf.java should check > if interfaces are up/support multicast" > > I see you have push access, so if you make the appropriate changes > (mentioned above) I can review the webrev and you can use the above bug > number and description to push the changeset. Please make sure you tell Pavel which forest to push to. It's sometimes hard for us outside Sun to know. Andrew. From gnu_andrew at member.fsf.org Wed Sep 23 13:35:03 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Wed, 23 Sep 2009 14:35:03 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABA20BD.4030305@redhat.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> Message-ID: <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> 2009/9/23 Andrew Haley : > Christopher Hegarty -Sun Microsystems Ireland wrote: >> [cc'ing net-dev] >> >> Alan Bateman wrote: >>> Pavel Tisnovsky wrote: >>>> Hi, >>>> >>>> two-lines patch for regression test >>>> java/net/MulticastSocket/SetOutgoingIf.java is exposed at >>>> http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ >>>> >>>> The test machine (where this test fails) has six network interfaces, >>>> but only two of them, namely eth2 and virbr0, can be used to send >>>> multicast packets. But the test does not check interface attributes >>>> and tries to use _ALL_ network interfaces (excluding loopback device, >>>> of course) to send and then receive multicast packets. >>>> >>>> It fails, but the failure message depends on current network >>>> interface order (order is not guaranteed) returned by >>>> NetworkInterface.getNetworkInterfaces(). Patch check, if the given >>>> network interface is able to send multicast packets. >>>> >>>> I think, the patch could be applied to OpenJDK6 too. >>>> >>>> Pavel Tisnovsky >>> Pavel - this looks good me, although I think you should send it to >>> net-dev. To make it more reliable you could also check isUp as >>> getNetworkInterface may enumerate network interfaces that are down. >> >> I agree with Alan here, it is best to check isUp also. >> >> Alan created the following bug for this: >> ?6884837: "test/java/net/MulticastSocket/SetOutgoingIf.java should check >> if interfaces are up/support multicast" >> >> I see you have push access, so if you make the appropriate changes >> (mentioned above) I can review the webrev and you can use the above bug >> number and description to push the changeset. > > Please make sure you tell Pavel which forest to push to. ?It's sometimes > hard for us outside Sun to know. > > Andrew. > http://openjdk.java.net/guide/repositories.html is the source for this information, though someone at Sun needs to update it. The jsn tree is dead (security and net now use the tl forest) and the i18n team push to the swing forest. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From aph at redhat.com Wed Sep 23 14:36:51 2009 From: aph at redhat.com (Andrew Haley) Date: Wed, 23 Sep 2009 15:36:51 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> Message-ID: <4ABA3283.4090209@redhat.com> Andrew John Hughes wrote: > 2009/9/23 Andrew Haley : >> Christopher Hegarty -Sun Microsystems Ireland wrote: >>> [cc'ing net-dev] >>> >>> I see you have push access, so if you make the appropriate changes >>> (mentioned above) I can review the webrev and you can use the above bug >>> number and description to push the changeset. >> Please make sure you tell Pavel which forest to push to. It's sometimes >> hard for us outside Sun to know. > > http://openjdk.java.net/guide/repositories.html Yeah, I know. It's still a good idea for the approver to tell newbie contributors which forest to push to. Andrew. From gnu_andrew at member.fsf.org Wed Sep 23 14:46:11 2009 From: gnu_andrew at member.fsf.org (Andrew John Hughes) Date: Wed, 23 Sep 2009 15:46:11 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABA3283.4090209@redhat.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> <4ABA3283.4090209@redhat.com> Message-ID: <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> 2009/9/23 Andrew Haley : > Andrew John Hughes wrote: >> 2009/9/23 Andrew Haley : >>> Christopher Hegarty -Sun Microsystems Ireland wrote: >>>> [cc'ing net-dev] >>>> >>>> I see you have push access, so if you make the appropriate changes >>>> (mentioned above) I can review the webrev and you can use the above bug >>>> number and description to push the changeset. >>> Please make sure you tell Pavel which forest to push to. ?It's sometimes >>> hard for us outside Sun to know. >> >> http://openjdk.java.net/guide/repositories.html > > Yeah, I know. ?It's still a good idea for the approver to tell newbie > contributors which forest to push to. > > Andrew. > Oh, I agree. I just thought I'd use the opportunity to point out to everyone that a) there is some documentation of this and, more importantly, b) it needs updating. -- Andrew :-) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8 From Christopher.Hegarty at Sun.COM Wed Sep 23 15:04:03 2009 From: Christopher.Hegarty at Sun.COM (Christopher Hegarty -Sun Microsystems Ireland) Date: Wed, 23 Sep 2009 16:04:03 +0100 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABA16AE.6010401@redhat.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA16AE.6010401@redhat.com> Message-ID: <4ABA38E3.9070303@sun.com> Pavel, This change should be integrated into the tl/jdk [1] repository. You can plan to integrate after code review, or if you prefer just let me know and I can take care of it for you. -Chris. [1] http://hg.openjdk.java.net/jdk7/tl/jdk/ Pavel Tisnovsky wrote: > Christopher, > > thank you for your answer. I'll update the test and make the webrev. > > FYI: in fact, the test java/net/MulticastSocket/Test.java fails too on > my machine, but I just not (yet) investigated the issue. It fails with > exception java.net.SocketException: Cannot assign requested address. > > Pavel > > Christopher Hegarty -Sun Microsystems Ireland wrote: >> [cc'ing net-dev] >> >> Alan Bateman wrote: >>> Pavel Tisnovsky wrote: >>>> Hi, >>>> >>>> two-lines patch for regression test >>>> java/net/MulticastSocket/SetOutgoingIf.java is exposed at >>>> http://cr.openjdk.java.net/~ptisnovs/JTReg_SetOutgoinIf/ >>>> >>>> The test machine (where this test fails) has six network interfaces, >>>> but only two of them, namely eth2 and virbr0, can be used to send >>>> multicast packets. But the test does not check interface attributes >>>> and tries to use _ALL_ network interfaces (excluding loopback >>>> device, of course) to send and then receive multicast packets. >>>> >>>> It fails, but the failure message depends on current network >>>> interface order (order is not guaranteed) returned by >>>> NetworkInterface.getNetworkInterfaces(). Patch check, if the given >>>> network interface is able to send multicast packets. >>>> >>>> I think, the patch could be applied to OpenJDK6 too. >>>> >>>> Pavel Tisnovsky >>> Pavel - this looks good me, although I think you should send it to >>> net-dev. To make it more reliable you could also check isUp as >>> getNetworkInterface may enumerate network interfaces that are down. >> >> I agree with Alan here, it is best to check isUp also. >> >> Alan created the following bug for this: >> 6884837: "test/java/net/MulticastSocket/SetOutgoingIf.java should >> check if interfaces are up/support multicast" >> >> I see you have push access, so if you make the appropriate changes >> (mentioned above) I can review the webrev and you can use the above >> bug number and description to push the changeset. >> >> -Chris. >> >> P.S. I wonder if we have a similar issue with some of the other >> multicasting tests? >> >>> >>> -Alan. >>> >>> > From Xueming.Shen at Sun.COM Wed Sep 23 17:08:21 2009 From: Xueming.Shen at Sun.COM (Xueming Shen) Date: Wed, 23 Sep 2009 10:08:21 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <1ccfd1c10909222329y1c2d9fe0s845baecd4a4efe6d@mail.gmail.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AA949DA.9010707@sun.com> <4AAA1B75.6060309@sun.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> <4AAD27B4.4040507@sun.com> <4AB865BE.40109@sun.com> <4AB91A06.3070409@sun.com> <4AB9279E.8030701@sun.com> <4AB92D74.7080702@sun.com> <1ccfd1c10909222329y1c2d9fe0s845baecd4a4efe6d@mail.gmail.com> Message-ID: <4ABA5605.6060302@sun.com> Martin, thanks for the comments. webrev has been updated accordingly, I will submit it for the CCC. What should the "google copyright" look like for InflateIn_DeflateOut.java? I picked it from http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Z_SYNC_FLUSH/test/java/util/zip/InflateIn_DeflateOut.java.html which uses the sun copyright, I guess it was copied from the your DeflateIn_InflateOut.java test case. So if you can pass me your google version I will paste it in. I assume It should be OK that I then put the sun one on top of that. Glad to see the light at the end of the tunnel finally:-) sherman Martin Buchholz wrote: > [+ Brandon] > > Sherman, > Here are some review comments on "take1" > > Overall, looks good. > This low-level API will be annoying to use, > but that's mostly unavoidable. > > ---- > typos: @linke sinze > ---- > source files contain TABs, no longer permitted > ---- > is denigrated in favor of @code > ---- > I don't think you really meant to include ./Flush.java in the webrev > ---- > {@link Deflater.SYNC_FLUSH} > => > {@link Deflater#SYNC_FLUSH} > ---- > Please use a Google copyright in InflateIn_DeflateOut > ---- > > Martin > > On Tue, Sep 22, 2009 at 13:03, Xueming Shen wrote: > >> Thanks Alan! >> >> The webrev has been updated accordingly to address your comments (use >> syncFlush instead of >> doSyncFlush and those suggestions for Deflater.java). >> >> http://cr.openjdk.java.net/~sherman/zipflush/webrev >> >> Sherman >> >> PS. There was a "take2" for DOS that I think might be more consistent with >> the existing APIs, but it might be the >> time to focus on one approach. If you're interested the "take2" is at >> >> http://cr.openjdk.java.net/~sherman/zipflush/webrev.take2/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html >> >> Alan Bateman wrote: >> >>> Welcome back (for some reason I thought you were gone for two weeks). >>> >>> It would be best to send the proposal to the mailing list so that others >>> can comment. >>> >>> Personally, I don't like exposing the flush mode to subclasses but you are >>> right that it is more consistent with the original design. If this approach >>> is chosen then I would suggest that the flush implementation make a copy of >>> the flush mode before testing and using it. Also, the new constructors will >>> need to say that they initialize the flush mode based on the parameter >>> (since it can change on the fly). BTW: What is the reason for renaming the >>> parameter to flushDef. I prefer "syncFlush" over "doSyncFlush". >>> >>> I'm happy with Deflater. In the description of SYNC_FLUSH I would suggest >>> changing the "," into a ";" or else make it into two sentences. In the new >>> deflate method the description of NO_FLUSH needs a comma after "accumulate" >>> for it to flow well. Similar issue in the SYNC_FLUSH description where you >>> need a comma after "is flushed". There is also a typo [ comparssed :-) ] >>> >>> -Alan. >>> >>> >>> >> From Kelly.Ohair at Sun.COM Wed Sep 23 17:48:58 2009 From: Kelly.Ohair at Sun.COM (Kelly O'Hair) Date: Wed, 23 Sep 2009 10:48:58 -0700 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> <4ABA3283.4090209@redhat.com> <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> Message-ID: <4ABA5F8A.8080000@sun.com> Andrew John Hughes wrote: > 2009/9/23 Andrew Haley : >> Andrew John Hughes wrote: >>> 2009/9/23 Andrew Haley : >>>> Christopher Hegarty -Sun Microsystems Ireland wrote: >>>>> [cc'ing net-dev] >>>>> >>>>> I see you have push access, so if you make the appropriate changes >>>>> (mentioned above) I can review the webrev and you can use the above bug >>>>> number and description to push the changeset. >>>> Please make sure you tell Pavel which forest to push to. It's sometimes >>>> hard for us outside Sun to know. >>> http://openjdk.java.net/guide/repositories.html >> Yeah, I know. It's still a good idea for the approver to tell newbie >> contributors which forest to push to. >> >> Andrew. >> > > Oh, I agree. I just thought I'd use the opportunity to point out to > everyone that a) there is some documentation of this and, more > importantly, b) it needs updating. I will try and see if I can do some updating to this repositories page. If there are other problems with this page, let me know I'll try and include the changes people tell me about, within reason of course.. ;^) -kto From martinrb at google.com Wed Sep 23 17:58:32 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 23 Sep 2009 10:58:32 -0700 Subject: 4206909 - adding Z_SYNC_FLUSH support to deflaters In-Reply-To: <4ABA5605.6060302@sun.com> References: <1ccfd1c10909031147g28b856fbrdaefa5fbaa411515@mail.gmail.com> <4AAAD99A.4050505@sun.com> <1ccfd1c10909121445p7361dbe9l6ce7e79e178b1519@mail.gmail.com> <4AAD27B4.4040507@sun.com> <4AB865BE.40109@sun.com> <4AB91A06.3070409@sun.com> <4AB9279E.8030701@sun.com> <4AB92D74.7080702@sun.com> <1ccfd1c10909222329y1c2d9fe0s845baecd4a4efe6d@mail.gmail.com> <4ABA5605.6060302@sun.com> Message-ID: <1ccfd1c10909231058t6bc5bb76q54f98af12c28f0bc@mail.gmail.com> [+Brandon] For the test copyright line, use * Copyright 2009 Google, Inc. All Rights Reserved. as in other test cases. Whether, in addition, to have a Sun copyright depends on whether you made "substantive modifications". Heuristic for that is 10 lines of code. Obviously, the Sun copyright got there via copy-n-paste from existing files. --- You still have @linke typos and lingering TABs to untabify. --- Otherwise, I'm happy enough with this - I think we have rough consensus. Martin On Wed, Sep 23, 2009 at 10:08, Xueming Shen wrote: > > Martin, thanks for the comments. > > webrev has been updated accordingly, I will submit it for the CCC. > > What should the "google copyright" look like for InflateIn_DeflateOut.java? > > I picked it from > > http://cr.openjdk.java.net/~martin/webrevs/openjdk7/Z_SYNC_FLUSH/test/java/util/zip/InflateIn_DeflateOut.java.html > > which uses the sun copyright, I guess it was copied from the your > DeflateIn_InflateOut.java test case. > > So if you can pass me your google version I will paste it in. I assume It > should be OK that I then put the > sun one on top of that. > > Glad to see the light at the end of the tunnel finally:-) > > sherman > > Martin Buchholz wrote: >> >> [+ Brandon] >> >> Sherman, >> Here are some review comments on "take1" >> >> Overall, looks good. >> This low-level API will be annoying to use, >> but that's mostly unavoidable. >> >> ---- >> typos: @linke sinze >> ---- >> source files contain TABs, no longer permitted >> ---- >> is denigrated in favor of @code >> ---- >> I don't think you really meant to include ./Flush.java in the webrev >> ---- >> {@link Deflater.SYNC_FLUSH} >> => >> {@link Deflater#SYNC_FLUSH} >> ---- >> Please use a Google copyright in InflateIn_DeflateOut >> ---- >> >> Martin >> >> On Tue, Sep 22, 2009 at 13:03, Xueming Shen wrote: >> >>> >>> Thanks Alan! >>> >>> The webrev has been updated accordingly to address your comments (use >>> syncFlush instead of >>> doSyncFlush and those suggestions for Deflater.java). >>> >>> http://cr.openjdk.java.net/~sherman/zipflush/webrev >>> >>> Sherman >>> >>> PS. There was a "take2" for DOS that I think might be more consistent >>> with >>> the existing APIs, but it might be the >>> time to focus on one approach. If you're interested the "take2" is at >>> >>> >>> http://cr.openjdk.java.net/~sherman/zipflush/webrev.take2/src/share/classes/java/util/zip/DeflaterOutputStream.java.sdiff.html >>> >>> Alan Bateman wrote: >>> >>>> >>>> Welcome back (for some reason I thought you were gone for two weeks). >>>> >>>> It would be best to send the proposal to the mailing list so that others >>>> can comment. >>>> >>>> Personally, I don't like exposing the flush mode to subclasses but you >>>> are >>>> right that it is more consistent with the original design. ?If this >>>> approach >>>> is chosen then I would suggest that the flush implementation make a copy >>>> of >>>> the flush mode before testing and using it. Also, the new constructors >>>> will >>>> need to say that they initialize the flush mode based on the parameter >>>> (since it can change on the fly). BTW: What is the reason for renaming >>>> the >>>> parameter to flushDef. I prefer "syncFlush" over "doSyncFlush". >>>> >>>> I'm happy with Deflater. In the description of SYNC_FLUSH I would >>>> suggest >>>> changing the "," into a ";" or else make it into two sentences. In the >>>> new >>>> deflate method the description of NO_FLUSH needs a comma after >>>> "accumulate" >>>> for it to flow well. Similar issue in the SYNC_FLUSH description where >>>> you >>>> need a comma after "is flushed". There is also a typo [ comparssed :-) ] >>>> >>>> -Alan. >>>> >>>> >>>> >>> >>> > > From joe.darcy at sun.com Thu Sep 24 01:30:26 2009 From: joe.darcy at sun.com (joe.darcy at sun.com) Date: Thu, 24 Sep 2009 01:30:26 +0000 Subject: hg: jdk7/tl/langtools: 6517779: javax.lang.model.util.Elements.getConstantExpression() doesn't throw any exception; ... Message-ID: <20090924013028.87B1512856@hg.openjdk.java.net> Changeset: e992e602788e Author: darcy Date: 2009-09-23 18:29 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/e992e602788e 6517779: javax.lang.model.util.Elements.getConstantExpression() doesn't throw any exception 6517907: javax.lang.model.util.Elements.getConstantExpression() with negative byte value fails Summary: Fix various problems with Elements.getConstantExpression() Reviewed-by: jjg ! src/share/classes/com/sun/tools/javac/util/Constants.java ! src/share/classes/com/sun/tools/javac/util/Convert.java + test/tools/javac/processing/model/util/elements/Foo.java + test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java From jonathan.gibbons at sun.com Thu Sep 24 01:49:47 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Thu, 24 Sep 2009 01:49:47 +0000 Subject: hg: jdk7/tl/langtools: 6410637: Make decision on deprecated methods in DefaultFileManager and BaseFileObject.; ... Message-ID: <20090924014949.1C3811285D@hg.openjdk.java.net> Changeset: 49359d0e6a9c Author: jjg Date: 2009-09-23 18:48 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/49359d0e6a9c 6410637: Make decision on deprecated methods in DefaultFileManager and BaseFileObject. 6747645: ZipFileObject.getName is incorrectly deprecated 6885123: JavaFileObject getName issues Reviewed-by: mcimadamore ! src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java ! src/share/classes/com/sun/tools/javac/file/BaseFileObject.java ! src/share/classes/com/sun/tools/javac/file/JavacFileManager.java - src/share/classes/com/sun/tools/javac/file/Old199.java ! src/share/classes/com/sun/tools/javac/file/RegularFileObject.java ! src/share/classes/com/sun/tools/javac/file/SymbolArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.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/util/AbstractDiagnosticFormatter.java ! src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java ! src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java ! src/share/classes/com/sun/tools/javac/util/Log.java ! src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java ! src/share/classes/com/sun/tools/javadoc/SourcePositionImpl.java ! src/share/classes/javax/tools/SimpleJavaFileObject.java + test/tools/javac/4241573/T4241573.java ! test/tools/javac/6589361/T6589361.java ! test/tools/javac/Diagnostics/6769027/T6769027.java ! test/tools/javac/T6705935.java ! test/tools/javac/api/6411310/T6411310.java + test/tools/javac/api/6411310/Test.java ! test/tools/javac/api/6733837/T6733837.java From jonathan.gibbons at sun.com Thu Sep 24 02:16:34 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Thu, 24 Sep 2009 02:16:34 +0000 Subject: hg: jdk7/tl/langtools: 6572945: javah should be written as an annotation processor, not a doclet Message-ID: <20090924021636.53D0D12862@hg.openjdk.java.net> Changeset: c287d51c57da Author: jjg Date: 2009-09-23 19:15 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/c287d51c57da 6572945: javah should be written as an annotation processor, not a doclet Reviewed-by: darcy ! make/build.xml ! src/share/classes/com/sun/tools/javah/Gen.java + src/share/classes/com/sun/tools/javah/InternalError.java ! src/share/classes/com/sun/tools/javah/JNI.java + src/share/classes/com/sun/tools/javah/JavahFileManager.java + src/share/classes/com/sun/tools/javah/JavahTask.java + src/share/classes/com/sun/tools/javah/JavahTool.java ! src/share/classes/com/sun/tools/javah/LLNI.java ! src/share/classes/com/sun/tools/javah/Main.java - src/share/classes/com/sun/tools/javah/MainDoclet.java ! src/share/classes/com/sun/tools/javah/Mangle.java + src/share/classes/com/sun/tools/javah/NativeHeaderTool.java ! src/share/classes/com/sun/tools/javah/TypeSignature.java ! src/share/classes/com/sun/tools/javah/Util.java - src/share/classes/com/sun/tools/javah/resources/Linux_ppc.properties - src/share/classes/com/sun/tools/javah/resources/Linux_sparc.properties - src/share/classes/com/sun/tools/javah/resources/SunOS_sparc.properties - src/share/classes/com/sun/tools/javah/resources/SunOS_sparcv9.properties ! src/share/classes/com/sun/tools/javah/resources/l10n.properties - src/share/classes/com/sun/tools/javah/resources/win32_x86.properties ! src/share/classes/com/sun/tools/javap/DisassemblerTool.java + test/tools/javah/6572945/T6572945.java + test/tools/javah/6572945/TestClass1.java + test/tools/javah/6572945/TestClass2.java + test/tools/javah/6572945/TestClass3.java + test/tools/javah/6572945/gold/jni.dir.1/TestClass1.h + test/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner1.h + test/tools/javah/6572945/gold/jni.dir.1/TestClass1_Inner2.h + test/tools/javah/6572945/gold/jni.dir.1/TestClass2.h + test/tools/javah/6572945/gold/jni.file.1 + test/tools/javah/6572945/gold/jni.file.2 + test/tools/javah/6572945/gold/jni.file.3 ! test/tools/javah/MissingParamClassTest.sh + test/tools/javah/compareTest/CompareTest.java + test/tools/javah/compareTest/CompareTest.sh + test/tools/javah/compareTest/FindNativeFiles.java + test/tools/javah/compareTest/README From weijun.wang at sun.com Thu Sep 24 13:38:25 2009 From: weijun.wang at sun.com (weijun.wang at sun.com) Date: Thu, 24 Sep 2009 13:38:25 +0000 Subject: hg: jdk7/tl/jdk: 6885166: regression test for 6877357 (IPv6 address does not work) error (timed out) Message-ID: <20090924133901.793EC12878@hg.openjdk.java.net> Changeset: bd928aefe692 Author: weijun Date: 2009-09-24 21:35 +0800 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bd928aefe692 6885166: regression test for 6877357 (IPv6 address does not work) error (timed out) Reviewed-by: xuelei ! test/sun/security/krb5/IPv6.java From Bradford.Wetmore at Sun.COM Thu Sep 24 15:42:20 2009 From: Bradford.Wetmore at Sun.COM (Brad Wetmore) Date: Thu, 24 Sep 2009 08:42:20 -0700 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> <4ABA3283.4090209@redhat.com> <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> Message-ID: <4ABB935C.9090804@sun.com> > Oh, I agree. I just thought I'd use the opportunity to point out to > everyone that a) there is some documentation of this and, more > importantly, b) it needs updating. Kelly's been following this thread, but I haven't seen the note about the webrev here. His latest webrev (posted to guide-discuss) removes the JSN references, don't know if it has addressed your other points: http://mail.openjdk.java.net/pipermail/guide-discuss/2009-September/000046.html Also, the JSN gate still exists, but is flagged with "NO LONGER IN USE" on hg.openjdk.java.net. Brad Andrew John Hughes wrote: > 2009/9/23 Andrew Haley : >> Andrew John Hughes wrote: >>> 2009/9/23 Andrew Haley : >>>> Christopher Hegarty -Sun Microsystems Ireland wrote: >>>>> [cc'ing net-dev] >>>>> >>>>> I see you have push access, so if you make the appropriate changes >>>>> (mentioned above) I can review the webrev and you can use the above bug >>>>> number and description to push the changeset. >>>> Please make sure you tell Pavel which forest to push to. It's sometimes >>>> hard for us outside Sun to know. >>> http://openjdk.java.net/guide/repositories.html >> Yeah, I know. It's still a good idea for the approver to tell newbie >> contributors which forest to push to. >> >> Andrew. >> > > Oh, I agree. I just thought I'd use the opportunity to point out to > everyone that a) there is some documentation of this and, more > importantly, b) it needs updating. From Kelly.Ohair at Sun.COM Thu Sep 24 15:58:18 2009 From: Kelly.Ohair at Sun.COM (Kelly O'Hair) Date: Thu, 24 Sep 2009 08:58:18 -0700 Subject: Patch for JTreg test java/net/MulticastSocket/SetOutgoingIf.java In-Reply-To: <4ABB935C.9090804@sun.com> References: <4AB9F725.5000704@redhat.com> <4AB9FFFD.2050303@sun.com> <4ABA1276.6090506@sun.com> <4ABA20BD.4030305@redhat.com> <17c6771e0909230635s155080c6id7a02de2ba8bde12@mail.gmail.com> <4ABA3283.4090209@redhat.com> <17c6771e0909230746j6767fbe3i787aa31ac4a076de@mail.gmail.com> <4ABB935C.9090804@sun.com> Message-ID: <4ABB971A.20909@sun.com> Andrew, Let me know if you have any suggestions on changes to the developers guide, especially the repositories.html page. I don't want to do massive edits to it, but I certainly can make misc. smaller changes, corrections and additions. -kto From joe.darcy at sun.com Thu Sep 24 22:59:21 2009 From: joe.darcy at sun.com (joe.darcy at sun.com) Date: Thu, 24 Sep 2009 22:59:21 +0000 Subject: hg: jdk7/tl/langtools: 6337964: should ignore last comma in annotation array Message-ID: <20090924225924.367B1128BB@hg.openjdk.java.net> Changeset: d0f541480556 Author: darcy Date: 2009-09-24 16:00 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/d0f541480556 6337964: should ignore last comma in annotation array Reviewed-by: jjg ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java + test/tools/javac/annotations/pos/TrailingComma.java From tim.bell at sun.com Sat Sep 26 17:02:51 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:02:51 +0000 Subject: hg: jdk7/tl: 5 new changesets Message-ID: <20090926170251.6D485129C0@hg.openjdk.java.net> Changeset: e76b72562a98 Author: ohair Date: 2009-09-03 17:44 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/e76b72562a98 6855174: Improve log output when builds transition from one workspace to another Reviewed-by: jjg ! make/Defs-internal.gmk ! make/corba-rules.gmk ! make/deploy-rules.gmk ! make/hotspot-rules.gmk ! make/install-rules.gmk ! make/jaxp-rules.gmk ! make/jaxws-rules.gmk ! make/jdk-rules.gmk ! make/langtools-rules.gmk ! make/sponsors-rules.gmk Changeset: 931f7f7501da Author: ohair Date: 2009-09-17 13:17 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/931f7f7501da Merge Changeset: 76f6380ac0b4 Author: xdono Date: 2009-09-18 09:39 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/76f6380ac0b4 Merge Changeset: d70b157f6407 Author: xdono Date: 2009-09-22 14:06 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/rev/d70b157f6407 6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair ! make/corba-rules.gmk ! make/hotspot-rules.gmk ! make/install-rules.gmk ! make/jaxp-rules.gmk ! make/jaxws-rules.gmk ! make/langtools-rules.gmk ! make/sponsors-rules.gmk Changeset: 3ac6dcf78232 Author: robilad Date: 2009-09-23 20:06 +0200 URL: http://hg.openjdk.java.net/jdk7/tl/rev/3ac6dcf78232 6872735: Further update build readme for new platforms 6641691: Bring build readme's up-to-date Summary: Added build instructions for Debian, Ubuntu 8.04, 8.10, 9.04, Fedora 10, 11, OpenSolaris 2009.06, OpenSUSE and Mandriva Reviewed-by: ohair, andrew ! README-builds.html From tim.bell at sun.com Sat Sep 26 17:03:27 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:03:27 +0000 Subject: hg: jdk7/tl/corba: 6 new changesets Message-ID: <20090926170332.B0A93129C5@hg.openjdk.java.net> Changeset: 1c130e7b7a2e Author: ohair Date: 2009-09-02 09:20 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/1c130e7b7a2e 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building) Reviewed-by: jjg, iris ! make/Makefile ! make/common/BuildToolJar.gmk ! make/common/CancelImplicits.gmk ! make/common/Defs.gmk ! make/common/Rules.gmk ! make/common/shared/Compiler-msvc.gmk ! make/common/shared/Defs-utils.gmk ! make/common/shared/Defs-windows.gmk ! make/common/shared/Defs.gmk ! make/common/shared/Platform.gmk ! make/jprt.properties Changeset: 085333867e39 Author: xdono Date: 2009-09-14 10:57 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/085333867e39 Merge Changeset: 546970b224ca Author: xdono Date: 2009-09-18 09:39 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/546970b224ca Merge Changeset: 31ce3cac3cc1 Author: ohair Date: 2009-09-18 16:26 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/31ce3cac3cc1 6883790: corba build problem related to wildcard and vpath, regression Reviewed-by: tbell ! make/common/Rules.gmk Changeset: 2aa5665d86a5 Author: ohair Date: 2009-09-18 17:10 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/2aa5665d86a5 6883816: corba fix for missing javax/transaction/xa classes (the real fix) Reviewed-by: tbell ! make/common/Rules.gmk Changeset: b751c528c555 Author: xdono Date: 2009-09-22 14:06 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/corba/rev/b751c528c555 6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair ! make/common/CancelImplicits.gmk From tim.bell at sun.com Sat Sep 26 17:04:11 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:04:11 +0000 Subject: hg: jdk7/tl/hotspot: 6884624: Update copyright year Message-ID: <20090926170417.C8DE0129CA@hg.openjdk.java.net> Changeset: 89e0543e1737 Author: xdono Date: 2009-09-22 14:06 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/hotspot/rev/89e0543e1737 6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair ! agent/make/saenv.sh ! agent/make/saenv64.sh ! agent/src/os/solaris/proc/Makefile ! agent/src/os/solaris/proc/mapfile ! agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java ! agent/src/share/classes/sun/jvm/hotspot/memory/FreeChunk.java ! src/cpu/x86/vm/c1_LIRGenerator_x86.cpp ! src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp ! src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp ! src/share/vm/c1/c1_IR.cpp ! src/share/vm/c1/c1_IR.hpp ! src/share/vm/c1/c1_LIRAssembler.cpp ! src/share/vm/ci/ciObjectFactory.cpp ! src/share/vm/classfile/classLoader.hpp ! src/share/vm/code/debugInfoRec.hpp ! src/share/vm/code/nmethod.hpp ! src/share/vm/compiler/oopMap.cpp ! src/share/vm/compiler/oopMap.hpp ! src/share/vm/gc_implementation/g1/concurrentZFThread.cpp ! src/share/vm/gc_implementation/g1/g1MMUTracker.cpp ! 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/shared/markSweep.cpp ! src/share/vm/gc_implementation/shared/markSweep.hpp ! src/share/vm/memory/genMarkSweep.cpp ! src/share/vm/memory/iterator.cpp ! src/share/vm/memory/iterator.hpp ! src/share/vm/memory/serialize.cpp ! src/share/vm/oops/arrayKlass.cpp ! src/share/vm/oops/instanceKlassKlass.hpp ! src/share/vm/oops/instanceRefKlass.cpp ! src/share/vm/oops/methodDataOop.hpp ! src/share/vm/oops/objArrayOop.hpp ! src/share/vm/opto/compile.hpp ! src/share/vm/opto/idealKit.cpp ! src/share/vm/opto/idealKit.hpp ! src/share/vm/opto/ifnode.cpp ! src/share/vm/opto/phaseX.cpp ! src/share/vm/opto/phaseX.hpp ! src/share/vm/opto/postaloc.cpp ! src/share/vm/prims/jvm.h ! src/share/vm/runtime/atomic.hpp ! src/share/vm/runtime/perfData.hpp ! src/share/vm/runtime/sweeper.cpp ! src/share/vm/runtime/vframeArray.hpp ! src/share/vm/runtime/vframe_hp.hpp ! src/share/vm/services/threadService.cpp ! src/share/vm/services/threadService.hpp From tim.bell at sun.com Sat Sep 26 17:04:59 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:04:59 +0000 Subject: hg: jdk7/tl/jaxp: 3 new changesets Message-ID: <20090926170504.82C27129CF@hg.openjdk.java.net> Changeset: 534e23823a1b Author: ohair Date: 2009-09-21 13:54 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxp/rev/534e23823a1b 6856630: Restructure jaxp/jaxws repositories Reviewed-by: darcy, tbell ! .hgignore ! README + build-defs.xml + build-drop-template.xml + build.properties + build.xml + jaxp.properties ! make/Makefile - make/build.properties - make/build.xml ! make/jprt.properties - make/tools/StripProperties/StripProperties.java - make/tools/StripProperties/StripPropertiesTask.java + nbproject/findbugs.settings + nbproject/project.xml + nbproject/sqe.properties + patches/jaxp_src/README Changeset: 0748962aa825 Author: ohair Date: 2009-09-21 17:21 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxp/rev/0748962aa825 6884220: Have drop sources ignore the output.dir property Reviewed-by: xdono ! build.properties Changeset: ee9c7578aca5 Author: xdono Date: 2009-09-22 14:06 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxp/rev/ee9c7578aca5 6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair ! src/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java From tim.bell at sun.com Sat Sep 26 17:05:41 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:05:41 +0000 Subject: hg: jdk7/tl/jaxws: 2 new changesets Message-ID: <20090926170544.D63A2129D4@hg.openjdk.java.net> Changeset: ae2bec597586 Author: ohair Date: 2009-09-21 13:57 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxws/rev/ae2bec597586 6856630: Restructure jaxp/jaxws repositories Reviewed-by: darcy, tbell ! .hgignore ! README + build-defs.xml + build-drop-template.xml + build.properties + build.xml + jaxws.properties ! make/Makefile - make/build.properties - make/build.xml ! make/jprt.properties - make/tools/StripProperties/StripProperties.java - make/tools/StripProperties/StripPropertiesTask.java + nbproject/findbugs.settings + nbproject/project.xml + nbproject/sqe.properties + patches/jaxws_src/README Changeset: 77708e68db52 Author: ohair Date: 2009-09-21 17:21 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/jaxws/rev/77708e68db52 6884220: Have drop sources ignore the output.dir property Reviewed-by: xdono ! build.properties From tim.bell at sun.com Sat Sep 26 17:07:21 2009 From: tim.bell at sun.com (tim.bell at sun.com) Date: Sat, 26 Sep 2009 17:07:21 +0000 Subject: hg: jdk7/tl/langtools: 3 new changesets Message-ID: <20090926170729.882AB129DB@hg.openjdk.java.net> Changeset: 14735c7932d7 Author: xdono Date: 2009-09-22 14:06 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/14735c7932d7 6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair ! src/share/classes/com/sun/tools/javac/code/Type.java ! src/share/classes/com/sun/tools/javac/file/BaseFileObject.java ! src/share/classes/com/sun/tools/javac/file/JavacFileManager.java ! src/share/classes/com/sun/tools/javac/file/RegularFileObject.java ! src/share/classes/com/sun/tools/javac/file/SymbolArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java ! src/share/classes/com/sun/tools/javac/jvm/ClassReader.java ! src/share/classes/com/sun/tools/javap/JavapTask.java ! test/com/sun/javadoc/lib/JavadocTester.java ! test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java ! test/com/sun/javadoc/testCRLineSeparator/pkg/MyClass.java ! test/com/sun/javadoc/testNoPackagesFile/TestNoPackagesFile.java ! test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java ! test/com/sun/javadoc/testTaglets/TestTaglets.java ! test/tools/apt/Basics/apt.sh ! test/tools/apt/Basics/print.sh ! test/tools/apt/Compile/compile.sh ! test/tools/javac/4846262/Test.sh ! test/tools/javac/6302184/T6302184.sh ! test/tools/javac/6627362/T6627362.java ! test/tools/javac/ClassPathTest/ClassPathTest.sh ! test/tools/javac/ExtDirs/ExtDirs.sh ! test/tools/javac/MissingInclude.sh ! test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh ! test/tools/javac/T5090006/compiler.sh ! test/tools/javac/api/6440333/T6440333.java ! test/tools/javac/api/Sibling.java ! test/tools/javac/code/ArrayClone.java ! test/tools/javac/constDebug/ConstDebug.sh ! test/tools/javac/fatalErrors/NoJavaLang.sh ! test/tools/javac/generics/inference/6302954/T6476073.java ! test/tools/javac/innerClassFile/Driver.sh ! test/tools/javac/javazip/Test.sh ! test/tools/javac/meth/MakeNegTests.sh ! test/tools/javac/newlines/Newlines.sh ! test/tools/javac/quid/MakeNegTests.sh ! test/tools/javac/quid/QuotedIdent.java ! test/tools/javac/quid/QuotedIdent2.java ! test/tools/javac/stackmap/T4955930.sh ! test/tools/javac/unicode/SupplementaryJavaID6.sh ! test/tools/javah/6257087/foo.sh ! test/tools/javah/ConstMacroTest.sh ! test/tools/javah/MissingParamClassTest.sh ! test/tools/javah/ReadOldClass.sh ! test/tools/javap/T4975569.java ! test/tools/javap/pathsep.sh ! test/tools/javap/stackmap/T6271292.sh Changeset: 9596dff46093 Author: tbell Date: 2009-09-25 14:24 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/9596dff46093 Merge Changeset: 4776a869fdfa Author: tbell Date: 2009-09-25 22:04 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/4776a869fdfa Merge ! src/share/classes/com/sun/tools/javac/file/BaseFileObject.java ! src/share/classes/com/sun/tools/javac/file/JavacFileManager.java - src/share/classes/com/sun/tools/javac/file/Old199.java ! src/share/classes/com/sun/tools/javac/file/RegularFileObject.java ! src/share/classes/com/sun/tools/javac/file/SymbolArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipArchive.java ! src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java ! src/share/classes/com/sun/tools/javac/jvm/ClassReader.java - src/share/classes/com/sun/tools/javah/MainDoclet.java - src/share/classes/com/sun/tools/javah/resources/Linux_ppc.properties - src/share/classes/com/sun/tools/javah/resources/Linux_sparc.properties - src/share/classes/com/sun/tools/javah/resources/SunOS_sparc.properties - src/share/classes/com/sun/tools/javah/resources/SunOS_sparcv9.properties - src/share/classes/com/sun/tools/javah/resources/win32_x86.properties ! test/tools/javah/MissingParamClassTest.sh From quintin at last.za.net Sat Sep 26 19:51:51 2009 From: quintin at last.za.net (Quintin Beukes) Date: Sat, 26 Sep 2009 21:51:51 +0200 Subject: Separate Class/Method level Generics Interpretations Message-ID: <1f3854d50909261251q45f3c5a8xb4cea88e574bc867@mail.gmail.com> Hey, When you have parameterized methods in a parameterized class, and you don't use the parameters of the class, then the parameters of all it's methods are also ignored, even when not related. Is there any specific reason why it was done like this? If not, I would like to implement it, as I don't see why you have to loose the method's generic ability when you don't use that of the class. Take for instance, this example: class AnnotatedMethod { public M annotatedMethod(M obj) { return obj; } } class AnnotatedClass { public M annotatedMethod(M obj) { return obj; } } public class AnnotationDemo { public static void main(String[] args) throws Exception { AnnotatedMethod method = new AnnotatedMethod(); String s1 = method.annotatedMethod("string"); AnnotatedClass clazzWorking = new AnnotatedClass(); String s2 = clazzWorking.annotatedMethod("string"); AnnotatedClass clazzNotWorking = new AnnotatedClass(); String s3 = clazzNotWorking.annotatedMethod("string"); } } Quintin Beukes From neal at gafter.com Sat Sep 26 20:34:52 2009 From: neal at gafter.com (Neal Gafter) Date: Sat, 26 Sep 2009 13:34:52 -0700 Subject: Separate Class/Method level Generics Interpretations In-Reply-To: <1f3854d50909261251q45f3c5a8xb4cea88e574bc867@mail.gmail.com> References: <1f3854d50909261251q45f3c5a8xb4cea88e574bc867@mail.gmail.com> Message-ID: <15e8b9d20909261334o6292141fnac44af19397a6ec4@mail.gmail.com> Quentin- By definition, the members of a RAW type (a generic type without type parameters) are the ERASED members of the class. This is not affected by whether or not the signature of the member uses the type parameters of the class. Making it behave as you seem to expect would significantly complicate the type system. If you don't want the erasing to happen, then use the wildcard version of the generic class. Generally speaking, you shouldn't expect generics to "work" in the presence of raw types. It is better not to mix raw and generic code. Cheers, Neal On Sat, Sep 26, 2009 at 12:51 PM, Quintin Beukes wrote: > Hey, > > When you have parameterized methods in a parameterized class, and you > don't use the parameters of the class, then the parameters of all it's > methods are also ignored, even when not related. Is there any specific > reason why it was done like this? If not, I would like to implement > it, as I don't see why you have to loose the method's generic ability > when you don't use that of the class. > > Take for instance, this example: > class AnnotatedMethod > { > public M annotatedMethod(M obj) > { > return obj; > } > } > > class AnnotatedClass > { > public M annotatedMethod(M obj) > { > return obj; > } > } > > public class AnnotationDemo > { > public static void main(String[] args) throws Exception > { > AnnotatedMethod method = new AnnotatedMethod(); > String s1 = method.annotatedMethod("string"); > > AnnotatedClass clazzWorking = new AnnotatedClass(); > String s2 = clazzWorking.annotatedMethod("string"); > > AnnotatedClass clazzNotWorking = new AnnotatedClass(); > String s3 = clazzNotWorking.annotatedMethod("string"); > } > } > > Quintin Beukes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at sun.com Mon Sep 28 23:50:50 2009 From: jonathan.gibbons at sun.com (jonathan.gibbons at sun.com) Date: Mon, 28 Sep 2009 23:50:50 +0000 Subject: hg: jdk7/tl/langtools: 6886348: apt incorrectly uses Scope.table Message-ID: <20090928235055.B343712A1B@hg.openjdk.java.net> Changeset: c6d0c55b1aba Author: jjg Date: 2009-09-28 16:48 -0700 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/c6d0c55b1aba 6886348: apt incorrectly uses Scope.table Reviewed-by: darcy ! src/share/classes/com/sun/tools/apt/comp/Apt.java From ptisnovs at redhat.com Wed Sep 30 09:49:39 2009 From: ptisnovs at redhat.com (ptisnovs at redhat.com) Date: Wed, 30 Sep 2009 09:49:39 +0000 Subject: hg: jdk7/tl/jdk: 6884837: JTReg test SetOutgoingIf is not correct Message-ID: <20090930094959.2F52441574@hg.openjdk.java.net> Changeset: 5b1aaf2d7504 Author: ptisnovs Date: 2009-09-30 11:49 +0200 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/5b1aaf2d7504 6884837: JTReg test SetOutgoingIf is not correct Summary: Added check of network interfaces status Reviewed-by: alanb, chegar ! test/java/net/MulticastSocket/SetOutgoingIf.java