mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8226585: Improve javac messages for using a preview API
Avoiding deprecation for removal for APIs associated with preview features, the features are marked with an annotation, and errors/warnings are produced for them based on the annotation. Co-authored-by: Joe Darcy <joe.darcy@oracle.com> Reviewed-by: erikj, mcimadamore, alanb
This commit is contained in:
parent
f771978f53
commit
a1894385b3
43 changed files with 794 additions and 166 deletions
|
@ -2888,6 +2888,15 @@ public final class String
|
|||
}
|
||||
|
||||
/**
|
||||
* {@preview Associated with text blocks, a preview feature of
|
||||
* the Java language.
|
||||
*
|
||||
* This method is associated with <i>text blocks</i>, a preview
|
||||
* feature of the Java language. Programs can only use this
|
||||
* method when preview features are enabled. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Returns a string whose value is this string, with incidental
|
||||
* {@linkplain Character#isWhitespace(int) white space} removed from
|
||||
* the beginning and end of every line.
|
||||
|
@ -2963,10 +2972,9 @@ public final class String
|
|||
*
|
||||
* @since 13
|
||||
*
|
||||
* @deprecated This method is associated with text blocks, a preview language feature.
|
||||
* Text blocks and/or this method may be changed or removed in a future release.
|
||||
*/
|
||||
@Deprecated(forRemoval=true, since="13")
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
|
||||
essentialAPI=true)
|
||||
public String stripIndent() {
|
||||
int length = length();
|
||||
if (length == 0) {
|
||||
|
@ -3005,6 +3013,15 @@ public final class String
|
|||
}
|
||||
|
||||
/**
|
||||
* {@preview Associated with text blocks, a preview feature of
|
||||
* the Java language.
|
||||
*
|
||||
* This method is associated with <i>text blocks</i>, a preview
|
||||
* feature of the Java language. Programs can only use this
|
||||
* method when preview features are enabled. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Returns a string whose value is this string, with escape sequences
|
||||
* translated as if in a string literal.
|
||||
* <p>
|
||||
|
@ -3079,11 +3096,9 @@ public final class String
|
|||
* @jls 3.10.7 Escape Sequences
|
||||
*
|
||||
* @since 13
|
||||
*
|
||||
* @deprecated This method is associated with text blocks, a preview language feature.
|
||||
* Text blocks and/or this method may be changed or removed in a future release.
|
||||
*/
|
||||
@Deprecated(forRemoval=true, since="13")
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
|
||||
essentialAPI=true)
|
||||
public String translateEscapes() {
|
||||
if (isEmpty()) {
|
||||
return "";
|
||||
|
@ -3309,6 +3324,15 @@ public final class String
|
|||
}
|
||||
|
||||
/**
|
||||
* {@preview Associated with text blocks, a preview feature of
|
||||
* the Java language.
|
||||
*
|
||||
* This method is associated with <i>text blocks</i>, a preview
|
||||
* feature of the Java language. Programs can only use this
|
||||
* method when preview features are enabled. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Formats using this string as the format string, and the supplied
|
||||
* arguments.
|
||||
*
|
||||
|
@ -3324,10 +3348,9 @@ public final class String
|
|||
*
|
||||
* @since 13
|
||||
*
|
||||
* @deprecated This method is associated with text blocks, a preview language feature.
|
||||
* Text blocks and/or this method may be changed or removed in a future release.
|
||||
*/
|
||||
@Deprecated(forRemoval=true, since="13")
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS,
|
||||
essentialAPI=true)
|
||||
public String formatted(Object... args) {
|
||||
return new Formatter().format(this, args).toString();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue