Bug 20502 - gcj failure if .jar contains same .class twice
Summary: gcj failure if .jar contains same .class twice
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-16 18:52 UTC by Tom Tromey
Modified: 2016-09-30 22:51 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-03-17 00:01:46


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2005-03-16 18:52:07 UTC
As mentioned here:

https://www.redhat.com/archives/fedora-devel-java-list/2005-March/msg00178.html

gcj will fail if asked to compile a .jar that contains a given
.class twice.  At the very least it should emit a better error
message.
Comment 1 Bryce McKinlay 2005-03-16 19:01:19 UTC
I think in general, if a .jar is valid for the VM, then we should do our best to
compile it without an error. So - we should just ignore (well, issue a warning
perhaps) duplicately-named class files in a jar.
Comment 2 Bryce McKinlay 2005-03-16 19:33:01 UTC
I wonder why this check doesn't catch it (jcf-parse.c):

  if (CLASS_PARSED_P (current_class))
    {
      /* FIXME - where was first time */
      fatal_error ("reading class %s for the second time from %s",
		   IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))),
		   jcf->filename);
    }
  CLASS_PARSED_P (current_class) = 1;
Comment 3 Andrew Pinski 2005-03-17 00:01:46 UTC
Confirmed.
Comment 4 GCC Commits 2005-03-17 15:54:46 UTC
Subject: Bug 20502

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bryce@gcc.gnu.org	2005-03-17 15:54:24

Modified files:
	gcc/java       : ChangeLog jcf-parse.c 

Log message:
	2005-03-17  Bryce McKinlay  <mckinlay@redhat.com>
	
	PR java/20502
	* jcf-parse.c (duplicate_class_warning): New function.
	(java_parse_file): Call duplicate_class_warning if
	CLASS_FROM_CURRENTLY_COMPILED_P is already set.
	(parse_zip_file_entries): Likewise. Also set
	CLASS_FROM_CURRENTLY_COMPILED_P.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1574&r2=1.1575
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/jcf-parse.c.diff?cvsroot=gcc&r1=1.183&r2=1.184

Comment 5 Andrew Pinski 2016-09-30 22:51:39 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.