Skip to content

Fix errorprone and Javadoc warnings #2614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

inv-jishnu
Copy link
Contributor

@inv-jishnu inv-jishnu commented Apr 30, 2025

Description

This PR fixes error prone and java doc warnings and renamed logger param used from LOGGER to logger.
This PR was created based on following feedback from PR #2591.

Related issues and/or PRs

Changes made

I have made the following changes

  • Renamed LOGGER to logger
  • Changed assert to assertThat
  • Added SAME_NAME_BUT_DIFFERENT to ignore patterns that need to be ignored for data loader core project
  • Added suppress warning for SameNameButDifferent and MissingSummary and a few more.
  • Fixed few warning with minor code changes
  • Removed an unused class and a method

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

NA

Release notes

Fix warnings for java doc and error prone

@inv-jishnu inv-jishnu added the enhancement New feature or request label Apr 30, 2025
@inv-jishnu inv-jishnu self-assigned this Apr 30, 2025
@inv-jishnu inv-jishnu marked this pull request as draft April 30, 2025 04:25
@inv-jishnu inv-jishnu mentioned this pull request Apr 30, 2025
6 tasks
Base automatically changed from feat/data-loader/import-log-2 to master May 8, 2025 04:09
@inv-jishnu
Copy link
Contributor Author

inv-jishnu commented Jun 11, 2025

@brfrn169 san, @komamitsu san, @Torch3333 san,

I have made a change to use mutate instead of put in 0f03536 as there was a deprecation warning.

Also there are error: cannot find symbol warning remaining at 4 places which is related to lombok (lombok version and java version)
ex.
scalardb/data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/ExportOptions.java:43: error: cannot find symbol
public static ExportOptionsBuilder builder(
^
symbol: class ExportOptionsBuilder

@inv-jishnu
Copy link
Contributor Author

Removed a string format constant to remove a warning in bfad6d3.

scalardb/data-loader/cli/src/main/java/com/scalar/db/dataloader/cli/command/dataexport/ExportCommand.java:48: warning: [InlineFormatString] Prefer to create format strings inline, instead of extracting them to a single-use constant
  private static final String EXPORT_FILE_NAME_FORMAT = "export.%s.%s.%s.%s";
                              ^
    (see https://errorprone.info/bugpattern/InlineFormatString)

@brfrn169
Copy link
Collaborator

brfrn169 commented Jun 12, 2025

@inv-jishnu I found one more warning:

/Users/toshihiro.suzuki/work/scalar-labs/scalardb/data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/processor/ImportProcessor.java:90: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
          dataChunkProcessorExecutor.submit(
                                           ^
    (see https://errorprone.info/bugpattern/FutureReturnValueIgnored)
  Did you mean to remove this line?

@@ -4,6 +4,7 @@
import lombok.Value;

/** * The scan range which is used in data export scan filtering */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** * The scan range which is used in data export scan filtering */
/** The scan range which is used in data export scan filtering. */

@@ -4,7 +4,8 @@
import lombok.Builder;
import lombok.Data;

/** * Import data chunk data */
/** * Import data chunk data. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** * Import data chunk data. */
/** Import data chunk data. */

@@ -6,7 +6,8 @@
import lombok.Builder;
import lombok.Data;

/** * A DTO to store import data chunk details */
/** * A DTO to store import data chunk details. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** * A DTO to store import data chunk details. */
/** A DTO to store import data chunk details. */

@@ -6,6 +6,7 @@
import lombok.Value;

/** Transaction batch details */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Transaction batch details */
/** Transaction batch details. */

@@ -8,6 +8,7 @@
import lombok.Value;

/** Transaction batch result */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Transaction batch result */
/** Transaction batch result. */

@@ -37,7 +37,7 @@
</Match>
<!-- Ignore mutable object exposure warnings(caused by Lombok) for all classes in dataloader.core -->
<Match>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2,CT_CONSTRUCTOR_THROW"/>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2,CT_CONSTRUCTOR_THROW,SAME_NAME_BUT_DIFFERENT"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CT_CONSTRUCTOR_THROW and SAME_NAME_BUT_DIFFERENT are already excluded globally:

Suggested change
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2,CT_CONSTRUCTOR_THROW,SAME_NAME_BUT_DIFFERENT"/>
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>

@@ -107,7 +108,7 @@ public void put(

Put put = createPutWith(namespace, table, partitionKey, clusteringKey, columns);
try {
transaction.put(put);
transaction.mutate(Collections.singletonList(put));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we should use mutate() for a single mutation. Please continue using put() for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brfrn169 san,
I will revert this change.
Thank you.

@brfrn169 brfrn169 requested a review from ypeckstadt June 12, 2025 00:53
@brfrn169
Copy link
Collaborator

@inv-jishnu I also found many Javadoc errors and warnings. Please handle them in a separate PR.

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@inv-jishnu
Copy link
Contributor Author

@brfrn169 san,

Apart from error: cannot find symbol and a few deprecated warnings for put and Scan.Ordering (in CLI). I have fixed all warning that I have seen. If I missed any I will update the rest in another PR.
Thank you.

@inv-jishnu inv-jishnu requested a review from brfrn169 June 12, 2025 04:22
@brfrn169
Copy link
Collaborator

brfrn169 commented Jun 13, 2025

Apart from error: cannot find symbol and a few deprecated warnings for put and Scan.Ordering (in CLI). I have fixed all warning that I have seen.

@inv-jishnu Did you also mean Javadoc warnings? I still see many warnings like warning: no @param for ..., warning: no @return, and warning: no @throws ..., other than error: cannot find symbol.

Also, regarding Scan.Ordering, you can use the Scan.Ordering.asc() or Scan.Ordering.desc() methods to remove the warning.

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Copy link
Contributor

@ypeckstadt ypeckstadt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

On my side I don't see any errors or warnings anymore when I build it with Java 8. I do get a lot more warnings when building with Java 17 selected though but probably can be ignored for now.

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@brfrn169 brfrn169 changed the title Fix errorprone warnings Fix errorprone and Javadoc warnings Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants