Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

JavaDoc for string prefence fields with empty default value seems incomplete #1877

Copy link
Copy link
@ironjan

Description

@ironjan
Issue body actions

Issue

The javadoc for @SharedPrefs is generated in SharedPrefHolder like so:

if (defaultValueStr != null) {
    fieldMethod.javadoc().append("<p><b>Defaults to</b>: " + defaultValueStr + "</p>\n");
}

The following example shows what javadocs are generated. The empty default strings lead to a javadoc that seems incomplete when viewed with Android Studio.

@SharedPref
public interface PreferencesInterface {
    // also works with @DefaultString("")
    // will generate "<p><b>Defaults to</b>: </p>"
   String stringField();

   // will generate "<p><b>Defaults to</b>: not empty</p>"
   @DefaultString("not empty")
   String anotherStringField();
}

bildschirmfoto zu 2016-10-16_13-41-52

Suggestions

One possibility would be to include back-ticks in the generated javadoc. This seems to me like a clean solution; I have seen this in ruby docs but not yet in the "java world".

<p><b>Defaults to</b>: `" + defaultValueStr + "`</p>\n

This would generate javadocs like the following:

for empty strings:
  <p><b>Defaults to</b>: ``</p>
for @DefaultString("non-empty")
  <p><b>Defaults to</b>: `non-empty`</p>
for an int field as non-String example
  <p><b>Defaults to</b>: `0`</p>

Another possibility would be to handle strings so that docs like <p><b>Defaults to</b>: ""</p> or <p><b>Defaults to</b>: "not empty"</p> are generated.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.