Modify

Opened 3 months ago

Last modified 3 months ago

#24467 new defect

Cannot complile JOSM using Eclipse

Reported by: GerdP Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc: taylor.smock

Description (last modified by GerdP)

I don't know since when, but my Eclipse installation no longer worked. So I started with a fresh installation using
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2025-09/R/eclipse-java-2025-09-R-win32-x86_64.zip&mirror_id=1285
and an empty workspace.
I followed the steps described in the wiki https://josm.openstreetmap.de/wiki/DevelopersGuide/Compiling
After importing the project c:\josm\core the build is started automatically and ends with a popup showing

Errors occurred during the build.
Errors running builder 'Java Builder' on project 'josm'.
Internal Error compiling /josm/src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java

The log window shows two more problems.

The problem remains when I do "Maven -> Update Project... -> Select All -> OK"

Attachments (1)

Screenshot 2025-09-16 074741.png (27.2 KB ) - added by GerdP 3 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 by GerdP, 3 months ago

Description: modified (diff)

comment:2 by GerdP, 3 months ago

Description: modified (diff)

comment:3 by GerdP, 3 months ago

Description: modified (diff)

comment:4 by stoecker, 3 months ago

Cc: taylor.smock added

Internal error sounds much like a bug in eclipse or the toolchain.

Does it help to run maven once by hand. Maybe that skips the problematic file?

comment:5 by GerdP, 3 months ago

Yes, it is probably an error in Eclipse. I tried with mvn compile. This is the log which looks similar to that produced with ant clean dist.
I didn't use maven before. How do I create the josm.jar without running all the unit tests?

c:\josm\core>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< org.openstreetmap.josm:josm >---------------------
[INFO] Building josm 1.5-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- enforcer:3.5.0:enforce (enforce-versions) @ josm ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO]
[INFO] --- checkstyle:3.5.0:check (validate) @ josm ---
[INFO] You have 0 Checkstyle violations.
[INFO]
[INFO] --- buildnumber:3.2.1:create (default) @ josm ---
[INFO] Get info from versioned directory: c:\josm\core
[INFO] Storing buildNumber: 19440 at timestamp: 1758005639100
[INFO] Get info from versioned directory: c:\josm\core
[INFO] Storing scmBranch: trunk
[INFO]
[INFO] --- dependency:3.7.0:properties (default) @ josm ---
[INFO]
[INFO] --- javacc:3.1.0:javacc (javacc) @ josm ---
Java Compiler Compiler Version 7.0.13 (Parser Generator)
(type "javacc" with no arguments for help)
Warning: Bad option value in "-JDK_VERSION=11" will be ignored.
Reading from file c:\josm\core\src\org\openstreetmap\josm\gui\mappaint\mapcss\MapCSSParser.jj . . .
Warning: Line 4, Column 3: Command line setting of "OUTPUT_DIRECTORY" modifies option value in file.
Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
File "TokenMgrError.java" does not exist.  Will create one.
File "ParseException.java" does not exist.  Will create one.
File "Token.java" does not exist.  Will create one.
File "SimpleCharStream.java" does not exist.  Will create one.
Parser generated with 0 errors and 1 warnings.
[INFO] Processed 1 grammar
[INFO]
[INFO] --- resources:3.3.1:copy-resources (copy-root-resources) @ josm ---
[INFO] Copying 2 resources from  to target\classes
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ josm ---
[INFO] Copying 1387 resources from resources to target\classes
[INFO] Copying 5 resources from  to target\classes
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ josm ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 1890 source files with javac [debug release 11] to target\classes
[INFO] /c:/josm/core/src/org/openstreetmap/josm/actions/mapmode/MapMode.java: c:\josm\core\src\org\openstreetmap\josm\actions\mapmode\MapMode.java verwendet oder überschreibt eine veraltete API.
[INFO] /c:/josm/core/src/org/openstreetmap/josm/actions/mapmode/MapMode.java: Wiederholen Sie die Kompilierung mit -Xlint:deprecation, um Details zu erhalten.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:08 min
[INFO] Finished at: 2025-09-16T08:54:27+02:00
[INFO] ------------------------------------------------------------------------

comment:6 by GerdP, 3 months ago

Forgot to answer the question: The mvn compile didn't help with the Eclipse problems.

comment:7 by stoecker, 3 months ago

mvn package -DskipTests should do that.

comment:8 by taylor.smock, 3 months ago

I also got the error

Internal compiler error: java.lang.RuntimeException: Internal Error compiling /josm/src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java at org.eclipse.jdt.internal.compiler.ProcessTaskManager.processing(ProcessTaskManager.java:139)

Eclipse doesn't even like opening the file.

I've done a little bit of debugging, and it doesn't like

      /**
       * Pass-through to {@link JButton#JButton()} allowing associated popup menu to be set
       * @param m the associated popup menu
       */
      public PopupMenuButton(JPopupMenu m) {
          super();
          this.initialize(m); // W: warning: [this-escape] possible 'this' escape before subclass is fully initialized
      }

More specifically, it doesn't like the {@link JButton#JButton()} bit. Removing the () "fixes" the issue.

Here is a diff, if you want to apply it:

  • src/org/openstreetmap/josm/gui/widgets/PopupMenuButton.java

     
    7272    }
    7373
    7474    /**
    75      * Pass-through to {@link JButton#JButton()} allowing associated popup menu to be set
     75     * Pass-through to {@link JButton#JButton} allowing associated popup menu to be set
    7676     * @param m the associated popup menu
    7777     */
    7878    public PopupMenuButton(JPopupMenu m) {

I'm going to report a bug against Eclipse, if I can find the right place.

comment:9 by GerdP, 3 months ago

Great. Many thanks, Taylor. I didn't even consider that the source itself could be the problem :O

comment:10 by taylor.smock, 3 months ago

No problem.
I've just finished reporting the bug upstream (see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4401 ).

comment:11 by GerdP, 3 months ago

My freshly installed Eclipse complains about these parameters:

                -javaagent:${com.ginsberg:junit5-system-exit:jar}
                -javaagent:${org.jmockit:jmockit:jar}

I guess I have to install additional software. Can you point me to the right locations?

comment:12 by taylor.smock, 3 months ago

Eclipse should automatically replace the ${com.ginsberg.junit5-system-exit:jar} and ${org.jmockit:jmockit:jar} with the path to the jar (on Linux, ~/.m2/repository/com/ginsberg/junit5-system-exit/2.0.2/junit5-system-exit-2.0.2.jar and ~/.m2/repository/org/jmockit/jmockit/1.49.a/jmockit-1.49.a.jar).

comment:13 by GerdP, 3 months ago

Well, I have those jar files but Eclipse doesn't replace anything. I get "Reference to undefined variable com.ginsberg".
I am pretty sure that this worked in the past, but it now also happens with the old eclipse installation, so I guess something in the new workspace folder is now missing. I didn't create a backup for that :(

For now, I replace the variables with fixed paths...

comment:14 by GerdP, 3 months ago

In 19442/josm:

See #24467: Cannot complile JOSM using Eclipse

  • fix javadoc error which causes internal error in Eclipse (patch by taylor.smock)

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 GerdP.
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.