Skip to content

Commit 640ae67

Browse files
committed
Merge branch 'microsoft-main' into main
2 parents 244576a + 0c44812 commit 640ae67

File tree

96 files changed

+4927
-430
lines changed

Some content is hidden

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

96 files changed

+4927
-430
lines changed

.github/workflows/build.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
linux:
11+
name: Linux
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: '11'
21+
22+
- name: Cache local Maven repository
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
30+
- name: Verify
31+
run: ./mvnw clean verify
32+
33+
- name: Checkstyle
34+
run: ./mvnw checkstyle:check
35+
36+
windows:
37+
name: Windows
38+
runs-on: windows-latest
39+
timeout-minutes: 30
40+
steps:
41+
- name: Set git to use LF
42+
run: |
43+
git config --global core.autocrlf false
44+
git config --global core.eol lf
45+
46+
- uses: actions/checkout@v2
47+
48+
- name: Set up JDK 11
49+
uses: actions/setup-java@v1
50+
with:
51+
java-version: '11'
52+
53+
- name: Cache local Maven repository
54+
uses: actions/cache@v2
55+
with:
56+
path: $HOME/.m2/repository
57+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
58+
restore-keys: |
59+
${{ runner.os }}-maven-
60+
61+
- name: Verify
62+
run: ./mvnw.cmd clean verify
63+
64+
- name: Checkstyle
65+
run: ./mvnw.cmd checkstyle:check
66+
67+
darwin:
68+
name: macOS
69+
runs-on: macos-latest
70+
timeout-minutes: 30
71+
steps:
72+
- uses: actions/checkout@v2
73+
74+
- name: Set up JDK 11
75+
uses: actions/setup-java@v1
76+
with:
77+
java-version: '11'
78+
79+
- name: Cache local Maven repository
80+
uses: actions/cache@v2
81+
with:
82+
path: ~/.m2/repository
83+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
84+
restore-keys: |
85+
${{ runner.os }}-maven-
86+
87+
- name: Verify
88+
run: ./mvnw clean verify
89+
90+
- name: Checkstyle
91+
run: ./mvnw checkstyle:check

