-
Bug
-
Resolution: Unresolved
-
P4
-
16
5.1.11 defines _string conversion_ for primitive types in terms of a wrapper class constructor call followed by a 'toString' call.
The wrapper class constructors are now deprecated for removal, and JLS should not depend on them. Note that their use is incidental: the behavior of string conversion does not depend on the identities of its intermediate results, and `javac` does not, in fact, call them. (It used to use specialized StringBuilder.append methods; now it uses StringConcatFactory.makeConcatWithConstants with a specialized descriptor.)
Suggested alternative: define string conversions (5.1.11) only for reference types; then allow string contexts (5.4) to apply boxing conversion before string conversion. (Why not include boxing in 5.1.11? Well, that's not really the intent of 5.1, which defines a number of independent small operations that can be combined in different contexts.)
The wrapper class constructors are now deprecated for removal, and JLS should not depend on them. Note that their use is incidental: the behavior of string conversion does not depend on the identities of its intermediate results, and `javac` does not, in fact, call them. (It used to use specialized StringBuilder.append methods; now it uses StringConcatFactory.makeConcatWithConstants with a specialized descriptor.)
Suggested alternative: define string conversions (5.1.11) only for reference types; then allow string contexts (5.4) to apply boxing conversion before string conversion. (Why not include boxing in 5.1.11? Well, that's not really the intent of 5.1, which defines a number of independent small operations that can be combined in different contexts.)
- relates to
-
JDK-8249100 JEP 390: Warnings for Value-Based Classes
- Closed