Skip to content

Commit 1f107c3

Browse files
committed
Reformat our own code to width of 120
1 parent f793b7e commit 1f107c3

File tree

63 files changed

+240
-420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+240
-420
lines changed

.eclipse/org.eclipse.jdt.core.prefs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
384384
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
385385
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
386386
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
387-
org.eclipse.jdt.core.formatter.lineSplit=90
387+
org.eclipse.jdt.core.formatter.lineSplit=120
388388
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
389389
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
390390
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/MessagesTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public class MessagesTests {
3131
@Test
3232
public void bindHasCorrectMessage() {
3333
String message = NLS.bind(Messages.springFormatSettingsImportError, "reason");
34-
assertThat(message)
35-
.isEqualTo("Error importing project specific settings: reason");
34+
assertThat(message).isEqualTo("Error importing project specific settings: reason");
3635
}
3736

3837
}

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/projectsettings/ProjectPropertiesTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ public void getModifiedContentReplacesCopyrightYear() throws IOException {
8080
writeProperties(file, "2016-2020");
8181
ProjectProperties properties = new ProjectProperties();
8282
properties.addFromFolder(folder);
83-
ProjectSettingsFiles files = new ProjectSettingsFilesLocator()
84-
.locateSettingsFiles();
83+
ProjectSettingsFiles files = new ProjectSettingsFilesLocator().locateSettingsFiles();
8584
ProjectSettingsFile prefs = getFile(files, "org.eclipse.jdt.ui.prefs");
8685
String content = loadContent(properties.getModifiedContent(prefs));
87-
assertThat(content)
88-
.contains("Copyright 2016-2020 the original author or authors");
86+
assertThat(content).contains("Copyright 2016-2020 the original author or authors");
8987

9088
}
9189

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/projectsettings/ProjectSettingsFileTests.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,14 @@ public void fromFileAdaptsFile() throws Exception {
4343
writeText(file, "test");
4444
ProjectSettingsFile projectSettingsFile = ProjectSettingsFile.fromFile(file);
4545
assertThat(projectSettingsFile.getName()).isEqualTo(file.getName());
46-
assertThat(projectSettingsFile.getContent())
47-
.hasSameContentAs(new ByteArrayInputStream("test".getBytes()));
46+
assertThat(projectSettingsFile.getContent()).hasSameContentAs(new ByteArrayInputStream("test".getBytes()));
4847
}
4948

5049
@Test
5150
public void fromClasspathResourceAdaptsResource() throws Exception {
52-
ProjectSettingsFile projectSettingsFile = ProjectSettingsFile
53-
.fromClasspath(getClass(), "test.txt");
51+
ProjectSettingsFile projectSettingsFile = ProjectSettingsFile.fromClasspath(getClass(), "test.txt");
5452
assertThat(projectSettingsFile.getName()).isEqualTo("test.txt");
55-
assertThat(projectSettingsFile.getContent())
56-
.hasSameContentAs(new ByteArrayInputStream("test".getBytes()));
53+
assertThat(projectSettingsFile.getContent()).hasSameContentAs(new ByteArrayInputStream("test".getBytes()));
5754
}
5855

