Error in Javadoc for DatabaseMetaData

2013-06-30 Thread Nick Williams
In java.sql.DatabaseMetaData, the Javadoc for supportsResultSetHoldability 
fails to properly close a code tag, and so everything following that method 
is monospace. To be precise:

codeResultSet.CLOSE_CURSORS_AT_COMMITcode

However, it should be:

codeResultSet.CLOSE_CURSORS_AT_COMMIT/code

Nick



hg: jdk8/tl/jdk: 8019466: Fix doclint issues in java.util.function

2013-06-30 Thread joe . darcy
Changeset: bf650fee4983
Author:darcy
Date:  2013-06-30 16:02 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/bf650fee4983

8019466: Fix doclint issues in java.util.function
Reviewed-by: briangoetz

! src/share/classes/java/util/function/BinaryOperator.java
! src/share/classes/java/util/function/Function.java
! src/share/classes/java/util/function/UnaryOperator.java



Code update for 8014319: Faster division of large integers

2013-06-30 Thread Tim Buktu
Hi,

I made a few changes to the BigInteger code in my GitHub repo:
 * Moved Burnikel-Ziegler division to MutableBigInteger
 * Added more comments to the Burnikel-Ziegler code
 * Updated Barrett thresholds
 * Merged BigInteger.java and BigIntegerTest.java with the latest from hg

The files at the links below contain the latest code for bugs 8014319
and 8014320.
Brian, if you want me to, I can make an updated patch for just 8014319.

https://raw.github.com/tbuktu/bigint/4c24162e99227e177f17f5db9b8ca2757820d2cd/src/main/java/java/math/BigInteger.java
https://raw.github.com/tbuktu/bigint/95f1158d2205614c8739344df07ee35523b8ad89/src/main/java/java/math/MutableBigInteger.java
https://raw.github.com/tbuktu/bigint/95f1158d2205614c8739344df07ee35523b8ad89/src/main/java/java/math/MutableBigInteger.java

Is 8014319 going to be next up for review?
Also, would it be okay to do a s/Reminder/Remainder/g on
MutableBigInteger.java and include it in 8014319?
Thanks,

Tim


JDK 8 code review request for doclint fixes in java.util.jar.Pack200

2013-06-30 Thread Joe Darcy

Hello,

Pack200 has some doclint issues; please review the fixes to them below.

Thanks,

-Joe

--- a/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:02:11 2013 -0700
+++ b/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:19:25 2013 -0700

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights 
reserved.

  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 // Static methods of the Pack200 class.
 /**
  * Obtain new instance of a class that implements Packer.
- *
+ * ul
  * lipIf the system property ttjava.util.jar.Pack200.Packer/tt
  * is defined, then the value is taken to be the fully-qualified name
  * of a concrete implementation class, which must implement Packer.
@@ -122,6 +122,7 @@
  * lipIf an implementation has not been specified with the system
  * property, then the system-default implementation class is 
instantiated,

  * and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -137,7 +138,7 @@

 /**
  * Obtain new instance of a class that implements Unpacker.
- *
+ * ul
  * lipIf the system property 
ttjava.util.jar.Pack200.Unpacker/tt

  * is defined, then the value is taken to be the fully-qualified
  * name of a concrete implementation class, which must implement 
Unpacker.

@@ -147,6 +148,7 @@
  * lipIf an implementation has not been specified with the
  * system property, then the system-default implementation class
  * is instantiated, and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -350,14 +352,14 @@
  * directory will be passed also.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = packer.properties();
  * p.put(PASS_FILE_PFX+0, mutants/Rogue.class);
  * p.put(PASS_FILE_PFX+1, mutants/Wolverine.class);
  * p.put(PASS_FILE_PFX+2, mutants/Storm.class);
  * # Pass all files in an entire directory hierarchy:
  * p.put(PASS_FILE_PFX+3, police/);
- * /pre/code.
+ * }/pre
  */
 String PASS_FILE_PFX= pack.pass.file.;

@@ -378,12 +380,12 @@
  * This is the default value for this property.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = pack200.getProperties();
  * p.put(UNKNOWN_ATTRIBUTE, ERROR);
  * p.put(UNKNOWN_ATTRIBUTE, STRIP);
  * p.put(UNKNOWN_ATTRIBUTE, PASS);
- * /pre/code
+ * }/pre
  */
 String UNKNOWN_ATTRIBUTE= pack.unknown.attribute;



Re: JDK 8 code review request for doclint fixes in java.util.jar.Pack200

