From: Josh Micich Date: Fri, 4 Dec 2009 23:05:06 +0000 (+0000) Subject: Removed generic type parameter from OperandPtg because it was not worth the extra... X-Git-Tag: REL_3_6~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4a7c19343f8b7c3850b5e407c94c194a42d37e16;p=poi.git Removed generic type parameter from OperandPtg because it was not worth the extra syntax. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@887432 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java index c01cf77a34..0b06258558 100644 --- a/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/SharedFormulaRecord.java @@ -130,9 +130,9 @@ public final class SharedFormulaRecord extends SharedValueRecordBase { areaNPtg.isFirstColRelative(), areaNPtg.isLastColRelative()); ptg.setClass(originalOperandClass); - } else if (ptg instanceof OperandPtg) { + } else if (ptg instanceof OperandPtg) { // Any subclass of OperandPtg is mutable, so it's safest to not share these instances. - ptg = ((OperandPtg) ptg).copy(); + ptg = ((OperandPtg) ptg).copy(); } else { // all other Ptgs are immutable and can be shared } diff --git a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java index 68398bb70c..27a7edd9b8 100644 --- a/src/java/org/apache/poi/hssf/record/TextObjectRecord.java +++ b/src/java/org/apache/poi/hssf/record/TextObjectRecord.java @@ -75,7 +75,7 @@ public final class TextObjectRecord extends ContinuableRecord { */ private int _unknownPreFormulaInt; /** expect tRef, tRef3D, tArea, tArea3D or tName */ - private OperandPtg _linkRefPtg; + private OperandPtg _linkRefPtg; /** * Not clear if needed . Excel seems to be OK if this byte is not present. * Value is often the same as the earlier firstColumn byte. */ @@ -108,7 +108,7 @@ public final class TextObjectRecord extends ContinuableRecord { throw new RecordFormatException("Read " + ptgs.length + " tokens but expected exactly 1"); } - _linkRefPtg = (OperandPtg) ptgs[0]; + _linkRefPtg = (OperandPtg) ptgs[0]; if (in.remaining() > 0) { _unknownPostFormulaByte = Byte.valueOf(in.readByte()); } else { diff --git a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java index 2acbaf3e1e..d8d855b07b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java @@ -32,7 +32,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author avik * @author Jason Height (jheight at chariot dot net dot au) */ -public final class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken { +public final class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken { public final static byte sid = 0x3b; private final static int SIZE = 11; // 10 + 1 for Ptg diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaPtgBase.java b/src/java/org/apache/poi/hssf/record/formula/AreaPtgBase.java index d50fca02f9..8c6863ef21 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaPtgBase.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaPtgBase.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author andy * @author Jason Height (jheight at chariot dot net dot au) */ -public abstract class AreaPtgBase> extends OperandPtg implements AreaI { +public abstract class AreaPtgBase extends OperandPtg implements AreaI { /** * TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas. * see similar comment in ReferencePtg diff --git a/src/java/org/apache/poi/hssf/record/formula/OperandPtg.java b/src/java/org/apache/poi/hssf/record/formula/OperandPtg.java index bd1490289c..b8cf6ed096 100644 --- a/src/java/org/apache/poi/hssf/record/formula/OperandPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/OperandPtg.java @@ -17,11 +17,10 @@ package org.apache.poi.hssf.record.formula; - /** * @author Josh Micich */ -public abstract class OperandPtg> extends Ptg implements Cloneable { +public abstract class OperandPtg extends Ptg implements Cloneable { /** * All Operand {@link Ptg}s are classified ('relative', 'value', 'array') @@ -29,11 +28,9 @@ public abstract class OperandPtg> extends Ptg implements public final boolean isBaseToken() { return false; } - public final Y copy() { + public final OperandPtg copy() { try { - @SuppressWarnings("unchecked") - Y result = (Y) clone(); - return result; + return (OperandPtg) clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } diff --git a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java index ece0e1c2c5..8d7fc79499 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java @@ -31,7 +31,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Libin Roman (Vista Portal LDT. Developer) * @author Jason Height (jheight at chariot dot net dot au) */ -public final class Ref3DPtg extends RefPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken { +public final class Ref3DPtg extends RefPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken { public final static byte sid = 0x3a; private final static int SIZE = 7; // 6 + 1 for Ptg diff --git a/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java b/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java index 28e7ebd9fb..70ed4da87a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java +++ b/src/java/org/apache/poi/hssf/record/formula/RefPtgBase.java @@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianOutput; * @author Andrew C. Oliver (acoliver@apache.org) * @author Jason Height (jheight at chariot dot net dot au) */ -public abstract class RefPtgBase> extends OperandPtg { +public abstract class RefPtgBase extends OperandPtg { /** The row index - zero based unsigned 16 bit value */ private int field_1_row; diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 612eb67b18..a935916bad 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -58,6 +58,7 @@ import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor; import org.apache.poi.hssf.record.formula.Area3DPtg; import org.apache.poi.hssf.record.formula.MemFuncPtg; import org.apache.poi.hssf.record.formula.NameXPtg; +import org.apache.poi.hssf.record.formula.OperandPtg; import org.apache.poi.hssf.record.formula.Ptg; import org.apache.poi.hssf.record.formula.Ref3DPtg; import org.apache.poi.hssf.record.formula.SheetNameFormatter; @@ -678,11 +679,11 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm Ptg ptg = ptgs[i]; if (ptg instanceof Area3DPtg) { - Area3DPtg a3p = ((Area3DPtg) ptg).copy(); + Area3DPtg a3p = (Area3DPtg) ((OperandPtg) ptg).copy(); a3p.setExternSheetIndex(newExtSheetIx); ptgs[i] = a3p; } else if (ptg instanceof Ref3DPtg) { - Ref3DPtg r3p = ((Ref3DPtg) ptg).copy(); + Ref3DPtg r3p = (Ref3DPtg) ((OperandPtg) ptg).copy(); r3p.setExternSheetIndex(newExtSheetIx); ptgs[i] = r3p; }