Skip to content

Commit

Permalink
fix: errorprone warnings to error fixes added
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Sep 9, 2024
1 parent d88dd19 commit ce8a33f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
35 changes: 35 additions & 0 deletions java/c/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,40 @@ under the License.
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration combine.self="override">
<fork>true</fork>
<source>${minimalJavaBuildVersion}</source>
<target>${minimalJavaBuildVersion}</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne -XepAllErrorsAsWarnings</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
<arg>-Werror</arg>
</compilerArgs>
<annotationProcessorPaths combine.children="append">
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${error_prone_core.version}</version>
<!-- Use the same version as the dependency -->
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion java/c/src/main/java/org/apache/arrow/c/ArrayExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void export(ArrowArray array, FieldVector vector, DictionaryProvider dictionaryP

data.buffers = new ArrayList<>(vector.getExportedCDataBufferCount());
data.buffers_ptrs =
allocator.buffer((long) (vector.getExportedCDataBufferCount()) * Long.BYTES);
allocator.buffer((long) vector.getExportedCDataBufferCount() * Long.BYTES);
vector.exportCDataBuffers(data.buffers, data.buffers_ptrs, NULL);

if (dictionaryEncoding != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public List<ArrowBuf> visit(ArrowType.Utf8 type) {
private List<ArrowBuf> visitVariableWidthView(ArrowType type) {
final int viewBufferIndex = 1;
final int variadicSizeBufferIndex = this.buffers.length - 1;
final long numOfVariadicBuffers = this.buffers.length - 3;
final long numOfVariadicBuffers = this.buffers.length - 3L;
final long variadicSizeBufferCapacity = numOfVariadicBuffers * Long.BYTES;
List<ArrowBuf> buffers = new ArrayList<>();

Expand Down
8 changes: 4 additions & 4 deletions java/c/src/test/java/org/apache/arrow/c/DictionaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ private void createStructVector(StructVector vector) {

// Write the values to child 1
child1.allocateNew();
child1.set(0, "01234567890".getBytes());
child1.set(1, "012345678901234567".getBytes());
child1.set(0, "01234567890".getBytes(StandardCharsets.UTF_8));
child1.set(1, "012345678901234567".getBytes(StandardCharsets.UTF_8));
vector.setIndexDefined(0);

// Write the values to child 2
Expand All @@ -269,8 +269,8 @@ private void createStructVectorInline(StructVector vector) {

// Write the values to child 1
child1.allocateNew();
child1.set(0, "012345678".getBytes());
child1.set(1, "01234".getBytes());
child1.set(0, "012345678".getBytes(StandardCharsets.UTF_8));
child1.set(1, "01234".getBytes(StandardCharsets.UTF_8));
vector.setIndexDefined(0);

// Write the values to child 2
Expand Down
8 changes: 0 additions & 8 deletions java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,6 @@ public void testVarBinaryVector() {
}
}

private String generateString(String str, int repetition) {
StringBuilder aRepeated = new StringBuilder();
for (int i = 0; i < repetition; i++) {
aRepeated.append(str);
}
return aRepeated.toString();
}

@Test
public void testViewVector() {
// ViewVarCharVector with short strings
Expand Down

0 comments on commit ce8a33f

Please sign in to comment.