Summary
The type java.lang.Record
should use an explicit constructor rather than a default one.
Problem
Relying on a default constructor is not prudent for platform classes.
Solution
Add an explicit protected
constructor.
Specification
--- old/src/java.base/share/classes/java/lang/Record.java 2020-01-06 13:47:31.740871560 -0800
+++ new/src/java.base/share/classes/java/lang/Record.java 2020-01-06 13:47:31.552777567 -0800
@@ -91,6 +91,11 @@
essentialAPI=true)
public abstract class Record {
/**
+ * Constructor for record classes to call.
+ */
+ protected Record() {}
+
+ /**
* Indicates whether some other object is "equal to" this one. In addition
* to the general contract of {@link Object#equals(Object)},
* record classes must further participate in the invariant that when
- csr of
-
JDK-8236695 java.lang.Record should be declared with an explicit constructor
-
- Resolved
-