Community
Participate
Working Groups
Build Identifier: In situations like the one below, we should have a quick fix that removes the wrong statement. final Foobar foobar = new Foobar(); foobar.callNoneExistingMethod("compile error here"); ^^^^^^^^^^^^^^^^^^^^^^^ The method callNoneExistingMethod(String) is undefined for the type Foobar .... There should be a quickfix "remove statement" available ... that's the easiest way to fix the bug ;) Reproducible: Always
This doesn't make too much sense and you'd still have a compile error afterwards.
Dani, let me explain more detailed ... Imagine you have a Utilclass "Foobar.doIt("XXX")" ... Now you have 50 Classes where you call this method ... Then you delete Foobar.doIt (there is no refactoring method "remove method". After this you have 50 compile errors ... no such method ... class #1: foobar.doIt("AAA"); ^^^ class #2: foobar.doIt("AAA"); ^^^ class #3: foobar.doIt("BBB"); ^^^ ... I want to go to the ProblemView ... select all this compile errors and want execute quick fix "remove statement" ... after this all these 50 classes now without compile errors. Do you understand?
(In reply to comment #2) > Dani, let me explain more detailed ... > Imagine you have a Utilclass "Foobar.doIt("XXX")" ... > Now you have 50 Classes where you call this method ... > Then you delete Foobar.doIt (there is no refactoring method "remove method". > After this you have 50 compile errors ... no such method ... > > class #1: > foobar.doIt("AAA"); > ^^^ > class #2: > foobar.doIt("AAA"); > ^^^ > class #3: > foobar.doIt("BBB"); > ^^^ > ... > > I want to go to the ProblemView ... select all this compile errors and want > execute quick fix "remove statement" ... after this > all these 50 classes now without compile errors. > > Do you understand? Yes, you want to remove the whole line to get rid of the compile . The argument list might have code that you don't want to delete. Also, can use search/replace for that. We won't add a quick fix for this.
You are right ... the result maybe (still) wrong. But anyway ... maybe somebody need such a quick fix ... I created a simple plugin to provide this quickfix :D Have a look at https://github.com/ahoehma/de.ahoehma.jdt I think if the quickfix is only available for "missing void methods" the code after removing the compile-code-statement should work.
(In reply to comment #2) > Then you delete Foobar.doIt (there is no refactoring method "remove method". If the method is really useless, then just make sure it has an empty body and then inline it.
(In reply to comment #5) > (In reply to comment #2) > > Then you delete Foobar.doIt (there is no refactoring method "remove method". > > If the method is really useless, then just make sure it has an empty body and > then inline it. Ahh ... brilliant idea Markus! This concept could be used for a "remove method refactoring".