Bug 52341 - [Readme] Derived ANT BuildListener gets ClassCastException
Summary: [Readme] Derived ANT BuildListener gets ClassCastException
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC4   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
Depends on:
Blocks:
 
Reported: 2004-02-18 03:52 EST by Ed Willink CLA
Modified: 2004-08-05 11:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2004-02-18 03:52:40 EST
This is probably another variation of #34466, but requiring at least a 
generalisation of the Readme for known problems, since I'm not using a
custom Ant task or type.

My plug-in contains a derived org.apache.tools.ant.BuildListener.
It is registered via addBuildListener.
For debug, the derived constructor does a cast to its interface.
Class constructs ok in caller and in invocation from InternalAntRunner.
But, at line 200 of InternalAntRunner

project.addBuildListener((BuildListener) listener.newInstance());

a ClassCastException claims that the derived class is not an instance of its
interface, although the same cast worked within its constructor.

Come on now. Let's get this bug fixed.
Comment 1 Darin Swanson CLA 2004-02-18 11:20:57 EST
You are correct that this is another instance of the type of problem in 34466. 
Loading classes with different classloaders will always cause all kinds of 
interesting behavior.

Will be added to the README for 3.0.
Comment 2 Darin Swanson CLA 2004-06-21 16:43:04 EDT
Added to the 3.0 release notes / readme.
Comment 3 Darin Wright CLA 2004-08-05 11:17:46 EDT
Verified.