Skip to content

Avoiding needless java.awt.Color dependency in HSSFColor#806

Closed
JaroslavTulach wants to merge 3 commits intoapache:trunkfrom
JaroslavTulach:AvoidNeedlessJavaAwtColorDependencyInHSSFColor
Closed

Avoiding needless java.awt.Color dependency in HSSFColor#806
JaroslavTulach wants to merge 3 commits intoapache:trunkfrom
JaroslavTulach:AvoidNeedlessJavaAwtColorDependencyInHSSFColor

Conversation

@JaroslavTulach
Copy link
Contributor

I am currently working on project called Enso. We are making heavy use of Apache POI to parse Excel documents our users are processing.

Excel in Enso

We are also using GraalVM Native Image to compile our application to native executable. Recently we realized in enso-org/enso#12843 that it is necessary to avoid dependency on java.desktop module.

Why Avoiding java.desktop Dependency?

Since Java9 the JDK offers tool called jlink. It can be used to create a smaller JDK ready for execution in the cloud and other restricted environments:

Excluding java.desktop is a good practice anyway - reduces bloat of the final application by tens of megabytes.

Patching HSSFColor

Such a solution was good short-term workaround, but I don't want to maintain a fork of POI! Hence my goal is to find a way to include the necessary fixes in your project in the long term. Hence the creation of this PR. Can you please consider its acceptance?

Technicalities

  • this PR replaces the RGB handling code in HSSFColor
  • originally this code relied on java.awt.Color
    • however that creates unnecessary dependency on java.desktop
  • the PR proposes direct manipulation with RGB int compatible with handling in java.awt.Color
  • the behavior remains the same
  • dependency of HSSFColor on java.desktop is removed

Other Fixes

  • there are other places in POI where dependency on java.desktop deserves to be removed
  • however that's a long term direction
  • I am starting with this simple HSSFColor proposal
  • if it is accepted, I create subsequent PRs addressing other java.desktop dependencies

@pjfanning
Copy link
Member

I'd prefer to make the new constructor public but not to deprecate the old one.

@JaroslavTulach JaroslavTulach force-pushed the AvoidNeedlessJavaAwtColorDependencyInHSSFColor branch from cd6e232 to 32fea65 Compare May 11, 2025 04:50
@asfgit asfgit closed this in 8bac1b3 May 11, 2025
@pjfanning
Copy link
Member

thanks - merged

@JaroslavTulach
Copy link
Contributor Author

thanks - merged

I see 8bac1b3 - thanks for accepting my change. It will make Enso better. When do you expect next release binary artifacts to be uploaded to Maven central?

PS: I was hoping to get a commit authored by me in the POI history to expand on my ASF contributions. Maybe next time.

@pjfanning
Copy link
Member

We don't use git in POI. We use subversion. This GitHub project is a readonly mirror.

There is no release expected in the near future. The POI community is small and releases need multiple people to do reviews and get involved in the votes.

You can build the jars from source or we have regular builds in CI - https://ci-builds.apache.org/

@JaroslavTulach
Copy link
Contributor Author

There is no release expected in the near future.

Your web indicates you may perform a release by end of the calendar year (it shows Version 5.4.2 (2025-??-??)). True?

releases need multiple people ... get involved in the votes.

As a PMC member of Apache NetBeans I can give you non-binding +1 ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants