Bug 2857 - Renaming .java class with errors to .txt leaves errors in Task list (1GK06R3)
Summary: Renaming .java class with errors to .txt leaves errors in Task list (1GK06R3)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All Windows NT
: P3 enhancement (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 13008 14340 (view as bug list)
Depends on:
Blocks: 13008
  Show dependency tree
 
Reported: 2001-10-10 22:44 EDT by Karice McIntyre CLA
Modified: 2002-11-21 11:59 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karice McIntyre CLA 2001-10-10 22:44:48 EDT
Preference option to save resource upon modification is turned on
(Not sure if that is relevant in this case)

If I have a java class that has errors and I rename it to be a .txt file
the errors in the Task list do not go away (I have to do a rebuild to 
get the errors to go away).  However, if I rename it back to .java, 
the errors show up right away, without a rebuild.

STEPS:
*Create the following class in a Java project in the Resource Perspective:
public class TaskClass {
      private int y;
      public TaskClass() {
      }
      public void doThis() {
      }
      abstract public void doThat();
      public int getX() {
       return x;
      }
     }
Notice in the Tasks list that there are 2 errors.

*In Nav, Rename TaskClass.java to TaskClass.txt.
BUG: Notice that the errors are still there

workaround: Do Project-> Rebuild All to make the errors go away.

NOTES:
Comment 1 DJ Houghton CLA 2001-10-29 19:21:50 EST
PRODUCT VERSION:
eclipse sdk 135 winnt 4.0

Comment 2 Peter Burka CLA 2002-04-03 17:12:45 EST
Build 20020321

I encountered a similar problem when I renamed a package.  Renaming the package 
caused several errors within the package to be fixed.  However the errors still 
appeared in the task list.

Steps to repeat:

Create a new file named foo/Foo.java:

package foo;

public class Foo {
	public static void main(String[] args) {
		new baz.Foo();	
	}
}

An error will appear because baz.Foo is undefined.
Rename the package 'foo' to 'baz'.
The class will no longer be tagged as a problem, but the problem remains in the 
task list.

Rebuilding (or even building) the project does not seem to fix the problem.

Rebuilding the workspace also does not fix the problem.

How do I get rid of these tasks???
Comment 3 DJ Houghton CLA 2002-04-03 17:40:15 EST
Note that Peter's problem was fixed along with Bug 12269.

The first problem happened to me too.

Basically renaming a Java file with problems to a text file carries the markers 
with it. Since the new file isn't a java file, I would assume that the java 
builder doesn't clear the problems because its not compiling the new text file. 
Doing a rebuild on the project removes all java problems and thus gets rid of 
this bogus error. Should the java problems be removed on a resource move? 
(note: consider autobuild on/off here?)

Moving to JDT/Core for comment.
Comment 4 Philipe Mulet CLA 2002-04-04 06:01:09 EST
I don't see why autobuild would make any difference here, I think the builder 
is innocent... however, there is clearly is an issue with moving resources with 
problems.

I think the Java problems should always be cleared if the target resource is 
not a JAVA file...

Comment 5 Jerome Lanneluc CLA 2002-04-09 09:52:15 EDT
We need to remove the markers in the delta processor. However this can be done 
only when resource modification is allowed (i.e. during PRE_AUTO_BUILD or 
POST_AUTO_BUILD). We would have to move the delta processing in either of these 
events. This is a major change and will not occur before 2.0.
Comment 6 Philipe Mulet CLA 2002-07-25 06:59:44 EDT
Reopening
Comment 7 Philipe Mulet CLA 2002-07-25 07:01:01 EDT
Clearing resolution
Comment 8 Philipe Mulet CLA 2002-07-31 10:36:01 EDT
*** Bug 13008 has been marked as a duplicate of this bug. ***
Comment 9 Philipe Mulet CLA 2002-09-23 04:48:09 EDT
We should record these in a list of files which need to have their problem 
markers flushed, which the Java builder will process when building so as to 
remove all their markers.
Comment 10 Jerome Lanneluc CLA 2002-10-02 11:57:10 EDT
Java builder is creating these markers so it's up to the Java builder to delete 
those.
Fixed Java builder to remove problems and tasks for a compilation unit that is 
deleted and that has the MOVE_TO flags set.
If the target file is a compilation unit, the new cu will be recompiled	and new 
markers added.
If the target file is a non-java resource (as in this bug), then markers are 
removed.
Comment 11 David Audel CLA 2002-10-17 10:36:47 EDT
Verified.
Comment 12 Jerome Lanneluc CLA 2002-11-21 11:59:21 EST
*** Bug 14340 has been marked as a duplicate of this bug. ***