Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ProjectBuilder: ASTParser does not resolve Bindings
ProjectBuilder: ASTParser does not resolve Bindings [message #1751381] Mon, 09 January 2017 15:28
Ralf S. is currently offline Ralf S.Friend
Messages: 5
Registered: June 2015
Junior Member
Hello,

I've created a plug-in that adds two builders to a Java project:

  1. Generator: This builder generate Java source code based on input from a XML-file. Mainly String constants with annotations.
  2. Validator: This builder parses Java files using the ASTParser and validates the usage of the generated constants based on the info in the annotations.

The Generator is run before the Java Builder and the Validator after it.

So a full build looks like this:

  1. Generator regenerates the Java source based on XML-input - Success
  2. Java-Builder recompiles source code (including newly generated java files) - Success
  3. Validator parses Java Source-Code - Error

The Problem with the Validator is, that it cannot resolve the bindings to the String constants in the newly generated source code ( from build step 1).

In despair I added a 2 seconds sleep to the Validator, before it starts to build the ASTs. Now it works as expected.
So the Validator has to wait for something, but I'm not sure what.

I then used the JobManager to check for background jobs running when the Validator is started. The most promising was "Updating workspace". When I do a Job.join() on that job (and deleting the 2 sec sleep) it also works. The join take between 800 to 1400 ms.

I have two problems with this solution:

  1. Im not sure this is the correct solution.
  2. I'm not happy with selecting the Job "Updating workspace" by name, as i couldn't identify which JobFamily it belongs to.

Any hints or ideas? Every help is appreciated!

Thanks,
Ralf


Previous Topic:Embed eclipse libraries to Third Party Tool
Next Topic:What API level will AST returned by SharedASTProvider.getAST(...) have?
Goto Forum:
  


Current Time: Fri Nov 08 03:13:09 GMT 2024

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

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

Back to the top