diff options
author | Sergey Prigogin | 2016-08-31 00:06:55 +0000 |
---|---|---|
committer | Sergey Prigogin | 2016-08-31 00:08:11 +0000 |
commit | cb2a038fb522881890e65f94cb469acb242f3b30 (patch) | |
tree | cf82e4cbb432e429572f3dc7c537cff92bcf6fec /bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java | |
parent | d123d8ceecaefa3b677f09e81c09e642a4e988cd (diff) | |
download | eclipse.platform.team-cb2a038fb522881890e65f94cb469acb242f3b30.tar.gz eclipse.platform.team-cb2a038fb522881890e65f94cb469acb242f3b30.tar.xz eclipse.platform.team-cb2a038fb522881890e65f94cb469acb242f3b30.zip |
Fixed compiler warnings.Y20160901-1000I20160906-0800
Change-Id: I97279754360d3135cbc6e30025bd8c2f4b3fb0ce
Diffstat (limited to 'bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java')
-rw-r--r-- | bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java index 37b02420c..019874b29 100644 --- a/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java +++ b/bundles/org.eclipse.compare.core/src/org/eclipse/compare/internal/core/patch/LineReader.java @@ -24,12 +24,11 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; public class LineReader { - - /* + /** * Reads the contents and returns them as a List of lines. */ - public static List load(ReaderCreator content, boolean create) { - List lines = null; + public static List<String> load(ReaderCreator content, boolean create) { + List<String> lines = null; BufferedReader bufferedReader = null; if (!create && content != null && content.canCreateReader()) { // read current contents @@ -39,22 +38,23 @@ public class LineReader { } catch (CoreException ex) { ComparePlugin.log(ex); } finally { - if (bufferedReader != null) + if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException ex) { // silently ignored } + } } } if (lines == null) - lines = new ArrayList(); + lines = new ArrayList<>(); return lines; } - public static List readLines(BufferedReader reader) { - List lines; + public static List<String> readLines(BufferedReader reader) { + List<String> lines; LineReader lr= new LineReader(reader); if (!Platform.WS_CARBON.equals(Platform.getWS())) lr.ignoreSingleCR(); // Don't treat single CRs as line feeds to be consistent with command line patch @@ -65,16 +65,16 @@ public class LineReader { /* * Concatenates all strings found in the given List. */ - public static String createString(boolean preserveLineDelimeters, List lines) { + public static String createString(boolean preserveLineDelimeters, List<String> lines) { StringBuffer sb= new StringBuffer(); - Iterator iter= lines.iterator(); + Iterator<String> iter= lines.iterator(); if (preserveLineDelimeters) { while (iter.hasNext()) - sb.append((String)iter.next()); + sb.append(iter.next()); } else { String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$ while (iter.hasNext()) { - String line= (String)iter.next(); + String line= iter.next(); int l= length(line); if (l < line.length()) { // line has delimiter sb.append(line.substring(0, l)); @@ -91,7 +91,7 @@ public class LineReader { * Returns the length (excluding a line delimiter CR, LF, CR/LF) * of the given string. */ - /* package */ static int length(String s) { + static int length(String s) { int l= s.length(); if (l > 0) { char c= s.charAt(l-1); @@ -131,7 +131,7 @@ public class LineReader { * stream has been reached * @exception IOException If an I/O error occurs */ - /* package */ String readLine() throws IOException { + String readLine() throws IOException { try { while (!this.fSawEOF) { int c= readChar(); @@ -170,7 +170,7 @@ public class LineReader { } } - /* package */ void close() { + void close() { try { this.fReader.close(); } catch (IOException ex) { @@ -178,9 +178,9 @@ public class LineReader { } } - public List readLines() { + public List<String> readLines() { try { - List lines= new ArrayList(); + List<String> lines= new ArrayList<>(); String line; while ((line= readLine()) != null) lines.add(line); @@ -198,7 +198,7 @@ public class LineReader { * Returns the number of characters in the given string without * counting a trailing line separator. */ - /* package */ int lineContentLength(String line) { + int lineContentLength(String line) { if (line == null) return 0; int length= line.length(); |