This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Remove Window.java hack
Tom Tromey wrote:
> Bryce> * java/awt/Window.java (addNotify): Remove peer casting hack now that
> Bryce> gcj/312 is fixed.
>
> I think there are other cast hacks like this in java.awt.
> I don't think they are marked :-(
> But as I recall they are all in addNotify methods.
ok, thanks. I think this catches most of them.
[ b. ]
2000-12-18 Bryce McKinlay <bryce@albatross.co.nz>
* java/awt/Button.java (addNotify): Remove peer casting hack now that
gcj/312 is fixed.
* java/awt/Label.java (addNotify): Likewise.
* java/awt/Panel.java (addNotify): Likewise.
* java/awt/Scrollbar.java (addNotify): Likewise.
* java/awt/Component.java (processPaintEvent): Use peer not getPeer.
Remove redundant null checks.
Index: Button.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Button.java,v
retrieving revision 1.3
diff -u -r1.3 Button.java
--- Button.java 2000/08/16 18:03:47 1.3
+++ Button.java 2000/12/18 22:08:34
@@ -38,7 +38,7 @@
public void addNotify ()
{
if (peer == null)
- peer = (ComponentPeer) getToolkit ().createButton (this);
+ peer = getToolkit ().createButton (this);
super.addNotify();
}
Index: Component.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Component.java,v
retrieving revision 1.13
diff -u -r1.13 Component.java
--- Component.java 2000/10/02 05:14:25 1.13
+++ Component.java 2000/12/18 22:08:34
@@ -1306,8 +1306,6 @@
private void processPaintEvent(PaintEvent event)
{
- ComponentPeer peer = getPeer();
-
// Can't do graphics without peer
if (peer == null)
return;
@@ -1319,10 +1317,10 @@
switch (event.id)
{
case PaintEvent.PAINT:
- if (peer != null) paint(gfx);
+ paint(gfx);
break;
case PaintEvent.UPDATE:
- if (peer != null) update(gfx);
+ update(gfx);
break;
default:
throw new IllegalArgumentException("unknown paint event");
Index: Label.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Label.java,v
retrieving revision 1.3
diff -u -r1.3 Label.java
--- Label.java 2000/07/31 02:03:51 1.3
+++ Label.java 2000/12/18 22:08:34
@@ -42,7 +42,7 @@
public void addNotify ()
{
if (peer == null)
- peer = (ComponentPeer) getToolkit ().createLabel (this);
+ peer = getToolkit ().createLabel (this);
}
public int getAlignment ()
Index: Panel.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Panel.java,v
retrieving revision 1.2
diff -u -r1.2 Panel.java
--- Panel.java 2000/08/16 18:03:47 1.2
+++ Panel.java 2000/12/18 22:08:34
@@ -32,8 +32,8 @@
public void addNotify()
{
- if (getPeer() == null)
- peer = (ComponentPeer) getToolkit().createPanel(this);
+ if (peer == null)
+ peer = getToolkit().createPanel(this);
super.addNotify();
}
}
Index: Scrollbar.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Scrollbar.java,v
retrieving revision 1.4
diff -u -r1.4 Scrollbar.java
--- Scrollbar.java 2000/09/26 23:46:09 1.4
+++ Scrollbar.java 2000/12/18 22:08:34
@@ -54,7 +54,7 @@
public void addNotify ()
{
if (peer == null)
- peer = (ComponentPeer) getToolkit ().createScrollbar (this);
+ peer = getToolkit ().createScrollbar (this);
}
public int getOrientation ()