dotnet / dotnet/android

Java Finalizer() warning about deprecation in build

Open
#11,420 3 comments 1 reaction 2 assignees Claimed by @jonathanpeppers View on GitHub
Area: Mono.Android t/bug
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 21h
Merged PRs (30d)
257

Description

### Description

On our build server, when release building the .NET MAUI Android project we see the following warning:
`GenericAnimatorListener.java:50: warning: [removal] finalize() in Object has been deprecated and marked for removal`
I could also reproduce it locally with `msbuild ProjectName.csproj /p:Configuration=Release -v:d -fileLogger` and checking the log file for the same warning.

It doesn't fail the build but should be something that has to be fixed eventually. It seems to come from Microsoft.Maui.Controls and if I understand it correctly it is a Java wrapper for [GenericAnimatorListener.cs](https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Platform/Android/GenericAnimatorListener.cs) and I guess the JavaFinalize() that it inherits and overrides from AnimatorListenerAdapter is what is causing it.

### Steps to Reproduce

_No response_

### Link to public reproduction project repository

_No response_

### Version with bug

10.0.50

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

_No response_

### Did you find any workaround?

Message can be ignored but should be fixed in a future release.

### Relevant log output

```shell
C:\Program Files\Android\openjdk\jdk-21.0.8\bin\javac.exe -J-Dfile.encoding=UTF8 "@C:\Users\User\AppData\Local\Temp\tmp7C63.tmp" -target 1.8 -source 1.8 -Xlint:-options
obj\AndroidClient\android\src\crc64338477404e88479c\GenericAnimatorListener.java:50: warning: [removal] finalize() in Object has been deprecated and marked for removal
public void finalize ()
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.