Problems compiling Log4jME

Cedric Berger cedric@wireless-networks.com
Thu Sep 27 08:21:00 GMT 2001


Tom Tromey wrote:

>>>>>>"David" == David Vrabel <dv207@hermes.cam.ac.uk> writes:
>>>>>>
>
>David> The above files do fail.
>David>     .java -> .class works fine (gcj -C B.java)
>David>     .java -> .o works fine (gcj -c B.java)
>David>     .class -> .o does not work (gcj -c B.class) with a message:
>David> "B.java: In class `B':
>David> B.java: In method `B.g()':
>David> B.java:3: Class 'B' has no method named 'f' matching signature '()V'
>David> B.java:0: confused by earlier errors, bailing out"
>
>Thanks.
>
>Looking at the .class files, I see that `javac' emits an abstract
>method `f' for B, while `gcj -C' does not.
>
Don't do that! The abstract method will not be generated by javac if you 
specify
  "-targer 1.2" which is the default for the upcoming JDK 1.4 (and the 
right thing to do)
from: http://java.sun.com/j2se/1.4/compatibility.html (point 9):

   1. As of J2SDK 1.4.0, the javac bytecode compiler uses "-target 1.2"
      by default as opposed to the previous "-target 1.1" behavior. See
      the reference page
      < http://java.sun.com/j2se/1.4/docs/tooldocs/tools.html > for the
      javac compiler for descriptions of these behaviors. One of the
      changes involved in targeting 1.2 is that the compiler no longer
      generates and inserts method declarations into class files when
      the class inherits unimplemented methods from interfaces. These
      inserted methods, like all other non-private methods, are included
      in the default serialVersionUID computation. As a result, if you
      define an abstract serializable class which directly implements an
      interface but does not implement one or more of its methods, then
      its default serialVersionUID value will vary depending on whether
      it is compiled with the J2SDK 1.4 version of javac or a previous
      javac.

      For background information on these methods inserted by earlier
      versions of javac, see bug 4043008
      < http://developer.java.sun.com/developer/bugParade/bugs/4043008.html >.


( http://developer.java.sun.com/developer/bugParade/bugs/4043008.html )
Cedric




More information about the Java mailing list