RFR: 8305321: Remove unused exports in java.desktop [v5]

Phil Race prr at openjdk.org
Wed Oct 25 23:27:37 UTC 2023


On Fri, 13 Oct 2023 15:19:53 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Please review this patch that removes a number of unused exports from java.desktop native libraries.
>> 
>> In most cases I removed JNIEXPORT from methods and variables that are only used within a single shared library. Other than that:
>> - removed `getSunFontIDs` that was reportedly used by rasterizer; as far as I could tell, rasterizer project is dead now, but if that's incorrect I can restore that export.
>> - removed `colorValueID` in X11Color; that field was not used.
>> - removed `J2dTraceInit` from header file. That method is only used internally by `J2dTraceImpl`.
>> 
>> The methods `Transform_GetInfo` and `Transform_transform` are declared in GraphicsPrimitiveMgr, but are only used in TransformHelper. Let me know if I should move them to where they are used.
>> 
>> The method `img_makePalette`, currently located in `share/native/libawt/awt/image/cvutils/img_colors.c`, is only used by `unix/native/common/awt/X11Color.c`; it could be moved to the same directory to avoid exporting the method from libawt. The files `img_colors.[ch]` do not have any references to other files in `cvutils`.
>> 
>> Manually verified that the exports are no longer present after these changes. Tier1-3 and client libs tests still pass.
>
> Daniel Jeliński has updated the pull request incrementally with seven additional commits since the last revision:
> 
>  - Revert "Remove Color_initIDs"
>    
>    This reverts commit 8a8c9a63de14773905a64a8067ddd68c8a6ab137.
>  - Revert "Remove KeyboardFocusManager_initIDs"
>    
>    This reverts commit 66bd9a136b4c34d7d600ad49ce67fcd060160fb8.
>  - Revert "Remove Rectangle_initIDs"
>    
>    This reverts commit 0d21e361cd92215bbc8bb971b5c3f26898b96a0b.
>  - Revert "Remove Button_initIDs"
>    
>    This reverts commit 423afbf3b61cad504ae10a99ceb02c318f3a83ae.
>  - Revert "Remove FileDialog_initIDs"
>    
>    This reverts commit e66a9ffdda6e451c4298f59786adbd434dd1adb5.
>  - Revert "Remove TextField_initIDs"
>    
>    This reverts commit 0c3b78d27b899d4301f8326f90f1cc36703cbd3d.
>  - Revert "Update copyright"
>    
>    This reverts commit 5808c65e5fbabc08b43da982736b40db87000cb5.

I eyeballed this but I also ran all our automated tests on all platforms,
I don't know that I could be sure none of these were needed without doing that.

If we ever need to export any of these in the future it is easy enough to add it back.

src/java.desktop/share/native/common/font/sunfontids.h line 86:

> 84: 
> 85: /* Note: we share variable in the context of fontmanager lib
> 86:    but we need access method to use it from separate rasterizer lib */

That comment had nothing to do with the rasterizer OpenJDK project which wasn't even about font rasterisation. I think this refers to the closed source font rasteriser now removed. Anyway I don't think the comment is important enough to insist on keeping it.

-------------

Marked as reviewed by prr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13261#pullrequestreview-1698410666
PR Review Comment: https://git.openjdk.org/jdk/pull/13261#discussion_r1372412452


More information about the client-libs-dev mailing list