2013-06-30 Thread Lance Andersen - Oracle
looks good Joe
On Jun 30, 2013, at 7:20 PM, Joe Darcy wrote:

 Hello,
 
 Pack200 has some doclint issues; please review the fixes to them below.
 
 Thanks,
 
 -Joe
 
 --- a/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 16:02:11 
 2013 -0700
 +++ b/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 16:19:25 
 2013 -0700
 @@ -1,5 +1,5 @@
 /*
 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights 
 reserved.
 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights 
 reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
 @@ -112,7 +112,7 @@
 // Static methods of the Pack200 class.
 /**
  * Obtain new instance of a class that implements Packer.
 - *
 + * ul
  * lipIf the system property ttjava.util.jar.Pack200.Packer/tt
  * is defined, then the value is taken to be the fully-qualified name
  * of a concrete implementation class, which must implement Packer.
 @@ -122,6 +122,7 @@
  * lipIf an implementation has not been specified with the system
  * property, then the system-default implementation class is instantiated,
  * and the result is returned./p/li
 + * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
 @@ -137,7 +138,7 @@
 
 /**
  * Obtain new instance of a class that implements Unpacker.
 - *
 + * ul
  * lipIf the system property ttjava.util.jar.Pack200.Unpacker/tt
  * is defined, then the value is taken to be the fully-qualified
  * name of a concrete implementation class, which must implement Unpacker.
 @@ -147,6 +148,7 @@
  * lipIf an implementation has not been specified with the
  * system property, then the system-default implementation class
  * is instantiated, and the result is returned./p/li
 + * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
 @@ -350,14 +352,14 @@
  * directory will be passed also.
  * p
  * Examples:
 - * precode
 + * pre{@code
  * Map p = packer.properties();
  * p.put(PASS_FILE_PFX+0, mutants/Rogue.class);
  * p.put(PASS_FILE_PFX+1, mutants/Wolverine.class);
  * p.put(PASS_FILE_PFX+2, mutants/Storm.class);
  * # Pass all files in an entire directory hierarchy:
  * p.put(PASS_FILE_PFX+3, police/);
 - * /pre/code.
 + * }/pre
  */
 String PASS_FILE_PFX= pack.pass.file.;
 
 @@ -378,12 +380,12 @@
  * This is the default value for this property.
  * p
  * Examples:
 - * precode
 + * pre{@code
  * Map p = pack200.getProperties();
  * p.put(UNKNOWN_ATTRIBUTE, ERROR);
  * p.put(UNKNOWN_ATTRIBUTE, STRIP);
  * p.put(UNKNOWN_ATTRIBUTE, PASS);
 - * /pre/code
 + * }/pre
  */
 String UNKNOWN_ATTRIBUTE= pack.unknown.attribute;
 


Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
lance.ander...@oracle.com



Re: JDK 8 code review request for doclint fixes in java.util.jar.Pack200

2013-06-30 Thread Kumar Srinivasan

Hi Joe,

The changes looks good, thanks for doing this!. I should've peeked at
the generated reports. :-[

But, there are 2 more errors j.u.j.Attributes.java and some missing
@throws for j.u.j.JarEntry.java, are you planning on doing this separately ?

Thanks

Kumar



Hello,

Pack200 has some doclint issues; please review the fixes to them below.

Thanks,

-Joe

--- a/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:02:11 2013 -0700
+++ b/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:19:25 2013 -0700

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights 
reserved.

  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 // Static methods of the Pack200 class.
 /**
  * Obtain new instance of a class that implements Packer.
- *
+ * ul
  * lipIf the system property 
ttjava.util.jar.Pack200.Packer/tt
  * is defined, then the value is taken to be the fully-qualified 
name

  * of a concrete implementation class, which must implement Packer.
@@ -122,6 +122,7 @@
  * lipIf an implementation has not been specified with the 
system
  * property, then the system-default implementation class is 
instantiated,

  * and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -137,7 +138,7 @@

 /**
  * Obtain new instance of a class that implements Unpacker.
- *
+ * ul
  * lipIf the system property 
ttjava.util.jar.Pack200.Unpacker/tt

  * is defined, then the value is taken to be the fully-qualified
  * name of a concrete implementation class, which must implement 
Unpacker.

@@ -147,6 +148,7 @@
  * lipIf an implementation has not been specified with the
  * system property, then the system-default implementation class
  * is instantiated, and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -350,14 +352,14 @@
  * directory will be passed also.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = packer.properties();
  * p.put(PASS_FILE_PFX+0, mutants/Rogue.class);
  * p.put(PASS_FILE_PFX+1, mutants/Wolverine.class);
  * p.put(PASS_FILE_PFX+2, mutants/Storm.class);
  * # Pass all files in an entire directory hierarchy:
  * p.put(PASS_FILE_PFX+3, police/);
- * /pre/code.
+ * }/pre
  */
 String PASS_FILE_PFX= pack.pass.file.;

@@ -378,12 +380,12 @@
  * This is the default value for this property.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = pack200.getProperties();
  * p.put(UNKNOWN_ATTRIBUTE, ERROR);
  * p.put(UNKNOWN_ATTRIBUTE, STRIP);
  * p.put(UNKNOWN_ATTRIBUTE, PASS);
- * /pre/code
+ * }/pre
  */
 String UNKNOWN_ATTRIBUTE= pack.unknown.attribute;





