harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r462693 - in /incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java: java/applet/ org/apache/harmony/applet/
Date Wed, 11 Oct 2006 04:27:24 GMT
Author: ndbeyer
Date: Tue Oct 10 21:27:23 2006
New Revision: 462693

URL: http://svn.apache.org/viewvc?view=rev&rev=462693
Log:
Misc changes -
* cleanup misspellings
* Add annotations
* generify various pieces of code 
* simplify some synchronized code 

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/Applet.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletContext.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletStub.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AudioClip.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AudioClipImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Callback.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/CodeBase.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Document.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/DocumentSlice.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Factory.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Launcher.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Parameters.java
    incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/Applet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/Applet.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/Applet.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/Applet.java
Tue Oct 10 21:27:23 2006
@@ -1,9 +1,10 @@
 /*
- *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -61,10 +62,12 @@
             super();
         }
         
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.FRAME;
         }
         
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
             AccessibleStateSet set = super.getAccessibleStateSet();
             Window owner = null;
@@ -91,27 +94,33 @@
     }
 
     public void init() {
-        // do nothing by specefication
+        // do nothing by specification
     }
 
     public void start() {
-        // do nothing by specefication
+        // do nothing by specification
     }
 
     public void destroy() {
-        // do nothing by specefication
+        // do nothing by specification
     }
 
     public void stop() {
-        // do nothing by specefication
+        // do nothing by specification
     }
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
     public void resize(int width, int height) {
         synchronized(appletLock) {
             stub.appletResize(width, height);
         }
     }
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
     public void resize(Dimension d) {
         synchronized(appletLock) {
             stub.appletResize(d.width, d.height);
@@ -124,6 +133,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         synchronized(appletLock) {
             if (accessibleContext == null) {
@@ -140,7 +150,7 @@
     }
 
     public String getAppletInfo() {
-        // return null by specefication
+        // return null by specification
         return null;
     }
 
@@ -166,6 +176,7 @@
         return getAppletContext().getImage(appendURL(url, name));
     }
 
+    @Override
     public Locale getLocale() {
         return super.getLocale();
     }
@@ -177,7 +188,7 @@
     }
 
     public String[][] getParameterInfo() {
-        // return null by specefication
+        // return null by specification
         return null;
     }
 
@@ -234,4 +245,3 @@
     }
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletContext.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletContext.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletContext.java
Tue Oct 10 21:27:23 2006
@@ -29,25 +29,24 @@
 
 public interface AppletContext {
 
-    public Applet getApplet(String name);
+    Applet getApplet(String name);
 
-    public Enumeration<Applet> getApplets();
+    Enumeration<Applet> getApplets();
 
-    public AudioClip getAudioClip(URL url);
+    AudioClip getAudioClip(URL url);
 
-    public Image getImage(URL url);
+    Image getImage(URL url);
 
-    public InputStream getStream(String key);
+    InputStream getStream(String key);
 
-    public Iterator<String> getStreamKeys();
+    Iterator<String> getStreamKeys();
 
-    public void setStream(String key, InputStream stream) throws IOException;
+    void setStream(String key, InputStream stream) throws IOException;
 
-    public void showDocument(URL url, String target);
+    void showDocument(URL url, String target);
 
-    public void showDocument(URL url);
+    void showDocument(URL url);
 
-    public void showStatus(String status);
+    void showStatus(String status);
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletStub.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletStub.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletStub.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AppletStub.java
Tue Oct 10 21:27:23 2006
@@ -24,17 +24,16 @@
 
 public interface AppletStub {
 
-    public URL getCodeBase();
+    URL getCodeBase();
 
-    public void appletResize(int width, int height);
+    void appletResize(int width, int height);
 
-    public AppletContext getAppletContext();
+    AppletContext getAppletContext();
 
-    public URL getDocumentBase();
+    URL getDocumentBase();
 
-    public String getParameter(String name);
+    String getParameter(String name);
 
-    public boolean isActive();
+    boolean isActive();
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AudioClip.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AudioClip.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AudioClip.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/java/applet/AudioClip.java
Tue Oct 10 21:27:23 2006
@@ -22,11 +22,10 @@
 
 public interface AudioClip {
 
-    public void stop();
+    void stop();
 
-    public void loop();
+    void loop();
 
-    public void play();
+    void play();
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AppletThread.java
Tue Oct 10 21:27:23 2006
@@ -29,28 +29,23 @@
  * Thread that initializes applet and performs commands from the host application
  */
 final class AppletThread extends Thread {
-    
-    private final Proxy proxy;
-
     private final Object monitor = new Object();
-    private final List commandQueue = Collections.synchronizedList(new LinkedList());
+    private final List<Command> commandQueue = Collections.synchronizedList(new LinkedList<Command>());
     
-    private boolean doExit = false;
+    private boolean doExit;
     
     AppletThread(Proxy proxy) {
         super(proxy.docSlice.codeBase.threadGroup, "Applet-" + proxy.params.className);
-        
-        this.proxy = proxy;
         setContextClassLoader(proxy.docSlice.codeBase.classLoader);
     }
     
+    @Override
     public void run() {
 
         while (true) {
             
             while( !commandQueue.isEmpty()) {
-                Command command = (Command)commandQueue.remove(0);
-                
+                Command command = commandQueue.remove(0);
                 command.run();
             }
             
@@ -64,7 +59,10 @@
                         return;
                     }
                 } catch (InterruptedException e) {
-                    // TODO: handle difference between intensional and unexpected interruptions
+                    // set the interrupt state
+                    interrupt();
+                    // the thread was interrupted, so we end it
+                    return;
                 }
             }
         }
