java/1337: Bogus error from java/awt/Window.java

bryce@albatross.co.nz bryce@albatross.co.nz
Wed Dec 20 12:25:00 GMT 2000


>Number:         1337
>Category:       java
>Synopsis:       Bogus error from java/awt/Window.java
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:09 PST 2000
>Closed-Date:    Mon Dec 18 13:27:03 PST 2000
>Last-Modified:  Mon Dec 18 13:30:01 PST 2000
>Originator:     Bryce McKinlay
>Release:        gcc version 2.96 20000809 (experimental)
>Organization:
>Environment:
linux on ia32
>Description:
java/awt/Window.java contains a method like this:

  public void addNotify()
  {
    if (peer == null)
      peer = (ComponentPeer) getToolkit ().createWindow (this);
  }

However, the cast to (ComponentPeer) *should* be 
unneccessary, because ComponetPeer is a superinterface of 
WindowPeer (and jikes agrees with me).

If the cast is removed, we get a strange error message 
the second time it is compiled when building libgcj (it
compiles fine to bytecode but not to native code):

javac="gcj -C"; cd ../../../libjava; \
  $javac -g -classpath /home/bryce/cvs/libgcj/build/i686-pc-linux-gnu/libjava:`/
bin/pwd` -d /home/bryce/cvs/libgcj/build/i686-pc-linux-gnu/libjava \
    java/awt/Window.java
java/awt/Window.java: In class `java.awt.Window':
java/awt/Window.java: In method `addNotify()':
java/awt/Window.java:80: Incompatible type for `='. Explicit cast needed to conv
ert `java.awt.peer.WindowPeer' to `java.awt.peer.ComponentPeer'.
      peer = getToolkit ().createWindow (this);
           ^
java/awt/Window.java: In method `class$(java.lang.String)':
java/awt/Window.java:1: Missing return statement.
/* Copyright (C) 1999, 2000  Free Software Foundation
 ^
2 errors
>How-To-Repeat:
Remove the cast from java.awt.Window.addNotify() and try 
to rebuild libgcj.
>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR gcj/312


From: Bryce McKinlay <bryce@albatross.co.nz>
To: java-gnats@sourceware.cygnus.com, apbianco@cygnus.com
Cc:  
Subject: Re: gcj/312
Date: Mon, 30 Oct 2000 23:05:59 +1300

 I'm also getting this error while trying to build ANTLR (from
 www.antlr.org):
 
 antlr/HTMLCodeGenerator.java: In class `antlr.HTMLCodeGenerator':
 antlr/HTMLCodeGenerator.java: In method `antlr.HTMLCodeGenerator()':
 antlr/HTMLCodeGenerator.java:35: Incompatible type for `='. Can't
 convert `antlr.JavaCharFormatter' to `antlr.CharFormatter'.
                 charFormatter = new JavaCharFormatter();
                                  ^
 1 error
 antlr/JavaCodeGenerator.java: In method `antlr.JavaCodeGenerator()':
 antlr/JavaCodeGenerator.java:69: Incompatible type for `='. Can't
 convert `antlr.JavaCharFormatter' to `antlr.CharFormatter'.
         charFormatter = new JavaCharFormatter();
                          ^
 1 error
 
 
 "JavaCharFormatter" implements the "CharFormatter" interface directly,
 so this is strange. This seems to be rather common error when building
 3rd party sources.
 
 regards
 
   [ bryce ]
 
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=312&database=java
 
 
 
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Mon Dec 18 13:27:03 2000
State-Changed-Why:
    I checked in a patch to fix this:
    http://gcc.gnu.org/ml/gcc-patches/2000-12/msg00862.html
    
    And also removed the hack from the runtime.

From: bryce@albatross.co.nz
To: apbianco@cygnus.com, bryce@albatross.co.nz,
  java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/312
Date: 18 Dec 2000 21:27:03 -0000

 Synopsis: Bogus error from java/awt/Window.java
 
 State-Changed-From-To: open->closed
 State-Changed-By: bryce
 State-Changed-When: Mon Dec 18 13:27:03 2000
 State-Changed-Why:
     I checked in a patch to fix this:
     http://gcc.gnu.org/ml/gcc-patches/2000-12/msg00862.html
     
     And also removed the hack from the runtime.
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=312&database=java
>Unformatted:




More information about the Gcc-prs mailing list