diff --git a/elf/src/main/java/com/ledmington/elf/ELFParser.java b/elf/src/main/java/com/ledmington/elf/ELFParser.java index b4594b3..c63fccc 100644 --- a/elf/src/main/java/com/ledmington/elf/ELFParser.java +++ b/elf/src/main/java/com/ledmington/elf/ELFParser.java @@ -64,6 +64,12 @@ public final class ELFParser { private ELFParser() {} + /** + * Parses the given file and returns an {@link ELF} file object. + * + * @param filename The name of the file to be parsed. + * @return An ELF file object. + */ public static ELF parse(final String filename) { final File file = new File(filename); if (!file.exists()) { diff --git a/elf/src/main/java/com/ledmington/elf/section/note/GnuPropertyType.java b/elf/src/main/java/com/ledmington/elf/section/note/GnuPropertyType.java index 335df89..b06fad1 100644 --- a/elf/src/main/java/com/ledmington/elf/section/note/GnuPropertyType.java +++ b/elf/src/main/java/com/ledmington/elf/section/note/GnuPropertyType.java @@ -161,10 +161,20 @@ public enum GnuPropertyType { this(code, "UNKNOWN"); } + /** + * Returns the 32-bit code of this GNU property type. + * + * @return The 32-bit code of this GNU property type. + */ public int getCode() { return code; } + /** + * Returns a String with the description of this type as GNU's readelf would print it. + * + * @return The description of this type. + */ public String getDescription() { return description; } diff --git a/emu/src/test/java/com/ledmington/emu/TestEmulation.java b/emu/src/test/java/com/ledmington/emu/TestEmulation.java index 1a45dfe..e7506ee 100644 --- a/emu/src/test/java/com/ledmington/emu/TestEmulation.java +++ b/emu/src/test/java/com/ledmington/emu/TestEmulation.java @@ -17,6 +17,8 @@ */ package com.ledmington.emu; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; @@ -25,18 +27,18 @@ import org.junit.jupiter.api.Test; /** End-to-end testing emulating entire executables. */ -public final class TestEmulation { +final class TestEmulation { @Test void doNothing() { final Path p; try { - p = Paths.get( - Objects.requireNonNull(this.getClass().getClassLoader().getResource("do_nothing.elf")) - .toURI()); + p = Paths.get(Objects.requireNonNull( + Thread.currentThread().getContextClassLoader().getResource("do_nothing.elf")) + .toURI()); } catch (final URISyntaxException e) { throw new RuntimeException(e); } - Emu.run(p.toString()); + assertDoesNotThrow(() -> Emu.run(p.toString())); } }