Re: [cp-patches] FYI: Swing demo themes switch

2006-03-15 Thread David Gilbert

Roman Kennke wrote:


Hi David,

 


I removed the start dialog from the Swing demo and replaced it with a new
menu, called 'Themes' which allows the user to switch themes. ATM
there are only 2 themes (the 2 official ones: the DefaultMetalTheme, or
'Steel', and the JDK5 OceanTheme).



 

Great!  I wanted to try this out, but the Demo currently gives me this 
exception before I see the main window come up:
   



This is fixed by the attached patch. However, I still have problems with
the menu painting and Mark reported disappearing menu items (which is
really weird). When you get something running, maybe you can report if
you see any of these problems?
 

I'm seeing the problems with the menus, and also the internal frames on 
the 'Desktop World' are not responding to mouse events too well...


Regards,

Dave



Re: [cp-patches] FYI: Swing demo themes switch

2006-03-15 Thread Roman Kennke
Hi David,

 I removed the start dialog from the Swing demo and replaced it with a new
 menu, called 'Themes' which allows the user to switch themes. ATM
 there are only 2 themes (the 2 official ones: the DefaultMetalTheme, or
 'Steel', and the JDK5 OceanTheme).
 
   
 
 Great!  I wanted to try this out, but the Demo currently gives me this 
 exception before I see the main window come up:

This is fixed by the attached patch. However, I still have problems with
the menu painting and Mark reported disappearing menu items (which is
really weird). When you get something running, maybe you can report if
you see any of these problems?

2006-03-14  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicToolBarUI.java
(PropertyListener.propertyChange): Added null check to avoid
NPE.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [cp-patches] FYI: Swing demo themes switch

2006-03-15 Thread Roman Kennke
Hi David,

 I removed the start dialog from the Swing demo and replaced it with a new
 menu, called 'Themes' which allows the user to switch themes. ATM
 there are only 2 themes (the 2 official ones: the DefaultMetalTheme, or
 'Steel', and the JDK5 OceanTheme).
 
  
 
   
 
 Great!  I wanted to try this out, but the Demo currently gives me this 
 exception before I see the main window come up:
 
 
 
 This is fixed by the attached patch. However, I still have problems with
 the menu painting and Mark reported disappearing menu items (which is
 really weird). When you get something running, maybe you can report if
 you see any of these problems?
   
 
 I'm seeing the problems with the menus, and also the internal frames on 
 the 'Desktop World' are not responding to mouse events too well...

Try reverting Lillian's recent Container.addImpl patch and see if that
solves your problems. At least for me it did.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Re: [cp-patches] FYI: Swing demo reworked

2006-03-15 Thread Roman Kennke
Hi again,

 BTW: I find it ugly to have a couple of XXXWorld demos in the application
 and the rest are 'outsourced' into separate demos. The ButtonWorld is
 kinda useless and confusing (it should really be 'BorderWorld') and
 the other demos could be outsourced just like the others. What we should
 do is one of the following:
 
 1. Inline the outsourced demos. This should be fairly easy, since the
 XXXDemo application now have a DemoFactory which delivers a JComponent,
 that can easily be embedded into the TabbedPane. So all Demos would show
 up inside the Swing Activity board in a separate tab. The downside is
 that we need to load everything at startup which consumes time.
 
 2. Outsource the XXXWorld demos just like the others. Problem: What
 should we display in the main panel?
 
 3. A completely different solution would be to provide a 'desktop' in
 the main app and let the subdemos appear as InternalFrames inside the
 application desktop. This way we can still lazily load the subdemos
 while having them integrated in the activity board.

I want to add that approach #3 also helps with switching themes. Having
subdemos in separate windows makes it necessary to close the window and
reopen it in order to make it pick up the new theme. Same for LF
change.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[cp-patches] FYI: TableColumn.java updates

2006-03-15 Thread David Gilbert
This patch (committed) fixes a couple of methods that are not firing the required 
PropertyChangeEvents (Mauve tests already committed), and updates some API doc comments:


2006-03-15  David Gilbert  [EMAIL PROTECTED]

* javax/swing/table/TableColumn.java: API docs updated all over, plus
(setIdentifier): Fire required PropertyChangeEvent,
(setCellEditor): Likewise.

Regards,

Dave
Index: javax/swing/table/TableColumn.java
===
RCS file: /sources/classpath/classpath/javax/swing/table/TableColumn.java,v
retrieving revision 1.19
diff -u -r1.19 TableColumn.java
--- javax/swing/table/TableColumn.java  14 Mar 2006 22:14:27 -  1.19
+++ javax/swing/table/TableColumn.java  15 Mar 2006 11:44:50 -
@@ -113,7 +113,7 @@
   protected TableCellRenderer headerRenderer;
 
   /**
-   * The header value.
+   * The value for the column header.
*/
   protected Object headerValue;
 
