Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project should run with JDK 1.8 but uses a method from JDK 9 #13

Open
gerolfscherr opened this issue Apr 26, 2024 · 1 comment
Open

Comments

@gerolfscherr
Copy link

The Project is supposed to run with jdk 1.8 but it uses a method which is marked @since 9
and therefore doesn't really work on jdk 1.8, see Stacktrace below:

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
Exception in thread "main" java.lang.NoSuchMethodError: java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
  at info.faljse.SDNotify.jna.CLibrary$SockAddr.getFieldOrder(CLibrary.java:81)
  at com.sun.jna.Structure.fieldOrder(Structure.java:1044)
  at com.sun.jna.Structure.getFields(Structure.java:1098)
  at com.sun.jna.Structure.deriveLayout(Structure.java:1265)
  at com.sun.jna.Structure.calculateSize(Structure.java:1192)
  at com.sun.jna.Structure.calculateSize(Structure.java:1144)
  at com.sun.jna.Structure.allocateMemory(Structure.java:426)
  at com.sun.jna.Structure.<init>(Structure.java:216)
  at com.sun.jna.Structure.<init>(Structure.java:204)
  at com.sun.jna.Structure.<init>(Structure.java:191)
  at com.sun.jna.Structure.<init>(Structure.java:183)
  at info.faljse.SDNotify.jna.CLibrary$SockAddr.<init>(CLibrary.java:75)
  at info.faljse.SDNotify.SDNotify.<init>(SDNotify.java:48)
  at info.faljse.SDNotify.SDNotify.getInstance(SDNotify.java:186)
  at info.faljse.SDNotify.SDNotify.sendNotify(SDNotify.java:72)
@gerolfscherr
Copy link
Author

gerolfscherr commented Apr 26, 2024

the offending line is:

return List.of("family", "addr");

and the fix would be something like

        @Override
        protected List<String> getFieldOrder() {
            ArrayList a = new ArrayList();
            a.add("family");
            a.add("addr");
            return Collections.unmodifiableList(a);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant