From b74bbc518c471b2545766120044c538f6aae51f9 Mon Sep 17 00:00:00 2001 From: exaucae Date: Mon, 27 Feb 2023 13:44:33 +0000 Subject: [PATCH] fix: correct imports --- .../com/baeldung/java/panama/core/Greetings.java | 12 ++++++++---- .../baeldung/java/panama/core/MemoryAllocation.java | 2 +- .../com/baeldung/java/panama/core/MemoryLayout.java | 10 ++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/java-panama/src/main/java/com/baeldung/java/panama/core/Greetings.java b/java-panama/src/main/java/com/baeldung/java/panama/core/Greetings.java index e6d596dbf0..1937bd65e9 100644 --- a/java-panama/src/main/java/com/baeldung/java/panama/core/Greetings.java +++ b/java-panama/src/main/java/com/baeldung/java/panama/core/Greetings.java @@ -1,9 +1,14 @@ package com.baeldung.java.panama.core; -import java.lang.foreign.*; -import java.lang.invoke.MethodHandle; +import static java.lang.foreign.ValueLayout.ADDRESS; +import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.*; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.lang.foreign.SymbolLookup; +import java.lang.invoke.MethodHandle; public class Greetings { @@ -26,7 +31,6 @@ public class Greetings { if (methodHandle == null) { throw new NoSuchMethodError("Method Handle was not found"); } - ; try (MemorySession memorySession = MemorySession.openConfined()) { MemorySegment greetingSegment = memorySession.allocateUtf8String(greeting); diff --git a/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryAllocation.java b/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryAllocation.java index 557a0695cc..239b25b69e 100644 --- a/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryAllocation.java +++ b/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryAllocation.java @@ -2,8 +2,8 @@ package com.baeldung.java.panama.core; import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySession; -import java.lang.foreign.ValueLayout; import java.lang.foreign.SegmentAllocator; +import java.lang.foreign.ValueLayout; public class MemoryAllocation { diff --git a/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryLayout.java b/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryLayout.java index 647247b54b..612997e35e 100644 --- a/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryLayout.java +++ b/java-panama/src/main/java/com/baeldung/java/panama/core/MemoryLayout.java @@ -1,15 +1,17 @@ package com.baeldung.java.panama.core; +import static java.lang.foreign.MemoryLayout.sequenceLayout; +import static java.lang.foreign.MemoryLayout.structLayout; +import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; +import static java.lang.foreign.ValueLayout.JAVA_FLOAT; +import static java.lang.foreign.ValueLayout.PathElement; + import java.lang.foreign.GroupLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySession; import java.lang.foreign.SequenceLayout; import java.lang.invoke.VarHandle; -import static java.lang.foreign.MemoryLayout.sequenceLayout; -import static java.lang.foreign.MemoryLayout.structLayout; -import static java.lang.foreign.ValueLayout.*; - public class MemoryLayout { public static void main(String[] args) {