-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An extension point allowing third parties to override source to dom tree implementations #2560
An extension point allowing third parties to override source to dom tree implementations #2560
Conversation
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ICompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
67b41dd
to
a4d4296
Compare
@testforstephen Would you mind giving a review on this PR? Thanks. |
sure, I'll take a look next week. |
@testforstephen , also something to consider. I noticed your compiler extension PR extends via system property containing the FQN + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the extension point looks clean to me. Could you add some unit tests for it?
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Outdated
Show resolved
Hide resolved
I'd keep the compiler extension PR as it is for now. If we encounter any limitations with this approach, we can consider changing it to an extension point later. |
Working on test cases. Will update PR asap. |
0b8c177
to
cc3ded4
Compare
c8da8dc
to
be4b1df
Compare
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Show resolved
Hide resolved
...ore.tests.model/src/org/eclipse/jdt/core/tests/dom/CompilationUnitResolverDiscoveryTest.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
...ore.tests.model/src/org/eclipse/jdt/core/tests/dom/CompilationUnitResolverDiscoveryTest.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that only copies or immutable data structures are passed to third party to prevent that changes by third party can make errors in jdt. IProgressMonitor is an exceptional case.
int is OK,
String is OK,
Arrays are mutable -> copy or better use a immutable List.
Map -> make a immutable copy
FileASTRequestor is mutable -> i don't have solution for that at hand
The FileASTRequestor is intentionally mutable. It's even expected that one of its field gets modified as part of the process. It kind of captures some of the state. I believe we won't be able to change that. |
8429dcb
to
aca0803
Compare
I've updated arrays and maps to be cloned or immutable before sending them to the unitResolver. |
059b135
to
d452370
Compare
Is anything else needed before this can be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has some formatting issues, others look good to me.
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
Outdated
Show resolved
Hide resolved
…mentations Signed-off-by: Rob Stryker <stryker@redhat.com> exsd cleanup Signed-off-by: Rob Stryker <stryker@redhat.com> Cleanup Signed-off-by: Rob Stryker <stryker@redhat.com> Javadoc for added interface Signed-off-by: Rob Stryker <stryker@redhat.com> More docs Remove printStackTrace() Signed-off-by: Rob Stryker <stryker@redhat.com> Handle quality checks Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com> Import errors Signed-off-by: Rob Stryker <stryker@redhat.com> Clean up API Tools warnings Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
according to review comments
d452370
to
060655a
Compare
Unless I missed one, all former review comments are now covered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Show resolved
Hide resolved
org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/ICompilationUnitResolver.java
Outdated
Show resolved
Hide resolved
...ore.tests.model/src/org/eclipse/jdt/core/tests/dom/CompilationUnitResolverDiscoveryTest.java
Show resolved
Hide resolved
* cache the config element and minimize access to extension registry * Removed @SInCE * Add doc * Fix and register test case in a suite
@iloveeclipse I appended a commit that should cover all your comments. |
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Show resolved
Hide resolved
@iloveeclipse I think all your review comments were addressed, can you please have another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All concerns cleared.
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolverDiscovery.java
Show resolved
Hide resolved
Are we waiting for someone else to review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there is some concern I plan to merge this one on Monday.
3 committers approved the patch - merging. |
Thanks to everyone involved! |
…ree implementations (eclipse-jdt#2560) This extension point would allow third party products to override the conversion between java source files and the JDT dom tree with a custom implementation. In order to prevent rogue extenders from simply breaking people's installations, a system property selecting the preferred ICompilationUnitResolver must be set, as well. Signed-off-by: Rob Stryker <stryker@redhat.com> Co-authored-by: Rob Stryker <stryker@redhat.com> Co-authored-by: Mickael Istria <mistria@redhat.com>
…ree implementations (eclipse-jdt#2560) This extension point would allow third party products to override the conversion between java source files and the JDT dom tree with a custom implementation. In order to prevent rogue extenders from simply breaking people's installations, a system property selecting the preferred ICompilationUnitResolver must be set, as well. Signed-off-by: Rob Stryker <stryker@redhat.com> Co-authored-by: Rob Stryker <stryker@redhat.com> Co-authored-by: Mickael Istria <mistria@redhat.com>
What it does
This extension point would allow third party products to override the conversion between java source files and the JDT dom tree with a custom implementation. In order to prevent rogue extenders from simply breaking people's installations, a system property selecting the preferred ICompilationUnitResolver must be set, as well.
As consumers of JDT become more diverse and also have been operating in environments not previously expected, being able to properly define the borders and interactions between and among the various parts of JDT becomes important. As resources to maintain various parts of the codebase become scarce, allowing the community to experiment with potentially more efficient solutions also becomes important.
Ensuring that the community can contribute to a common codebase for the vast majority of the shared work is critical to providing that community the cohesion, common goals, and shared visions that maintains a project. And allowing different elements of the community the freedom, via extension points or otherwise, to investigate alternatives to parts of the current codebase will serve to keep the project growing long term.
How to test
Other than exposing an extension point, this change does not significantly change any behavior. To test, one could attempt to make a plugin using this extension point and verifying that the various interface methods are called in a runtime workbench. I am not familiar with how the jdt.core project prefers to automatically test extension points, especially ones that require a sysprop to also be set.
Author checklist