-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore missing AWT library if missing
- This is a workaround until oracle/graal#4124 is fixed
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
runtime/src/main/java/io/quarkiverse/poi/runtime/graal/SheetUtilSubstitution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.quarkiverse.poi.runtime.graal; | ||
|
||
import java.text.AttributedString; | ||
|
||
import org.apache.poi.ss.usermodel.CellStyle; | ||
import org.apache.poi.ss.usermodel.Workbook; | ||
import org.apache.poi.ss.util.SheetUtil; | ||
import org.graalvm.nativeimage.Platform; | ||
import org.graalvm.nativeimage.Platforms; | ||
|
||
import com.oracle.svm.core.annotate.Alias; | ||
import com.oracle.svm.core.annotate.RecomputeFieldValue; | ||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
|
||
@TargetClass(SheetUtil.class) | ||
@Platforms(Platform.MACOS.class) | ||
public final class SheetUtilSubstitution { | ||
|
||
@Alias | ||
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) | ||
public static int DEFAULT_CHAR_WIDTH = 5; | ||
|
||
@Substitute | ||
public static int getDefaultCharWidth(final Workbook wb) { | ||
return DEFAULT_CHAR_WIDTH; | ||
} | ||
|
||
@Substitute | ||
private static double getCellWidth(int defaultCharWidth, int colspan, | ||
CellStyle style, double minWidth, AttributedString str) { | ||
return defaultCharWidth; | ||
} | ||
} |