Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Claes Redestad
Hi Stuart et al, I've gone through the feedback (thanks, everyone!) and made the following adjustments which I hope covers most, if not all, concerns: - Per John's suggestion I've moved most of the methods in List12/ListN to AbstractImmutableList, using for-loops rather than iterators etc. I'

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Andrej Golovnin
Hi Claes, > http://cr.openjdk.java.net/~redestad/8193128/open.05/ src/java.base/share/classes/java/util/ImmutableCollections.java 599 public boolean contains(Object o) { 600 Objects.requireNonNull(o); 601 return size > 0 && probe(o) >= 0; // implicit nullcheck

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Claes Redestad
Hi Andrej, thanks for catching this. Webrev updated in-place. Regards /Claes On 2018-01-08 14:25, Andrej Golovnin wrote: Hi Claes, http://cr.openjdk.java.net/~redestad/8193128/open.05/ src/java.base/share/classes/java/util/ImmutableCollections.java 599 public boolean contains(Obj

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
Hi Claes, Are you sure that AbstractImmutableSet.equals(Object) is correct?     @Override     public boolean equals(Object o) {     if (o == this)     return true;     if (!(o instanceof Set))     return false;     Collection c = (Collecti

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
Also, I don't think that ClassCastException should be caught here. It should never be thrown by containsAll(c) anyway. On 01/08/18 20:09, Peter Levart wrote: Hi Claes, Are you sure that AbstractImmutableSet.equals(Object) is correct?     @Override     public boolean equals(Object o) {

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
On 01/08/18 20:09, Peter Levart wrote: Should the method also check that the size(s) of both sets are the same? Or better yet, compute the size of the other set as you iterate the elements. Like this:     public boolean equals(Object o) {     if (o == this)     ret

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
On 01/08/18 20:46, Peter Levart wrote: Or better yet, compute the size of the other set as you iterate the elements. Like this:     public boolean equals(Object o) {     if (o == this)     return true;     if (!(o instanceof Set))     return fals

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Claes Redestad
Gosh! My intent was to carry over AbstractSet::equals verbatim, so I have no idea how the size check got lost in translation and passed through testing! Appears to be another hole in the test coverage, or I didn't run the right ones. As to calculating o.size() as we go then I'm not sure: most S

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
Hi Claes, On 01/08/18 21:57, Claes Redestad wrote: Gosh! My intent was to carry over AbstractSet::equals verbatim, so I have no idea how the size check got lost in translation and passed through testing! Appears to be another hole in the test coverage, or I didn't run the right ones. As to ca

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Peter Levart
Hi Claes, On 01/08/18 23:41, Peter Levart wrote: Hi Claes, On 01/08/18 21:57, Claes Redestad wrote: Gosh! My intent was to carry over AbstractSet::equals verbatim, so I have no idea how the size check got lost in translation and passed through testing! Appears to be another hole in the test

RFR: jsr166 jdk integration 2018-01

2018-01-08 Thread Martin Buchholz
http://cr.openjdk.java.net/~martin/webrevs/jdk/jsr166-integration/overview.html 8191483: AbstractQueuedSynchronizer cancel/cancel race http://cr.openjdk.java.net/~martin/webrevs/jdk/jsr166-integration/AQS-cancel-cancel-race/index.html https://bugs.openjdk.java.net/browse/JDK-8191483 Lots of minor

Re: [11] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

2018-01-08 Thread Claes Redestad
Hi, On 2018-01-09 00:04, Peter Levart wrote: Hi Claes, On 01/08/18 23:41, Peter Levart wrote: Hi Claes, On 01/08/18 21:57, Claes Redestad wrote: CCE is specified to be thrown by Set::contains/containsAll, so I think we should play it safe and leave it unchanged. It's probably specified s

Re: JDK-8145371 ClassCastException thrown in LambdaFormEditor.getInCache

2018-01-08 Thread Martin Buchholz
No takers? ... let's try again. Despite uniform failure to reproduce this except under a debugger, let's apply the simple obviously correct fix, namely: /** Craft a LambdaForm customized for this particular MethodHandle */ /*non-public*/ void customize() { +final LambdaForm

Re: JDK-8145371 ClassCastException thrown in LambdaFormEditor.getInCache

2018-01-08 Thread John Rose
That looks good to me. Vladimir Ivanov should take a look. Christmas vacation is just ending in Russia, so he should be around soon. On Jan 8, 2018, at 6:41 PM, Martin Buchholz wrote: > > No takers? ... let's try again. Despite uniform failure to reproduce this > except under a debugger, let'

Re: JDK-8145371 ClassCastException thrown in LambdaFormEditor.getInCache

2018-01-08 Thread Paul Sandoz
Hi Martin [Back from holiday] Can you reproduce using the debugger? If so do you have a more up to date stack trace? That change looks ok. The form field is final, and in the j.l.invoke package such fields are also stable so once C2 gets at it it will likely treat it as a constant. In general

Re: JDK-8145371 ClassCastException thrown in LambdaFormEditor.getInCache

2018-01-08 Thread Martin Buchholz
In the hotspot sources I find // An instance field can be constant if it's a final static field or if // it's a final non-static field of a trusted class (classes in // java.lang.invoke and sun.invoke packages and subpackages). BUT you can't trust MethodHandle.form! Yes, it's