This is the mail archive of the java-prs@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/2370: Behavior of main compilation without --main is unfriendly



>Number:         2370
>Category:       java
>Synopsis:       Behavior of main compilation without  --main is unfriendly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 23 15:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hans Boehm
>Release:        gcc 3.0
>Organization:
>Environment:
All
>Description:
Currently if gcj is asked to link a program with no --main specified, it will blindly proceed, thus guaranteeing a moderatwly obscure linker error message in response to a simple compilation attempt like

gcj X.java

Since most naive users are likely to try invoking it this way first, it would be really nice if it were a bit friendlier.

Based on a brief discussion on the Java mailing list, there seems to be some tentative agreement that:

If the only file arguments are .java and .class files, and there is no --main:
  1) If there is exactly one file argument, generate the --main
  2) If there is more than one, issue a warning, suggesting --main.  (This gets a little tricky if there are nonstandard libraries involved, which might be hiding main.  If none are explicitly listed, a warning should certainly be safe.)

Per Bothner pointed out that simply issuing an error if the linker was invoked without --main would not be appropriate once C++ main programs are better supported with Java code.

Tom expressed some concerns about implied options.  I wouldn't be at all opposed if this were not officially supported, and even in case 1 we issued a warning, but then did the right thing anyway.  I think in case there really is only one "right thing".  And it's important to do that, since it determines whether most user's first attempt to use gcj succeeds or fails.  The warning would simultaneously teach users the proper way to invoke gcj for larger applications.
>How-To-Repeat:
gcj hello.java
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]