Skip to content
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

Cleanup #2026

Merged
merged 17 commits into from
Apr 26, 2021
Merged

Cleanup #2026

merged 17 commits into from
Apr 26, 2021

Conversation

wcekan
Copy link
Contributor

@wcekan wcekan commented Apr 26, 2021

Description

Cleanup compiler warnings.
Remove unnecessary nested else.
Remove unnecessary braces in single statement lambdas.

Motivation and Context

Code quality.

How Has This Been Tested?

Unit testing

License

I confirm that this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@wcekan wcekan requested a review from moizarafat April 26, 2021 02:10
@@ -114,7 +113,7 @@ public void close() throws IOException {
}

protected DataStoreTransaction getTransaction(Object object) {
return getTransaction(object.getClass());
return getTransaction(ClassType.of(object.getClass()));
Copy link
Contributor Author

@wcekan wcekan Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aklish this became an endless loop when

protected DataStoreTransaction getTransaction(Class<?> cls) {

became

protected DataStoreTransaction getTransaction(Type<?> cls) {

@@ -41,7 +41,7 @@

public class CSVExportFormatterTest {
public static final String FORMAT = "yyyy-MM-dd'T'HH:mm'Z'";
private static final SimpleDateFormat FORMATTER = new SimpleDateFormat(FORMAT);
private static final FastDateFormat FORMATTER = FastDateFormat.getInstance(FORMAT, TimeZone.getTimeZone("GMT"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we leverage the new java.time formatter instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
is not a direct replacement for DateFormat.

Also, this is only a test. If anything it is ISO8601DateSerde that would have to change.

public ISO8601DateSerde(SimpleDateFormat df, Class<? extends Date> targetType) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address in a separate PR.

@@ -736,7 +736,7 @@ private static String replaceNewlineWithSpace(String str) {
return (str == null) ? null : NEWLINE.matcher(str).replaceAll(SPACE);
}

private final class ConfigPackage implements Package {
private static final class ConfigPackage implements Package {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why static here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Should com.yahoo.elide.datastores.aggregation.dynamic.TableType$ConfigPackage be a static inner class?
This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. If possible, the class should be made static.

@aklish aklish merged commit 6143d10 into master Apr 26, 2021
@aklish aklish deleted the cleanup branch April 26, 2021 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants