From b5ee3d1f2abf5af86438ac4c9e3da3cc026dffd3 Mon Sep 17 00:00:00 2001 From: Tingjun Yuan Date: Tue, 24 Jan 2023 01:25:29 +0000 Subject: [PATCH] 8299497: Usage of constructors of primitive wrapper classes should be avoided in java.desktop API docs Reviewed-by: serb, prr --- .../share/classes/java/awt/font/LineBreakMeasurer.java | 4 ++-- .../classes/java/awt/image/renderable/ParameterBlock.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java.desktop/share/classes/java/awt/font/LineBreakMeasurer.java b/src/java.desktop/share/classes/java/awt/font/LineBreakMeasurer.java index 079ee9ff55c..423aae39c37 100644 --- a/src/java.desktop/share/classes/java/awt/font/LineBreakMeasurer.java +++ b/src/java.desktop/share/classes/java/awt/font/LineBreakMeasurer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2023, 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 @@ -198,7 +198,7 @@ import java.awt.font.FontRenderContext; * // layout can be null if lineContainsText is true * if (layout != null) { * layouts.addElement(layout); - * penPositions.addElement(new Float(horizontalPos)); + * penPositions.addElement(Float.valueOf(horizontalPos)); * horizontalPos += layout.getAdvance(); * maxAscent = Math.max(maxAscent, layout.getAscent()); * maxDescent = Math.max(maxDescent, diff --git a/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java b/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java index cd2e8d45dba..10f62777526 100644 --- a/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java +++ b/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2023, 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 @@ -48,7 +48,7 @@ import java.util.Vector; * downward cast and have return values of base type; an exception * will be thrown if the stored values do not have the correct type. * There is no way to distinguish between the results of - * "short s; add(s)" and "add(new Short(s))". + * "short s; add(s)" and "add(Short.valueOf(s))". * *

Note that the get and set methods operate on references. * Therefore, one must be careful not to share references between