@@ -91,4 +89,3 @@
     }
     
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AudioClipImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AudioClipImpl.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AudioClipImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/AudioClipImpl.java
Tue Oct 10 21:27:23 2006
@@ -29,6 +29,7 @@
  */
 public class AudioClipImpl implements AudioClip {
     
+    @SuppressWarnings("unused") // TODO remove once used
     private final URL url;
     
     // TODO: introduce AudioClipPeer when sound API will be available
@@ -44,29 +45,20 @@
         }
         this.url = url;
     }
-    
-    /* (non-Javadoc)
-     * @see java.applet.AudioClip#stop()
-     */
+
     public void stop() {
         // TODO: implement when sound API will be available
-        if (true) throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException();
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AudioClip#loop()
-     */
     public void loop() {
         // TODO: implement when sound API will be available
-        if (true) throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException();
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AudioClip#play()
-     */
     public void play() {
         // TODO: implement when sound API will be available
-        if (true) throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException();
     }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Callback.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Callback.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Callback.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Callback.java
Tue Oct 10 21:27:23 2006
@@ -27,9 +27,9 @@
  */
 interface Callback {
 
-    public void showDocument(int documentId, URL url, String target);
+    void showDocument(int documentId, URL url, String target);
 
-    public void showStatus(int documentId, String status);
+    void showStatus(int documentId, String status);
 
-    public void appletResize(int appletId, int width, int height);
+    void appletResize(int appletId, int width, int height);
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/CodeBase.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/CodeBase.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/CodeBase.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/CodeBase.java
Tue Oct 10 21:27:23 2006
@@ -37,8 +37,7 @@
     final ContextThreadGroup threadGroup;
     final Factory factory;
 
-    // Document -> DocumentSlice
-    private final IdentityHashMap docSlices = new IdentityHashMap();
+    private final IdentityHashMap<Document, DocumentSlice> docSlices = new IdentityHashMap<Document,
DocumentSlice>();
     
     CodeBase(URL url, Factory factory) {
         this.codeBase = url;
@@ -50,7 +49,7 @@
     
     DocumentSlice getDocumentSlice(Document doc) {
         synchronized(docSlices) {
-            DocumentSlice slice = (DocumentSlice)docSlices.get(doc);
+            DocumentSlice slice = docSlices.get(doc);
             if (slice == null) {
                 slice = new DocumentSlice(doc, this);
                 docSlices.put(doc, slice);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Connection.java
Tue Oct 10 21:27:23 2006
@@ -20,15 +20,13 @@
  */
 package org.apache.harmony.applet;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.net.Socket;
 import java.net.URL;
 import java.util.HashMap;
-
+import java.util.Map;
 import org.apache.harmony.awt.ContextStorage;
 
 
@@ -169,7 +167,7 @@
     }
     
     /**
-     * command synopsys:<br>
+     * command synopsis:<br>
      * CREATE id parentWindowId className docBase docId codeBase<br>
      *   NAME name_in_document<br>
      *   PARAM name value<br>
@@ -185,7 +183,7 @@
         int docId;
         URL codeBase;
         String name = null;
-        HashMap parameters = new HashMap();
+        Map<String, String> parameters = new HashMap<String, String>();
         
         try {
             id = Integer.parseInt(args[1]);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Document.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Document.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Document.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Document.java
Tue Oct 10 21:27:23 2006
@@ -21,19 +21,17 @@
 package org.apache.harmony.applet;
 
 import java.net.URL;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
 /**
  * Representation of browser's (or other host app's) document that contains applets
  */
-
 final class Document {
 
     final URL docBase;
     final int id;
-    private final Set slices = Collections.synchronizedSet(new HashSet());
+    private final Set<DocumentSlice> slices = new HashSet<DocumentSlice>();
     final Factory factory;
 
     Document(Factory factory, URL url, int id) {
@@ -43,7 +41,9 @@
     }
     
     void add(DocumentSlice ds) {
-        slices.add(ds);
+        synchronized (slices) {
+            slices.add(ds);
+        }
     }
     
     void remove(DocumentSlice ds) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/DocumentSlice.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/DocumentSlice.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/DocumentSlice.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/DocumentSlice.java
Tue Oct 10 21:27:23 2006
@@ -33,6 +33,8 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Collection of applets running in one document and loaded from the same code base,
@@ -43,8 +45,8 @@
     final CodeBase codeBase;
     final Document document;
     
-    private final ArrayList proxies = new ArrayList();
-    private final HashMap streams = new HashMap();
+    private final List<Proxy> proxies = new ArrayList<Proxy>();
+    private final Map<String, InputStream> streams = new HashMap<String, InputStream>();
     
     
     DocumentSlice(Document doc, CodeBase codeBase) {
@@ -62,24 +64,21 @@
     void remove(Proxy p) {
         codeBase.factory.remove(p);
 
-        boolean empty = false;
+        boolean empty;
         synchronized (proxies) {
             proxies.remove(p);
-            empty = (proxies.size() == 0);
+            empty = proxies.isEmpty();
         }
         if (empty) {
             codeBase.remove(this);
             document.remove(this);
         }
     }
-    /*
-     * @see java.applet.AppletContext#getApplet(java.lang.String)
-     */
+
     public Applet getApplet(String name) {
         
         synchronized (proxies) {
-            for (Iterator it = proxies.iterator(); it.hasNext();) {
-                Proxy p = (Proxy)it.next();
+            for (Proxy p : proxies) {
                 if (p.params.name.equals(name)) {
                     return p.getApplet();
                 }
@@ -88,15 +87,11 @@
         }
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#getApplets()
-     */
-    public Enumeration getApplets() {
+    public Enumeration<Applet> getApplets() {
         
         synchronized (proxies) {
-            ArrayList applets = new ArrayList();
-            for (Iterator it = proxies.iterator(); it.hasNext();) {
-                Proxy p = (Proxy)it.next();
+            ArrayList<Applet> applets = new ArrayList<Applet>();
+            for (Proxy p : proxies) {
                 Applet a = p.getApplet();
                 if (a != null) {
                     applets.add(a);
@@ -106,47 +101,32 @@
         }
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#getAudioClip(java.net.URL)
-     */
     public AudioClip getAudioClip(URL url) {
         return new AudioClipImpl(url);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#getImage(java.net.URL)
-     */
     public Image getImage(URL url) {
         return Toolkit.getDefaultToolkit().getImage(url);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#getStream(java.lang.String)
-     */
     public InputStream getStream(String key) {
 
         synchronized (streams) {
-            return (InputStream)streams.get(key);
+            return streams.get(key);
         }
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#getStreamKeys()
-     */
-    public Iterator getStreamKeys() {
+    public Iterator<String> getStreamKeys() {
 
         synchronized (streams) {
-            ArrayList keys = new ArrayList();
-            for(Iterator i = streams.keySet().iterator(); i.hasNext(); ) {
-                keys.add(i.next());
+            ArrayList<String> keys = new ArrayList<String>();
+            for (String string : streams.keySet()) {
+                keys.add(string);
             }
             return keys.iterator();
         }
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#setStream(java.lang.String, java.io.InputStream)
-     */
     public void setStream(String key, InputStream stream) throws IOException {
 
         synchronized (streams) {
@@ -154,23 +134,14 @@
         }
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#showDocument(java.net.URL, java.lang.String)
-     */
     public void showDocument(URL url, String target) {
         codeBase.factory.showDocument(this, url, target);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#showDocument(java.net.URL)
-     */
     public void showDocument(URL url) {
         this.showDocument(url, null);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletContext#showStatus(java.lang.String)
-     */
     public void showStatus(String status) {
         codeBase.factory.showStatus(this, status);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Factory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Factory.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Factory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Factory.java
Tue Oct 10 21:27:23 2006
@@ -23,7 +23,6 @@
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -32,9 +31,9 @@
 final class Factory {
     
     private final Callback callback;
-    private final Map codeBases = Collections.synchronizedMap(new HashMap());
-    private final Map allProxies = Collections.synchronizedMap(new HashMap());
-    private final Map documents = Collections.synchronizedMap(new HashMap());
+    private final Map<URL, CodeBase> codeBases = Collections.synchronizedMap(new HashMap<URL,
CodeBase>());
+    private final Map<Integer, Proxy> allProxies = Collections.synchronizedMap(new
HashMap<Integer, Proxy>());
+    private final Map<Integer, Document> documents = Collections.synchronizedMap(new
HashMap<Integer, Document>());
     
     Factory(Callback callback) {
         this.callback = callback;
@@ -42,7 +41,7 @@
     
     CodeBase getCodeBase(URL url) {
         synchronized(codeBases) {
-            CodeBase cb = (CodeBase)codeBases.get(url);
+            CodeBase cb = codeBases.get(url);
             if (cb == null) {
                 cb = new CodeBase(url, this);
                 codeBases.put(url, cb);
@@ -60,7 +59,7 @@
     }
 
     void dispose(int id) {
-        Proxy p = (Proxy)allProxies.get(new Integer(id));
+        Proxy p = allProxies.get(new Integer(id));
         if (p == null) {
             return;
         }
@@ -73,7 +72,7 @@
         synchronized(documents) {
             Document doc;
             Integer objDocId = new Integer(docId);
-            doc = (Document)documents.get(objDocId);
+            doc = documents.get(objDocId);
             if (doc == null) {
                 doc = new Document(this, docBase, docId);
                 documents.put(objDocId, doc);
@@ -94,28 +93,28 @@
     }
     
     void start(int id) {
-        Proxy p = (Proxy)allProxies.get(new Integer(id));
+        Proxy p = allProxies.get(new Integer(id));
         if (p != null) {
             p.start();
         }
     }
     
     void stop(int id) {
-        Proxy p = (Proxy)allProxies.get(new Integer(id));
+        Proxy p = allProxies.get(new Integer(id));
         if (p != null) {
             p.stop();
         }
     }
     
     void init(int id) {
-        Proxy p = (Proxy)allProxies.get(new Integer(id));
+        Proxy p = allProxies.get(new Integer(id));
         if (p != null) {
             p.init();
         }
     }
     
     void destroy(int id) {
-        Proxy p = (Proxy)allProxies.get(new Integer(id));
+        Proxy p = allProxies.get(new Integer(id));
         if (p != null) {
             p.destroy();
         }
@@ -142,16 +141,14 @@
     }
     
     void dump() {
-        for (Iterator it = allProxies.values().iterator(); it.hasNext(); ) {
-            Proxy p = (Proxy)it.next();
+        for (Proxy p : allProxies.values()) {
             System.err.println("app " + p.params.id + " " + 
                     " cb " + p.docSlice.codeBase.hashCode() + " " +
                     " doc " + p.params.documentId + " " +
                     p.params.codeBase + p.params.className + " " + 
                     (p.isActive() ? "active" : "stopped"));
         }
-        for (Iterator it = codeBases.values().iterator(); it.hasNext(); ) {
-            CodeBase cb = (CodeBase)it.next();
+        for (CodeBase cb : codeBases.values()) {
             System.err.println("cb " + cb.hashCode() + " " + cb.threadGroup);
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Launcher.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Launcher.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Launcher.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Launcher.java
Tue Oct 10 21:27:23 2006
@@ -154,6 +154,7 @@
         
         
         f.addWindowListener(new WindowAdapter() {
+            @Override
             public void windowClosing(WindowEvent e) {
                 Launcher.this.hide();
                 e.getWindow().dispose();
@@ -187,7 +188,7 @@
                            documentId,
                            codeBase,
                            className,
-                           new HashMap(),
+                           new HashMap<String, String>(),
                            className,
                            placeholder); 
         
@@ -213,6 +214,7 @@
             this.margin = margin;
         }
         
+        @Override
         public void paint(Graphics g) {
 
             super.paint(g);
@@ -228,12 +230,16 @@
             g.drawLine(w - offset, offset, w - offset, h - offset);
         }
 
+        @SuppressWarnings("deprecation")
+        @Deprecated
+        @Override
         public void layout() {
             Component child = getComponent(0);
 
             child.setBounds(offset + margin, offset+1, getWidth() - 2*(offset + margin),
getHeight() - 2*offset-1);
         }
         
+        @Override
         public Dimension getPreferredSize() {
             Component child = getComponent(0);
             Dimension size = child.getPreferredSize();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Parameters.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Parameters.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Parameters.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Parameters.java
Tue Oct 10 21:27:23 2006
@@ -29,7 +29,7 @@
 final class Parameters {
 
     /** applet parameters provided by &lt;param&gt; tags */
-    final Map parameters;
+    final Map<String, String> parameters;
     /** the location the document comes from */
     final URL documentBase;
     /** document's id from the host application */
@@ -53,7 +53,7 @@
                 int documentId,
                 URL codeBase,
                 String className,
-                Map parameters,
+                Map<String, String> parameters,
                 String name,
                 Object container) {
 
@@ -69,7 +69,7 @@
     }
 
     String getParameter(String name) {
-        return (String)parameters.get(name);
+        return parameters.get(name);
     }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java?view=diff&rev=462693&r1=462692&r2=462693
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/applet/src/main/java/org/apache/harmony/applet/Proxy.java
Tue Oct 10 21:27:23 2006
@@ -64,6 +64,7 @@
                 mainThread.start();
             }
             mainThread.postCommand(new Command("create") {
+                @Override
                 public void run() {
                     createImpl();
                 }});
@@ -102,6 +103,7 @@
             startImpl();
         } else {
             mainThread.postCommand(new Command("start") {
+                @Override
                 public void run() {
                     startImpl();
                 }});
@@ -121,6 +123,7 @@
             stopImpl();
         } else {
             mainThread.postCommand(new Command("stop") {
+                @Override
                 public void run() {
                     stopImpl();
                 }});
@@ -140,6 +143,7 @@
             initImpl();
         } else {
             mainThread.postCommand(new Command("init") {
+                @Override
                 public void run() {
                     initImpl();
                 }});
@@ -158,6 +162,7 @@
             destroyImpl();
         } else {
             mainThread.postCommand(new Command("destroy") {
+                @Override
                 public void run() {
                     destroyImpl();
                 }});
@@ -176,6 +181,7 @@
             disposeImpl();
         } else {
             mainThread.postCommand(new Command("dispose") {
+                @Override
                 public void run() {
                     disposeImpl();
                 }});
@@ -199,7 +205,7 @@
     }
     
     private Applet createApplet() {
-        Class appletClass;
+        Class<?> appletClass;
         try {
             appletClass = docSlice.codeBase.classLoader.loadClass(params.className);
         } catch (ClassNotFoundException e) {
@@ -208,52 +214,33 @@
 
         try {
             return (Applet)appletClass.newInstance();
-
         } catch (InstantiationException e) {
             throw new RuntimeException(e);
         } catch (IllegalAccessException e) {
             throw new RuntimeException(e);
         }
     }
-    
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#getCodeBase()
-     */
+
     public URL getCodeBase() {
         return docSlice.codeBase.codeBase;
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#appletResize(int, int)
-     */
     public void appletResize(int width, int height) {
         docSlice.codeBase.factory.appletResize(this, width, height);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#getAppletContext()
-     */
     public AppletContext getAppletContext() {
         return docSlice;
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#getDocumentBase()
-     */
     public URL getDocumentBase() {
         return docSlice.document.docBase;
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#getParameter(java.lang.String)
-     */
     public String getParameter(String name) {
         return params.getParameter(name);
     }
 
-    /* (non-Javadoc)
-     * @see java.applet.AppletStub#isActive()
-     */
     public boolean isActive() {
         return active;
     }



Mime
View raw message