Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1759a9b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "PreloadCheck: Add some comments"

parents 73b25f4f 1e8c3995
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.preload.check;

/**
 * Test that the given boot classpath class is initialized.
 */
public class Initialized {
    public static void main(String[] args) throws Exception {
        Util.assertInitialized(args[0], null);
+5 −1
Original line number Diff line number Diff line
@@ -16,13 +16,16 @@

package com.android.preload.check;

/**
 * Test that a helper class is first seen as uninitialized, then initialized after forced.
 */
public class IntegrityCheck {
    public static void main(String[] args) throws Exception {
        ClassLoader loader = IntegrityCheck.class.getClassLoader();

        Util.assertNotInitialized("com.android.preload.check.IntegrityCheck$StatusHelper", loader);

        Class<?> klass = Class.forName("com.android.preload.check.IntegrityCheck$StatusHelper",
        Class.forName("com.android.preload.check.IntegrityCheck$StatusHelper",
                /* initialize */ true, loader);

        Util.assertInitialized("com.android.preload.check.IntegrityCheck$StatusHelper", loader);
@@ -30,6 +33,7 @@ public class IntegrityCheck {
        System.out.println("OK");
    }

    @SuppressWarnings("unused")
    private static class StatusHelper {
        private final static Object defer = new Object();
    }
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.preload.check;

/**
 * Test that the given boot classpath class is not initialized.
 */
public class NotInitialized {
    public static void main(String[] args) throws Exception {
        Util.assertNotInitialized(args[0], null);
+8 −0
Original line number Diff line number Diff line
@@ -23,7 +23,15 @@ import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Test boot classpath classes that satisfy a given regular expression to be not initialized.
 * Optionally check that at least one class was matched.
 */
public class NotInitializedRegex {
    /**
     * First arg (mandatory): regular exception. Second arg (optional): boolean to denote a
     * required match.
     */
    public static void main(String[] args) throws Exception {
        Matcher m = Pattern.compile(args[0]).matcher("");
        boolean requiresMatch = args.length > 1 ? Boolean.parseBoolean(args[1]) : false;