Community
Participate
Working Groups
Detail formatters encounter classloading-related issues which prevent them from rendering properly. Consider this sample program: package test; import java.util.Calendar; public class Test { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); System.out.println(cal); } } And this detail formatter: java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z"); fmt.setTimeZone(this.getTimeZone()); return fmt.format(this.getTime()) + " " + this.getTimeZone().getID(); This produces the following error from the detail formatter: Detail formatter error: The method getTimeZone() from the type GregorianCalendar refers to the missing type TimeZone The method getTime() is undefined for the type GregorianCalendar The method getTimeZone() from the type GregorianCalendar refers to the missing type TimeZone However, the same essential expression works fine in a Debug Shell: java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z"); fmt.setTimeZone(cal.getTimeZone()); fmt.format(cal.getTime()) + " " + cal.getTimeZone().getID();
Created attachment 283741 [details] screenshot1
Created attachment 283742 [details] screenshot2
Note - we are using: openjdk version "13.0.2" 2020-01-14
Same here with openjdk11. Detail formatter has java.util.GregorianCalender: this.getTime() Following error is displayed: Detail formatter error: The method getTime() is undefined for the type GregorianCalendar Also happens with eclipse 2021/09.
Can reproduce the same with the latest Java 17 also. Problem is in the ability to add the methods of super class Calendar to the GregorianCalendar. Even the content assist does not show these methods in the detail Formatter snippet area.
The problem still persists in the current version 2022-03 and JDK11. I have found a workaround for the GregorianCalendar with: String str = this.toString(); String[] arr = str.split(","); String year = arr[29].split("=")[1]; String month = arr[30].split("=")[1]; String day = arr[33].split("=")[1]; String hour = arr[39].split("=")[1]; String minute = arr[40].split("=")[1]; String second = arr[41].split("=")[1]; return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;