Skip to content
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

Version 2.9.0 using deprecated Java features ("Deprecated in Java") #2460

Closed
latobibor opened this issue Apr 19, 2023 · 1 comment · Fixed by #2597
Closed

Version 2.9.0 using deprecated Java features ("Deprecated in Java") #2460

latobibor opened this issue Apr 19, 2023 · 1 comment · Fixed by #2597
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided

Comments

@latobibor
Copy link

Description

A lot of warnings appear during build which is currently polluting the build output.

Adding all warnings for people who search with partial logs for the same problem.

w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (7, 31): Parameter 'event' is never used
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (7, 41): Parameter 'reactApplicationContext' is never used
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt: (755, 11): Name shadowed: size
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt: (9, 51): Unreachable code
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEnabledRootView.kt: (10, 80): Unreachable code
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt: (77, 18): 'onChildStartedNativeGesture(MotionEvent!): Unit' is deprecated. Deprecated in Java
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt: (82, 42): Parameter 'disallowIntercept' is never used
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt: (114, 28): Parameter 'viewTag' is never used
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt: (7, 44): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt: (14, 11): 'init(Int): Unit' is deprecated. Deprecated in Java
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt: (30, 42): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: /Users/andras.toth/projects/GestureHandlerDeprecatedWarnings/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerTouchEvent.kt: (31, 21): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java

Steps to reproduce

  1. Run to get the latest virgin react-native npx react-native init GestureHandlerDeprecatedWarnings
  2. Run yarn add react-native-gesture-handler
  3. Run npm run android

Results:
The following warnings.

Snack or a link to a repository

https://github.com/latobibor/react-native-gesture-handler-build-warnings-repro

Gesture Handler version

2.9.0

React Native version

0.71.7, 0.69.9

Platforms

Android

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

None

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided labels Apr 19, 2023
@jacksonlevine
Copy link

Also getting this.

m-bert added a commit that referenced this issue Mar 12, 2024
## Description

It turns out that our code uses some deprecated functions. Also there were few more warnings, such as shadowed name or unused variables.

Some of included changes require digging into `react-native` source code to find alternative approach.

Fixes #2460 

## `dispatch` method

Based on @kkafar research in [screens](software-mansion/react-native-screens#1867), I've replaced `dispatch` method with `getEventData`.

- [Here](https://github.com/facebook/react-native/blob/e2ef6b98a061508bdd70a4c2747fe061c49b5c39/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java#L154-L168) you can find how `dispatch` looks like in the source code. 
- [Here](facebook/react-native@72d0ddc#diff-afc6f25f459dcf1e24a012e16862c869aa04b0de5795171efe14b7a88be08e64) you can see example change in react-native

## Test plan

Tested that our example apps (paper and fabric) work as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants