New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 781018 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 781015
Owner:
not working at Google anymore
Closed: Jan 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: ----
Type: Bug



Sign in to add a comment

clang-format quality problem - interface defaults with @Nullable in Java

Project Member Reported by dtrainor@chromium.org, Nov 2 2017

Issue description

clang-format produced code that (choose all that apply): 
- Doesn't match Chromium style
- Riles my finely honed stylistic dander
- No sane human would ever choose

Here's the code before formatting:

/**
 * Used by various components to provide a set of feedback that can be gathered synchronously.
 */
public interface FeedbackSource {
    /**
     * Called to get all relevant feedback for this source.
     * @return A map of all feedback reported by this source.
     */
    default @Nullable Map<String, String> getFeedback() {
        return null;
    }

    /**
     * Returns a key-value pair of logs for this source.  It is appropriate to
     * return a larger than normal amount of data here and it will be automatically
     * handled by the consumer.  Each source can only return (at most) one
     * key-value log pair.
     * @return A key-value pair representing the logs for this source and the
     *         identifier.
     */
    default @Nullable Pair<String, String> getLogs() {
        return null;
    }
}

Here's the code after formatting:

/**
 * Used by various components to provide a set of feedback that can be gathered synchronously.
 */
public interface FeedbackSource {
    /**
     * Called to get all relevant feedback for this source.
     * @return A map of all feedback reported by this source.
     */
    default @
        Nullable Map<String, String> getFeedback() {
            return nul
        }

    /**
     * Returns a key-value pair of logs for this source.  It is appropriate to
     * return a larger than normal amount of data here and it will be automatically
     * handled by the consumer.  Each source can only return (at most) one
     * key-value log pair.
     * @return A key-value pair representing the logs for this source and the
     *         identifier.
     */
    default @
        Nullable Pair<String, String> getLogs() {
            return null;
        }
}

Here's how it ought to look:

/**
 * Used by various components to provide a set of feedback that can be gathered synchronously.
 */
public interface FeedbackSource {
    /**
     * Called to get all relevant feedback for this source.
     * @return A map of all feedback reported by this source.
     */
    default @Nullable Map<String, String> getFeedback() {
        return null;
    }

    /**
     * Returns a key-value pair of logs for this source.  It is appropriate to
     * return a larger than normal amount of data here and it will be automatically
     * handled by the consumer.  Each source can only return (at most) one
     * key-value log pair.
     * @return A key-value pair representing the logs for this source and the
     *         identifier.
     */
    default @Nullable Pair<String, String> getLogs() {
        return null;
    }
}

Code review link for full files/context:
https://chromium-review.googlesource.com/c/chromium/src/+/726821
 

Comment 1 by thakis@chromium.org, Jan 23 2018

Mergedinto: 781015
Status: Duplicate (was: Untriaged)

Sign in to add a comment