Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -63,7 +63,7 @@ protected void logMessage(String message, BuildEvent event, int overridePriority

StringBuffer fullMessage = new StringBuffer();
if (!loggingToLogFile()) {
fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$
fullMessage.append(System.lineSeparator());
}
if (event.getException() == null && event.getTask() != null && !fEmacsMode) {
adornMessage(event, fullMessage);
Expand Down Expand Up @@ -117,7 +117,7 @@ private void adornMessage(BuildEvent event, StringBuffer fullMessage) {
appendAndLink(fullMessage, location, label, offset, line);
line = r.readLine();
while (line != null) {
fullMessage.append(System.getProperty("line.separator")); //$NON-NLS-1$
fullMessage.append(System.lineSeparator());
fullMessage.append(column);
appendAndLink(fullMessage, location, label, offset, line);
line = r.readLine();
Expand Down Expand Up @@ -262,7 +262,7 @@ private String getTimeString(long milliseconds) {
result.append(RuntimeMessages.AntProcessBuildLogger__milliseconds_6);
}

result.append(System.getProperty("line.separator")); //$NON-NLS-1$
result.append(System.lineSeparator());
return result.toString();
}

Expand All @@ -282,7 +282,7 @@ public void targetStarted(BuildEvent event) {
return;
}
Target target = event.getTarget();
StringBuilder msg = new StringBuilder(System.getProperty("line.separator")); //$NON-NLS-1$
StringBuilder msg = new StringBuilder(System.lineSeparator());
String targetName = target.getName();
msg.append(targetName);
msg.append(':');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2023 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Portions Copyright 2000-2005 The Apache Software Foundation
*
* This program and the accompanying materials are made
Expand Down Expand Up @@ -328,7 +328,7 @@ private void printTargets(Project project) {
*/
private void printTargets(Project project, List<String> names, List<String> descriptions, String heading, int maxlen) {
// now, start printing the targets and their descriptions
String lSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lSep = System.lineSeparator();

String spaces = " "; //$NON-NLS-1$
while (spaces.length() < maxlen) {
Expand Down Expand Up @@ -1164,7 +1164,7 @@ private void printVersion() {
* Logs a message with the client outlining the usage of <b>Ant</b>.
*/
private void printUsage() {
String lSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lSep = System.lineSeparator();
StringBuilder msg = new StringBuilder();
msg.append("ant ["); //$NON-NLS-1$
msg.append(RemoteAntMessages.getString("InternalAntRunner.options_13")); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2016 IBM Corporation and others.
* Copyright (c) 2003, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -192,7 +192,7 @@ protected void receiveMessage(String message) {
if (index > 0) {
int priority = Integer.parseInt(message.substring(0, index));
String msg = message.substring(index + 1);
writeMessage(msg + System.getProperty("line.separator"), priority); //$NON-NLS-1$
writeMessage(msg + System.lineSeparator(), priority);
if (msg.startsWith("BUILD FAILED")) { //$NON-NLS-1$
fBuildFailed = true;
} else if (fBuildFailed) {
Expand Down Expand Up @@ -222,7 +222,7 @@ private void receiveTargetMessage(String message) {
int lineNumber = Integer.parseInt(tokenizer.nextToken());
generateLink(msg, location, lineNumber, 0, msg.length() - 1);
}
writeMessage(msg + System.getProperty("line.separator"), Project.MSG_INFO); //$NON-NLS-1$
writeMessage(msg + System.lineSeparator(), Project.MSG_INFO);
}

private void receiveTaskMessage(String message) {
Expand Down Expand Up @@ -269,7 +269,7 @@ private void receiveTaskMessage(String message) {

StringBuffer fullMessage = new StringBuffer();
adornMessage(taskName, line, fullMessage);
writeMessage(fullMessage.append(System.getProperty("line.separator")).toString(), priority); //$NON-NLS-1$
writeMessage(fullMessage.append(System.lineSeparator()).toString(), priority);
}

private void generateLink(String line, String fileName, int lineNumber, int offset, int length) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 John-Mason P. Shackelford and others.
* Copyright (c) 2004, 2025 John-Mason P. Shackelford and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -93,7 +93,7 @@ public boolean useSpacesInsteadOfTabs() {
private void simpleTest(String sourceFileName, String targetFileName, FormattingPreferences prefs) throws Exception {

XmlDocumentFormatter xmlFormatter = new XmlDocumentFormatter();
xmlFormatter.setDefaultLineDelimiter(System.getProperty("line.separator")); //$NON-NLS-1$
xmlFormatter.setDefaultLineDelimiter(System.lineSeparator());
String result = xmlFormatter.format(Files.readString(getBuildFile(sourceFileName).toPath()), prefs);
String expectedResult = Files.readString(getBuildFile(targetFileName).toPath());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2004, 2013 John-Mason P. Shackelford and others.
* Copyright (c) 2004, 2025 John-Mason P. Shackelford and others.
*
* This program and the accompanying materials
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* John-Mason P. Shackelford - initial API and implementation
* IBM Corporation - bug 84342
Expand Down Expand Up @@ -37,7 +37,7 @@ public final void testFormatUsingPreferenceStore() throws Exception {
node.putInt(AntEditorPreferenceConstants.FORMATTER_TAB_SIZE, 4);
node.flush();
}
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target></project>"; //$NON-NLS-1$
String formattedDoc = XmlFormatter.format(xmlDoc);
String expected = "<project default=\"go\">" + lineSep + "\t<target name=\"go\"" + lineSep //$NON-NLS-1$ //$NON-NLS-2$
Expand Down Expand Up @@ -74,7 +74,7 @@ public int getTabWidth() {
return 6;
}
};
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target></project>"; //$NON-NLS-1$
String formattedDoc = XmlFormatter.format(xmlDoc, prefs);
String expected = "<project default=\"go\">" + lineSep + " <target name=\"go\"" + lineSep //$NON-NLS-1$ //$NON-NLS-2$
Expand Down Expand Up @@ -114,7 +114,7 @@ public int getTabWidth() {
return 6;
}
};
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String xmlDoc = "<project default=\"go\"><target name=\"go\" description=\"Demonstrate the wrapping of long tags.\"><echo>hi</echo></target>" //$NON-NLS-1$
+ lineSep + lineSep + "</project>"; //$NON-NLS-1$
String formattedDoc = XmlFormatter.format(xmlDoc, prefs);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2004, 2013 John-Mason P. Shackelford and others.
* Copyright (c) 2004, 2025 John-Mason P. Shackelford and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* John-Mason P. Shackelford - initial API and implementation
* IBM Corporation - Bug 84342
Expand Down Expand Up @@ -192,7 +192,7 @@ public void testParserGetAttributes() throws Exception {

@Test
public void testFormat01() throws Exception {
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String indent = "\t"; //$NON-NLS-1$
String source = "<target name=\"myTargetName\" depends=\"a,b,c,d,e,f,g\" description=\"This is a very long element which ought to be wrapped.\">"; //$NON-NLS-1$
String target = "<target name=\"myTargetName\"" + lineSep //$NON-NLS-1$
Expand All @@ -204,7 +204,7 @@ public void testFormat01() throws Exception {

@Test
public void testFormat02() throws Exception {
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String indent = "\t"; //$NON-NLS-1$
String source = "<target name=\"myTargetName\" depends=\"a,b,c,d,e,f,g\" description=\"This is a very long element which ought to be wrapped.\">"; //$NON-NLS-1$
String target = "<target name=\"myTargetName\"" + lineSep //$NON-NLS-1$
Expand All @@ -217,7 +217,7 @@ public void testFormat02() throws Exception {

@Test
public void testBug73411() throws Exception {
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String indent = "\t"; //$NON-NLS-1$
String source = "<target name='myTargetName' depends=\"a,b,c,d,e,f,g\" description=\'This is a very long element which ought to be \"wrapped\".'>"; //$NON-NLS-1$
String target = "<target name='myTargetName'" + lineSep //$NON-NLS-1$
Expand Down Expand Up @@ -307,7 +307,7 @@ public boolean alignElementCloseChar() {

tag.setClosed(true);

String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
assertEquals("<myElement attribute1=\"value1\"" + lineSep //$NON-NLS-1$
+ "\t\t attribute2=\"value2\" />", //$NON-NLS-1$
tagFormatter.wrapTag(tag, dontAlignCloseChar, "\t\t ", lineSep)); //$NON-NLS-1$
Expand All @@ -334,7 +334,7 @@ public void testBug63558() throws Exception {
// Ordinarily the double space after the element name would be repaired
// but if the formatter is working correctly these examples will be
// considered malformed and will be passed through untouched.
String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
String lineSep = System.lineSeparator();
String source1 = "<echo file=\"foo\">" + lineSep + "&lt;html>&lt;body>&lt;pre>" //$NON-NLS-1$ //$NON-NLS-2$
+ "${compilelog}&lt;/pre>&lt;/body>&lt;/html>"; //$NON-NLS-1$
FormattingPreferences prefs = getPreferences(true, false, 60);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2021 IBM Corporation and others.
* Copyright (c) 2003, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -285,7 +285,7 @@ protected String getReaderContentAsString(BufferedReader bufferedReader) {

while (line != null) {
if (result.length() != 0) {
result.append(System.getProperty("line.separator")); //$NON-NLS-1$
result.append(System.lineSeparator());
}
result.append(line);
line = bufferedReader.readLine();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*******************************************************************************
* Copyright (c) 2004, 2017 Richard Hoefter and others.
* Copyright (c) 2004, 2025 Richard Hoefter and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* Richard Hoefter ([email protected]) - initial API and implementation, bug 95300, bug 95297, bug 128104, bug 201180, bug 288830
* IBM Corporation - NLS'ing and incorporating into Eclipse.
* - Bug 177833 Class created from combination of all utility classes of contribution
* Richard Hoefter ([email protected]) - initial API and implementation, bug 95300, bug 95297, bug 128104, bug 201180, bug 288830
* IBM Corporation - NLS'ing and incorporating into Eclipse.
* - Bug 177833 Class created from combination of all utility classes of contribution
* - Bug 267459 Java project with an external jar file from C:\ on the build path throws a NPE during the Ant Buildfile generation.
* - bug fixing
*******************************************************************************/
Expand Down Expand Up @@ -134,7 +134,7 @@ public static String getProjectRoot(IJavaProject project) {

/**
* Convert Eclipse path to absolute filename.
*
*
* @param file
* Project root optionally followed by resource name. An absolute path is simply converted to a string.
* @return full qualified path
Expand Down Expand Up @@ -192,7 +192,7 @@ public static String removeProjectRoot(String file, IProject project) {

/**
* Remove project root from given project file.
*
*
* @param newProjectRoot
* replace project root, e.g. with a variable ${project.location}
*/
Expand All @@ -213,7 +213,7 @@ public static String replaceProjectRoot(String file, IProject project, String ne

/**
* Get for given project all directly dependent projects.
*
*
* @return set of IJavaProject objects
*/
public static List<IJavaProject> getClasspathProjects(IJavaProject project) throws JavaModelException {
Expand All @@ -239,7 +239,7 @@ private static void addClasspathProjects(List<IJavaProject> projects, IClasspath

/**
* Get for given project all directly and indirectly dependent projects.
*
*
* @return set of IJavaProject objects
*/
public static List<IJavaProject> getClasspathProjectsRecursive(IJavaProject project) throws JavaModelException {
Expand All @@ -259,7 +259,7 @@ private static void getClasspathProjectsRecursive(IJavaProject project, LinkedLi

/**
* Sort projects according to General -&gt; Workspace -&gt; Build Order.
*
*
* @param javaProjects
* list of IJavaProject objects
* @return list of IJavaProject objects with new order
Expand Down Expand Up @@ -303,10 +303,10 @@ private static List<IJavaProject> sortProjectsUsingBuildOrder(List<IJavaProject>

/**
* Returns cyclic dependency marker for a given project.
*
*
* <p>
* See org.eclipse.jdt.core.tests.model.ClasspathTests.numberOfCycleMarkers.
*
*
* @param javaProject
* project for which cyclic dependency marker should be found
* @return cyclic dependency marker for a given project or <code>null</code> if there is no such marker
Expand All @@ -324,7 +324,7 @@ public static IMarker getCyclicDependencyMarker(IJavaProject javaProject) throws

/**
* Find JUnit tests. Same tests are also returned by Eclipse run configuration wizard.
*
*
* @param containerHandle
* project, package or source folder
*/
Expand Down Expand Up @@ -411,7 +411,7 @@ public int compare(IType o1, IType o2) {
/**
* Platform specific newline character(s).
*/
public static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
public static final String NEWLINE = System.lineSeparator();

public static String removePrefix(String s, String prefix) {
if (s == null) {
Expand Down Expand Up @@ -483,7 +483,7 @@ public static String toString(Document doc) throws TransformerConfigurationExcep

/**
* Converts collection to a separated string.
*
*
* @param c
* collection
* @param separator
Expand All @@ -504,7 +504,7 @@ public static String toString(Collection<String> c, String separator) {

/**
* Remove duplicates preserving original order.
*
*
* @param l
* list to remove duplicates from
* @return new list without duplicates
Expand Down Expand Up @@ -548,7 +548,7 @@ public static boolean existsUserFile(String filename) {

/**
* Request write access to given file. Depending on the version control plug-in opens a confirm checkout dialog.
*
*
* @param shell
* parent instance for dialogs
* @param file
Expand All @@ -561,7 +561,7 @@ public static boolean validateEdit(Shell shell, IFile file) {

/**
* Request write access to given files. Depending on the version control plug-in opens a confirm checkout dialog.
*
*
* @param shell
* parent instance for dialogs
* @return <code>IFile</code> objects for which user confirmed checkout
Expand Down Expand Up @@ -633,7 +633,7 @@ public static boolean isDefaultClasspath(IJavaProject project, EclipseClasspath

/**
* Add variable/value for Eclipse variable. If given string is no variable, nothing is added.
*
*
* @param variable2valueMap
* property map to add variable/value
* @param s
Expand Down
Loading
Loading