8325189: Enable this-escape javac warning in java.base

Reviewed-by: alanb, erikj, naoto, smarks, ihse, joehw, lancea, weijun
This commit is contained in:
Joe Darcy 2024-02-07 20:05:11 +00:00
parent 299a8ee68d
commit fbd15b2087
93 changed files with 151 additions and 2 deletions

View file

@ -104,6 +104,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
*
* @param name the name of {@code Attribute}
*/
@SuppressWarnings("this-escape")
protected Attribute(String name) {
this.name = name;
if (this.getClass() == Attribute.class) {

View file

@ -223,6 +223,7 @@ public class AttributedString {
* beginIndex and endIndex is out of the text range.
* @see java.text.Annotation
*/
@SuppressWarnings("this-escape")
public AttributedString(AttributedCharacterIterator text,
int beginIndex,
int endIndex,

View file

@ -937,6 +937,7 @@ public abstract class DateFormat extends Format {
* be used, but {@code -1} should be used for values
* that don't correspond to legal {@code Calendar} values
*/
@SuppressWarnings("this-escape")
protected Field(String name, int calendarField) {
super(name);
this.calendarField = calendarField;

View file

@ -449,6 +449,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
@SuppressWarnings("this-escape")
public DecimalFormat() {
// Get the pattern for the default locale.
Locale def = Locale.getDefault(Locale.Category.FORMAT);
@ -485,6 +486,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getCurrencyInstance
* @see java.text.NumberFormat#getPercentInstance
*/
@SuppressWarnings("this-escape")
public DecimalFormat(String pattern) {
// Always applyPattern after the symbols are set
this.symbols = DecimalFormatSymbols.getInstance(Locale.getDefault(Locale.Category.FORMAT));
@ -515,6 +517,7 @@ public class DecimalFormat extends NumberFormat {
* @see java.text.NumberFormat#getPercentInstance
* @see java.text.DecimalFormatSymbols
*/
@SuppressWarnings("this-escape")
public DecimalFormat (String pattern, DecimalFormatSymbols symbols) {
// Always applyPattern after the symbols are set
this.symbols = (DecimalFormatSymbols)symbols.clone();
@ -4199,6 +4202,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMaximumIntegerDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int maximumIntegerDigits = super.getMaximumIntegerDigits();
/**
@ -4211,6 +4215,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMinimumIntegerDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int minimumIntegerDigits = super.getMinimumIntegerDigits();
/**
@ -4223,6 +4228,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMaximumFractionDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int maximumFractionDigits = super.getMaximumFractionDigits();
/**
@ -4235,6 +4241,7 @@ public class DecimalFormat extends NumberFormat {
* @see #getMinimumFractionDigits
* @since 1.5
*/
@SuppressWarnings("this-escape")
private int minimumFractionDigits = super.getMinimumFractionDigits();
/**

View file

@ -1258,6 +1258,7 @@ public abstract class NumberFormat extends Format {
*
* @param name Name of the attribute
*/
@SuppressWarnings("this-escape")
protected Field(String name) {
super(name);
if (this.getClass() == NumberFormat.Field.class) {

View file

@ -278,6 +278,7 @@ public class RuleBasedCollator extends Collator{
* example, build rule "a < ? < d" will cause the constructor to
* throw the ParseException because the '?' is not quoted.
*/
@SuppressWarnings("this-escape")
public RuleBasedCollator(String rules) throws ParseException {
this(rules, Collator.CANONICAL_DECOMPOSITION);
}