From bc1569e7866fe075424ce5f92a6e28783c595edc Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 9 Dec 2020 16:55:30 +0000 Subject: [PATCH] remove more deprecated code git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884257 13f79535-47bb-0310-9956-ffa450edef68 --- .../hssf/usermodel/HSSFBorderFormatting.java | 47 -------------- .../poi/hssf/usermodel/HSSFCellStyle.java | 10 ++- .../hssf/usermodel/HSSFFontFormatting.java | 36 ----------- .../poi/hssf/usermodel/HSSFPicture.java | 49 --------------- .../poi/ss/usermodel/BorderFormatting.java | 62 ------------------- .../apache/poi/ss/usermodel/CellStyle.java | 10 +-- .../poi/ooxml/util/TransformerHelper.java | 2 +- .../xssf/usermodel/XSSFBorderFormatting.java | 23 ------- .../poi/xssf/usermodel/XSSFCellStyle.java | 23 +++---- .../poi/xssf/usermodel/XSSFWorkbook.java | 10 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 4 +- .../poi/hslf/usermodel/HSLFMasterSheet.java | 18 ------ 12 files changed, 25 insertions(+), 269 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java index c3098820c5..f0de680a6a 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java @@ -326,53 +326,6 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B return BorderStyle.NONE; } - @Override - public BorderStyle getBorderBottomEnum() { - return getBorderBottom(); - } - - @Override - public BorderStyle getBorderDiagonalEnum() { - return getBorderDiagonal(); - } - - @Override - public BorderStyle getBorderLeftEnum() { - return getBorderLeft(); - } - - @Override - public BorderStyle getBorderRightEnum() { - return getBorderRight(); - } - - @Override - public BorderStyle getBorderTopEnum() { - return getBorderTop(); - } - - /** - * HSSF doesn't support table borders, so always {@link BorderStyle#NONE} - * - * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderVertical() - */ - @Deprecated - @Override - public BorderStyle getBorderVerticalEnum() { - return getBorderVertical(); - } - - /** - * HSSF doesn't support table borders, so always {@link BorderStyle#NONE} - * - * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderHorizontal() - */ - @Deprecated - @Override - public BorderStyle getBorderHorizontalEnum() { - return getBorderHorizontal(); - } - /** * HSSF Doesn't support table borders, so always {@link HSSFColorPredefined#AUTOMATIC} * diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index e97e6555f2..894c194ba0 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -35,6 +35,7 @@ import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.util.Removal; /** * High level representation of the style of a cell in a sheet of a workbook. @@ -187,11 +188,11 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable { /** * gets the index of the font for this style - * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short) + * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int) + * @since 5.0.0 (used to return a short value) */ @Override - @Deprecated - public short getFontIndex() + public int getFontIndex() { return _format.getFontIndex(); } @@ -199,8 +200,11 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable { /** * gets the index of the font for this style * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int) + * @deprecated use {@link #getFontIndex()} instead * @since 4.0.0 */ + @Deprecated + @Removal(version = "6.0.0") @Override public int getFontIndexAsInt() { diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java index 40cf873306..735d921cc3 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFontFormatting.java @@ -21,7 +21,6 @@ import org.apache.poi.hssf.record.CFRuleBase; import org.apache.poi.hssf.record.cf.FontFormatting; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Color; -import org.apache.poi.util.Removal; /** * High level representation for Font Formatting component @@ -29,41 +28,6 @@ import org.apache.poi.util.Removal; */ @SuppressWarnings("unused") public final class HSSFFontFormatting implements org.apache.poi.ss.usermodel.FontFormatting { - /** - * Underline type - None - * @deprecated use {@link org.apache.poi.ss.usermodel.Font#U_NONE} - */ - @Deprecated - @Removal(version = "5.0.0") - public final static byte U_NONE = org.apache.poi.ss.usermodel.Font.U_NONE; - /** - * Underline type - Single - * @deprecated use {@link org.apache.poi.ss.usermodel.Font#U_SINGLE} - */ - @Deprecated - @Removal(version = "5.0.0") - public final static byte U_SINGLE = org.apache.poi.ss.usermodel.Font.U_SINGLE; - /** - * Underline type - Double - * @deprecated use {@link org.apache.poi.ss.usermodel.Font#U_DOUBLE} - */ - @Deprecated - @Removal(version = "5.0.0") - public final static byte U_DOUBLE = org.apache.poi.ss.usermodel.Font.U_DOUBLE; - /** - * Underline type - Single Accounting - * @deprecated use {@link org.apache.poi.ss.usermodel.Font#U_SINGLE_ACCOUNTING} - */ - @Deprecated - @Removal(version = "5.0.0") - public final static byte U_SINGLE_ACCOUNTING = org.apache.poi.ss.usermodel.Font.U_SINGLE_ACCOUNTING; - /** - * Underline type - Double Accounting - * @deprecated use {@link org.apache.poi.ss.usermodel.Font#U_DOUBLE_ACCOUNTING} - */ - @Deprecated - @Removal(version = "5.0.0") - public final static byte U_DOUBLE_ACCOUNTING = org.apache.poi.ss.usermodel.Font.U_DOUBLE_ACCOUNTING; private final FontFormatting fontFormatting; private final HSSFWorkbook workbook; diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java index b3a74e69f8..e66658905f 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java @@ -36,62 +36,13 @@ import org.apache.poi.hssf.record.EscherAggregate; import org.apache.poi.hssf.record.ObjRecord; import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType; import org.apache.poi.ss.usermodel.Picture; -import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.ImageUtils; -import org.apache.poi.util.Removal; import org.apache.poi.util.StringUtil; /** * Represents a escher picture. Eg. A GIF, JPEG etc... */ public class HSSFPicture extends HSSFSimpleShape implements Picture { - /** - * Windows Enhanced Metafile - * @deprecated use {@link Workbook#PICTURE_TYPE_EMF} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_EMF = Workbook.PICTURE_TYPE_EMF; - - /** - * Windows Metafile - * @deprecated use {@link Workbook#PICTURE_TYPE_WMF} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_WMF = Workbook.PICTURE_TYPE_WMF; - - /** - * Macintosh PICT - * @deprecated use {@link Workbook#PICTURE_TYPE_PICT} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_PICT = Workbook.PICTURE_TYPE_PICT; - - /** - * JFIF / JPEG - * @deprecated use {@link Workbook#PICTURE_TYPE_JPEG} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_JPEG = Workbook.PICTURE_TYPE_JPEG; - - /** - * PNG - * @deprecated use {@link Workbook#PICTURE_TYPE_PNG} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_PNG = Workbook.PICTURE_TYPE_PNG; - - /** - * Windows DIB - * @deprecated use {@link Workbook#PICTURE_TYPE_DIB} - */ - @Removal(version = "5.0.0") - @Deprecated - public static final int PICTURE_TYPE_DIB = Workbook.PICTURE_TYPE_DIB; public HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord) { super(spContainer, objRecord); diff --git a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java index e0aba8621f..985a215409 100644 --- a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java +++ b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java @@ -19,8 +19,6 @@ package org.apache.poi.ss.usermodel; -import org.apache.poi.util.Removal; - /** * High level representation for Border Formatting component * of Conditional Formatting settings @@ -55,66 +53,6 @@ public interface BorderFormatting { */ BorderStyle getBorderHorizontal(); - /** - * @since POI 3.15 - * @deprecated use getBorderBottom instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderBottomEnum(); - - /** - * @since POI 3.15 - * @deprecated use getBorderDiagonal instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderDiagonalEnum(); - - /** - * @since POI 3.15 - * @deprecated use getBorderLeft instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderLeftEnum(); - - /** - * @since POI 3.15 - * @deprecated use getBorderRight instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderRightEnum(); - - /** - * @since POI 3.15 - * @deprecated use getBorderTop instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderTopEnum(); - - /** - * Only valid for range borders, such as table styles - * @since 3.17 beta 1 - * @return border style - * @deprecated use getBorderVertical instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderVerticalEnum(); - - /** - * Only valid for range borders, such as table styles - * @since 3.17 beta 1 - * @return border style - * @deprecated use getBorderHorizontal instead - */ - @Removal(version = "4.2") - @Deprecated - BorderStyle getBorderHorizontalEnum(); - short getBottomBorderColor(); Color getBottomBorderColorColor(); diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java index 57395c6bc6..8417887f5f 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -55,17 +55,19 @@ public interface CellStyle { /** * gets the index of the font for this style - * @see Workbook#getFontAt(short) - * @deprecated use getFontIndexAsInt() instead + * @see Workbook#getFontAt(int) + * @since 5.0.0 (used to return a short value) */ - @Removal(version = "4.2") - short getFontIndex(); + int getFontIndex(); /** * gets the index of the font for this style * @see Workbook#getFontAt(int) + * @deprecated use {@link #getFontIndex()} instead * @since 4.0.0 */ + @Deprecated + @Removal(version = "6.0.0") int getFontIndexAsInt(); /** diff --git a/src/ooxml/java/org/apache/poi/ooxml/util/TransformerHelper.java b/src/ooxml/java/org/apache/poi/ooxml/util/TransformerHelper.java index e6a3f0c8f3..c3f00bd034 100644 --- a/src/ooxml/java/org/apache/poi/ooxml/util/TransformerHelper.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/TransformerHelper.java @@ -25,7 +25,7 @@ import org.apache.poi.util.XMLHelper; /** * @deprecated use {@link XMLHelper} */ -@Removal(version = "5.0.0") +@Removal(version = "6.0.0") @Deprecated public final class TransformerHelper { private TransformerHelper() {} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java index dc40bdcc38..4afbcb123e 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java @@ -57,23 +57,6 @@ public class XSSFBorderFormatting implements BorderFormatting { return getBorderStyle(_border.getRight()); } - @Override - public BorderStyle getBorderTopEnum() { return getBorderTop(); } - - @Override - public BorderStyle getBorderBottomEnum() { return getBorderBottom(); } - - @Override - public BorderStyle getBorderDiagonalEnum() { return getBorderDiagonal(); } - - @Override - public BorderStyle getBorderLeftEnum() { - return getBorderLeft(); - } - - @Override - public BorderStyle getBorderRightEnum() { return getBorderRight(); } - @Override public BorderStyle getBorderTop() { return getBorderStyle(_border.getTop()); @@ -274,12 +257,6 @@ public class XSSFBorderFormatting implements BorderFormatting { return getBorderStyle(_border.getHorizontal()); } - @Override - public BorderStyle getBorderVerticalEnum() { return getBorderVertical(); } - - @Override - public BorderStyle getBorderHorizontalEnum() { return getBorderHorizontal(); } - public short getVerticalBorderColor() { return getIndexedColor(getVerticalBorderColorColor()); } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index 02da02977e..af5fa32e24 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -439,22 +439,25 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { /** * Gets the index of the font for this style * - * @return short - font index - * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(short) + * @return font index + * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(int) + * @since 5.0.0 (used to return a short value) */ @Override - @Deprecated - public short getFontIndex() { - return (short) getFontId(); + public int getFontIndex() { + return getFontId(); } /** * Gets the index of the font for this style * - * @return short - font index + * @return font index * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(int) + * @deprecated use {@link #getFontIndex()} instead * @since 4.0.0 */ + @Deprecated + @Removal(version = "6.0.0") @Override public int getFontIndexAsInt() { return getFontId(); @@ -1272,14 +1275,6 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { return _cellXf.toString().equals(cf.getCoreXf().toString()); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public XSSFCellStyle clone() { - return copy(); - } - /** * Make a copy of this style. The underlying CTXf bean is cloned, * the references to fills and borders remain. diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 3375ea52bb..f04fbf8716 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -84,7 +84,6 @@ import org.apache.poi.util.NotImplemented; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; import org.apache.poi.util.Removal; -import org.apache.poi.util.Units; import org.apache.poi.xssf.XLSBUnsupportedException; import org.apache.poi.xssf.model.CalculationChain; import org.apache.poi.xssf.model.ExternalLinksTable; @@ -123,15 +122,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument; public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Support { private static final Pattern COMMA_PATTERN = Pattern.compile(","); - /** - * Width of one character of the default font in pixels. Same for Calibri and Arial. - * @deprecated POI 3.17 beta 1 - * @see Units#DEFAULT_CHARACTER_WIDTH - */ - @Deprecated - @Removal(version="4.1") - public static final float DEFAULT_CHARACTER_WIDTH = Units.DEFAULT_CHARACTER_WIDTH; - /** * Excel silently truncates long sheet names to 31 chars. * This constant is used to ensure uniqueness in the first 31 chars diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index db79c01f65..aff4e21f97 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -868,7 +868,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { // Column 1 has a font with regular colours XSSFCell cr = r.getCell(1); - XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndexAsInt()); + XSSFFont fr = wb.getFontAt(cr.getCellStyle().getFontIndex()); XSSFColor colr = fr.getXSSFColor(); // No theme, has colours assertEquals(0, colr.getTheme()); @@ -876,7 +876,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { // Column 0 has a font with colours from a theme XSSFCell ct = r.getCell(0); - XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndexAsInt()); + XSSFFont ft = wb.getFontAt(ct.getCellStyle().getFontIndex()); XSSFColor colt = ft.getXSSFColor(); // Has a theme, which has the colours on it assertEquals(9, colt.getTheme()); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java index 0548bf8027..5c424cc8a7 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFMasterSheet.java @@ -21,8 +21,6 @@ import org.apache.poi.hslf.model.textproperties.TextPropCollection; import org.apache.poi.hslf.record.SheetContainer; import org.apache.poi.hslf.record.TextHeaderAtom; import org.apache.poi.sl.usermodel.MasterSheet; -import org.apache.poi.sl.usermodel.SimpleShape; -import org.apache.poi.util.Removal; /** * The superclass of all master sheets - Slide masters, Notes masters, etc. @@ -47,20 +45,4 @@ public abstract class HSLFMasterSheet extends HSLFSheet implements MasterSheet)shape).isPlaceholder(); - } } -- 2.39.5