redhat-developer / redhat-developer/vscode-java
Unexpected dead code warning.
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
SessionCallback<List<Object>> obj;
public void method() throws TransactionException {
StringRedisTemplate stringRedisTemplate = resourcePool.template();
var res = obj.execute(stringRedisTemplate);// @Nullable <K, V> T execute(RedisOperations<K, V> operations) throws DataAccessException;
if (res == null) {
System.out.println("Direct execution is not Dead Code");
}
List<Object> results = stringRedisTemplate.execute(new SessionCallback<List<Object>>() {
@Override
@Nullable
public <K, V> List<Object> execute(@NonNull RedisOperations<K, V> operations) throws DataAccessException {
operations.multi();
return null;
}
});
// @Override public <T> T StringRedisTemplate::execute(SessionCallback<T> session) {
// ...
// try {
// return session.execute(this); -> this is NullAble
// } finally {
// RedisConnectionUtils.unbindConnection(factory);
// }
// }
if (results == null) {
throw new TransactionException("Transaction failed, please retry") {
};
}
}
Minimal reproduce repo
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 with the minimal reproduce repository linked in the issue and run the Java snippet that triggers the dead-code warning. Compare the warning with the shown nullable execution paths and attached diagnostic; done means the warning behavior is correctly resolved or clearly reproduced for the project maintainers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100