-
Notifications
You must be signed in to change notification settings - Fork 32
Refact: Did nit fixes in entire project code and updated header also added missing headers #252
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
…added missing headers
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, I just have one small comment
core-api/src/main/java/com/optimizely/ab/bucketing/UserProfileService.java
Outdated
Show resolved
Hide resolved
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
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.
Thanks for adding the missing header!
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.
Thanks for the much needed clean-up. I left a few comments where I think we can do a little better while we are in here making changes.
Main thing we should clean-up is the placement of annotations on return types. I added a handful comments on specific lines, but not exhaustive. Can find more by searching the diff for "public @"
@@ -117,7 +118,8 @@ public LiveVariable(@JsonProperty("id") String id, | |||
this.type = type; | |||
} | |||
|
|||
public @Nullable VariableStatus getStatus() { | |||
public @Nullable | |||
VariableStatus getStatus() { |
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 should be single line.
the cause is probably the annotation on the return type being unconventional. Snippet below is equivalent and probably wont confuse auto-formatter tool
@Nullable
public VariableStatus getStatus() {
* @param errorHandler the error handler to send exceptions to | ||
* @return the event type for the given event name | ||
*/ | ||
public @CheckForNull EventType getEventTypeForName(String eventName, ErrorHandler errorHandler) { | ||
public @CheckForNull | ||
EventType getEventTypeForName(String eventName, ErrorHandler errorHandler) { |
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 move the @CheckForNull
annotation to before public
like how its used on getExperimentForKey
. They are equivalent and wont produce weird formatting where public
is on different line. That's easy to misread as a package-local visibility.
getEventNameMapping() | ||
.get(eventName); | ||
getEventNameMapping() | ||
.get(eventName); |
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.
can be single line
@@ -299,7 +296,8 @@ public Experiment getExperimentForKey(@Nonnull String experimentKey, | |||
} | |||
|
|||
|
|||
public @Nullable Experiment getExperimentForVariationId(String variationId) { | |||
public @Nullable | |||
Experiment getExperimentForVariationId(String variationId) { |
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.
Same as other comments about annotation placement for return types. This is formatting is worse.
public @Nullable Variation getForcedVariation(@Nonnull String experimentKey, | ||
@Nonnull String userId) { | ||
public @Nullable | ||
Variation getForcedVariation(@Nonnull String experimentKey, |
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.
Same as other comments about annotation placement for return types. This is formatting is worse.
@@ -67,7 +67,8 @@ public Object getValue() { | |||
return value; | |||
} | |||
|
|||
public @Nullable Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) { | |||
public @Nullable | |||
Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) { |
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.
Same as other comments about annotation placement for return types. This is formatting is worse.
@@ -44,15 +44,15 @@ public OrCondition(@Nonnull List<Condition> conditions) { | |||
// false or null is null | |||
// false or false is false | |||
// null or null is null | |||
public @Nullable Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) { | |||
public @Nullable | |||
Boolean evaluate(ProjectConfig config, Map<String, ?> attributes) { |
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.
Same as other comments about annotation placement for return types. This is formatting is worse.
protected SubstringMatch(String value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* This matches the same substring matching logic in the Web client. | ||
* | ||
* @param attributeValue | ||
* @return true/false if the user attribute string value contains the condition string value | ||
*/ | ||
public @Nullable | ||
Boolean eval(Object attributeValue) { |
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.
Lets update this annotation placement for style consistency
|
||
@Override | ||
public @CheckForNull | ||
Void handleResponse(HttpResponse response) throws IOException { |
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.
Same as other comments about annotation placement for return types.
public @Nullable Variation bucket(@Nonnull Experiment experiment, | ||
@Nonnull String bucketingId) { | ||
public @Nullable | ||
Variation bucket(@Nonnull Experiment experiment, |
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.
Same as other comments about annotation placement for return types. This is formatting is worse.
@loganlinn I have updated the PR and did all the changes you have asked for. |
Summary