| Summary: | [1.7] Debugger should support binary literals and underscores while setting literals | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Satyam Kandula <satyam.kandula> | ||||||
| Component: | Debug | Assignee: | Michael Rennie <Michael_Rennie> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie, Olivier_Thomann | ||||||
| Version: | 3.7 | Flags: | curtis.windatt.public:
review+
|
||||||
| Target Milestone: | 3.7.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Satyam Kandula
Same issue with binary literals, where I entered "0b111" for the int value. java.lang.NumberFormatException: For input string: "b111" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:447) at java.lang.Integer.valueOf(Integer.java:526) at java.lang.Integer.decode(Integer.java:919) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.parseIntValue(ASTInstructionCompiler.java:2915) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2887) at org.eclipse.jdt.core.dom.NumberLiteral.accept0(NumberLiteral.java:135) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2566) at org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:136) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2566) at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:504) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:484) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:219) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.createExpressionFromAST(ASTEvaluationEngine.java:448) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:267) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.evaluate(ASTEvaluationEngine.java:119) at org.eclipse.jdt.internal.debug.ui.actions.JavaObjectValueEditor.evaluate(JavaObjectValueEditor.java:166) at org.eclipse.jdt.internal.debug.ui.actions.JavaObjectValueEditor.access$0(JavaObjectValueEditor.java:148) at org.eclipse.jdt.internal.debug.ui.actions.JavaObjectValueEditor$1.runInUIThread(JavaObjectValueEditor.java:114) at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:969) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:885) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:87) at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:539) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:519) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) (In reply to comment #1) > Same issue with binary literals, where I entered "0b111" for the int value. > I quickly debugged this and the instruction compiler is passing the correct literal to Integer.decode, which is failing to decode it. This feels like something Integer should handle for us in the decode method. In the meantime Olivier mentioned he had some code that could handle this for us. Created attachment 199941 [details]
First draft
This needs some polishing and review. It adds support for binary literals as well as underscores in literals.
Libraries won't support the new format (either underscores or binary literals) immediately. So you actually need to do some processing on the literal to remove underscores and make sure that the binary literals are handled. Created attachment 200410 [details]
updated patch
Completes the first draft patch with support for short, float, double and byte processing. Also fixes the 'Change Value' var view action and adds regression tests.
Curtis please review for 3.7.1 +1 for 3.7.1 inclusion Patch committed and released to HEAD and 3.7.1 |