Skip to content

Commit

Permalink
Build: Suppress various build warnings (apache#10938)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk1506 authored Aug 15, 2024
1 parent cf02ffa commit 8c85a5a
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void closeStream() throws IOException {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void cleanUpStagingFiles() {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/org/apache/iceberg/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private static void writeByteBufferMap(
* @throws IOException On serialization error
* @throws ClassNotFoundException If the class is not found
*/
@SuppressWarnings("DangerousJavaDeserialization")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
rowCount = (Long) in.readObject();
columnSizes = (Map<Integer, Long>) in.readObject();
Expand All @@ -190,6 +191,7 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
upperBounds = readByteBufferMap(in);
}

@SuppressWarnings("DangerousJavaDeserialization")
private static Map<Integer, ByteBuffer> readByteBufferMap(ObjectInputStream in)
throws IOException, ClassNotFoundException {
int size = in.readInt();
Expand Down
2 changes: 1 addition & 1 deletion aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public void close() {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void setSkipSize(int skipSize) {
this.skipSize = skipSize;
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private void createStagingDirectoryIfNotExists() throws IOException, SecurityExc
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void close() throws IOException {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void close() throws IOException {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
6 changes: 2 additions & 4 deletions baseline.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,14 @@ subprojects {
'-Xep:CollectionUndefinedEquality:ERROR',
// specific to Palantir - Uses name `log` but we use name `LOG`
'-Xep:ConsistentLoggerName:OFF',
// TODO (https://github.com/apache/iceberg/issues/10853) this is a recently added check. Figure out whether we adjust the code or suppress for good
'-Xep:DangerousJavaDeserialization:WARN',
'-Xep:DangerousJavaDeserialization:ERROR',
'-Xep:DangerousThreadPoolExecutorUsage:OFF',
// subclasses are not equal
'-Xep:EqualsGetClass:OFF',
// specific to Palantir
'-Xep:FinalClass:OFF',
'-Xep:FormatStringAnnotation:ERROR',
// TODO (https://github.com/apache/iceberg/issues/10855) this is a recently added check. Figure out whether we adjust the code or suppress for good
'-Xep:ImmutablesReferenceEquality:WARN',
'-Xep:ImmutablesReferenceEquality:ERROR',
'-Xep:IntLongMath:ERROR',
// prefer method references over lambdas
'-Xep:LambdaMethodReference:ERROR',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public int read(byte[] b, int off, int len) throws IOException {
return stream.read(b, off, len);
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down Expand Up @@ -195,7 +195,7 @@ public void close() throws IOException {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private static String scheme(String location) {
return null;
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static byte[] serializeToBytes(
}
}

@SuppressWarnings("unchecked")
@SuppressWarnings({"DangerousJavaDeserialization", "unchecked"})
public static <T> T deserializeFromBytes(byte[] bytes) {
if (bytes == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void close() throws IOException {
}
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void close() throws IOException {
stream.close();
}

@SuppressWarnings("checkstyle:NoFinalizer")
@SuppressWarnings({"checkstyle:NoFinalizer", "Finalize"})
@Override
protected void finalize() throws Throwable {
super.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ private static void createFileForCommit(DataFile[] closedFiles, String location,
LOG.debug("Iceberg committed file is created {}", fileForCommit);
}

@SuppressWarnings("DangerousJavaDeserialization")
private static DataFile[] readFileForCommit(String fileForCommitLocation, FileIO io) {
try (ObjectInputStream ois =
new ObjectInputStream(io.newInputFile(fileForCommitLocation).newStream())) {
Expand Down

0 comments on commit 8c85a5a

Please sign in to comment.