redhat-developer / redhat-developer/vscode-java
instanceof pattern inside lambda causes issues.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Using instanceof pattern inside of lambdas breaks multiple features. Examples:
- hovering over elements stops showing the signature
- Renaming from inside the method with the pattern pops an internal error (https://pastebin.com/iTZDjVq0)
- Attempting to Go To Definition of a field or method doesn't work inside the method with the pattern
- Sometime intellisense stops suggesting things
Environment
- Operating System: Windows 10 PRO 1909
- JDK version: Graalvm Java 16 21.1.0
- Visual Studio Code version: 1.59.1(2021-08-19)
- Java extension version: v0.81.0
[Please attach a sample project reproducing the error]
public class Test {
public static final void bug() {
Optional.empty().ifPresent(o-> {
if(o instanceof byte[] array) {
Object local = null;
}
});
}
}
https://pastebin.com/iTZDjVq0
https://pastebin.com/bc7rGyfE
Additional Informations
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by opening the supplied Java sample in VS Code with the listed Java extension and reproducing hovering, rename, Go To Definition, and IntelliSense failures. Enable the Java extension logs using the linked troubleshooting guide and compare the behavior with the two linked pastebins. Done means these language features work inside the instanceof pattern used in the lambda.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100