[I'm filling this as DEFECT only so that it stays on our radar and gets implemented for 6.9]
Following technologies will be made optional in next release of EE (>6):
EJB 2.x entity beans
JSR-88 (Deployment API)
Consequently, a number of API packages are proposed optional:
"Note that these APIs are not deprecated as such. In particular, they are not tagged in the javadocs nor annotate specially. From the point of view of the API itself, everything is fine; it's in the context of the platform that we want to discourage developers from using these APIs in their new applications."
I would suggest to start with very simple solution. We can create an hint, which will appear in the editor where the developer is using class from the optional packages, notifying him about the problem. This is the simplest solution which don't require any API changes. Once there is more and more optional packages we can provide better UI support (marking classes in code completion etc.). Such a solution will require API changes.
Fixed - references to classes from optional packages will have WARNING hint with text saying "Be aware that this API will be optional in EE 7 platform". Hint is enabled by default and users can turn it off if they desire so.