Skip to content

More intellij automated fixes#479

Merged
mikewalch merged 2 commits intoapache:masterfrom
mikewalch:auto-fixes
May 9, 2018
Merged

More intellij automated fixes#479
mikewalch merged 2 commits intoapache:masterfrom
mikewalch:auto-fixes

Conversation

@mikewalch
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Member

@ctubbsii ctubbsii left a comment

Choose a reason for hiding this comment

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

👍 Array literals are my favorite new thing I've learned about Java 8 in the last week, and diamond operator is always good to make lines shorter and more readable.

There may be room for further improvements with some of the singletons which are unnecessarily put into an array, but this change works on its own, too.

public void testSimpleWritable() throws IOException {
Range[] ranges = new Range[] {new Range(new Key("a"), new Key("b"))};
Range[] ranges = {new Range(new Key("a"), new Key("b"))};
BatchInputSplit split = new BatchInputSplit("table", Table.ID.of("1"), Arrays.asList(ranges),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could be further simplified with Collections.singletonList() instead of allocating an intermediate array. I saw a few cases of this "array of singleton" case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 96d0411

zoo.putPersistentData(instanceNamePath, uuid.getBytes(UTF_8), NodeExistsPolicy.FAIL);

final byte[] EMPTY_BYTE_ARRAY = new byte[0], ZERO_CHAR_ARRAY = new byte[] {'0'};
final byte[] EMPTY_BYTE_ARRAY = new byte[0], ZERO_CHAR_ARRAY = {'0'};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Variables should really have their own declarations with their own modifiers. I wonder if we can enforce this with checkstyle.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed in 96d0411

@Test
public void testFilteredMountEntries() throws Exception {
String[] mountEntries = new String[] {"rootfs / rootfs rw 0 0",
String[] mountEntries = {"rootfs / rootfs rw 0 0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thoughts: I really wonder about the portability of this FileSystemMonitor. It seems dubious. I'm not even sure if it works properly with systemd or recognizes m.2 and nvme drives. The FileSystemMonitor seems more like a monitoring utility which should exist separate from Accumulo.

new String[] {"a", "b", "c"}, new String[] {"a", "b", "c", "d", "e"},
new String[] {"a", "b", "c", "d", "e", "f", "g"},
String tests[][] = {new String[] {"a", "b", "c", "d"}, new String[] {"a", "b", "c"},
new String[] {"a", "b", "c", "d", "e"}, new String[] {"a", "b", "c", "d", "e", "f", "g"},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you run it again does it pick up on the inner arrays?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It tried to run it again and it doesn't pickup the inner arrays :-(

@mikewalch mikewalch merged commit 10872a7 into apache:master May 9, 2018
@mikewalch mikewalch deleted the auto-fixes branch May 9, 2018 18:49
@ctubbsii ctubbsii added this to the 2.0.0 milestone Jul 12, 2024
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.

3 participants