From ea56d752f4c93af19a136601e6e28926a95cfe4e Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 9 Dec 2020 20:42:19 +0000 Subject: [PATCH] remove more deprecated code git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884269 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xssf/usermodel/XSSFSheet.java | 13 --- .../apache/poi/xssf/usermodel/XSSFTable.java | 24 +----- .../poi/xssf/usermodel/TestXSSFTable.java | 15 +--- .../poi/xssf/usermodel/TestXSSFWorkbook.java | 2 +- .../poi/hsmf/datatypes/DirectoryChunk.java | 12 --- .../hwpf/model/BookmarkFirstDescriptor.java | 9 -- .../apache/poi/hwpf/model/CHPBinTable.java | 2 +- .../org/apache/poi/hwpf/model/Colorref.java | 9 -- .../model/FootnoteReferenceDescriptor.java | 9 -- .../apache/poi/hwpf/model/Hyphenation.java | 9 -- .../poi/hwpf/model/PropertyModifier.java | 9 -- .../apache/poi/hwpf/model/PropertyNode.java | 9 -- .../hwpf/sprm/CharacterSprmUncompressor.java | 8 +- .../org/apache/poi/hwpf/sprm/SprmBuffer.java | 9 -- .../apache/poi/hwpf/usermodel/BorderCode.java | 9 -- .../hwpf/usermodel/CharacterProperties.java | 9 -- .../poi/hwpf/usermodel/CharacterRun.java | 14 --- .../poi/hwpf/usermodel/DateAndTime.java | 85 ++++++++----------- .../poi/hwpf/usermodel/DropCapSpecifier.java | 9 -- .../hwpf/usermodel/LineSpacingDescriptor.java | 9 -- .../hwpf/usermodel/ParagraphProperties.java | 9 -- .../apache/poi/hwpf/usermodel/Section.java | 9 -- .../poi/hwpf/usermodel/SectionProperties.java | 9 -- .../poi/hwpf/usermodel/ShadingDescriptor.java | 9 -- .../hwpf/usermodel/ShadingDescriptor80.java | 9 -- .../TableAutoformatLookSpecifier.java | 9 -- .../hwpf/usermodel/TableCellDescriptor.java | 9 -- .../poi/hwpf/usermodel/TableProperties.java | 9 -- 28 files changed, 47 insertions(+), 299 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 592ff3a007..155aa70556 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -4069,19 +4069,6 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { return new XSSFAutoFilter(this); } - /** - * Creates a new Table, and associates it with this Sheet. The table does - * not yet have an area defined and needs to be initialized by calling - * {@link XSSFTable#setArea(AreaReference)}. - * - * @deprecated Use {@link #createTable(AreaReference))} instead - */ - @Deprecated - @Removal(version = "4.2.0") - public XSSFTable createTable() { - return createTable(null); - } - /** * Creates a new Table, and associates it with this Sheet. *

diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java index 31b6e320cf..62f6158deb 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java @@ -220,18 +220,11 @@ public class XSSFTable extends POIXMLDocumentPart implements Table { } return tableColumns; } - + /** - * Note this list is static - once read, it does not notice later changes to the underlying column structures - * To clear the cache, call {@link #updateHeaders} - * - * @deprecated Use {@link XSSFTableColumn#getXmlColumnPr()} instead. - * - * @return List of XSSFXmlColumnPr + * Use {@link XSSFTableColumn#getXmlColumnPr()} instead. */ - @Deprecated - @Removal(version="4.2.0") - public List getXmlColumnPrs() { + private List getXmlColumnPrs() { if (xmlColumnPrs == null) { xmlColumnPrs = new ArrayList<>(); for (XSSFTableColumn column: getColumns()) { @@ -438,17 +431,6 @@ public class XSSFTable extends POIXMLDocumentPart implements Table { ctTable.setDisplayName(name); } - /** - * @deprecated Use {@link #getColumnCount()} instead. - * - * @return the number of mapped table columns (see Open Office XML Part 4: chapter 3.5.1.4) - */ - @Deprecated - @Removal(version = "4.2.0") - public long getNumberOfMappedColumns() { - return ctTable.getTableColumns().getCount(); - } - /** * Get the area reference for the cells which this table covers. The area * includes header rows and totals rows. diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java index 733da646f9..45f08f8f0f 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java @@ -89,7 +89,7 @@ public final class TestXSSFTable { XSSFSheet sheet = outputWorkbook.createSheet(); //Create - XSSFTable outputTable = sheet.createTable(); + XSSFTable outputTable = sheet.createTable(null); outputTable.setDisplayName("Test"); CTTable outputCTTable = outputTable.getCTTable(); @@ -223,15 +223,6 @@ public final class TestXSSFTable { } } - @Test - public void getNumberOfMappedColumns() throws IOException { - try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("StructuredReferences.xlsx")) { - XSSFTable table = wb.getTable("\\_Prime.1"); - //noinspection deprecation - assertEquals(3, table.getNumberOfMappedColumns()); - } - } - @Test public void getColumnCount() throws IOException { try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("StructuredReferences.xlsx")) { @@ -258,7 +249,7 @@ public final class TestXSSFTable { // can be synchronized with the underlying CTTable try (XSSFWorkbook wb = new XSSFWorkbook()) { XSSFSheet sh = wb.createSheet(); - XSSFTable table = sh.createTable(); + XSSFTable table = sh.createTable(null); assertNotNull(table.getDisplayName()); assertNotNull(table.getCTTable().getDisplayName()); CTTable ctTable = table.getCTTable(); @@ -289,7 +280,7 @@ public final class TestXSSFTable { public void getRowCount() throws IOException { try (XSSFWorkbook wb = new XSSFWorkbook()) { XSSFSheet sh = wb.createSheet(); - XSSFTable table = sh.createTable(); + XSSFTable table = sh.createTable(null); CTTable ctTable = table.getCTTable(); assertEquals(0, table.getRowCount()); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java index e2b2d88d5e..c13d96bc2d 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java @@ -1102,7 +1102,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook { // If a table is added after getTable is called it should still be reachable by XSSFWorkbook.getTable // This test makes sure that if any caching is done that getTable never uses a stale cache - XSSFTable table2 = wb.getSheet("Foglio2").createTable(); + XSSFTable table2 = wb.getSheet("Foglio2").createTable(null); table2.setName("Table2"); assertSame("Did not find Table2", table2, wb.getTable("Table2")); diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java index 6a12894998..2b42db7209 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java @@ -45,18 +45,6 @@ public class DirectoryChunk extends Chunk { return dir; } - /** - * Treats the directory as an embedded MAPIMessage (it normally is one), and - * returns a MAPIMessage object to process it with. - * - * @deprecated use {@link #getAsEmbeddedMessage()} instead - */ - @Removal(version = "4.3") - @Deprecated - public MAPIMessage getAsEmbededMessage() throws IOException { - return getAsEmbeddedMessage(); - } - /** * Treats the directory as an embedded MAPIMessage (it normally is one), and * returns a MAPIMessage object to process it with. diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java index 617868be11..0de0daf226 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/BookmarkFirstDescriptor.java @@ -21,7 +21,6 @@ import java.util.Objects; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.BKFAbstractType; import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; @Internal public final class BookmarkFirstDescriptor extends BKFAbstractType implements Duplicatable { @@ -35,14 +34,6 @@ public final class BookmarkFirstDescriptor extends BKFAbstractType implements Du fillFields( data, offset ); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - protected BookmarkFirstDescriptor clone() { - return copy(); - } - @Override public BookmarkFirstDescriptor copy() { return new BookmarkFirstDescriptor(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java index 0aff01bfac..8367aa84fd 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java @@ -156,7 +156,7 @@ public class CHPBinTable if ( hasChp ) { - SprmBuffer newSprmBuffer = sprmBuffer.clone(); + SprmBuffer newSprmBuffer = sprmBuffer.copy(); CHPX chpx = new CHPX( textPiece.getStart(), textPiece.getEnd(), newSprmBuffer ); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java index 6deb288ea5..7ae494fb05 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Colorref.java @@ -19,7 +19,6 @@ package org.apache.poi.hwpf.model; import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.Removal; /** * 24-bit color structure @@ -87,14 +86,6 @@ public class Colorref implements Duplicatable { this.value = value; } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public Colorref clone() { - return copy(); - } - @Override public Colorref copy() { return new Colorref(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java index 8d7d224593..6c21ff2fd7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FootnoteReferenceDescriptor.java @@ -21,7 +21,6 @@ import java.util.Objects; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.FRDAbstractType; import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; @Internal public final class FootnoteReferenceDescriptor extends FRDAbstractType implements Duplicatable { @@ -35,14 +34,6 @@ public final class FootnoteReferenceDescriptor extends FRDAbstractType implement fillFields( data, offset ); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - protected FootnoteReferenceDescriptor clone() { - return copy(); - } - @Override public FootnoteReferenceDescriptor copy() { return new FootnoteReferenceDescriptor(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java index 00c2b91558..ac391ba780 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Hyphenation.java @@ -24,7 +24,6 @@ import org.apache.poi.hwpf.model.types.HRESIAbstractType; import org.apache.poi.hwpf.usermodel.CharacterProperties; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.Removal; /** * Hyphenation. Substructure of the {@link CharacterProperties}. @@ -43,14 +42,6 @@ public final class Hyphenation extends HRESIAbstractType implements Duplicatable fillFields( data, 0 ); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public Hyphenation clone() { - return copy(); - } - @Override public Hyphenation copy() { return new Hyphenation(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java index 5cfc1e38fe..a2e0bd2ff3 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyModifier.java @@ -21,7 +21,6 @@ import java.util.Objects; import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; -import org.apache.poi.util.Removal; @Internal public final class PropertyModifier implements Duplicatable { @@ -55,14 +54,6 @@ public final class PropertyModifier implements Duplicatable { value = other.value; } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - protected PropertyModifier clone() { - return copy(); - } - @Override public PropertyModifier copy() { return new PropertyModifier(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java index 643571a396..9448f6034b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/PropertyNode.java @@ -25,7 +25,6 @@ import org.apache.poi.common.Duplicatable; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -import org.apache.poi.util.Removal; /** * Represents a lightweight node in the Trees used to store content @@ -152,14 +151,6 @@ public abstract class PropertyNode> implements Compara return false; } - @Override - @Deprecated - @Removal(version = "5.0.0") - @SuppressWarnings({"unchecked","squid:S2975"}) - public T clone() { - return (T) copy(); - } - @Override public abstract PropertyNode copy(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java index f7ebeab350..0f2e92222d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java @@ -45,7 +45,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor public static CharacterProperties uncompressCHP( CharacterProperties parent, byte[] grpprl, int offset ) { - CharacterProperties newProperties = parent.clone(); + CharacterProperties newProperties = parent.copy(); applySprms( parent, grpprl, offset, true, newProperties ); return newProperties; } @@ -61,7 +61,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor } else { - newProperties = parStyle.clone(); + newProperties = parStyle.copy(); } /* @@ -84,7 +84,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor } CharacterProperties styleProperties = newProperties; - newProperties = styleProperties.clone(); + newProperties = styleProperties.copy(); try { @@ -329,7 +329,7 @@ public final class CharacterSprmUncompressor extends SprmUncompressor case 0x33: // preserve the fSpec setting from the original CHP boolean fSpec = newCHP.isFSpec(); - newCHP = oldCHP.clone(); + newCHP = oldCHP.copy(); newCHP.setFSpec( fSpec ); return; case 0x34: diff --git a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java index d18f8219aa..201d069742 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java @@ -24,7 +24,6 @@ import org.apache.poi.util.IOUtils; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.Removal; @Internal public final class SprmBuffer implements Duplicatable { @@ -107,14 +106,6 @@ public final class SprmBuffer implements Duplicatable { _offset += grpprl.length - offset; } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public SprmBuffer clone() { - return copy(); - } - @Override public SprmBuffer copy() { return new SprmBuffer(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java index cb7ffc95ac..9f2c1ab466 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java @@ -22,7 +22,6 @@ import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.Removal; /** * Mapping class for BRC80 structure (Border Code for Word 97) @@ -88,14 +87,6 @@ public final class BorderCode implements Duplicatable { return 42; // any arbitrary constant will do } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public BorderCode clone() { - return copy(); - } - @Override public BorderCode copy() { return new BorderCode(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java index 3c444cd52c..71e98888e0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.Colorref; import org.apache.poi.hwpf.model.types.CHPAbstractType; -import org.apache.poi.util.Removal; @SuppressWarnings("unused") public final class CharacterProperties extends CHPAbstractType implements Duplicatable { @@ -371,14 +370,6 @@ public final class CharacterProperties extends CHPAbstractType implements Duplic setCv( new Colorref( colour24 & 0xFFFFFF ) ); } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public CharacterProperties clone() { - return copy(); - } - @Override public CharacterProperties copy() { return new CharacterProperties(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java index 4e51c747de..96fb227dd9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java @@ -26,7 +26,6 @@ import org.apache.poi.hwpf.model.Ffn; import org.apache.poi.hwpf.model.NilPICFAndBinData; import org.apache.poi.hwpf.model.StyleSheet; import org.apache.poi.hwpf.sprm.SprmBuffer; -import org.apache.poi.util.Removal; import java.math.BigDecimal; import java.math.RoundingMode; @@ -567,19 +566,6 @@ public final class CharacterRun extends Range implements Duplicatable, org.apach _props.setIco24(colour24); } - /** - * Used to create a deep copy of this object. - * - * @return A deep copy. - */ - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public CharacterRun clone() { - return copy(); - } - @Override public CharacterRun copy() { return new CharacterRun(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java index be677fba87..38c4a2895c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java @@ -17,15 +17,10 @@ package org.apache.poi.hwpf.usermodel; -import java.util.Calendar; - import org.apache.poi.common.Duplicatable; -import org.apache.poi.util.BitField; -import org.apache.poi.util.BitFieldFactory; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.LocaleUtil; -import org.apache.poi.util.Removal; +import org.apache.poi.util.*; + +import java.util.Calendar; /** * This class is used to represent a date and time in a Word document. @@ -42,7 +37,8 @@ public final class DateAndTime implements Duplicatable { private short _info; private short _info2; - public DateAndTime() {} + public DateAndTime() { + } public DateAndTime(DateAndTime other) { _info = other._info; @@ -54,60 +50,49 @@ public final class DateAndTime implements Duplicatable { _info2 = LittleEndian.getShort(buf, offset + LittleEndianConsts.SHORT_SIZE); } - public Calendar getDate() { - // TODO Discover if the timezone is stored somewhere else or not - return LocaleUtil.getLocaleCalendar( - _years.getValue(_info2)+1900, - _months.getValue(_info2)-1, - _dom.getValue(_info), - _hours.getValue(_info), - _minutes.getValue(_info), - 0 - ); - } - - public void serialize(byte[] buf, int offset) - { - LittleEndian.putShort(buf, offset, _info); - LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _info2); - } - - @Override - public boolean equals(Object o) - { - if (!(o instanceof DateAndTime)) return false; - DateAndTime dttm = (DateAndTime)o; - return _info == dttm._info && _info2 == dttm._info2; - } - - @Override - public int hashCode() { - assert false : "hashCode not designed"; - return 42; // any arbitrary constant will do - } + public Calendar getDate() { + // TODO Discover if the timezone is stored somewhere else or not + return LocaleUtil.getLocaleCalendar( + _years.getValue(_info2) + 1900, + _months.getValue(_info2) - 1, + _dom.getValue(_info), + _hours.getValue(_info), + _minutes.getValue(_info), + 0 + ); + } + + public void serialize(byte[] buf, int offset) { + LittleEndian.putShort(buf, offset, _info); + LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _info2); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof DateAndTime)) return false; + DateAndTime dttm = (DateAndTime) o; + return _info == dttm._info && _info2 == dttm._info2; + } @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public DateAndTime clone() { - return copy(); + public int hashCode() { + assert false : "hashCode not designed"; + return 42; // any arbitrary constant will do } + @Override public DateAndTime copy() { return new DateAndTime(this); } - public boolean isEmpty() - { + public boolean isEmpty() { return _info == 0 && _info2 == 0; } @Override - public String toString() - { - if ( isEmpty() ) + public String toString() { + if (isEmpty()) return "[DTTM] EMPTY"; return "[DTTM] " + getDate(); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java index f391bb887f..c5589f0d52 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DropCapSpecifier.java @@ -21,7 +21,6 @@ import org.apache.poi.common.Duplicatable; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.Removal; /** * This data structure is used by a paragraph to determine how it should drop @@ -50,14 +49,6 @@ public final class DropCapSpecifier implements Duplicatable { this._fdct = fdct; } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public DropCapSpecifier clone() { - return copy(); - } - @Override public DropCapSpecifier copy() { return new DropCapSpecifier(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java index 181dc6f75d..8849f8aa75 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.Removal; /** * This class is used to determine line spacing for a paragraph. @@ -45,14 +44,6 @@ public final class LineSpacingDescriptor implements Duplicatable { _fMultiLinespace = LittleEndian.getShort(buf, offset + LittleEndianConsts.SHORT_SIZE); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public LineSpacingDescriptor clone() { - return copy(); - } - @Override public LineSpacingDescriptor copy() { return new LineSpacingDescriptor(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java index b335fc85a9..f1c78be1d9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ParagraphProperties.java @@ -19,7 +19,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.PAPAbstractType; -import org.apache.poi.util.Removal; @SuppressWarnings("unused") public final class ParagraphProperties extends PAPAbstractType implements Duplicatable { @@ -36,14 +35,6 @@ public final class ParagraphProperties extends PAPAbstractType implements Duplic jcLogical = other.jcLogical; } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public ParagraphProperties clone() { - return copy(); - } - @Override public ParagraphProperties copy() { return new ParagraphProperties(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java index 89b0846659..ac0e6f25af 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.HWPFOldDocument; import org.apache.poi.hwpf.model.SEPX; -import org.apache.poi.util.Removal; public final class Section extends Range implements Duplicatable { private final SectionProperties _props; @@ -40,14 +39,6 @@ public final class Section extends Range implements Duplicatable { _props = sepx.getSectionProperties(); } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public Section clone() { - return copy(); - } - @Override public Section copy() { return new Section(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java index 1eeb47a511..72f688ad3a 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/SectionProperties.java @@ -19,7 +19,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.SEPAbstractType; -import org.apache.poi.util.Removal; public final class SectionProperties extends SEPAbstractType implements Duplicatable { private short field_60_rncftn; @@ -50,14 +49,6 @@ public final class SectionProperties extends SEPAbstractType implements Duplicat field_65_nfcednref = other.field_65_nfcednref; } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public SectionProperties clone() { - return copy(); - } - @Override public SectionProperties copy() { return new SectionProperties(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java index 85e2d1c233..5274645f51 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor.java @@ -19,7 +19,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.SHDAbstractType; -import org.apache.poi.util.Removal; /** * The SHD is a substructure of the CHP, PAP, and TC for Word 2000. @@ -36,14 +35,6 @@ public final class ShadingDescriptor extends SHDAbstractType implements Duplicat fillFields( buf, offset ); } - @Override - @SuppressWarnings("squid:S2975") - @Deprecated - @Removal(version = "5.0.0") - public ShadingDescriptor clone() { - return copy(); - } - @Override public ShadingDescriptor copy() { return new ShadingDescriptor(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java index e40e499b21..aefd3feb9f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ShadingDescriptor80.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.Colorref; import org.apache.poi.hwpf.model.types.SHD80AbstractType; -import org.apache.poi.util.Removal; /** * The SHD80 is a substructure of the CHP and PAP, and TC for Word 97. @@ -42,14 +41,6 @@ public final class ShadingDescriptor80 extends SHD80AbstractType implements Dupl field_1_value = value; } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public ShadingDescriptor80 clone() { - return copy(); - } - @Override public ShadingDescriptor80 copy() { return new ShadingDescriptor80(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java index 305ee149a6..8893c4da2b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java @@ -20,7 +20,6 @@ import java.util.Objects; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.TLPAbstractType; -import org.apache.poi.util.Removal; public class TableAutoformatLookSpecifier extends TLPAbstractType implements Duplicatable { public static final int SIZE = 4; @@ -35,14 +34,6 @@ public class TableAutoformatLookSpecifier extends TLPAbstractType implements Dup fillFields( data, offset ); } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public TableAutoformatLookSpecifier clone() { - return copy(); - } - @Override public TableAutoformatLookSpecifier copy() { return new TableAutoformatLookSpecifier(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java index ad31a92361..e7e99373c7 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableCellDescriptor.java @@ -20,7 +20,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.TCAbstractType; import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.Removal; public final class TableCellDescriptor extends TCAbstractType implements Duplicatable { public static final int SIZE = 20; @@ -51,14 +50,6 @@ public final class TableCellDescriptor extends TCAbstractType implements Duplica getBrcRight().serialize(data, 0x10 + offset); } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public TableCellDescriptor clone() { - return copy(); - } - @Override public TableCellDescriptor copy() { return new TableCellDescriptor(this); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java index 999d2a9e58..eec31c4815 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java @@ -19,7 +19,6 @@ package org.apache.poi.hwpf.usermodel; import org.apache.poi.common.Duplicatable; import org.apache.poi.hwpf.model.types.TAPAbstractType; -import org.apache.poi.util.Removal; public final class TableProperties extends TAPAbstractType implements Duplicatable { @@ -64,14 +63,6 @@ public final class TableProperties extends TAPAbstractType implements Duplicatab setRgdxaCenterPrint( new short[columns] ); } - @Override - @SuppressWarnings({"squid:S2975", "MethodDoesntCallSuperMethod"}) - @Deprecated - @Removal(version = "5.0.0") - public TableProperties clone() { - return copy(); - } - @Override public TableProperties copy() { return new TableProperties(this); -- 2.39.5