Hello,
Martin, how would you prefer these changes, or equivalent ones, to get
into the java.util.concurrent upstream sources?
Several classes in java.util.concurrent rely on default constructors,
which is not recommended. Please review the patch below which removes
them along with the corresponding CSR
(https://bugs.openjdk.java.net/browse/JDK-8250241); webrev at
http://cr.openjdk.java.net/~darcy/8250240.0/.
Thanks,
-Joe
diff -r d62da6fc4074
src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java
---
a/src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java
Thu Jul 23 20:25:41 2020 +0100
+++
b/src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java
Thu Jul 23 15:01:27 2020 -0700
@@ -77,6 +77,11 @@
public abstract class AbstractExecutorService implements ExecutorService {
/**
+ * Constructor for subclasses to call.
+ */
+ public AbstractExecutorService() {}
+
+ /**
* Returns a {@code RunnableFuture} for the given runnable and default
* value.
*
diff -r d62da6fc4074
src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
Thu Jul 23 20:25:41 2020 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
Thu Jul 23 15:01:27 2020 -0700
@@ -242,6 +242,11 @@
private static final int SIGNAL = 1 << 16; // true if joiner waiting
private static final int SMASK = 0xffff; // short bits for tags
+ /**
+ * Constructor for subclasses to call.
+ */
+ public ForkJoinTask() {}
+
static boolean isExceptionalStatus(int s) { // needed by subclasses
return (s & THROWN) != 0;
}
diff -r d62da6fc4074
src/java.base/share/classes/java/util/concurrent/RecursiveAction.java
---
a/src/java.base/share/classes/java/util/concurrent/RecursiveAction.java
Thu Jul 23 20:25:41 2020 +0100
+++
b/src/java.base/share/classes/java/util/concurrent/RecursiveAction.java
Thu Jul 23 15:01:27 2020 -0700
@@ -166,6 +166,11 @@
private static final long serialVersionUID = 5232453952276485070L;
/**
+ * Constructor for subclasses to call.
+ */
+ public RecursiveAction() {}
+
+ /**
* The main computation performed by this task.
*/
protected abstract void compute();
diff -r d62da6fc4074
src/java.base/share/classes/java/util/concurrent/RecursiveTask.java
---
a/src/java.base/share/classes/java/util/concurrent/RecursiveTask.java
Thu Jul 23 20:25:41 2020 +0100
+++
b/src/java.base/share/classes/java/util/concurrent/RecursiveTask.java
Thu Jul 23 15:01:27 2020 -0700
@@ -69,6 +69,11 @@
private static final long serialVersionUID = 5232453952276485270L;
/**
+ * Constructor for subclasses to call.
+ */
+ public RecursiveTask() {}
+
+ /**
* The result of the computation.
*/
@SuppressWarnings("serial") // Conditionally serializable
diff -r d62da6fc4074
src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
---
a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
Thu Jul 23 20:25:41 2020 +0100
+++
b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java
Thu Jul 23 15:01:27 2020 -0700
@@ -65,6 +65,11 @@
private static final long serialVersionUID = 7373984972572414692L;
+ /**
+ * Constructor for subclasses to call.
+ */
+ public AbstractQueuedLongSynchronizer() {}
+
/*
* To keep sources in sync, the remainder of this source file is
* exactly cloned from AbstractQueuedSynchronizer, replacing class