[Bug 63118] New: proposal: make Cell.setSellType(CellType.FORMULA) illegal

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 63118] New: proposal: make Cell.setSellType(CellType.FORMULA) illegal

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63118

            Bug ID: 63118
           Summary: proposal: make Cell.setSellType(CellType.FORMULA)
                    illegal
           Product: POI
           Version: 4.0.x-dev
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: SS Common
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Motivation: as well as any setCellType call doesn't make much sense and implies
implicit conversions/default value setting, calling
setCellType(CellType.FORMULA) makes even less sense because formula has no
default value and cannot be null. Setting formula to "0" is a workaround and,
again, is an implicit (i.e. counter-intuitive) side effect.

In all the test suite, I didn't find any reasonable usage of this call. There
were a bunch of calls in test SetUp methods (obviously, redundant) and a call
in XSSFCell ctor. *Perhaps* it wins a tiny bit in terms of performance,
although I very much doubt it.

I have the change ready and tested but am open to obections/discussion. The
change is documented in Cell interface.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63118

[hidden email] <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|proposal: make              |proposal: make
                   |Cell.setSellType(CellType.F |Cell.setCellType(CellType.F
                   |ORMULA) illegal             |ORMULA) illegal

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63118

--- Comment #1 from Andreas Beeker <[hidden email]> ---
I'm +1 for making it illegal

- throw an exception with a hint (to using setCellFormula instead?) now
- mark setCellType deprecated for removal in POI 5

please also check the examples/docs for references to it

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63118

[hidden email] <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from [hidden email] <[hidden email]> ---
Implemented in r1852244 - r1852247.

Changes:
* setCellType is now deprecated (@Removal = 5.0)
* setCellType(FORMULA) on a non-formula cell is illegal and throws an IAE with
a message suggesting to use setCellFormula directly.
* setCellType(FORMULA) on a formula cell does nothing
* added Cell.setBlank() to be the only use case that will survive the removal
of setCellType. Current implementation delegates to setCellType(BLANK), but at
least that's not a part of the public API.
* purged most calls to setCellType within the project. setCellType(BLANK) were
replaced with setBlank, calls with other arguments were removed wherever
possible (i.e. where it didn't break tests). Mostly these calls were in the
test suite. The only (if I didn't miss something) calls were left in tests to
verify value conversions. This logic/tests will pass away when setCellType is
removed.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]