Re: JDK 8 code review request for doclint fixes in java.util.jar.Pack200

2013-06-30 Thread Joe Darcy

Hi Kumar,

On 06/30/2013 04:45 PM, Kumar Srinivasan wrote:

Hi Joe,

The changes looks good, thanks for doing this!. I should've peeked at
the generated reports. :-[


The changes look fine according to specdiff too.



But, there are 2 more errors j.u.j.Attributes.java and some missing
@throws for j.u.j.JarEntry.java, are you planning on doing this 
separately ?


I am actually hoping for someone else to do them separately ;-)

At least one of the missing @throws should probably be addressed by 
removing the throws clause from the method, which requires some more 
investigation and a ccc request.


Thanks,

-Joe



Thanks

Kumar



Hello,

Pack200 has some doclint issues; please review the fixes to them below.

Thanks,

-Joe

--- a/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:02:11 2013 -0700
+++ b/src/share/classes/java/util/jar/Pack200.javaSun Jun 30 
16:19:25 2013 -0700

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All 
rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All 
rights reserved.

  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 // Static methods of the Pack200 class.
 /**
  * Obtain new instance of a class that implements Packer.
- *
+ * ul
  * lipIf the system property 
ttjava.util.jar.Pack200.Packer/tt
  * is defined, then the value is taken to be the fully-qualified 
name

  * of a concrete implementation class, which must implement Packer.
@@ -122,6 +122,7 @@
  * lipIf an implementation has not been specified with the 
system
  * property, then the system-default implementation class is 
instantiated,

  * and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -137,7 +138,7 @@

 /**
  * Obtain new instance of a class that implements Unpacker.
- *
+ * ul
  * lipIf the system property 
ttjava.util.jar.Pack200.Unpacker/tt

  * is defined, then the value is taken to be the fully-qualified
  * name of a concrete implementation class, which must implement 
Unpacker.

@@ -147,6 +148,7 @@
  * lipIf an implementation has not been specified with the
  * system property, then the system-default implementation class
  * is instantiated, and the result is returned./p/li
+ * /ul
  *
  * pNote:  The returned object is not guaranteed to operate
  * correctly if multiple threads use it at the same time.
@@ -350,14 +352,14 @@
  * directory will be passed also.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = packer.properties();
  * p.put(PASS_FILE_PFX+0, mutants/Rogue.class);
  * p.put(PASS_FILE_PFX+1, mutants/Wolverine.class);
  * p.put(PASS_FILE_PFX+2, mutants/Storm.class);
  * # Pass all files in an entire directory hierarchy:
  * p.put(PASS_FILE_PFX+3, police/);
- * /pre/code.
+ * }/pre
  */
 String PASS_FILE_PFX= pack.pass.file.;

@@ -378,12 +380,12 @@
  * This is the default value for this property.
  * p
  * Examples:
- * precode
+ * pre{@code
  * Map p = pack200.getProperties();
  * p.put(UNKNOWN_ATTRIBUTE, ERROR);
  * p.put(UNKNOWN_ATTRIBUTE, STRIP);
  * p.put(UNKNOWN_ATTRIBUTE, PASS);
- * /pre/code
+ * }/pre
  */
 String UNKNOWN_ATTRIBUTE= pack.unknown.attribute;








hg: jdk8/tl/jdk: 8019467: Fix doclint issues in java.util.jar.Pack200

2013-06-30 Thread joe . darcy
Changeset: 9eaeb1a0aa46
Author:darcy
Date:  2013-06-30 17:15 -0700
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/9eaeb1a0aa46

8019467: Fix doclint issues in java.util.jar.Pack200
Reviewed-by: lancea, ksrini

! src/share/classes/java/util/jar/Pack200.java



