Index: /trunk/src/JOSM.java
===================================================================
--- /trunk/src/JOSM.java	(revision 5828)
+++ /trunk/src/JOSM.java	(revision 5829)
@@ -1,12 +1,15 @@
 // License: GPL. Copyright 2007 by Immanuel Scholz and others
-//Licence: GPL
-
-// Note: The name of the main class will be the name of the application menu on OS X.
-//       so instead of exposing "org.openstreetmap.josm.gui.MainApplication" to the
-//       user, we subclass it with a nicer name "JOSM".
-//       An alternative would be to set the name in the plist file---but JOSM usually
-//       is not delivered as an OS X Application Bundle, so we have no plist file.
-
 import org.openstreetmap.josm.gui.MainApplication;
 
+/**
+ * JOSM main class (entry point of the application).<br/>
+ * 
+ * The name of the main class will be the name of the application menu on OS X.
+ * so instead of exposing "org.openstreetmap.josm.gui.MainApplication" to the
+ * user, we subclass it with a nicer name "JOSM".
+ * An alternative would be to set the name in the plist file---but JOSM usually
+ * is not delivered as an OS X Application Bundle, so we have no plist file.
+ * 
+ * @since 1023
+ */
 public class JOSM extends MainApplication {}
Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 5828)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 5829)
@@ -95,4 +95,8 @@
 import org.openstreetmap.josm.tools.WindowGeometry;
 
+/**
+ * Abstract class holding various static global variables and methods used in large parts of JOSM application.
+ * @since 98
+ */
 abstract public class Main {
 
@@ -108,12 +112,15 @@
         return true;
     }
+    
     /**
      * Global parent component for all dialogs and message boxes
      */
     public static Component parent;
+    
     /**
      * Global application.
      */
     public static Main main;
+    
     /**
      * The worker thread slave. This is for executing all long and intensive
@@ -122,4 +129,5 @@
      */
     public final static ExecutorService worker = new ProgressMonitorExecutor();
+    
     /**
      * Global application preferences
@@ -131,10 +139,15 @@
      */
     public static final PrimitiveDeepCopy pasteBuffer = new PrimitiveDeepCopy();
+    
+    /**
+     * The layer source from which {@link Main#pasteBuffer} data comes from.
+     */
     public static Layer pasteSource;
 
     /**
-     * The MapFrame. Use setMapFrame to set or clear it.
+     * The MapFrame. Use {@link Main#setMapFrame} to set or clear it.
      */
     public static MapFrame map;
+    
     /**
      * Set to <code>true</code>, when in applet mode
@@ -147,4 +160,7 @@
     public static ToolbarPreferences toolbar;
 
+    /**
+     * The commands undo/redo handler.
+     */
     public UndoRedoHandler undoRedo = new UndoRedoHandler();
 
@@ -240,4 +256,5 @@
     /**
      * Set or clear (if passed <code>null</code>) the map.
+     * @param map The map to set {@link Main#map} to. Can be null.
      */
     public final void setMapFrame(final MapFrame map) {
@@ -532,4 +549,7 @@
     ///////////////////////////////////////////////////////////////////////////
 
+    /**
+     * Global panel. 
+     */
     public static final JPanel panel = new JPanel(new BorderLayout());
 
@@ -592,5 +612,5 @@
     }
 
