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/2332: valid declaration rejected



>Number:         2332
>Category:       java
>Synopsis:       valid declaration rejected
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 20 13:46:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tom Tromey
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
This ugly example is derived from the Apache javax.servlet
code:
public class foo {
  Object[][] vals;

  public foo (Object[] v[])
  {
    vals = v;
  }
}

I believe this is valid (if hideous) Java code.
However gcj rejects it:

creche. gcj --syntax-only foo.java 
foo.java: In class `foo':
foo.java: In method `(java.lang.Object[])':
foo.java:6: Incompatible type for `='. Explicit cast needed to convert `java.lang.Object[]' to `java.lang.Object[][]'.
       vals = v;
            ^
1 error

I looked at this bug once and came to the conclusion
that gcj thought `v' was of type `Object[]'.
>How-To-Repeat:

>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]