redhat-developer / redhat-developer/vscode-java

Not unboxing generic methods from dependencies

Open
#2,787 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compile
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I believe the Intellisense is not properly unboxing generic methods when the is defined in a dependency (.class file).

Environment
  • Operating System: MacOS
  • JDK version: Oracle version 19
  • Visual Studio Code version: 1.73.0
  • Java extension version: v0.25.2022110400
More Information

I am not a very experienced Java developer and I've inherited a fairly large project so please forgive me if I'm not totally wrong or not making sense here.

In my case, using the inTransaction() function defined here

if(inTransaction(new DbTransactionUser<Boolean, Object>() {
    public Boolean useTransaction() {
         return true;
   }
}) {

}

the above code cannot unbox the generic inTransaction and interpret it as a Boolean although if I define a similar generic function within my project, it seems to unbox correctly. This leads me to assume that it can unbox when reading from .java but cannot unbox when reading from .class files.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the generic inTransaction() example using the dependency implementation linked in DbQueryManager.java, then compare it with an equivalent generic method defined in the project. Start by tracing Java IntelliSense handling for generic methods loaded from .class files; done means the dependency-defined method is unboxed and interpreted as Boolean just like the source-defined version.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.