Skip to content

Commit 7308f07

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of debug/org.eclipse.debug.core
1 parent 12f8337 commit 7308f07

15 files changed

+49
-50
lines changed

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ public IStatusHandler getStatusHandler(IStatus status) {
692692
if (handler instanceof IStatusHandler) {
693693
return (IStatusHandler)handler;
694694
}
695-
invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new Object[] { config.getDeclaringExtension().getUniqueIdentifier() })); //$NON-NLS-1$
695+
invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", config.getDeclaringExtension().getUniqueIdentifier())); //$NON-NLS-1$
696696
} catch (CoreException e) {
697697
log(e);
698698
}
@@ -1140,7 +1140,7 @@ public static void logDebugMessage(String message) {
11401140
if (getDefault().isDebugging()) {
11411141
// this message is intentionally not externalized, as an exception may
11421142
// be due to the resource bundle itself
1143-
log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new Object[] { message }), null));
1143+
log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, message), null));
11441144
}
11451145
}
11461146

@@ -1216,8 +1216,7 @@ private void initializeProcessFactories() {
12161216
} else {
12171217
// invalid process factory
12181218
String badDefiner = configurationElement.getContributor().getName();
1219-
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new Object[] {
1220-
badDefiner, id }), null));
1219+
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, badDefiner, id), null));
12211220
}
12221221
}
12231222
}
@@ -1238,15 +1237,13 @@ private synchronized List<ExecFactoryFacade> getExecFactories() {
12381237
try {
12391238
priority = Integer.parseInt(attribute);
12401239
} catch (NumberFormatException e) {
1241-
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_invalid_exec_factory, new Object[] {
1242-
configurationElement.getContributor().getName() }), null));
1240+
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_invalid_exec_factory, configurationElement.getContributor().getName()), null));
12431241
priority = 0;
12441242
}
12451243
list.add(new ExecFactoryFacade(configurationElement, priority));
12461244
} else {
12471245
String badDefiner = configurationElement.getContributor().getName();
1248-
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_invalid_exec_factory, new Object[] {
1249-
badDefiner }), null));
1246+
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_invalid_exec_factory, badDefiner), null));
12501247
}
12511248
}
12521249
list.sort(Comparator.comparingInt(ExecFactoryFacade::getPriority).reversed());
@@ -1256,7 +1253,7 @@ private synchronized List<ExecFactoryFacade> getExecFactories() {
12561253
}
12571254

12581255
private void invalidStatusHandler(Exception e, String id) {
1259-
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new Object[] { id }), e));
1256+
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, id), e));
12601257
}
12611258

12621259
/**
@@ -1286,7 +1283,7 @@ public boolean equals(Object obj) {
12861283
}
12871284
}
12881285

1289-
private class ExecFactoryFacade implements ExecFactory {
1286+
private static class ExecFactoryFacade implements ExecFactory {
12901287

12911288
private IConfigurationElement element;
12921289
private int priority;

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode,
163163
monitor.subTask(DebugCoreMessages.LaunchConfigurationDelegate_6);
164164
List<IAdaptable> errors = new ArrayList<>();
165165
for (IProject project : projects) {
166-
monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { project.getName() }));
166+
monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, project.getName()));
167167
if (existsProblems(project)) {
168168
errors.add(project);
169169
}

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ public void setValue(byte value) {
157157
*/
158158
public void setReadable(boolean readable) {
159159
flags |= MemoryByte.READABLE;
160-
if (!readable)
160+
if (!readable) {
161161
flags ^= MemoryByte.READABLE;
162+
}
162163
}
163164

164165
/**
@@ -179,8 +180,9 @@ public boolean isReadable() {
179180
*/
180181
public void setWritable(boolean writable) {
181182
flags |= MemoryByte.WRITABLE;
182-
if (!writable)
183+
if (!writable) {
183184
flags ^= MemoryByte.WRITABLE;
185+
}
184186
}
185187

186188
/**
@@ -199,8 +201,9 @@ public boolean isWritable() {
199201
*/
200202
public void setChanged(boolean changed) {
201203
flags |= MemoryByte.CHANGED;
202-
if (!changed)
204+
if (!changed) {
203205
flags ^= MemoryByte.CHANGED;
206+
}
204207
}
205208

206209
/**
@@ -220,8 +223,9 @@ public boolean isChanged() {
220223
*/
221224
public void setHistoryKnown(boolean known) {
222225
flags |= MemoryByte.HISTORY_KNOWN;
223-
if (!known)
226+
if (!known) {
224227
flags ^= MemoryByte.HISTORY_KNOWN;
228+
}
225229
}
226230

