commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Savarese (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (NET-396) POP3.setState() should not be public
Date Mon, 11 Apr 2011 03:31:05 GMT

     [ https://issues.apache.org/jira/browse/NET-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Savarese reopened NET-396:
---------------------------------

      Assignee: Daniel Savarese

setState is supposed to be public.  As I originally documented over a decade ago:
  "The POP3 class ... is provided only so that you may easily implement your own POP3 client
..."

That is no longer possible with this change.  The function must be public so the class can
be used via aggregation as well as derivation by third-party code.  Classes like POP3 (better
thought of as instantiable namespaces instead of conventional objects) were intended to provide
raw protocol access and maximum flexibility, not to protect the programmer from shooting himself
in the foot.  Otherwise, there would be no base protocol classes and only FooClient classes.
 It was always intended for it to be possible for adventurous programmers to use the base
protocol classes outside of their packages.

I'm not defending the outdated design--Commons Net has been in need of a rewrite for many
years, but the incremental patching approach was the path of least resistance.  Nonetheless,
I'd like to revert the change before the 3.0 release.

> POP3.setState() should not be public
> ------------------------------------
>
>                 Key: NET-396
>                 URL: https://issues.apache.org/jira/browse/NET-396
>             Project: Commons Net
>          Issue Type: Bug
>          Components: POP3
>    Affects Versions: 2.2
>            Reporter: Sebb
>            Assignee: Daniel Savarese
>             Fix For: 3.0
>
>
> The POP3 method setState() is public. However, the state should only be settable by library
methods, not by client code, otherwise the state checks won't work correctly.
> Changing the visibility would break binary compatibility.
> To maintain compatibility there could be a new method (package-private, which would give
test cases access) which is allowed to set the state. Also change the public method to either
do nothing or throw an UnsupportedOperationException.
> The getState() method can remain public.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message