Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7074

serialver tool in openjdk 21 does not work for nested classes

$
0
0

I have created a demo class as follows:

public class Demo2 implements Serializable {    int id;    public static void main(String[] args) {        System.out.println("Hi");    }}

When I execute the command:

serialver com.sample.Demo2

it provides the correct result:

com.sample.Demo2:    private static final long serialVersionUID = -3814645723313276333L;

For the second class:

public class Demo {    static class Serial implements Serializable {        int id;    }    public static void main(String[] args) {        System.out.println("Hi");    }}

When I execute the command:

serialver com.sample.Demo$Serial

I get following output:

Class com.sample.Demo is not Serializable.

I have OpenJDK 21.0.7 installed on my Ubuntu machine:

OpenJDK version

Is there any way, this can be resolved?


Viewing all articles
Browse latest Browse all 7074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>