Repository: nodejs/node
Pull request: dgram: move deprecated APIs to EOL

Seven years is long enough to be deprecated.


Changed files:
filename: doc/api/deprecations.md
patch: @@ -2394,19 +2394,22 @@ unavailable when the [permission model][] is enabled.
 
 <!-- YAML
 changes:
+  - version: REPLACEME
+    pr-url: https://github.com/nodejs/node/pull/58474
+    description: End-of-Life.
   - version: v11.0.0
     pr-url: https://github.com/nodejs/node/pull/22011
     description: Runtime deprecation.
 -->
 
-Type: Runtime
+Type: End-of-Life
 
 The `node:dgram` module previously contained several APIs that were never meant
 to accessed outside of Node.js core: `Socket.prototype._handle`,
 `Socket.prototype._receiving`, `Socket.prototype._bindState`,
 `Socket.prototype._queue`, `Socket.prototype._reuseAddr`,
 `Socket.prototype._healthCheck()`, `Socket.prototype._stopReceiving()`, and
-`dgram._createSocketHandle()`.
+`dgram._createSocketHandle()`. These have been removed.
 
 ### DEP0113: `Cipher.setAuthTag()`, `Decipher.getAuthTag()`
 

filename: lib/dgram.js
patch: @@ -53,7 +53,6 @@ const {
 } = require('internal/errors');
 const {
   kStateSymbol,
-  _createSocketHandle,
   newHandle,
 } = require('internal/dgram');
 const { isIP } = require('internal/net');
@@ -66,7 +65,7 @@ const {
   validateUint32,
 } = require('internal/validators');
 const { Buffer } = require('buffer');
-const { deprecate, guessHandleType, promisify } = require('internal/util');
+const { guessHandleType, promisify } = require('internal/util');
 const { isArrayBufferView } = require('internal/util/types');
 const EventEmitter = require('events');
 const { addAbortListener } = require('internal/events/abort_listener');
@@ -1044,72 +1043,6 @@ Socket.prototype.getSendQueueCount = function() {
   return this[kStateSymbol].handle.getSendQueueCount();
 };
 
-// Deprecated private APIs.
-ObjectDefineProperty(Socket.prototype, '_handle', {
-  __proto__: null,
-  get: deprecate(function() {
-    return this[kStateSymbol].handle;
-  }, 'Socket.prototype._handle is deprecated', 'DEP0112'),
-  set: deprecate(function(val) {
-    this[kStateSymbol].handle = val;
-  }, 'Socket.prototype._handle is deprecated', 'DEP0112'),
-});
-
-
-ObjectDefineProperty(Socket.prototype, '_receiving', {
-  __proto__: null,
-  get: deprecate(function() {
-    return this[kStateSymbol].receiving;
-  }, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
-  set: deprecate(function(val) {
-    this[kStateSymbol].receiving = val;
-  }, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
-});
-
-
-ObjectDefineProperty(Socket.prototype, '_bindState', {
-  __proto__: null,
-  get: deprecate(function() {
-    return this[kStateSymbol].bindState;
-  }, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
-  set: deprecate(function(val) {
-    this[kStateSymbol].bindState = val;
-  }, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
-});
-
-
-ObjectDefineProperty(Socket.prototype, '_queue', {
-  __proto__: null,
-  get: deprecate(function() {
-    return this[kStateSymbol].queue;
-  }, 'Socket.prototype._queue is deprecated', 'DEP0112'),
-  set: deprecate(function(val) {
-    this[kStateSymbol].queue = val;
-  }, 'Socket.prototype._queue is deprecated', 'DEP0112'),
-});
-
-
-ObjectDefineProperty(Socket.prototype, '_reuseAddr', {
-  __proto__: null,
-  get: deprecate(function() {
-    return this[kStateSymbol].reuseAddr;
-  }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
-  set: deprecate(function(val) {
-    this[kStateSymbol].reuseAddr = val;
-  }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
-});
-
-
-Socket.prototype._healthCheck = deprecate(function() {
-  healthCheck(this);
-}, 'Socket.prototype._healthCheck() is deprecated', 'DEP0112');
-
-
-Socket.prototype._stopReceiving = deprecate(function() {
-  stopReceiving(this);
-}, 'Socket.prototype._stopReceiving() is deprecated', 'DEP0112');
-
-
 // Legacy alias on the C++ wrapper object. This is not public API, so we may
 // want to runtime-deprecate it at some point. There's no hurry, though.
 ObjectDefineProperty(UDP.prototype, 'owner', {
@@ -1118,13 +1051,7 @@ ObjectDefineProperty(UDP.prototype, 'owner', {
   set(v) { return this[owner_symbol] = v; },
 });
 
-
 module.exports = {
-  _createSocketHandle: deprecate(
-    _createSocketHandle,
-    'dgram._createSocketHandle() is deprecated',
-    'DEP0112',
-  ),
   createSocket,
   Socket,
 };

filename: test/parallel/test-dgram-create-socket-handle-fd.js
patch: @@ -5,11 +5,10 @@ if (common.isWindows)
   common.skip('Does not support binding fd on Windows');
 
 const assert = require('assert');
-const dgram = require('dgram');
+const { _createSocketHandle } = require('internal/dgram');
 const { internalBinding } = require('internal/test/binding');
 const { UDP } = internalBinding('udp_wrap');
 const { TCP, constants } = internalBinding('tcp_wrap');
-const _createSocketHandle = dgram._createSocketHandle;
 
 // Return a negative number if the "existing fd" is invalid.
 {

filename: test/parallel/test-dgram-deprecation-error.js
patch: @@ -1,84 +0,0 @@
-'use strict';
-
-const common = require('../common');
-const assert = require('assert');
-const dgram = require('dgram');
-const fork = require('child_process').fork;
-
-const sock = dgram.createSocket('udp4');
-
-const testNumber = parseInt(process.argv[2], 10);
-
-const propertiesToTest = [
-  '_handle',
-  '_receiving',
-  '_bindState',
-  '_queue',
-  '_reuseAddr',
-];
-
-const methodsToTest = [
-  '_healthCheck',
-  '_stopReceiving',
-];
-
-const propertyCases = propertiesToTest.map((propName) => {
-  return [
-    () => {
-      // Test property getter
-      common.expectWarning(
-        'DeprecationWarning',
-        `Socket.prototype.${propName} is deprecated`,
-        'DEP0112'
-      );
-      sock[propName]; // eslint-disable-line no-unused-expressions
-    },
-    () => {
-      // Test property setter
-      common.expectWarning(
-        'DeprecationWarning',
-        `Socket.prototype.${propName} is deprecated`,
-        'DEP0112'
-      );
-      sock[propName] = null;
-    },
-  ];
-});
-
-const methodCases = methodsToTest.map((propName) => {
-  return () => {
-    common.expectWarning(
-      'DeprecationWarning',
-      `Socket.prototype.${propName}() is deprecated`,
-      'DEP0112'
-    );
-    sock[propName]();
-  };
-});
-
-const cases = [].concat(
-  ...propertyCases,
-  ...methodCases
-);
-
-// If we weren't passed a test ID then we need to spawn all of the cases.
-// We run the cases in child processes since deprecations print once.
-if (Number.isNaN(testNumber)) {
-  const children = cases.map((_case, i) =>
-    fork(process.argv[1], [ String(i) ]));
-
-  children.forEach((child) => {
-    child.on('close', (code) => {
-      // Pass on child exit code
-      if (code > 0) {
-        process.exit(code);
-      }
-    });
-  });
-
-  return;
-}
-
-// We were passed a test ID - run the test case
-assert.ok(cases[testNumber]);
-cases[testNumber]();