There are a couple of methods in AbstractDocument that should be final,
but are not in Classpath. This patch fixes this.

2006-03-25  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/AbstractDocument.java
        (getAttributeContext): Made method final.
        (getCurrentWriter): Likewise.
        (getEndPosition): Likewise.
        (getProperty): Likewise.
        (getStartPosition): Likewise.
        (putProperty): Likewise.
        (readLock): Likewise.
        (readUnlock): Likewise.
        (writeLock): Likewise.
        (writeUnlock): Likewise.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/text/AbstractDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.53
diff -u -1 -0 -r1.53 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	1 Mar 2006 20:39:48 -0000	1.53
+++ javax/swing/text/AbstractDocument.java	25 Mar 2006 18:44:14 -0000
@@ -322,21 +322,21 @@
   public int getAsynchronousLoadPriority()
   {
     return 0;
   }
 
   /**
    * Returns the [EMAIL PROTECTED] AttributeContext} used in this <code>Document</code>.
    *
    * @return the [EMAIL PROTECTED] AttributeContext} used in this <code>Document</code>
    */
-  protected AttributeContext getAttributeContext()
+  protected final AttributeContext getAttributeContext()
   {
     return context;
   }
 
   /**
    * Returns the root element for bidirectional content.
    *
    * @return the root element for bidirectional content
    */
   public Element getBidiRootElement()
@@ -359,21 +359,21 @@
 
   /**
    * Returns the thread that currently modifies this <code>Document</code>
    * if there is one, otherwise <code>null</code>. This can be used to
    * distinguish between a method call that is part of an ongoing modification
    * or if it is a separate modification for which a new lock must be aquired.
    *
    * @return the thread that currently modifies this <code>Document</code>
    *         if there is one, otherwise <code>null</code>
    */
-  protected Thread getCurrentWriter()
+  protected final Thread getCurrentWriter()
   {
     return currentWriter;
   }
 
   /**
    * Returns the properties of this <code>Document</code>.
    *
    * @return the properties of this <code>Document</code>
    */
   public Dictionary getDocumentProperties()
@@ -385,21 +385,21 @@
     return properties;
   }
 
   /**
    * Returns a [EMAIL PROTECTED] Position} which will always mark the end of the
    * <code>Document</code>.
    *
    * @return a [EMAIL PROTECTED] Position} which will always mark the end of the
    *         <code>Document</code>
    */
-  public Position getEndPosition()
+  public final Position getEndPosition()
   {
     // FIXME: Properly implement this by calling Content.createPosition().
     return new Position() 
       {        
         public int getOffset() 
         { 
           return getLength(); 
         } 
       };
   }
@@ -430,21 +430,21 @@
   }
 
   /**
    * Returns a property from this <code>Document</code>'s property list.
    *
    * @param key the key of the property to be fetched
    *
    * @return the property for <code>key</code> or <code>null</code> if there
    *         is no such property stored
    */
-  public Object getProperty(Object key)
+  public final Object getProperty(Object key)
   {
     // FIXME: make me thread-safe
     Object value = null;
     if (properties != null)
       value = properties.get(key);
 
     return value;
   }
 
   /**
@@ -463,21 +463,21 @@
     return elements;
   }
 
   /**
    * Returns a [EMAIL PROTECTED] Position} which will always mark the beginning of the
    * <code>Document</code>.
    *
    * @return a [EMAIL PROTECTED] Position} which will always mark the beginning of the
    *         <code>Document</code>
    */
-  public Position getStartPosition()
+  public final Position getStartPosition()
   {
     // FIXME: Properly implement this using Content.createPosition().
     return new Position() 
       {        
         public int getOffset() 
         { 
           return 0; 
         } 
       };
   }
@@ -582,34 +582,34 @@
   {
     // Do nothing here. Subclasses may want to override this.
   }
 
   /**
    * Stores a property in this <code>Document</code>'s property list.
    *
    * @param key the key of the property to be stored
    * @param value the value of the property to be stored
    */
-  public void putProperty(Object key, Object value)
+  public final void putProperty(Object key, Object value)
   {
     // FIXME: make me thread-safe
     if (properties == null)
       properties = new Hashtable();
 
     properties.put(key, value);
   }
 
   /**
    * Blocks until a read lock can be obtained.  Must block if there is
    * currently a writer modifying the <code>Document</code>.
    */
-  public void readLock()
+  public final void readLock()
   {
     if (currentWriter != null && currentWriter.equals(Thread.currentThread()))
       return;
     synchronized (documentCV)
       {
         while (currentWriter != null || numWritersWaiting > 0)
           {
             try
               {
                 documentCV.wait();
@@ -620,21 +620,21 @@
               }
           }
           numReaders++;
       }
   }
 
   /**
    * Releases the read lock. If this was the only reader on this
    * <code>Document</code>, writing may begin now.
    */
-  public void readUnlock()
+  public final void readUnlock()
   {
     // Note we could have a problem here if readUnlock was called without a
     // prior call to readLock but the specs simply warn users to ensure that
     // balance by using a finally block:
     // readLock()
     // try
     // { 
     //   doSomethingHere 
     // }
     // finally
@@ -847,21 +847,21 @@
   public void setDocumentProperties(Dictionary p)
   {
     // FIXME: make me thread-safe
     properties = p;
   }
 
   /**
    * Blocks until a write lock can be obtained.  Must wait if there are 
    * readers currently reading or another thread is currently writing.
    */
-  protected void writeLock()
+  protected final void writeLock()
   {
     if (currentWriter != null && currentWriter.equals(Thread.currentThread()))
       return;
     synchronized (documentCV)
       {
         numWritersWaiting++;
         while (numReaders > 0)
           {
             try
               {
@@ -874,21 +874,21 @@
           }
         numWritersWaiting --;
         currentWriter = Thread.currentThread();
       }
   }
 
   /**
    * Releases the write lock. This allows waiting readers or writers to
    * obtain the lock.
    */
-  protected void writeUnlock()
+  protected final void writeUnlock()
   {
     synchronized (documentCV)
     {
         if (Thread.currentThread().equals(currentWriter))
           {
             currentWriter = null;
             documentCV.notifyAll();
           }
     }
   }

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to