text
stringlengths
3
1.18M
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project import java.util.Timer; import java.util.TimerTask; /* * Throw an exception from a finalizer and make sure it's harmless. Under * Dalvik this may also generate a warning in the log file. */ public class Main { static Object waiter = new Object(); static vo...
// Copyright 2006 The Android Open Source Project /** * Test some basic thread stuff. */ public class Main { public static void main(String[] args) { for (int i = 0; i < 512; i++) { MyThread myThread = new MyThread(); myThread.start(); try { Thread.slee...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2007 The Android Open Source Project import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; class Privvy implements PrivilegedAction<Integer> { private Integer mValue; public Privvy(int val) { mValue = new Integer(val + 1); ...
// Copyright 2007 The Android Open Source Project import java.security.AccessController; /** * Test java.security.AccessController. */ public class Main { public static void main(String[] args) { Privvy priv = new Privvy(38); Integer result = AccessController.doPrivileged(priv); System.o...
package android.test.anno; @AnnoSimpleType @AnnoSimpleType2 @AnnoSimpleTypeInvis public class SimplyNoted { @AnnoSimpleField public int mFoo; @AnnoSimpleField public static int mOneFoo; @AnnoSimpleConstructor SimplyNoted() { mFoo = 0; } @AnnoSimpleConstructor SimplyNoted(...
/* part of test for array problem */ package android.test.anno; import java.lang.annotation.*; @Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface IntToString { int from(); String to(); }
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimpleParameter {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoFancyParameter { double factor(); }
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.CONSTRUCTOR) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimpleConstructor {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoFancyType { public int num(); public String name() default "unknown"; }
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimpleField {}
@AnnoSimplePackage package android.test.anno;
package android.test.anno; import java.io.IOException; import java.io.EOFException; @AnnoFancyType(num=5, name="full") public class FullyNoted { @AnnoFancyField(nombre="fubar") int mBar; @AnnoFancyConstructor(numArgs=1) FullyNoted(@AnnoFancyParameter(factor=0.5) int bar) { mBar = bar; ...
package android.test.anno; @AnnoSimpleType2 public interface INoted { @AnnoSimpleMethod public int bar(); }
/* part of test for array problem */ package android.test.anno; import java.lang.annotation.*; @Target({ ElementType.FIELD, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface ExportedProperty { boolean resolveId() default false; IntToString[] mapping() default { @IntToString(from = -...
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimpleMethod {}
package android.test.anno; import java.lang.annotation.*; @Documented @Inherited @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoArrayField { boolean[] zz() default {}; byte[] bb() default {}; char[] cc() default {'a', 'b'}; short[] ss() default {}; int[] ii(...
package android.test.anno; @AnnoFancyType(num=5) // first occurrence of AnnoFancyType // we inherit @AnnoSimpleType @AnnoSimpleType2 // AnnoSimpleType2 here *and* inherited from parent public class SubNoted extends SimplyNoted implements INoted { int mBar; public i...
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) @Inherited // should have no effect @Documented public @interface AnnoFancyField { public String nombre() default "no se"; }
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoFancyMethod { enum AnnoFancyMethodEnum { FOO, BAR }; boolean callMe() default false; boolean biteMe(); AnnoFancyMethodEnum enumerated() default AnnoFancyMeth...
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.PACKAGE) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimplePackage {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface AnnoSimpleType {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.CLASS) public @interface AnnoSimpleTypeInvis {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.LOCAL_VARIABLE) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoSimpleLocalVariable {}
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.CONSTRUCTOR) @Retention(RetentionPolicy.RUNTIME) public @interface AnnoFancyConstructor { public int numArgs() default 0; }
package android.test.anno; public class SomeClass { }
package android.test.anno; import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface AnnoSimpleType2 {}
import android.test.anno.TestAnnotations; public class Main { static public void main(String[] args) { TestAnnotations.main(args); } }
// Copyright 2006 The Android Open Source Project /** * Test the uncaught exception handler. */ public class Main { public static void main(String[] args) { testThread(1); testThread(2); testThread(3); catchTheUncaught(1); } private static void testThread(int which) { ...
// Copyright 2007 The Android Open Source Project import java.lang.Thread.UncaughtExceptionHandler; /** * Report death-by-uncaught-exception. */ public class ThreadDeathHandler implements Thread.UncaughtExceptionHandler { private String mMyMessage; public ThreadDeathHandler(String msg) { mMyMessage...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project /** * Test comparison operators. */ public class Compare { /* * Test the integer comparisons in various ways. */ static void testIntCompare(int minus, int plus, int plus2, int zero) { System.out.println("IntMath.testIntCompare"); ...
// Copyright 2006 The Android Open Source Project /** * Test arithmetic operations. */ public class FloatMath { static void convTest() { System.out.println("FloatMath.convTest"); float f; double d; int i; long l; /* float --> int */ f = 1234.5678f; ...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Test failure to resolve class members. */ class UnresTest1 { public static void run() { System.out.println("UnresTest1..."); UnresStuff stuff = new UnresStuff(); try { int x = stuff.instField; assert(false); } catch (NoSuchFieldError nsfe) { ...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project /** * Exercise arrays. */ public class Array { /* * Verify array contents. */ static void checkBytes(byte[] bytes) { assert(bytes[0] == 0); assert(bytes[1] == -1); assert(bytes[2] == -2); assert(bytes[3] == -3); ...
public class Switch { /** * Test switch() blocks */ private static void testSwitch() { System.out.println("Switch.testSwitch"); int a = 1; switch (a) { case -1: assert(false); break; case 0: assert(false); break; case 1: /*correct*/ break; ...
// Copyright 2008 The Android Open Source Project /** * Exercise monitors. */ public class Monitor { public static int mVal = 0; public synchronized void subTest() { Object obj = new Object(); synchronized (obj) { mVal++; obj = null; // does NOT cause a failure ...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Unresolved class. * * "happy" version. */ public class UnresClass { int foo; }
// Copyright 2006 The Android Open Source Project /** * Test arithmetic operations. */ public class IntMath { static void shiftTest1() { System.out.println("IntMath.shiftTest1"); final int[] mBytes = { 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb }; long l; ...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project import java.io.Serializable; import java.util.Arrays; /** * Exercise some class-related instructions. */ public class Classes { int mSome; public void subFunc(boolean wantSub) { assert(!wantSub); } void checkCast(Object thisRef, Object more...
/* * Test failure to resolve classes. */ class UnresTest2 { /* * Try check-cast and instance-of. */ static boolean checkCasts(Object obj) { boolean foo = false; try { UnresClass un = (UnresClass) obj; assert(false); } catch (NoClassDefFoundError ncdfe...
/* * Unresolved classes / fields / methods in a resolved class. * * "happy" version. */ public class UnresStuff { public int instField; public static int staticField; public double wideInstField; public static double wideStaticField; public void virtualMethod() { System.out.println("...
/* * Unresolved classes / fields / methods in a resolved class. * * "happy" version. */ public class UnresStuff { public int x; }
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2007 The Android Open Source Project /** * Test Java language asserts. */ public class Main { public static void main(String[] args) { assert true; try { assert false; System.out.println("GLITCH: didn't assert (is '-ea' set?)"); } catch (AssertionError...
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
import sun.misc.Unsafe; import java.lang.reflect.Field; public class Main { private static Unsafe UNSAFE; public static void main(String[] args) throws Exception { setUp(); ParkTester test = new ParkTester(); System.out.println("Test starting"); test.start(); UNSAFE...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project public interface Defs { public void func(); // func2 not defined }
// Copyright 2008 The Android Open Source Project public class Base implements Defs { public void func() { System.out.println("whee"); } };
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project public abstract class Defs { public void func() { System.out.println("yo"); } public void func2() { System.out.println("yo yo"); } }
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2008 The Android Open Source Project /* * Some basic operations for testing the debugger. */ public class Main { long mLong = 0x1122334455667788L; public Main() { double d = 3.1415; System.out.println("d is " + d); } public static void showObject(Object[] foo) { ...
// Copyright 2007 The Android Open Source Project /** * Array write speed test. */ public class Main { /** whether to report times */ static boolean timing = false; static final int STORAGE_SIZE = 128*1024; static int[] mStorage = new int[STORAGE_SIZE]; static public void report(long start, lon...
// Copyright 2007 The Android Open Source Project /* Initial: test001: 2039901us (4079ns per call) test049: 3346619us (6693ns per call) test099: 4687402us (9374ns per call) testInst001: 1327216us (2654ns per use) testInst049: 1326995us (2653ns per use) testInst099: 1327735us (2655ns per use) After refactoring c...
public class Main { static public void main(String[] args) throws Exception { boolean timing = (args.length >= 1) && args[0].equals("--timing"); ManyInterfaces.run(timing); } }
// Copyright 2007 The Android Open Source Project /** * Return stuff. */ public class Main { public static void main(String[] args) { System.out.println("pick 1"); pickOne(1).run(); System.out.println(((CommonInterface)pickOne(1)).doStuff()); System.out.println("pick 2"); ...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
// Copyright 2006 The Android Open Source Project /** * This causes most VMs to lock up. * * Interrupting threads in class initialization should NOT work. */ public class Main { public static boolean aInitialized = false; public static boolean bInitialized = false; static public void main(String[] arg...
// Copyright 2007 The Android Open Source Project /** * Exercise Object.wait(), comparing results against wall clock time. */ public class Main { /* delays, in milliseconds */ private final static long[] DELAYS = { 200, 500, 1000, 2000, 3500, 8000 }; public static void main(String[] args) { ...
import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.Set; public class Main { static public void main(String[] args) throws Exception { ...
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...