[ 
https://issues.apache.org/jira/browse/OPENJPA-2958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109513#comment-18109513
 ] 

ASF subversion and git services commented on OPENJPA-2958:
----------------------------------------------------------

Commit 6691297c05b3565bef4579d38644142c9b0aab1a in openjpa's branch 
refs/heads/OPENJPA-2958 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=6691297c0 ]

[OPENJPA-2958] Add ImplHelper.registerUnenhancedInstance()

BrokerImpl reached into the public mutable ImplHelper._unenhancedInstanceMap
to register the persistence capable instance of an unenhanced one. Add a
method for it and route all three write sites through it, so the registry
is no longer written to from outside the class that owns it. Behaviour is
unchanged: the method is the same overwriting put.

The field is deprecated to point callers at the method. It stays public:
its type is a reference type, so it is never inlined into callers, and
making it private would turn into a NoSuchFieldError at runtime for
anything compiled against 4.1.x rather than a compile error on upgrade.
Making it private belongs in a major release.


> Direct access to ImplHelper._unenhancedInstanceMap
> --------------------------------------------------
>
>                 Key: OPENJPA-2958
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2958
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: jpa
>    Affects Versions: 4.2.0
>            Reporter: Maxim Solodovnik
>            Assignee: Richard Zowalla
>            Priority: Major
>             Fix For: 4.2.0
>
>
> Discussion thread: 
> https://github.com/apache/openjpa/pull/144#discussion_r3683000504
> **(low)** Reaching into `ImplHelper._unenhancedInstanceMap` (a public mutable 
> static field) directly is fragile - suggest a small 
> `ImplHelper.registerUnenhancedInstance(obj, pc)` method instead of exposing 
> the raw map.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to