java/2332: valid declaration rejected

tromey@redhat.com tromey@redhat.com
Tue Mar 20 13:46:00 GMT 2001


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



More information about the Gcc-bugs mailing list