Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39965

Re: Java 21 and [this-escape] warnings?

From Knute Johnson <knute2023@585ranch.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java 21 and [this-escape] warnings?
Date 2023-06-10 13:26 -0500
Organization A noiseless patient Spider
Message-ID <u62f9g$2ck76$2@dont-email.me> (permalink)
References <u60jra$2275l$1@dont-email.me> <65a6bfdc-3cfa-424f-a042-e712ee50e781n@googlegroups.com>

Show all headers | View raw


On 6/10/23 08:58, Eric Sosman wrote:
> On Friday, June 9, 2023 at 9:32:41 PM UTC-4, Knute Johnson wrote:
>> [...] I've commented out several lines
>> but you can un-comment them and see the warnings from the compiler. The
>> first one that I really don't understand is
>> Frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE). [...]
> 
> I've not tried Java21 and am just guessing wildly, so take
> my observations with a grain -- nay, a tonne -- of salt:
> 
>> public class test extends JFrame {
> 
> Have you tried making the class final?  Alternatively, ...

At your suggestion I did and all the errors go away.  You get the prize 
Eric!

>> public test() {
>> super("test");
>> //setLayout(new GridBagLayout()); // [this-escape]
>> //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //
>> [this-escape]
> 
> ... have you tried super.setXXX instead of bare setXXX?

super doesn't seem to help.

>> l.setBorder(new EmptyBorder(20,20,20,20)); // [this-escape]
>> sometimes
> 
> I don't understand (or even guess at) this one, not at all.

I think that one was me somewhere mixing things up.

final is the answer!

Thanks!

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Java 21 and [this-escape] warnings? Knute Johnson <knute2023@585ranch.com> - 2023-06-09 20:32 -0500
  Re: Java 21 and [this-escape] warnings? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2023-06-10 13:46 +0200
    Re: Java 21 and [this-escape] warnings? Knute Johnson <knute2023@585ranch.com> - 2023-06-10 13:23 -0500
      Re: Java 21 and [this-escape] warnings? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2023-06-11 14:45 +0200
  Re: Java 21 and [this-escape] warnings? Eric Sosman <donalhambra@gmail.com> - 2023-06-10 06:58 -0700
    Re: Java 21 and [this-escape] warnings? Knute Johnson <knute2023@585ranch.com> - 2023-06-10 13:26 -0500
  Re: Java 21 and [this-escape] warnings? Arne Vajhøj <arne@vajhoej.dk> - 2023-06-10 18:57 -0400

csiph-web