5956
private void writeText(File file, String s) throws FileNotFoundException {

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/projectsettings/ProjectSettingsFilesLocatorTests.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,19 @@ public class ProjectSettingsFilesLocatorTests {
4141

4242
@Test
4343
public void locateSettingsFilesWhenNoFoldersShouldReturnDefault() throws IOException {
44-
ProjectSettingsFiles files = new ProjectSettingsFilesLocator()
45-
.locateSettingsFiles();
46-
assertThat(files.iterator()).extracting(ProjectSettingsFile::getName)
47-
.containsOnly("org.eclipse.jdt.core.prefs", "org.eclipse.jdt.ui.prefs");
44+
ProjectSettingsFiles files = new ProjectSettingsFilesLocator().locateSettingsFiles();
45+
assertThat(files.iterator()).extracting(ProjectSettingsFile::getName).containsOnly("org.eclipse.jdt.core.prefs",
46+
"org.eclipse.jdt.ui.prefs");
4847
}
4948

5049
@Test
5150
public void locateSettingsFilesOnlyFindPrefs() throws Exception {
5251
File folder = this.temp.newFolder();
5352
writeFile(folder, "foo.prefs");
5453
writeFile(folder, "bar.notprefs");
55-
ProjectSettingsFiles files = new ProjectSettingsFilesLocator(folder)
56-
.locateSettingsFiles();
57-
assertThat(files.iterator()).extracting(ProjectSettingsFile::getName)
58-
.containsOnly("org.eclipse.jdt.core.prefs", "org.eclipse.jdt.ui.prefs",
59-
"foo.prefs");
54+
ProjectSettingsFiles files = new ProjectSettingsFilesLocator(folder).locateSettingsFiles();
55+
assertThat(files.iterator()).extracting(ProjectSettingsFile::getName).containsOnly("org.eclipse.jdt.core.prefs",
56+
"org.eclipse.jdt.ui.prefs", "foo.prefs");
6057
}
6158

6259
@Test
@@ -66,12 +63,10 @@ public void locateSettingsFilesWhenMultipleFoldersFindsInEarliest() throws Excep
6663
File folder2 = this.temp.newFolder();
6764
writeFile(folder2, "foo.prefs", "foo2");
6865
writeFile(folder2, "org.eclipse.jdt.core.prefs", "core2");
69-
ProjectSettingsFiles files = new ProjectSettingsFilesLocator(folder1, folder2)
70-
.locateSettingsFiles();
66+
ProjectSettingsFiles files = new ProjectSettingsFilesLocator(folder1, folder2).locateSettingsFiles();
7167
Map<String, ProjectSettingsFile> found = new LinkedHashMap<>();
7268
files.iterator().forEachRemaining((f) -> found.put(f.getName(), f));
73-
assertThat(found.get("foo.prefs").getContent())
74-
.hasSameContentAs(new ByteArrayInputStream("foo1".getBytes()));
69+
assertThat(found.get("foo.prefs").getContent()).hasSameContentAs(new ByteArrayInputStream("foo1".getBytes()));
7570
assertThat(found.get("org.eclipse.jdt.core.prefs").getContent())
7671
.hasSameContentAs(new ByteArrayInputStream("core2".getBytes()));
7772
}

spring-javaformat-eclipse/io.spring.javaformat.eclipse.tests/src/io/spring/javaformat/eclipse/projectsettings/ProjectSettingsFilesTests.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,14 @@ public class ProjectSettingsFilesTests {
4545
@Test
4646
public void iteratorIteratesFiles() throws Exception {
4747
ProjectSettingsFile file = ProjectSettingsFile.fromFile(this.temp.newFile());
48-
ProjectSettingsFiles files = new ProjectSettingsFiles(Collections.singleton(file),
49-
new ProjectProperties());
48+
ProjectSettingsFiles files = new ProjectSettingsFiles(Collections.singleton(file), new ProjectProperties());
5049
assertThat(files).containsOnly(file);
5150
}
5251

5352
@Test
5453
public void applyToProjectCopiesToDotSettings() throws Exception {
55-
ProjectSettingsFile file = ProjectSettingsFile
56-
.fromFile(this.temp.newFile("foo.prefs"));
57-
ProjectSettingsFiles files = new ProjectSettingsFiles(Collections.singleton(file),
58-
new ProjectProperties());
54+
ProjectSettingsFile file = ProjectSettingsFile.fromFile(this.temp.newFile("foo.prefs"));
55+
ProjectSettingsFiles files = new ProjectSettingsFiles(Collections.singleton(file), new ProjectProperties());
5956
IProject project = mock(IProject.class);
6057
IProgressMonitor monitor = mock(IProgressMonitor.class);
6158
IFile projectFile = mock(IFile.class);

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/Executor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public void run(Command command) throws CoreException {
5252
throw (CoreException) ex;
5353
}
5454
String msg = NLS.bind(this.failureMessage, ex.getMessage());
55-
throw new CoreException(
56-
new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, msg, ex));
55+
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, msg, ex));
5756
}
5857
}
5958

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/Messages.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
*/
2626
public final class Messages extends NLS {
2727

28-
private static final String BUNDLE_NAME = Messages.class.getPackage().getName()
29-
+ ".messages"; //$NON-NLS-1$
28+
private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
3029

3130
/**
3231
* General error message.

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/formatter/SpringCodeFormatter.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@ public class SpringCodeFormatter extends CodeFormatter {
3434
private Formatter delegate = new Formatter();
3535

3636
@Override
37-
public TextEdit format(int kind, String source, int offset, int length,
38-
int indentationLevel, String lineSeparator) {
39-
return this.delegate.format(kind, source, offset, length, indentationLevel,
40-
lineSeparator);
37+
public TextEdit format(int kind, String source, int offset, int length, int indentationLevel,
38+
String lineSeparator) {
39+
return this.delegate.format(kind, source, offset, length, indentationLevel, lineSeparator);
4140
}
4241

4342
@Override
44-
public TextEdit format(int kind, String source, IRegion[] regions,
45-
int indentationLevel, String lineSeparator) {
46-
return this.delegate.format(kind, source, regions, indentationLevel,
47-
lineSeparator);
43+
public TextEdit format(int kind, String source, IRegion[] regions, int indentationLevel, String lineSeparator) {
44+
return this.delegate.format(kind, source, regions, indentationLevel, lineSeparator);
4845
}
4946

5047
@Override

spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/gradle/RefreshProjectSettingsListeners.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ public void preExecute(String commandId, ExecutionEvent event) {
7878

7979
static void attach() {
8080
if (PlatformUI.isWorkbenchRunning()) {
81-
ICommandService commandService = PlatformUI.getWorkbench()
82-
.getAdapter(ICommandService.class);
81+
ICommandService commandService = PlatformUI.getWorkbench().getAdapter(ICommandService.class);
8382
Command command = commandService.getCommand(COMMAND_NAME);
8483
if (command != null) {
8584
command.addExecutionListener(new CommandListener());
@@ -96,8 +95,7 @@ private static class ProjectListener implements EventListener {
9695

9796
@Override
9897
public void onEvent(Event event) {
99-
if (event instanceof ProjectCreatedEvent
100-
|| event instanceof GradleNatureAddedEvent) {
98+
if (event instanceof ProjectCreatedEvent || event instanceof GradleNatureAddedEvent) {
10199
new RefreshProjectsSettingsJob().schedule();
102100
}
103101
}

0 commit comments

Comments
 (0)