apache / apache/netbeans

Deprecation inspection does not produce any output

Open
#4,604 2 comments 0 reactions 0 assignees View on GitHub
hints Java kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 15

### What happened

I wanted to find uses of deprecated API in a Java (Maven) project. But running the Inspect... item did not give any output in the Inspector window.

### How to reproduce

I have a minimal test case
``` java
public class Mavenproject2 {

public static void main(String[] args) {
Mavenproject2 it = new Mavenproject2();
System.out.println(it.test(123));
System.out.println(it.test("Hello World!"));
}
/**
* Test a number
* @param x a number
* @return another number
*/
public int test(int x) {
return x;
}
/**
* Test a String
* @param x
* @return a number
* @deprecated Use Support#test(int) instead
*/
@Deprecated()
public int test(String x) {
return x.length();
}
}
```
With this code in a maven project, select menu Source | Inspect... and choose Scope: current file and Use: single inspection deprecated. I believe this should cite use of deprecated `test(String)` in the Inspector panel but it does not.

![Screenshot 2022-09-09 110241](https://user-images.githubusercontent.com/22172519/189326314-7748f0fd-c81b-4912-9d75-dc9e52399104.png)

Note the IDE does show strikethrough on both the declaration and use of that method.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 10 version 10.0 running on amd64; Cp1252; en_GB (nb)

### JDK

11.0.9.1; OpenJDK 64-Bit Server VM 11.0.9.1+1

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

Log file attached, as far as I can no relevant entries.
[ide-log.txt](https://github.com/apache/netbeans/files/9534464/ide-log.txt)

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the minimal Java Maven project using Source | Inspect..., with scope set to the current file and the deprecated inspection selected. Compare the missing result in the Inspector panel with the strikethrough shown for the deprecated method declaration and use. Done means the inspection reports the deprecated test(String) call.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.