@@ -206,6 +206,8 @@
* (with the property name 'modelIndex') to all registered listeners.
* 
* @param modelIndex the column index in the model.
+   * 
+   * @see #getModelIndex()
*/
   public void setModelIndex(int modelIndex)
   {
@@ -221,7 +223,9 @@
* Returns the index of the column in the related [EMAIL PROTECTED] 
TableModel} that
* this codeTableColumn/code maps to.
* 
-   * @return the model index
+   * @return the model index.
+   * 
+   * @see #setModelIndex(int)
*/
   public int getModelIndex()
   {
@@ -229,13 +233,21 @@
   }
 
   /**
-   * Sets the identifier for the column.
+   * Sets the identifier for the column and sends a [EMAIL PROTECTED] 
PropertyChangeEvent}
+   * (with the property name 'identifier') to all registered listeners.
+   * 
+   * @param identifier the identifier (codenull/code permitted).
* 
-   * @param identifier the identifier
+   * @see #getIdentifier()
*/
   public void setIdentifier(Object identifier)
   {
-this.identifier = identifier;
+if (this.identifier != identifier)
+  {   
+Object oldValue = this.identifier;
+this.identifier = identifier;
+changeSupport.firePropertyChange(identifier, oldValue, identifier);
+  }
   }
 
   /**
@@ -253,11 +265,12 @@
   }
 
   /**
-   * Sets the header value and sends a [EMAIL PROTECTED] PropertyChangeEvent} 
to all
-   * registered listeners.  The header value property uses the name
-   * [EMAIL PROTECTED] #HEADER_VALUE_PROPERTY}.
+   * Sets the header value and sends a [EMAIL PROTECTED] PropertyChangeEvent} 
(with the 
+   * property name [EMAIL PROTECTED] #HEADER_VALUE_PROPERTY}) to all 
registered listeners.
+   * 
+   * @param headerValue the value of the header (codenull/code permitted).
* 
-   * @param headerValue the value of the header
+   * @see #getHeaderValue()
*/
   public void setHeaderValue(Object headerValue)
   {
@@ -273,7 +286,9 @@
   /**
* Returns the header value.
* 
-   * @return the value of the header
+   * @return the value of the header.
+   * 
+   * @see #getHeaderValue()
*/
   public Object getHeaderValue()
   {
@@ -281,9 +296,13 @@
   }
 
   /**
-   * setHeaderRenderer
+   * Sets the renderer for the column header and sends a 
+   * [EMAIL PROTECTED] PropertyChangeEvent} (with the property name 
+   * [EMAIL PROTECTED] #HEADER_RENDERER_PROPERTY}) to all registered listeners.
* 
-   * @param renderer the renderer to use
+   * @param renderer the header renderer (codenull/code permitted).
+   * 
+   * @see #getHeaderRenderer()
*/
   public void setHeaderRenderer(TableCellRenderer renderer)
   {
@@ -297,8 +316,11 @@
   }
 
   /**
-   * getHeaderRenderer
-   * @return TableCellRenderer
+   * Returns the renderer for the column header.
+   * 
+   * @return The renderer for the column header (possibly codenull/code).
+   * 
+   * @see #setHeaderRenderer(TableCellRenderer)
*/
   public TableCellRenderer getHeaderRenderer()
   {
@@ -307,9 +329,12 @@
 
   /**
* Sets the renderer for cells in this column and sends a 
-   * [EMAIL PROTECTED] PropertyChangeEvent} to all registered listeners.
+   * [EMAIL PROTECTED] PropertyChangeEvent} (with the property name 
+   * [EMAIL PROTECTED] #CELL_RENDERER_PROPERTY}) to all registered listeners.
* 
* @param renderer the cell renderer (codenull/code permitted).
+   * 
+   * @see #getCellRenderer()
*/
   public void setCellRenderer(TableCellRenderer renderer)
   {
@@ -325,7 +350,9 @@
   /**
* Returns the renderer for the table cells in this column.
* 
-   * @return The cell renderer.
+   * @return The cell renderer (possibly codenull/code).
+   * 
+   * @see #setCellRenderer(TableCellRenderer)
*/
   public TableCellRenderer getCellRenderer()
   {
@@ -333,19 +360,30 @@
   }
 
   /**
-   * setCellEditor
+   * Sets the cell editor for the column and sends a [EMAIL PROTECTED] 
PropertyChangeEvent}
+   * (with the property name 'cellEditor') to all registered listeners.
* 
-   * 

Re: [cp-patches] FYI: Swing demo themes switch

2006-03-15 Thread David Gilbert

Roman Kennke wrote:


Hi David,

 


This is fixed by the attached patch. However, I still have problems with
the menu painting and Mark reported disappearing menu items (which is
really weird). When you get something running, maybe you can report if
you see any of these problems?


 

I'm seeing the problems with the menus, and also the internal frames on 
the 'Desktop World' are not responding to mouse events too well...
   



Try reverting Lillian's recent Container.addImpl patch and see if that
solves your problems. At least for me it did.

/Roman

 

Yes, reverting that fixes the problem.  Most likely it is unrelated, but 
now I noticed some bad regressions in the JComboBox demo...


Regards,

Dave



Re: [cp-patches] FYI: Swing demo themes switch

2006-03-15 Thread Mark Wielaard
Hi,

On Wed, 2006-03-15 at 12:45 +0100, Roman Kennke wrote:
  I'm seeing the problems with the menus, and also the internal frames on 
  the 'Desktop World' are not responding to mouse events too well...
 
 Try reverting Lillian's recent Container.addImpl patch and see if that
 solves your problems. At least for me it did.

It seems to solve the Menu thing. But internal frames still have
problems after you switch themes (even if you switch back). Before
switching themes they seem to respond normally when dragging around. You
only cannot drag them from the text of the frame, only from the pattern.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part


[cp-patches] FYI: TableColumn.sizeWidthToFit() implemented

2006-03-15 Thread David Gilbert
This patch (committed) implements the TableColumn.sizeWidthToFit() method, which was 
previously stubbed:


2006-03-15  David Gilbert  [EMAIL PROTECTED]

* javax/swing/table/TableColumn.java
(sizeWidthToFit): Implemented.

I committed Mauve tests to back up the implementation already.

Regards,

Dave
Index: javax/swing/table/TableColumn.java
===
RCS file: /sources/classpath/classpath/javax/swing/table/TableColumn.java,v
retrieving revision 1.20
diff -u -r1.20 TableColumn.java
--- javax/swing/table/TableColumn.java  15 Mar 2006 11:54:29 -  1.20
+++ javax/swing/table/TableColumn.java  15 Mar 2006 14:12:47 -
@@ -38,6 +38,8 @@
 
 package javax.swing.table;
 
+import java.awt.Component;
+import java.awt.Dimension;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.Serializable;
@@ -584,11 +586,23 @@
   }
 
   /**
-   * sizeWidthToFit
+   * Sets the minimum, maximum, preferred and current width to match the
+   * minimum, maximum and preferred width of the header renderer component.
+   * If there is no header renderer component, this method does nothing.
*/
   public void sizeWidthToFit()
   {
-// TODO
+if (headerRenderer == null)
+  return;
+Component c = headerRenderer.getTableCellRendererComponent(null, 
+getHeaderValue(), false, false, 0, 0);
+Dimension min = c.getMinimumSize();
+Dimension max = c.getMaximumSize();
+Dimension pref = c.getPreferredSize();
+setMinWidth(min.width);
+setMaxWidth(max.width);
+setPreferredWidth(pref.width);
+setWidth(pref.width);
   }
 
   /**


[cp-patches] FYI: JInternalFrame fix

2006-03-15 Thread Roman Kennke
This fixes the boolean properties in JInternalFrame to be bound
properties.

2006-03-15  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JInternalFrame.java
(setClosable): Made this property bound.
(setResizable): Made this property bound.
(setIconifiable): Made this property bound.
(setMaximizable): Made this property bound.

/Roman
Index: javax/swing/JInternalFrame.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JInternalFrame.java,v
retrieving revision 1.28
diff -u -r1.28 JInternalFrame.java
--- javax/swing/JInternalFrame.java	14 Mar 2006 13:00:53 -	1.28
+++ javax/swing/JInternalFrame.java	15 Mar 2006 14:30:46 -
@@ -1239,7 +1239,11 @@
*/
   public void setClosable(boolean b)
   {
-closable = b;
+if (closable != b)
+  {
+closable = b;
+firePropertyChange(closable, ! closable, closable);
+  }
   }
 
   /**
@@ -1397,7 +1401,11 @@
*/
   public void setIconifiable(boolean b)
   {
-iconable = b;
+if (iconable != b)
+  {
+iconable = b;
+firePropertyChange(iconable, ! iconable, iconable);
+  }
   }
 
   /**
@@ -1462,7 +1470,11 @@
*/
   public void setMaximizable(boolean b)
   {
-maximizable = b;
+if (maximizable != b)
+  {
+maximizable = b;
+firePropertyChange(maximizable, ! maximizable, maximizable);
+  }
   }
 
   /**
@@ -1539,7 +1551,11 @@
*/
   public void setResizable(boolean b)
   {
-resizable = b;
+if (b != resizable)
+  {
+resizable = b;
+firePropertyChange(resizable, ! resizable, resizable);
+  }
   }
 
   /**


Re: [cp-patches] Patch: Container fix

2006-03-15 Thread Lillian Angel
On Wed, 2006-03-15 at 12:44 +0100, Roman Kennke wrote:
 Hi Lillian,
 
 This change in Container.addImpl causes massive painting problems in
 Swing. Could you reconsider this? It might be the case that we only need
 a if(isShowing() { repaint... } instead of completely removing the
 repaint.

No, I have added more tests to the Container.addImpl mauve test to show
this is right.

 
 Note that I am not saying that you are wrong. If it turns out that your
 patch is right (write more mauve tests for this please), then we must
 probably do something in JComponent.addImpl or so.

Yes, something has to be done elsewhere. We cannot call repaint each
time a component is added to a container.


Lillian




[cp-patches] Patch: Component show fix

2006-03-15 Thread Lillian Angel
Sun only calls repaint if the component is lightweight.
I am going to commit another mauve test for this.

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

* java/awt/Component.java
(show): repaint should only be called if the component
isShowing and isLightweight.

Index: java/awt/Component.java
===
RCS file: /sources/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.105
diff -u -r1.105 Component.java
--- java/awt/Component.java	3 Mar 2006 21:12:19 -	1.105
+++ java/awt/Component.java	15 Mar 2006 15:15:09 -
@@ -906,7 +906,7 @@
 
 // The JDK repaints the component before invalidating the parent.
 // So do we.
-if (isShowing())
+if (isShowing()  isLightweight())
   repaint();
 // Invalidate the parent if we have one. The component itself must
 // not be invalidated. We also avoid NullPointerException with


Re: [cp-patches] RFC: gnu.regexp: subexpressions within RETokenLookAhead

2006-03-15 Thread Ito Kazumitsu
From: Ito Kazumitsu [EMAIL PROTECTED]
Date: Wed, 15 Mar 2006 07:07:36 +0900 (JST)

 This fix will make pass the following tests in
 gnu/testlet/java/util/regex/Pattern/testdata2:

I have made another fix so that the followings pass.

/(?=(foo)a)bar/
fooabar
 0: bar
 1: foo
*** Failers
No match
bar
No match
foobbar
No match

/(?=(foo))bar\1/
foobarfoo
 0: barfoo
 1: foo
foobarfootling
 0: barfoo
 1: foo
*** Failers
No match
foobar
No match
barfoo
No match

/(?.*)(?=(abcd|wxyz))/
alphabetabcd
 0: alphabetabcd
 1: abcd
endingwxyz
 0: endingwxyz
 1: wxyz
*** Failers
No match
a rather long string that doesn't end with one of them
No match

ChangeLog:
2006-03-16  Ito Kazumitsu  [EMAIL PROTECTED]

* gnu/regexp/REMatch.java(matchedCharIndexed): New field,
(start, end): Added comment about the negative values of them,
(finish): Saves the input text in matchedCharIndexed,
(toString): If the start or end index is out of bounds of the
matched text, get the substring from matchedCharIndexed.
Added special handlings in case start/end index  -1.
* gnu/regexp/RETokenLookAhead.java(matchThis): Return the newly
found match, but keep the index as the original match.
* gnu/regexp/RETokenLookBehind.java(matchThis): Return the newly
found match, but keep the index as the original match.
* gnu/regexp/RETokenBackRef.java(matchThis): Added special handlings
in case start/end index  -1.

Index: classpath/gnu/regexp/REMatch.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/REMatch.java,v
retrieving revision 1.9
diff -u -r1.9 REMatch.java
--- classpath/gnu/regexp/REMatch.java   11 Mar 2006 01:39:49 -  1.9
+++ classpath/gnu/regexp/REMatch.java   15 Mar 2006 15:14:14 -
@@ -49,6 +49,7 @@
  */
 public final class REMatch implements Serializable, Cloneable {
 private String matchedText;
+private CharIndexed matchedCharIndexed;
 
 // These variables are package scope for fast access within the engine
 int eflags; // execution flags this match was made using
@@ -66,6 +67,10 @@
 int index; // used while matching to mark current match position in input
 int[] start; // start positions (relative to offset) for each (sub)exp.
 int[] end;   // end positions for the same
+// start[i] == -1 or end[i] == -1 means that the start/end position is 
void.
+// start[i] == p or end[i] == p where p  0 and p != -1 means that
+// the actual start/end position is (p+1). Start/end positions may
+// become negative when the subexpression is in a RETokenLookBehind.
 boolean empty; // empty string matched. This flag is used only within
   // RETokenRepeated.
 
@@ -106,6 +111,7 @@
for (i = 0; i  end[0]; i++)
sb.append(text.charAt(i));
matchedText = sb.toString();
+   matchedCharIndexed = text;
for (i = 0; i  start.length; i++) {
// If any subexpressions didn't terminate, they don't count
// TODO check if this code ever gets hit
@@ -181,7 +187,18 @@
if ((sub = start.length) || sub  0)
throw new IndexOutOfBoundsException(No group  + sub);
if (start[sub] == -1) return null;
-   return (matchedText.substring(start[sub],end[sub]));
+   if (start[sub] = 0  end[sub] = matchedText.length())
+   return (matchedText.substring(start[sub],end[sub]));
+   else {
+   StringBuffer sb = new StringBuffer();
+   int s = start[sub];
+   int e = end[sub];
+   if (s  0) s += 1;
+   if (e  0) e += 1;
+   for (int i = start[0] + s; i  start[0] + e; i++)
+   sb.append(matchedCharIndexed.charAt(i));
+   return sb.toString();
+   }
 }
 
 /** 
Index: classpath/gnu/regexp/RETokenBackRef.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/RETokenBackRef.java,v
retrieving revision 1.5
diff -u -r1.5 RETokenBackRef.java
--- classpath/gnu/regexp/RETokenBackRef.java11 Mar 2006 01:39:49 -  
1.5
+++ classpath/gnu/regexp/RETokenBackRef.java15 Mar 2006 15:14:14 -
@@ -57,6 +57,8 @@
b = mymatch.start[num];
e = mymatch.end[num];
if ((b==-1)||(e==-1)) return null; // this shouldn't happen, but...
+   if (b  0) b += 1;
+   if (e  0) e += 1;
for (int i=b; ie; i++) {
char c1 = input.charAt(mymatch.index+i-b);
char c2 = input.charAt(i);
Index: classpath/gnu/regexp/RETokenLookAhead.java
===
RCS file: /cvsroot/classpath/classpath/gnu/regexp/RETokenLookAhead.java,v
retrieving revision 1.4
diff -u -r1.4 RETokenLookAhead.java
--- classpath/gnu/regexp/RETokenLookAhead.java  11 Mar 2006 01:39:49 -  
1.4
+++ 

[cp-patches] FYI: Popup fixlet

2006-03-15 Thread Roman Kennke
Lillians patch to Container.addImpl turned out to be ok, and it probably
saves us lots of unnecessary repaint() calls. However, it broke all
kinds of popup menus. I fixed this by adding a repaint() call to
Popup.LightweightPopup.show().

2006-03-15  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/Popup.java
(LightweightPopup.show): Repaint the panel after showing it.

/Roman
Index: javax/swing/Popup.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/Popup.java,v
retrieving revision 1.9
diff -u -r1.9 Popup.java
--- javax/swing/Popup.java	27 Jan 2006 10:35:11 -	1.9
+++ javax/swing/Popup.java	15 Mar 2006 15:26:31 -
@@ -285,6 +285,7 @@
   Point layeredPaneLoc = layeredPane.getLocationOnScreen();
   panel.setLocation(x - layeredPaneLoc.x, y - layeredPaneLoc.y);
   layeredPane.add(panel, JLayeredPane.POPUP_LAYER);
+  panel.repaint();
 }
 
 /**


[cp-patches] Patch: Container fix

2006-03-15 Thread Lillian Angel
locate(...) should not ignore invisible components. I have committed a
mauve test for this. I added a lot more documentation to all the methods
listed. Also, I removed findComponentForMouseEvent because it was
package-private and never used.

getComponentAt needs special handling for lightweight components. I am
working on this as well.

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

* java/awt/Container.java
(getComponentAt): Added API documentation.
(getComponentAt): Likewise.
(locate): Likewise. Also, removed lines to ignore
invisible components.
(findComponentAt): Added API documentation.
(findComponentAt): Added API documentation.
(findComponentForMouseEvent): Removed, never used.


Index: java/awt/Container.java
===
RCS file: /sources/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.85
diff -u -r1.85 Container.java
--- java/awt/Container.java	14 Mar 2006 16:48:24 -	1.85
+++ java/awt/Container.java	15 Mar 2006 16:05:12 -
@@ -964,6 +964,12 @@
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case codenull/code is returned.
+   * 
+   * The top-most child component is returned in the case where there is overlap
+   * in the components. This is determined by finding the component closest to 
+   * the index 0 that claims to contain the given point via Component.contains(), 
+   * except that Components which are lightweight take precedence over 
+   * those which are not.
*
* @param x The X coordinate of the point.
* @param y The Y coordinate of the point.
@@ -983,7 +989,13 @@
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case codenull/code is returned.
-   *
+   * 
+   * The top-most child component is returned in the case where there is overlap
+   * in the components. This is determined by finding the component closest to 
+   * the index 0 that claims to contain the given point via Component.contains(), 
+   * except that Components which are lightweight take precedence over 
+   * those which are not.
+   * 
* @param x The x position of the point to return the component at.
* @param y The y position of the point to return the component at.
*
@@ -998,12 +1010,9 @@
   {
 if (!contains (x, y))
   return null;
+
 for (int i = 0; i  ncomponents; ++i)
   {
-// Ignore invisible children...
-if (!component[i].isVisible ())
-  continue;
-
 int x2 = x - component[i].x;
 int y2 = y - component[i].y;
 if (component[i].contains (x2, y2))
@@ -1021,6 +1030,12 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
*
+   * The top-most child component is returned in the case where there is overlap
+   * in the components. This is determined by finding the component closest to 
+   * the index 0 that claims to contain the given point via Component.contains(), 
+   * except that Components which are lightweight take precedence over 
+   * those which are not.
+   * 
* @param p The point to return the component at.
* @return The component containing the specified point, or codenull/code
* if there is no such point.
@@ -1030,6 +1045,23 @@
 return getComponentAt (p.x, p.y);
   }
 
+  /**
+   * Locates the visible child component that contains the specified position. 
+   * The top-most child component is returned in the case where there is overlap
+   * in the components. If the containing child component is a Container,
+   * this method will continue searching for the deepest nested child 
+   * component. Components which are not visible are ignored during the search.
+   * 
+   * The findComponentAt method is different from getComponentAt in that getComponentAt
+   * only searches the Container's immediate children; if the containing component is 
+   * a Container, findComponentAt will search that child to find a nested component.
+   * 
+   * @param x - x coordinate
+   * @param y - y coordinate
+   * @return null if the component does not contain the position. 
+   * If there is no child component at the requested point and the point is 
+   * within the bounds of the container the container itself is returned.
+   */
   public Component findComponentAt(int x, int y)
   {
 synchronized (getTreeLock ())
@@ -1063,53 +1095,21 @@
   }
   
   /**
-   * Finds the visible child component that contains the specified position.
-   * The top-most child is returned in the case where there is overlap.
-   * If the top-most child is transparent and has no MouseListeners attached,
-   * we discard it and return the next top-most component containing the
-   * 

[cp-patches] FYI: new Container.getComponentAt class

2006-03-15 Thread Lillian Angel
Added a new class containing tests for getComponentAt. getComponentAt
should not ignore invisible components.

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

* gnu/testlet/java/awt/Container/getComponentAt.java:
New Class





[cp-patches] Re: FYI: new Container.getComponentAt class

2006-03-15 Thread Lillian Angel
Patch attached.

On Wed, 2006-03-15 at 11:11 -0500, Lillian Angel wrote:
 Added a new class containing tests for getComponentAt. getComponentAt
 should not ignore invisible components.
 
 2006-03-15  Lillian Angel  [EMAIL PROTECTED]
 
 * gnu/testlet/java/awt/Container/getComponentAt.java:
 New Class
 
Index: gnu/testlet/java/awt/Container/getComponentAt.java
===
RCS file: gnu/testlet/java/awt/Container/getComponentAt.java
diff -N gnu/testlet/java/awt/Container/getComponentAt.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/testlet/java/awt/Container/getComponentAt.java	15 Mar 2006 16:05:26 -
@@ -0,0 +1,66 @@
+/* getComponentAt.java --
+   Copyright (C) 2006 Red Hat
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Mauve; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+package gnu.testlet.java.awt.Container;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Frame;
+import java.awt.List;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+
+public class getComponentAt implements Testlet
+{
+  /**
+   * Starts the test run.
+   *
+   * @param harness the test harness to use
+   */
+  public void test(TestHarness harness)
+  {
+Frame f = new Frame();
+List l = new List(10);
+TextArea t = new TextArea(10, 10);
+f.setSize(300, 300);
+t.setBounds(10, 10, 100, 100);
+l.setBounds(0, 0, 100, 100);
+
+t.setVisible(true);
+l.setVisible(false);
+f.add(l);
+f.add(t);
+f.show();
+
+Robot r = harness.createRobot();
+r.waitForIdle();
+r.delay(1000);
+
+Point po = l.getLocation();
+harness.check(t.isVisible(), true);
+harness.check(f.isVisible(), true);
+harness.check(l.isVisible(), false);
+harness.check(f.getComponentAt(po.x, po.y) == l);
+  }
+}


Re: [cp-patches] FYI: Made some classes final as pointed out by JAPI

2006-03-15 Thread Wolfgang Baer
Hi Audrius,

Audrius Meskauskas wrote:
 Great job!

There are a lot more of these issues as pointed out by reverse japi.
http://www.kaffe.org/~stuart/japi/htmlout/h-classpath-jdk15.html

I will try continue to address these issues from time to time.

Wolfgang



Re: [cp-patches] Patch: Container fix

2006-03-15 Thread Lillian Angel
On Wed, 2006-03-15 at 11:10 -0500, Lillian Angel wrote:

 getComponentAt needs special handling for lightweight components. I am
 working on this as well.

Done.

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

* java/awt/Container.java
(getComponentAt): Fixed mistake in comments.
(getComponentAt): Likewise.
(locate): Likewise. Also, handled lightweight components.
Heavyweights take precedence over lightweights, so we should
iterate through the heavyweights first.



Index: java/awt/Container.java
===
RCS file: /sources/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.86
diff -u -r1.86 Container.java
--- java/awt/Container.java	15 Mar 2006 16:08:03 -	1.86
+++ java/awt/Container.java	15 Mar 2006 16:21:50 -
@@ -968,8 +968,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
*
* @param x The X coordinate of the point.
* @param y The Y coordinate of the point.
@@ -993,8 +993,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
* 
* @param x The x position of the point to return the component at.
* @param y The y position of the point to return the component at.
@@ -1011,13 +1011,27 @@
 if (!contains (x, y))
   return null;
 
+// First find the component closest to (x,y) that is a heavyweight.
 for (int i = 0; i  ncomponents; ++i)
   {
-int x2 = x - component[i].x;
-int y2 = y - component[i].y;
-if (component[i].contains (x2, y2))
-  return component[i];
+Component comp = component[i];
+int x2 = x - comp.x;
+int y2 = y - comp.y;
+if (comp.contains (x2, y2)  !comp.isLightweight())
+  return comp;
+  }
+
+// if a heavyweight component is not found, look for a lightweight
+// closest to (x,y).
+for (int i = 0; i  ncomponents; ++i)
+  {
+Component comp = component[i];
+int x2 = x - comp.x;
+int y2 = y - comp.y;
+if (comp.contains (x2, y2)  comp.isLightweight())
+  return comp;
   }
+
 return this;
   }
   }
@@ -1033,8 +1047,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
* 
* @param p The point to return the component at.
* @return The component containing the specified point, or codenull/code


Re: [cp-patches] FYI: Made some classes final as pointed out by JAPI

2006-03-15 Thread Stuart Ballard
Andrew John Hughes A.Hughes at dcs.shef.ac.uk writes:
 There seem to be an awful lot of 'missing' classes on this reverse
 JAPI run.  Presumably, these are not missing, but we are wrongly
 exposing them in GNU Classpath?

That's pretty much right. You have to read the results backwards in this report.
An item that's missing in jdk15 is a class that's public or protected in
Classpath that either doesn't exist at all in JDK1.5 or is default-access or
private. These items should be made default-access or private in Classpath too,
or moved to a gnu.* package, or removed entirely if they're unused.

Simplest way to eliminate the Japi errors would be to just make them
default-access and make sure everything still compiles, but (just like with
stubs) it might be better not to do this without figuring what the right way
is in each case.

Another note for anyone interested in tackling these: Japi considers all methods
of a final class final, so in several cases in the current report a class is
reported as incorrectly nonfinal and then the same error appears for all of its
methods. Fixing the class to be final is all that's needed to eliminate all
those errors.

Stuart.




[cp-patches] FYI: new Swing demo

2006-03-15 Thread Roman Kennke
I redesigned the Swing demo a little. What I did:

1. throw away the 'XXXWorld' tabbed pane in the center.
2. 'Outsourced' the XXXWorld stuff in separate demos just like the
other demos. This is TreeDemo, ListDemo and TabbedPaneDemo. The
ButtonWorld and DesktopWorld are no longer there. IMO the ButtonWorld
was quite useless and confusing. Eventually we would write a BorderDemo
to replace it. The DesktopWorld is replaced by point#3
3. Added a desktop. This desktop shows a GNU Classpath badge in the
middle.
4. Made the subdemos appear as internal frames inside the new desktop.

IMO this makes the Swing activity board more clear. Eventually we should
move all those buttons in the toolbar with icons instead of labels. But
that is not that important.

Note that I added a PNG file (the GNU Classpath badge). I hope it shows
up for everybody. Otherwise the Makefiles must be tweaked a little so
that png files are included in the examples.zip. I must say that I
always start the demo without the examples.zip so I have no problems
there.

2006-03-15  Roman Kennke  [EMAIL PROTECTED]

* examples/gnu/classpath/examples/swing/Demo.java:
(desktop): New field.
(mkMenuBar): Added new subdemos.
(mkButtonWorld): Removed.
(CheckCellRenderer): Moved to ListDemo.
(LabelCellRenderer): Moved to ListDemo.
(mkTreeWorld): Moved to TreeDemo.
(mkDesktopWorld): Removed.
(mkTabWorld): Moved to TabbedPaneDemo.
(mkTabbedPane): Removed.
(Demo): Replaced 'worlds' tabbed pane with desktop.
(PopupAction): Made class non-static.
(PopupAction.actionPerformed): Bring up subdemos in internal
frame.
(mkButtonBar): Added new demos.
(createDesktop): New method.
* examples/gnu/classpath/examples/swing/DemoDesktop.java: New
class.
* examples/gnu/classpath/examples/swing/ListDemo.java: New demo.
* examples/gnu/classpath/examples/swing/TreeDemo.java: New demo.
* examples/gnu/classpath/examples/swing/TabbedPaneDemo.java: New
demo.
* examples/gnu/classpath/examples/swing/badge.png: New image file.

/Roman
Index: examples/gnu/classpath/examples/swing/Demo.java
===
RCS file: /cvsroot/classpath/classpath/examples/gnu/classpath/examples/swing/Demo.java,v
retrieving revision 1.37
diff -u -r1.37 Demo.java
--- examples/gnu/classpath/examples/swing/Demo.java	15 Mar 2006 11:18:05 -	1.37
+++ examples/gnu/classpath/examples/swing/Demo.java	15 Mar 2006 16:39:15 -
@@ -27,7 +27,6 @@
 
 import javax.swing.*;
 import javax.swing.tree.*;
-import javax.swing.border.*;
 
 import javax.swing.plaf.metal.DefaultMetalTheme;
 import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -39,6 +38,13 @@
 public class Demo
 {
   JFrame frame;
+
+  /**
+   * The main desktop. This is package private to avoid synthetic accessor
+   * method.
+   */
+  JDesktopPane desktop;
+
   static Color blueGray = new Color(0xdc, 0xda, 0xd5);
 
   private static Icon stockIcon(String s)
@@ -129,6 +135,12 @@
 
 examples.add(new JMenuItem(new PopupAction(Table,
   TableDemo.createDemoFactory(;
+examples.add(new JMenuItem(new PopupAction(List,
+   ListDemo.createDemoFactory(;
+examples.add(new JMenuItem(new PopupAction(TabbedPane,
+ TabbedPaneDemo.createDemoFactory(;
+examples.add(new JMenuItem(new PopupAction(Tree,
+   TreeDemo.createDemoFactory(;
 
 final JMenuItem vmMenu;
 
@@ -277,92 +289,6 @@
   }
 
 
-  static JPanel mkButtonWorld()
-  {
-Icon ii = bigStockIcon(home);
-int CENTER = SwingConstants.CENTER;
-int TOP = SwingConstants.TOP;
-int BOTTOM = SwingConstants.BOTTOM;
-
-int[] valigns = new int[] {SwingConstants.CENTER,
-   SwingConstants.TOP,
-   SwingConstants.BOTTOM};
-
-int[] haligns = new int[] {SwingConstants.CENTER,
-   SwingConstants.RIGHT,
-   SwingConstants.LEFT};
-
-Border[] borders = new Border[] { 
-  new SoftBevelBorder(BevelBorder.RAISED),
-  new SoftBevelBorder(BevelBorder.LOWERED),
-  new BevelBorder(BevelBorder.RAISED),
-  
-  LineBorder.createBlackLineBorder(),
-  new MatteBorder(2, 2, 2, 2, Color.GREEN),
-  LineBorder.createGrayLineBorder(),
-  
-  new BevelBorder(BevelBorder.LOWERED),
-  new EtchedBorder(EtchedBorder.RAISED),
-  new EtchedBorder(EtchedBorder.LOWERED)  
-};
-
-JComponent[] comps = new JComponent[3*3];
-
-int q = 0;
-
-JPanel panel = new JPanel();
-panel.setLayout(new GridLayout(3, 3));
-
-for (int i = 0; i  3; ++i)
-  for (int j = 0; j  3; ++j)
-{
-  JButton b = mkButton(halign2str(haligns[i])

Re: [cp-patches] FYI: Made some classes final as pointed out by JAPI

2006-03-15 Thread Andrew John Hughes
On Wed, 15 Mar 2006 17:16:33 +0100
Wolfgang Baer [EMAIL PROTECTED] wrote:

 Hi Audrius,
 
 Audrius Meskauskas wrote:
  Great job!
 
 There are a lot more of these issues as pointed out by reverse japi.
 http://www.kaffe.org/~stuart/japi/htmlout/h-classpath-jdk15.html
 
 I will try continue to address these issues from time to time.
 
 Wolfgang
 

There seem to be an awful lot of 'missing' classes on this reverse
JAPI run.  Presumably, these are not missing, but we are wrongly
exposing them in GNU Classpath?

Thanks,
-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint) attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
Support OpenDocument instead.

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }

Value your freedom, or you will lose it, teaches history. 
`Don't bother us with politics' respond those who don't want to learn. 
-- Richard Stallman

The views expressed above are representative of my own personal
opinions, and not necessarily those of the University of Sheffield.


pgp8p4vctiQHr.pgp
Description: PGP signature


[cp-patches] Fix for false positive

2006-03-15 Thread Chris Burdess

I committed this patch to fix a false positive on my last commit.

2006-03-15  Chris Burdess  [EMAIL PROTECTED]

Fixes PR 26700
* gnu/xml/stream/XMLParser.java: Fix for detectEncoding false  
positive.


--
犬 Chris Burdess
  They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety. - Benjamin Franklin






patch
Description: Binary data


PGP.sig
Description: This is a digitally signed message part


[cp-patches] Patch: RFC: changing parts of VM reflection API

2006-03-15 Thread Tom Tromey
I'm posting this for comment.

This is the patch to change Method/Field/Constructor to have a
'getModifiersInternal' method, which returns the un-masked modifiers
as read from the .class file.  This lets us implement the new
1.5 reflection predicates such as isSynthetic.

I made this patch against the generics branch, so it probably won't
apply cleanly to the trunk without a little tweaking.  But there is
nothing actually generics-specific in this patch, and I would like to
commit it to the trunk.

Note that we could also do something similar to this for Class.  I
think we ought to but I'd prefer to do it as a separate patch.

The VMs will need some changes as soon as this goes in, because it
adds an abstract method to Member.  This means that a VM's copy of
(e.g.) Field will not compile until it is updated.  This is why I'm
not simply checking it in.

Tom

2006-03-05  Tom Tromey  [EMAIL PROTECTED]

* vm/reference/java/lang/reflect/Method.java (METHOD_MODIFIERS):
New constant.
(getModifiersInternal): Renamed from getModifiers.
(getModifiers): New method.
(isBridge): Likewise.
(isSynthetic): Likewise.
(isVarArgs): Likewise.
* vm/reference/java/lang/reflect/Field.java (FIELD_MODIFIERS):
New constant.
(getModifiersInternal): Renamed from getModifiers.
(getModifiers): New method.
(isSynthetic): Likewise.
(isEnumConstant): Likewise.
* vm/reference/java/lang/reflect/Constructor.java
(getModifiersInternal): Renamed from getModifiers.
(getModifiers): New method
(CONSTRUCTOR_MODIFIERS): New constant.
(isSynthetic): New method.
(isVarArgs): Likewise.
* java/lang/reflect/Member.java (isSynthetic): New method.

Index: java/lang/reflect/Member.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/reflect/Member.java,v
retrieving revision 1.6.2.3
diff -u -r1.6.2.3 Member.java
--- java/lang/reflect/Member.java   20 Sep 2005 18:46:29 -  1.6.2.3
+++ java/lang/reflect/Member.java   15 Mar 2006 16:37:30 -
@@ -97,4 +97,13 @@
* @see Modifier
*/
   int getModifiers();
+
+  /**
+   * Return true if this member is synthetic, meaning that it was
+   * created by the compiler and does not appear in the user's
+   * source code.
+   * @return true if the member is synthetic
+   * @since 1.5
+   */
+  boolean isSynthetic();
 }
Index: java/lang/reflect/Modifier.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/reflect/Modifier.java,v
retrieving revision 1.8.2.4
diff -u -r1.8.2.4 Modifier.java
--- java/lang/reflect/Modifier.java 13 Jan 2006 13:25:57 -  1.8.2.4
+++ java/lang/reflect/Modifier.java 15 Mar 2006 16:37:30 -
@@ -158,6 +158,26 @@
   static final int ALL_FLAGS = 0xfff;
 
   /**
+   * Flag indicating a bridge method.
+   */
+  static final int BRIDGE = 0x40;
+
+  /**
+   * Flag indicating a varargs method.
+   */
+  static final int VARARGS = 0x80;
+
+  /**
+   * Flag indicating a synthetic member.
+   */
+  static final int SYNTHETIC = 0x1000;
+
+  /**
+   * Flag indicating an enum constant or an enum class.
+   */
+  static final int ENUM = 0x4000;
+
+  /**
* Check whether the given modifier is abstract.
* @param mod the modifier.
* @return codetrue/code if abstract, codefalse/code otherwise.
Index: vm/reference/java/lang/reflect/Constructor.java
===
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/lang/reflect/Constructor.java,v
retrieving revision 1.11.2.10
diff -u -r1.11.2.10 Constructor.java
--- vm/reference/java/lang/reflect/Constructor.java 2 Mar 2006 09:34:06 
-   1.11.2.10
+++ vm/reference/java/lang/reflect/Constructor.java 15 Mar 2006 16:37:40 
-
@@ -81,6 +82,9 @@
   private ClassT clazz;
   private int slot;
   
+  private static final int CONSTRUCTOR_MODIFIERS
+= Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC;
+
   /**
* This class is uninstantiable except from native code.
*/
@@ -114,6 +118,13 @@
   }
 
   /**
+   * Return the raw modifiers for this constructor.  In particular
+   * this will include the synthetic and varargs bits.
+   * @return the constructor's modifiers
+   */
+  private native int getModifiersInternal();
+
+  /**
* Gets the modifiers this constructor uses.  Use the codeModifier/code
* class to interpret the values. A constructor can only have a subset of the
* following modifiers: public, private, protected.
@@ -121,7 +132,31 @@
* @return an integer representing the modifiers to this Member
* @see Modifier
*/
-  public native int getModifiers();
+  public int getModifiers()
+  {
+return getModifiersInternal()  CONSTRUCTOR_MODIFIERS;
+  }
+
+  /**
+   * Return true if this constructor is synthetic, 

[cp-patches] FYI: InternalFrame fix

2006-03-15 Thread Roman Kennke
This fixes the handling of changing properties in JInternalFrame so that
the actions are correctly updated when any of the properties change.

2006-03-15  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(PropertyChangeHandler.propertyChange): Call enableActions().
Fixed 'iconable' property name.

/Roman
Index: javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,v
retrieving revision 1.20
diff -u -r1.20 BasicInternalFrameTitlePane.java
--- javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	13 Mar 2006 22:06:47 -	1.20
+++ javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	15 Mar 2006 18:20:08 -
@@ -301,27 +301,27 @@
 {
   String propName = evt.getPropertyName();
   if (propName.equals(closable))
-	{
-	  if (evt.getNewValue().equals(Boolean.TRUE))
-	closeButton.setVisible(true);
-	  else
-	closeButton.setVisible(false);
-	}
-  else if (propName.equals(iconifiable))
-	{
-	  if (evt.getNewValue().equals(Boolean.TRUE))
-	iconButton.setVisible(true);
-	  else
-	iconButton.setVisible(false);
-	}
+{
+  if (evt.getNewValue().equals(Boolean.TRUE))
+closeButton.setVisible(true);
+  else
+closeButton.setVisible(false);
+}
+  else if (propName.equals(iconable))
+{
+  if (evt.getNewValue().equals(Boolean.TRUE))
+iconButton.setVisible(true);
+  else
+iconButton.setVisible(false);
+}
   else if (propName.equals(maximizable))
-	{
-	  if (evt.getNewValue().equals(Boolean.TRUE))
-	maxButton.setVisible(true);
-	  else
-	maxButton.setVisible(false);
-	}
-	
+{
+  if (evt.getNewValue().equals(Boolean.TRUE))
+maxButton.setVisible(true);
+  else
+maxButton.setVisible(false);
+}
+  enableActions();
 }
   }
 


Re: [cp-patches] Patch: Container fix

2006-03-15 Thread Thomas Fitzsimmons
On Wed, 2006-03-15 at 11:10 -0500, Lillian Angel wrote:
 locate(...) should not ignore invisible components. I have committed a
 mauve test for this. I added a lot more documentation to all the methods
 listed.

The new documentation seems to be cut-n-pasted from Sun's javadocs.
Please revert those sections and re-write them in your own words,
preferably expanding on and clarifying Sun's explanations.  In this case
you could explicitly mention that getComponentAt does not consider a
component's current visibility.

Tom





Re: [cp-patches] Patch: RFC: changing parts of VM reflection API

2006-03-15 Thread Archie Cobbs

[EMAIL PROTECTED] Tromey wrote:

I'm posting this for comment.

This is the patch to change Method/Field/Constructor to have a
'getModifiersInternal' method, which returns the un-masked modifiers
as read from the .class file.  This lets us implement the new
1.5 reflection predicates such as isSynthetic.


Looks good to me... accompianied by a NEWS entry of course.

Thanks,
-Archie

__
Archie Cobbs  *CTO, Awarix*  http://www.awarix.com



[cp-patches] Patch: Container doc fix

2006-03-15 Thread Lillian Angel
Fixed the documentation for a few Container methods.

2006-03-13  Lillian Angel  [EMAIL PROTECTED]

* java/awt/Container.java
(getComponentAt): Fixed documentation.
(getComponentAt): Likewise.
(findComponentAt): Likewise.
(findComponentAt): Likewise.

Index: java/awt/Container.java
===
RCS file: /sources/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.86
diff -u -r1.86 Container.java
--- java/awt/Container.java	15 Mar 2006 16:08:03 -	1.86
+++ java/awt/Container.java	15 Mar 2006 16:21:50 -
@@ -968,8 +968,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
*
* @param x The X coordinate of the point.
* @param y The Y coordinate of the point.
@@ -993,8 +993,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
* 
* @param x The x position of the point to return the component at.
* @param y The y position of the point to return the component at.
@@ -1011,13 +1011,27 @@
 if (!contains (x, y))
   return null;
 
+// First find the component closest to (x,y) that is a heavyweight.
 for (int i = 0; i  ncomponents; ++i)
   {
-int x2 = x - component[i].x;
-int y2 = y - component[i].y;
-if (component[i].contains (x2, y2))
-  return component[i];
+Component comp = component[i];
+int x2 = x - comp.x;
+int y2 = y - comp.y;
+if (comp.contains (x2, y2)  !comp.isLightweight())
+  return comp;
+  }
+
+// if a heavyweight component is not found, look for a lightweight
+// closest to (x,y).
+for (int i = 0; i  ncomponents; ++i)
+  {
+Component comp = component[i];
+int x2 = x - comp.x;
+int y2 = y - comp.y;
+if (comp.contains (x2, y2)  comp.isLightweight())
+  return comp;
   }
+
 return this;
   }
   }
@@ -1033,8 +1047,8 @@
* The top-most child component is returned in the case where there is overlap
* in the components. This is determined by finding the component closest to 
* the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are lightweight take precedence over 
-   * those which are not.
+   * except that Components which are not lightweight take precedence over 
+   * those which are.
* 
* @param p The point to return the component at.
* @return The component containing the specified point, or codenull/code


[cp-patches] FYI: Fast InternalFrame dragging

2006-03-15 Thread Roman Kennke
I implemented a facility for really fast dragging of components to
Swing. The idea is that when a component (like a JInternalFrame) is
dragged, then it doesn't need to repaint everything but only copy around
the component's rectangle. For this to accomplish we need a temporary
buffer where the component is drawn into at the beginning of the
dragging operation and this buffer is then copied around while dragging.

This is implemented in JComponent.paint() and turned on and off via a
client propery.

I added support for this to the JInternalFrame.

2006-03-15  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JComponent.java
(dragBuffer): New field.
(dragBufferInitialized): New field.
(paint): Added facility for buffered dragging of components.
(initializeDragBuffer): New method.
(getConditionForKeyStroke): Removed deprecated flag. Adjusted
API docs.
* javax/swing/plaf/basic/BasicInternalFrameUI.java
(BorderListener.mouseDragged): Turn on buffered dragging.
(BorderListener.mouseReleased): Turn off buffered dragging.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/JComponent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.105
diff -u -r1.105 JComponent.java
--- javax/swing/JComponent.java	27 Feb 2006 12:52:05 -	1.105
+++ javax/swing/JComponent.java	15 Mar 2006 18:58:14 -
@@ -550,6 +550,16 @@
   private boolean paintingTile;
 
   /**
+   * A temporary buffer used for fast dragging of components.
+   */
+  private Image dragBuffer;
+
+  /**
+   * Indicates if the dragBuffer is already initialized.
+   */
+  private boolean dragBufferInitialized;
+
+  /**
* A cached Rectangle object to be reused. Be careful when you use that,
* so that it doesn't get modified in another context within the same
* method call chain.
@@ -1556,20 +1566,57 @@
   }
 else
   {
+if (getClientProperty(bufferedDragging) != null
+ dragBuffer == null)
+  {
+initializeDragBuffer();
+  }
+else if (getClientProperty(bufferedDragging) == null
+ dragBuffer != null)
+  {
+dragBuffer = null;
+  }
+
 if (g.getClip() == null)
   g.setClip(0, 0, getWidth(), getHeight());
-Graphics g2 = getComponentGraphics(g);
-paintComponent(g2);
-paintBorder(g2);
-paintChildren(g2);
-Rectangle clip = g2.getClipBounds();
-if (clip.x == 0  clip.y == 0  clip.width == getWidth()
- clip.height == getHeight())
-  RepaintManager.currentManager(this).markCompletelyClean(this);
+if (dragBuffer != null  dragBufferInitialized)
+  {
+g.drawImage(dragBuffer, 0, 0, this);
+  }
+else
+  {
+Graphics g2 = getComponentGraphics(g);
+paintComponent(g2);
+paintBorder(g2);
+paintChildren(g2);
+Rectangle clip = g2.getClipBounds();
+if (clip.x == 0  clip.y == 0  clip.width == getWidth()
+ clip.height == getHeight())
+  RepaintManager.currentManager(this).markCompletelyClean(this);
+  }
   }
   }
 
   /**
+   * Initializes the drag buffer by creating a new image and painting this
+   * component into it.
+   */
+  private void initializeDragBuffer()
+  {
+dragBufferInitialized = false;
+// Allocate new dragBuffer if the current one is too small.
+if (dragBuffer == null || dragBuffer.getWidth(this)  getWidth()
+|| dragBuffer.getHeight(this)  getHeight())
+  {
+dragBuffer = createImage(getWidth(), getHeight());
+  }
+Graphics g = dragBuffer.getGraphics();
+paint(g);
+g.dispose();
+dragBufferInitialized = true;
+  }
+
+  /**
* Paint the component's border. This usually means calling [EMAIL PROTECTED]
* Border#paintBorder} on the [EMAIL PROTECTED] #border} property, if it is
* non-codenull/code. You may override this if you wish to customize
@@ -1993,15 +2040,15 @@
* Return the condition that determines whether a registered action
* occurs in response to the specified keystroke.
*
+   * As of 1.3 KeyStrokes can be registered with multiple simultaneous
+   * conditions.
+   *
* @param ks The keystroke to return the condition of
*
* @return One of the values [EMAIL PROTECTED] #UNDEFINED_CONDITION}, [EMAIL PROTECTED]
* #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, [EMAIL PROTECTED] #WHEN_FOCUSED}, or [EMAIL PROTECTED]
* #WHEN_IN_FOCUSED_WINDOW}
*
-   * @deprecated As of 1.3 KeyStrokes can be registered with multiple
-   * simultaneous conditions.
-   *
* @see #registerKeyboardAction(ActionListener, KeyStroke, int)   
* @see 

Re: [cp-patches] Patch: Container doc fix

2006-03-15 Thread Lillian Angel
I promise to work on this annoying habit of attaching the wrong
patches. :)

On Wed, 2006-03-15 at 13:40 -0500, Lillian Angel wrote:
 Fixed the documentation for a few Container methods.
 
 2006-03-13  Lillian Angel  [EMAIL PROTECTED]
 
 * java/awt/Container.java
 (getComponentAt): Fixed documentation.
 (getComponentAt): Likewise.
 (findComponentAt): Likewise.
 (findComponentAt): Likewise.
 
Index: java/awt/Container.java
===
RCS file: /sources/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- java/awt/Container.java	15 Mar 2006 16:23:59 -	1.87
+++ java/awt/Container.java	15 Mar 2006 18:40:10 -	1.88
@@ -965,11 +965,12 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
* 
-   * The top-most child component is returned in the case where there is overlap
-   * in the components. This is determined by finding the component closest to 
-   * the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are not lightweight take precedence over 
-   * those which are.
+   * The top-most child component is returned in the case where components overlap.
+   * This is determined by finding the component closest to (x,y) and contains 
+   * that location. Heavyweight components take precedence of lightweight components.
+   * 
+   * This function does not ignore invisible components. If there is an invisible
+   * component at (x,y), it will be returned.
*
* @param x The X coordinate of the point.
* @param y The Y coordinate of the point.
@@ -990,11 +991,12 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
* 
-   * The top-most child component is returned in the case where there is overlap
-   * in the components. This is determined by finding the component closest to 
-   * the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are not lightweight take precedence over 
-   * those which are.
+   * The top-most child component is returned in the case where components overlap.
+   * This is determined by finding the component closest to (x,y) and contains 
+   * that location. Heavyweight components take precedence of lightweight components.
+   * 
+   * This function does not ignore invisible components. If there is an invisible
+   * component at (x,y), it will be returned.
* 
* @param x The x position of the point to return the component at.
* @param y The y position of the point to return the component at.
@@ -1044,11 +1046,12 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
*
-   * The top-most child component is returned in the case where there is overlap
-   * in the components. This is determined by finding the component closest to 
-   * the index 0 that claims to contain the given point via Component.contains(), 
-   * except that Components which are not lightweight take precedence over 
-   * those which are.
+   * The top-most child component is returned in the case where components overlap.
+   * This is determined by finding the component closest to (x,y) and contains 
+   * that location. Heavyweight components take precedence of lightweight components.
+   * 
+   * This function does not ignore invisible components. If there is an invisible
+   * component at (x,y), it will be returned.
* 
* @param p The point to return the component at.
* @return The component containing the specified point, or codenull/code
@@ -1066,9 +1069,8 @@
* this method will continue searching for the deepest nested child 
* component. Components which are not visible are ignored during the search.
* 
-   * The findComponentAt method is different from getComponentAt in that getComponentAt
-   * only searches the Container's immediate children; if the containing component is 
-   * a Container, findComponentAt will search that child to find a nested component.
+   * findComponentAt differs from getComponentAt, because it recursively 
+   * searches a Container's children.
* 
* @param x - x coordinate
* @param y - y coordinate
@@ -1115,9 +1117,8 @@
* this method will continue searching for the deepest nested child 
* component. Components which are not visible are ignored during the search.
* 
-   * The findComponentAt method is different from getComponentAt in that getComponentAt
-   * only searches the Container's immediate children; if the containing component is 
-   * a Container, findComponentAt will search that child to find a nested component.
+   * findComponentAt differs from getComponentAt, because it recursively 
+   * searches a Container's children.
* 
* 

Re: [cp-patches] FYI: Container doc fix

2006-03-15 Thread Lillian Angel
again ...

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

* java/awt/Container.java
(getComponentAt): Fixed documentation.
(getComponentAt): Likewise.


On Wed, 2006-03-15 at 14:13 -0500, Lillian Angel wrote:
 I promise to work on this annoying habit of attaching the wrong
 patches. :)
 
 On Wed, 2006-03-15 at 13:40 -0500, Lillian Angel wrote:
  Fixed the documentation for a few Container methods.
  
  2006-03-13  Lillian Angel  [EMAIL PROTECTED]
  
  * java/awt/Container.java
  (getComponentAt): Fixed documentation.
  (getComponentAt): Likewise.
  (findComponentAt): Likewise.
  (findComponentAt): Likewise.
  
Index: java/awt/Container.java
===
RCS file: /sources/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.89
retrieving revision 1.88
diff -u -r1.89 -r1.88
--- java/awt/Container.java	15 Mar 2006 19:34:29 -	1.89
+++ java/awt/Container.java	15 Mar 2006 18:40:10 -	1.88
@@ -965,9 +965,9 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
* 
-   * When components overlap, the first component is returned. The component
-   * that is closest to (x, y), containing that location, is returned. 
-   * Heavyweight components take precedence of lightweight components.
+   * The top-most child component is returned in the case where components overlap.
+   * This is determined by finding the component closest to (x,y) and contains 
+   * that location. Heavyweight components take precedence of lightweight components.
* 
* This function does not ignore invisible components. If there is an invisible
* component at (x,y), it will be returned.
@@ -991,9 +991,9 @@
* unless the point does not exist within this container, in which
* case codenull/code is returned.
* 
-   * When components overlap, the first component is returned. The component
-   * that is closest to (x, y), containing that location, is returned. 
-   * Heavyweight components take precedence of lightweight components.
+   * The top-most child component is returned in the case where components overlap.
+   * This is determined by finding the component closest to (x,y) and contains 
+   * that location. Heavyweight components take precedence of lightweight components.
* 
* This function does not ignore invisible components. If there is an invisible
* component at (x,y), it will be returned.


[cp-patches] Patch: GdkGraphics2D fix

2006-03-15 Thread Lillian Angel
This fixes the segmentation fault that Norman has been encountering with
several of his programs. Fixes bug #24211

2006-03-15  Lillian Angel  [EMAIL PROTECTED]

PR classpath/24211
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked):
Added check to avoid segmentation fault.

Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
===
RCS file: /sources/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,v
retrieving revision 1.37
diff -u -r1.37 gnu_java_awt_peer_gtk_GdkGraphics2D.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	20 Feb 2006 22:44:04 -	1.37
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c	15 Mar 2006 20:13:53 -
@@ -1992,6 +1992,10 @@
 
   gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
   g_assert (gr != NULL);
+  
+  if (gr-pattern == NULL)
+return;
+  
   if (gr-debug) printf (cairo_pattern_set_filter %d\n, filter);
   switch ((enum java_awt_rendering_hints_filter) filter)
 {


[cp-patches] Patch: FYI: fix eclipse tab settings

2006-03-15 Thread Tom Tromey
I'm checking this in on the trunk.

This changes our eclipse settings so that a tab is counted as 8 spaces
in a java source file.  This makes Classpath source files display
correctly.

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* .settings/org.eclipse.jdt.core.prefs: Set tabs to 8 spaces.

Index: .settings/org.eclipse.jdt.core.prefs
===
RCS file: /cvsroot/classpath/classpath/.settings/org.eclipse.jdt.core.prefs,v
retrieving revision 1.6
diff -u -r1.6 org.eclipse.jdt.core.prefs
--- .settings/org.eclipse.jdt.core.prefs6 Feb 2006 19:09:01 -   
1.6
+++ .settings/org.eclipse.jdt.core.prefs15 Mar 2006 21:29:45 -
@@ -1,4 +1,4 @@
-#Tue Feb 07 05:21:36 EST 2006
+#Wed Mar 15 14:23:07 MST 2006
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
@@ -126,7 +126,7 @@
 org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.indentation.size=8
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
 
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do
 not insert
 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert



[cp-patches] Patch: FYI: StrictMath.signum

2006-03-15 Thread Tom Tromey
I'm checking this in.

This adds the two StrictMath.signum methods.
They can simply delegate to Math.signum, as the code would be
identical.

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* java/lang/StrictMath.java (signum): New methods.

Index: java/lang/StrictMath.java
===
RCS file: /cvsroot/classpath/classpath/java/lang/StrictMath.java,v
retrieving revision 1.7
diff -u -r1.7 StrictMath.java
--- java/lang/StrictMath.java   7 Mar 2006 01:02:01 -   1.7
+++ java/lang/StrictMath.java   15 Mar 2006 21:56:38 -
@@ -1843,6 +1843,50 @@
   }
 
   /**
+   * p
+   * Returns the sign of the argument as follows:
+   * /p
+   * ul
+   * liIf codea/code is greater than zero, the result is 1.0./li
+   * liIf codea/code is less than zero, the result is -1.0./li
+   * liIf codea/code is codeNaN/code, the result is codeNaN/code.
+   * liIf codea/code is positive or negative zero, the result is the
+   * same./li
+   * /ul
+   * 
+   * @param a the numeric argument.
+   * @return the sign of the argument.
+   * @since 1.5.
+   */
+  public static double signum(double a)
+  {
+// There's no difference.
+return Math.signum(a);
+  }
+
+  /**
+   * p
+   * Returns the sign of the argument as follows:
+   * /p
+   * ul
+   * liIf codea/code is greater than zero, the result is 1.0f./li
+   * liIf codea/code is less than zero, the result is -1.0f./li
+   * liIf codea/code is codeNaN/code, the result is codeNaN/code.
+   * liIf codea/code is positive or negative zero, the result is the
+   * same./li
+   * /ul
+   * 
+   * @param a the numeric argument.
+   * @return the sign of the argument.
+   * @since 1.5.
+   */
+  public static float signum(float a)
+  {
+// There's no difference.
+return Math.signum(a);
+  }
+
+  /**
* Return the ulp for the given double argument.  The ulp is the
* difference between the argument and the next larger double.  Note
* that the sign of the double argument is ignored, that is,



[cp-patches] [PATCH/JDWP] BreakpointEvent NativeMethodException

2006-03-15 Thread Keith Seitz

Hi,

I've committed the following two files which simply add two classes 
needed for breakpoints.


Keith

ChangeLog
2006-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/event/BreakpointEvent.java: New file.

* gnu/classpath/jdwp/exception/NativeMethodException.java: New 
file.
Index: gnu/classpath/jdwp/event/BreakpointEvent.java
===
RCS file: gnu/classpath/jdwp/event/BreakpointEvent.java
diff -N gnu/classpath/jdwp/event/BreakpointEvent.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/event/BreakpointEvent.java	1 Jan 1970 00:00:00 -
@@ -0,0 +1,110 @@
+/* BreakpointEvent.java -- An event specifying that the interpreter
+   has hit a breakpoint
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.id.ThreadId;
+import gnu.classpath.jdwp.util.Location;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Notification of a breakpoint in the target VM. The breakpoint event is
+ * generated before the code at its location is executed.
+ *
+ * @author Keith Seitz  ([EMAIL PROTECTED])
+ */
+public class BreakpointEvent
+  extends Event
+{
+  // The thread in which this event occurred
+  private Thread _thread;
+
+  // Location where breakpoint occurred
+  private Location _location;
+
+  /**
+   * Constructs a new BreakpointEvent
+   *
+   * @param thread  thread in which event occurred
+   * @param loc location where breakpoint occurred
+   */
+  public BreakpointEvent(Thread thread, Location loc)
+  {
+super(JdwpConstants.EventKind.BREAKPOINT);
+_thread = thread;
+_location = loc;
+  }
+
+  /**
+   * Returns a specific filtering parameter for this event.
+   * Valid types are thread and location.
+   *
+   * @param type  the type of parameter desired
+   * @returns the desired parameter or null
+   */
+  public Object getParameter(Class type)
+  {
+if (type == ThreadId.class)
+  return _thread;
+else if (type == Location.class)
+  return _location;
+
+return null;
+  }
+
+  /**
+   * Writes the event to the given stream
+   *
+   * @param outStream  the output stream to write the event to
+   */
+  protected void _writeData (DataOutputStream outStream)
+throws IOException
+  {
+VMIdManager idm = VMIdManager.getDefault();
+ThreadId tid = (ThreadId) idm.getObjectId(_thread);
+
+tid.write(outStream);
+_location.write(outStream);
+  }
+}
Index: gnu/classpath/jdwp/exception/NativeMethodException.java
===
RCS file: gnu/classpath/jdwp/exception/NativeMethodException.java
diff -N gnu/classpath/jdwp/exception/NativeMethodException.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ gnu/classpath/jdwp/exception/NativeMethodException.java	1 Jan 1970 00:00:00 -
@@ -0,0 +1,63 @@
+/* NativeMethodException.java -- a native method exception
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under 

[cp-patches] [PATCH/JDWP] Update LocationOnlyFilter

2006-03-15 Thread Keith Seitz

Hello,

Initially, I committed a LoctionOnlyFilter that wasn't really 
implemented. Now after having actually used something that needs a 
LocationOnlyFilter, I understand better how this filter is going to 
work -- it will always match; it's just a bookkeeping artifact.


I've updated the javadoc for this class and implemented the matches 
method.


Keith

ChangeLog
* gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java:
Update javadoc.
(matches): Implement.
Index: LocationOnlyFilter.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java,v
retrieving revision 1.1
diff -u -r1.1 LocationOnlyFilter.java
--- LocationOnlyFilter.java	26 Aug 2005 21:52:28 -	1.1
+++ LocationOnlyFilter.java	15 Mar 2006 23:18:40 -
@@ -1,5 +1,5 @@
 /* LocationOnlyFilter.java -- filter on location
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -49,6 +49,13 @@
  * May be used with breakpoint, field access, field modification, step,
  * and exception event kinds.
  *
+ * This filter is not really a filter. It is simply a way to communicate
+ * location information for supported events in a generic way to ease 
+ * the burden of special casing several things in
+ * EventReqeustCommandSet.executeSet.
+ * 
+ * Consequently, this filter always matches any event.
+ * 
  * @author Keith Seitz  ([EMAIL PROTECTED])
  */
 public class LocationOnlyFilter
@@ -85,7 +92,7 @@
*/
   public boolean matches (Event event)
   {
-// FIXME
-throw new RuntimeException (LocationOnlyFilter.matches not implemented);
+// This filter always matches. See comments in class javadoc.
+return true;
   }
 }


[cp-patches] Patch: FYI: reverse japi -vs- AWT

2006-03-15 Thread Tom Tromey
I'm checking this in.

Inspired by Wolfgang's note, I looked through the reverse japi
results a bit.

This patch fixes most of the problems in java.awt.  The only ones this
does not fix are the extra getAccessibleState methods -- I believe
these should be named getAccessibleStateSet, but I am not 100% sure.
Any opinions?

For the java.awt.dnd changes, I looked and I made these classes
public.  I assume this was either a mistake on my part or a bug in
some earlier japi.

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* java/awt/image/RescaleOp.java (getRenderingHints): Now final.
* java/awt/image/LookupOp.java (filter): Now final.
(getBounds2D): Likewise.
(getPoint2D): Likewise.
(getTable): Likewise.
(getRenderingHints): Likewise.
* java/awt/image/ConvolveOp.java (filter): Now final.
(getBounds2D): Likewise.
(getKernel): Likewise.
(getPoint2D): Likewise.
(getRenderingHints): Likewise.
* java/awt/image/BandCombineOp.java (getPoint2D): Now final.
(getMatrix): Likewise.
(getBounds2D): Likewise.
(getRenderingHints): Likewise.
* java/awt/image/AffineTransformOp.java (getPoint2D): Now final.
* java/awt/Button.java (AccessibleAWTButton.serialVersionUID): Now
private.
* java/awt/dnd/DropTargetContext.java (TransferableProxy): Now
protected.
* java/awt/dnd/DropTarget.java (DropTargetAutoScroller): Now
protected.
* java/awt/MenuItem.java (AccessibleAWTMenuItem): Now protected.

Index: java/awt/Button.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/Button.java,v
retrieving revision 1.24
diff -u -r1.24 Button.java
--- java/awt/Button.java20 Sep 2005 01:05:28 -  1.24
+++ java/awt/Button.java16 Mar 2006 00:46:30 -
@@ -98,7 +98,7 @@
   protected class AccessibleAWTButton extends AccessibleAWTComponent
 implements AccessibleAction, AccessibleValue
   {
-public static final long serialVersionUID = -5932203980244017102L;
+private static final long serialVersionUID = -5932203980244017102L;
 
 protected AccessibleAWTButton()
 {
Index: java/awt/MenuItem.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/MenuItem.java,v
retrieving revision 1.26
diff -u -r1.26 MenuItem.java
--- java/awt/MenuItem.java  20 Sep 2005 01:05:28 -  1.26
+++ java/awt/MenuItem.java  16 Mar 2006 00:46:30 -
@@ -111,7 +111,7 @@
 private static final long serialVersionUID = -217847831945965825L;
 
 /** Constructor */
-public AccessibleAWTMenuItem()
+protected AccessibleAWTMenuItem()
 {
   super();
 }
Index: java/awt/dnd/DropTarget.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DropTarget.java,v
retrieving revision 1.11
diff -u -r1.11 DropTarget.java
--- java/awt/dnd/DropTarget.java2 Jul 2005 20:32:26 -   1.11
+++ java/awt/dnd/DropTarget.java16 Mar 2006 00:46:30 -
@@ -61,9 +61,7 @@
*/
   private static final long serialVersionUID = -6283860791671019047L;
 
-  /** @specnote According to the online documentation, this is
-   * protected, but in reality it is public.  */
-  public static class DropTargetAutoScroller
+  protected static class DropTargetAutoScroller
 implements ActionListener
   {
 private Component component;
Index: java/awt/dnd/DropTargetContext.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DropTargetContext.java,v
retrieving revision 1.9
diff -u -r1.9 DropTargetContext.java
--- java/awt/dnd/DropTargetContext.java 2 Jul 2005 20:32:26 -   1.9
+++ java/awt/dnd/DropTargetContext.java 16 Mar 2006 00:46:30 -
@@ -54,9 +54,7 @@
 {
   static final long serialVersionUID = -634158968993743371L;
 
-  /** @specnote According to the online documentation, this is
-   * protected, but in reality it is public.  */
-  public class TransferableProxy implements Transferable
+  protected class TransferableProxy implements Transferable
   {
 protected boolean isLocal;
 protected Transferable transferable;
Index: java/awt/image/AffineTransformOp.java
===
RCS file: /cvsroot/classpath/classpath/java/awt/image/AffineTransformOp.java,v
retrieving revision 1.7
diff -u -r1.7 AffineTransformOp.java
--- java/awt/image/AffineTransformOp.java   2 Jul 2005 20:32:29 -   
1.7
+++ java/awt/image/AffineTransformOp.java   16 Mar 2006 00:46:30 -
@@ -347,7 +347,7 @@
  * @param dstPt destination point
  * @return the location of the transformed source point.
  */
-public Point2D getPoint2D (Point2D srcPt, Point2D dstPt)
+public final Point2D getPoint2D 

[cp-patches] Patch: FYI: more reverse japi fixes

2006-03-15 Thread Tom Tromey
I'm checking this in.

This is more simple fixes pointed out by the reverse japi page.

I'm trying to flush out the simple ones so that we can more easily
focus on the real bugs.  (There are a few of these lurking around.)

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* javax/imageio/stream/ImageOutputStreamImpl.java (flushBits): Now
final.
* javax/imageio/stream/ImageOutputStream.java (flushBefore): Javadoc
fix.
* java/util/zip/ZipFile.java (ENDNRD): New constant.
* java/util/zip/ZipConstants.java (ENDNRD, ENDDCD): Removed.
* java/util/zip/Inflater.java (end): Not deprecated.
* java/util/zip/Deflater.java (end): Not deprecated.
* java/text/Bidi.java (Bidi): Now final.
* java/nio/MappedByteBuffer.java (finalize): Now protected.

Index: java/nio/MappedByteBuffer.java
===
RCS file: /cvsroot/classpath/classpath/java/nio/MappedByteBuffer.java,v
retrieving revision 1.13
diff -u -r1.13 MappedByteBuffer.java
--- java/nio/MappedByteBuffer.java  2 Jul 2005 20:32:39 -   1.13
+++ java/nio/MappedByteBuffer.java  16 Mar 2006 01:05:28 -
@@ -85,7 +85,7 @@
 forceImpl();
   }
 
-  public void finalize()
+  protected void finalize()
 throws Throwable
   {
 unmapImpl();
Index: java/text/Bidi.java
===
RCS file: /cvsroot/classpath/classpath/java/text/Bidi.java,v
retrieving revision 1.2
diff -u -r1.2 Bidi.java
--- java/text/Bidi.java 31 Dec 2005 10:45:47 -  1.2
+++ java/text/Bidi.java 16 Mar 2006 01:05:29 -
@@ -47,7 +47,7 @@
  * Annex #9: The Bidirectional Algorithm/a. A full implementation is
  * a href=http://fribidi.org/;GNU FriBidi/a.
  */
-public class Bidi
+public final class Bidi
 {
   /**
* Returns false if all characters in the text between start and end
Index: java/util/zip/Deflater.java
===
RCS file: /cvsroot/classpath/classpath/java/util/zip/Deflater.java,v
retrieving revision 1.6
diff -u -r1.6 Deflater.java
--- java/util/zip/Deflater.java 2 Jul 2005 20:32:44 -   1.6
+++ java/util/zip/Deflater.java 16 Mar 2006 01:05:29 -
@@ -221,7 +221,6 @@
* where the compressor allocates native memory.
* If you call any method (even reset) afterwards the behaviour is
* iundefined/i.  
-   * @deprecated Just clear all references to deflater instead.
*/
   public void end()
   {
Index: java/util/zip/Inflater.java
===
RCS file: /cvsroot/classpath/classpath/java/util/zip/Inflater.java,v
retrieving revision 1.8
diff -u -r1.8 Inflater.java
--- java/util/zip/Inflater.java 13 Jul 2005 08:48:28 -  1.8
+++ java/util/zip/Inflater.java 16 Mar 2006 01:05:29 -
@@ -199,7 +199,6 @@
* with Sun's JDK, where the compressor allocates native memory.
* If you call any method (even reset) afterwards the behaviour is
* iundefined/i.  
-   * @deprecated Just clear all references to inflater instead.
*/
   public void end ()
   {
Index: java/util/zip/ZipConstants.java
===
RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipConstants.java,v
retrieving revision 1.7
diff -u -r1.7 ZipConstants.java
--- java/util/zip/ZipConstants.java 21 Feb 2006 09:21:53 -  1.7
+++ java/util/zip/ZipConstants.java 16 Mar 2006 01:05:29 -
@@ -85,9 +85,6 @@
   long ENDSIG = 'P'|('K'8)|(516)|(624);
   int ENDHDR = 22;
 
-  /* The following two fields are missing in SUN JDK */
-  int ENDNRD =  4;
-  int ENDDCD =  6;
   int ENDSUB =  8;
   int ENDTOT = 10;
   int ENDSIZ = 12;
Index: java/util/zip/ZipFile.java
===
RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipFile.java,v
retrieving revision 1.28
diff -u -r1.28 ZipFile.java
--- java/util/zip/ZipFile.java  15 Feb 2006 09:25:40 -  1.28
+++ java/util/zip/ZipFile.java  16 Mar 2006 01:05:29 -
@@ -75,6 +75,11 @@
*/
   public static final int OPEN_DELETE = 0x4;
 
+  /**
+   * This field isn't defined in the JDK's ZipConstants, but should be.
+   */
+  static final int ENDNRD =  4;
+
   // Name of this zip file.
   private final String name;
 
Index: javax/imageio/stream/ImageOutputStream.java
===
RCS file: 
/cvsroot/classpath/classpath/javax/imageio/stream/ImageOutputStream.java,v
retrieving revision 1.4
diff -u -r1.4 ImageOutputStream.java
--- javax/imageio/stream/ImageOutputStream.java 2 Jul 2005 20:32:45 -   
1.4
+++ javax/imageio/stream/ImageOutputStream.java 16 Mar 2006 01:05:29 -
@@ -54,7 +54,7 @@
   extends ImageInputStream, DataOutput
 {
   /**
-   * @param postion
+   * @param position
*
* @throws IOException if an errror occurs
*/

[cp-patches] [PATCH/JDWP] Rewrite Location to use VMMethod

2006-03-15 Thread Keith Seitz

Hi,

This patch rewrites the majority of gnu.classpath.jdwp.util.Location to 
use VMMethod instead of a tag, classID, methodID, and index.


Keith

ChangeLog
2005-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/util/Location.java: Rewrite using VMMethod.
(Location): Index is a long, not an int.
(getMethod): New method.
(getIndex): New method.
(toString): New method.
Index: gnu/classpath/jdwp/util/Location.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/Location.java,v
retrieving revision 1.2
diff -u -r1.2 Location.java
--- gnu/classpath/jdwp/util/Location.java	25 Aug 2005 22:27:25 -	1.2
+++ gnu/classpath/jdwp/util/Location.java	16 Mar 2006 00:46:19 -
@@ -1,5 +1,5 @@
 /* Location.java -- class to read/write JDWP locations
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -39,13 +39,12 @@
 package gnu.classpath.jdwp.util;
 
 import gnu.classpath.jdwp.VMIdManager;
+import gnu.classpath.jdwp.VMMethod;
 import gnu.classpath.jdwp.exception.JdwpException;
 import gnu.classpath.jdwp.id.ClassReferenceTypeId;
-import gnu.classpath.jdwp.id.ObjectId;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 
 /**
@@ -55,62 +54,81 @@
  */
 public class Location
 {
-
-  private ClassReferenceTypeId crti;
-
-  private int index;
-
-  private byte tag;
-
-  private ObjectId mid;
+  private VMMethod method;
+  private long index;
 
   /**
* Create a location with the given parameters.
* 
-   * @param tag the type of construct the location is in
-   * @param clazz the class the location is in
-   * @param meth the Method
+   * @param method the method
* @param index location in the method
-   * @throws JdwpException
*/
-  public Location(byte tag, Class clazz, Method meth, int index)
-  throws JdwpException
+  public Location(VMMethod method, long index)
   {
-this.tag = tag;
-this.crti = 
-  (ClassReferenceTypeId) VMIdManager.getDefault().getReferenceTypeId(clazz);
-this.mid = VMIdManager.getDefault().getObjectId(meth);
+this.method = method;
 this.index = index;
   }
 
   /**
* Read a location from the given bytebuffer, consists of a TAG (byte),
-   * followed by a ReferenceTypeId, a MethodId and an index (int).
+   * followed by a ReferenceTypeId, a MethodId and an index (long).
* 
* @param bb this holds the location
-   * @throws IOException
-   * @throws JdwpException
+   * @throws IOExceptionwhen an error occurs reading from the buffer
+   * @throws JdwpException  for invalid class or method IDs
*/
-  public Location(ByteBuffer bb) throws IOException, JdwpException
+  public Location(ByteBuffer bb)
+throws IOException, JdwpException
   {
-this.tag = bb.get();
-this.crti = 
+byte tag = bb.get();
+ClassReferenceTypeId classId = 
   (ClassReferenceTypeId) VMIdManager.getDefault().readReferenceTypeId(bb);
-this.mid = VMIdManager.getDefault().readObjectId(bb);
-this.index = bb.getInt();
+Class klass = classId.getType();
+method = VMMethod.readId(klass, bb);
+index = bb.getLong();
   }
 
   /**
* Write the given location to an output stream.
* 
* @param os stream to write to
-   * @throws IOException
+   * @throws IOException when an error occurs writing to the stream
+   */
+  public void write(DataOutputStream os)
+throws IOException
+  {
+VMIdManager idm = VMIdManager.getDefault();
+ClassReferenceTypeId crti = (ClassReferenceTypeId)
+  idm.getReferenceTypeId(method.getDeclaringClass());
+
+crti.writeTagged(os);
+method.writeId(os);
+os.writeLong(index);
+  }
+
+  /**
+   * Gets the method of this location
+   * 
+   * @return the method
*/
-  public void write(DataOutputStream os) throws IOException
+  public VMMethod getMethod()
+  {
+return method;
+  }
+
+  /**
+   * Gets the code index of this location
+   * 
+   * @return the code index
+   */
+  public long getIndex ()
+  {
+return index;
+  }
+
+  // convenient for debugging
+  public String toString ()
   {
-os.writeByte(tag);
-crti.write(os);
-mid.write(os);
-os.writeInt(index);
+return method.toString () + . + index;
   }
 }


[cp-patches] [PATCH/JDWP] LineTable cleanup

2006-03-15 Thread Keith Seitz

Hi,

Another little random thing to get out of my sandbox. I just didn't like 
the redundant information that it required.


Keith

ChangeLog
2006-03-15  Keith Seitz  [EMAIL PROTECTED]

* gnu/classpath/jdwp/util/LineTable.java (lines): Remove all occurances
of this redundant variable.
(LineTable): Assert that the number of line numbers and the number of
code indicies is the same.
Index: LineTable.java
===
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/util/LineTable.java,v
retrieving revision 1.2
diff -u -r1.2 LineTable.java
--- LineTable.java	24 Aug 2005 22:57:07 -	1.2
+++ LineTable.java	16 Mar 2006 01:17:54 -
@@ -1,5 +1,5 @@
 /* LineTable.java -- A class representing a Line Table for a method
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -54,25 +54,24 @@
   private final long end;
   private final int[] lineNum;
   private final long[] lineCI;
-  private final int lines;
 
   /**
* Construct a line table with the given parameters.
* 
* @param start lowest code index for method, -1 if native
* @param end highest code index for method, -1 if native
-   * @param lines number of entries in line table
-   * @param lineCI code indexes for entries in line tables (of length lines)
-   * @param lineNum line numbers for in line tables (of length lines)
+   * @param lineNum line numbers for in line tables
+   * @param lineCI code indicies for entries in line tables
*/
-  public LineTable(long start, long end, int lines, long lineCI[],
-   int lineNum[])
+  public LineTable(long start, long end, int[] lineNum, long[] lineCI)
   {
+if (lineNum.length != lineCI.length)
+  throw new AssertionError(code index and line numbers tables 
+   + not same length);
 this.start = start;
 this.end = end;
-this.lines = lines;
-this.lineCI = lineCI;
 this.lineNum = lineNum;
+this.lineCI = lineCI;
   }
   
   /**
@@ -86,8 +85,8 @@
   {
 os.writeLong(start);
 os.writeLong(end);
-os.writeInt(lines);
-for (int i = 0; i  lines; i++)
+os.writeInt(lineNum.length);
+for (int i = 0; i  lineNum.length; i++)
   {
 os.writeLong(lineCI[i]);
 os.writeInt(lineNum[i]);


[cp-patches] Patch: FYI: javax.sounds -vs- reverse japi

2006-03-15 Thread Tom Tromey
I'm checking this in.

This fixes the reverse japi bugs in javax.sound.

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* javax/sound/midi/Track.java (Track): New constructor.
(events): Now package-private.
* javax/sound/midi/MidiUnavailableException.java
(MidiUnavailableException): Removed invalid constructors.
* javax/sound/midi/MidiSystem.java (MidiSystem): New constructor.
* javax/sound/midi/InvalidMidiDataException.java
(InvalidMidiDataException): Removed invalid constructors.
* javax/sound/midi/Sequencer.java (hashCode): Now final.
* javax/sound/midi/SysexMessage.java (SysexMessage): Now protected.
* javax/sound/midi/ShortMessage.java (ShortMessage): Now protected.
(SYSTEM_EXCLUSIVE): Removed.
(getDataLength): Updated.
* javax/sound/midi/MidiDevice.java (Info): Now protected.
(equals): Now final
(getName): Now final.
(getVendor): Now final.
(getDescription): Likewise.
(hashCode): Likewise.
(getVersion): Likewise.
(toString): Likewise.
* javax/sound/midi/MetaMessage.java (MetaMessage): Now protected.
* javax/sound/sampled/ReverbType.java (getDecayTime): Now final.
(getEarlyReflectionDelay): Likewise.
(getEarlyReflectionIntensity): Likewise.
(getLateReflectionDelay): Likewise.
(getLateReflectionIntensity): Likewise.
(toString): Likewise.
* javax/sound/sampled/Port.java (toString): Now final.
* javax/sound/sampled/LineEvent.java (getFramePosition): Now final.
(getLine): Likewise.
(getType): Likewise.
* javax/sound/sampled/Mixer.java (Info): Now protected.
(getDescription): Now final.
(getName): Likewise.
(getVendor): Likewise.
(getVersion): Likewise.
(toString): Likewise.
* javax/sound/sampled/Control.java: Now abstract.
(Type.toString): Now final.

Index: javax/sound/midi/InvalidMidiDataException.java
===
RCS file: 
/cvsroot/classpath/classpath/javax/sound/midi/InvalidMidiDataException.java,v
retrieving revision 1.2
diff -u -r1.2 InvalidMidiDataException.java
--- javax/sound/midi/InvalidMidiDataException.java  28 Sep 2005 14:56:47 
-  1.2
+++ javax/sound/midi/InvalidMidiDataException.java  16 Mar 2006 01:43:39 
-
@@ -66,25 +66,4 @@
   {
 super(s);
   }
-
-  /**
-   * Create an InvalidMidiDataException object.
-   * 
-   * @param s the exception message string
-   * @param cause the root cause of the exception
-   */
-  public InvalidMidiDataException(String s, Throwable cause)
-  {
-super(s, cause);
-  }
-
-  /**
-   * Create an InvalidMidiDataException object.
-   * 
-   * @param cause the root cause of the exception
-   */
-  public InvalidMidiDataException(Throwable cause)
-  {
-super(cause);
-  }
 }
Index: javax/sound/midi/MetaMessage.java
===
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/MetaMessage.java,v
retrieving revision 1.1
diff -u -r1.1 MetaMessage.java
--- javax/sound/midi/MetaMessage.java   26 Sep 2005 16:35:00 -  1.1
+++ javax/sound/midi/MetaMessage.java   16 Mar 2006 01:43:39 -
@@ -76,7 +76,7 @@
* Create a MetaMessage object.
* @param data a complete system exclusive message
*/
-  public MetaMessage(byte[] data)
+  protected MetaMessage(byte[] data)
   {
 super(data);
 int index = 2;
Index: javax/sound/midi/MidiDevice.java
===
RCS file: /cvsroot/classpath/classpath/javax/sound/midi/MidiDevice.java,v
retrieving revision 1.1
diff -u -r1.1 MidiDevice.java
--- javax/sound/midi/MidiDevice.java26 Sep 2005 16:35:00 -  1.1
+++ javax/sound/midi/MidiDevice.java16 Mar 2006 01:43:39 -
@@ -134,7 +134,7 @@
  * @param description the device description
  * @param version the device version string
  */
-public Info(String name, String vendor, String description, String version)
+protected Info(String name, String vendor, String description, String 
version)
 {
   this.name = name;
   this.vendor = vendor;
@@ -150,7 +150,7 @@
  * @return true if this is the same object
  * @see java.lang.Object#equals(java.lang.Object)
  */
-public boolean equals(Object obj)
+public final boolean equals(Object obj)
 {
   return super.equals(obj);
 }
@@ -161,7 +161,7 @@
  * @return the hash code for this object
  * @see java.lang.Object#hashCode()
  */
-public int hashCode()
+public final int hashCode()
 {
   return super.hashCode();
 }
@@ -171,7 +171,7 @@
  * 
  * @return the device name
  */
-public String getName()
+public final String getName()
 {
   return name;
 }
@@ -181,7 +181,7 @@
  * 
  * 

[cp-patches] java.beans -vs- reverse japi

2006-03-15 Thread Tom Tromey
I'm checking this in.

This adds some constructors as pointed out by the reverse japi page.

Tom

2006-03-15  Tom Tromey  [EMAIL PROTECTED]

* java/beans/beancontext/BeanContextSupport.java (BCSChild): New
constructor.
(BCSIterator): Likewise.
* java/beans/beancontext/BeanContextServicesSupport.java (BCSSChild):
New constructor.
(BCSSProxyServiceProvider): Likewise.
(BCSSServiceProvider): Likewise.

Index: java/beans/beancontext/BeanContextServicesSupport.java
===
RCS file: 
/cvsroot/classpath/classpath/java/beans/beancontext/BeanContextServicesSupport.java,v
retrieving revision 1.7
diff -u -r1.7 BeanContextServicesSupport.java
--- java/beans/beancontext/BeanContextServicesSupport.java  27 Sep 2005 
16:26:24 -  1.7
+++ java/beans/beancontext/BeanContextServicesSupport.java  16 Mar 2006 
01:52:20 -
@@ -62,6 +62,10 @@
 extends BeanContextSupport.BCSChild
   {
 private static final long serialVersionUID = -3263851306889194873L;
+
+private BCSSChild()
+{
+}
   }
 
   protected class BCSSProxyServiceProvider
@@ -69,7 +73,11 @@
 BeanContextServiceRevokedListener
   {
 private static final long serialVersionUID = 7078212910685744490L;
-
+
+private BCSSProxyServiceProvider()
+{
+}
+
 public Iterator getCurrentServiceSelectors (BeanContextServices bcs,
 Class serviceClass)
 {
@@ -104,6 +112,10 @@
 
 protected BeanContextServiceProvider serviceProvider;
 
+private BCSSServiceProvider()
+{
+}
+
 protected BeanContextServiceProvider getServiceProvider()
 {
   return serviceProvider;
Index: java/beans/beancontext/BeanContextSupport.java
===
RCS file: 
/cvsroot/classpath/classpath/java/beans/beancontext/BeanContextSupport.java,v
retrieving revision 1.6
diff -u -r1.6 BeanContextSupport.java
--- java/beans/beancontext/BeanContextSupport.java  27 Sep 2005 16:26:24 
-  1.6
+++ java/beans/beancontext/BeanContextSupport.java  16 Mar 2006 01:52:20 
-
@@ -80,10 +80,18 @@
   protected class BCSChild implements Serializable
   {
 private static final long serialVersionUID = -5815286101609939109L;
+
+BCSChild()
+{
+}
   }
 
   protected static final class BCSIterator implements Iterator
   {
+BCSIterator()
+{
+}
+
 public boolean hasNext ()
 {
   throw new Error (Not implemented);



[cp-patches] FYI: Optimize GdkGraphics painting

2006-03-15 Thread Thomas Fitzsimmons
Hi,

I've done some optimization work to address this performance problem
reported by Norman Hendrich:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26486

The problem was that we were calling gdk_flush after every graphics
operation.  It is necessary to flush the graphics at least periodically,
since the AWT allows graphics calls from threads other than the GDK main
thread (See http://www.gtk.org/faq/#AEN492).However, Norman's test cases
demonstrate that flushing after every graphics operation negatively
affects performance.

The attached patch uses the lighter-weight XFlush in place of gdk_flush
and limits the flushing frequency to a maximum of 50 times per second.

I used GCJ for testing, for maximum performance of the non-native code.
I tested four different approaches:

1) the current approach: gdk_flush after every graphics operation
2) XFlush after every graphics operation
3) XFlush calls at a maximum of 50 times per second.
4) No calls to flush.

I ran two tests: Norman's FillRect benchmark and my AnimationApplet
which is an example of a Graphics-call-intense applet.  Approaches 1 and
2 had unacceptable performance on the FillRect benchmark but produced
smooth animation in AnimationApplet.  Approaches 3 and 4 had equal
performance on FillRect but 3 produced smooth animation in
AnimationApplet whereas 4 produced extremely choppy animation.  The
patch I'm committing implements approach 3.

I'm adding FillRect and AnimationApplet to the Swing and AWT demos
respectively so that we can keep an objective eye on painting
performance from now on.

The patch also re-arranges the paint- and update- handling parts of the
peers to make the design clearer.

Tom

2006-03-15  Thomas Fitzsimmons  [EMAIL PROTECTED]

* examples/gnu/classpath/examples/awt/AnimationApplet.java: New
example.
* examples/gnu/classpath/examples/swing/FillRect.java: Likewise.
* examples/gnu/classpath/examples/awt/Demo.java: Add
AnimationApplet demo.
* examples/gnu/classpath/examples/swing/Demo.java: Add FillRect
demo.

* gnu/java/awt/peer/gtk/GtkCanvasPeer.java (getGraphics): Remove
method.
(handleEvent): Likewise.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (isInRepaint):
Remove field.
(beginNativeRepaint): Remove method.
(endNativeRepaint): Likewise.
(handleEvent): Call paintComponent and updateComponent.
(paintComponent): New method.
(updateComponent): Likewise.
(repaint): Return early if width or height is less than one.
(postExposeEvent): Remove isInRepaint reference.
* gnu/java/awt/peer/gtk/GtkContainerPeer.java: (getGraphics):
Remove method.
* gnu/java/awt/peer/gtk/GtkDialogPeer.java (getGraphics): Inherit
from GtkWindowPeer.
(postMouseEvent): Likewise.
(postExposeEvent): Likewise.
* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java (updateComponent):
Override to do nothing.
* gnu/java/awt/peer/gtk/GtkFramePeer.java (getGraphics): Inherit
from GtkWindowPeer.
(postMouseEvent): Likewise.
(postExposeEvent): Likewise.
* gnu/java/awt/peer/gtk/GtkPanelPeer.java (handleEvent): Inherit
paint and update handling from GtkComponentPeer.
(updateComponent): Override to call paintComponent.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Replace
gdk_flush calls with schedule_flush calls.
(flush): New function.
(schedule_flush): Likewise.

Index: gnu/java/awt/peer/gtk/GtkCanvasPeer.java
===
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkCanvasPeer.java,v
retrieving revision 1.15
diff -u -r1.15 GtkCanvasPeer.java
--- gnu/java/awt/peer/gtk/GtkCanvasPeer.java	2 Jul 2005 20:32:12 -	1.15
+++ gnu/java/awt/peer/gtk/GtkCanvasPeer.java	16 Mar 2006 02:32:22 -
@@ -54,45 +54,8 @@
 super (c);
   }
 
-  public Graphics getGraphics ()
-  {
-if (GtkToolkit.useGraphics2D ())
-  return new GdkGraphics2D (this);
-else
-return new GdkGraphics (this);
-  }
-
-  public void handleEvent (AWTEvent event)
-  {
-int id = event.getID();
-  
-switch (id)
-  {
-  case PaintEvent.PAINT:
-  case PaintEvent.UPDATE:
-	{
-	  try 
-	{
-	  Graphics g = getGraphics ();
-	  g.setClip (((PaintEvent)event).getUpdateRect());
-		
-	  if (id == PaintEvent.PAINT)
-		awtComponent.paint (g);
-	  else
-		awtComponent.update (g);
-	  
-	  g.dispose ();
-	} 
-	  catch (InternalError e)
-	{ 
-	  System.err.println (e);
-	}
-	}
-	break;
-  }
-  }
-
-  /* Preferred size for a drawing widget is always what the user requested */
+  // Preferred size for a drawing widget is always what the user
+  // requested.
   public Dimension getPreferredSize ()
   {
 return awtComponent.getSize ();
Index: 

RE: [cp-patches] Patch: RFC: changing parts of VM reflection API

2006-03-15 Thread Jeroen Frijters
Tom Tromey wrote:
 I'm posting this for comment.
 
 This is the patch to change Method/Field/Constructor to have a
 'getModifiersInternal' method, which returns the un-masked modifiers
 as read from the .class file.  This lets us implement the new
 1.5 reflection predicates such as isSynthetic.

Looks good to me.

 Note that we could also do something similar to this for Class.  I
 think we ought to but I'd prefer to do it as a separate patch.

VMClass.getModifiers() already should return the raw modifiers. Of
course, for Class there is the added complication of inner classes that
have an additional modifiers word (which ATM is selected by a boolean
passed to VMClass.getModifiers, which is a bit ugly).

Regards,
Jeroen