Modify

Opened 4 weeks ago

Last modified 4 days ago

#24104 new enhancement

Remove deprecated functions

Reported by: gaben Owned by: team
Priority: trivial Milestone: 25.04
Component: Core Version:
Keywords: deprecation since Cc: taylor.smock

Description

As title says, no code change, just show when it was deprecated.

Using r19301.

Attachments (1)

Deprecated_annotation.patch (17.3 KB ) - added by gaben 4 weeks ago.

Download all attachments as: .zip

Change History (32)

comment:1 by stoecker, 4 weeks ago

What's the forRemoval? All the deprecations should be removed. We don't keep them.

comment:2 by gaben, 4 weeks ago

Oops, wait. The WireType rev number is wrong there. Digging...

by gaben, 4 weeks ago

Attachment: Deprecated_annotation.patch added

in reply to:  1 comment:3 by gaben, 4 weeks ago

Replying to stoecker:

What's the forRemoval? All the deprecations should be removed. We don't keep them.

Yeah, it didn’t add much value, so I removed it. Also, I couldn't figure out where the START_GROUP and END_GROUP members were coming from in WireType, so removed them from the patch as well.

comment:4 by stoecker, 4 weeks ago

Is there somewhere an 'Java used deprecations' tool which we can run over the compiled plugins?

Could help to trigger the plugin authors and also show what can be removed now without any issue.

Otherwise I'd recommend to drop anything older than a year and no longer used in josm and the team managed plugins. Anything still used there should be fixed BTW.

comment:5 by stoecker, 4 weeks ago

jdeprscan seems a tool to scan for deprecated usage.

Last edited 4 weeks ago by stoecker (previous) (diff)

comment:6 by stoecker, 4 weeks ago

Hmm. I couldn't find a single plugin using a deprecated function. Seems we can drop that stuff. Needs to verify that my call is correct (or does this only find deprecations of Java stuff?).

Copy all plugins to plugins/

Run:

P=plugins
J=josm-latest.jar
CP=$P/ejml.jar:$P/log4j.jar:$P/austriaaddresshelper.jar:$P/utilsplugin2.jar:$P/PicLayer.jar:$P/pmtiles.jar:$P/geojson.jar:$P/turnrestrictions.jar:$P/datepicker.jar:$P/Elevation.jar:$P/jts.jar:$P/apache-commons.jar:$P/matsim.jar:$P/pbf.jar

