Merge "PreloadCheck: Add some comments"
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user