Community
Participate
Working Groups
It could be useful to be able to create only a subpart of a compilation unit instead of the whole compilation unit when the user knows that the interesting part is located in a method. In this case only this method should have its statement created in the resulting DOM/AST.
Suggested API on org.eclipse.jdt.core.dom.AST: public static CompilationUnit parsePartialCompilationUnit( ICompilationUnit unit, int position, boolean resolveBindings) public static CompilationUnit parsePartialCompilationUnit( ICompilationUnit unit, int position, boolean resolveBindings, WorkingCopyOwner owner)
Changed milestone.
Jim, could you please review the javadoc? When done, please reassign it to me and I will close it. Regression tests added.
Made minor improvements to wording of spec. Dirk or Martin should review to ensure this is what is needed. Olivier: The implementation should quietly ignore source positions that are negative or completely out of range. (I also added some missing owner !=null checks to the AST.parse... methods that take a WorkingCopyOwner.)
Added bound checks. Fixed and released in HEAD. Regression tests added in jdt/ui tests and jdt/core dom tests. Reopen if this is not what you wanted.
Verified.