Skip to content

Commit 99357f2

Browse files
Add the new features to the test plan (#563)
* Add the new features to the test plan Signed-off-by: Jinbo Wang <jinbwan@microsoft.com> * comment jdk-12 by default Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
1 parent 85495a9 commit 99357f2

5 files changed

Lines changed: 102 additions & 1 deletion

File tree

TestPlan.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,4 +488,34 @@ Exception in thread "main" java.lang.IllegalStateException
488488
"shortenCommandLine": ""/"auto"/"jarmanifest"/"argfile", // argfile requires your Java version is 9 and higher.
489489
"console": ""/"internalConsole"/"integratedTerminal"/"externalTerminal"
490490

491-
```
491+
```
492+
493+
## Jump to source code when clicking stack trace in DEBUG CONSOLE
494+
1. Open `28.debugfeatures` project in VS Code.
495+
2. Open `StackTrace.java` file.
496+
3. Click Run or Debug CodeLens, check the DEBUG CONSOLE. It's expected to render the source link for each stack trace line, and clicking the link should open the associated Java file in the editor.
497+
498+
![image](https://user-images.githubusercontent.com/14052197/56104487-7ecc4880-5f6a-11e9-89aa-b9c66b6f318b.png)
499+
500+
## Show the logical structure view for the Map and List variables
501+
1. Open `28.debugfeatures` project in VS Code.
502+
2. Open `LogicalStructure.java` file, and add a breakpoint at line 30.
503+
3. Click Debug CodeLens, check the Variable viewlet.
504+
- emptyMap - non-expandable
505+
- bookset - Show two children (0: LinkedHashMap$Entry, 1: LinkedHashMap$Entry)
506+
- bigStore - Lazy loading the children and show the index range first `[0..9999]` ...
507+
- emptyList - non-expandable
508+
- list - Show two children (0: LogicalStructure$Foo, 1: LogicalStructure$Foo).
509+
- bigList - Lazy loading the children and show the index range first `[0..9999]` ...
510+
511+
![image](https://user-images.githubusercontent.com/14052197/56104630-1e89d680-5f6b-11e9-87a5-8a17a2ed33b5.png)
512+
513+
## Enable Java 12 preview for standalone Java files
514+
1. Install JDK-12.
515+
2. Open `28.debugfeatures` project in VS Code, and open `Java12Preview.java` file.
516+
3. Uncomment `"java.home"` in `./vscode/settings.json`.
517+
4. Run VS Code commmand `Java: clean Java language server workspace`, and click `Restart and delete` button in the prompted message box to reload VS Code.
518+
5. Add a breakpoint at line 7 of `Java12Preview.java`, and click Debug CodeLens. The debugger should run successfully.
519+
6. Open VS Code menu `Help -> Open Process Explorer`, find the Java Debuggger process in the `Process Explorer`. And its command line string should contain `--enable-preview` flag.
520+
521+
![image](https://user-images.githubusercontent.com/14052197/56105328-40d12380-5f6e-11e9-94bc-8f3f3d298750.png)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// "java.home": "C:\\Program Files\\Java\\jdk-12",
3+
"java.debug.settings.showLogicalStructure": true,
4+
"java.debug.settings.forceBuildBeforeLaunch": false
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class Java12Preview {
2+
3+
public static void main(String[] args) {
4+
String week = "MONDAY";
5+
switch (week) {
6+
case "MONDAY" -> {
7+
System.out.println("This is Monday");
8+
}
9+
case "TUESDAY" -> System.out.println("This is TUESDAY");
10+
default -> System.out.println("Unknown day.");
11+
}
12+
}
13+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import java.util.ArrayList;
2+
import java.util.Arrays;
3+
import java.util.HashMap;
4+
import java.util.LinkedHashMap;
5+
import java.util.List;
6+
import java.util.Map;
7+
8+
public class LogicalStructure {
9+
10+
public static void main(String[] args) {
11+
int[] arrays = new int[] { 1 };
12+
Object obj = new Object();
13+
Map<String, String> emptyMap = new HashMap<>();
14+
Map<String, Integer> bookset = new LinkedHashMap<>();
15+
bookset.put("Algorithm Introduction", 60);
16+
bookset.put("Thinking in JAVA", 50);
17+
18+
Map<String, Map<String, Integer>> bigStore = new HashMap<>();
19+
for (int i = 0; i < 100000; i++) {
20+
bigStore.put("key" + i, bookset);
21+
}
22+
23+
List<String> emptyList = new ArrayList<>();
24+
List<Foo> list = Arrays.asList(new Foo("One"), new Foo("Two"));
25+
List<String> bigList = new ArrayList<>();
26+
for (int i = 0; i < 100000; i++) {
27+
bigList.add("key" + i);
28+
}
29+
30+
System.out.println("Exit.");
31+
}
32+
33+
static class Foo {
34+
private String name;
35+
36+
Foo(String name) {
37+
this.name = name;
38+
}
39+
}
40+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class StackTrace {
2+
3+
public static void main(String[] args) {
4+
System.out.println("begin.");
5+
new RuntimeException("test").printStackTrace();
6+
7+
System.out.println("finish.");
8+
new RuntimeException("test1").printStackTrace(System.out);
9+
10+
System.out.println("exit");
11+
throw new RuntimeException("test2");
12+
}
13+
}

0 commit comments

Comments
 (0)