jdt core - Breaking API changes from R2.1 to R3.0
java development tooling core |
This document lists the breaking API changes that occured between R2.1 and R3.0 and how to migrate from the R2.1 API to the R3.0 API. |
IWorkingCopy
now extends ICompilationUnit
(see bug 36987 )
Historically, IWorkingCopy
gathered all working copy concerns,
and ICompilationUnit
implement this interface, though only the
factory method makes sense for them; thus their implementation of the working
copy features do nothing relevant to clients. IWorkingCopy
also
implements the spec'ed factory method, but it doesn't work for these.
Clients using IWorkingCopy
and ICompilationUnit
can
adapt to this change by referencing IWorkingCopy
instead of
ICompilationUnit
when a working copy is needed.
IWorkingCopies
(i.e.
getWorkingCopy
and getSharedWorkingCopy
) now return
an IWorkingCopy
instead of an IJavaElement
.
Working copies were initialy designed to be editable elements on any IJavaElement
.
Pratice showed that they were used only to edit ICompilationUnit
. To avoid
downcasting to IWorkingCopy
, the factory methods now return an
IWorkingCopy
.
Clients using factory methods to create working copies can now remove the cast from
IJavaElement
to IWorkingCopy
.