🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15425

Re: Is JDK 2.0 bytecode compatible with JDK 1.02?

#15425
From: Rich Wilkman
Date: Thu, 17 Jun 1999 00:00
74 lines
2938 bytes
Jonathan:

In general, yes.  However "compatibility" is always best thought of as
one way.  You can run 1.02 code in a 1.2 VM, but you can't count on
running 1.2 code in a 1.02 VM.  That's what it looks like is happening
to you.  Somewhere on your classpath you have mixed up different code.

-Rich

Jonathan Knott wrote:
> 
> Hello JB fans,
> 
> I was under the impression that I could use the JDK 2.0 compiler to get
> JDK 1.02 bytecode.  (which I need for applets for older browsers)
> I thought that all I had to do was write in "JDK 1.02 Java".  I have
> always had success doing that with JDK 1.1x compilers.  Below I will
> show that this is not true with the JDK 2.0 compiler.
> 
> The following lines of Java code are perfectly valid in JDK 1.02.
> 
> TextField tf;
> tf.setText( "hi" );
> 
> If I compile this with JDK 1.02 or JDK 1.1x, it works fine.  The crucial
> bytecode is:
> 
> invokevirtual METHOD java/awt/TextComponent setText
> (Ljava/lang/String;)V
> 
> If I compile the above Java with JDK 2.0 (the default JB3 compiler),
> the following byte code is produced:
> 
> invokevirtual METHOD java/awt/TextField setText (Ljava/lang/String;)V
> 
> This crashes in JDK 1.02, such as Netscape 3.0.  This is not legal JDK
> 1.02 bytecode.
> 
> I thought that the bytecode produced was supposed to be backward
> compatible.
> My theory was that if I wrote in "JDK 1.02 Java", the compiler would
> produce
> "JDK 1.02 bytecode".
> 
> This is a clear example where that is not true.  I am wrong?  Or did Sun
> make a mistake?  Have I just found a weird example or should I expect
> many such bytecode problems?
> 
> Thanks for your help,
> 
> Jonathan Knott
> 
> P.S.
> 
> This case is simple to fix.  The lines below produce legal JDK 1.02
> bytecode.
> 
> TextComponent tc = (TextComponent) tf;
> tc.setText( "hi" );

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <37699901.1BFF33AD@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3769151A.2F14EB4@pacific.net.sg>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,1404b3dc214fe147
X-Google-Attributes: gidf74b3,public
From: Rich Wilkman <rwilkman@inprise.com>
Subject: Re: Is JDK 2.0 bytecode compatible with JDK 1.02?
Date: 1999/06/17
Message-ID: <37699901.1BFF33AD@inprise.com>
X-Deja-AN: 490886774
Content-Transfer-Encoding: 7bit
References: <3769151A.2F14EB4@pacific.net.sg>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language