unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Daniel Głowacki" <dglowacki4@gmail.com>
Cc: 72402@debbugs.gnu.org
Subject: bug#72402: 28.2; Etags does not parse correctly Java source code
Date: Thu, 01 Aug 2024 11:16:31 +0300	[thread overview]
Message-ID: <86wml0wtcw.fsf@gnu.org> (raw)
In-Reply-To: <87le1hr38a.fsf@hpg6> (message from Daniel Głowacki on Wed, 31 Jul 2024 17:27:33 +0200)

> From: Daniel Głowacki <dglowacki4@gmail.com>
> Date: Wed, 31 Jul 2024 17:27:33 +0200
> 
> I have found a bug while using 'etags' program for parsing Java files.
> Some of Java files are not parsed as they should be. Important parts
> of the code is missing.
> 
> Some example below:
> ===================
> JAVA VERSION: OpendJDK version 22
> SOURCE FILE: $(JAVA_HOME)/lib/src/java.base/java/util/HashMap.java
> 
> ...
> 
> public class HashMap<K,V> extends AbstractMap<K,V>
>     implements Map<K,V>, Cloneable, Serializable {
> 
>     @java.io.Serial
>     private static final long serialVersionUID = 362498820763181265L;
> 
> ...
> 
> 'TAGS' FILE CREATED BY 'ETAGS':
> 
> ...
> 
> src/java.base/java/util/HashMap.java,2267
>     implements Map<\x7fMap%1140,6932
>     implements Map<K,V>, Cloneable,\x7f140,6932
>     final class KeySet \x7f988,39333
>         public final int size(\x7f989,39381
>         public final void clear(\x7f990,39446
>         public final Iterator<K> iterator(\x7f991,39520
>         public final boolean contains(\x7f992,39598
>         public final boolean remove(\x7f993,39673
>         public final Spliterator<K> spliterator(\x7f996,39807
>         public Object[] toArray(\x7f1000,39938
>         public <T> T[] toArray(\x7f1004,40035
>         public final void forEach(\x7f1008,40135
>     final class Values \x7f1048,41686
>         public final int size(\x7f1049,41741
>         public final void clear(\x7f1050,41806
>         public final Iterator<V> iterator(\x7f1051,41880
>         public final boolean contains(\x7f1052,41960
>         public final Spliterator<V> spliterator(\x7f1053,42037
>         public Object[] toArray(\x7f1057,42170
>         public <T> T[] toArray(\x7f1061,42269
>         public final void forEach(\x7f1065,42371
>     final class EntrySet \x7f1102,43948
>         public final int size(\x7f1103,44011
>         public final void clear(\x7f1104,44076
>         public final Iterator<Map.Entry<K,V>> iterator(\x7f1105,44150
>         public final boolean contains(\x7f1108,44259
>         public final boolean remove(\x7f1115,44546
>         public final Spliterator<Map.Entry<K,V>> spliterator(\x7f1123,44858
>         public final void forEach(\x7f1126,45003
>     private static final class UnsafeHolder \x7f1567,60383
>         private UnsafeHolder(\x7f1568,60429
>         static void putLoadFactor(\x7f1573,60725
>     abstract class HashIterator \x7f1581,60945
>         Node<\x7fNode%11582,60979
>         Node<K,V> next;\x7f1582,60979
>         Node<\x7fNode%11583,61034
>         Node<K,V> current;\x7f1583,61034
>         int expectedModCount;\x7f1584,61082
>         int index;\x7f1585,61130
>         HashIterator(\x7f1587,61178
>         public final boolean hasNext(\x7f1597,61508
>         final Node<\x7fNode%11601,61593
>         final Node<K,V> nextNode(\x7f1601,61593
>         public final void remove(\x7f1614,62079
>     final class KeyIterator \x7f1626,62481
>         public final K next(\x7f1628,62563
>     final class ValueIterator \x7f1631,62627
>         public final V next(\x7f1633,62711
>     final class EntryIterator \x7f1636,62777
>         public final Map.Entry<\x7fEntry%11638,62874
>         public final Map.Entry<K,V> next(\x7f1638,62874
> 
> ....
> 
> The class declaration of HashMap is missing. It works for other files,
> e.g. ArrayJava.java

Hmm... "etags --help" doesn't seem to indicate that classes are
tagged:

  etags --help --lang=c --lang=c++ --lang=java
  In C code, any C function or typedef is a tag, and so are
  definitions of 'struct', 'union' and 'enum'.  '#define' macro
  definitions and 'enum' constants are tags unless you specify
  '--no-defines'.  Global variables are tags unless you specify
  '--no-globals' and so are struct members unless you specify
  '--no-members'.  Use of '--no-globals', '--no-defines' and
  '--no-members' can make the tags table file much smaller.
  You can tag function declarations and external variables by
  using '--declarations'.

  In C++ code, all the tag constructs of C code are tagged.  (Use
  --help --lang=c --lang=c++ for full help.)
  In addition to C tags, member functions are also recognized.  Member
  variables are recognized unless you use the '--no-members' option.
  Tags for variables and functions in classes are named 'CLASS::VARIABLE'
  and 'CLASS::FUNCTION'.  'operator' definitions have tag names like
  'operator+'.

  In Java code, all the tags constructs of C and C++ code are
  tagged.  (Use --help --lang=c --lang=c++ --lang=java for full help.)

It says nothing about classes, only about class members?

Can you post a Java file which has more-or-less complete class
declarations, including the problematic one, and where some classes
are tagged while others aren't?  I'd like to try to figure out why
some are tagged, but not others, and it's hard without an example.
Please post the minimal example, to make stepping through the code
easier.

Thanks.





  reply	other threads:[~2024-08-01  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 15:27 bug#72402: 28.2; Etags does not parse correctly Java source code Daniel Głowacki
2024-08-01  8:16 ` Eli Zaretskii [this message]
     [not found]   ` <875xsirir2.fsf@hpg6>
2024-08-18  9:06     ` Eli Zaretskii
2024-08-19 21:21       ` Daniel Głowacki
2024-08-29 11:30         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86wml0wtcw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72402@debbugs.gnu.org \
    --cc=dglowacki4@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).