Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2015-03-05 04:41:23 -0500
committerSarika Sinha2015-03-05 04:41:23 -0500
commit4033dafbeb0b55279a16ddab06d8db5e397f7bb2 (patch)
tree3cb931b4a128efea9f14b3334931555829ab35bd
parent25611f0b960f8297cf41ec2a2ffe7d49c22209aa (diff)
downloadeclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.tar.gz
eclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.tar.xz
eclipse.platform.debug-4033dafbeb0b55279a16ddab06d8db5e397f7bb2.zip
Bug 461219 - Compile warnings in official buildI20150305-1200
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java27
-rw-r--r--org.eclipse.debug.examples.core/pom.xml2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java13
-rw-r--r--org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java21
-rw-r--r--org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--org.eclipse.debug.examples.mixedmode/pom.xml2
-rw-r--r--org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java12
-rw-r--r--org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--org.eclipse.debug.tests/pom.xml2
-rw-r--r--org.eclipse.ui.externaltools/pom.xml2
13 files changed, 34 insertions, 62 deletions
diff --git a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
index 091dbe0d4..854ba028d 100644
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -110,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
diff --git a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
index 195d902bd..4f473c9d1 100644
--- a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
+++ b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 Wind River Systems and others.
+ * Copyright (c) 2005, 2015 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -387,10 +387,9 @@ public class PDAVirtualMachine {
fFilename = inputFile;
// Load all the code into memory
- FileReader fileReader = new FileReader(inputFile);
StringWriter stringWriter = new StringWriter();
List<String> code = new LinkedList<String>();
- try {
+ try (FileReader fileReader = new FileReader(inputFile)) {
int c = fileReader.read();
while (c != -1) {
if (c == '\n') {
@@ -402,9 +401,7 @@ public class PDAVirtualMachine {
c = fileReader.read();
}
}
- finally {
- fileReader.close();
- }
+
code.add(stringWriter.toString().trim());
fCode = code.toArray(new String[code.size()]);
@@ -456,16 +453,16 @@ public class PDAVirtualMachine {
System.out.println("-debug " + fCommandPort + " " + fEventPort); //$NON-NLS-1$ //$NON-NLS-2$
}
- ServerSocket commandServerSocket = new ServerSocket(fCommandPort);
- fCommandSocket = commandServerSocket.accept();
- fCommandReceiveStream = new BufferedReader(new InputStreamReader(fCommandSocket.getInputStream()));
- fCommandResponseStream = new PrintStream(fCommandSocket.getOutputStream());
- commandServerSocket.close();
+ try (ServerSocket commandServerSocket = new ServerSocket(fCommandPort)) {
+ fCommandSocket = commandServerSocket.accept();
+ fCommandReceiveStream = new BufferedReader(new InputStreamReader(fCommandSocket.getInputStream()));
+ fCommandResponseStream = new PrintStream(fCommandSocket.getOutputStream());
+ }
- ServerSocket eventServerSocket = new ServerSocket(fEventPort);
- fEventSocket = eventServerSocket.accept();
- fEventStream = new PrintStream(fEventSocket.getOutputStream());
- eventServerSocket.close();
+ try (ServerSocket eventServerSocket = new ServerSocket(fEventPort)) {
+ fEventSocket = eventServerSocket.accept();
+ fEventStream = new PrintStream(fEventSocket.getOutputStream());
+ }
System.out.println("debug connection accepted"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.examples.core/pom.xml b/org.eclipse.debug.examples.core/pom.xml
index 5e9c0b42b..18bdfb23e 100644
--- a/org.eclipse.debug.examples.core/pom.xml
+++ b/org.eclipse.debug.examples.core/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2013 Eclipse Foundation and others.
+ Copyright (c) 2012, 2015 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
index b4a2ecf73..b1bc4d67c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -128,18 +128,9 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
* @return a free port number on localhost, or -1 if unable to find a free port
*/
public static int findFreePort() {
- ServerSocket socket= null;
- try {
- socket= new ServerSocket(0);
+ try (ServerSocket socket = new ServerSocket(0)) {
return socket.getLocalPort();
} catch (IOException e) {
- } finally {
- if (socket != null) {
- try {
- socket.close();
- } catch (IOException e) {
- }
- }
}
return -1;
}
diff --git a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
index d51bba239..3f6f99350 100644
--- a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
+++ b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -164,20 +164,10 @@ public class PreProcessor extends Task {
}
} else {
// write new file
- FileWriter writer = null;
- try {
- writer = new FileWriter(destFile);
+ try (FileWriter writer = new FileWriter(destFile)) {
writer.write(contents);
} catch (IOException e) {
throw new BuildException(e);
- } finally {
- try {
- if (writer != null) {
- writer.close();
- }
- } catch (IOException e) {
- throw new BuildException(e);
- }
}
}
}
@@ -191,11 +181,9 @@ public class PreProcessor extends Task {
*/
public String preProcessFile(File srcFile, String strip) {
try {
- FileReader fileReader = new FileReader(srcFile);
- BufferedReader reader = new BufferedReader(fileReader);
boolean changed = false;
StringBuffer buffer = new StringBuffer();
- try {
+ try (FileReader fileReader = new FileReader(srcFile); BufferedReader reader = new BufferedReader(fileReader)) {
String line = reader.readLine();
String activeSymbol = null;
int state = STATE_OUTSIDE_CONDITION;
@@ -283,9 +271,6 @@ public class PreProcessor extends Task {
line = reader.readLine();
}
}
- finally {
- reader.close();
- }
if (!changed) {
return null;
}
diff --git a/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
index 091dbe0d4..854ba028d 100644
--- a/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -110,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
diff --git a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
index 091dbe0d4..854ba028d 100644
--- a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -110,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
diff --git a/org.eclipse.debug.examples.mixedmode/pom.xml b/org.eclipse.debug.examples.mixedmode/pom.xml
index b1a6d2d30..495622f11 100644
--- a/org.eclipse.debug.examples.mixedmode/pom.xml
+++ b/org.eclipse.debug.examples.mixedmode/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2013 Eclipse Foundation and others.
+ Copyright (c) 2013, 2015 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
diff --git a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
index 091dbe0d4..854ba028d 100644
--- a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -110,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
index d799e50bf..caa7fea92 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
@@ -127,10 +127,8 @@ public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
}
private int findLine(IFile file, String var) throws CoreException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
-
int lineNum = 0;
- try {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()))) {
while(true) {
String line = reader.readLine().trim();
if (line.startsWith("var")) { //$NON-NLS-1$
@@ -144,12 +142,8 @@ public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
} catch (IOException e) {
// end of file reached and line wasn't found
return -1;
- } finally {
- try {
- reader.close();
- } catch (IOException e) {}
- }
- return lineNum;
+ }
+ return lineNum;
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
index 091dbe0d4..854ba028d 100644
--- a/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -110,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
diff --git a/org.eclipse.debug.tests/pom.xml b/org.eclipse.debug.tests/pom.xml
index 4d050dcf1..36e1b60a3 100644
--- a/org.eclipse.debug.tests/pom.xml
+++ b/org.eclipse.debug.tests/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2014 Eclipse Foundation and others.
+ Copyright (c) 2012, 2015 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
diff --git a/org.eclipse.ui.externaltools/pom.xml b/org.eclipse.ui.externaltools/pom.xml
index 2780b7d1a..ce2eefb71 100644
--- a/org.eclipse.ui.externaltools/pom.xml
+++ b/org.eclipse.ui.externaltools/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2013 Eclipse Foundation and others.
+ Copyright (c) 2012, 2015 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at

Back to the top