Community
Participate
Working Groups
Updating from Ecipse oxygen 3... The @SuppressWarnings("unchecked") is not working and i see the warnings. Trying to clean and build not worked,I even closed and reopent the project. The compiler error/warnings is set to default and the project has not any customized settings for error/warnings. The defult suggestion for quick fix is not working. I always see the warning. Regards, -- Configuration Details -- Product: Eclipse IDE 4.9.0.20180917-1800 (org.eclipse.epp.package.jee.product)Installed Features: org.eclipse.jdt 3.15.0.v20180906-0745 Versioning Plugin: org.eclipse.platform 4.9.0.v20180906-1121
Can you please share an example, preferably in a small isolated testcase. We have tests that cover this feature. So there's something specific about your code.
I found that this happens when I install Aspectj Tool. I used the last version ajdt-e48-2.2.4.201811011643.zip but same issue.
Perhaps AspectJ JDT weaving disturbs JDT somehow?
We're experiencing the same problem with 2018/09, and only when AJDT is installed: Version: 4.9.0.20180917-1800 Build id: 20180917-1800 org.aspectj (1.9.2.201811011643) "AspectJ Development Tools" org.eclipse.ajdt (2.2.4.201811011643) "AspectJ Development Tools"
I can only second or third the behaviour reported by the OP. In any version of Eclipse newer than Oxygen 3a I have tested, the presence of AJDT (2.2.4, full details below), causes @SuppressWarnings annotations to stop working as intended. Meaning the compiler will ignore the annotation and display warning about unchecked conversions, raw types in generics, unused code etc. AJDT version: AspectJ Development Tools 2.2.4.201805251550 AspectJ Compiler 1.8.13.201805251550 Equinox Weaving SDK 1.2.0.201805251550 Maven Integration for AJDT (Optional) 0.14.0.201506231302 Works with Eclipse Neon and Oxygen.3a Release (4.7.3a) Build id: 20180405-1200 OS: Windows 10, v.10.0, x86_64 / win32 Does not work with current final relase versions of Photon or 2018-12
In addition to my previous comment, Photon is also exhibiting the same issue with the to date latest version of AJDT from the https://download.eclipse.org/tools/ajdt/48/dev/update/ update site: AspectJ Development Tools 2.2.4.201901092148 AspectJ Compiler 1.9.2.201901092148 Equinox Weaving SDK 1.2.0.201901092148
Can you possibly share a project with me that exhibits this problem? I have this simple class in a Java11 project in Eclipse 4.10 and uncommenting the suppresswarnings will suppress the unchecked problem, as expected. package bean; import java.util.Collections; import java.util.List; public class Demo { public static List getStringList() { return null; } // @SuppressWarnings("unchecked") public static void main(String[]argv) { List<String> list = (List<String>)getStringList(); Collections.reverse(list); } } I've tried with/without jdt weaving on (and can't think why it would interfere, but what else could it be??) and it still works. I tried with/without an AJ project in the workspace, made no difference.
(In reply to Andrew Clement from comment #7) Andrew, I tried your example and can confirm that the warning is suppressed when the main method is annotated. However, I get the warning when I move the @SuppressWarnings annotation to the local variable while the class is in an AJ project: public static void main(String[]argv) { @SuppressWarnings("unchecked") List<String> list = (List<String>)getStringList(); Collections.reverse(list); } The warning is suppressed as expected as long as the project is not an AJ project. Converting the project to an AJ project without touching the code immediately adds the warning. Eclipse 4.11.0.20190314-1200 org.eclipse.ajdt 2.2.4.2019022121
Bug still observed: Eclipse 4.12.0.v20190605-1801 AJDT 2.2.4.201905102027
Bug still observed: AspectJ Development Tools 2.2.4.201911072000 Eclipse Platform 4.13.0.v20190916-1323
Bug still observed: AspectJ Development Tools 2.2.4.202203241553 Eclipse Platform 4.25.0.v20220831-1800
Bug still observed: AspectJ Development Tools: 2.2.4.202311040357 Eclipse Platform: 4.30.0.v20231201-0512