227231
/**
@@ -242,8 +246,9 @@ public boolean isHistoryKnown() {
242246
public void setBigEndian(boolean isBigEndian)
243247
{
244248
flags |= MemoryByte.BIG_ENDIAN;
245-
if (!isBigEndian)
249+
if (!isBigEndian) {
246250
flags ^= MemoryByte.BIG_ENDIAN;
251+
}
247252
}
248253

249254
/**
@@ -266,8 +271,9 @@ public boolean isBigEndian()
266271
public void setEndianessKnown(boolean isEndianessKnown)
267272
{
268273
flags |= MemoryByte.ENDIANESS_KNOWN;
269-
if (!isEndianessKnown)
274+
if (!isEndianessKnown) {
270275
flags ^= MemoryByte.ENDIANESS_KNOWN;
276+
}
271277
}
272278

273279
/**

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private List<ISourceContainer> parseSourceContainers(NodeList list) throws CoreE
261261
containers.add(container);
262262
}
263263
else {
264-
abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, new Object[] { typeId }), null);
264+
abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, typeId), null);
265265
}
266266
}
267267
return containers;

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ private synchronized ZipFile getArchive() throws CoreException {
239239
} catch (IOException e) {
240240
File file = new File(fArchivePath);
241241
if (file.exists()) {
242-
abort(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_2, new Object[] { fArchivePath }), e);
242+
abort(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_2, fArchivePath), e);
243243
} else {
244-
warn(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_1, new Object[] { fArchivePath }), e);
244+
warn(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_1, fArchivePath), e);
245245
}
246246
}
247247
return null;

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointImportParticipantDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* type="org.eclipse.jdt.debug.javaLineBreakpointMarker">
3232
* </ImportParticipant>
3333
* </extension>
34-
* }
34+
* }
3535
* </pre>
3636
*
3737
* @noextend This class is not intended to be sub-classed by clients.

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ public IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
555555
IConfigurationElement config = fBreakpointExtensions.get(marker.getType());
556556
if (config == null) {
557557
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
558-
DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.BreakpointManager_Missing_breakpoint_definition, new Object[] { marker.getType() }), null));
558+
DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.BreakpointManager_Missing_breakpoint_definition, marker.getType()), null));
559559
}
560560
Object object = config.createExecutableExtension(IConfigurationElementConstants.CLASS);
561561
if (object instanceof IBreakpoint) {

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private void loadPersistedExpressions() {
165165
if (node.getNodeType() == Node.ELEMENT_NODE) {
166166
Element element= (Element) node;
167167
if (!element.getNodeName().equals(EXPRESSION_TAG)) {
168-
DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading watch expressions: {0}", new Object[] { node.getNodeName() }), null); //$NON-NLS-1$
168+
DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading watch expressions: {0}", node.getNodeName()), null); //$NON-NLS-1$
169169
continue;
170170
}
171171
String expressionText= element.getAttribute(TEXT_TAG);

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,11 @@ protected DebugException getInvalidFormatDebugException() {
832832
public boolean equals(Object obj) {
833833

834834
// Make sure it's a LaunchConfigurationInfo object
835-
if (!(obj instanceof LaunchConfigurationInfo)) {
835+
if (!(obj instanceof LaunchConfigurationInfo other)) {
836836
return false;
837837
}
838838

839839
// Make sure the types are the same
840-
LaunchConfigurationInfo other = (LaunchConfigurationInfo) obj;
841840
if (!fType.getIdentifier().equals(other.getType().getIdentifier())) {
842841
return false;
843842
}

debug/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public synchronized ILaunchConfiguration doSave(IProgressMonitor monitor) throws
245245
* @throws CoreException if a problem is encountered
246246
*/
247247
private void doSave0(IProgressMonitor monitor) throws CoreException {
248-
SubMonitor lmonitor = SubMonitor.convert(monitor, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_0, new Object[] { getName() }), 2);
248+
SubMonitor lmonitor = SubMonitor.convert(monitor, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_0, getName()), 2);
249249
try {
250250
// set up from/to information if this is a move
251251
boolean moved = (!isNew() && isMoved());
@@ -286,7 +286,7 @@ protected void writeNewFile(IProgressMonitor monitor) throws CoreException {
286286
throw new DebugException(
287287
new Status(
288288
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
289-
DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new Object[] { e.toString() }), null
289+
DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, e.toString()), null
290290
)
291291
);
292292
}
@@ -322,7 +322,7 @@ protected void writeNewFile(IProgressMonitor monitor) throws CoreException {
322322
throw new DebugException(
323323
new Status(
324324
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
325-
DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new Object[] { ie.toString() }), null
325+
DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, ie.toString()), null
326326
)
327327
);
328328
}
@@ -353,7 +353,7 @@ protected void writeNewFile(IProgressMonitor monitor) throws CoreException {
353353
added = true;
354354
//create file input stream: work one unit in a sub monitor
355355
smonitor = lmonitor.newChild(1);
356-
smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_2, new Object[] { getName() }));
356+
smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_2, getName()));
357357
file.create(stream, false, smonitor);
358358
} else {
359359
// validate edit
@@ -366,7 +366,7 @@ protected void writeNewFile(IProgressMonitor monitor) throws CoreException {
366366
}
367367
//set the contents of the file: work 1 unit in a sub monitor
368368
smonitor = lmonitor.newChild(1);
369-
smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_3, new Object[] { getName() }));
369+
smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_3, getName()));
370370
file.setContents(stream, true, false, smonitor);
371371
}
372372
} catch (IOException closeException) {

0 commit comments

Comments
 (0)