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

Alexey Ivanov aivanov at openjdk.org
Mon Oct 23 17:25:32 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.

Approved.

Further clean-up will be handled separately.

I agree. Yet if they're unused from outside, there's no need to export them. After all, you hid some functions from `GrPrim_*` family.

A separate PR will do.


> > `jvm`
> 
> That's an odd beast; it is used to retrieve a pointer to JNIEnv. The pointer to JNIEnv is available in all JNI functions, so we could do without a global jvm variable.

Yes, it's possible to do without it. I believe it's primarily used for up-calls. Anyway, it's not something to address here.

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

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13261#pullrequestreview-1693101493
PR Comment: https://git.openjdk.org/jdk/pull/13261#issuecomment-1775662294


More information about the client-libs-dev mailing list