-
Bug
-
Resolution: Unresolved
-
P4
-
13, 14
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
The documentation for java.awt.event.KeyEvent contains the following warning:
>WARNING: Aside from those keys that are defined by the Java language (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_ constants.
This is rather irritating because when compiling code which contains compile-time constants (such as these VK_ constants) they are replaced with their value. So if these VK_ constants were changed, it would break backwards compability.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the following code and decompile the class file.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
class KeyEventTest extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_A) {
System.out.println("Pressed A");
}
}
}
---------- END SOURCE ----------
The documentation for java.awt.event.KeyEvent contains the following warning:
>WARNING: Aside from those keys that are defined by the Java language (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_ constants.
This is rather irritating because when compiling code which contains compile-time constants (such as these VK_ constants) they are replaced with their value. So if these VK_ constants were changed, it would break backwards compability.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the following code and decompile the class file.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
class KeyEventTest extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_A) {
System.out.println("Pressed A");
}
}
}
---------- END SOURCE ----------