This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249712 - Java Debugger Formatters. Import external Classes into the code snippets
Summary: Java Debugger Formatters. Import external Classes into the code snippets
Status: NEW
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Martin Entlicher
Depends on:
Reported: 2015-01-09 10:30 UTC by -Silver-
Modified: 2015-01-09 10:30 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description -Silver- 2015-01-09 10:30:39 UTC
In the company where I work Eclipse is used as IDE. Its debugger has a very useful feature that allows to use external classes into the code snippet of the variable formatter.

During a debugging of a project the debugger stops to a breakpoint and I want to see the content of a variable instance of class ComplexDataStructure. 
To understand the content of this variable it must be converted by the Eclipse debugger formatter in form of XML.
Eclipse makes this conversion (from "ComplexDataStructure" to a String containing XML) using the external class "Converter".
The following is the code snippet in Eclipse for the formatter that do this transformation:


I use Netbeans and now I'm obliged to switch from one IDE to the other because it seems that this feature(essential in my work) is not supported by Netbeans. 
In fact into the code snippet of the Netbeans variable formatter I can just insert very simple java code always referring the same class that is evaluated. 
For example I can insert:

toString(); //ALLOWED It is the classic example on the tutorial, it is called on the instance of ComplexDataStructure that is being evaluated. 

toXML();  // ALLOWED this should be the solution but unfortunately the class ComplexDataStructure DOESN'T contain this method and i can not modify the class to add it.

org.myCompany.util.transform.Converter.convertComplexDataStructureToXML(this);  // NOT ALLOWED IN NETBEANS this is the code snippet that works in eclipse, but Netbeans doesn't allow to use external class like org.myCompany.util.transform.Converter and send back the following error message 

>"org" is not a known variable in the current context.< 

Because the org.myCompany.util.transform.Converter is obviously unknown in the context.

Could you please provide a mechanism to import classes into the context of the debugger formatter? 

Furthermore when I use Netbeans 8.0.2 with Jdk 8 attaching the debugger to a webserver via socket that is running with Jre 6 the formatter code snippet is not able neither to use the libraries of the java lang packages so if I put into the variable formatter code snippet

String s;
s = "Hello";
return s.toUpperCase();

Netbeans show me the following error message 

>"String" is not a known variable in the current context.<