Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » ASTParser.setFocalPosition(int) question(ASTParser.setFocalPosition(int) question)
ASTParser.setFocalPosition(int) question [message #517699] Mon, 01 March 2010 13:45 Go to next message
Eclipse UserFriend
The JavaDoc for ASTParser.setFocalPosition(int) says:

"Requests an abridged abstract syntax tree. By default, complete ASTs are returned."

Although those statements and the rest of the JavaDoc seem to be obsolete (The comment seems to be discussing a method that takes a boolean etc.), that's not my question. :-) If I am only interested in getting an "abridged AST" and not so interested in a "focal position", does it make sense to simply call this method with a position of 0?

It seems like there should be an addition method like setPartial(boolean)? Or am I missing something?

Thanks.
Re: ASTParser.setFocalPosition(int) question [message #518617 is a reply to message #517699] Thu, 04 March 2010 11:09 Go to previous messageGo to next message
Eclipse UserFriend
setFocalPosition(..) should be used when you want the method body for a specific method, but not for all other methods.
If you never want method bodies, you can use the new method on ASTParser:
org.eclipse.jdt.core.dom.ASTParser.setIgnoreMethodBodies(boo lean)

If you can point us to the obsolete documentation, we might get it fixed.

Thanks.

Olivier
Re: ASTParser.setFocalPosition(int) question [message #518677 is a reply to message #518617] Thu, 04 March 2010 13:02 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for pointing out that new method, Olivier. I guess I need to keep a closer watch on the API. I've been pondering this question for several years now. :-)
Quote:
If you can point us to the obsolete documentation, we might get it fixed.

The method comment reads like the first few sentences are left over from a method like setPartial(boolean). The two sentences make no mention of what the supplied 'position' parameter is for, they just seem to discuss what is a side-effect of setting the "focal position". Then the third sentence says:
Quote:
When <code>true</code> the resulting AST does not have nodes for the entire compilation unit.
What is this referring to? What is supposed to be 'true'?

Anyway, nothing fatal. If you read the entire comment, you can figure out what is going on; it's just that the introduction feels out of sync....

Brian
Re: ASTParser.setFocalPosition(int) question [message #518948 is a reply to message #518677] Fri, 05 March 2010 09:32 Go to previous messageGo to next message
Eclipse UserFriend
I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=304817 to track the documentation issue.
Feel free to add yourself to the CC list.
--
Olivier
Re: ASTParser.setFocalPosition(int) question [message #518960 is a reply to message #518948] Fri, 05 March 2010 10:10 Go to previous messageGo to next message
Eclipse UserFriend
I released a change in the documentation. Let me know if you find it better now.
Thanks.
--
Olivier
Re: ASTParser.setFocalPosition(int) question [message #519047 is a reply to message #518960] Fri, 05 March 2010 15:45 Go to previous message
Eclipse UserFriend
It looks fine. Thanks.
Brian
Previous Topic:Compile and call the class during the runtime
Next Topic:Eclipse ME
Goto Forum:
  


Current Time: Sun Mar 16 09:54:28 EDT 2025

Powered by FUDForum. Page generated in 0.02525 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top