diff --git a/TestPlan.md b/TestPlan.md index 02c4035..7d7952a 100644 --- a/TestPlan.md +++ b/TestPlan.md @@ -523,6 +523,13 @@ Exception in thread "main" java.lang.IllegalStateException ![image](https://user-images.githubusercontent.com/14052197/56104630-1e89d680-5f6b-11e9-87a5-8a17a2ed33b5.png) +## Show toString object view +1. Open `28.debugfeatures` project in VS Code. +2. Open `Variables.java` file, and add a breakpoint at line 39. +3. Click Debug CodeLens, check the Variable viewlet. +4. Verify the highlight value in the screenshot below. +![image](https://user-images.githubusercontent.com/14052197/58676978-c9741980-838c-11e9-9f0e-48658fa06bd7.png) + ## Enable Java 12 preview for standalone Java files 1. Install JDK-12. 2. Open `28.debugfeatures` project in VS Code, and open `Java12Preview.java` file. diff --git a/testprojects/28.debugfeatures/Variables.java b/testprojects/28.debugfeatures/Variables.java new file mode 100644 index 0000000..1a63786 --- /dev/null +++ b/testprojects/28.debugfeatures/Variables.java @@ -0,0 +1,75 @@ +import java.util.*; + +public class Variables { + + public static void main(String[] args) { + int[] a = new int[100000]; + Integer intObj = new Integer(20); + Float floatObj = new Float("1.354"); + Character character = new Character('a'); + Boolean bool = new Boolean(true); + + Map emptyMap = new HashMap<>(); + Map bookset = new LinkedHashMap<>(); + bookset.put("Algorithm Introduction", 60); + bookset.put("Thinking in JAVA", 50); + + Map> smallStore = new HashMap<>(); + smallStore.put("Computer Science", bookset); + + Map> bigStore = new HashMap<>(); + for (int i = 0; i < 100000; i++) { + bigStore.put("key" + i, bookset); + } + + List smallList = Arrays.asList("Algorithm Introduction"); + List bigList = new ArrayList<>(); + for (int i = 0; i < 100000; i++) { + bigList.add("key" + i); + } + + School school = new School(); + Person person = new Person(); + Person person1 = null; + Employee employee = new Employee(); + StringException stringException = new StringException(); + NullString nullString =new NullString(); + Date date = new Date(); + String name = "Test"; + System.out.println("Exit."); + } + + public static class School { + String name = "test"; + + } + + public static class Person { + String name = "jinbo"; + + @Override + public String toString() { + return "Person [name=" + name + "]"; + } + } + + public static class Employee extends Person { + + } + + public static class StringException { + + @Override + public String toString() { + throw new RuntimeException("Unimplemented method exception"); + } + } + + public static class NullString { + + @Override + public String toString() { + return null; + } + } +}