The 'jikes' Java compiler had its final release more than 18 years ago [1].
Therefore there is no point any more in having it supported in the 'javacomp'
and 'javacomp-script' modules.

[1] https://en.wikipedia.org/wiki/Jikes


2023-06-09  Bruno Haible  <br...@clisp.org>

        javacomp: Remove support for 'jikes'.
        * lib/javacomp.c (compile_using_jikes, is_jikes_present): Remove
        functions.
        (compile_java_class): Remove jikes related code.

        javacomp-script: Remove support for 'jikes'.
        * build-aux/javacomp.sh.in: Don't test HAVE_JIKES.
        * m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_JIKES. Don't set
        CONF_JAVAC to 'jikes'. Update comment.
        (gt_JAVACOMP_DISABLED): Don't set HAVE_JIKES.

>From 96afd2da4ef7a18e6ce1d3557daaf7dc65b5330d Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 16:08:18 +0200
Subject: [PATCH 1/2] javacomp-script: Remove support for 'jikes'.

* build-aux/javacomp.sh.in: Don't test HAVE_JIKES.
* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_JIKES. Don't set
CONF_JAVAC to 'jikes'. Update comment.
(gt_JAVACOMP_DISABLED): Don't set HAVE_JIKES.
---
 ChangeLog                |  8 ++++++++
 build-aux/javacomp.sh.in | 17 ++---------------
 m4/javacomp.m4           | 35 +----------------------------------
 3 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index de1b1eb08d..310927c36a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-09  Bruno Haible  <br...@clisp.org>
+
+	javacomp-script: Remove support for 'jikes'.
+	* build-aux/javacomp.sh.in: Don't test HAVE_JIKES.
+	* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_JIKES. Don't set
+	CONF_JAVAC to 'jikes'. Update comment.
+	(gt_JAVACOMP_DISABLED): Don't set HAVE_JIKES.
+
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
 	javacomp: Remove support for 'gcj'.
diff --git a/build-aux/javacomp.sh.in b/build-aux/javacomp.sh.in
index 470dfd0e1a..d049c95ccf 100644
--- a/build-aux/javacomp.sh.in
+++ b/build-aux/javacomp.sh.in
@@ -48,20 +48,7 @@ else
     test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
     exec $CONF_JAVAC "$@"
   else
-    if test -n "@HAVE_JIKES@"; then
-      # In this case, $CONF_JAVAC starts with "jikes".
-      # Combine given CLASSPATH and configured CLASSPATH.
-      if test -n "$CLASSPATH"; then
-        CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
-      else
-        CLASSPATH="$CONF_CLASSPATH"
-      fi
-      export CLASSPATH
-      test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
-      exec $CONF_JAVAC "$@"
-    else
-      echo 'Java compiler not found, try setting $JAVAC, then reconfigure' 1>&2
-      exit 1
-    fi
+    echo 'Java compiler not found, try setting $JAVAC, then reconfigure' 1>&2
+    exit 1
   fi
 fi
