RFR: 8321428: Deprecate for removal the package java.beans.beancontext [v2]

Alexey Ivanov aivanov at openjdk.org
Tue Apr 9 14:00:06 UTC 2024


On Tue, 2 Apr 2024 16:58:19 GMT, Larry Cable <duke at openjdk.org> wrote:

>> the beancontext package was added (by me) in JDK 1.2 to provide JavaBeans(tm) with a containment and services hierarchy.
>> 
>> based upon concepts from OpenDoc, which was a popular component model at the time, the API pre-dated the addition of language features such as annotations, and the invention and adoption of programming design patterns such as "Inversion of Control"  and/or "Dependency Injection".
>> 
>> This API (package) has not evolved with either the language or current design trends, as such it is, at best, anachronistic, and is probably an anti-pattern that should be avoided.
>> 
>> This package is therefore deprecated **FOR REMOVAL IN AT FUTURE RELEASE**
>
> Larry Cable has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into 8321428
>  - added deprecation message to package-info as requested
>  - 8321428: Deprecate for removal the package java.beans.beancontext

Should the copyright year be bumped to 2024 in all the modified files?

src/java.desktop/share/classes/java/beans/Beans.java line 106:

> 104:      * @since 1.2
> 105:      */
> 106:     @Deprecated(since = "23", forRemoval = true)

In other places, you didn't add spaces around `=` and used the reversed order of `since` and `forRemoval` attributes.

In majority of other files in this PR, `@SuppressWarnings` precedes `@Deprecated`.

src/java.desktop/share/classes/java/beans/beancontext/BeanContextChild.java line 69:

> 67: 
> 68: @SuppressWarnings("removal")
> 69: @Deprecated(forRemoval=true, since="23")

Suggestion:

@Deprecated(since="23", forRemoval=true)

The most common order of attributes in JDK is `since` followed by `forRemoval`. Should this package be consistent with other deprecated classes?

https://github.com/openjdk/jdk/blob/5fb5e6c8f04e325cbb782431d51251edde4c2618/src/java.base/share/classes/java/lang/Double.java#L1017-L1019

https://github.com/openjdk/jdk/blob/71c5bbcec7052a8394dd49c0a8c46801adbfcae4/src/java.base/share/classes/java/lang/SecurityManager.java#L316-L317

src/java.desktop/share/classes/java/beans/beancontext/package-info.java line 41:

> 39:  * Users are advised to migrate their applications to other technologies.
> 40:  *
> 41:  * @since 1.2

Is is possible to add `@Deprecated` annotation to the package?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18569#issuecomment-2045243209
PR Review Comment: https://git.openjdk.org/jdk/pull/18569#discussion_r1557661383
PR Review Comment: https://git.openjdk.org/jdk/pull/18569#discussion_r1557664034
PR Review Comment: https://git.openjdk.org/jdk/pull/18569#discussion_r1557656116


More information about the client-libs-dev mailing list