Skip to content

[Native Image] Inconsistent appending of "." in deprecation error messages. #11556

Open
@edburns

Description

@edburns

Describe the Issue

See #11554 . Notice the error message there has two periods at the end:

Consider including proxy configuration in the reflection section of reachability-metadata.md instead.. 

The reason for this is inconsistency between the values of the deprecationMessage attribute and callsites that interpolate those values.

From Copilot:

Here is a list of all code locations in the Graal codebase that call getDeprecationMessage() on OptionDescriptor for the purpose of interpolating it into a message string. For each, I indicate whether a "." is prepended (inserted before or after the deprecation message), so you can decide if the period should be in the attribute or in the interpolation code.


1. substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/SubstrateOptionsParser.java

Location:
parseHostedOption method

Usage:

if (deprecationMessage != null && !deprecationMessage.isEmpty()) {
    message += ": " + deprecationMessage;
}
message += ". Please refer to the GraalVM release notes.";
  • "." prepended or appended?: Appended after the deprecation message (always adds a period after, regardless of whether it's already in the message).

2. substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionParser.java

Location:
parseOptionAtRuntime method

Usage:

if (deprecationMessage != null && !deprecationMessage.isEmpty()) {
    log.string(": ").string(deprecationMessage);
}
log.newline();
  • "." prepended or appended?: No period added by the code (the message is interpolated as-is).

3. sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/Launcher.java

Location:
argument parsing logic

Usage:

String messageFormat = "Option '%s' is deprecated and might be removed from future versions.";
String deprecationMessage = descriptor.getDeprecationMessage();
String message;
if (deprecationMessage != null) {
    message = String.format(messageFormat + "%n%s", descriptor.getName(), deprecationMessage);
} else {
    message = String.format(messageFormat, descriptor.getName());
}
warn(message);
  • "." prepended or appended?: No period added before or after the deprecation message (since the format string already ends in a period, the deprecation message starts on a new line).

4. truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotEngineImpl.java

Location:
printDeprecatedOptionsWarning method

Usage:

String.format("Option '%s' is deprecated: %s. Please update the option or suppress this warning using the option 'engine.WarnOptionDeprecation=false'.",
    key.getName(), key.getDeprecationMessage())
  • "." prepended or appended?: A period is always appended after the deprecation message (regardless of whether the message already ends with a period).

5. substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionValues.java

Location:
asDescriptor helper method

Usage:

return new DescriptorImpl(descriptor.getName(), help, ..., descriptor.isDeprecated(), descriptor.getDeprecationMessage());
  • "." prepended or appended?: N/A (just stores the value, not for message printing).

Summary Table

File/Method Appends/prepends "." to deprecation message?
SubstrateOptionsParser.parseHostedOption Yes, always appends a period after
RuntimeOptionParser.parseOptionAtRuntime No period added
Launcher.java (argument parsing) No period added
PolyglotEngineImpl.printDeprecatedOptionsWarning Yes, always appends a period after
RuntimeOptionValues (DescriptorImpl record) N/A (not message interpolation)

Conclusion:

  • Some places (SubstrateOptionsParser, PolyglotEngineImpl) always append a period after the deprecation message, even if one is already present.
  • Others (RuntimeOptionParser, Launcher) do not add a period, and print the deprecation message as-is.
  • There is inconsistency, so it's best to ensure the code that interpolates the deprecation message is responsible for punctuation, NOT the message itself, to avoid double periods (". .").

View more results in GitHub code search.

Let me know if you need the result for additional files or more details!

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

See #11554.

Operating System and Version

See #11554.

Build Command

See #11554.

Expected Behavior

Error messages do not have "..".

Actual Behavior

Error messages do have ".."

Steps to Reproduce

See #11554.

Additional Context

No response

Build Log Output and Error Messages

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions