Bug 26197 (leeaur) - Reference to realThing in UnknownElement.execute defined to null to early
Summary: Reference to realThing in UnknownElement.execute defined to null to early
Status: NEW
Alias: leeaur
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.6.0
Hardware: All All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-16 15:36 UTC by Rikard Thulin
Modified: 2017-08-18 13:16 UTC (History)
1 user (show)



Attachments
HACKED (deleted)
2017-08-17 05:36 UTC, rizky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rikard Thulin 2004-01-16 15:36:49 UTC
In UnknownElement.execute() the variable realThing is defined to null. This
makes it impossible to use BuildEvent (via BuildListener) and getTask(), e.g.

public void taskFinished(BuildEvent event) {
	Task task = event.getTask();
        if (task instanceof UnknownElement) {
	    UnknownElement ue = (UnknownElement)task;
	    System.out.println("UE TASK: " + ue.getTask()); // WILL PRINT NULL
	}
}

The following change in UnknownElement.execute would make this work, but I guess
 it creates other problems with GC?:

// the task will not be reused ( a new init() will be called )
// Let GC do its job
//realThing = null;         ****** THIS LINE WAS REMOVE TO GET IT TO WORK!
Comment 1 Rikard Thulin 2007-11-21 23:00:46 UTC
Is it possible to investigate this bug? Currently BuildListeners does only work
for doing simple things such as logging events. If this bug is fixed it would be
possible for IDE:s to extract information such as classpath from the javac task
and add that to IDE:s project settings. Integration between ant and IDE:s would
be greatly enhanced.
Comment 2 Steve Loughran 2007-11-22 02:09:51 UTC
The reference to GC is a warning sign, it means things must have leaked badly in
the past. As such, even if we look at it (and reminding us helps) it would have
to be done looking at the impact the value has on memory consumption. 
Comment 3 Stefan Bodewig 2017-08-18 13:16:15 UTC
The content of attachment 35241 [details] has been deleted for the following reason:

bogus attempt of a hack