[BLUEJ-1319] Result not valid var name for codepad
There is an anomalous behaviour of the codepad when you define any variable or any type named "result" (obviously without ""). In this case all the variables defined of the same type appears to be valued to 0. (I think internally it contains the right values, but, if you want to show the content in the codepad the answer is 0, 0.0 or null)
Try this sequence in the codepad:
int x = 8; int y = 2; x 8 (int) y 2 (int) int result = x + y; result 0 (int) x 0 (int) y 0 (int)
after this point any new int variable will be shown with a 0 (int) value. Same happens by using double variables instead int, or a reference like String (null instead 0)
Surprisingly, if you try to print the variable x or y through the terminal (System.out.println(x);) the right value is shown, but if you try to do it with "result" variable the value of x is shown instead x + y
Issue metadata
- Issue type: Bug
- Priority: Highest
- Fix versions: 5.0.0