.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
<natures>
1515
<nature>org.eclipse.m2e.core.maven2Nature</nature>
1616
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1600224298170</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
1728
</projectDescription>

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"sourcePaths": [
1515
"${workspaceRoot}/com.microsoft.java.debug.core/main/java",
1616
"${workspaceRoot}/com.microsoft.java.debug.plugin/src/main/java"
17-
]
17+
],
18+
"projectName": "com.microsoft.java.debug.plugin"
1819
}
1920
]
2021
}

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"java.configuration.updateBuildConfiguration": "automatic",
32
"files.exclude": {
43
"**/.git": true,
54
"**/*.class": true,

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,47 @@ The Java Debug Server is the bridge between VSCode and JVM. The implementation i
2424
- com.microsoft.java.debug.core - the core logic of the debug server
2525
- com.microsoft.java.debug.plugin - wraps the debug server into an Eclipse plugin to work with Eclipse JDT Language Server
2626

27+
## Installation
28+
29+
### Windows:
30+
```
31+
mvnw.cmd clean install
32+
```
33+
### Linux and macOS:
34+
```
35+
./mvnw clean install
36+
```
37+
38+
39+
## Usage with eclipse.jdt.ls
40+
41+
To use `java-debug` as a [jdt.ls](https://github.com/eclipse/eclipse.jdt.ls) plugin, an [LSP client](https://langserver.org/) has to launch [jdt.ls](https://github.com/eclipse/eclipse.jdt.ls) with `initializationOptions` that contain the path to the built `java-debug` jar within a `bundles` array:
42+
43+
44+
```
45+
{
46+
"initializationOptions": {
47+
"bundles": [
48+
"path/to/microsoft/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-<version>.jar"
49+
]
50+
}
51+
}
52+
```
53+
54+
Editor extensions like [vscode-java](https://github.com/redhat-developer/vscode-java) take care of this.
55+
56+
57+
Once `eclipse.jdt.ls` launched, the client can send a [Command](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#command) to the server to start a debug session:
58+
59+
```
60+
{
61+
"command": "vscode.java.startDebugSession"
62+
}
63+
```
64+
65+
The response to this request will contain a port number on which the debug adapter is listening, and to which a client implementing the debug-adapter protocol can connect to.
66+
67+
2768
License
2869
-------
29-
EPL 1.0, See [LICENSE](LICENSE.txt) file.
70+
EPL 1.0, See [LICENSE](LICENSE.txt) file.

check_style.xml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<property name="fileExtensions" value="java, properties, xml"/>
2222
<module name="RegexpHeader">
23-
<property name="headerFile" value="${basedir}/microsoft.header"/>
23+
<property name="headerFile" value="microsoft.header"/>
2424
</module>
2525
<!-- Checks for whitespace
2626
See http://checkstyle.sf.net/config_whitespace.html -->
@@ -40,6 +40,23 @@
4040
<property name="message" value="CRLF and CR line endings are prohibited, but this file uses them."/>
4141
</module>
4242

43+
<module name="LineLengthCheck">
44+
<property name="fileExtensions" value="java" />
45+
<!-- Checks if a line is too long. -->
46+
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="160"/>
47+
<property name="severity" value="error"/>
48+
49+
<!--
50+
The default ignore pattern exempts the following elements:
51+
- import statements
52+
- long URLs inside comments
53+
-->
54+
55+
<property name="ignorePattern"
56+
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
57+
default="^(package .*;\s*)|(import .*;\s*)|( *\* *https?://.*)$"/>
58+
</module>
59+
4360
<module name="TreeWalker">
4461
<!-- Default CheckStyle Whitespace rules seem reasonable to use. -->
4562
<module name="EmptyForIteratorPad"/>
@@ -92,10 +109,6 @@
92109
<property name="allowByTailComment" value="true"/>
93110
<property name="allowNonPrintableEscapes" value="true"/>
94111
</module>
95-
<module name="LineLength">
96-
<property name="max" value="160"/>
97-
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
98-
</module>
99112
<module name="AvoidStarImport"/>
100113
<module name="OneTopLevelClass"/>
101114
<module name="NoLineWrap"/>
@@ -226,6 +239,7 @@
226239
<property name="thirdPartyPackageRegExp" value="^com\."/>
227240
<property name="sortImportsInGroupAlphabetically" value="true"/>
228241
<property name="separateLineBetweenGroups" value="true"/>
242+
<property name="severity" value="info"/>
229243
</module>
230244
<module name="MethodParamPad"/>
231245
<module name="ParenPad"/>
@@ -249,19 +263,16 @@
249263
<property name="forbiddenSummaryFragments"
250264
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
251265
</module>
252-
<module name="JavadocParagraph"/>
266+
<!-- <module name="JavadocParagraph"/> -->
253267
<module name="AtclauseOrder">
254268
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
255269
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
256270
</module>
257271
<module name="JavadocMethod">
258272
<property name="scope" value="public"/>
259273
<property name="allowMissingParamTags" value="true"/>
260-
<property name="allowMissingThrowsTags" value="true"/>
261274
<property name="allowMissingReturnTag" value="true"/>
262-
<property name="minLineCount" value="2"/>
263275
<property name="allowedAnnotations" value="Override, Test"/>
264-
<property name="allowThrowsTagsForSubclasses" value="true"/>
265276
</module>
266277
<module name="MethodName">
267278
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
@@ -289,4 +300,4 @@
289300
<module name="SimplifyBooleanExpression"/>
290301
<module name="SimplifyBooleanReturn"/>
291302
</module>
292-
</module>
303+
</module>

com.microsoft.java.debug.core/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@
2626
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
2727
<nature>org.eclipse.m2e.core.maven2Nature</nature>
2828
</natures>
29+
<filteredResources>
30+
<filter>
31+
<id>1599036548523</id>
32+
<name></name>
33+
<type>30</type>
34+
<matcher>
35+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
36+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
37+
</matcher>
38+
</filter>
39+
</filteredResources>
2940
</projectDescription>

com.microsoft.java.debug.core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.microsoft.java</groupId>
77
<artifactId>java-debug-parent</artifactId>
8-
<version>0.20.0</version>
8+
<version>0.32.0</version>
99
</parent>
1010
<artifactId>com.microsoft.java.debug.core</artifactId>
1111
<packaging>jar</packaging>
@@ -68,7 +68,7 @@
6868
<dependency>
6969
<groupId>junit</groupId>
7070
<artifactId>junit</artifactId>
71-
<version>4.12</version>
71+
<version>4.13.1</version>
7272
<scope>test</scope>
7373
</dependency>
7474
<dependency>

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/DebugSession.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ public IBreakpoint createBreakpoint(String className, int lineNumber, int hitCou
8383
return new EvaluatableBreakpoint(vm, this.getEventHub(), className, lineNumber, hitCount, condition, logMessage);
8484
}
8585

86+
@Override
87+
public IWatchpoint createWatchPoint(String className, String fieldName, String accessType, String condition, int hitCount) {
88+
return new Watchpoint(vm, this.getEventHub(), className, fieldName, accessType, condition, hitCount);
89+
}
90+
8691
@Override
8792
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught) {
93+
setExceptionBreakpoints(notifyCaught, notifyUncaught, null, null);
94+
}
95+
96+
@Override
97+
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, String[] classFilters, String[] classExclusionFilters) {
8898
EventRequestManager manager = vm.eventRequestManager();
8999
ArrayList<ExceptionRequest> legacy = new ArrayList<>(manager.exceptionRequests());
90100
manager.deleteEventRequests(legacy);
@@ -105,6 +115,16 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
105115
// get only the uncaught exceptions
106116
ExceptionRequest request = manager.createExceptionRequest(null, notifyCaught, notifyUncaught);
107117
request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
118+
if (classFilters != null) {
119+
for (String classFilter : classFilters) {
120+
request.addClassFilter(classFilter);
121+
}
122+
}
123+
if (classExclusionFilters != null) {
124+
for (String exclusionFilter : classExclusionFilters) {
125+
request.addClassExclusionFilter(exclusionFilter);
126+
}
127+
}
108128
request.enable();
109129
}
110130
}

0 commit comments

Comments
 (0)