diff --git a/m4/javacomp.m4 b/m4/javacomp.m4
index 32570a016d..d9e1608e0b 100644
--- a/m4/javacomp.m4
+++ b/m4/javacomp.m4
@@ -1,4 +1,4 @@
-# javacomp.m4 serial 22
+# javacomp.m4 serial 23
 dnl Copyright (C) 2001-2003, 2006-2007, 2009-2023 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -239,17 +239,9 @@ AC_DEFUN([gt_JAVACOMP]
   dnl                -target 9 only possible with -source 1.6/1.7/1.8/9
   dnl                -target 10 only possible with -source 1.6/1.7/1.8/9/10
   dnl
-  dnl The support of jikes for target-version and source-version:
-  dnl
-  dnl   jikes 1.14 does not have a way to specify the target-version. It
-  dnl   always assumes target-version=1.1.
-  dnl
-  dnl   For jikes 1.14, the source-version always is 1.3.
-  dnl
   CONF_JAVAC=
   HAVE_JAVAC_ENVVAR=
   HAVE_JAVAC=
-  HAVE_JIKES=
   HAVE_JAVACOMP=
 changequote(,)dnl
   cat > conftestlib.java <<EOF
@@ -358,7 +350,6 @@ AC_DEFUN([gt_JAVACOMP]
     pushdef([AC_CHECKING],[:])dnl
     pushdef([AC_MSG_RESULT],[:])dnl
     AC_CHECK_PROG([HAVE_JAVAC_IN_PATH], [javac], [yes])
-    AC_CHECK_PROG([HAVE_JIKES_IN_PATH], [jikes], [yes])
     popdef([AC_MSG_RESULT])dnl
     popdef([AC_CHECKING])dnl
     popdef([AC_MSG_CHECKING])dnl
@@ -457,27 +448,6 @@ AC_DEFUN([gt_JAVACOMP]
         fi
       fi
     fi
-    if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JIKES_IN_PATH"; then
-      dnl Test whether jikes is usable.
-      if { jikes >/dev/null 2>/dev/null || test $? = 1; } \
-         && (
-              # See if the existing CLASSPATH is sufficient to make jikes work.
-              unset JAVA_HOME
-              jikes conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1
-              error=$?
-              rm -f conftestlib.class
-              exit $error
-            ); then
-        dnl OK, jikes works.
-        dnl Now test whether it supports the desired target-version and
-        dnl source-version.
-        if test "$source_version" = 1.3; then
-          CONF_JAVAC="jikes"
-          HAVE_JIKES=1
-          HAVE_JAVACOMP=1
-        fi
-      fi
-    fi
   fi
   rm -f conftest*.java conftest*.class
   if test -n "$HAVE_JAVACOMP"; then
@@ -491,7 +461,6 @@ AC_DEFUN([gt_JAVACOMP]
   AC_SUBST([CLASSPATH_SEPARATOR])
   AC_SUBST([HAVE_JAVAC_ENVVAR])
   AC_SUBST([HAVE_JAVAC])
-  AC_SUBST([HAVE_JIKES])
 ])
 
 # Simulates gt_JAVACOMP when no Java support is desired.
@@ -500,9 +469,7 @@ AC_DEFUN([gt_JAVACOMP_DISABLED]
   CONF_JAVAC=
   HAVE_JAVAC_ENVVAR=
   HAVE_JAVAC=
-  HAVE_JIKES=
   AC_SUBST([CONF_JAVAC])
   AC_SUBST([HAVE_JAVAC_ENVVAR])
   AC_SUBST([HAVE_JAVAC])
-  AC_SUBST([HAVE_JIKES])
 ])
-- 
2.34.1

>From b82e78320ba2d40f032f9df2d0c41cdc40653a42 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 16:11:23 +0200
Subject: [PATCH 2/2] javacomp: Remove support for 'jikes'.

* lib/javacomp.c (compile_using_jikes, is_jikes_present): Remove
functions.
(compile_java_class): Remove jikes related code.
---
 ChangeLog      |   5 +++
 lib/javacomp.c | 115 +------------------------------------------------
 2 files changed, 6 insertions(+), 114 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 310927c36a..8452637679 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
+	javacomp: Remove support for 'jikes'.
+	* lib/javacomp.c (compile_using_jikes, is_jikes_present): Remove
+	functions.
+	(compile_java_class): Remove jikes related code.
+
 	javacomp-script: Remove support for 'jikes'.
 	* build-aux/javacomp.sh.in: Don't test HAVE_JIKES.
 	* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_JIKES. Don't set
diff --git a/lib/javacomp.c b/lib/javacomp.c
index b3bef36ca1..ee3fe220eb 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -66,7 +66,6 @@
    $JAVAC   unknown     N  n/a            -O -g  true
    javac    JDK 1.1.8   Y  -classpath P   -O -g  javac 2>/dev/null; test $? = 1
    javac    JDK 1.3.0   Y  -classpath P   -O -g  javac 2>/dev/null; test $? -le 2
-   jikes    Jikes 1.14  N  -classpath P   -O -g  jikes 2>/dev/null; test $? = 1
 
    All compilers support the option "-d DIRECTORY" for the base directory
    of the classes to be written.
@@ -77,10 +76,7 @@
    We try the Java compilers in the following order:
      1. getenv ("JAVAC"), because the user must be able to override our
         preferences,
-     2. "javac", because it is a standard compiler,
-     3. "jikes", comes last because it has some deviating interpretation
-        of the Java Language Specification and because it requires a
-        CLASSPATH environment variable.
+     2. "javac", because it is a standard compiler.
 
    We unset the JAVA_HOME environment variable, because a wrong setting of
    this variable can confuse the JDK's javac.
@@ -420,62 +416,6 @@ compile_using_javac (const char * const *java_sources,
   return err;
 }
 
-/* Try to compile a set of Java sources with jikes.
-   Return a failure indicator (true upon error).  */
-static bool
-compile_using_jikes (const char * const *java_sources,
-                     unsigned int java_sources_count,
-                     const char *directory,
-                     bool optimize, bool debug,
-                     bool verbose, bool null_stderr)
-{
-  bool err;
-  unsigned int argc;
-  const char **argv;
-  const char **argp;
-  int exitstatus;
-  unsigned int i;
-
-  argc =
-    1 + (optimize ? 1 : 0) + (debug ? 1 : 0) + (directory != NULL ? 2 : 0)
-    + java_sources_count;
-  argv = (const char **) xmalloca ((argc + 1) * sizeof (const char *));
-
-  argp = argv;
-  *argp++ = "jikes";
-  if (optimize)
-    *argp++ = "-O";
-  if (debug)
-    *argp++ = "-g";
-  if (directory != NULL)
-    {
-      *argp++ = "-d";
-      *argp++ = directory;
-    }
-  for (i = 0; i < java_sources_count; i++)
-    *argp++ = java_sources[i];
-  *argp = NULL;
-  /* Ensure argv length was correctly calculated.  */
-  if (argp - argv != argc)
-    abort ();
-
-  if (verbose)
-    {
-      char *command = shell_quote_argv (argv);
-      printf ("%s\n", command);
-      free (command);
-    }
-
-  exitstatus = execute ("jikes", "jikes", argv, NULL,
-                        false, false, false, null_stderr,
-                        true, true, NULL);
-  err = (exitstatus != 0);
-
-  freea (argv);
-
-  return err;
-}
-
 /* ====================== Usability test subroutines ====================== */
 
 /* Write a given contents to a temporary file.
@@ -1062,30 +1002,6 @@ is_javac_usable (const char *source_version,
   return false;
 }
 
-static bool
-is_jikes_present (void)
-{
-  static bool jikes_tested;
-  static bool jikes_present;
-
-  if (!jikes_tested)
-    {
-      /* Test for presence of jikes: "jikes 2> /dev/null ; test $? = 1"  */
-      const char *argv[2];
-      int exitstatus;
-
-      argv[0] = "jikes";
-      argv[1] = NULL;
-      exitstatus = execute ("jikes", "jikes", argv, NULL,
-                            false, false, true, true,
-                            true, false, NULL);
-      jikes_present = (exitstatus == 0 || exitstatus == 1);
-      jikes_tested = true;
-    }
-
-  return jikes_present;
-}
-
 /* ============================= Main function ============================= */
 
 bool
@@ -1225,35 +1141,6 @@ compile_java_class (const char * const *java_sources,
         }
     }
 
-  if (is_jikes_present ())
-    {
-      /* Test whether it supports the desired target-version and
-         source-version.  */
-      bool usable = (strcmp (source_version, "1.3") == 0);
-
-      if (usable)
-        {
-          char *old_classpath;
-
-          /* Set CLASSPATH.  We could also use the "-classpath ..." option.
-             Since jikes doesn't come with its own standard library, it
-             needs a classes.zip or rt.jar or libgcj.jar in the CLASSPATH.
-             To increase the chance of success, we reuse the current CLASSPATH
-             if the user has set it.  */
-          old_classpath =
-            set_classpath (classpaths, classpaths_count, false, verbose);
-
-          err = compile_using_jikes (java_sources, java_sources_count,
-                                     directory, optimize, debug, verbose,
-                                     false);
-
-          /* Reset CLASSPATH.  */
-          reset_classpath (old_classpath);
-
-          goto done2;
-        }
-    }
-
   error (0, 0, _("Java compiler not found, try setting $JAVAC"));
   err = true;
 
-- 
2.34.1

Reply via email to