Re: RFR (XS): 8014890 : Reference queues may return more entries than expected

2013-06-30 Thread David Holmes

Hi Thomas,

Sorry for the delay in looking into this deeper but I've been OOTO a bit 
this past week.


I'm backing up to the start to explore the apparent problem ...

On 19/06/2013 7:08 AM, Thomas Schatzl wrote:

Hi all,

   can I have reviews for the following change?

It happens if multiple threads are enqueuing and dequeuing reference
objects into a reference queue, that Reference objects may be enqueued
at multiple times.

This is because when java.lang.ref.ReferenceQueue.poll() returns and
inactivates a Reference object, another thread may just be during
enqueuing it again.

In the test case provided, the two threads that conflict are the
reference handler thread and the program (main) thread.

Relevant code:

ReferenceHandlerThread.run():

0: [...]
1: ReferenceQueue q = r.queue; // r is the reference
2: if (r != ReferenceQueue.NULL)
3:   q.enqueue().

ReferenceQueue::poll()(reallyPoll()) code (I removed lots of code here)

1: synchronized(lock) {
2:   [...]
3:   r.queue = ReferenceQueue.NULL;
3:}

I.e. while ReferenceQueue.poll() sets the Reference's queue to the NULL
queue so that that reference will not be enqueued again (or at most into
the NULL queue which is a nop), it happens that if the task switch
occurs between lines 2 and 3 of the reference handler thread, q still
contains the old queue reference, and the reference handler thread will
enqueue the Reference into the original queue again.


Let's set some initial conditions here. For poll() to remove 'r' it must 
already have been enqueued on this queue. That means that r.queue == 
ENQUEUED. That means the ReferenceHandler thread would actually enqueue 
it to the ENQUEUED instance - which is harmless.


So it seems to me that we must have a race between two enqueue attempts 
for a problem to arise here. So lets assume that there is a concurrent 
r.enqueue() with the reference handlers attempt to enqueue, and a poll() 
is mixed in. Consider the following:


refThread reads target q:

  ReferenceQueue q = r.queue; // r is the reference
  if (r != ReferenceQueue.NULL)

(Note: the check for NULL is at best an optimization; it isn't needed)

Thread_1 does r.enqueue()

  So r.queue == ENQUEUED

Thread_2 does q.poll() and removes r.

  r.queue == NULL

refThread continues and executes:

  q.enqueue(r)

and so we have enqueued 'r' twice. Which seems to be the problem 
scenario observed by the test, as we can then poll() and get 'r' a 
second time.


But is it actually a problem if this happens? If I have two concurrent 
attempts to enqueue a reference and concurrent attempt to dequeue it 
(via poll) it seems quite plausible to see: enqueue, poll, enqueue - and 
so the reference ends up in the queue. The test program is of the form:


  for (int i = 0; i  iterations; i++) {
queue = new ReferenceQueueObject();

for (int j = 0; j  refs.length; j++) {
refs[j] = new WeakReference(new Object(), queue);
}

System.gc(); // enqueues references into the list of 
discovered references


// now manually enqueue all of them
for (int j = 0; j  refs.length; j++) {
refs[j].enqueue();
}
// and get them back. There should be exactly numReferences
// entries in the queue now.
int foundReferences = 0;
while (queue.poll() != null) {
foundReferences++;
}

and naively we would assume that until the enqueue loop is complete (at 
which point all refs are enqueued) then the ReferenceHandler thread will 
not process any of those references as they are still strongly 
reachable. If it processes them after then it is a no-op and either way 
the poll() will find the exact number of references enqueued.


But that is not guaranteed to happen. As JLS 12.6.1 states:

Optimizing transformations of a program can be designed that reduce the 
number of objects that are reachable to be less than those which would 
naively be considered reachable.


So in fact we might find that one or more references are no longer 
reachable before their enqueue() operation is invoked and so 
consequently we can indeed get this race between the reference handler's 
attempt to enqueue and the test programs attempt to enqueue. I would say 
this is a bug in the test program as it needs to ensure that the 
references are guaranteed to be strongly reachable until after they have 
had enqueue() invoked.


So your proposed fix really just masks the invalid assumption that a 
ReferenceHandler based enqueue and a direct r.enqueue can't possibly be 
concurrent.


Let's consider the case of two concurrent r.enqueue() calls, with an 
interleaving poll(). Because Reference.enqueue lacks synchronization on 
the reference while reading the queue you can get an interleaving where 
the second enqueue() might see NULL, ENQUEUED or the actual queue 
depending on