Skip to content

Commit

Permalink
Migrate google java format from 1.7 -> 1.21.0
Browse files Browse the repository at this point in the history
Reviewed By: IanChilds

Differential Revision: D52786052
  • Loading branch information
j-bahr authored and facebook-github-bot committed Mar 22, 2024
1 parent df573ae commit 2bf49ca
Show file tree
Hide file tree
Showing 39 changed files with 183 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public AnimatedImageResultBuilder setFrameForPreview(int frameForPreview) {
return CloseableReference.cloneOrNull(mDecodedFrames);
}

/** @return animated image uri path */
/**
* @return animated image uri path
*/
@Nullable
public String getSource() {
return mSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ public interface AnimationInformation {
*/
int getLoopDurationMs();

/** @return Animation asset width */
/**
* @return Animation asset width
*/
int width();

/** @return Animation asset height */
/**
* @return Animation asset height
*/
int height();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ private void onFrameDropped() {
}
}

/** @return the current uptime in ms */
/**
* @return the current uptime in ms
*/
private long now() {
// This call has to return [SystemClock#uptimeMillis()] in order to preserve correct
// frame scheduling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public void onDraw(
mLastFrameNumber = frameNumberToDraw;
FLog.d(
TAG,
"draw: frame: %2d, drawn: %b, delay: %3d ms, rendering: %3d ms, prev: %3d ms ago, duplicates: %3d, skipped: %3d, draw calls: %4d, anim time: %6d ms, next start: %6d ms, next scheduled: %6d ms",
"draw: frame: %2d, drawn: %b, delay: %3d ms, rendering: %3d ms, prev: %3d ms ago,"
+ " duplicates: %3d, skipped: %3d, draw calls: %4d, anim time: %6d ms, next start: %6d"
+ " ms, next scheduled: %6d ms",
frameNumberToDraw,
frameDrawn,
animationTimeMs % frameScheduler.getLoopDurationMs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public interface FrameScheduler {
*/
long getTargetRenderTimeForNextFrameMs(long animationTimeMs);

/** @return true if the animation is infinite */
/**
* @return true if the animation is infinite
*/
boolean isInfiniteAnimation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ private Extras obtainExtras(

protected @Nullable Uri getMainUri() {
return null;
};
}
;

private Extras obtainExtras(
@Nullable DataSource<T> datasource, @Nullable INFO info, @Nullable Uri mainUri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public void setOrigin(String text, int color) {
invalidateSelf();
}

/** @param imageSizeBytes the image size in bytes */
/**
* @param imageSizeBytes the image size in bytes
*/
public void setImageSize(int imageSizeBytes) {
mImageSizeBytes = imageSizeBytes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ public void setPlaceholderImage(Drawable drawable, ScalingUtils.ScaleType scaleT
getScaleTypeDrawableAtIndex(PLACEHOLDER_IMAGE_INDEX).setScaleType(scaleType);
}

/** @return true if there is a placeholder image set. */
/**
* @return true if there is a placeholder image set.
*/
public boolean hasPlaceholderImage() {
return mFadeDrawable.getDrawable(PLACEHOLDER_IMAGE_INDEX) != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public interface DraweeHierarchy {
*/
Drawable getTopLevelDrawable();

/** @return bounds of the top drawable */
/**
* @return bounds of the top drawable
*/
Rect getBounds();
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static byte[] readFile(InputStream in, long expectedSize) throws IOException {
? ByteStreams.toByteArray(in)
: ByteStreams.toByteArray(in, (int) expectedSize);
}

/**
* Reads all bytes from a file into a byte array.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class PooledByteArrayBufferedInputStream extends InputStream {

/** how many bytes in mByteArray were set by last call to mInputStream.read */
private int mBufferedSize;

/**
* position of next buffered byte in mByteArray to be read
*
Expand Down
4 changes: 3 additions & 1 deletion fbcore/src/main/java/com/facebook/common/util/TriState.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public enum TriState {
UNSET,
;

/** @return whether this value is set; that is, whether it is YES or NO. */
/**
* @return whether this value is set; that is, whether it is YES or NO.
*/
@Functional
public boolean isSet() {
return this != UNSET;
Expand Down
24 changes: 18 additions & 6 deletions fbcore/src/main/java/com/facebook/datasource/DataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
*/
public interface DataSource<T> {

/** @return true if the data source is closed, false otherwise */
/**
* @return true if the data source is closed, false otherwise
*/
boolean isClosed();

/**
Expand All @@ -51,7 +53,9 @@ public interface DataSource<T> {
*/
boolean hasResult();

/** @return an object with extra data for this datasource */
/**
* @return an object with extra data for this datasource
*/
@Nullable
Map<String, Object> getExtras();

Expand All @@ -61,17 +65,25 @@ public interface DataSource<T> {
*/
boolean hasMultipleResults();

/** @return true if request is finished, false otherwise */
/**
* @return true if request is finished, false otherwise
*/
boolean isFinished();

/** @return true if request finished due to error */
/**
* @return true if request finished due to error
*/
boolean hasFailed();

/** @return failure cause if the source has failed, else null */
/**
* @return failure cause if the source has failed, else null
*/
@Nullable
Throwable getFailureCause();

/** @return progress in range [0, 1] */
/**
* @return progress in range [0, 1]
*/
float getProgress();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public VolleyNetworkFetchState(

private final RequestQueue mRequestQueue;

/** @param requestQueue The Volley {@link RequestQueue} to use */
/**
* @param requestQueue The Volley {@link RequestQueue} to use
*/
public VolleyNetworkFetcher(RequestQueue requestQueue) {
mRequestQueue = requestQueue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,14 @@ private boolean isExpectedFile(File file) {
return true;
}

/** @return true if and only if the file is not old enough to be considered an old temp file */
/**
* @return true if and only if the file is not old enough to be considered an old temp file
*/
private boolean isRecentFile(File file) {
return file.lastModified() > (mClock.now() - TEMP_FILE_LIFETIME_MS);
}
};
}
;

@Override
public void purgeUnexpectedResources() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ public DiskDumpInfo() {
interface Entry {
/** the id representing the resource */
String getId();

/** calculated on first time and never changes so it can be used as immutable * */
long getTimestamp();

/** calculated on first time and never changes so it can be used as immutable * */
long getSize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ public interface FileCache extends DiskTrimmable {
*/
void remove(CacheKey key);

/** @return the in-use size of the cache */
/**
* @return the in-use size of the cache
*/
long getSize();

/** @return the count of pictures in the cache */
/**
* @return the count of pictures in the cache
*/
long getCount();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public abstract class AbstractAdaptiveCountingMemoryCache<K, V>
@GuardedBy("this")
@VisibleForTesting
int mLFUFractionPromil;

// default LFU Fraction
static final int DEFAULT_LFU_FRACTION_PROMIL = 500;

Expand All @@ -100,6 +101,7 @@ public abstract class AbstractAdaptiveCountingMemoryCache<K, V>
@GuardedBy("this")
@VisibleForTesting
final int mAdaptiveRatePromil;

// defualt adaptive rate
static final int DEFAULT_ADAPTIVE_RATE_PROMIL = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ public Bitmap getUnderlyingBitmap() {
return mBitmap;
}

/** @return size in bytes of the underlying bitmap */
/**
* @return size in bytes of the underlying bitmap
*/
@Override
public int getSizeInBytes() {
return BitmapUtil.getSizeInBytes(mBitmap);
}

/** @return width of the image */
/**
* @return width of the image
*/
@Override
public int getWidth() {
if (mRotationAngle % 180 != 0
Expand All @@ -148,7 +152,9 @@ public int getWidth() {
return getBitmapWidth(mBitmap);
}

/** @return height of the image */
/**
* @return height of the image
*/
@Override
public int getHeight() {
if (mRotationAngle % 180 != 0
Expand All @@ -167,12 +173,16 @@ private static int getBitmapHeight(@Nullable Bitmap bitmap) {
return (bitmap == null) ? 0 : bitmap.getHeight();
}

/** @return the rotation angle of the image */
/**
* @return the rotation angle of the image
*/
public int getRotationAngle() {
return mRotationAngle;
}

/** @return the EXIF orientation of the image */
/**
* @return the EXIF orientation of the image
*/
@Override
public int getExifOrientation() {
return mExifOrientation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

@Nullsafe(Nullsafe.Mode.LOCAL)
public interface CloseableImage extends Closeable, ImageInfo, HasBitmap, HasExtraData {
/** @return size in bytes of the bitmap(s) */
/**
* @return size in bytes of the bitmap(s)
*/
int getSizeInBytes();

/** Closes this instance and releases the resources. */
Expand All @@ -26,13 +28,19 @@ public interface CloseableImage extends Closeable, ImageInfo, HasBitmap, HasExtr

boolean isStateful();

/** @return width of the image */
/**
* @return width of the image
*/
int getWidth();

/** @return height of the image */
/**
* @return height of the image
*/
int getHeight();

/** @return quality information for the image */
/**
* @return quality information for the image
*/
QualityInfo getQualityInfo();

ImageInfo getImageInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

public abstract class DefaultCloseableImage extends BaseCloseableImage {
private static final String TAG = "CloseableImage";

/** Ensures that the underlying resources are always properly released. */
@Override
protected void finalize() throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,25 @@

/** Interface containing information about an image. */
public interface ImageInfo extends HasImageMetadata {
/** @return width of the image */
/**
* @return width of the image
*/
int getWidth();

/** @return height of the image */
/**
* @return height of the image
*/
int getHeight();

/** @return size in bytes of the image */
/**
* @return size in bytes of the image
*/
default int getSizeInBytes() {
return 0;
}

/** @return quality information for the image */
/**
* @return quality information for the image
*/
QualityInfo getQualityInfo();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
/** Factory methods for creating cache keys for the pipeline. */
public interface CacheKeyFactory {

/** @return {@link CacheKey} for doing bitmap cache lookups in the pipeline. */
/**
* @return {@link CacheKey} for doing bitmap cache lookups in the pipeline.
*/
CacheKey getBitmapCacheKey(ImageRequest request, @Nullable Object callerContext);

/** @return {@link CacheKey} for doing post-processed bitmap cache lookups in the pipeline. */
/**
* @return {@link CacheKey} for doing post-processed bitmap cache lookups in the pipeline.
*/
CacheKey getPostprocessedBitmapCacheKey(ImageRequest request, @Nullable Object callerContext);

/**
Expand Down
Loading

0 comments on commit 2bf49ca

Please sign in to comment.