| Summary: | [exceptions] Very frequent ClassCastExceptions: CompilationUnit | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] JSDT | Reporter: | Jens Beyer <jens.beyer> | ||||||
| Component: | General | Assignee: | Nitin Dahyabhai <thatnitind> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||||
| Severity: | normal | ||||||||
| Priority: | P2 | CC: | cmjaun, itewksbu, mamacdon, raghunathan.srinivasan, vlad.balan | ||||||
| Version: | 3.0.4 | Flags: | thatnitind:
pmc_approved?
(david_williams) raghunathan.srinivasan: pmc_approved+ thatnitind: pmc_approved? (naci.dai) thatnitind: pmc_approved? (deboer) thatnitind: pmc_approved? (neil.hauge) thatnitind: pmc_approved? (kaloyan) thatnitind: review+ |
||||||
| Target Milestone: | 3.2.3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | PMC_approved | ||||||||
| Attachments: |
|
||||||||
|
Description
Jens Beyer
Can you provide any additional details on your project set up or provide a small sample project where this is reproducible? I haven't been able to cause this exception to take place yet. Did the log mention what type of object it was attempting to cast from? The line in question is: SourceFile compilationUnit = (SourceFile) result.getCompilationUnit(); Created attachment 129060 [details]
Requestes sample projects
As requested, find attached two plug-in projects. I created them from scratch in a completely new workspace (just to make sure I didn't mess something up with the workspace) and the exception occured as soon as I added the Javascript library folder of test as library folder in test1 (referenced projects, so to speak).
I have to do that in order to be able to use functions from test in test1. I didn't find any other way to do such.
I am able to reproduce this now. Thanks for the sample projects. It does have something to do with setting up the library folder. Still investigating... Categorizing JSDT bugzillas for planning purposes. *** Bug 318203 has been marked as a duplicate of this bug. *** Steps to Reproduce: 1. create 2 js projects, with 2 js files, each with one function. 2. make one project reference the other through "include path" 3. in the including project's function call the other function, from the included project. save the file. Created attachment 187333 [details]
Fix Patch
The issue here is the Compilers check for weather it should compile a referenced ICompUnit is wrong. It should be checking if the referenced ICompuUnit is a SourceFile and only then try to compile it.
Simple one line fix. Passes all existing JUnits.
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. The compiler breaks its processing when this CCE happens. It doesn't forget that it needs to "compile" the original source file that triggered the problem, though, so it will continue to try and fail to compile it properly. * Is there a work-around? If so, why do you believe the work-around is insufficient? No workaround if the project setup is as required. * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? Ad-hoc testing. * Give a brief technical overview. Who has reviewed this fix? Completing the bindings for a type reference adds all of the compilation units containing it into the list of units to process. The casting to a source unit completes the actual compilation process by storing the generated errors as markers, but there's no need to do that for the units added incidentally to complete bindings. They would be processed as proper source units on their own at another time (at which point they'll cause other units to be loaded for their sake). * What is the risk associated with this fix? Low. It adds an instanceof check before adding actual source units to the more involved compiling queue. Released. |