From 3a622169d321e96b858a2934504f5681aa612ef6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 23 Sep 2017 14:03:25 +0000 Subject: [PATCH] Remove more deprecated classes and methods git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1809428 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/util/AreaReference.java | 43 ------------------- .../apache/poi/hssf/util/HSSFRegionUtil.java | 4 +- .../apache/poi/hssf/util/PaneInformation.java | 30 ------------- .../apache/poi/ss/formula/ptg/AreaPtg.java | 11 ----- .../org/apache/poi/ss/util/AreaReference.java | 22 ---------- .../apache/poi/xssf/usermodel/XSSFShape.java | 28 ------------ .../poi/hssf/util/TestAreaReference.java | 10 ----- .../poi/ss/formula/eval/TestAreaEval.java | 4 +- .../poi/ss/formula/functions/EvalFactory.java | 4 +- .../poi/ss/formula/ptg/TestAreaPtg.java | 4 +- 10 files changed, 11 insertions(+), 149 deletions(-) delete mode 100644 src/java/org/apache/poi/hssf/util/AreaReference.java delete mode 100644 src/java/org/apache/poi/hssf/util/PaneInformation.java diff --git a/src/java/org/apache/poi/hssf/util/AreaReference.java b/src/java/org/apache/poi/hssf/util/AreaReference.java deleted file mode 100644 index 2bea3df3a..000000000 --- a/src/java/org/apache/poi/hssf/util/AreaReference.java +++ /dev/null @@ -1,43 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.util; - -import org.apache.poi.ss.SpreadsheetVersion; - -/** - * @deprecated POI 3.15 beta 3. Use {@link org.apache.poi.ss.util.AreaReference} instead. - */ -@Deprecated -public final class AreaReference extends org.apache.poi.ss.util.AreaReference { - /** - * Create an area ref from a string representation. Sheet names containing special characters should be - * delimited and escaped as per normal syntax rules for formulas.
- * The area reference must be contiguous (i.e. represent a single rectangle, not a union of rectangles) - */ - public AreaReference(String reference) { - super(reference, SpreadsheetVersion.EXCEL97); - } - - /** - * Creates an area ref from a pair of Cell References. - * Also normalises such that the top-left - */ - public AreaReference(CellReference topLeft, CellReference botRight) { - super(topLeft, botRight); - } -} diff --git a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java index 3cef98c4d..46eff91ed 100644 --- a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java +++ b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java @@ -26,10 +26,10 @@ import org.apache.poi.util.Removal; /** * Various utility functions that make working with a region of cells easier. - * @deprecated POI 3.18 + * @deprecated POI 4.0.0 * @see RegionUtil */ -@Removal(version="3.20") +@Removal(version="4.2") public final class HSSFRegionUtil { private HSSFRegionUtil() { diff --git a/src/java/org/apache/poi/hssf/util/PaneInformation.java b/src/java/org/apache/poi/hssf/util/PaneInformation.java deleted file mode 100644 index d0382961e..000000000 --- a/src/java/org/apache/poi/hssf/util/PaneInformation.java +++ /dev/null @@ -1,30 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.util; - -/** - * Holds information regarding a split plane or freeze plane for a sheet. - * @deprecated POI 3.15 beta 3. Use {@link org.apache.poi.ss.util.PaneInformation} instead. - */ -public class PaneInformation extends org.apache.poi.ss.util.PaneInformation -{ - public PaneInformation(short x, short y, short top, short left, byte active, boolean frozen) { - super(x, y, top, left, active, frozen); - } - -} diff --git a/src/java/org/apache/poi/ss/formula/ptg/AreaPtg.java b/src/java/org/apache/poi/ss/formula/ptg/AreaPtg.java index c6371a8ce..93f9a0633 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/AreaPtg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/AreaPtg.java @@ -17,10 +17,8 @@ package org.apache.poi.ss.formula.ptg; -import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.util.AreaReference; import org.apache.poi.util.LittleEndianInput; -import org.apache.poi.util.Removal; /** * Specifies a rectangular area of cells A1:A4 for instance. @@ -36,15 +34,6 @@ public final class AreaPtg extends Area2DPtgBase { public AreaPtg(LittleEndianInput in) { super(in); } - - /** - * @deprecated use {@link #AreaPtg(AreaReference)} instead - */ - @Deprecated() - @Removal(version="3.19") - public AreaPtg(String arearef) { - this(new AreaReference(arearef, SpreadsheetVersion.EXCEL97)); - } public AreaPtg(AreaReference arearef) { super(arearef); diff --git a/src/java/org/apache/poi/ss/util/AreaReference.java b/src/java/org/apache/poi/ss/util/AreaReference.java index 44fcab2b6..309ed51e5 100644 --- a/src/java/org/apache/poi/ss/util/AreaReference.java +++ b/src/java/org/apache/poi/ss/util/AreaReference.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.StringTokenizer; import org.apache.poi.ss.SpreadsheetVersion; -import org.apache.poi.util.Removal; public class AreaReference { @@ -105,16 +104,6 @@ public class AreaReference { } return true; } - - /** - * Creates an area ref from a pair of Cell References. - * @deprecated use {@link #AreaReference(CellReference, CellReference, SpreadsheetVersion)} instead - */ - @Deprecated - @Removal(version="3.19") - public AreaReference(CellReference topLeft, CellReference botRight) { - this(topLeft, botRight, DEFAULT_SPREADSHEET_VERSION); - } /** * Creates an area ref from a pair of Cell References. @@ -217,17 +206,6 @@ public class AreaReference { return isWholeColumnReference(_version, _firstCell, _lastCell); } - /** - * Takes a non-contiguous area reference, and returns an array of contiguous area references - * @return an array of contiguous area references. - * @deprecated use {@link #generateContiguous(SpreadsheetVersion, String)} instead - */ - @Deprecated - @Removal(version="3.19") - public static AreaReference[] generateContiguous(String reference) { - return generateContiguous(DEFAULT_SPREADSHEET_VERSION, reference); - } - /** * Takes a non-contiguous area reference, and returns an array of contiguous area references * @return an array of contiguous area references. diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java index 9ecff2670..8f7489434 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java @@ -18,7 +18,6 @@ package org.apache.poi.xssf.usermodel; import org.apache.poi.ss.usermodel.Shape; -import org.apache.poi.util.Removal; import org.apache.poi.util.Units; import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties; import org.openxmlformats.schemas.drawingml.x2006.main.CTNoFillProperties; @@ -32,33 +31,6 @@ import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal; * Represents a shape in a SpreadsheetML drawing. */ public abstract class XSSFShape implements Shape { - /** - * @deprecated POI 3.17 beta 1 - * @see Units#EMU_PER_PIXEL - */ - @Removal(version="3.19") - public static final int EMU_PER_PIXEL = Units.EMU_PER_PIXEL; - - /** - * @deprecated POI 3.17 beta 1 - * @see Units#EMU_PER_POINT - */ - @Removal(version="3.19") - public static final int EMU_PER_POINT = Units.EMU_PER_POINT; - - /** - * @deprecated POI 3.17 beta 1 - * @see Units#POINT_DPI - */ - @Removal(version="3.19") - public static final int POINT_DPI = Units.POINT_DPI; - - /** - * @deprecated POI 3.17 beta 1 - * @see Units#PIXEL_DPI - */ - @Removal(version="3.19") - public static final int PIXEL_DPI = Units.PIXEL_DPI; /** * Parent drawing diff --git a/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java b/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java index c14ca44e4..8668b9568 100644 --- a/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java +++ b/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java @@ -274,16 +274,6 @@ public final class TestAreaReference extends TestCase { confirmWholeColumnRef("AD:$AE", 29, 30, false, true); } - @SuppressWarnings("deprecation") - public void testDeprecatedMethod() { - String refSimple = "$C$10:$C$10"; - AreaReference[] arefs1 = AreaReference.generateContiguous(SpreadsheetVersion.EXCEL97, refSimple); - AreaReference[] arefs2 = AreaReference.generateContiguous(refSimple); - assertEquals(1, arefs1.length); - assertEquals(arefs1.length, arefs2.length); - assertEquals(arefs1[0].formatAsString(), arefs2[0].formatAsString()); - } - private static void confirmWholeColumnRef(String ref, int firstCol, int lastCol, boolean firstIsAbs, boolean lastIsAbs) { AreaReference ar = new AreaReference(ref, SpreadsheetVersion.EXCEL97); confirmCell(ar.getFirstCell(), 0, firstCol, true, firstIsAbs); diff --git a/src/testcases/org/apache/poi/ss/formula/eval/TestAreaEval.java b/src/testcases/org/apache/poi/ss/formula/eval/TestAreaEval.java index a3ace443d..8df7ced33 100644 --- a/src/testcases/org/apache/poi/ss/formula/eval/TestAreaEval.java +++ b/src/testcases/org/apache/poi/ss/formula/eval/TestAreaEval.java @@ -20,8 +20,10 @@ package org.apache.poi.ss.formula.eval; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.ptg.AreaPtg; import org.apache.poi.ss.formula.functions.EvalFactory; +import org.apache.poi.ss.util.AreaReference; /** * Tests for AreaEval @@ -32,7 +34,7 @@ public final class TestAreaEval extends TestCase { public void testGetValue_bug44950() { // TODO - this test probably isn't testing much anymore - AreaPtg ptg = new AreaPtg("B2:D3"); + AreaPtg ptg = new AreaPtg(new AreaReference("B2:D3", SpreadsheetVersion.EXCEL97)); NumberEval one = new NumberEval(1); ValueEval[] values = { one, diff --git a/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java b/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java index dfe8e53e9..345b4fb80 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/EvalFactory.java @@ -17,6 +17,7 @@ package org.apache.poi.ss.formula.functions; +import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.TwoDEval; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.AreaEvalBase; @@ -28,6 +29,7 @@ import org.apache.poi.ss.formula.ptg.AreaI; import org.apache.poi.ss.formula.ptg.AreaPtg; import org.apache.poi.ss.formula.ptg.Ref3DPtg; import org.apache.poi.ss.formula.ptg.RefPtg; +import org.apache.poi.ss.util.AreaReference; /** * Test helper class for creating mock Eval objects @@ -45,7 +47,7 @@ public final class EvalFactory { * @param values empty (null) entries in this array will be converted to NumberEval.ZERO */ public static AreaEval createAreaEval(String areaRefStr, ValueEval[] values) { - AreaPtg areaPtg = new AreaPtg(areaRefStr); + AreaPtg areaPtg = new AreaPtg(new AreaReference(areaRefStr, SpreadsheetVersion.EXCEL2007)); return createAreaEval(areaPtg, values); } diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java index 4c7dadc4c..1192b7ed9 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaPtg.java @@ -22,6 +22,8 @@ import junit.framework.TestCase; import org.apache.poi.hssf.model.HSSFFormulaParser; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.SpreadsheetVersion; +import org.apache.poi.ss.util.AreaReference; /** * Tests for {@link AreaPtg}. @@ -44,7 +46,7 @@ public final class TestAreaPtg extends TestCase { } public static void testSortTopLeftToBottomRight() { - AreaPtg ptg = new AreaPtg("A$1:$B5"); + AreaPtg ptg = new AreaPtg(new AreaReference("A$1:$B5", SpreadsheetVersion.EXCEL2007)); assertEquals("A$1:$B5", ptg.toFormulaString()); ptg.setFirstColumn(3); assertEquals("Area Ptg should not implicitly re-sort itself (except during construction)",