Add a new modifier __DeprecatedToPrivate for methods, fields, and classes. This modifier may be added to any public, protected, or package-private declaration. The effect of the modifier is to compile the API point as if the modifier were not present. But javac refuses to compile references to such names, unless they are in the same nest (for methods and fields) or package (for types). It is as if the access protection were rewritten, during source compilation only, to private (for methods and fields) and package-private (for types).
A reasonable spelling for __DeprecatedToPrivate (which is a working title) might be @Deprecated(privatized=true).
Background:
The translation strategy and JVM have a mechanism for totally submerging such methods, so that they are no longer visible to the source code; it’s ACC_SYNTHETIC. A synthetic method occupies a descriptor and is linkable and reflectable but cannot be used from source code.
There is no syntax for defining such things in source code; the compiler back end spits them out into class files. But if these noxious methods were to be deprecated to the point of unusability *in source code*, yet still needed to be present as linkage points for old classfiles, we could create a marking, and a user model, for keeping them around.
A reasonable spelling for __DeprecatedToPrivate (which is a working title) might be @Deprecated(privatized=true).
Background:
The translation strategy and JVM have a mechanism for totally submerging such methods, so that they are no longer visible to the source code; it’s ACC_SYNTHETIC. A synthetic method occupies a descriptor and is linkable and reflectable but cannot be used from source code.
There is no syntax for defining such things in source code; the compiler back end spits them out into class files. But if these noxious methods were to be deprecated to the point of unusability *in source code*, yet still needed to be present as linkage points for old classfiles, we could create a marking, and a user model, for keeping them around.