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


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

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

Newsgroups comp.lang.java.programmer
Date 2023-06-10 06:58 -0700
References <u60jra$2275l$1@dont-email.me>
Message-ID <65a6bfdc-3cfa-424f-a042-e712ee50e781n@googlegroups.com> (permalink)
Subject Re: Java 21 and [this-escape] warnings?
From Eric Sosman <donalhambra@gmail.com>

Show all headers | View raw


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, ...

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

> GridBagConstraints c = new GridBagConstraints(); 
> 
> JLabel l = new JLabel("this is a JLabel"); 
> l.setBorder(new EmptyBorder(20,20,20,20)); // [this-escape] 
> sometimes 

I don't understand (or even guess at) this one, not at all.

> //add(l,c); // [this-escape] 
> //add(l); // [this-escape] 

... but again: try using super.add (or a final class).

-- 
esosman@comcast-dot-net.invalid
Look on my code, ye Hackers, and guffaw!

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