-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid ICC_ColorSpace instances in Apache Tika to support GraalVM 20.3 #13718
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
36 changes: 36 additions & 0 deletions
36
extensions/tika/runtime/src/main/java/io/quarkus/tika/graalvm/PDFBoxSubstitutions.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,36 @@ | ||
package io.quarkus.tika.graalvm; | ||
|
||
import java.awt.color.ColorSpace; | ||
import java.awt.color.ICC_ColorSpace; | ||
|
||
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(className = "org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB") | ||
final class Target_org_apache_pdfbox_pdmodel_graphics_color_PDDeviceRGB { | ||
@Substitute | ||
private void init() { | ||
// This method appears to be just a workaround for PDFBOX-2184 | ||
} | ||
|
||
// awtColorSpace is not actually used in PDDeviceRGB | ||
@Alias | ||
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) | ||
private volatile ColorSpace awtColorSpace; | ||
} | ||
|
||
@TargetClass(className = "org.apache.pdfbox.pdmodel.graphics.color.PDICCBased") | ||
final class Target_org_apache_pdfbox_pdmodel_graphics_color_PDICCBased { | ||
// This class provides alternative paths for when awtColorSpace is null, so it is safe to reset it | ||
@Alias | ||
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset) | ||
private volatile ICC_ColorSpace awtColorSpace; | ||
} | ||
|
||
// Substitutions to prevent ICC_ColorSpace instances from appearing in the native image when using Apache Tika | ||
// See https://github.com/quarkusio/quarkus/pull/13644 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should add a comment adding that this class should be removed once we switch from GraalVM 20.3 to GraalVM 21? (having |
||
class PDFBoxSubstitutions { | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks great, thanks!
Minor nitpick: this class should be in the
io.quarkus.tika.runtime.graal
to be consistent with other extensions.