[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Some accessor relaxing for inner classes
From: |
Mark Wielaard |
Subject: |
[cp-patches] Some accessor relaxing for inner classes |
Date: |
Thu, 14 Jul 2005 01:21:44 +0200 |
Hi,
I had hoped that the gcj 3.x GNU Classpath examples swing demo problem
came from some miscompilation related to inner/outer-class field or
method accesses. And since eclipse can easily point out such issues (it
warns when a inner/outer class references a private member of the other
class which needs an extra synthetic access method), I fixed the most
prominent issues it pointed out. That didn't help unfortunately. It
still is a good practice. So I am checking in the following:
2005-07-14 Mark Wielaard <address@hidden>
* examples/gnu/classpath/examples/awt/Demo.java
(TestWindow.parent): Make package private.
* gnu/java/net/protocol/http/HTTPURLConnection.java
(proxyHostname, proxyPort, agent, keepAlive, maxConnections):
Likewise.
* java/text/SimpleDateFormat.java (field, size): Likewise.
* java/util/jar/JarFile.java (readSignatures): Likewise.
* java/util/logging/FileHandler.java (written): Likewise.
* javax/swing/plaf/basic/BasicFileChooserUI.java: Make shared
fields package private.
(closeDialog): Make package private.
(filterEntries): Likewise.
* javax/swing/plaf/basic/BasicPopupMenuUI.java
(mouseInputListener): Likewise.
* javax/swing/plaf/basic/BasicTreeUI.java
(getNextVisibleNode, getPreviousVisibleNode, selectPath): Likewise.
* javax/swing/text/JTextComponent.java (caret, editable): Likewise.
Cheers,
Mark
--
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
Join the community at http://planet.classpath.org/
Index: examples/gnu/classpath/examples/awt/Demo.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/examples/gnu/classpath/examples/awt/Demo.java,v
retrieving revision 1.3
diff -u -r1.3 Demo.java
--- examples/gnu/classpath/examples/awt/Demo.java 2 Jul 2005 20:32:08
-0000 1.3
+++ examples/gnu/classpath/examples/awt/Demo.java 13 Jul 2005 23:05:24
-0000
@@ -613,7 +613,7 @@
static class TestWindow extends SubFrame
{
static int xs = 5, ys = 5;
- private final Frame parent;
+ final Frame parent;
public TestWindow(Frame f)
{
Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java,v
retrieving revision 1.13
diff -u -r1.13 HTTPURLConnection.java
--- gnu/java/net/protocol/http/HTTPURLConnection.java 7 Jul 2005 06:29:30
-0000 1.13
+++ gnu/java/net/protocol/http/HTTPURLConnection.java 13 Jul 2005 23:05:25
-0000
@@ -82,11 +82,12 @@
*/
private HTTPConnection connection;
- private String proxyHostname;
- private int proxyPort;
- private String agent;
- private boolean keepAlive;
- private int maxConnections;
+ // These are package private for use in anonymous inner classes.
+ String proxyHostname;
+ int proxyPort;
+ String agent;
+ boolean keepAlive;
+ int maxConnections;
private Request request;
private Headers requestHeaders;
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/SimpleDateFormat.java,v
retrieving revision 1.47
diff -u -r1.47 SimpleDateFormat.java
--- java/text/SimpleDateFormat.java 2 Jul 2005 20:32:41 -0000 1.47
+++ java/text/SimpleDateFormat.java 13 Jul 2005 23:05:25 -0000
@@ -73,14 +73,16 @@
private class CompiledField
{
/**
- * The ID of the field within the local pattern characters,
+ * The ID of the field within the local pattern characters.
+ * Package private for use in out class.
*/
- private int field;
+ int field;
/**
* The size of the character sequence.
+ * Package private for use in out class.
*/
- private int size;
+ int size;
/**
* The character used.
Index: java/util/jar/JarFile.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/jar/JarFile.java,v
retrieving revision 1.17
diff -u -r1.17 JarFile.java
--- java/util/jar/JarFile.java 2 Jul 2005 20:32:44 -0000 1.17
+++ java/util/jar/JarFile.java 13 Jul 2005 23:05:25 -0000
@@ -495,7 +495,8 @@
}
// Only called with lock on this JarFile.
- private void readSignatures() throws IOException
+ // Package private for use in inner classes.
+ void readSignatures() throws IOException
{
Map pkcs7Dsa = new HashMap();
Map pkcs7Rsa = new HashMap();
Index: java/util/logging/FileHandler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/logging/FileHandler.java,v
retrieving revision 1.8
diff -u -r1.8 FileHandler.java
--- java/util/logging/FileHandler.java 9 Jul 2005 18:21:52 -0000 1.8
+++ java/util/logging/FileHandler.java 13 Jul 2005 23:05:25 -0000
@@ -228,8 +228,9 @@
/**
* The number of bytes that have currently been written to the stream.
+ * Package private for use in inner classes.
*/
- private long written;
+ long written;
/**
Index: javax/swing/plaf/basic/BasicFileChooserUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,v
retrieving revision 1.6
diff -u -r1.6 BasicFileChooserUI.java
--- javax/swing/plaf/basic/BasicFileChooserUI.java 8 Jul 2005 15:46:56
-0000 1.6
+++ javax/swing/plaf/basic/BasicFileChooserUI.java 13 Jul 2005 23:05:25
-0000
@@ -874,76 +874,74 @@
}
};
- // -- begin private --
+ // -- begin private, but package local since used in inner classes --
- /** DOCUMENT ME! */
- private JFileChooser filechooser;
+ JFileChooser filechooser;
/** DOCUMENT ME! */
- private JList filelist;
+ JList filelist;
/** DOCUMENT ME! */
- private JComboBox filters;
+ JComboBox filters;
/** DOCUMENT ME! */
- private BasicDirectoryModel model;
+ BasicDirectoryModel model;
/** DOCUMENT ME! */
- private FileFilter acceptAll = new AcceptAllFileFilter();
+ FileFilter acceptAll = new AcceptAllFileFilter();
/** DOCUMENT ME! */
- private FileView fv = new BasicFileView();
+ FileView fv = new BasicFileView();
/** DOCUMENT ME! */
- private static final int ICON_SIZE = 24;
+ static final int ICON_SIZE = 24;
/** DOCUMENT ME! */
- private JComboBox parents;
+ JComboBox parents;
/** DOCUMENT ME! */
- private String filename;
+ String filename;
/** DOCUMENT ME! */
- private JButton accept;
+ JButton accept;
/** DOCUMENT ME! */
- private JButton cancel;
+ JButton cancel;
/** DOCUMENT ME! */
- private JButton upFolderButton;
+ JButton upFolderButton;
/** DOCUMENT ME! */
- private JButton newFolderButton;
+ JButton newFolderButton;
/** DOCUMENT ME! */
- private JButton homeFolderButton;
+ JButton homeFolderButton;
/** DOCUMENT ME! */
- private JPanel accessoryPanel;
+ JPanel accessoryPanel;
/** DOCUMENT ME! */
- private PropertyChangeListener propertyChangeListener;
+ PropertyChangeListener propertyChangeListener;
/** DOCUMENT ME! */
- private String acceptAllFileFilterText;
+ String acceptAllFileFilterText;
/** DOCUMENT ME! */
- private String dirDescText;
+ String dirDescText;
/** DOCUMENT ME! */
- private String fileDescText;
+ String fileDescText;
/** DOCUMENT ME! */
- private boolean dirSelected = false;
+ boolean dirSelected = false;
/** DOCUMENT ME! */
- private File currDir = null;
+ File currDir = null;
- /** DOCUMENT ME! */
- private JPanel bottomPanel;
+ JPanel bottomPanel;
/** DOCUMENT ME! */
- private JPanel closePanel;
+ JPanel closePanel;
// -- end private --
private class ListLabelRenderer
@@ -1029,10 +1027,7 @@
}
}
- /**
- * DOCUMENT ME!
- */
- private void closeDialog()
+ void closeDialog()
{
Window owner = SwingUtilities.windowForComponent(filechooser);
if (owner instanceof JDialog)
@@ -1168,10 +1163,7 @@
};
}
- /**
- * DOCUMENT ME!
- */
- private void filterEntries()
+ void filterEntries()
{
FileFilter[] list = filechooser.getChoosableFileFilters();
if (filters.getItemCount() > 0)
Index: javax/swing/plaf/basic/BasicPopupMenuUI.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java,v
retrieving revision 1.12
diff -u -r1.12 BasicPopupMenuUI.java
--- javax/swing/plaf/basic/BasicPopupMenuUI.java 8 Jul 2005 15:24:08
-0000 1.12
+++ javax/swing/plaf/basic/BasicPopupMenuUI.java 13 Jul 2005 23:05:25
-0000
@@ -74,8 +74,8 @@
/* popupMenu for which this UI delegate is for*/
protected JPopupMenu popupMenu;
- /* MouseInputListener listens to mouse events */
- private static transient MouseInputListener mouseInputListener;
+ /* MouseInputListener listens to mouse events. Package private for inner
classes. */
+ static transient MouseInputListener mouseInputListener;
/* PopupMenuListener listens to popup menu events fired by JPopupMenu*/
private transient PopupMenuListener popupMenuListener;
Index: javax/swing/plaf/basic/BasicTreeUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.32
diff -u -r1.32 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java 13 Jul 2005 21:15:42 -0000
1.32
+++ javax/swing/plaf/basic/BasicTreeUI.java 13 Jul 2005 23:05:25 -0000
@@ -625,12 +625,12 @@
/**
* Get next visible node in the tree.
- *
+ * Package private for use in inner classes.
* @param the current node
* @return the next visible node in the JTree. Return null if there are no
* more.
*/
- private DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode
node)
+ DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node)
{
DefaultMutableTreeNode next = null;
TreePath current = null;
@@ -657,12 +657,13 @@
/**
* Get previous visible node in the tree.
+ * Package private for use in inner classes.
*
* @param the current node
* @return the next visible node in the JTree. Return null if there are no
* more.
*/
- private DefaultMutableTreeNode getPreviousVisibleNode
+ DefaultMutableTreeNode getPreviousVisibleNode
(DefaultMutableTreeNode node)
{
DefaultMutableTreeNode prev = null;
@@ -1562,11 +1563,12 @@
/**
* Selects the specified path in the tree depending on modes.
+ * Package private for use in inner classes.
*
* @param tree is the tree we are selecting the path in
* @param path is the path we are selecting
*/
- private void selectPath(JTree tree, TreePath path)
+ void selectPath(JTree tree, TreePath path)
{
if (path != null)
{
Index: javax/swing/text/JTextComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v
retrieving revision 1.34
diff -u -r1.34 JTextComponent.java
--- javax/swing/text/JTextComponent.java 12 Jul 2005 09:05:13 -0000
1.34
+++ javax/swing/text/JTextComponent.java 13 Jul 2005 23:05:26 -0000
@@ -934,15 +934,16 @@
return getUI().getEditorKit(this).getActions();
}
- // This is package-private to avoid an accessor method.
+ // These are package-private to avoid an accessor method.
Document doc;
- private Caret caret;
+ Caret caret;
+ boolean editable;
+
private Highlighter highlighter;
private Color caretColor;
private Color disabledTextColor;
private Color selectedTextColor;
private Color selectionColor;
- private boolean editable;
private Insets margin;
private boolean dragEnabled;
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] Some accessor relaxing for inner classes,
Mark Wielaard <=