remove more deprecated code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884269 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2020-12-09 20:42:19 +00:00
parent ea59cc2bc9
commit ea56d752f4
28 changed files with 46 additions and 298 deletions

View File

@ -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.
* <p>

View File

@ -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<XSSFXmlColumnPr> getXmlColumnPrs() {
private List<XSSFXmlColumnPr> 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.

View File

@ -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());

View File

@ -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"));

View File

@ -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.

View File

@ -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);

View File

@ -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 );

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<T extends PropertyNode<T>> 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();

View File

@ -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:

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 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 void serialize(byte[] buf, int offset) {
LittleEndian.putShort(buf, offset, _info);
LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _info2);
}
@Override
@SuppressWarnings("squid:S2975")
@Deprecated
@Removal(version = "5.0.0")
public DateAndTime clone() {
return copy();
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
}
@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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);