From 57ffd3aa12a8076fa3f713813f265e32ae1f3b74 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Tue, 2 Dec 2025 22:17:35 +0100 Subject: [PATCH] Remove unused list of pivot-caches and update deprecations Seems the list is currently never accessed any more. --- .../poi/xssf/usermodel/XSSFWorkbook.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 6effa4f501..a62bbfb739 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -209,7 +209,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su * List of all pivot tables in workbook */ private final List pivotTables = new ArrayList<>(); - private List pivotCaches; private final XSSFFactory xssfFactory; @@ -387,9 +386,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su if (getCorePart().getContentType().equals(XSSFRelation.XLSB_BINARY_WORKBOOK.getContentType())) { throw new XLSBUnsupportedException(); } - - // Create arrays for parts attached to the workbook itself - pivotCaches = new ArrayList<>(); } @Override @@ -1115,6 +1111,9 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su * * @param nameIndex the index of the named range * @return the XSSFName at the given index + * + * @deprecated 3.16. New projects should avoid accessing named ranges by index. + * Use {@link #getName(String)} instead. */ @Deprecated XSSFName getNameAt(int nameIndex) { @@ -2088,7 +2087,22 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su return externalLinks; } - @Deprecated // use getExternalLinksTables() instead + /** + * Returns the list of {@link ExternalLinksTable} object for this workbook + * + *

The external links table specifies details of named ranges etc + * that are referenced from other workbooks, along with the last seen + * values of what they point to.

+ * + *

Note that Excel uses index 0 for the current workbook, so the first + * External Links in a formula would be '[1]Foo' which corresponds to + * entry 0 in this list.

+ + * @return the {@code ExternalLinksTable} list, which may be empty + * + * @deprecated use getExternalLinksTables() instead + */ + @Deprecated @Removal(version = "7.0.0") @Internal public List getExternalLinksTable() { @@ -2426,10 +2440,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su final int tableId = pivotTables.size() + 1; cache.setCacheId(tableId); cache.setId(rId); - if(pivotCaches == null) { - pivotCaches = new ArrayList<>(); - } - pivotCaches.add(cache); return cache; }