-    public void postConstructorProcessCmdLine(Map<Option, Collection<String>> args) {
+    protected static void postConstructorProcessCmdLine(Map<Option, Collection<String>> args) {
         if (args.containsKey(Option.DOWNLOAD)) {
             List<File> fileList = new ArrayList<File>();
@@ -705,8 +725,14 @@
     }
 
+    /**
+     * Closes JOSM and optionally terminates the Java Virtual Machine (JVM). If there are some unsaved data layers, asks first for user confirmation.
+     * @param exit If {@code true}, the JVM is terminated by running {@link System#exit} with a return code of 0.
+     * @return {@code true} if JOSM has been closed, {@code false} if the user has cancelled the operation.
+     * @since 3378
+     */
     public static boolean exitJosm(boolean exit) {
         if (Main.saveUnsavedModifications()) {
             geometry.remember("gui.geometry");
-            if (map  != null) {
+            if (map != null) {
                 map.rememberToggleDialogWidth();
             }
@@ -721,9 +747,8 @@
             if (exit) {
                 System.exit(0);
-                return true;
-            } else
-                return true;
-        } else
-            return false;
+            }
+            return true;
+        }
+        return false;
     }
 
@@ -739,5 +764,5 @@
      * @return The guessed parameter type
      */
-    private DownloadParamType paramType(String s) {
+    private static DownloadParamType paramType(String s) {
         if(s.startsWith("http:")) return DownloadParamType.httpUrl;
         if(s.startsWith("file:")) return DownloadParamType.fileUrl;
@@ -798,4 +823,8 @@
     }
 
+    /**
+     * Identifies the current operating system family and initializes the platform hook accordingly.
+     * @since 1849
+     */
     public static void determinePlatformHook() {
         String os = System.getProperty("os.name");
@@ -853,14 +882,20 @@
         }
     }
-    public static void addListener() {
+    
+    protected static void addListener() {
         parent.addComponentListener(new WindowPositionSizeListener());
         ((JFrame)parent).addWindowStateListener(new WindowPositionSizeListener());
     }
 
+    /**
+     * Checks that JOSM is at least running with Java 6.
+     * @since 3815
+     */
     public static void checkJava6() {
         String version = System.getProperty("java.version");
         if (version != null) {
             if (version.startsWith("1.6") || version.startsWith("6") ||
-                    version.startsWith("1.7") || version.startsWith("7"))
+                    version.startsWith("1.7") || version.startsWith("7") ||
+                    version.startsWith("1.8") || version.startsWith("8"))
                 return;
             if (version.startsWith("1.5") || version.startsWith("5")) {
Index: /trunk/src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 5828)
+++ /trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 5829)
@@ -49,7 +49,9 @@
 
     private final class MainCaller extends Main {
-        private MainCaller() {
+        private MainCaller(Map<Option, Collection<String>> mapargs) {
+            addListener();
             setContentPane(contentPanePrivate);
             setJMenuBar(menu);
+            postConstructorProcessCmdLine(mapargs);
         }
     }
@@ -131,7 +133,6 @@
         Main.preConstructorInit(Option.fromStringMap(args));
         Main.parent = frame;
-        Main.addListener();
 
-        new MainCaller().postConstructorProcessCmdLine(Option.fromStringMap(args));
+        new MainCaller(Option.fromStringMap(args));
 
         MainMenu m = Main.main.menu; // shortcut
Index: /trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 5828)
+++ /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 5829)
@@ -64,9 +64,9 @@
 
     /**
-     * Construct an main frame, ready sized and operating. Does not
-     * display the frame.
+     * Constructs a main frame, ready sized and operating. Does not display the frame.
+     * @param mainFrame The main JFrame of the application
      */
     public MainApplication(JFrame mainFrame) {
-        super();
+        addListener();
         mainFrame.setContentPane(contentPanePrivate);
         mainFrame.setJMenuBar(menu);
@@ -223,4 +223,5 @@
     /**
      * Main application Startup
+     * @param argArray Command-line arguments
      */
     public static void main(final String[] argArray) {
@@ -343,5 +344,4 @@
 
         monitor.indeterminateSubTask(tr("Creating main GUI"));
-        Main.addListener();
         final Main main = new MainApplication(mainFrame);
 
@@ -404,5 +404,5 @@
                 }
 
-                main.postConstructorProcessCmdLine(args_final);
+                postConstructorProcessCmdLine(args_final);
 
                 DownloadDialog.autostartIfNeeded();
