Bug 536256 - @SuppressWarnings("deprecation") flagged as unnecessary on overridden method
Summary: @SuppressWarnings("deprecation") flagged as unnecessary on overridden method
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.3   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-25 11:54 EDT by Sam Brannen CLA
Modified: 2023-03-06 17:07 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Brannen CLA 2018-06-25 11:54:23 EDT
Given the following code, Eclipse 4.7.3a flags the declaration of @SuppressWarnings("deprecation") as a warning stating that it is "Unnecessary".

However, when compiling the same code using JDK 1.8.0_171 with -Werror specified and without @SuppressWarnings("deprecation"), the compilation fails with the following:

/Users/X/project/src/main/java/example/Superclass.java:14: warning: [deprecation] foo() in Superclass has been deprecated
        public void foo() {
                    ^
error: warnings found and -Werror specified
1 error
1 warning


public class Superclass {

	@Deprecated
	public void foo() {
	}

}

class Subclass extends Superclass {

	@SuppressWarnings("deprecation")
	public void foo() {
	}

}

Please ensure that Eclipse does not flag the use of @SuppressWarnings("deprecation") as "Unnecessary" when overriding a deprecated method.
Comment 1 Sam Brannen CLA 2018-06-25 11:57:33 EDT
Actually, please also ensure that Eclipse flags the absence of @SuppressWarnings("deprecation") as a deprecation warning when overriding a deprecated method with a quick fix to add the suppression.
Comment 2 Eclipse Genie CLA 2020-10-11 20:26:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Eclipse Genie CLA 2023-02-23 17:51:41 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Michael Woinoski CLA 2023-03-06 17:07:52 EST
The problem still occurs in Eclipse IDE for Enterprise Java and Web Developers Version: 2022-12 (4.26.0), Build id: 20221201-1913. To reproduce it:

@SuppressWarnings("deprecation")
public static void main(String[] args) {
    BigDecimal bd = new BigDecimal("3.1415")
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
    }
}