Skip to content

Commit 422dc13

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of debug/org.eclipse.debug.tests
1 parent ef2aecb commit 422dc13

File tree

13 files changed

+9
-31
lines changed

13 files changed

+9
-31
lines changed

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/SerialExecutorTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.eclipse.debug.tests.AbstractDebugTest;
2727
import org.junit.Test;
2828

29-
@SuppressWarnings("restriction")
3029
public class SerialExecutorTest extends AbstractDebugTest {
3130
@Override
3231
public void tearDown() throws Exception {

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
* Primary tests fixed width mode and calculation of {@link TextChangingEvent}s.
4747
* </p>
4848
*/
49-
@SuppressWarnings("restriction")
5049
public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
5150

5251
/**

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,6 @@ public void setIgnoreFixedConsole(boolean ignoreWrappeding) {
786786
*
787787
* @return output partition identifier
788788
*/
789-
@SuppressWarnings("restriction")
790789
public static String outputPartitionType() {
791790
return org.eclipse.ui.internal.console.IOConsolePartition.OUTPUT_PARTITION_TYPE;
792791
}
@@ -797,7 +796,6 @@ public static String outputPartitionType() {
797796
*
798797
* @return input partition identifier
799798
*/
800-
@SuppressWarnings("restriction")
801799
public static String inputPartitionType() {
802800
return org.eclipse.ui.internal.console.IOConsolePartition.INPUT_PARTITION_TYPE;
803801
}

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
/**
4646
* Tests the ProcessConsoleManager.
4747
*/
48-
@SuppressWarnings("restriction")
4948
public class ProcessConsoleManagerTests extends AbstractDebugTest {
5049

5150
/**

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ public void processConsoleUTF8Input(String prefix, int numTwoByteCharacters) thr
192192
final ILaunch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
193193
launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, StandardCharsets.UTF_8.toString());
194194
final IProcess process = DebugPlugin.newProcess(launch, mockProcess, "testUtf8Input");
195-
@SuppressWarnings("restriction")
196195
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), StandardCharsets.UTF_8.toString());
197196
try {
198197
console.initialize();
@@ -223,11 +222,9 @@ public void testInputReadJobCancel() throws Exception {
223222
final MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
224223
try {
225224
final IProcess process = mockProcess.toRuntimeProcess("testInputReadJobCancel");
226-
@SuppressWarnings("restriction")
227225
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider());
228226
try {
229227
console.initialize();
230-
@SuppressWarnings("restriction")
231228
final Class<?> jobFamily = org.eclipse.debug.internal.ui.views.console.ProcessConsole.class;
232229
assertThat(Job.getJobManager().find(jobFamily)).as("check input read job started").hasSizeGreaterThan(0);
233230
Job.getJobManager().cancel(jobFamily);
@@ -287,7 +284,6 @@ public void processTerminationTest(ILaunchConfiguration launchConfig, boolean te
287284
final AtomicBoolean terminationSignaled = new AtomicBoolean(false);
288285
final Process mockProcess = new MockProcess(null, null, terminateBeforeConsoleInitialization ? 0 : -1);
289286
final IProcess process = DebugPlugin.newProcess(new Launch(launchConfig, ILaunchManager.RUN_MODE, null), mockProcess, name.getMethodName());
290-
@SuppressWarnings("restriction")
291287
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider());
292288
console.addPropertyChangeListener(event -> {
293289
if (event.getSource() == console && IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE.equals(event.getProperty())) {
@@ -389,7 +385,6 @@ private IOConsole doConsoleOutputTest(byte[] testContent, Map<String, Object> la
389385
final IProcess process = mockProcess.toRuntimeProcess("Output Redirect", launchConfigAttributes);
390386
final String encoding = launchConfigAttributes != null ? (String) launchConfigAttributes.get(DebugPlugin.ATTR_CONSOLE_ENCODING) : null;
391387
final AtomicBoolean consoleFinished = new AtomicBoolean(false);
392-
@SuppressWarnings("restriction")
393388
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), encoding);
394389
console.addPropertyChangeListener((PropertyChangeEvent event) -> {
395390
if (event.getSource() == console && IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE.equals(event.getProperty())) {
@@ -409,9 +404,7 @@ private IOConsole doConsoleOutputTest(byte[] testContent, Map<String, Object> la
409404
final IDocument doc = console.getDocument();
410405

411406
if (outFile != null) {
412-
@SuppressWarnings("restriction")
413-
String expectedPathMsg = MessageFormat.format(org.eclipse.debug.internal.ui.views.console.ConsoleMessages.ProcessConsole_1, new Object[] {
414-
outFile.getAbsolutePath() });
407+
String expectedPathMsg = MessageFormat.format(org.eclipse.debug.internal.ui.views.console.ConsoleMessages.ProcessConsole_1, outFile.getAbsolutePath());
415408
assertEquals("No or wrong output of redirect file path in console.", expectedPathMsg, doc.get(doc.getLineOffset(0), doc.getLineLength(0)));
416409
assertThat(console.getHyperlinks()).as("check redirect file path is linked").hasSize(1);
417410
}
@@ -450,7 +443,6 @@ public void testOutput() throws Exception {
450443
launchConfigAttributes.put(DebugPlugin.ATTR_CONSOLE_ENCODING, consoleEncoding);
451444
final IProcess process = mockProcess.toRuntimeProcess("simpleOutput", launchConfigAttributes);
452445
sysout.println(lines[1]);
453-
@SuppressWarnings("restriction")
454446
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
455447
sysout.println(lines[2]);
456448
try {
@@ -507,7 +499,6 @@ public void testBinaryOutputToFile() throws Exception {
507499
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
508500
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
509501
final IProcess process = mockProcess.toRuntimeProcess("redirectBinaryOutput", launchConfigAttributes);
510-
@SuppressWarnings("restriction")
511502
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
512503
try {
513504
console.initialize();
@@ -562,7 +553,6 @@ public void testBinaryInputFromFile() throws Exception {
562553
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, inFile.getCanonicalPath());
563554
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
564555
final IProcess process = mockProcess.toRuntimeProcess("redirectBinaryInput", launchConfigAttributes);
565-
@SuppressWarnings("restriction")
566556
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
567557
try {
568558
console.initialize();

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
@SuppressWarnings("deprecation")
8787
public class LaunchConfigurationTests extends AbstractLaunchTest implements ILaunchConfigurationListener {
8888

89-
@SuppressWarnings({ "restriction", "unused" })
89+
@SuppressWarnings({ "unused" })
9090
// Only ensures org.eclipse.ui.externaltools is required
9191
private static final org.eclipse.ui.externaltools.internal.model.BuilderUtils ref = null;
9292

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public void testToolTipCalculationLogsError() throws Exception {
545545
}
546546

547547
class LogListener implements ILogListener {
548-
private Map<String, IStatus> logs = new HashMap<>();
548+
private final Map<String, IStatus> logs = new HashMap<>();
549549

550550
@Override
551551
public synchronized void logging(IStatus status, String plugin) {

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestLogicalStructureTypeDelegate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ public class TestLogicalStructureTypeDelegate implements ILogicalStructureTypeDe
99

1010
@Override
1111
public boolean providesLogicalStructure(IValue value) {
12-
if (value instanceof TestValue) {
13-
TestValue testValue = (TestValue) value;
12+
if (value instanceof TestValue testValue) {
1413
return "raw".equals(testValue.getValueString());
1514
}
1615
return false;

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/TestSourceDirector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public class TestSourceDirector extends AbstractSourceLookupDirector {
2323
public Object getSourceElement(Object element) {
2424
if (element instanceof String) {
2525
return element.toString() + System.currentTimeMillis();
26-
} else if (element instanceof IStackFrame) {
27-
IStackFrame frame = (IStackFrame) element;
26+
} else if (element instanceof IStackFrame frame) {
2827
return frame.getModelIdentifier() + System.currentTimeMillis();
2928
}
3029
return super.getSourceElement(element);

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/SpyTabGroup.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
import org.eclipse.debug.tests.ui.SpyTab.SpyTabB;
1616
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
1717
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
18-
import org.eclipse.debug.ui.ILaunchConfigurationTab;
1918

2019
public class SpyTabGroup extends AbstractLaunchConfigurationTabGroup {
2120

2221
@Override
2322
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
24-
setTabs(new ILaunchConfigurationTab[] { new SpyTabA(), new SpyTabB() });
23+
setTabs(new SpyTabA(), new SpyTabB());
2524
}
2625

2726
}

0 commit comments

Comments
 (0)