Skip to content

Commit

Permalink
3.x: Patch out duplicate @nonnull annotation in generated javadocs (#…
Browse files Browse the repository at this point in the history
…7073)

* 3.x: Patch out duplicate @nonnull annotation in generated javadocs

* Replace different pattern for Javadocs 8
  • Loading branch information
akarnokd authored Sep 12, 2020
1 parent 0f21ba8 commit ffe2fcc
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions gradle/javadoc_cleanup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ def fixJavadocFile(file) {
// lots of spaces after the @Nullable annotations
fileContents = fileContents.replaceAll("@Nullable</a>\\s{4,}", "@Nullable</a> ");

// javadoc bug: duplicates the link to @NonNull for some reason
def nonNullText1 = "<a href=\"../annotations/NonNull.html\" title=\"annotation in io.reactivex.rxjava3.annotations\">@NonNull</a>";

fileContents = fileContents.replace(nonNullText1 + " " + nonNullText1, nonNullText1);
fileContents = fileContents.replace(nonNullText1 + "\n " + nonNullText1, nonNullText1);
fileContents = fileContents.replace(nonNullText1 + "\r\n " + nonNullText1, nonNullText1);

def nonNullText2 = "<a href=\"../../../../io/reactivex/rxjava3/annotations/NonNull.html\" title=\"annotation in io.reactivex.rxjava3.annotations\">@NonNull</a>";
fileContents = fileContents.replace(nonNullText2 + " " + nonNullText2, nonNullText2);
fileContents = fileContents.replace(nonNullText2 + "\n " + nonNullText2, nonNullText2);
fileContents = fileContents.replace(nonNullText2 + "\r\n " + nonNullText2, nonNullText2);

// javadoc bug: duplicates the link to @Nullable for some reason
def nullableText1 = "<a href=\"../annotations/Nullable.html\" title=\"annotation in io.reactivex.rxjava3.annotations\">@Nullable</a>";

fileContents = fileContents.replace(nullableText1 + " " + nullableText1, nullableText1);
fileContents = fileContents.replace(nullableText1 + "\n " + nullableText1, nullableText1);
fileContents = fileContents.replace(nullableText1 + "\r\n " + nullableText1, nullableText1);

def nullableText2 = "<a href=\"../../../../io/reactivex/rxjava3/annotations/Nullable.html\" title=\"annotation in io.reactivex.rxjava3.annotations\">@Nullable</a>";

fileContents = fileContents.replace(nullableText2 + " " + nullableText2, nullableText2);
fileContents = fileContents.replace(nullableText2 + "\n " + nullableText2, nullableText2);
fileContents = fileContents.replace(nullableText2 + "\r\n " + nullableText2, nullableText2);

file.setText(fileContents, 'UTF-8');
}

Expand Down

0 comments on commit ffe2fcc

Please sign in to comment.