summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2008-10-21 07:00:00 -0700
commita0c5294bd396e480cbf850bde283a94042526698 (patch)
treefbeaaacb86eb9b610563f05c32af6870964f8d79
parenta921fd048da6858dc24d4370e3bba15fc9cc69ca (diff)
downloademma-a0c5294bd396e480cbf850bde283a94042526698.tar.gz
-rw-r--r--ANDROID-CHANGES.txt8
-rw-r--r--Android.mk14
-rw-r--r--core/java12/com/vladium/emma/rt/InstrClassLoader.java5
-rw-r--r--core/java12/com/vladium/util/IntVector.java3
-rw-r--r--core/java13/com/vladium/util/exit/ExitHookManager.java131
-rw-r--r--core/java14/com/vladium/util/IJREVersion.java8
-rw-r--r--core/res/com/vladium/emma/rt/RTExitHook.closure3
-rw-r--r--core/res/emma_default.properties2
-rw-r--r--lib/emma.jarbin0 -> 428218 bytes
-rw-r--r--lib/emma_ant.jarbin0 -> 38232 bytes
10 files changed, 32 insertions, 142 deletions
diff --git a/ANDROID-CHANGES.txt b/ANDROID-CHANGES.txt
new file mode 100644
index 0000000..d4cade0
--- /dev/null
+++ b/ANDROID-CHANGES.txt
@@ -0,0 +1,8 @@
+
+Change made for Android
+
+1) Change coverage.out.file location in core/res/emma_default.properties to /data/coverage.ec
+2) Remove reference to sun.misc.* in core/java14/com/vladium/util/IJREVersion.java
+3) Remove reference to sun.misc.* and SunJREExitHookManager class from core/java13/com/vladium/util/exit/ExitHookManager.java
+4) Add java.security.cert.Certificate cast to core/java12/com/vladium/emma/rt/InstrClassLoader.java to fix compiler error
+5) Copy /core/res/com/vladium/emma/rt/RTExitHook.closure into source tree so it does not have to be generated in the build
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..7c5b34c
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,14 @@
+# Copyright 2008 The Android Open Source Project
+
+LOCAL_PATH := $(my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, core)
+
+LOCAL_MODULE := emma
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_JAVA_RESOURCE_DIRS := core/res
+
+include $(BUILD_JAVA_LIBRARY)
diff --git a/core/java12/com/vladium/emma/rt/InstrClassLoader.java b/core/java12/com/vladium/emma/rt/InstrClassLoader.java
index b8c4277..7732d0e 100644
--- a/core/java12/com/vladium/emma/rt/InstrClassLoader.java
+++ b/core/java12/com/vladium/emma/rt/InstrClassLoader.java
@@ -16,6 +16,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.CodeSource;
+import java.security.cert.Certificate;
import java.util.Map;
import com.vladium.logging.Logger;
@@ -343,7 +344,7 @@ final class InstrClassLoader extends URLClassLoader
// support ProtectionDomains with non-null class source URLs:
// [however, disable anything related to sealing or signing]
- final CodeSource csrc = new CodeSource (srcURL, null);
+ final CodeSource csrc = new CodeSource (srcURL, (Certificate[])null);
// allow getPackage() to return non-null on the class we are about to
// define (however, don't bother emulating the original manifest info since
@@ -459,4 +460,4 @@ final class InstrClassLoader extends URLClassLoader
private static final URL [] EMPTY_URL_ARRAY = new URL [0];
} // end of class
-// ---------------------------------------------------------------------------- \ No newline at end of file
+// ----------------------------------------------------------------------------
diff --git a/core/java12/com/vladium/util/IntVector.java b/core/java12/com/vladium/util/IntVector.java
index 2bc4a99..3e159be 100644
--- a/core/java12/com/vladium/util/IntVector.java
+++ b/core/java12/com/vladium/util/IntVector.java
@@ -32,7 +32,8 @@ final class IntVector implements Cloneable
public int get (final int index)
{
if (index > m_size - 1)
- throw new IndexOutOfBoundsException ("get[" + index + "] on vector of size " + m_size);
+ throw new IndexOutOfBoundsException ("get[" + index + "] on vector of size " + m_size);
+
return m_values [index];
}
diff --git a/core/java13/com/vladium/util/exit/ExitHookManager.java b/core/java13/com/vladium/util/exit/ExitHookManager.java
index c119268..2bcee9f 100644
--- a/core/java13/com/vladium/util/exit/ExitHookManager.java
+++ b/core/java13/com/vladium/util/exit/ExitHookManager.java
@@ -11,9 +11,6 @@ package com.vladium.util.exit;
import java.util.HashMap;
import java.util.Map;
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
import com.vladium.util.IJREVersion;
import com.vladium.util.Property;
import com.vladium.emma.IAppConstants;
@@ -40,10 +37,6 @@ abstract class ExitHookManager implements IJREVersion
{
s_singleton = new JRE13ExitHookManager ();
}
- else if (JRE_SUN_SIGNAL_COMPATIBLE)
- {
- s_singleton = new SunJREExitHookManager ();
- }
else
{
throw new UnsupportedOperationException ("no shutdown hook manager available [JVM: " + Property.getSystemFingerprint () + "]");
@@ -124,129 +117,7 @@ abstract class ExitHookManager implements IJREVersion
} // end of nested class
-
- private static final class SunJREExitHookManager extends ExitHookManager
- {
- public synchronized boolean addExitHook (final Runnable runnable)
- {
- if ((runnable != null) && ! m_signalHandlerMap.containsKey (runnable))
- {
- final INTSignalHandler handler = new INTSignalHandler (runnable);
-
- try
- {
- handler.register ();
- m_signalHandlerMap.put (runnable, handler); // TODO: use identity here
-
- return true;
- }
- catch (Throwable t)
- {
- System.out.println ("exception caught while adding a shutdown hook:");
- t.printStackTrace (System.out);
- }
- }
-
- return false;
- }
-
- public synchronized boolean removeExitHook (final Runnable runnable)
- {
- if (runnable != null)
- {
- final INTSignalHandler handler = (INTSignalHandler) m_signalHandlerMap.get (runnable); // TODO: use identity here
- if (handler != null)
- {
- try
- {
- handler.unregister ();
- m_signalHandlerMap.remove (runnable);
-
- return true;
- }
- catch (Exception e)
- {
- System.out.println ("exception caught while removing a shutdown hook:");
- e.printStackTrace (System.out);
- }
- }
- }
-
- return false;
- }
-
- SunJREExitHookManager ()
- {
- m_signalHandlerMap = new HashMap ();
- }
-
-
- private final Map /* Runnable->INTSignalHandler */ m_signalHandlerMap;
-
- } // end of nested class
-
-
- private static final class INTSignalHandler implements SignalHandler
- {
- public synchronized void handle (final Signal signal)
- {
- if (m_runnable != null)
- {
- try
- {
- m_runnable.run ();
- }
- catch (Throwable ignore) {}
- }
- m_runnable = null;
-
- if ((m_previous != null) && (m_previous != SIG_DFL) && (m_previous != SIG_IGN))
- {
- try
- {
- // this does not work:
- //Signal.handle (signal, m_previous);
- //Signal.raise (signal);
-
- m_previous.handle (signal);
- }
- catch (Throwable ignore) {}
- }
- else
- {
- System.exit (0);
- }
- }
-
- INTSignalHandler (final Runnable runnable)
- {
- m_runnable = runnable;
- }
-
- synchronized void register ()
- {
- m_previous = Signal.handle (new Signal ("INT"), this);
- }
-
- synchronized void unregister ()
- {
-// if (m_previous != null)
-// {
-// Signal.handle (new Signal ("INT"), m_previous);
-// m_previous = null;
-// }
-
- m_runnable = null;
- }
-
-
- private Runnable m_runnable;
- private SignalHandler m_previous;
-
- } // end of nested class
-
-
private static ExitHookManager s_singleton;
} // end of class
-// ---------------------------------------------------------------------------- \ No newline at end of file
+// ----------------------------------------------------------------------------
diff --git a/core/java14/com/vladium/util/IJREVersion.java b/core/java14/com/vladium/util/IJREVersion.java
index 866c3fe..7f3331a 100644
--- a/core/java14/com/vladium/util/IJREVersion.java
+++ b/core/java14/com/vladium/util/IJREVersion.java
@@ -82,14 +82,6 @@ interface IJREVersion
_JRE_1_4_PLUS = temp;
temp = false;
- try
- {
- Class.forName ("sun.misc.Signal");
- Class.forName ("sun.misc.SignalHandler");
-
- temp = true;
- }
- catch (Throwable ignore) {}
_JRE_SUN_SIGNAL_COMPATIBLE = temp;
}
diff --git a/core/res/com/vladium/emma/rt/RTExitHook.closure b/core/res/com/vladium/emma/rt/RTExitHook.closure
new file mode 100644
index 0000000..366a00a
--- /dev/null
+++ b/core/res/com/vladium/emma/rt/RTExitHook.closure
@@ -0,0 +1,3 @@
+#this file is auto-generated, do not edit
+#Fri Feb 08 12:18:59 PST 2008
+closure=com.vladium.util.ResourceLoader,com.vladium.emma.rt.RTCoverageDataPersister,com.vladium.util.IntSet,com.vladium.logging.Logger,com.vladium.util.IntSet$Entry,com.vladium.emma.data.DataFactory$UCFileOutputStream,com.vladium.emma.rt.RTExitHook,com.vladium.util.ClassLoaderResolver$CallerResolver,com.vladium.emma.data.CoverageData,com.vladium.util.ClassLoadContext,com.vladium.emma.data.ClassDescriptor,com.vladium.util.Property$SystemPropertyLookup,com.vladium.util.IConstants,com.vladium.emma.data.IMetaData,com.vladium.emma.data.CoverageOptions,com.vladium.util.ClassLoaderResolver,com.vladium.emma.data.ICoverageData$DataHolder,com.vladium.emma.data.ISessionData,com.vladium.emma.data.DataFactory$UCFileInputStream,com.vladium.emma.data.IMetadataConstants,com.vladium.emma.data.MethodDescriptor,com.vladium.util.Property$SystemRedirectsLookup,com.vladium.emma.data.MetaData,com.vladium.logging.Logger$1,com.vladium.util.IClassLoadStrategy,com.vladium.emma.data.DataFactory$RandomAccessFileInputStream,com.vladium.emma.data.IMergeable,com.vladium.util.IntObjectMap,com.vladium.util.Property,com.vladium.logging.Logger$ThreadLocalStack,com.vladium.emma.data.DataFactory,com.vladium.emma.data.ICoverageData,com.vladium.emma.data.DataFactory$RandomAccessFileOutputStream,com.vladium.util.IntObjectMap$Entry,com.vladium.util.XProperties,com.vladium.util.ClassLoaderResolver$DefaultClassLoadStrategy,com.vladium.logging.ILogLevels,com.vladium.util.ClassLoaderResolver$1,com.vladium.util.Property$FilePropertyLookup
diff --git a/core/res/emma_default.properties b/core/res/emma_default.properties
index ec4fecb..8a3079d 100644
--- a/core/res/emma_default.properties
+++ b/core/res/emma_default.properties
@@ -48,7 +48,7 @@ session.out.merge: true
# runtime coverage data output properties:
-coverage.out.file: coverage.ec
+coverage.out.file: /data/coverage.ec
coverage.out.merge: true
# -------------------------------------------------------------
diff --git a/lib/emma.jar b/lib/emma.jar
new file mode 100644
index 0000000..27629de
--- /dev/null
+++ b/lib/emma.jar
Binary files differ
diff --git a/lib/emma_ant.jar b/lib/emma_ant.jar
new file mode 100644
index 0000000..3f28c2c
--- /dev/null
+++ b/lib/emma_ant.jar
Binary files differ