We have in Netbeans IDE problem that using Rectangle.setSize() rarely gives strange result. We use setSize() to swap width and height in rectangle. Rarely it happens that values are not swapped but become the same. Eg. if we call
rect.setSize(rect.height,rect.width) with width 768 and height 1024 and then check values of width and height both have value 768 instead of correct (1024,768). It happens only rarely and results in broken MDI desktop in IDE.
I tried to write simple standalone test but I could not reproduce this behaviour. I suspect it has something with runtime optimization but I could not find appropriate category so please reassign as necessary.
Steps to reproduce:
1.Start Netbeans IDE in MDI mode with empty userdir.
2.Open Source Editor and attach it to top.
3.Open Output window and attach it to bottom (it is attached to bottom by default).
4.Attach some window to right side.
5.You have now all four sides of desktop occupied by attached window.
6.Now start to play with desktop layout eg drag splitter of Explorer (left attached window) around. After while desktop becames corrupted.
I investigated this behaviour and I found it is caused by strange behaviour of setSize() as I described above.
I attach class where code is located.
I attach snapshot of corrupted IDE.
I attach patch jar file (put to lib/patches) to detect this behaviour
(It contains test code given bellow). When It happens it logs message ## ## ERROR ## ## to console.
It happens only on JDK 1.4.0-b87 on all three platforms Win2K, Solaris, Linux. It is not reproducible on JDK 1.3.1_01.
Following code tests described behaviour, if I put test directly into flip() method it does not happen.
You can get Netbeans IDE at www.netbeans.org/downloads.html. Get 3.3 beta 6.
code sample:
PerimeterLayout.java line 294:
if (vertical) {
// rotate the rectangles in order to ensure proper sizing
int height = compRect.height;
int width = compRect.width;
flip(compRect);
if ((compRect.height != width) || (compRect.width != height)) {
System.out.println("## ## ERROR ## ##");
}
flip(remaining);
flip(container);
}
....
code of flip(): private void flip(Rectangle rect) {
//Bugfix #18087
/*int x = rect.x;
int y = rect.y;
int height = rect.height;
int width = rect.width;
rect.setSize(height, width);
rect.setLocation(y, x);*/
//int height = rect.height;
//int width = rect.width;
rect.setSize(rect.height, rect.width);
rect.setLocation(rect.y, rect.x);
/*if ((rect.height != width) || (rect.width != height)) {
System.out.println("## ## ERROR ## ##");
}*/
}
rect.setSize(rect.height,rect.width) with width 768 and height 1024 and then check values of width and height both have value 768 instead of correct (1024,768). It happens only rarely and results in broken MDI desktop in IDE.
I tried to write simple standalone test but I could not reproduce this behaviour. I suspect it has something with runtime optimization but I could not find appropriate category so please reassign as necessary.
Steps to reproduce:
1.Start Netbeans IDE in MDI mode with empty userdir.
2.Open Source Editor and attach it to top.
3.Open Output window and attach it to bottom (it is attached to bottom by default).
4.Attach some window to right side.
5.You have now all four sides of desktop occupied by attached window.
6.Now start to play with desktop layout eg drag splitter of Explorer (left attached window) around. After while desktop becames corrupted.
I investigated this behaviour and I found it is caused by strange behaviour of setSize() as I described above.
I attach class where code is located.
I attach snapshot of corrupted IDE.
I attach patch jar file (put to lib/patches) to detect this behaviour
(It contains test code given bellow). When It happens it logs message ## ## ERROR ## ## to console.
It happens only on JDK 1.4.0-b87 on all three platforms Win2K, Solaris, Linux. It is not reproducible on JDK 1.3.1_01.
Following code tests described behaviour, if I put test directly into flip() method it does not happen.
You can get Netbeans IDE at www.netbeans.org/downloads.html. Get 3.3 beta 6.
code sample:
PerimeterLayout.java line 294:
if (vertical) {
// rotate the rectangles in order to ensure proper sizing
int height = compRect.height;
int width = compRect.width;
flip(compRect);
if ((compRect.height != width) || (compRect.width != height)) {
System.out.println("## ## ERROR ## ##");
}
flip(remaining);
flip(container);
}
....
code of flip(): private void flip(Rectangle rect) {
//Bugfix #18087
/*int x = rect.x;
int y = rect.y;
int height = rect.height;
int width = rect.width;
rect.setSize(height, width);
rect.setLocation(y, x);*/
//int height = rect.height;
//int width = rect.width;
rect.setSize(rect.height, rect.width);
rect.setLocation(rect.y, rect.x);
/*if ((rect.height != width) || (rect.width != height)) {
System.out.println("## ## ERROR ## ##");
}*/
}
- relates to
-
JDK-4587517 Incorrect FP code being generated on x86
-
- Closed
-
-
JDK-4621338 jit/symcjit/misctests/testFor crashes with os.cpp,723 in comp, mixed mode (linux
-
- Closed
-