Skip to content

Commit e0e6e04

Browse files
Merge branch 'eclipse-platform:master' into master
2 parents 6f85070 + 893349b commit e0e6e04

File tree

509 files changed

+13211
-404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+13211
-404
lines changed

Jenkinsfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pipeline {
1818
sh """
1919
mvn clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \
2020
-Pbree-libs -Papi-check -Pjavadoc \
21+
-Dmaven.test.failure.ignore=true \
2122
-Dcompare-version-with-baselines.skip=false \
2223
-Dmaven.compiler.failOnWarning=false \
2324
-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS \
@@ -30,8 +31,8 @@ pipeline {
3031
archiveArtifacts artifacts: '.*log,*/target/work/data/.metadata/.*log,*/tests/target/work/data/.metadata/.*log,apiAnalyzer-workspace/.metadata/.*log', allowEmptyArchive: true
3132
junit '**/target/surefire-reports/TEST-*.xml'
3233
discoverGitReferenceBuild referenceJob: 'eclipse.platform/master'
33-
recordIssues tools: [eclipse(pattern: '**/target/compilelogs/*.xml'), javaDoc()], qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]]
34-
recordIssues tool: mavenConsole(), qualityGates: [[threshold: 1, type: 'DELTA_ERROR', unstable: true]]
34+
recordIssues publishAllIssues:false, ignoreQualityGate:true, tool: eclipse(name: 'Compiler and API Tools', pattern: '**/target/compilelogs/*.xml'), qualityGates: [[threshold: 1, type: 'DELTA', unstable: true]]
35+
recordIssues publishAllIssues:false, tools: [mavenConsole(), javaDoc()]
3536
}
3637
}
3738
}

debug/org.eclipse.debug.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
5-
Bundle-Version: 3.21.300.qualifier
5+
Bundle-Version: 3.21.400.qualifier
66
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717

1818

1919
import java.util.ArrayList;
20-
import java.util.HashMap;
2120
import java.util.List;
21+
import java.util.Map;
22+
import java.util.Objects;
23+
import java.util.concurrent.ConcurrentHashMap;
2224
import java.util.concurrent.locks.Lock;
2325
import java.util.concurrent.locks.ReadWriteLock;
2426
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -66,7 +68,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
6668
/**
6769
* The configuration that was launched, or null.
6870
*/
69-
private ILaunchConfiguration fConfiguration= null;
71+
private volatile ILaunchConfiguration fConfiguration = null;
7072

7173
/**
7274
* The system processes associated with
@@ -78,7 +80,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
7880
* The source locator to use in the debug session
7981
* or <code>null</code> if not supported.
8082
*/
81-
private ISourceLocator fLocator= null;
83+
private volatile ISourceLocator fLocator = null;
8284

8385
/**
8486
* The mode this launch was launched in.
@@ -88,7 +90,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
8890
/**
8991
* Table of client defined attributes
9092
*/
91-
private HashMap<String, String> fAttributes;
93+
private final Map<String, String> fAttributes = new ConcurrentHashMap<>();
9294

9395
/**
9496
* Flag indicating that change notification should
@@ -319,20 +321,20 @@ public ILaunchConfiguration getLaunchConfiguration() {
319321
*/
320322
@Override
321323
public void setAttribute(String key, String value) {
322-
if (fAttributes == null) {
323-
fAttributes = new HashMap<>(5);
324+
Objects.requireNonNull(key);
325+
if (value == null) {
326+
// ConcurrentHashMap does not allow null values
327+
fAttributes.remove(key);
328+
} else {
329+
fAttributes.put(key, value);
324330
}
325-
fAttributes.put(key, value);
326331
}
327332

328333
/**
329334
* @see ILaunch#getAttribute(String)
330335
*/
331336
@Override
332337
public String getAttribute(String key) {
333-
if (fAttributes == null) {
334-
return null;
335-
}
336338
return fAttributes.get(key);
337339
}
338340

@@ -343,7 +345,7 @@ public String getAttribute(String key) {
343345
public IDebugTarget[] getDebugTargets() {
344346
readLock.lock();
345347
try {
346-
return fTargets.toArray(new IDebugTarget[fTargets.size()]);
348+
return fTargets.toArray(IDebugTarget[]::new);
347349
} finally {
348350
readLock.unlock();
349351
}

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,29 @@
2020
import org.eclipse.debug.core.ILaunch;
2121

2222
/**
23-
* A process represents a program running in normal (non-debug) mode.
24-
* Processes support setting and getting of client defined attributes.
25-
* This way, clients can annotate a process with any extra information
26-
* important to them. For example, classpath annotations, or command
27-
* line arguments used to launch the process may be important to a client.
23+
* A process represents a program running in normal (non-debug) mode. Processes
24+
* support setting and getting of client defined attributes. This way, clients
25+
* can annotate a process with any extra information important to them. For
26+
* example, classpath annotations, or command line arguments used to launch the
27+
* process may be important to a client.
2828
* <p>
29-
* Clients may implement this interface, however, the debug plug-in
30-
* provides an implementation of this interface for a
31-
* <code>java.lang.Process</code>.
29+
* Clients may implement this interface, however, the debug plug-in provides an
30+
* implementation of this interface for a <code>java.lang.Process</code>.
3231
* </p>
32+
*
33+
* If implementing custom launches it is important to fire event whenever the
34+
* process state changes in the following way:
35+
*
36+
* <pre>
37+
* DebugPlugin manager = DebugPlugin.getDefault();
38+
* if (manager != null) {
39+
* manager.fireDebugEventSet(new DebugEvent[] {
40+
* new DebugEvent(this, DebugEvent.CREATE) });
41+
* }
42+
* </pre>
43+
*
44+
* otherwise the UI will probably show faulty state for your process and launch.
45+
*
3346
* @see org.eclipse.debug.core.DebugPlugin#newProcess(ILaunch, Process, String)
3447
*/
3548
public interface IProcess extends IAdaptable, ITerminate {

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
import java.nio.charset.IllegalCharsetNameException;
1818
import java.nio.charset.UnsupportedCharsetException;
1919
import java.util.Collections;
20-
import java.util.HashMap;
2120
import java.util.List;
2221
import java.util.Map;
22+
import java.util.Objects;
23+
import java.util.concurrent.ConcurrentHashMap;
2324
import java.util.concurrent.ExecutionException;
2425
import java.util.concurrent.TimeUnit;
2526
import java.util.concurrent.TimeoutException;
@@ -68,7 +69,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
6869
private Process fProcess;
6970

7071
/**
71-
* This process's exit value
72+
* This process's exit value.
73+
*
74+
* synchronized by this
7275
*/
7376
private int fExitValue;
7477

@@ -96,17 +99,17 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
9699
/**
97100
* Table of client defined attributes
98101
*/
99-
private Map<String, String> fAttributes;
102+
private final Map<String, String> fAttributes = new ConcurrentHashMap<>();
100103

101104
/**
102105
* Whether output from the process should be captured or swallowed
103106
*/
104-
private boolean fCaptureOutput = true;
107+
private final boolean fCaptureOutput;
105108

106109
/**
107110
* Whether the descendants of this process should be terminated too
108111
*/
109-
private boolean fTerminateDescendants = true;
112+
private final boolean fTerminateDescendants;
110113

111114
private final String fThreadNameSuffix;
112115

@@ -141,14 +144,16 @@ public RuntimeProcess(ILaunch launch, Process process, String name, Map<String,
141144
String captureOutput = launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT);
142145
fCaptureOutput = !("false".equals(captureOutput)); //$NON-NLS-1$
143146

147+
boolean terminateDescendants = true;
144148
try {
145149
ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
146150
if (launchConfiguration != null) {
147-
fTerminateDescendants = launchConfiguration.getAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
151+
terminateDescendants = launchConfiguration.getAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
148152
}
149153
} catch (CoreException e) {
150154
DebugPlugin.log(e);
151155
}
156+
fTerminateDescendants = terminateDescendants;
152157
fThreadNameSuffix = getPidInfo(process, launch);
153158

154159
fStreamsProxy = createStreamsProxy();
@@ -264,7 +269,9 @@ public void terminate() throws DebugException {
264269
try { // (in total don't wait longer than TERMINATION_TIMEOUT)
265270
long waitStart = System.currentTimeMillis();
266271
if (process.waitFor(TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS)) {
267-
fExitValue = process.exitValue();
272+
synchronized (this) {
273+
fExitValue = process.exitValue();
274+
}
268275
if (waitFor(descendants, waitStart)) {
269276
return;
270277
}
@@ -419,26 +426,25 @@ protected void fireChangeEvent() {
419426
*/
420427
@Override
421428
public void setAttribute(String key, String value) {
422-
if (fAttributes == null) {
423-
fAttributes = new HashMap<>(5);
424-
}
425-
Object origVal = fAttributes.get(key);
426-
if (origVal != null && origVal.equals(value)) {
427-
return; //nothing changed.
429+
Objects.requireNonNull(key);
430+
if (value == null) {
431+
// ConcurrentHashMap does not allow null values
432+
if (fAttributes.remove(key) != null) {
433+
fireChangeEvent();
434+
}
435+
} else {
436+
String origVal = fAttributes.put(key, value);
437+
if (!Objects.equals(origVal, value)) {
438+
fireChangeEvent();
439+
}
428440
}
429-
430-
fAttributes.put(key, value);
431-
fireChangeEvent();
432441
}
433442

434443
/**
435444
* @see IProcess#getAttribute(String)
436445
*/
437446
@Override
438447
public String getAttribute(String key) {
439-
if (fAttributes == null) {
440-
return null;
441-
}
442448
return fAttributes.get(key);
443449
}
444450

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Bug 534597 - Unanticipated comparator errors in I20180511-2000
22
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1184
33
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1659
4-
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1744
4+
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1744
5+
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1781

debug/org.eclipse.debug.tests/build.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ bin.includes = META-INF/,\
2424
src.includes = icons/
2525

2626
# Maven/Tycho pom model adjustments
27-
pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings}
2827
pom.model.property.testClass = org.eclipse.debug.tests.AutomatedSuite
2928
pom.model.property.tycho.surefire.useUIHarness = true
3029
pom.model.property.tycho.surefire.useUIThread = true

debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true
5-
Bundle-Version: 3.18.300.qualifier
5+
Bundle-Version: 3.18.400.qualifier
66
Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.debug.ui/forceQualifierUpdate.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ Bug 534597 - Unanticipated comparator errors in I20180511-2000
44
Bug 566471 - I20200828-0150 - Comparator Errors Found
55
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1184
66
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1378
7-
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1659
7+
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1659
8+
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1781

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ public class DebugUIMessages extends NLS {
303303

304304
public static String LaunchShortcutAction_combineLaunchShortcutName;
305305

306-
public static String ContextualLaunchAction_0;
307-
308306
static {
309307
// load message values from bundle file
310308
NLS.initializeMessages(BUNDLE_NAME, DebugUIMessages.class);

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ CodePagesPrefDialog_7=ASCII codepage entered is invalid.
162162
CodePagesPrefDialog_8=Invalid codepage
163163
CodePagesPrefDialog_9=EBCDIC codepage entered is invalid.
164164
CodePagesPrefDialog_0=The codepage is not supported.
165-
ContextualLaunchAction_0=Loading...
166165

167166
##############################################################
168167
# View Tab

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
*******************************************************************************/
1414
package org.eclipse.debug.internal.ui.commands.actions;
1515

16+
import java.util.Arrays;
17+
18+
import org.eclipse.core.runtime.ILog;
19+
import org.eclipse.core.runtime.Status;
20+
import org.eclipse.debug.core.DebugException;
1621
import org.eclipse.debug.core.DebugPlugin;
1722
import org.eclipse.debug.core.ILaunch;
1823
import org.eclipse.debug.core.ILaunchManager;
@@ -22,9 +27,11 @@
2227
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
2328
import org.eclipse.debug.internal.ui.actions.ActionMessages;
2429
import org.eclipse.debug.ui.actions.DebugCommandAction;
30+
import org.eclipse.debug.ui.contexts.DebugContextEvent;
2531
import org.eclipse.jface.resource.ImageDescriptor;
2632
import org.eclipse.jface.viewers.ISelection;
2733
import org.eclipse.jface.viewers.StructuredSelection;
34+
import org.eclipse.swt.widgets.Event;
2835
import org.eclipse.ui.IWorkbenchPart;
2936
import org.eclipse.ui.IWorkbenchWindow;
3037

@@ -49,9 +56,7 @@ public void dispose() {
4956
private void attachSelfToLaunchManager() {
5057
ILaunchManager launchManager = getLaunchManager();
5158
launchManager.addLaunchListener(this);
52-
// heuristic... rather than updating all the time, just assume there's
53-
// something that's not terminated.
54-
setEnabled(launchManager.getLaunches().length > 0);
59+
setEnabled(canTerminate());
5560
}
5661

5762
private ILaunchManager getLaunchManager() {
@@ -103,12 +108,12 @@ protected Class<ITerminateHandler> getCommandType() {
103108

104109
@Override
105110
public void launchesTerminated(ILaunch[] launches) {
106-
setEnabled(getLaunchManager().getLaunches().length > 0);
111+
setEnabled(canTerminate());
107112
}
108113

109114
@Override
110115
public void launchesAdded(ILaunch[] launches) {
111-
setEnabled(true);
116+
setEnabled(canTerminate());
112117
}
113118

114119
@Override
@@ -117,7 +122,7 @@ public void launchesChanged(ILaunch[] launches) {
117122

118123
@Override
119124
public void launchesRemoved(ILaunch[] launches) {
120-
setEnabled(getLaunchManager().getLaunches().length > 0);
125+
setEnabled(canTerminate());
121126
}
122127

123128
@Override
@@ -136,4 +141,32 @@ public void init(IWorkbenchWindow window) {
136141
super.init(window);
137142
attachSelfToLaunchManager();
138143
}
144+
145+
@Override
146+
protected boolean getInitialEnablement() {
147+
return canTerminate();
148+
}
149+
150+
private boolean canTerminate() {
151+
return Arrays.stream(getLaunchManager().getLaunches()).anyMatch(ILaunch::canTerminate);
152+
}
153+
154+
@Override
155+
public void runWithEvent(Event event) {
156+
for (ILaunch l : getLaunchManager().getLaunches()) {
157+
try {
158+
if (l.canTerminate()) {
159+
l.terminate();
160+
}
161+
} catch (DebugException e) {
162+
ILog.get().log(Status.warning("Unable to terminate launch: " + e.getMessage(), e)); //$NON-NLS-1$
163+
}
164+
}
165+
setEnabled(canTerminate());
166+
}
167+
168+
@Override
169+
public void debugContextChanged(DebugContextEvent event) {
170+
setEnabled(canTerminate());
171+
}
139172
}

0 commit comments

Comments
 (0)