Re: How can I trigger a @Serial warning?

2021-09-23 Thread Tagir Valeev
Hello, Cay!

By the way, in IntelliJ IDEA we have the inspection that warns you about
wrong use of Serial:

[image: image.png]
It also suggests adding this annotation where it's appropriate:

[image: image.png]
Both inspections are turned on by default.

With best regards,
Tagir Valeev.


On Thu, Sep 9, 2021 at 2:47 PM Cay Horstmann 
wrote:

> I am trying to give an example of the utility of the @Serial annotation.
> But the JDK 17 javac doesn't seem to do anything with it. I tried:
>
> @Serial private void readObject(java.io.ObjectInputStream stream, int
> shouldNotHaveThisParam) throws IOException, ClassNotFoundException
> @Serial private static final String serialVersionUID = "Fred";
> @Serial public String getName() { ... }
>
> Is there some flag that I need to use? I tried -Xlint:serial, but it
> didn't make a difference.
>
> Thanks,
>
> Cay
>
> --
>
> Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com
>


Re: How can I trigger a @Serial warning?

2021-09-09 Thread Joseph D. Darcy

Hi Cay,

The enhancements to javac's serial lint checking have not been 
implemented as of yet. For now, @Serial is just documentation.


HTH,

-Joe

On 9/8/2021 10:43 PM, Cay Horstmann wrote:
I am trying to give an example of the utility of the @Serial 
annotation. But the JDK 17 javac doesn't seem to do anything with it. 
I tried:


@Serial private void readObject(java.io.ObjectInputStream stream, int 
shouldNotHaveThisParam) throws IOException, ClassNotFoundException

@Serial private static final String serialVersionUID = "Fred";
@Serial public String getName() { ... }

Is there some flag that I need to use? I tried -Xlint:serial, but it 
didn't make a difference.


Thanks,

Cay



How can I trigger a @Serial warning?

2021-09-08 Thread Cay Horstmann
I am trying to give an example of the utility of the @Serial annotation. 
But the JDK 17 javac doesn't seem to do anything with it. I tried:


@Serial private void readObject(java.io.ObjectInputStream stream, int 
shouldNotHaveThisParam) throws IOException, ClassNotFoundException

@Serial private static final String serialVersionUID = "Fred";
@Serial public String getName() { ... }

Is there some flag that I need to use? I tried -Xlint:serial, but it 
didn't make a difference.


Thanks,

Cay

--

Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com