-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-2230] ApiSurface Refactoring #3533
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
Conversation
|
@kennknowles would you please review and let me know if I need to make some changes? |
| */ | ||
| @SuppressWarnings("rawtypes") | ||
| public class ApiSurface { | ||
| public abstract class ApiSurface { |
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.
I don't think we need to make this abstract and have subclasses extend ApiSurface. Really, we just need to build values of type ApiSurface. Something like this: directRunnerApiSurface() { return <build the API surface>; }.
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.
I evaluated writing custom methods in ApiSurface but decided not to go that route because some of the ApiSurface test implementation made calls like getClass().getPackage() which I think make them couple to the namespace where they are defined. Also, I think it is good to provide each package a way to build their ApiSurface they way they want through the buildApiSurface() Method.
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.
I mean this:
package org.apache.beam.sdk.util;
public class ApiSurface { ... just like now ... }And separately
class DirectRunnerApiSurfaceTest {
private static ApiSurface directRunnerApiSurface() { ... }
@Test
public void testApiSurface() {
assertThat(directRunnerApiSurface(), containsOnlyClassFrom(....));
}
}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.
I see what you are saying now ApiSurface is not meant to be defined by modules just to verify the set of entities they expose. will make the change accordingly. Thanks for the review.
|
|
||
| /** Returns an empty {@link ApiSurface}. */ | ||
| public static ApiSurface empty() { | ||
| private ApiSurface empty() { |
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.
Why is it not static now? And for all of the methods below, too.
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.
This is a side effect of making the class abstract, since it was constructing an object.
|
@kennknowles modified this as per your comments. |
|
Please @kennknowles Still waiting for your feedback on this. |
|
R: @kennknowles I was just on some vacation, but will be doing lots of reviews now that I am back. Soon. |
|
ping @kennknowles |
|
In fact, the way the ApiSurface tests have been made to scan the classpath is pretty fundamentally broken. I think probably the best thing to do to avoid blocking peoples' work is to remove the tests. (your change is looking good, but the basis is just not right, sorry for the time you spent here!) |
|
@kennknowles no problem, I am going to look into removing them if that has not been taken care of yet. |
|
We have turned on autoformatting of the codebase, which causes small conflicts across the board. You can probably safely rebase and just keep your changes. Like this: Please ping me if you run into any difficulty. |
|
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
[BEAM-<Jira issue #>] Description of pull requestmvn clean verify.<Jira issue #>in the title with the actual Jira issuenumber, if there is one.
Individual Contributor License Agreement.