stdbuf -o0 -e0 jdeprscan --class-path $J:$CP $P/*.jar 2>&1

comment:7 by stoecker, 4 weeks ago

Aaaah: "The jdeprscan tool only identifies the deprecated APIs defined by Java SE. Deprecated APIs defined by third-party libraries aren’t reported." Why?

comment:8 by stoecker, 4 weeks ago

Ok. "jdeps" at least allows to identify used classes. Result: No plugin uses

  • org.openstreetmap.josm.gui.SplashScreen
  • org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox
  • org.openstreetmap.josm.gui.oauth.ManualAuthorizationUI
  • org.openstreetmap.josm.gui.oauth.FullyAutomaticAuthorizationUI
  • org.openstreetmap.josm.gui.io.importexport.GeoJSONImporter
  • org.openstreetmap.josm.data.protobuf.ProtobufPacked

so the deprecations in these can be removed without issue.

Now I need a way to find which functions are used :-)

comment:9 by gaben, 4 weeks ago

A quick question. Do we know all JOSM compatible services are migrated to Oauth2.0?

For the rest, I need some time.

comment:10 by stoecker, 4 weeks ago

As far as I know we no longer support OAuth 1, only Basic authentication.

comment:11 by stoecker, 4 weeks ago

Ah, jdeprscan has hidden options: --Xload-csv and --Xprint-csv. Seems I need to make a csv for our deprecations and then use that for scanning.

comment:12 by stoecker, 4 weeks ago

javap -s classfile return the function signature.

#jdepr1
METHOD,org/openstreetmap/josm/data/coor/LatLon,equalsEpsilon(Lorg/openstreetmap/josm/data/coor/LatLon;)Z,,false
METHOD,org/openstreetmap/josm/data/coor/LatLon,isOutSideWorld()Z,,false
METHOD,org/openstreetmap/josm/data/coor/LatLon,greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D,,false
METHOD,org/openstreetmap/josm/data/coor/LatLon,bearing(Lorg/openstreetmap/josm/data/coor/LatLon;)D,,false
METHOD,org/openstreetmap/josm/data/gpx/GpxImageEntry,getGpsTime()Ljava/util/Date;,,false
METHOD,org/openstreetmap/josm/data/gpx/GpxImageEntry,getExifGpsTime()Ljava/util/Date;,,false
CLASS,org/openstreetmap/josm/data/gpx/ImmutableGpxTrack,,,false
METHOD,org/openstreetmap/josm/data/gpx/WayPoint,setTime(J)V,,false
METHOD,org/openstreetmap/josm/data/gpx/WayPoint,getDate()Ljava/util/Date;,,false
FIELD,org/openstreetmap/josm/data/oauth/OAuthVersion,OAuth10a,,false
METHOD,org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive,getTimestamp()Ljava/util/Date;,,false
FIELD,org/openstreetmap/josm/data/osm/OsmUtils,trueval,,false
FIELD,org/openstreetmap/josm/data/osm/OsmUtils,falseval,,false
FIELD,org/openstreetmap/josm/data/osm/OsmUtils,reverseval,,false
CONSTRUCTOR,org/openstreetmap/josm/data/protobuf/ProtobufPacked,<init>(Ljava/io/ByteArrayOutputStream;[B)V,,false
METHOD,org/openstreetmap/josm/gui/io/importexport/GeoJSONImporter,parseDataSet(Ljava/lang/String;)Lorg/openstreetmap/josm/data/osm/DataSet;,,false
METHOD,org/openstreetmap/josm/gui/mappaint/MapPaintStyles,getNodeIcon(Lorg/openstreetmap/josm/data/osm/Tag;)Ljavax/swing/ImageIcon;,,false
CONSTRUCTOR,org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI,<init>(Ljava/lang/String;Ljava/util/concurrent/Executor;)V,,false
CONSTRUCTOR,org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI,<init>(Ljava/lang/String;Ljava/util/concurrent/Executor;)V,,false
CLASS,org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox,,,false
METHOD,org/openstreetmap/josm/gui/SplashScreen,finishTask()V,,false
METHOD,org/openstreetmap/josm/io/auth/CredentialsAgent,lookupOAuthAccessToken()Lorg/openstreetmap/josm/data/oauth/IOAuthToken;,,false
METHOD,org/openstreetmap/josm/io/auth/CredentialsAgent,storeOAuthAccessToken(Lorg/openstreetmap/josm/data/oauth/IOAuthToken;)V,,false

should thus be the search list.

Last edited 4 weeks ago by stoecker (previous) (diff)

comment:13 by stoecker, 4 weeks ago

Cc: taylor.smock added

Heho, that works!

Jar file extplugins/damn.jar: #24107

class org/openstreetmap/josm/plugins/damn/DamnDialog uses deprecated class org/openstreetmap/josm/data/gpx/ImmutableGpxTrack 

Jar file extplugins/Elevation.jar:

error: cannot resolve Methodref hhtznr/josm/plugins/elevation/data/SRTMTile.getLatLonEle:(Lorg/openstreetmap/josm/data/coor/ILatLon;)Lhhtznr/josm/plugins/elevation/data/LatLonEle;
error: cannot resolve Methodref hhtznr/josm/plugins/elevation/data/SRTMTileGrid.<init>:(Lhhtznr/josm/plugins/elevation/data/SRTMTileProvider;Lorg/openstreetmap/josm/data/Bounds;)V
error: cannot resolve Methodref hhtznr/josm/plugins/elevation/data/SRTMTile.getLatLonEleValues:(Lorg/openstreetmap/josm/data/coor/ILatLon;Lorg/openstreetmap/josm/data/coor/ILatLon;)[[Lhhtznr/josm/plugins/elevation/data/LatLonEle;

No idea what that is. Can't resolve own methods?


Jar file extplugins/intersection.jar:

class com/kaart/laneconnectivity/model/Route$Segment uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class com/kaart/laneconnectivity/gui/GuiContainer uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/kendzi3d-dev.jar:
Jar file extplugins/kendzi3d.jar:

class kendzi/josm/kendzi3d/data/producer/EditorObjectsProducer uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/markseen.jar:

class org/openstreetmap/josm/plugins/markseen/MarkSeenRoot uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/Tracer-testing.jar:

class org/openstreetmap/josm/plugins/tracer/connectways/GeomUtils uses deprecated method org/openstreetmap/josm/data/coor/LatLon::bearing(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/connectways/GeomUtils uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/connectways/WayEditor uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/modules/lpis/LpisRecord uses deprecated method org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon(Lorg/openstreetmap/josm/data/coor/LatLon;)Z 

Jar file extplugins/uberterracer.jar:

class uberterracer/UberTerracerAction uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class uberterracer/UberTerracerAction uses deprecated method org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon(Lorg/openstreetmap/josm/data/coor/LatLon;)Z 

Jar file svn_josm/dist/CustomizePublicTransportStop.jar:

error: cannot resolve Methodref org/openstreetmap/josm/plugins/customizepublictransportstop/NearestWaySegment.<init>:(Ljava/lang/Double;Lorg/openstreetmap/josm/data/osm/IWaySegment;Lorg/openstreetmap/josm/data/osm/Node;)V

Again, hmm?


Jar file svn_josm/dist/javafx.jar:

error: cannot resolve Methodref org/openstreetmap/josm/plugins/javafx/gui/JavaFxWrapper.setFocusTraversalKeysEnabled:(Z)V
error: cannot resolve Methodref org/openstreetmap/josm/plugins/javafx/gui/JavaFxWrapper.setScene:(Ljavafx/scene/Scene;)V
error: cannot resolve Methodref org/openstreetmap/josm/plugins/javafx/gui/JavaFxWrapper.isMinimumSizeSet:()Z
error: cannot resolve Methodref org/openstreetmap/josm/plugins/javafx/gui/JavaFxWrapper.isPreferredSizeSet:()Z

Hmm?


Jar file svn_josm/dist/MicrosoftStreetside.jar:

error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/cubemap/CameraTransformer.getTransforms:()Ljavafx/collections/ObservableList;
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBox.getTransforms:()Ljavafx/collections/ObservableList;
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/cubemap/CubemapBox.getChildren:()Ljavafx/collections/ObservableList;
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.getScene:()Ljavafx/scene/Scene;
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.setScene:(Ljavafx/scene/Scene;)V
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.revalidate:()V
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.repaint:()V
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/cubemap/CameraTransformer.getChildren:()Ljavafx/collections/ObservableList;
error: cannot resolve Methodref org/openstreetmap/josm/plugins/streetside/gui/imageinfo/ThreeSixtyDegreeViewerPanel.setScene:(Ljavafx/scene/Scene;)V

And Hmm. Probably I'm missing a classpath entry?


So essentially only 4 are used:

  • org/openstreetmap/josm/data/gpx/ImmutableGpxTrack
  • org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance
  • org/openstreetmap/josm/data/coor/LatLon::bearing
  • org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon

Everything else can be removed already now...

in reply to:  1 comment:14 by taylor.smock, 4 weeks ago

Replying to stoecker:

What's the forRemoval? All the deprecations should be removed. We don't keep them.

forRemoval will for a warning on compile, even if deprecation warnings are suppressed. See JEP 277 for further details.

We will probably have to do a minimum JOSM version bump for anything that uses those methods, since some of them are equalsEpsilon(LatLon) versus equalsEpsilon(ILatLon).

For javafx and StreetSide, you are probably missing JavaFX on the classpath/modulepath.


As a heads up, I was just laid off (I've got until February 7th), so my contributions will significantly decrease. One of the jobs I'm looking at applying for will likely have a conflict of interest if I keep working on JOSM, so I may have to completely stop working on JOSM. I'll see what I can do, but no promises.

comment:15 by stoecker, 4 weeks ago

That's very sad to hear. Good luck with your next job.

comment:16 by taylor.smock, 4 weeks ago

As I've said in my conversations with others, "life happens".
I've also been planning on AI taking my job, so won't hurt me as much as it might have. I've been saying that since 2021/2022, so I'm not as prepared as I was hoping to be, even though it wasn't AI taking my job.

comment:17 by stoecker, 4 weeks ago

I think that somebody who can debug code (like you) will be searched especially in AI times. For the near future AI stuff will insert hard to find issues needing a competent debugger. 😹

I believe you will have no bigger problem finding something else. You're good in what you do.

comment:18 by gaben, 4 weeks ago

Ah, I can really relate. The same thing happened to me exactly a year ago, and you’ve probably noticed my contributions have dropped since. It’s a tough situation, and I know how frustrating it can be.

This is a bit off-topic, but over the past year, I’ve been focusing more on personal development than my career. Still, whenever open source comes up, I always find myself talking about how much I’ve learned from you, Vincent, Dirk, Simon, Gerd, and the entire JOSM core team. I’d love to catch up with all of you sometime in the future! :)

By the way, this might be a good time to update the contributors section in the wiki and code - I don’t see your name there, Taylor.

comment:19 by taylor.smock, 4 weeks ago

For the near future AI stuff will insert hard to find issues needing a competent debugger

That is what I've heard from people who have tried to use code written by AI. I haven't used AI for coding myself -- I'm not personally satisfied with the copyright status of generated code. Especially when contributing to an OSS project.

By the way, this might be a good time to update the contributors section in the wiki and code - I don’t see your name there, Taylor.

As far as contributions go, I've always been more interested in the source code contributions -- it is one of the reasons why I spent a lot of time on the process of converting the JOSM plugin repo to git (even though I have failed, since it isn't IMO perfect yet). Speaking of which, I'll add @stoecker to my repo for that. Just so the work isn't lost.

comment:20 by stoecker, 4 weeks ago

Milestone: 25.0125.02

Ticket retargeted after milestone closed

comment:21 by stoecker, 3 weeks ago

Only

  • org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance
  • org/openstreetmap/josm/data/coor/LatLon::bearing
  • org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon

remain.

comment:22 by stoecker, 2 weeks ago

In 19319/josm:

see #24104, add deprecated dates for remaining used functions, patch by gaben (stripped down a lot)

comment:23 by stoecker, 2 weeks ago

In 19320/josm:

see #24104 - drop deprecated elements which aren't used anywhere

comment:24 by stoecker, 2 weeks ago

Current state:

  • Couldn't drop deprecation in splash screen, that fails to compile
  • there are some other deprecations already annotated, which need to be checked (I only checked the stuff in the initial patch)
  • ant complains about missing deprecate annotation for getColumn() and getLine() in src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/SimpleCharStream.java which I don't understand yet.

comment:25 by anonymous, 2 weeks ago

If you add a @Generated class notation to the generated file, it should fix the deprecation warning. I think I filed a ticket against JavaCC about that.

comment:26 by stoecker, 2 weeks ago

I checked JavaCC code and currently it's not possible to get rid of that warning. GENERATE_ANNOTATIONS=false would drop the warning, but still leave the code.

Needs an option to NOT generate deprecated code at all, which is missing.

That leaves the other two task to do.

comment:27 by stoecker, 2 weeks ago

In 19322/josm:

see #24104 - drop deprecated test

comment:28 by stoecker, 10 days ago

Jar file extplugins/Elevation.jar (https://github.com/hhtznr/JOSM-Elevation-Plugin/issues/5):

class hhtznr/josm/plugins/elevation/ElevationPreferences uses deprecated method org/openstreetmap/josm/tools/Utils::isBlank(Ljava/lang/String;)Z 

Jar file extplugins/intersection.jar:

class com/kaart/laneconnectivity/model/Route$Segment uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class com/kaart/laneconnectivity/gui/GuiContainer uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/kendzi3d-dev.jar:

class kendzi/josm/kendzi3d/data/producer/EditorObjectsProducer uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
Jar file extplugins/kendzi3d.jar:
class kendzi/josm/kendzi3d/data/producer/EditorObjectsProducer uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/MapRoulette.jar:

interface org/openstreetmap/josm/plugins/maproulette/api/model/AbstractNode overrides deprecated method org/openstreetmap/josm/data/osm/IPrimitive::getTimestamp()Ljava/util/Date; 
interface org/openstreetmap/josm/plugins/maproulette/api/model/AbstractNode overrides deprecated method org/openstreetmap/josm/data/osm/IPrimitive::setTimestamp(Ljava/util/Date;)V 

Jar file extplugins/mapwithai.jar:

class org/openstreetmap/josm/plugins/mapwithai/backend/DataConflationSender uses deprecated method org/openstreetmap/josm/tools/Utils::isBlank(Ljava/lang/String;)Z 
class org/openstreetmap/josm/plugins/mapwithai/backend/GetDataRunnable uses deprecated method org/openstreetmap/josm/tools/Utils::isBlank(Ljava/lang/String;)Z 
class org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtils uses deprecated method org/openstreetmap/josm/tools/Utils::isBlank(Ljava/lang/String;)Z 

Jar file extplugins/markseen.jar:

class org/openstreetmap/josm/plugins/markseen/MarkSeenRoot uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 

Jar file extplugins/Tracer-testing.jar:

class org/openstreetmap/josm/plugins/tracer/connectways/GeomUtils uses deprecated method org/openstreetmap/josm/data/coor/LatLon::bearing(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/connectways/GeomUtils uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/connectways/WayEditor uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class org/openstreetmap/josm/plugins/tracer/modules/lpis/LpisRecord uses deprecated method org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon(Lorg/openstreetmap/josm/data/coor/LatLon;)Z 

Jar file extplugins/Tracks2Map.jar:

class hhtznr/josm/plugins/tracks2map/Tracks2MapPlugin uses deprecated method org/openstreetmap/josm/tools/Utils::isBlank(Ljava/lang/String;)Z 

Jar file extplugins/uberterracer.jar:

class uberterracer/UberTerracerAction uses deprecated method org/openstreetmap/josm/data/coor/LatLon::greatCircleDistance(Lorg/openstreetmap/josm/data/coor/LatLon;)D 
class uberterracer/UberTerracerAction uses deprecated method org/openstreetmap/josm/data/coor/LatLon::equalsEpsilon(Lorg/openstreetmap/josm/data/coor/LatLon;)Z 
Last edited 10 days ago by stoecker (previous) (diff)

comment:29 by stoecker, 10 days ago

In 19328/josm:

see #24104 - removed deprecated functions

comment:30 by stoecker, 9 days ago

In 19330/josm:

see #24104 - removed deprecated functions

comment:31 by stoecker, 4 days ago

Milestone: 25.0225.04
Summary: [patch] Add since attribute to Deprecated annotationsRemove deprecated functions

Move forward a bit.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to gaben.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.