grimly opened a new issue, #6427:
URL: https://github.com/apache/netbeans/issues/6427
### Apache NetBeans version
Apache NetBeans 19
### What happened
When applying a suggestion that would suppress a warning in a record
constructor, the constructor code would be corrupted and invalid code would be
left behind.
Given the following code :
```java
public record MyRecord<E>(Object obj, E typed) {
public MyRecord {
typed = (E)obj;
}
}
```
The cast obviously raises an `unchecked` warning.
Trying to resolve it with the `Suppress Warning - unchecked` option it turns
the code into the following invalid code :
```java
public record MyRecord<E>(Object obj, E typed) {
@SuppressWarnings("unchecked")
public {
typed = (E)obj;
}
}
```
Instead, this is the expected code:
```java
public record MyRecord<E>(Object obj, E typed) {
@SuppressWarnings("unchecked")
public MyRecord {
typed = (E)obj;
}
}
```
### How to reproduce
_No response_
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows 11
### JDK
Temurin-17.0.8.1+1
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists