Modify

Opened 4 weeks ago

Last modified 28 hours ago

#15182 assigned enhancement

Standalone JOSM validator

Reported by: Don-vip Owned by: Don-vip
Priority: major Milestone: 17.10
Component: Core validator Version:
Keywords: modularization Cc:

Description (last modified by Don-vip)

During Java 9 compatibility effort (#11924) I wondered if modularization could be applied to JOSM, which currently is a big spaghetti-based monolithic jar.

A clean modular architecture would be a huge task (don't know if it would really be possible at all, as we have a lot of interwoven dependencies) but I'd like to see if we can achieve a more affordable intermediate state, where we could build a standalone version of JOSM validator that could be run as follows:

java -jar josm-validator.jar data.osm -o warnings.xml

This jar having no dependency on AWT/Swing/JavaFX. This way it could be run for example by a Java 9 server VM which does not include the java.desktop module.

It would not change anything on JOSM editor except probably some API changes, but as little as possible.

#14704 is a prerequisite.

Attachments (1)

validator-standalone.patch (9.7 KB) - added by Don-vip 4 weeks ago.

Download all attachments as: .zip

Change History (122)

comment:1 Changed 4 weeks ago by Don-vip

In 12620/josm:

see #15182 - deprecate all Main logging methods and introduce suitable replacements in Logging for most of them

comment:2 Changed 4 weeks ago by Don-vip

In 12621/josm:

see #15182 - do not print stacktrace by default for debug/trace levels, as before

comment:3 Changed 4 weeks ago by Don-vip

In 12624/josm:

see #15182 - remove unused imports

comment:4 Changed 4 weeks ago by Don-vip

In 12627/josm:

see #15182 - remove unneeded imports to Main

comment:5 Changed 4 weeks ago by Don-vip

In 12628/josm:

see #15182 - build.xml - define constants for values repeated multiple times (java version, jar filename)

comment:6 Changed 4 weeks ago by Don-vip

Description: modified (diff)

comment:7 Changed 4 weeks ago by Don-vip

In 12629/josm:

see #15182 - move GUI initialization stuff from Main (abstract) to gui.MainApplication

comment:8 Changed 4 weeks ago by stoecker

Hmm, wouldn't it be more "satisfactory" to first make JOSM callable as standalone validator at all before you make it fully encapsulated? Even with many useless internal dependencies that would be a useful application.

comment:9 Changed 4 weeks ago by Don-vip

sure!

comment:10 Changed 4 weeks ago by Don-vip

#14704 is a prerequisite :)

comment:11 Changed 4 weeks ago by Don-vip

In 12630/josm:

see #15182 - deprecate Main.map and Main.isDisplayingMapView(). Replacements: gui.MainApplication.getMap() / gui.MainApplication.isDisplayingMapView()

comment:12 Changed 4 weeks ago by Don-vip

In 12631/josm:

see #15182 - remove last calls to Main.map

comment:13 Changed 4 weeks ago by Don-vip

In 12632/josm:

see #15182 - fix unit tests

comment:14 Changed 4 weeks ago by Don-vip

In 12633/josm:

see #15182 - move GUI program arguments management from Main to gui.MainApplication

comment:15 Changed 4 weeks ago by Don-vip

In 12634/josm:

see #15182 - deprecate Main.worker, replace it by gui.MainApplication.worker + code refactoring to make sure only editor packages use it

comment:16 Changed 4 weeks ago by Don-vip

In 12635/josm:

see #15182 - checkstyle

comment:17 Changed 4 weeks ago by Don-vip

In 12636/josm:

see #15182 - deprecate Main.getLayerManager(). Replacement: gui.MainApplication.getLayerManager()

comment:18 Changed 4 weeks ago by Don-vip

In 12637/josm:

see #15182 - deprecate Main.toolbar. Replacement: gui.MainApplication.getToolbar()

comment:19 Changed 4 weeks ago by Don-vip

In 12638/josm:

see #15182 - remove Main.currentProgressMonitor. Replacement: PleaseWaitProgressMonitor.getCurrent()

comment:20 Changed 4 weeks ago by Don-vip

In 12639/josm:

see #15182 - deprecate shortcut handling and mapframe listener methods in Main. Replacement: same methods in gui.MainApplication

comment:21 Changed 4 weeks ago by Don-vip

Description: modified (diff)

comment:22 Changed 4 weeks ago by Don-vip

In 12641/josm:

see #15182 - deprecate Main.main.undoRedo. Replacement: gui.MainApplication.undoRedo

comment:23 Changed 4 weeks ago by Don-vip

In 12642/josm:

see #15182 - deprecate Main.main.panel. Replacement: gui.MainApplication.getMainPanel()

comment:24 Changed 4 weeks ago by Don-vip

In 12643/josm:

see #15182 - deprecate Main.main.menu. Replacement: gui.MainApplication.getMenu()

comment:25 Changed 4 weeks ago by stoecker

Hmm, I don't think undoRedo is really a GUI element. I can think of possible projects using it without a gui, as it is the central comnand handling instance.

comment:26 Changed 4 weeks ago by Don-vip

I can make it a singleton so it can be called outside of MainApplication.

comment:27 Changed 4 weeks ago by Don-vip

In 12644/josm:

see #15182 - remove dependence of I18n on GUI

comment:28 Changed 4 weeks ago by Don-vip

In 12645/josm:

see #15182 - remove last non-deprecated dependence of Main on GUI

comment:29 Changed 4 weeks ago by Don-vip

In 12647/josm:

see #15182 - remove unused method

comment:30 Changed 4 weeks ago by Don-vip

In 12648/josm:

see #15182 - refactor build.xml

comment:31 Changed 4 weeks ago by Don-vip

In 12649/josm:

see #15182 - code refactoring to avoid dependence on GUI packages from Preferences

comment:32 Changed 4 weeks ago by Don-vip

In 12650/josm:

see #15182 - convert MapCSS performance test to Java + update import

comment:33 Changed 4 weeks ago by Don-vip

In 12651/josm:

see #15182 - code refactoring to avoid dependence on GUI packages from MapPaintStyles

comment:34 Changed 4 weeks ago by Don-vip

In 12656/josm:

see #15182 - move SearchCompiler from actions.search to data.osm.search

comment:35 Changed 4 weeks ago by Don-vip

In 12659/josm:

see #15182 - extract SearchMode and SearchSetting from actions.search.SearchAction to data.osm.search

comment:36 Changed 4 weeks ago by Don-vip

In 12662/josm:

see #15182 - remove dependence on GUI from data.osm.search.SearchCompiler

comment:37 Changed 4 weeks ago by Don-vip

In 12663/josm:

see #15182 - move NameFormatter* from gui to data.osm

comment:38 Changed 4 weeks ago by Don-vip

In 12664/josm:

see #15182 - fix javadoc warning

comment:39 Changed 4 weeks ago by Don-vip

In 12665/josm:

see #15182 - fix #15186 - fix #15192 - fix initialization of Main.worker (regression)

comment:40 Changed 4 weeks ago by Don-vip

In 12666/josm:

see #15182 - fix #15193 - fix SearchCompiler

comment:41 Changed 4 weeks ago by Don-vip

In 12669/josm:

see #15182 - remove dependence on JMapViewer for package data.coor (only useful for imagery)

comment:42 Changed 4 weeks ago by Don-vip

In 12670/josm:

see #15182 - remove dependence on GUI for tools.PlatformHook

comment:43 Changed 4 weeks ago by Don-vip

In 12671/josm:

see #15182 - move file importers/exporters from io package to gui.io.importexport package, as they rely heavily on GUI and are mainly used from Open/Save actions

comment:44 Changed 4 weeks ago by Don-vip

In 12672/josm:

see #15182 - move ConflictCollection from OsmDataLayer to DataSet. Simplifies some code where a data set is enough, and a layer is not needed

comment:45 Changed 4 weeks ago by Don-vip

In 12673/josm:

see #15182 - move CyclicUploadDependencyException from actions.upload to data.osm (used in data.APIDataSet)

comment:46 Changed 4 weeks ago by Don-vip

In 12674/josm:

see #15182 - move PROP_SYSTEM_OF_MEASUREMENT from gui.preferences.ProjectionPreferences to data.SystemOfMeasurment

comment:47 Changed 4 weeks ago by Don-vip

In 12675/josm:

see #15182 - move the Swing-based ProgressMonitor implementations from gui.progress to gui.progress.swing. Progress monitor concept is used in very large parts of JOSM, a console-based implementation could be added later

comment:48 Changed 4 weeks ago by Don-vip

In 12676/josm:

see #15182 - PMD

comment:49 Changed 4 weeks ago by bastiK

Exciting to see all those changes towards a more modular structure! How are we doing with respect to the upcoming release, is everything considered stable?

comment:50 Changed 4 weeks ago by Don-vip

I think so. It requires some plugins to be updated (I'm on it) but it's often just moving classes around and updating the imports. I have finished with deprecating stuff in Main, I have now a lot of code that compiles without the GUI :)

comment:51 Changed 4 weeks ago by Don-vip

In 12678/josm:

see #15182 - move WindowGeometry from tools to gui.util

comment:52 Changed 4 weeks ago by Don-vip

In 12679/josm:

see #15182 - make actions.downloadtasks.Download*Task depend on io.OsmServerLocationReader, not the opposite

comment:53 Changed 4 weeks ago by Don-vip

In 12681/josm:

see #15182 - removed useless import

comment:54 Changed 4 weeks ago by Don-vip

In 12682/josm:

see #15182 - move GuiSizesHelper from gui.util to tools (only called from there)

comment:55 Changed 4 weeks ago by Don-vip

In 12683/josm:

see #15182 - transfer GUI dependencies from tools.TextTagParser to gui.datatransfer.importers.TextTagPaster

comment:56 Changed 4 weeks ago by Don-vip

In 12686/josm:

see #15182 - move OAuthAccessTokenHolder from gui.preferences.server to data.oauth

comment:57 Changed 4 weeks ago by Don-vip

In 12687/josm:

see #15182 - move UploadStrategySpecification and required enums from gui.io to io

comment:58 Changed 4 weeks ago by Don-vip

In 12688/josm:

see #15182 - refactor PurgeAction/PurgeCommand to avoid unneeded dependence on action

comment:59 Changed 4 weeks ago by Don-vip

In 12689/josm:

see #15182 - refactor MergeNodesAction to avoid unneeded GUI dependence in DuplicateNode test

comment:60 Changed 4 weeks ago by Don-vip

In 12690/josm:

see #15182 - build.xml fixes, required for standalone validator jar (problem unseen in complete compilation)

comment:61 Changed 4 weeks ago by Don-vip

In 12691/josm:

see #15182 - introduce Main.getEditDataSet to avoid unneeded GUI dependence in validator tests and tagging presets

comment:62 Changed 4 weeks ago by Don-vip

In 12695/josm:

see #15182 - refactor PlatformHookOsx so that all GUI actions are performed in MainApplication and only macOS-specific stuff remains in platform hook

Changed 4 weeks ago by Don-vip

Attachment: validator-standalone.patch added

comment:63 Changed 4 weeks ago by Don-vip

With current build.xml + this task:

    <!--
      ** build standalone validator jar.
    -->
    <target name="standalone-validator-jar" depends="clean,javacc,compile-cots,create-revision,check-schemas">
        <delete dir="validator-src"/>
        <delete dir="validator-build"/>
        <mkdir dir="validator-src"/>
        <copy todir="validator-src" includeemptydirs="false">
            <fileset dir="${src.dir}">
                <include name="org/openstreetmap/josm/*.java"/>
                <include name="org/openstreetmap/josm/command/*.java"/>
                <include name="org/openstreetmap/josm/data/**"/>
                <exclude name="org/openstreetmap/josm/data/imagery/**"/>
                <include name="org/openstreetmap/josm/gui/mappaint/**"/>
                <include name="org/openstreetmap/josm/gui/progress/**"/>
                <exclude name="org/openstreetmap/josm/gui/progress/swing/**"/>
                <include name="org/openstreetmap/josm/gui/tagging/presets/**"/>
                <include name="org/openstreetmap/josm/io/**"/>
                <exclude name="org/openstreetmap/josm/io/imagery/**"/>
                <exclude name="org/openstreetmap/josm/io/remotecontrol/**"/>
                <exclude name="org/openstreetmap/josm/io/session/**"/>
                <include name="org/openstreetmap/josm/tools/**"/>
            </fileset>
        </copy>
        <patch patchfile="patches/validator-standalone.patch" strip="1" dir="validator-src" failonerror="true"/>
        <mkdir dir="validator-build"/>
        <javac compiler="${javac.compiler}" sourcepath="" srcdir="validator-src" classpath="${build.dir}"
            destdir="validator-build" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
            <compilerclasspath>
                <pathelement location="${error_prone_ant.jar}"/>
            </compilerclasspath>
            <compilerarg value="-Xlint:cast"/>
            <compilerarg value="-Xlint:deprecation"/>
            <compilerarg value="-Xlint:dep-ann"/>
            <compilerarg value="-Xlint:divzero"/>
            <compilerarg value="-Xlint:empty"/>
            <compilerarg value="-Xlint:finally"/>
            <compilerarg value="-Xlint:overrides"/>
            <!--<compilerarg value="-Xlint:rawtypes"/>-->
            <compilerarg value="-Xlint:static"/>
            <compilerarg value="-Xlint:try"/>
            <compilerarg value="-Xlint:unchecked"/>
            <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
            <compilerarg value="-XDignore.symbol.file"/>
            <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg value="-Xep:ImmutableEnumChecker:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg value="-Xep:FutureReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg value="-Xep:FloatingPointLiteralPrecision:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg value="-Xep:ShortCircuitBoolean:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg value="-Xep:LiteralClassName:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
            <compilerarg line="-Xmaxerrs 1000"/>
        </javac>
        <copy todir="validator-build" failonerror="no" includeemptydirs="no">
            <fileset dir="resources"/>
        </copy>
    </target>

r12545 (current tested): 626 errors
r12695 (current trunk): 344 errors

The three main problems ahead are:

  • code relying on layers
  • mappaint code. we need the MapCSS code for MapCSS validator test. But we don't need all the renderers, etc.
  • tagging presets, very GUI-oriented right now. We need them also for validator tests, but not the GUI components

From all errors here are the packages missing the most, by order of occurrence:

      1  package org.openstreetmap.josm.actions.SplitWayAction does not exist
      1  package org.openstreetmap.josm.gui.dialogs.relation does not exist
      1  package org.openstreetmap.josm.gui.draw.MapViewPath does not exist
      1  package org.openstreetmap.josm.gui.help does not exist
      1  package org.openstreetmap.josm.gui.layer.markerlayer does not exist
      1  package org.openstreetmap.josm.gui.layer.OsmDataLayer does not exist
      1  package org.openstreetmap.josm.gui.oauth does not exist
      1  package org.openstreetmap.josm.gui.preferences.display does not exist
      1  package org.openstreetmap.josm.gui.preferences does not exist
      1  package org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel does not exist
      2  package org.openstreetmap.gui.jmapviewer does not exist
      2  package org.openstreetmap.josm.actions.JoinAreasAction does not exist
      2  package org.openstreetmap.josm.gui.bugreport does not exist
      2  package org.openstreetmap.josm.gui.dialogs does not exist
      2  package org.openstreetmap.josm.gui.dialogs.relation.sort does not exist
      2  package org.openstreetmap.josm.gui.io does not exist
      2  package org.openstreetmap.josm.plugins does not exist
      4  package org.openstreetmap.josm.gui.preferences.projection does not exist
      4  package org.openstreetmap.josm.gui.preferences.server does not exist
      6  package org.openstreetmap.josm.gui.layer.MainLayerManager does not exist
      8  package org.openstreetmap.josm.actions does not exist
      8  package org.openstreetmap.josm.gui.MapViewState does not exist
      8  package org.openstreetmap.josm.gui.tagging.ac does not exist
     12  package org.openstreetmap.josm.gui.layer.LayerManager does not exist
     12  package org.openstreetmap.josm.gui.util does not exist
     15  package org.openstreetmap.josm.gui.widgets does not exist
     16  package org.openstreetmap.josm.gui.draw does not exist
     22  package org.openstreetmap.josm.gui.layer does not exist

and here are the files with the most unresolved imports:

      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\AddCommand.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\AddPrimitivesCommand.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\ChangeCommand.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\PurgeCommand.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\cache\JCSCachedTileLoaderJob.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\cache\JCSCacheManager.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\ChangesetCache.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\DataSet.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\MapRendererFactory.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\OffsetIterator.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\PreferencesUtils.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\validation\tests\DuplicateNode.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\validation\tests\TagChecker.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\ElemStyles.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\mapcss\ExpressionFactory.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\AreaIconElement.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\MapImage.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\Symbol.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\items\Link.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\TaggingPresetSearchAction.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\TaggingPresetSearchPrimitiveDialog.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\MultiFetchOverpassObjectReader.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\MultiFetchServerObjectReader.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\OsmConnection.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\OsmWriter.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\bugreport\BugReport.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\bugreport\BugReportQueue.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\Geometry.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\ImageOverlay.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\ImageProvider.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\OsmUrlToBounds.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\PlatformHookWindows.java
      1 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\Shortcut.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\event\DatasetEventManager.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\FilterModel.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\AbstractMapRenderer.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\ArrowPaintHelper.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\projection\Projections.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\validation\OsmValidator.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\validation\PaintVisitor.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\validation\tests\PublicTransportRouteTest.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\NodeElement.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\placement\CompletelyInsideAreaStrategy.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\placement\PartiallyInsideAreaStrategy.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\placement\PositionForAreaStrategy.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\items\Check.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\TaggingPresetSelector.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\auth\AbstractCredentialsAgent.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\auth\JosmPreferencesCredentialAgent.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\DefaultProxySelector.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\GeoJSONWriter.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\MessageNotifier.java
      2 \SVN\josm\core\validator-src\org\openstreetmap\josm\io\OsmApi.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\Command.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\event\SelectionEventManager.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\StyledMapRenderer.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\WireframeMapRenderer.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\TaggingPresetItem.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\bugreport\BugReportSender.java
      3 \SVN\josm\core\validator-src\org\openstreetmap\josm\tools\RightAndLefthandTraffic.java
      4 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\history\HistoryDataSet.java
      4 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\styleelement\placement\OnLineStrategy.java
      4 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\items\Combo.java
      4 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\items\Text.java
      5 \SVN\josm\core\validator-src\org\openstreetmap\josm\command\DeleteCommand.java
      5 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\osm\visitor\paint\relations\MultipolygonCache.java
      6 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\tagging\presets\TaggingPreset.java
      7 \SVN\josm\core\validator-src\org\openstreetmap\josm\data\UndoRedoHandler.java
      7 \SVN\josm\core\validator-src\org\openstreetmap\josm\gui\mappaint\MapPaintMenu.java

comment:64 Changed 4 weeks ago by Don-vip

In 12696/josm:

see #15182 - remove deprecation of Main.undoRedo until I figure how to deal with this class

comment:65 in reply to:  description Changed 3 weeks ago by bastiK

Replying to Don-vip:

During Java 9 compatibility effort (#11924) I wondered if modularization could be applied to JOSM, which currently is a big spaghetti-based monolithic jar.

A clean modular architecture would be a huge task (don't know if it would really be possible at all, as we have a lot of interwoven dependencies) but I'd like to see if we can achieve a more affordable intermediate state, where we could build a standalone version of JOSM validator that could be run as follows:

java -jar josm-validator.jar data.osm -o warnings.xml

This jar having no dependency on AWT/Swing/JavaFX. This way it could be run for example by a Java 9 server VM which does not include the java.desktop module.

I have similar long-term ideas, namely a stanalone MapCSS renderer and a projection library. Both should run in headless mode as well and come with command line arguments for basic use. After you've done the groundwork, it should be a piece of cake! ;)

comment:66 Changed 3 weeks ago by Don-vip

Well maybe I will need your help for the MapCSS part :)

comment:67 Changed 3 weeks ago by michael2402

When doing this, wouldn't it be wise to externalize that code completely?

It will make it much easier to re-use and normal contributors will be less likely to break things since the "normal" build will fail as well if the dependencies are not met.

I'd suggest the following for now:

  • josm
    • DataSet (+ all data set related classes)
    • MapCSS
      • DataSet
      • MapPainting (Projection, MapView point conversion, MapViewPaintable)
    • Imagery
      • MapPainting
    • Commands (that modify the data set)
      • DataSet

Everything depends on data set for now.

For the preferences, I'd suggest to use a separate module for the storage classes. We can then use those preferences in the MapCSS/MapPainting/... modules and keep the user interface code for them in josm main for now.

comment:68 Changed 3 weeks ago by Don-vip

Milestone: 17.09

comment:69 Changed 3 weeks ago by Don-vip

This doesn't work. Validator depends on MapCSS, but I don't want it to depend on MapView, which extends JComponent and imports a lot of awt/swing classes. I haven't looked exactly yet how to split the MapCSS parsing from the MapView/paint code.

The first step is to cut Swing out of our core data classes. That's I am trying to achieve. We'll see next how/if we can modularize further.

comment:70 Changed 3 weeks ago by bastiK

We can start with very informal modules, i.e. move some of the .java files into different directories. In terms of the build process, there is almost no change at all, we simply tell javac to find the source files in multiple directories.

Then, gradually, the dependency structure can be carved out more clearly, eventually to be turned into proper Java 9 modules.

Here is a possible directory structure:

modules
    |- org.openstreetmap.josm.app
        |- src
        |- build.xml
    |- org.openstreetmap.josm.validator
        |- src
            |- main
                |- java
                    |- module-info.java
                    |- org/openstreetmap/josm/data/validation/*.java
                |- resources
                    |- ignoretags.cfg
                    |- deprecated.mapcss
                     ...
            |- test
                |- java
                |- resources
        |- build.xml
    |- org.openstreetmap.josm.mapcss
    |- org.openstreetmap.josm.projection
    |- org.openstreetmap.jmapviewer
     ...
build.xml
README

The directory names (org.openstreetmap.josm.validator, ...) are the names of later the Java 9 modules as per the module naming convention.

Switching to the standard Maven directory layout for each module (like in the draft) would be neither a big advantage nor disadvantage. On the plus side, it may be easier for new developers who are familiar with the Maven layout.

One question that remains, is if all this is worthwhile and achievable or a hopeless endeavor. ;)

comment:71 Changed 3 weeks ago by Don-vip

That's about what I had in mind for the long term :)
It is worthwile. Once we have clean modules we can publish them to Maven Central. I'd like to see JOSM core classes become the standard OSM Java library :) There would be no need for other people to create their own (osm-common or osmapi for example)

comment:72 Changed 3 weeks ago by Don-vip

In 12718/josm:

see #13036 - see #15229 - see #15182 - make Commands depends only on a DataSet, not a Layer. This removes a lot of GUI dependencies

comment:73 Changed 3 weeks ago by Don-vip

In 12734/josm:

see #15182 - see #15229 - remove GUI dependence in NoteData

comment:74 Changed 3 weeks ago by Don-vip

In 12742/josm:

see #15229 - see #15182 - remove useless dependence of Geometry on GUI now that MultipolygonCache does not need anymore a MapView

comment:75 Changed 3 weeks ago by Don-vip

In 12743/josm:

see #15229 - see #15182 - deprecate gui.JosmUserIdentityManager - replaced by data.UserIdentityManager

comment:76 Changed 3 weeks ago by Don-vip

In 12744/josm:

see #15229 - see #15182 - remove GUI dependence of PlatformHookWindows - move workaround to MainApplication

comment:77 Changed 3 weeks ago by Don-vip

In 12747/josm:

see #15229 - see #15182 - fix unit tests

comment:78 Changed 3 weeks ago by Don-vip

In 12748/josm:

see #15229 - see #15182 - deprecate GuiHelper.getMenuShortcutKeyMaskEx() - replaced by PlatformHook.getMenuShortcutKeyMaskEx()

comment:79 Changed 3 weeks ago by Don-vip

In 12749/josm:

see #15229 - see #15182 - see #13036 - remove GUI stuff from Command and DeleteCommand

comment:80 Changed 3 weeks ago by Don-vip

In 12750/josm:

see #15229 - see #15182 - fix unit tests

comment:81 Changed 3 weeks ago by Don-vip

r12750 is down to 282 errors. List of problematic files:

org/openstreetmap/josm/command/DeleteCommand.java
org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
org/openstreetmap/josm/data/cache/JCSCacheManager.java
org/openstreetmap/josm/data/osm/ChangesetCache.java
org/openstreetmap/josm/data/osm/DataSet.java
org/openstreetmap/josm/data/osm/event/DatasetEventManager.java
org/openstreetmap/josm/data/osm/event/SelectionEventManager.java
org/openstreetmap/josm/data/osm/FilterModel.java
org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
org/openstreetmap/josm/data/osm/visitor/paint/ArrowPaintHelper.java
org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
org/openstreetmap/josm/data/osm/visitor/paint/OffsetIterator.java
org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java
org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
org/openstreetmap/josm/data/PreferencesUtils.java
org/openstreetmap/josm/data/projection/Projections.java
org/openstreetmap/josm/data/validation/OsmValidator.java
org/openstreetmap/josm/data/validation/PaintVisitor.java
org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
org/openstreetmap/josm/data/validation/tests/TagChecker.java
org/openstreetmap/josm/gui/mappaint/ElemStyles.java
org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java
org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
org/openstreetmap/josm/gui/mappaint/styleelement/placement/CompletelyInsideAreaStrategy.java
org/openstreetmap/josm/gui/mappaint/styleelement/placement/OnLineStrategy.java
org/openstreetmap/josm/gui/mappaint/styleelement/placement/PartiallyInsideAreaStrategy.java
org/openstreetmap/josm/gui/mappaint/styleelement/placement/PositionForAreaStrategy.java
org/openstreetmap/josm/gui/mappaint/styleelement/Symbol.java
org/openstreetmap/josm/gui/tagging/presets/items/Check.java
org/openstreetmap/josm/gui/tagging/presets/items/Combo.java
org/openstreetmap/josm/gui/tagging/presets/items/Link.java
org/openstreetmap/josm/gui/tagging/presets/items/Text.java
org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchAction.java
org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java
org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java
org/openstreetmap/josm/io/DefaultProxySelector.java
org/openstreetmap/josm/io/GeoJSONWriter.java
org/openstreetmap/josm/io/MessageNotifier.java
org/openstreetmap/josm/io/MultiFetchOverpassObjectReader.java
org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
org/openstreetmap/josm/io/OsmApi.java
org/openstreetmap/josm/io/OsmConnection.java
org/openstreetmap/josm/io/OsmWriter.java
org/openstreetmap/josm/tools/bugreport/BugReport.java
org/openstreetmap/josm/tools/bugreport/BugReportQueue.java
org/openstreetmap/josm/tools/bugreport/BugReportSender.java
org/openstreetmap/josm/tools/ImageOverlay.java
org/openstreetmap/josm/tools/ImageProvider.java
org/openstreetmap/josm/tools/OsmUrlToBounds.java
org/openstreetmap/josm/tools/RightAndLefthandTraffic.java

comment:82 Changed 2 weeks ago by Don-vip

In 12751/josm:

see #15229 - see #15182 - see #13036 - update unit tests and groovy script

comment:83 Changed 2 weeks ago by Don-vip

In 12752/josm:

see #15229 - see #15182 - see #13036 - fix groovy script

comment:84 Changed 2 weeks ago by Don-vip

In 12754/josm:

see #15229 - see #15182 - see #13036 - update unit tests

comment:85 Changed 2 weeks ago by Don-vip

In 12755/josm:

see #15229 - see #15182 - make Main to not depend on JCS

comment:86 Changed 2 weeks ago by Don-vip

In 12756/josm:

see #15229 - see #15182 - move RotationAngle from gui.util to tools

comment:87 Changed 2 weeks ago by Don-vip

In 12757/josm:

see #15229 - see #15182 - see #13036 - update fixture for performance tests

comment:88 Changed 2 weeks ago by Don-vip

In 12758/josm:

see #15229 - see #15182 - deprecate DataSet.getAutoCompletionManager() - replacement: AutoCompletionManager.of(DataSet)

comment:89 Changed 2 weeks ago by Don-vip

In 12760/josm:

see #15229 - see #15182 - see #13036 - remove more GUI stuff from DeleteCommand

comment:90 Changed 2 weeks ago by Don-vip

In 12761/josm:

see #15229 - see #15182 - see #13036 - fix stupid mistake

comment:91 Changed 2 weeks ago by Don-vip

In 12763/josm:

see #15229 - see #15182 - see #13036 - remove last GUI stuff from DeleteCommand

comment:92 Changed 2 weeks ago by Don-vip

In 12764/josm:

see #15229 - see #15182 - fix unit test

comment:93 Changed 2 weeks ago by Don-vip

In 12766/josm:

see #15229 - see #15182 - remove GUI stuff from MessageNotifier

comment:94 Changed 2 weeks ago by Don-vip

In 12767/josm:

see #15229 - see #15182 - do not longer fire ChangesetCacheEvent in EDT - now up to listeners to run their code in it if required

comment:95 Changed 2 weeks ago by Don-vip

In 12782/josm:

see #15229 - see #15182 - move ImageProcessor from gui.layer to tools

comment:96 Changed 2 weeks ago by bastiK

In 12786/josm:

see #15182 - remove GUI references from Projections class

comment:97 Changed 2 weeks ago by Don-vip

In 12790/josm:

see #15229 - see #15182 - remove GUI references from BugReportSender

comment:98 Changed 2 weeks ago by Don-vip

In 12791/josm:

see #15229 - see #15182 - javadoc fixes

comment:99 Changed 2 weeks ago by bastiK

In 12792/josm:

closes #15273, see #15229, see #15182 - add command line interface module for projections

  • run josm project --help to see the options
  • extracts parser from LatLon and CustomProjection into LatLonParser

comment:100 Changed 2 weeks ago by bastiK

In 12793/josm:

see #15273, see #15229, see #15182 - add missing class

comment:101 Changed 2 weeks ago by Don-vip

In 12796/josm:

see #15229 - see #15182 - remove GUI references from OsmUrlToBounds

comment:102 Changed 2 weeks ago by Don-vip

In 12799/josm:

see #15229 - see #15182 - see #14794 - move Multi* GUI classes from tools to gui.util

comment:103 Changed 2 weeks ago by Don-vip

In 12800/josm:

see #15229 - see #15182 - deprecate OsmWriter.writeLayer(OsmDataLayer) - replacement: OsmWriter.write(DataSet)

comment:104 Changed 2 weeks ago by Don-vip

In 12803/josm:

see #15229 - see #15182 - remove GUI references from OsmConnection

comment:105 Changed 2 weeks ago by Don-vip

In 12804/josm:

see #15229 - see #15182 - remove GUI references from OsmApi

comment:106 Changed 2 weeks ago by Don-vip

In 12805/josm:

see #15229 - see #15182 - remove GUI references from DefaultProxySelector

comment:107 Changed 2 weeks ago by Don-vip

In 12806/josm:

see #15229 - see #15182 - remove GUI references from GeoJSONWriter

comment:108 Changed 2 weeks ago by Don-vip

In 12807/josm:

see #15229 - see #15182 - see #14794 - checkstyle, unit tests

comment:109 Changed 13 days ago by Don-vip

In 12816/josm:

see #15229 - see #15182 - remove GUI references from I/O subsystem

comment:110 Changed 13 days ago by Don-vip

In 12821/josm:

see #15229 - see #15182 - remove GUI references from I/O subsystem

comment:111 Changed 12 days ago by Don-vip

In 12823/josm:

see #15229 - see #15182 - move PaintVisitor from data.validation to gui.layer.validation

comment:112 Changed 12 days ago by Don-vip

In 12825/josm:

see #15229 - see #15182 - make FileWatcher generic so it has no more dependence on MapCSS

comment:113 Changed 12 days ago by Don-vip

In 12826/josm:

see #15229 - see #15182 - remove GUI references from PreferencesUtils

comment:114 Changed 11 days ago by Don-vip

In 12828/josm:

see #15229 - see #15182 - see #13036 - convert SplitWayAction to SplitWayCommand to remove dependence of DeleteCommand on actions package

comment:115 Changed 11 days ago by Don-vip

In 12834/josm:

see #15229 - see #15182 - move TaggingPresetSearchAction to actions package

comment:116 Changed 11 days ago by Don-vip

In 12835/josm:

see #15229 - see #15182 - remove GUI references from TaggingPresetItem

comment:117 Changed 9 days ago by Don-vip

In 12859/josm:

see #15229 - see #15182 - deprecate non-GUI AutoCompletion* classes from gui.tagging.ac. Offer better replacements in new data.tagging.ac package

comment:118 Changed 8 days ago by Don-vip

In 12869/josm:

see #15229 - see #15182 - SonarQube - squid:S2444 - make static fields volatile

comment:119 Changed 7 days ago by Don-vip

In 12870/josm:

see #15229 - see #15182 - remove dependence of ImageProvider on PluginHandler

comment:120 Changed 39 hours ago by Don-vip

Milestone: 17.0917.10

comment:121 Changed 28 hours ago by simon04

In 12886/josm:

see #15229 - see #15182 - fix typo

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Don-vip.
as The resolution will be set.
to The owner will be changed from Don-vip to the specified user.
The owner will change to Don-vip
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.