summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:07 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:07 -0800
commitd94c06c605baa7814b787bab7c993775b486ffba (patch)
treea2b36c743db7cb9fd4d6ac4cc89fdfb53ed2e35e
parenta0881d052ee72e3f7e773374e9b1aa75fbd6be4c (diff)
downloadlibcore-d94c06c605baa7814b787bab7c993775b486ffba.zip
libcore-d94c06c605baa7814b787bab7c993775b486ffba.tar.gz
libcore-d94c06c605baa7814b787bab7c993775b486ffba.tar.bz2
auto import from //branches/cupcake/...@126645
-rw-r--r--Android.mk3
-rw-r--r--icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java6
-rw-r--r--luni-kernel/src/main/java/java/lang/Class.java9
-rw-r--r--luni-kernel/src/main/java/java/lang/reflect/Constructor.java5
-rw-r--r--luni-kernel/src/main/java/java/lang/reflect/Field.java5
-rw-r--r--luni-kernel/src/main/java/java/lang/reflect/Method.java5
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/lang/reflect/GenericSignatureParser.java10
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/lang/reflect/ImplForType.java13
-rw-r--r--nio/src/main/java/java/nio/Buffer.java12
-rw-r--r--nio/src/main/java/java/nio/IntToByteBufferAdapter.java11
-rw-r--r--nio/src/main/java/java/nio/ShortToByteBufferAdapter.java11
-rw-r--r--xml/src/main/java/org/xml/sax/ext/Attributes2Impl.java11
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java13
13 files changed, 55 insertions, 59 deletions
diff --git a/Android.mk b/Android.mk
index cf369a7..c12ce9a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,6 +22,9 @@ LOCAL_JAVA_RESOURCE_DIRS := $(call all-core-resource-dirs,main)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_DX_FLAGS := --core-library
+LOCAL_NO_EMMA_INSTRUMENT := true
+LOCAL_NO_EMMA_COMPILE := true
+
LOCAL_MODULE := core
include $(BUILD_JAVA_LIBRARY)
diff --git a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java
index e33e1b2..3b9bf86 100644
--- a/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java
+++ b/icu/src/main/java/com/ibm/icu4jni/charset/CharsetDecoderICU.java
@@ -17,7 +17,7 @@ package com.ibm.icu4jni.charset;
import com.ibm.icu4jni.common.ErrorCode;
// BEGIN android-removed
// import com.ibm.icu4jni.converters.NativeConverter;
-// ENd android-removed
+// END android-removed
import java.nio.CharBuffer;
@@ -253,9 +253,9 @@ public final class CharsetDecoderICU extends CharsetDecoder{
if(ec == ErrorCode.U_BUFFER_OVERFLOW_ERROR){
return CoderResult.OVERFLOW;
}else if(ec==ErrorCode.U_INVALID_CHAR_FOUND){
- return CoderResult.unmappableForLength(data[INVALID_BYTES]);
+ return CoderResult.malformedForLength(data[INVALID_BYTES]);
}else if(ec==ErrorCode.U_ILLEGAL_CHAR_FOUND){
- return CoderResult.unmappableForLength(data[INVALID_BYTES]);
+ return CoderResult.malformedForLength(data[INVALID_BYTES]);
}
/* decoding action succeded */
return CoderResult.UNDERFLOW;
diff --git a/luni-kernel/src/main/java/java/lang/Class.java b/luni-kernel/src/main/java/java/lang/Class.java
index c65ded9..dc5f1e1 100644
--- a/luni-kernel/src/main/java/java/lang/Class.java
+++ b/luni-kernel/src/main/java/java/lang/Class.java
@@ -927,7 +927,8 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
* @since Android 1.0
*/
public Type[] getGenericInterfaces() {
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForClass(this, getSignatureAttribute());
return Types.getClonedTypeArray(parser.interfaceTypes);
}
@@ -940,7 +941,8 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
* @since Android 1.0
*/
public Type getGenericSuperclass() {
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForClass(this, getSignatureAttribute());
return Types.getType(parser.superclassType);
}
@@ -1276,7 +1278,8 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe
*/
@SuppressWarnings("unchecked")
public synchronized TypeVariable<Class<T>>[] getTypeParameters() {
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForClass(this, getSignatureAttribute());
return parser.formalTypeParameters.clone();
}
diff --git a/luni-kernel/src/main/java/java/lang/reflect/Constructor.java b/luni-kernel/src/main/java/java/lang/reflect/Constructor.java
index b02dcae..54fac6a 100644
--- a/luni-kernel/src/main/java/java/lang/reflect/Constructor.java
+++ b/luni-kernel/src/main/java/java/lang/reflect/Constructor.java
@@ -32,6 +32,8 @@
package java.lang.reflect;
+import dalvik.system.VMStack;
+
import java.lang.annotation.Annotation;
import org.apache.harmony.kernel.vm.StringUtils;
@@ -64,7 +66,8 @@ public final class Constructor<T> extends AccessibleObject implements GenericDec
private synchronized void initGenericTypes() {
if (!genericTypesAreInitialized) {
String signatureAttribute = getSignatureAttribute();
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForConstructor(this, signatureAttribute);
formalTypeParameters = parser.formalTypeParameters;
genericParameterTypes = parser.parameterTypes;
diff --git a/luni-kernel/src/main/java/java/lang/reflect/Field.java b/luni-kernel/src/main/java/java/lang/reflect/Field.java
index 27cf34a..a6c930b 100644
--- a/luni-kernel/src/main/java/java/lang/reflect/Field.java
+++ b/luni-kernel/src/main/java/java/lang/reflect/Field.java
@@ -32,6 +32,8 @@
package java.lang.reflect;
+import dalvik.system.VMStack;
+
import java.lang.annotation.Annotation;
import org.apache.harmony.luni.lang.reflect.GenericSignatureParser;
@@ -98,7 +100,8 @@ public final class Field extends AccessibleObject implements Member {
private synchronized void initGenericType() {
if (!genericTypesAreInitialized) {
String signatureAttribute = getSignatureAttribute();
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForField(this.declaringClass, signatureAttribute);
genericType = parser.fieldType;
if (genericType == null) {
diff --git a/luni-kernel/src/main/java/java/lang/reflect/Method.java b/luni-kernel/src/main/java/java/lang/reflect/Method.java
index 7fc0322..473726d 100644
--- a/luni-kernel/src/main/java/java/lang/reflect/Method.java
+++ b/luni-kernel/src/main/java/java/lang/reflect/Method.java
@@ -32,6 +32,8 @@
package java.lang.reflect;
+import dalvik.system.VMStack;
+
import java.lang.annotation.Annotation;
import org.apache.harmony.kernel.vm.StringUtils;
@@ -68,7 +70,8 @@ public final class Method extends AccessibleObject implements GenericDeclaration
private synchronized void initGenericTypes() {
if (!genericTypesAreInitialized) {
String signatureAttribute = getSignatureAttribute();
- GenericSignatureParser parser = new GenericSignatureParser();
+ GenericSignatureParser parser = new GenericSignatureParser(
+ VMStack.getCallingClassLoader2());
parser.parseForMethod(this, signatureAttribute);
formalTypeParameters = parser.formalTypeParameters;
genericParameterTypes = parser.parameterTypes;
diff --git a/luni/src/main/java/org/apache/harmony/luni/lang/reflect/GenericSignatureParser.java b/luni/src/main/java/org/apache/harmony/luni/lang/reflect/GenericSignatureParser.java
index 83505e1..2ea0b5a 100644
--- a/luni/src/main/java/org/apache/harmony/luni/lang/reflect/GenericSignatureParser.java
+++ b/luni/src/main/java/org/apache/harmony/luni/lang/reflect/GenericSignatureParser.java
@@ -73,6 +73,7 @@ public class GenericSignatureParser {
public Type fieldType;
public ListOfTypes interfaceTypes;
public Type superclassType;
+ public ClassLoader loader;
GenericDeclaration genericDecl;
@@ -93,6 +94,10 @@ public class GenericSignatureParser {
char[] buffer;
int pos;
+ public GenericSignatureParser(ClassLoader loader) {
+ this.loader = loader;
+ }
+
void setInput(GenericDeclaration genericDecl, String input) {
if (input != null) {
this.genericDecl = genericDecl;
@@ -297,7 +302,7 @@ public class GenericSignatureParser {
ListOfTypes typeArgs = parseOptTypeArguments();
ImplForType parentType =
- new ImplForType(null, qualIdent.toString(), typeArgs);
+ new ImplForType(null, qualIdent.toString(), typeArgs, loader);
ImplForType type = parentType;
while (symbol == '.') {
@@ -306,7 +311,8 @@ public class GenericSignatureParser {
scanIdentifier();
qualIdent.append("$").append(identifier); // FIXME: is "$" correct?
typeArgs = parseOptTypeArguments();
- type = new ImplForType(parentType, qualIdent.toString(), typeArgs);
+ type = new ImplForType(parentType, qualIdent.toString(), typeArgs,
+ loader);
}
expect(';');
diff --git a/luni/src/main/java/org/apache/harmony/luni/lang/reflect/ImplForType.java b/luni/src/main/java/org/apache/harmony/luni/lang/reflect/ImplForType.java
index 8553276..70f05b4 100644
--- a/luni/src/main/java/org/apache/harmony/luni/lang/reflect/ImplForType.java
+++ b/luni/src/main/java/org/apache/harmony/luni/lang/reflect/ImplForType.java
@@ -25,13 +25,15 @@ public final class ImplForType implements ParameterizedType {
private Type ownerTypeRes;
private Class rawType; // Already resolved.
private final String rawTypeName;
+ private ClassLoader loader;
public ImplForType(ImplForType ownerType, String rawTypeName,
- ListOfTypes args) {
+ ListOfTypes args, ClassLoader loader) {
this.ownerType0 = ownerType;
this.rawTypeName = rawTypeName;
this.args = args;
+ this.loader = loader;
}
@@ -53,12 +55,11 @@ public final class ImplForType implements ParameterizedType {
public Class getRawType() {
if (rawType == null) {
- // TODO which ClassLoader to use?
- // Here the actual loading of the class has to be performed and the
- // Exceptions have to be re-thrown TypeNotPresent...
- // How to deal with member (nested) classes?
+ // Here the actual loading of the class has to be performed and the
+ // Exceptions have to be re-thrown TypeNotPresent...
+ // How to deal with member (nested) classes?
try {
- rawType = Class.forName(rawTypeName);
+ rawType = Class.forName(rawTypeName, false, loader);
} catch (ClassNotFoundException e) {
throw new TypeNotPresentException(rawTypeName, e);
}
diff --git a/nio/src/main/java/java/nio/Buffer.java b/nio/src/main/java/java/nio/Buffer.java
index 844d2ce..9e870e4 100644
--- a/nio/src/main/java/java/nio/Buffer.java
+++ b/nio/src/main/java/java/nio/Buffer.java
@@ -150,21 +150,11 @@ public abstract class Buffer {
* @since Android 1.0
*/
public final Buffer clear() {
- // BEGIN android-changed
- internalClear();
- // END android-changed
- return this;
- }
-
- // BEGIN android-added
- // We need a possibility to change the behavior of clear in some optimized
- // DirectByteBuffer adapters.
- void internalClear() {
position = 0;
mark = UNSET_MARK;
limit = capacity;
+ return this;
}
- // END android-added
/**
* Flips this buffer.
diff --git a/nio/src/main/java/java/nio/IntToByteBufferAdapter.java b/nio/src/main/java/java/nio/IntToByteBufferAdapter.java
index e52f6b6..91b9311 100644
--- a/nio/src/main/java/java/nio/IntToByteBufferAdapter.java
+++ b/nio/src/main/java/java/nio/IntToByteBufferAdapter.java
@@ -194,8 +194,11 @@ final class IntToByteBufferAdapter extends IntBuffer implements DirectBuffer {
}
// BEGIN android-added
+ @Override
public IntBuffer put(int[] i, int off, int len) {
if (byteBuffer instanceof ReadWriteDirectByteBuffer) {
+ byteBuffer.limit(limit << 2);
+ byteBuffer.position(position << 2);
((ReadWriteDirectByteBuffer) byteBuffer).put(i, off, len);
this.position += len;
return this;
@@ -203,14 +206,6 @@ final class IntToByteBufferAdapter extends IntBuffer implements DirectBuffer {
return super.put(i, off, len);
}
}
-
- @Override
- void internalClear() {
- if (byteBuffer instanceof ReadWriteDirectByteBuffer) {
- byteBuffer.clear();
- }
- super.internalClear();
- }
// END android-added
public IntBuffer slice() {
diff --git a/nio/src/main/java/java/nio/ShortToByteBufferAdapter.java b/nio/src/main/java/java/nio/ShortToByteBufferAdapter.java
index fe4fff4..41ce50c 100644
--- a/nio/src/main/java/java/nio/ShortToByteBufferAdapter.java
+++ b/nio/src/main/java/java/nio/ShortToByteBufferAdapter.java
@@ -194,8 +194,11 @@ final class ShortToByteBufferAdapter extends ShortBuffer implements DirectBuffer
}
// BEGIN android-added
+ @Override
public ShortBuffer put(short[] s, int off, int len) {
if (byteBuffer instanceof ReadWriteDirectByteBuffer) {
+ byteBuffer.limit(limit << 1);
+ byteBuffer.position(position << 1);
((ReadWriteDirectByteBuffer) byteBuffer).put(s, off, len);
this.position += len;
return this;
@@ -203,14 +206,6 @@ final class ShortToByteBufferAdapter extends ShortBuffer implements DirectBuffer
return super.put(s, off, len);
}
}
-
- @Override
- void internalClear() {
- if (byteBuffer instanceof ReadWriteDirectByteBuffer) {
- byteBuffer.clear();
- }
- super.internalClear();
- }
// END android-added
public ShortBuffer slice() {
diff --git a/xml/src/main/java/org/xml/sax/ext/Attributes2Impl.java b/xml/src/main/java/org/xml/sax/ext/Attributes2Impl.java
index 81b9b93..fc36805 100644
--- a/xml/src/main/java/org/xml/sax/ext/Attributes2Impl.java
+++ b/xml/src/main/java/org/xml/sax/ext/Attributes2Impl.java
@@ -44,7 +44,12 @@ public class Attributes2Impl extends AttributesImpl implements Attributes2
/**
* Construct a new, empty Attributes2Impl object.
*/
- public Attributes2Impl () { }
+ public Attributes2Impl () {
+ // BEGIN android-added
+ declared = new boolean[0];
+ specified = new boolean[0];
+ // END android-added
+ }
/**
@@ -241,7 +246,9 @@ public class Attributes2Impl extends AttributesImpl implements Attributes2
int length = getLength ();
- if (length < specified.length) {
+ // BEGIN android-changed
+ if (length > specified.length) {
+ // END android-changed
boolean newFlags [];
newFlags = new boolean [length];
diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java
index cd1b872..9ccdc8a 100644
--- a/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java
+++ b/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java
@@ -72,7 +72,6 @@ public class Attributes2ImplTest extends TestCase {
method = "setAttributes",
args = { Attributes.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testSetAttributes() {
// Ordinary case with Attributes2Impl
Attributes2Impl attrs = new Attributes2Impl();
@@ -130,7 +129,6 @@ public class Attributes2ImplTest extends TestCase {
args = { String.class, String.class, String.class, String.class,
String.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testAddAttribute() {
Attributes2Impl attrs = new Attributes2Impl();
@@ -170,7 +168,6 @@ public class Attributes2ImplTest extends TestCase {
method = "removeAttribute",
args = { int.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testRemoveAttribute() {
Attributes2Impl attrs = new Attributes2Impl(multi);
@@ -216,7 +213,6 @@ public class Attributes2ImplTest extends TestCase {
method = "Attributes2Impl",
args = { }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testAttributes2Impl() {
assertEquals(0, empty.getLength());
}
@@ -226,7 +222,6 @@ public class Attributes2ImplTest extends TestCase {
method = "Attributes2Impl",
args = { Attributes.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testAttributes2ImplAttributes() {
// Ordinary case with Attributes2Impl
Attributes2Impl attrs = new Attributes2Impl(multi);
@@ -279,7 +274,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isDeclared",
args = { int.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsDeclaredInt() {
// Ordinary cases
assertEquals(false, multi.isDeclared(0));
@@ -306,7 +300,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isDeclared",
args = { String.class, String.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsDeclaredStringString() {
// Ordinary cases
assertEquals(false, multi.isDeclared("http://some.uri", "foo"));
@@ -326,7 +319,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isDeclared",
args = { String.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsDeclaredString() {
// Ordinary cases
assertEquals(false, multi.isDeclared("ns1:foo"));
@@ -346,7 +338,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isSpecified",
args = { int.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsSpecifiedInt() {
// Ordinary cases
assertEquals(false, multi.isSpecified(1));
@@ -373,7 +364,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isSpecified",
args = { String.class, String.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsSpecifiedStringString() {
// Ordinary cases
assertEquals(false, multi.isSpecified("http://some.uri", "bar"));
@@ -393,7 +383,6 @@ public class Attributes2ImplTest extends TestCase {
method = "isSpecified",
args = { String.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testIsSpecifiedString() {
// Ordinary cases
assertEquals(false, multi.isSpecified("ns1:bar"));
@@ -413,7 +402,6 @@ public class Attributes2ImplTest extends TestCase {
method = "setDeclared",
args = { int.class, boolean.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testSetDeclared() {
// Ordinary cases
multi.setSpecified(0, false);
@@ -446,7 +434,6 @@ public class Attributes2ImplTest extends TestCase {
method = "setSpecified",
args = { int.class, boolean.class }
)
- @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.")
public void testSetSpecified() {
// Ordinary cases
multi.setSpecified(0, false);