Community
Participate
Working Groups
Build Identifier: I20110613-1736 Compiler shows warning that a method can be declared as static, but when declaring as static one will see a compiler error. See steps to reproduce for details... Reproducible: Always Steps to Reproduce: See attached project or follow instructions below: 1. Turn on compiler warning for Code style "Method can be static". 2. Create a java project with 2 packages (packageA and packageB) 3. In package A create an abstract class (e.g. AbstractExample) with an inner protected abstract class (e.g. SubClass). 4. In packageB create another class extending the abstract class (AbstractExample) from packageA. (here called Example) 5. Create a method in the class of packageB (Example) that creates a new instance of the inner class (SubClass). 6. Call this method in the constructor of "Example". As Is: One can see a compiler warning "method can be declared as static". To Be: No compiler warning, as making this method static will lead to a compile error.
Created attachment 201315 [details] Example Project for incorrect compiler warning.
Created attachment 203856 [details] patch under test The original fix bug 335845 missed on adding the relevant code to QualifiedAllocationExpression. Added that with the patch
Released commit 9c0f466d3a1091abcce132530971b41684c74f20 in HEAD for 3.8M3.
Verified for 3.8 M3 using build id: N20111022-2000