├── .gitignore ├── LICENSE ├── README.md ├── jack ├── .classpath ├── .project ├── libs │ ├── gc │ │ ├── include │ │ │ ├── cord.h │ │ │ ├── ec.h │ │ │ ├── extra │ │ │ │ ├── gc.h │ │ │ │ └── gc_cpp.h │ │ │ ├── gc.h │ │ │ ├── gc_allocator.h │ │ │ ├── gc_amiga_redirects.h │ │ │ ├── gc_backptr.h │ │ │ ├── gc_config_macros.h │ │ │ ├── gc_cpp.h │ │ │ ├── gc_gcj.h │ │ │ ├── gc_inline.h │ │ │ ├── gc_mark.h │ │ │ ├── gc_pthread_redirects.h │ │ │ ├── gc_tiny_fl.h │ │ │ ├── gc_typed.h │ │ │ ├── gc_version.h │ │ │ ├── include.am │ │ │ ├── javaxfc.h │ │ │ ├── leak_detector.h │ │ │ ├── new_gc_alloc.h │ │ │ ├── private │ │ │ │ ├── config.h.in │ │ │ │ ├── cord_pos.h │ │ │ │ ├── darwin_semaphore.h │ │ │ │ ├── darwin_stop_world.h │ │ │ │ ├── dbg_mlc.h │ │ │ │ ├── gc_hdrs.h │ │ │ │ ├── gc_locks.h │ │ │ │ ├── gc_pmark.h │ │ │ │ ├── gc_priv.h │ │ │ │ ├── gcconfig.h │ │ │ │ ├── msvc_dbg.h │ │ │ │ ├── pthread_stop_world.h │ │ │ │ ├── pthread_support.h │ │ │ │ ├── specific.h │ │ │ │ └── thread_local_alloc.h │ │ │ └── weakpointer.h │ │ ├── macosx64 │ │ │ └── libgc.a │ │ └── windows32 │ │ │ └── gc.lib │ └── soot-2.5.0.jar ├── native │ ├── build-windows32.xml │ ├── build.xml │ ├── jack.cpp │ ├── jni-headers │ │ ├── classfile_constants.h │ │ ├── jawt.h │ │ ├── jdwpTransport.h │ │ ├── jni.h │ │ ├── linux │ │ │ ├── jawt_md.h │ │ │ └── jni_md.h │ │ ├── mac │ │ │ └── jni_md.h │ │ └── win32 │ │ │ ├── jawt_md.h │ │ │ └── jni_md.h │ ├── test.cpp │ └── vm │ │ ├── array.h │ │ ├── classmanager.cpp │ │ ├── classmanager.h │ │ ├── garbagecollection.cpp │ │ ├── garbagecollection.h │ │ ├── java_lang.cpp │ │ ├── list.h │ │ ├── resizablearray.h │ │ ├── stringmap.h │ │ ├── time.cpp │ │ ├── time.h │ │ └── types.h └── src │ └── com │ └── badlogic │ └── jack │ ├── Jack.java │ ├── JackBuild.java │ ├── Test.java │ ├── build │ ├── AndroidNdkScriptGenerator.java │ ├── AntPathMatcher.java │ ├── AntScriptGenerator.java │ ├── BuildConfig.java │ ├── BuildExecutor.java │ ├── BuildTarget.java │ ├── FileDescriptor.java │ └── resources │ │ ├── headers │ │ ├── classfile_constants.h │ │ ├── jawt.h │ │ ├── jdwpTransport.h │ │ ├── jni.h │ │ ├── linux │ │ │ ├── jawt_md.h │ │ │ └── jni_md.h │ │ ├── mac │ │ │ └── jni_md.h │ │ └── win32 │ │ │ ├── jawt_md.h │ │ │ └── jni_md.h │ │ └── scripts │ │ ├── Android.mk.template │ │ ├── Application.mk.template │ │ ├── build-android.xml.template │ │ ├── build-target.xml.template │ │ └── build.xml.template │ ├── generators │ ├── ClinitGenerator.java │ ├── HeaderGenerator.java │ ├── ImplementationGenerator.java │ ├── LiteralsGenerator.java │ ├── MethodBodyGenerator.java │ ├── MethodGenerator.java │ ├── NativeMethodGenerator.java │ ├── ReflectionGenerator.java │ ├── RuntimeGenerator.java │ ├── SignalHandlerGenerator.java │ ├── StatementGenerator.java │ └── StaticsGenerator.java │ ├── info │ ├── ClassInfo.java │ ├── FieldInfo.java │ ├── MethodInfo.java │ └── SyntheticMethodInfo.java │ └── utils │ ├── CTypes.java │ ├── JavaSourceProvider.java │ ├── JavaTypes.java │ ├── Mangling.java │ └── SourceWriter.java ├── runtime ├── jack-kernel │ ├── .classpath │ ├── .project │ └── src │ │ ├── avian │ │ ├── Cell.java │ │ ├── Iso88591.java │ │ ├── PersistentSet.java │ │ └── Utf8.java │ │ └── java │ │ ├── io │ │ ├── BufferedInputStream.java │ │ ├── BufferedOutputStream.java │ │ ├── BufferedReader.java │ │ ├── BufferedWriter.java │ │ ├── ByteArrayInputStream.java │ │ ├── ByteArrayOutputStream.java │ │ ├── EOFException.java │ │ ├── Externalizable.java │ │ ├── File.java │ │ ├── FileDescriptor.java │ │ ├── FileInputStream.java │ │ ├── FileNotFoundException.java │ │ ├── FileOutputStream.java │ │ ├── FileReader.java │ │ ├── FileWriter.java │ │ ├── FilenameFilter.java │ │ ├── FilterOutputStream.java │ │ ├── IOException.java │ │ ├── InputStream.java │ │ ├── InputStreamReader.java │ │ ├── LineNumberReader.java │ │ ├── NotSerializableException.java │ │ ├── ObjectInput.java │ │ ├── ObjectOutput.java │ │ ├── ObjectStreamException.java │ │ ├── OutputStream.java │ │ ├── OutputStreamWriter.java │ │ ├── PrintStream.java │ │ ├── PrintWriter.java │ │ ├── PushbackReader.java │ │ ├── RandomAccessFile.java │ │ ├── Reader.java │ │ ├── Serializable.java │ │ ├── StreamCorruptedException.java │ │ ├── StringReader.java │ │ ├── StringWriter.java │ │ ├── UnsupportedEncodingException.java │ │ └── Writer.java │ │ ├── lang │ │ ├── AbstractMethodError.java │ │ ├── Appendable.java │ │ ├── ArithmeticException.java │ │ ├── ArrayIndexOutOfBoundsException.java │ │ ├── ArrayStoreException.java │ │ ├── Boolean.java │ │ ├── Byte.java │ │ ├── CharSequence.java │ │ ├── Character.java │ │ ├── Class.java │ │ ├── ClassCastException.java │ │ ├── ClassCircularityError.java │ │ ├── ClassFormatError.java │ │ ├── ClassNotFoundException.java │ │ ├── Cloneable.java │ │ ├── Comparable.java │ │ ├── Double.java │ │ ├── Enum.java │ │ ├── Error.java │ │ ├── Exception.java │ │ ├── Float.java │ │ ├── IllegalAccessError.java │ │ ├── IllegalAccessException.java │ │ ├── IllegalArgumentException.java │ │ ├── IllegalMonitorStateException.java │ │ ├── IllegalStateException.java │ │ ├── IncompatibleClassChangeError.java │ │ ├── IndexOutOfBoundsException.java │ │ ├── InstantiationError.java │ │ ├── InstantiationException.java │ │ ├── Integer.java │ │ ├── InternalError.java │ │ ├── Iterable.java │ │ ├── LinkageError.java │ │ ├── Long.java │ │ ├── Math.java │ │ ├── NegativeArraySizeException.java │ │ ├── NoClassDefFoundError.java │ │ ├── NoSuchFieldError.java │ │ ├── NoSuchFieldException.java │ │ ├── NoSuchMethodError.java │ │ ├── NoSuchMethodException.java │ │ ├── NullPointerException.java │ │ ├── Number.java │ │ ├── NumberFormatException.java │ │ ├── Object.java │ │ ├── OutOfMemoryError.java │ │ ├── Override.java │ │ ├── RuntimeException.java │ │ ├── Short.java │ │ ├── StackOverflowError.java │ │ ├── StackTraceElement.java │ │ ├── String.java │ │ ├── StringBuffer.java │ │ ├── StringBuilder.java │ │ ├── System.java │ │ ├── ThreadDeath.java │ │ ├── Throwable.java │ │ ├── UnknownError.java │ │ ├── UnsatisfiedLinkError.java │ │ ├── UnsupportedOperationException.java │ │ ├── VerifyError.java │ │ ├── VirtualMachineError.java │ │ ├── Void.java │ │ ├── annotation │ │ │ ├── Annotation.java │ │ │ ├── DirectNative.java │ │ │ ├── ElementType.java │ │ │ ├── Retention.java │ │ │ ├── RetentionPolicy.java │ │ │ └── Target.java │ │ ├── ref │ │ │ ├── PhantomReference.java │ │ │ ├── Reference.java │ │ │ ├── ReferenceQueue.java │ │ │ ├── SoftReference.java │ │ │ └── WeakReference.java │ │ └── reflect │ │ │ ├── Array.java │ │ │ ├── Constructor.java │ │ │ ├── Field.java │ │ │ ├── InvocationTargetException.java │ │ │ └── Method.java │ │ └── util │ │ ├── AbstractCollection.java │ │ ├── AbstractList.java │ │ ├── AbstractMap.java │ │ ├── AbstractQueue.java │ │ ├── AbstractSequentialList.java │ │ ├── AbstractSet.java │ │ ├── ArrayList.java │ │ ├── Arrays.java │ │ ├── BitSet.java │ │ ├── Calendar.java │ │ ├── Collection.java │ │ ├── Collections.java │ │ ├── Comparator.java │ │ ├── ConcurrentModificationException.java │ │ ├── Date.java │ │ ├── EnumSet.java │ │ ├── Enumeration.java │ │ ├── EventListener.java │ │ ├── EventObject.java │ │ ├── HashMap.java │ │ ├── HashSet.java │ │ ├── Hashtable.java │ │ ├── IdentityHashMap.java │ │ ├── Iterator.java │ │ ├── LinkedList.java │ │ ├── List.java │ │ ├── ListIterator.java │ │ ├── Locale.java │ │ ├── Map.java │ │ ├── MissingResourceException.java │ │ ├── NoSuchElementException.java │ │ ├── Properties.java │ │ ├── Queue.java │ │ ├── Random.java │ │ ├── RandomAccess.java │ │ ├── Set.java │ │ ├── SortedSet.java │ │ ├── Stack.java │ │ ├── StringTokenizer.java │ │ ├── TreeMap.java │ │ ├── TreeSet.java │ │ ├── UUID.java │ │ ├── Vector.java │ │ ├── WeakHashMap.java │ │ └── regex │ │ ├── Matcher.java │ │ └── Pattern.java ├── jack-library │ ├── .classpath │ ├── .project │ └── src │ │ └── java │ │ ├── io │ │ ├── BufferedInputStream.java │ │ ├── BufferedOutputStream.java │ │ ├── BufferedReader.java │ │ ├── BufferedWriter.java │ │ ├── EOFException.java │ │ ├── Externalizable.java │ │ ├── File.java │ │ ├── FileDescriptor.java │ │ ├── FileInputStream.java │ │ ├── FileNotFoundException.java │ │ ├── FileOutputStream.java │ │ ├── FileReader.java │ │ ├── FileWriter.java │ │ ├── FilenameFilter.java │ │ ├── FilterOutputStream.java │ │ ├── LineNumberReader.java │ │ ├── NotSerializableException.java │ │ ├── ObjectInput.java │ │ ├── ObjectOutput.java │ │ ├── ObjectStreamException.java │ │ ├── PushbackReader.java │ │ ├── RandomAccessFile.java │ │ ├── StreamCorruptedException.java │ │ ├── StringReader.java │ │ └── StringWriter.java │ │ └── util │ │ ├── AbstractCollection.java │ │ ├── AbstractList.java │ │ ├── AbstractMap.java │ │ ├── AbstractQueue.java │ │ ├── AbstractSequentialList.java │ │ ├── AbstractSet.java │ │ ├── ArrayList.java │ │ ├── Arrays.java │ │ ├── BitSet.java │ │ ├── Calendar.java │ │ ├── Collections.java │ │ ├── ConcurrentModificationException.java │ │ ├── Date.java │ │ ├── EnumSet.java │ │ ├── Enumeration.java │ │ ├── EventListener.java │ │ ├── EventObject.java │ │ ├── HashMap.java │ │ ├── HashSet.java │ │ ├── Hashtable.java │ │ ├── IdentityHashMap.java │ │ ├── Locale.java │ │ ├── Map.java │ │ ├── MissingResourceException.java │ │ ├── Properties.java │ │ ├── Queue.java │ │ ├── RandomAccess.java │ │ ├── Set.java │ │ ├── SortedSet.java │ │ ├── Stack.java │ │ ├── StringTokenizer.java │ │ ├── TreeMap.java │ │ ├── TreeSet.java │ │ ├── UUID.java │ │ ├── Vector.java │ │ ├── WeakHashMap.java │ │ └── regex │ │ ├── Matcher.java │ │ └── Pattern.java └── jack-tests │ ├── .classpath │ ├── .project │ └── src │ └── jack │ └── tests │ ├── Arithmetic.java │ ├── ArrayTest.java │ ├── Arrays.java │ ├── Exceptions.java │ ├── InstanceOf.java │ ├── Main.java │ ├── Primes.java │ ├── Reflection.java │ ├── Statics.java │ ├── Strings.java │ └── Synchronized.java ├── vs10 ├── vs10.sln ├── vs10.vcxproj └── vs10.vcxproj.filters └── xcode └── jack.xcodeproj ├── project.pbxproj ├── project.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── badlogic.xcuserdatad │ └── UserInterfaceState.xcuserstate └── xcuserdata └── badlogic.xcuserdatad └── xcschemes ├── jack.xcscheme └── xcschememanagement.plist /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | bin/ 3 | classpath/bin/ 4 | libs/windows32/ 5 | vs10/ 6 | jack/native/classes/ 7 | jack/native/target/ 8 | xcode/build 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Mario Zechner 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /jack/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /jack/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jack 4 | Lol, this is not a serious attempt really. Writting a Java bytecode to C 5 | transpiler is just silly. Trust!. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | org.eclipse.jdt.core.javanature 14 | 15 | -------------------------------------------------------------------------------- /jack/libs/gc/include/ec.h: -------------------------------------------------------------------------------- 1 | # ifndef EC_H 2 | # define EC_H 3 | 4 | # ifndef CORD_H 5 | # include "cord.h" 6 | # endif 7 | 8 | /* Extensible cords are strings that may be destructively appended to. */ 9 | /* They allow fast construction of cords from characters that are */ 10 | /* being read from a stream. */ 11 | /* 12 | * A client might look like: 13 | * 14 | * { 15 | * CORD_ec x; 16 | * CORD result; 17 | * char c; 18 | * FILE *f; 19 | * 20 | * ... 21 | * CORD_ec_init(x); 22 | * while(...) { 23 | * c = getc(f); 24 | * ... 25 | * CORD_ec_append(x, c); 26 | * } 27 | * result = CORD_balance(CORD_ec_to_cord(x)); 28 | * 29 | * If a C string is desired as the final result, the call to CORD_balance 30 | * may be replaced by a call to CORD_to_char_star. 31 | */ 32 | 33 | # ifndef CORD_BUFSZ 34 | # define CORD_BUFSZ 128 35 | # endif 36 | 37 | typedef struct CORD_ec_struct { 38 | CORD ec_cord; 39 | char * ec_bufptr; 40 | char ec_buf[CORD_BUFSZ+1]; 41 | } CORD_ec[1]; 42 | 43 | /* This structure represents the concatenation of ec_cord with */ 44 | /* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */ 45 | 46 | /* Flush the buffer part of the extended chord into ec_cord. */ 47 | /* Note that this is almost the only real function, and it is */ 48 | /* implemented in 6 lines in cordxtra.c */ 49 | void CORD_ec_flush_buf(CORD_ec x); 50 | 51 | /* Convert an extensible cord to a cord. */ 52 | # define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord) 53 | 54 | /* Initialize an extensible cord. */ 55 | # define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf) 56 | 57 | /* Append a character to an extensible cord. */ 58 | # define CORD_ec_append(x, c) \ 59 | { \ 60 | if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \ 61 | CORD_ec_flush_buf(x); \ 62 | } \ 63 | *((x)[0].ec_bufptr)++ = (c); \ 64 | } 65 | 66 | /* Append a cord to an extensible cord. Structure remains shared with */ 67 | /* original. */ 68 | void CORD_ec_append_cord(CORD_ec x, CORD s); 69 | 70 | # endif /* EC_H */ 71 | -------------------------------------------------------------------------------- /jack/libs/gc/include/extra/gc.h: -------------------------------------------------------------------------------- 1 | /* This file is installed for backward compatibility. */ 2 | #include 3 | -------------------------------------------------------------------------------- /jack/libs/gc/include/extra/gc_cpp.h: -------------------------------------------------------------------------------- 1 | /* This file is installed for backward compatibility. */ 2 | #include 3 | -------------------------------------------------------------------------------- /jack/libs/gc/include/gc_amiga_redirects.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_AMIGA_REDIRECTS_H 2 | 3 | # define GC_AMIGA_REDIRECTS_H 4 | 5 | # if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) ) 6 | extern void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes); 7 | # define GC_realloc(a,b) GC_amiga_realloc(a,b) 8 | extern void GC_amiga_set_toany(void (*func)(void)); 9 | extern int GC_amiga_free_space_divisor_inc; 10 | extern void *(*GC_amiga_allocwrapper_do) \ 11 | (size_t size,void *(*AllocFunction)(size_t size2)); 12 | # define GC_malloc(a) \ 13 | (*GC_amiga_allocwrapper_do)(a,GC_malloc) 14 | # define GC_malloc_atomic(a) \ 15 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic) 16 | # define GC_malloc_uncollectable(a) \ 17 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_uncollectable) 18 | # define GC_malloc_stubborn(a) \ 19 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_stubborn) 20 | # define GC_malloc_atomic_uncollectable(a) \ 21 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_uncollectable) 22 | # define GC_malloc_ignore_off_page(a) \ 23 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_ignore_off_page) 24 | # define GC_malloc_atomic_ignore_off_page(a) \ 25 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_ignore_off_page) 26 | # endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */ 27 | 28 | #endif /* GC_AMIGA_REDIRECTS_H */ 29 | 30 | 31 | -------------------------------------------------------------------------------- /jack/libs/gc/include/gc_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | * Copyright (c) 1996 by Silicon Graphics. All rights reserved. 4 | * Copyright (c) 1998 by Fergus Henderson. All rights reserved. 5 | * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. 6 | * All rights reserved. 7 | * 8 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 9 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 10 | * 11 | * Permission is hereby granted to use or copy this program 12 | * for any purpose, provided the above notices are retained on all copies. 13 | * Permission to modify the code and to distribute modified code is granted, 14 | * provided the above notices are retained, and a notice that the code was 15 | * modified is included with the above copyright notice. 16 | */ 17 | 18 | /* This should never be included directly; it is included only from gc.h. */ 19 | #if defined(GC_H) 20 | 21 | /* The version here should match that in configure/configure.ac */ 22 | /* Eventually this one may become unnecessary. For now we need */ 23 | /* it to keep the old-style build process working. */ 24 | #define GC_TMP_VERSION_MAJOR 7 25 | #define GC_TMP_VERSION_MINOR 2 26 | #define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA 27 | 28 | #ifndef GC_NOT_ALPHA 29 | # define GC_NOT_ALPHA 0xff 30 | #endif 31 | 32 | #ifdef GC_VERSION_MAJOR 33 | # if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR \ 34 | || GC_TMP_VERSION_MINOR != GC_VERSION_MINOR \ 35 | || defined(GC_ALPHA_VERSION) != (GC_TMP_ALPHA_VERSION != GC_NOT_ALPHA) \ 36 | || (defined(GC_ALPHA_VERSION) && GC_TMP_ALPHA_VERSION != GC_ALPHA_VERSION) 37 | # error Inconsistent version info. Check doc/README, include/gc_version.h, and configure.ac. 38 | # endif 39 | #else 40 | # define GC_VERSION_MAJOR GC_TMP_VERSION_MAJOR 41 | # define GC_VERSION_MINOR GC_TMP_VERSION_MINOR 42 | # define GC_ALPHA_VERSION GC_TMP_ALPHA_VERSION 43 | #endif /* !GC_VERSION_MAJOR */ 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /jack/libs/gc/include/include.am: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 4 | # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 5 | # 6 | # Permission is hereby granted to use or copy this program 7 | # for any purpose, provided the above notices are retained on all copies. 8 | # Permission to modify the code and to distribute modified code is granted, 9 | # provided the above notices are retained, and a notice that the code was 10 | # modified is included with the above copyright notice. 11 | # 12 | # Modified by: Grzegorz Jakacki 13 | # Modified by: Petter Urkedal 14 | 15 | ## Process this file with automake to produce part of Makefile.in. 16 | 17 | # installed headers 18 | # 19 | pkginclude_HEADERS += \ 20 | include/gc.h \ 21 | include/gc_typed.h \ 22 | include/gc_inline.h \ 23 | include/gc_mark.h \ 24 | include/weakpointer.h \ 25 | include/new_gc_alloc.h \ 26 | include/gc_allocator.h \ 27 | include/gc_backptr.h \ 28 | include/gc_gcj.h \ 29 | include/leak_detector.h \ 30 | include/gc_amiga_redirects.h \ 31 | include/gc_pthread_redirects.h \ 32 | include/gc_config_macros.h \ 33 | include/gc_tiny_fl.h \ 34 | include/gc_version.h 35 | 36 | # headers which are not installed 37 | # 38 | dist_noinst_HEADERS += \ 39 | include/private/gc_hdrs.h \ 40 | include/private/gc_priv.h \ 41 | include/private/gcconfig.h \ 42 | include/private/gc_pmark.h \ 43 | include/private/gc_locks.h \ 44 | include/private/dbg_mlc.h \ 45 | include/private/specific.h \ 46 | include/private/cord_pos.h \ 47 | include/private/pthread_support.h \ 48 | include/private/pthread_stop_world.h \ 49 | include/private/darwin_semaphore.h \ 50 | include/private/darwin_stop_world.h \ 51 | include/private/thread_local_alloc.h \ 52 | include/cord.h \ 53 | include/ec.h \ 54 | include/javaxfc.h 55 | 56 | # unprefixed header 57 | include_HEADERS += \ 58 | include/extra/gc.h 59 | -------------------------------------------------------------------------------- /jack/libs/gc/include/javaxfc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | * Copyright (c) 1996 by Silicon Graphics. All rights reserved. 4 | * Copyright (c) 1998 by Fergus Henderson. All rights reserved. 5 | * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. 6 | * All rights reserved. 7 | * 8 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 9 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 10 | * 11 | * Permission is hereby granted to use or copy this program 12 | * for any purpose, provided the above notices are retained on all copies. 13 | * Permission to modify the code and to distribute modified code is granted, 14 | * provided the above notices are retained, and a notice that the code was 15 | * modified is included with the above copyright notice. 16 | */ 17 | 18 | #ifndef GC_H 19 | # include "gc.h" 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * Invoke all remaining finalizers that haven't yet been run. (Since the 28 | * notifier is not called, this should be called from a separate thread.) 29 | * This function is needed for strict compliance with the Java standard, 30 | * which can make the runtime guarantee that all finalizers are run. 31 | * This is problematic for several reasons: 32 | * 1) It means that finalizers, and all methods called by them, 33 | * must be prepared to deal with objects that have been finalized in 34 | * spite of the fact that they are still referenced by statically 35 | * allocated pointer variables. 36 | * 1) It may mean that we get stuck in an infinite loop running 37 | * finalizers which create new finalizable objects, though that's 38 | * probably unlikely. 39 | * Thus this is not recommended for general use. 40 | */ 41 | GC_API void GC_CALL GC_finalize_all(void); 42 | 43 | #ifdef __cplusplus 44 | } /* end of extern "C" */ 45 | #endif 46 | -------------------------------------------------------------------------------- /jack/libs/gc/include/private/darwin_stop_world.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | * Copyright (c) 1996 by Silicon Graphics. All rights reserved. 4 | * Copyright (c) 1998 by Fergus Henderson. All rights reserved. 5 | * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. 6 | * All rights reserved. 7 | * 8 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 9 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 10 | * 11 | * Permission is hereby granted to use or copy this program 12 | * for any purpose, provided the above notices are retained on all copies. 13 | * Permission to modify the code and to distribute modified code is granted, 14 | * provided the above notices are retained, and a notice that the code was 15 | * modified is included with the above copyright notice. 16 | */ 17 | 18 | #ifndef GC_DARWIN_STOP_WORLD_H 19 | #define GC_DARWIN_STOP_WORLD_H 20 | 21 | #if !defined(GC_DARWIN_THREADS) 22 | # error darwin_stop_world.h included without GC_DARWIN_THREADS defined 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | struct thread_stop_info { 29 | mach_port_t mach_thread; 30 | ptr_t stack_ptr; /* Valid only when thread is in a "blocked" state. */ 31 | }; 32 | 33 | #ifndef DARWIN_DONT_PARSE_STACK 34 | GC_INNER ptr_t GC_FindTopOfStack(unsigned long); 35 | #endif 36 | 37 | #ifdef MPROTECT_VDB 38 | GC_INNER void GC_mprotect_stop(void); 39 | GC_INNER void GC_mprotect_resume(void); 40 | #endif 41 | 42 | #if defined(PARALLEL_MARK) && !defined(GC_NO_THREADS_DISCOVERY) 43 | GC_INNER GC_bool GC_is_mach_marker(thread_act_t); 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /jack/libs/gc/include/private/pthread_stop_world.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | * Copyright (c) 1996 by Silicon Graphics. All rights reserved. 4 | * Copyright (c) 1998 by Fergus Henderson. All rights reserved. 5 | * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. 6 | * All rights reserved. 7 | * 8 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 9 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 10 | * 11 | * Permission is hereby granted to use or copy this program 12 | * for any purpose, provided the above notices are retained on all copies. 13 | * Permission to modify the code and to distribute modified code is granted, 14 | * provided the above notices are retained, and a notice that the code was 15 | * modified is included with the above copyright notice. 16 | */ 17 | 18 | #ifndef GC_PTHREAD_STOP_WORLD_H 19 | #define GC_PTHREAD_STOP_WORLD_H 20 | 21 | struct thread_stop_info { 22 | # ifndef GC_OPENBSD_THREADS 23 | word last_stop_count; /* GC_last_stop_count value when thread */ 24 | /* last successfully handled a suspend */ 25 | /* signal. */ 26 | # endif 27 | 28 | ptr_t stack_ptr; /* Valid only when stopped. */ 29 | 30 | # ifdef NACL 31 | /* Grab NACL_GC_REG_STORAGE_SIZE pointers off the stack when */ 32 | /* going into a syscall. 20 is more than we need, but it's an */ 33 | /* overestimate in case the instrumented function uses any callee */ 34 | /* saved registers, they may be pushed to the stack much earlier. */ 35 | /* Also, on amd64 'push' puts 8 bytes on the stack even though */ 36 | /* our pointers are 4 bytes. */ 37 | # define NACL_GC_REG_STORAGE_SIZE 20 38 | ptr_t reg_storage[NACL_GC_REG_STORAGE_SIZE]; 39 | # endif 40 | }; 41 | 42 | GC_INNER void GC_stop_init(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /jack/libs/gc/macosx64/libgc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badlogic/jack/1fc147c697c0223b00223faf979321bcf52becd5/jack/libs/gc/macosx64/libgc.a -------------------------------------------------------------------------------- /jack/libs/gc/windows32/gc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badlogic/jack/1fc147c697c0223b00223faf979321bcf52becd5/jack/libs/gc/windows32/gc.lib -------------------------------------------------------------------------------- /jack/libs/soot-2.5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badlogic/jack/1fc147c697c0223b00223faf979321bcf52becd5/jack/libs/soot-2.5.0.jar -------------------------------------------------------------------------------- /jack/native/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /jack/native/jni-headers/linux/jawt_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jawt_md.h 1.13 10/03/23 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JAWT_MD_H_ 9 | #define _JAVASOFT_JAWT_MD_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "jawt.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* 21 | * X11-specific declarations for AWT native interface. 22 | * See notes in jawt.h for an example of use. 23 | */ 24 | typedef struct jawt_X11DrawingSurfaceInfo { 25 | Drawable drawable; 26 | Display* display; 27 | VisualID visualID; 28 | Colormap colormapID; 29 | int depth; 30 | /* 31 | * Since 1.4 32 | * Returns a pixel value from a set of RGB values. 33 | * This is useful for paletted color (256 color) modes. 34 | */ 35 | int (JNICALL *GetAWTColor)(JAWT_DrawingSurface* ds, 36 | int r, int g, int b); 37 | } JAWT_X11DrawingSurfaceInfo; 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* !_JAVASOFT_JAWT_MD_H_ */ 44 | -------------------------------------------------------------------------------- /jack/native/jni-headers/linux/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jni_md.h 1.20 10/03/23 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT 12 | #define JNIIMPORT 13 | #define JNICALL 14 | 15 | typedef int jint; 16 | #ifdef _LP64 /* 64-bit Solaris */ 17 | typedef long jlong; 18 | #else 19 | typedef long long jlong; 20 | #endif 21 | 22 | typedef signed char jbyte; 23 | 24 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 25 | -------------------------------------------------------------------------------- /jack/native/jni-headers/mac/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jni_md.h 1.19 05/11/17 3 | * 4 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 | * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT __attribute__((visibility("default"))) 12 | #define JNIIMPORT 13 | #define JNICALL 14 | 15 | #if __LP64__ 16 | typedef int jint; 17 | #else 18 | typedef long jint; 19 | #endif 20 | typedef long long jlong; 21 | typedef signed char jbyte; 22 | 23 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 24 | -------------------------------------------------------------------------------- /jack/native/jni-headers/win32/jawt_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * %W% %E% 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JAWT_MD_H_ 9 | #define _JAVASOFT_JAWT_MD_H_ 10 | 11 | #include 12 | #include "jawt.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* 19 | * Win32-specific declarations for AWT native interface. 20 | * See notes in jawt.h for an example of use. 21 | */ 22 | typedef struct jawt_Win32DrawingSurfaceInfo { 23 | /* Native window, DDB, or DIB handle */ 24 | union { 25 | HWND hwnd; 26 | HBITMAP hbitmap; 27 | void* pbits; 28 | }; 29 | /* 30 | * This HDC should always be used instead of the HDC returned from 31 | * BeginPaint() or any calls to GetDC(). 32 | */ 33 | HDC hdc; 34 | HPALETTE hpalette; 35 | } JAWT_Win32DrawingSurfaceInfo; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* !_JAVASOFT_JAWT_MD_H_ */ 42 | -------------------------------------------------------------------------------- /jack/native/jni-headers/win32/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * %W% %E% 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT __declspec(dllexport) 12 | #define JNIIMPORT __declspec(dllimport) 13 | #define JNICALL __stdcall 14 | 15 | typedef long jint; 16 | typedef __int64 jlong; 17 | typedef signed char jbyte; 18 | 19 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 20 | -------------------------------------------------------------------------------- /jack/native/test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Test for interfaces that specify methods already defined in super interfaces. 3 | Need to make sure any abstract class has a method that invokes the base class 4 | method so c++ doesn't get confused... 5 | 6 | Let list declare isEmpty() = 0 to see it fail. 7 | 8 | class Base { 9 | virtual void init() { 10 | } 11 | }; 12 | 13 | class Collection: public virtual Base { 14 | public: 15 | virtual bool isEmpty() = 0; 16 | }; 17 | 18 | class AbstractCollection: public virtual Base, public virtual Collection { 19 | public: 20 | virtual bool isEmpty() { 21 | return false; 22 | } 23 | }; 24 | 25 | class List: public virtual Base, public virtual Collection { 26 | public: 27 | 28 | }; 29 | 30 | class AbstractList: public virtual AbstractCollection, public virtual List { 31 | public: 32 | }; 33 | 34 | void test() { 35 | Base* obj = new AbstractList(); 36 | List* list = dynamic_cast(obj); 37 | }*/ 38 | 39 | /*class List { 40 | public: 41 | virtual void add(void* ptr, int a) = 0; 42 | }; 43 | 44 | class AbstractCollection: public virtual List { 45 | public: 46 | virtual void add(void* ptr, int a) = 0; 47 | virtual void add(void* ptr) { 48 | add(ptr, 0); 49 | } 50 | };*/ -------------------------------------------------------------------------------- /jack/native/vm/array.h: -------------------------------------------------------------------------------- 1 | #ifndef vm_vmarray_h 2 | #define vm_vmarray_h 3 | 4 | #include "classes/java_lang_Object.h" 5 | #include "vm/garbagecollection.h" 6 | #include "classes/java_lang_Class.h" 7 | 8 | template 9 | class Array: public java_lang_Object { 10 | public: 11 | Array(int size, bool isPrimitive, int dimensions, java_lang_Class** elementType) { 12 | this->length = size; 13 | this->isPrimitive = isPrimitive; 14 | this->dimensions = dimensions; 15 | this->elementType = elementType; 16 | this->arrayClass = 0; 17 | 18 | if(size > 0) { 19 | if(isPrimitive) { 20 | this->elements = (T*)jack_gc_malloc(sizeof(T) * size); 21 | } else { 22 | this->elements = (T*)jack_gc_malloc_atomic(sizeof(T) * size); 23 | } 24 | } else { 25 | this->elements = 0; 26 | } 27 | } 28 | 29 | Array(T* elements, int size, bool isPrimitive, int dimensions, java_lang_Class** elementType) { 30 | this->length = size; 31 | this->elements = elements; 32 | this->isPrimitive = isPrimitive; 33 | this->dimensions = dimensions; 34 | this->elementType = elementType; 35 | } 36 | 37 | java_lang_Class* m_getClass() { 38 | if(arrayClass == 0) { 39 | arrayClass = java_lang_Class::m_forArray(dimensions, *elementType); 40 | } 41 | return arrayClass; 42 | } 43 | 44 | inline T get(int idx) { 45 | // TODO add bounds check 46 | return elements[idx]; 47 | } 48 | 49 | inline void set(int idx, T val) { 50 | // TODO add bounds check 51 | elements[idx] = val; 52 | } 53 | 54 | inline T& operator[] (int idx) { 55 | return elements[idx]; 56 | } 57 | 58 | int length; 59 | bool isPrimitive; 60 | private: 61 | T* elements; 62 | int dimensions; 63 | java_lang_Class** elementType; 64 | java_lang_Class* arrayClass; 65 | }; 66 | 67 | #endif -------------------------------------------------------------------------------- /jack/native/vm/classmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_classmanager_h 2 | #define jack_classmanager_h 3 | 4 | class java_lang_Class; 5 | class java_lang_String; 6 | #define GC_THREADS 7 | #define GC_NOT_DLL 8 | #include 9 | #include "vm/stringmap.h" 10 | 11 | class ClassManager: public gc { 12 | private: 13 | static ClassManager* instance; 14 | StringMap* classes; 15 | 16 | ClassManager(); 17 | public: 18 | static ClassManager* getInstance(); 19 | java_lang_Class* forName(java_lang_String* name); 20 | java_lang_Class* forArray(int dimensions, java_lang_Class* elementType); 21 | java_lang_Class* forArray(java_lang_String* arrayName); 22 | void addClass(java_lang_Class* clazz); 23 | private: 24 | java_lang_Class* initArrayClass(java_lang_String* nameStr, int dimensions, java_lang_Class* elementType); 25 | }; 26 | 27 | #endif -------------------------------------------------------------------------------- /jack/native/vm/garbagecollection.cpp: -------------------------------------------------------------------------------- 1 | #define GC_THREADS 2 | #define GC_NOT_DLL 3 | #include 4 | #include "vm/garbagecollection.h" 5 | 6 | void jack_gc_init() { 7 | GC_INIT(); 8 | } 9 | 10 | int jack_gc_heapSize() { 11 | return GC_get_heap_size(); 12 | } 13 | 14 | void* jack_gc_malloc(int size) { 15 | return GC_MALLOC(size); 16 | } 17 | 18 | void* jack_gc_malloc_atomic(int size) { 19 | return GC_MALLOC_ATOMIC(size); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /jack/native/vm/garbagecollection.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_garbagecollection_h 2 | #define jack_garbagecollection_h 3 | 4 | void jack_gc_init(); 5 | int jack_gc_heapSize(); 6 | void* jack_gc_malloc(int size); 7 | void* jack_gc_malloc_atomic(int size); 8 | 9 | #endif -------------------------------------------------------------------------------- /jack/native/vm/java_lang.cpp: -------------------------------------------------------------------------------- 1 | #include "classes/classes.h" 2 | #include "vm/classmanager.h" 3 | 4 | java_lang_Class* java_lang_Class::m_forName(java_lang_String* name) { 5 | return ClassManager::getInstance()->forName(name); 6 | } 7 | 8 | java_lang_Class* java_lang_Class::m_forArray(int dimensions, java_lang_Class* elementType) { 9 | return ClassManager::getInstance()->forArray(dimensions, elementType); 10 | } 11 | 12 | void java_lang_Class::m_addClass(java_lang_Class* clazz) { 13 | ClassManager::getInstance()->addClass(clazz); 14 | } 15 | 16 | j_int java_lang_Object::m_hashCode() { 17 | return (j_int)this; 18 | } -------------------------------------------------------------------------------- /jack/native/vm/list.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_list_h 2 | #define jack_list_h 3 | 4 | #define GC_THREADS 5 | #define GC_NOT_DLL 6 | #include 7 | 8 | template 9 | class List: public gc { 10 | private: 11 | T* elements; 12 | int length; 13 | int numElements; 14 | 15 | public: 16 | List() { 17 | elements = (T*)GC_MALLOC(16 * sizeof(T)); 18 | length = 0; 19 | numElements = 16; 20 | } 21 | 22 | void add(T el) { 23 | if(length == numElements) { 24 | T* newElements = (T*)GC_MALLOC(sizeof(T) * length * 2); 25 | for(int i = 0; i < length; i++) { 26 | newElements[i] = elements[i]; 27 | } 28 | elements = newElements; 29 | numElements *= 2; 30 | } 31 | 32 | elements[length] = el; 33 | length++; 34 | } 35 | 36 | T get(int index) { 37 | if(index < 0 || index >= length) throw new java_lang_IndexOutOfBoundsException(); 38 | return elements[index]; 39 | } 40 | 41 | void set(int index, T el) { 42 | if(index < 0 || index >= length) throw new java_lang_IndexOutOfBoundsException(); 43 | elements[index] = el; 44 | } 45 | 46 | int size() { 47 | return length; 48 | } 49 | }; 50 | 51 | #endif -------------------------------------------------------------------------------- /jack/native/vm/resizablearray.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_list_h 2 | #define jack_list_h 3 | 4 | template 5 | class List: public gc { 6 | private: 7 | T* elements; 8 | int numElements; 9 | int size; 10 | 11 | public: 12 | List() { 13 | numElements = 16; 14 | size 15 | } 16 | 17 | int size() { 18 | return size; 19 | } 20 | 21 | void add(T t) { 22 | if(numElements < size + 1) { 23 | T* newElements = GC_MALLOC 24 | } 25 | } 26 | 27 | T get(int index) { 28 | return elements[index]; 29 | } 30 | 31 | void set(int index, T element) { 32 | return elements[index]; 33 | } 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /jack/native/vm/time.cpp: -------------------------------------------------------------------------------- 1 | #include "vm/time.h" 2 | #ifdef _MSC_VER 3 | #include 4 | #else 5 | 6 | #endif 7 | 8 | j_long getCurrentTimeMillis() { 9 | #ifdef _MSC_VER 10 | return GetTickCount64(); 11 | #else 12 | return 0; 13 | #endif 14 | } -------------------------------------------------------------------------------- /jack/native/vm/time.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_time_h 2 | #define jack_time_h 3 | 4 | #include "vm/types.h" 5 | j_long getCurrentTimeMillis(); 6 | 7 | #endif -------------------------------------------------------------------------------- /jack/native/vm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef jack_Types 2 | #define jack_Types 3 | 4 | typedef bool j_bool; 5 | typedef char j_byte; 6 | typedef unsigned short j_char; 7 | typedef short j_short; 8 | typedef int j_int; 9 | typedef long long j_long; 10 | typedef float j_float; 11 | typedef double j_double; 12 | 13 | typedef unsigned char j_ubyte; 14 | typedef unsigned short j_ushort; 15 | typedef unsigned int j_uint; 16 | typedef unsigned long long j_ulong; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/JackBuild.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack; 2 | 3 | import com.badlogic.jack.build.AntScriptGenerator; 4 | import com.badlogic.jack.build.BuildConfig; 5 | import com.badlogic.jack.build.BuildExecutor; 6 | import com.badlogic.jack.build.BuildTarget; 7 | import com.badlogic.jack.build.BuildTarget.TargetOs; 8 | 9 | public class JackBuild { 10 | public static void main(String[] args) { 11 | BuildConfig config = new BuildConfig("jack", "target", "libs", "native"); 12 | BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false); 13 | win32home.compilerPrefix = ""; 14 | new AntScriptGenerator().generate(config, win32home); 15 | BuildExecutor.executeAnt("native/build-windows32.xml", "-v"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/Test.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack; 2 | 3 | public class Test { 4 | public static void main(String[] args) { 5 | Object[] array = new String[0]; 6 | Class c = Object[][].class.getComponentType(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/headers/linux/jawt_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jawt_md.h 1.13 10/03/23 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JAWT_MD_H_ 9 | #define _JAVASOFT_JAWT_MD_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "jawt.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* 21 | * X11-specific declarations for AWT native interface. 22 | * See notes in jawt.h for an example of use. 23 | */ 24 | typedef struct jawt_X11DrawingSurfaceInfo { 25 | Drawable drawable; 26 | Display* display; 27 | VisualID visualID; 28 | Colormap colormapID; 29 | int depth; 30 | /* 31 | * Since 1.4 32 | * Returns a pixel value from a set of RGB values. 33 | * This is useful for paletted color (256 color) modes. 34 | */ 35 | int (JNICALL *GetAWTColor)(JAWT_DrawingSurface* ds, 36 | int r, int g, int b); 37 | } JAWT_X11DrawingSurfaceInfo; 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* !_JAVASOFT_JAWT_MD_H_ */ 44 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/headers/linux/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jni_md.h 1.20 10/03/23 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT 12 | #define JNIIMPORT 13 | #define JNICALL 14 | 15 | typedef int jint; 16 | #ifdef _LP64 /* 64-bit Solaris */ 17 | typedef long jlong; 18 | #else 19 | typedef long long jlong; 20 | #endif 21 | 22 | typedef signed char jbyte; 23 | 24 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 25 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/headers/mac/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)jni_md.h 1.19 05/11/17 3 | * 4 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 | * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT __attribute__((visibility("default"))) 12 | #define JNIIMPORT 13 | #define JNICALL 14 | 15 | #if __LP64__ 16 | typedef int jint; 17 | #else 18 | typedef long jint; 19 | #endif 20 | typedef long long jlong; 21 | typedef signed char jbyte; 22 | 23 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 24 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/headers/win32/jawt_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * %W% %E% 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JAWT_MD_H_ 9 | #define _JAVASOFT_JAWT_MD_H_ 10 | 11 | #include 12 | #include "jawt.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* 19 | * Win32-specific declarations for AWT native interface. 20 | * See notes in jawt.h for an example of use. 21 | */ 22 | typedef struct jawt_Win32DrawingSurfaceInfo { 23 | /* Native window, DDB, or DIB handle */ 24 | union { 25 | HWND hwnd; 26 | HBITMAP hbitmap; 27 | void* pbits; 28 | }; 29 | /* 30 | * This HDC should always be used instead of the HDC returned from 31 | * BeginPaint() or any calls to GetDC(). 32 | */ 33 | HDC hdc; 34 | HPALETTE hpalette; 35 | } JAWT_Win32DrawingSurfaceInfo; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* !_JAVASOFT_JAWT_MD_H_ */ 42 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/headers/win32/jni_md.h: -------------------------------------------------------------------------------- 1 | /* 2 | * %W% %E% 3 | * 4 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 5 | * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | 8 | #ifndef _JAVASOFT_JNI_MD_H_ 9 | #define _JAVASOFT_JNI_MD_H_ 10 | 11 | #define JNIEXPORT __declspec(dllexport) 12 | #define JNIIMPORT __declspec(dllimport) 13 | #define JNICALL __stdcall 14 | 15 | typedef long jint; 16 | typedef __int64 jlong; 17 | typedef signed char jbyte; 18 | 19 | #endif /* !_JAVASOFT_JNI_MD_H_ */ 20 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/scripts/Android.mk.template: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE := %sharedLibName% 5 | LOCAL_C_INCLUDES := %headerDirs% 6 | 7 | LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) %cFlags% 8 | LOCAL_CPPFLAGS := $(LOCAL_C_INCLUDES:%=-I%) %cppFlags% 9 | LOCAL_LDLIBS := %linkerFlags% 10 | LOCAL_ARM_MODE := arm 11 | 12 | LOCAL_SRC_FILES := %srcFiles% 13 | include $(BUILD_SHARED_LIBRARY) 14 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/scripts/Application.mk.template: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi armeabi-v7a -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/scripts/build-android.xml.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | %precompile% 12 | 13 | 14 | 15 | ndk_home: ${env.NDK_HOME} 16 | 17 | 18 | 19 | 20 | %postcompile% 21 | 22 | 23 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/build/resources/scripts/build.xml.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/generators/MethodBodyGenerator.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.generators; 2 | 3 | import soot.Local; 4 | import soot.NullType; 5 | import soot.SootMethod; 6 | 7 | import com.badlogic.jack.info.ClassInfo; 8 | import com.badlogic.jack.info.MethodInfo; 9 | import com.badlogic.jack.utils.CTypes; 10 | import com.badlogic.jack.utils.JavaSourceProvider; 11 | import com.badlogic.jack.utils.SourceWriter; 12 | 13 | /** 14 | * Generates the C++ translation for a {@link SootMethod} and fills 15 | * in additional information such as literals in a {@link ClassInfo} 16 | * and {@link MethodInfo} instance. Assumes that the signature of 17 | * the method was already emitted, e.g. by {@link ClinitGenerator} 18 | * or {@link MethodGenerator} 19 | * @author mzechner 20 | * 21 | */ 22 | public class MethodBodyGenerator { 23 | private final SourceWriter writer; 24 | private final JavaSourceProvider sourceProvider; 25 | private final ClassInfo info; 26 | private final SootMethod method; 27 | 28 | public MethodBodyGenerator(SourceWriter writer, JavaSourceProvider sourceProvider, ClassInfo info, SootMethod method) { 29 | this.writer = writer; 30 | this.sourceProvider = sourceProvider; 31 | this.info = info; 32 | this.method = method; 33 | } 34 | 35 | public void generate() { 36 | declareLocals(); 37 | new StatementGenerator(writer, sourceProvider, info, method).generate(); 38 | } 39 | 40 | /** 41 | * Declares all local variables plus a variable called _exception that 42 | * holds a pointer to any exception thrown. 43 | */ 44 | private void declareLocals() { 45 | // declare locals 46 | for(Local local: method.retrieveActiveBody().getLocals()) { 47 | String cType = null; 48 | // null types need special treatment, we don't output them 49 | // we also won't generate statements that use a nullType 50 | // as a target. 51 | if(local.getType() instanceof NullType) { 52 | cType = "java_lang_Object*"; 53 | } else { 54 | cType = CTypes.toCType(local.getType()); 55 | } 56 | writer.wl(cType + " " + local.getName() + " = 0;"); 57 | } 58 | writer.wl("java_lang_Object* _exception = 0;"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/generators/MethodGenerator.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.generators; 2 | 3 | import soot.SootMethod; 4 | import soot.Type; 5 | 6 | import com.badlogic.jack.info.ClassInfo; 7 | import com.badlogic.jack.utils.CTypes; 8 | import com.badlogic.jack.utils.JavaSourceProvider; 9 | import com.badlogic.jack.utils.Mangling; 10 | import com.badlogic.jack.utils.SourceWriter; 11 | 12 | /** 13 | * Takes a {@link SootMethod} and corresponding {@link ClassInfo} 14 | * and generates the C++ code for the statements in the method. Also 15 | * gathers literals and stores them in MethodInfo. 16 | * @author mzechner 17 | * 18 | */ 19 | public class MethodGenerator { 20 | private final SourceWriter writer; 21 | private final JavaSourceProvider sourceProvider; 22 | private final ClassInfo info; 23 | private final SootMethod method; 24 | 25 | public MethodGenerator(SourceWriter writer, JavaSourceProvider sourceProvider, ClassInfo info, SootMethod method) { 26 | this.writer = writer; 27 | this.sourceProvider = sourceProvider; 28 | this.method = method; 29 | this.info = info; 30 | } 31 | 32 | public void generate() { 33 | if(!method.isConcrete()) { 34 | if(method.isNative()) { 35 | new NativeMethodGenerator(writer, info, method).generate(); 36 | } 37 | } else { 38 | String methodSig = ""; 39 | methodSig += CTypes.toCType(method.getReturnType()); 40 | methodSig += " " + info.mangledName + "::" + Mangling.mangle(method) + "("; 41 | 42 | int i = 0; 43 | for(Object paramType: method.getParameterTypes()) { 44 | if(i > 0) methodSig += ", "; 45 | methodSig += CTypes.toCType((Type)paramType); 46 | methodSig += " param" + i; 47 | i++; 48 | } 49 | 50 | methodSig +=") {"; 51 | writer.wl(methodSig); 52 | writer.push(); 53 | new MethodBodyGenerator(writer, sourceProvider, info, method).generate(); 54 | writer.pop(); 55 | writer.wl("}"); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/generators/NativeMethodGenerator.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.generators; 2 | 3 | import java.util.List; 4 | 5 | import soot.Scene; 6 | import soot.SootMethod; 7 | import soot.Type; 8 | import soot.VoidType; 9 | import soot.tagkit.Tag; 10 | 11 | import com.badlogic.jack.info.ClassInfo; 12 | import com.badlogic.jack.utils.CTypes; 13 | import com.badlogic.jack.utils.Mangling; 14 | import com.badlogic.jack.utils.SourceWriter; 15 | 16 | /** 17 | * Generates the body of a native method. 18 | * @author mzechner 19 | * 20 | */ 21 | public class NativeMethodGenerator { 22 | private final SourceWriter writer; 23 | private final ClassInfo info; 24 | private final SootMethod method; 25 | 26 | public NativeMethodGenerator(SourceWriter writer, ClassInfo info, SootMethod method) { 27 | this.writer = writer; 28 | this.info = info; 29 | this.method = method; 30 | } 31 | 32 | private boolean isDirect(List tags) { 33 | for(Tag tag: tags) { 34 | if(tag.toString().contains("DirectNative")) return true; 35 | } 36 | return false; 37 | } 38 | 39 | public void generate() { 40 | // if this method or it's class is tagged with 41 | // @DirectNative, omit generation of the native 42 | // method wrapper. 43 | if(isDirect(method.getTags()) || isDirect(method.getDeclaringClass().getTags())) return; 44 | 45 | // output the signature 46 | String methodSig = ""; 47 | methodSig += CTypes.toCType(method.getReturnType()); 48 | methodSig += " " + info.mangledName + "::" + Mangling.mangle(method) + "("; 49 | 50 | int i = 0; 51 | for(Object paramType: method.getParameterTypes()) { 52 | if(i > 0) methodSig += ", "; 53 | methodSig += CTypes.toCType((Type)paramType); 54 | methodSig += " param" + i; 55 | i++; 56 | } 57 | 58 | methodSig +=") {"; 59 | writer.wl(methodSig); 60 | 61 | // FIXME JNI, add function pointer loading and invocation 62 | // output the body 63 | info.dependencies.add(Scene.v().getSootClass("java.lang.UnsupportedOperationException")); 64 | writer.push(); 65 | writer.wl("throw new java_lang_UnsupportedOperationException();"); 66 | writer.pop(); 67 | writer.wl("}"); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/generators/SignalHandlerGenerator.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.generators; 2 | 3 | import com.badlogic.jack.utils.SourceWriter; 4 | 5 | /** 6 | * Creates a function jack_register_signal_handlers that registers signal 7 | * handlers that throw exceptions for SIGSEG. 8 | * @author mzechner 9 | * 10 | */ 11 | public class SignalHandlerGenerator { 12 | public void generate(SourceWriter writer) { 13 | writer.wl("#include "); 14 | writer.wl("#include \"classes/java_lang_NullPointerException.h\""); 15 | writer.wl("void signal_handler(int code) { signal(SIGSEGV, signal_handler); throw new java_lang_NullPointerException(); }\n"); 16 | writer.wl("void jack_register_signal_handlers() { signal(SIGSEGV, signal_handler); }"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/info/FieldInfo.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.info; 2 | 3 | import com.badlogic.jack.utils.CTypes; 4 | import com.badlogic.jack.utils.Mangling; 5 | 6 | import soot.SootField; 7 | 8 | public class FieldInfo { 9 | public final SootField field; 10 | public final String mangledName; 11 | public final String cType; 12 | 13 | public FieldInfo(SootField field) { 14 | this.field = field; 15 | this.mangledName = Mangling.mangle(field); 16 | cType = CTypes.toCType(field.getType()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jack/src/com/badlogic/jack/utils/SourceWriter.java: -------------------------------------------------------------------------------- 1 | package com.badlogic.jack.utils; 2 | 3 | /** 4 | * Stores indentation levels that can be pushed/popped and 5 | * allows to output lines. 6 | * @author mzechner 7 | * 8 | */ 9 | public class SourceWriter { 10 | int indent; 11 | final StringBuffer buffer = new StringBuffer(); 12 | 13 | public SourceWriter() { 14 | } 15 | 16 | private String i() { 17 | StringBuffer buffer = new StringBuffer(); 18 | for(int i = 0; i < indent; i++) { 19 | buffer.append("\t"); 20 | } 21 | return buffer.toString(); 22 | } 23 | 24 | public void wl(String message) { 25 | buffer.append(i()); 26 | buffer.append(message); 27 | buffer.append("\n"); 28 | } 29 | 30 | public void push() { 31 | indent++; 32 | } 33 | 34 | public void pop() { 35 | indent--; 36 | if(indent < 0) indent = 0; 37 | } 38 | 39 | public String toString() { 40 | return buffer.toString(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /runtime/jack-kernel/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /runtime/jack-kernel/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jack-kernel 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/avian/Cell.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package avian; 12 | 13 | public class Cell { 14 | public T value; 15 | public Cell next; 16 | 17 | public Cell(T value, Cell next) { 18 | this.value = value; 19 | this.next = next; 20 | } 21 | 22 | public String toString() { 23 | StringBuilder sb = new StringBuilder(); 24 | sb.append("("); 25 | for (Cell c = this; c != null; c = c.next) { 26 | sb.append(value); 27 | if (c.next != null) { 28 | sb.append(" "); 29 | } 30 | } 31 | sb.append(")"); 32 | return sb.toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/avian/Iso88591.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package avian; 12 | 13 | import java.io.ByteArrayOutputStream; 14 | 15 | public class Iso88591 { 16 | 17 | public static byte[] encode(char[] s16, int offset, int length) { 18 | ByteArrayOutputStream buf = new ByteArrayOutputStream(); 19 | for (int i = offset; i < offset + length; ++i) { 20 | // ISO-88591-1/Latin-1 is the same as UTF-16 under 0x100 21 | buf.write(s16[i]); 22 | } 23 | return buf.toByteArray(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/BufferedOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class BufferedOutputStream extends OutputStream { 14 | private final OutputStream out; 15 | private final byte[] buffer; 16 | private int position; 17 | 18 | public BufferedOutputStream(OutputStream out, int size) { 19 | this.out = out; 20 | this.buffer = new byte[size]; 21 | } 22 | 23 | public BufferedOutputStream(OutputStream out) { 24 | this(out, 4096); 25 | } 26 | 27 | private void drain() throws IOException { 28 | if (position > 0) { 29 | out.write(buffer, 0, position); 30 | position = 0; 31 | } 32 | } 33 | 34 | public void write(int c) throws IOException { 35 | if (position >= buffer.length) { 36 | drain(); 37 | } 38 | 39 | buffer[position++] = (byte) (c & 0xFF); 40 | } 41 | 42 | public void write(byte[] b, int offset, int length) throws IOException { 43 | if (length > buffer.length - position) { 44 | drain(); 45 | out.write(b, offset, length); 46 | } else { 47 | System.arraycopy(b, offset, buffer, position, length); 48 | position += length; 49 | } 50 | } 51 | 52 | public void flush() throws IOException { 53 | drain(); 54 | out.flush(); 55 | } 56 | 57 | public void close() throws IOException { 58 | flush(); 59 | out.close(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/BufferedWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class BufferedWriter extends Writer { 14 | private final Writer out; 15 | private final char[] buffer; 16 | private int position; 17 | 18 | public BufferedWriter(Writer out, int size) { 19 | this.out = out; 20 | this.buffer = new char[size]; 21 | } 22 | 23 | public BufferedWriter(Writer out) { 24 | this(out, 4096); 25 | } 26 | 27 | private void drain() throws IOException { 28 | if (position > 0) { 29 | out.write(buffer, 0, position); 30 | position = 0; 31 | } 32 | } 33 | 34 | public void write(char[] b, int offset, int length) throws IOException { 35 | if (length > buffer.length - position) { 36 | drain(); 37 | out.write(b, offset, length); 38 | } else { 39 | System.arraycopy(b, offset, buffer, position, length); 40 | position += length; 41 | } 42 | } 43 | 44 | public void flush() throws IOException { 45 | drain(); 46 | out.flush(); 47 | } 48 | 49 | public void close() throws IOException { 50 | flush(); 51 | out.close(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/ByteArrayInputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class ByteArrayInputStream extends InputStream { 14 | private final byte[] array; 15 | private int position; 16 | private final int limit; 17 | 18 | public ByteArrayInputStream(byte[] array, int offset, int length) { 19 | this.array = array; 20 | position = offset; 21 | this.limit = offset + length; 22 | } 23 | 24 | public ByteArrayInputStream(byte[] array) { 25 | this(array, 0, array.length); 26 | } 27 | 28 | public int read() { 29 | if (position < limit) { 30 | return array[position++] & 0xff; 31 | } else { 32 | return -1; 33 | } 34 | } 35 | 36 | public int read(byte[] buffer, int offset, int bufferLength) { 37 | if (bufferLength == 0) { 38 | return 0; 39 | } 40 | if (position >= limit) { 41 | return -1; 42 | } 43 | int remaining = limit-position; 44 | if (remaining < bufferLength) { 45 | bufferLength = remaining; 46 | } 47 | System.arraycopy(array, position, buffer, offset, bufferLength); 48 | position += bufferLength; 49 | return bufferLength; 50 | } 51 | 52 | public int available() { 53 | return limit - position; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/EOFException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class EOFException extends IOException { 14 | public EOFException(String message) { 15 | super(message); 16 | } 17 | 18 | public EOFException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/Externalizable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface Externalizable { 14 | public void readExternal(ObjectInput in); 15 | public void writeExternal(ObjectOutput out); 16 | } 17 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileDescriptor.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileDescriptor { 14 | public static final FileDescriptor in = new FileDescriptor(0); 15 | public static final FileDescriptor out = new FileDescriptor(1); 16 | public static final FileDescriptor err = new FileDescriptor(2); 17 | 18 | final int value; 19 | 20 | public FileDescriptor(int value) { 21 | this.value = value; 22 | } 23 | 24 | public FileDescriptor() { 25 | this(-1); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileInputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileInputStream extends InputStream { 14 | // static { 15 | // System.loadLibrary("natives"); 16 | // } 17 | 18 | private int fd; 19 | private int remaining; 20 | 21 | public FileInputStream(FileDescriptor fd) { 22 | this.fd = fd.value; 23 | } 24 | 25 | public FileInputStream(String path) throws IOException { 26 | fd = open(path); 27 | remaining = (int) new File(path).length(); 28 | } 29 | 30 | public FileInputStream(File file) throws IOException { 31 | this(file.getPath()); 32 | } 33 | 34 | public int available() throws IOException { 35 | return remaining; 36 | } 37 | 38 | private static native int open(String path) throws IOException; 39 | 40 | private static native int read(int fd) throws IOException; 41 | 42 | private static native int read(int fd, byte[] b, int offset, int length) 43 | throws IOException; 44 | 45 | public static native void close(int fd) throws IOException; 46 | 47 | public int read() throws IOException { 48 | int c = read(fd); 49 | if (c >= 0 && remaining > 0) { 50 | -- remaining; 51 | } 52 | return c; 53 | } 54 | 55 | public int read(byte[] b, int offset, int length) throws IOException { 56 | if (b == null) { 57 | throw new NullPointerException(); 58 | } 59 | 60 | if (offset < 0 || offset + length > b.length) { 61 | throw new ArrayIndexOutOfBoundsException(); 62 | } 63 | 64 | int c = read(fd, b, offset, length); 65 | if (c > 0 && remaining > 0) { 66 | remaining -= c; 67 | } 68 | return c; 69 | } 70 | 71 | public void close() throws IOException { 72 | if (fd != -1) { 73 | close(fd); 74 | fd = -1; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileNotFoundException extends IOException { 14 | public FileNotFoundException(String message) { 15 | super(message); 16 | } 17 | 18 | public FileNotFoundException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileOutputStream extends OutputStream { 14 | // static { 15 | // System.loadLibrary("natives"); 16 | // } 17 | 18 | private int fd; 19 | 20 | public FileOutputStream(FileDescriptor fd) { 21 | this.fd = fd.value; 22 | } 23 | 24 | public FileOutputStream(String path) throws IOException { 25 | this(path, false); 26 | } 27 | 28 | public FileOutputStream(String path, boolean append) throws IOException { 29 | fd = open(path, append); 30 | } 31 | 32 | 33 | public FileOutputStream(File file) throws IOException { 34 | this(file.getPath()); 35 | } 36 | 37 | private static native int open(String path, boolean append) throws IOException; 38 | 39 | private static native void write(int fd, int c) throws IOException; 40 | 41 | private static native void write(int fd, byte[] b, int offset, int length) 42 | throws IOException; 43 | 44 | private static native void close(int fd) throws IOException; 45 | 46 | public void write(int c) throws IOException { 47 | write(fd, c); 48 | } 49 | 50 | public void write(byte[] b, int offset, int length) throws IOException { 51 | if (b == null) { 52 | throw new NullPointerException(); 53 | } 54 | 55 | if (offset < 0 || offset + length > b.length) { 56 | throw new ArrayIndexOutOfBoundsException(); 57 | } 58 | 59 | write(fd, b, offset, length); 60 | } 61 | 62 | public void close() throws IOException { 63 | if (fd != -1) { 64 | close(fd); 65 | fd = -1; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileReader extends Reader { 14 | private final Reader in; 15 | 16 | public FileReader(FileInputStream in) { 17 | this.in = new InputStreamReader(in); 18 | } 19 | 20 | public FileReader(FileDescriptor fd) { 21 | this(new FileInputStream(fd)); 22 | } 23 | 24 | public FileReader(String path) throws IOException { 25 | this(new FileInputStream(path)); 26 | } 27 | 28 | public FileReader(File file) throws IOException { 29 | this(new FileInputStream(file)); 30 | } 31 | 32 | public int read(char[] b, int offset, int length) throws IOException { 33 | return in.read(b, offset, length); 34 | } 35 | 36 | public void close() throws IOException { 37 | in.close(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FileWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileWriter extends Writer { 14 | private final Writer out; 15 | 16 | private FileWriter(FileOutputStream out) { 17 | this.out = new OutputStreamWriter(out); 18 | } 19 | 20 | public FileWriter(FileDescriptor fd) { 21 | this(new FileOutputStream(fd)); 22 | } 23 | 24 | public FileWriter(String path) throws IOException { 25 | this(new FileOutputStream(path)); 26 | } 27 | 28 | public FileWriter(File file) throws IOException { 29 | this(new FileOutputStream(file)); 30 | } 31 | 32 | public void write(char[] b, int offset, int length) throws IOException { 33 | out.write(b, offset, length); 34 | } 35 | 36 | public void flush() throws IOException { 37 | out.flush(); 38 | } 39 | 40 | public void close() throws IOException { 41 | out.close(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FilenameFilter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface FilenameFilter { 14 | 15 | boolean accept(File dir, String name); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/FilterOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FilterOutputStream extends OutputStream { 14 | protected OutputStream out; 15 | 16 | public FilterOutputStream(OutputStream out) { 17 | this.out = out; 18 | } 19 | 20 | public void close() throws IOException { 21 | out.close(); 22 | } 23 | 24 | public void flush() throws IOException { 25 | out.flush(); 26 | } 27 | 28 | public void write(byte[] b) throws IOException { 29 | out.write(b); 30 | } 31 | 32 | public void write(byte[] b, int off, int len) throws IOException { 33 | out.write(b, off, len); 34 | } 35 | 36 | public void write(int b) throws IOException { 37 | out.write(b); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/IOException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class IOException extends Exception { 14 | public IOException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public IOException(String message) { 19 | this(message, null); 20 | } 21 | 22 | public IOException(Throwable cause) { 23 | this(null, cause); 24 | } 25 | 26 | public IOException() { 27 | this(null, null); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/InputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public abstract class InputStream { 14 | public abstract int read() throws IOException; 15 | 16 | public int read(byte[] buffer) throws IOException { 17 | return read(buffer, 0, buffer.length); 18 | } 19 | 20 | public int read(byte[] buffer, int offset, int length) throws IOException { 21 | for (int i = 0; i < length; ++i) { 22 | int c = read(); 23 | if (c == -1) { 24 | if (i == 0) { 25 | return -1; 26 | } else { 27 | return i; 28 | } 29 | } else { 30 | buffer[offset + i] = (byte) (c & 0xFF); 31 | } 32 | } 33 | return length; 34 | } 35 | 36 | public long skip(long count) throws IOException { 37 | final long Max = 8 * 1024; 38 | int size = (int) (count < Max ? count : Max); 39 | byte[] buffer = new byte[size]; 40 | long remaining = count; 41 | int c; 42 | while ((c = read(buffer, 0, (int) (size < remaining ? size : remaining))) 43 | >= 0 44 | && remaining > 0) { 45 | remaining -= c; 46 | } 47 | return count - remaining; 48 | } 49 | 50 | public int available() throws IOException { 51 | return 0; 52 | } 53 | 54 | public void mark(int limit) { 55 | // ignore 56 | } 57 | 58 | public void reset() throws IOException { 59 | throw new IOException("mark/reset not supported"); 60 | } 61 | 62 | public boolean markSupported() { 63 | return false; 64 | } 65 | 66 | public void close() throws IOException { } 67 | } 68 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/LineNumberReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class LineNumberReader extends BufferedReader { 14 | private int line; 15 | 16 | public LineNumberReader(Reader in, int bufferSize) { 17 | super(in, bufferSize); 18 | } 19 | 20 | public LineNumberReader(Reader in) { 21 | super(in); 22 | } 23 | 24 | public int getLineNumber() { 25 | return line; 26 | } 27 | 28 | public void setLineNumber(int v) { 29 | line = v; 30 | } 31 | 32 | public int read(char[] b, int offset, int length) throws IOException { 33 | int c = super.read(b, offset, length); 34 | for (int i = 0; i < c; ++i) { 35 | if (b[i] == '\n') { 36 | ++ line; 37 | } 38 | } 39 | return c; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/NotSerializableException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class NotSerializableException extends ObjectStreamException { 14 | public NotSerializableException(String message) { 15 | super(message); 16 | } 17 | 18 | public NotSerializableException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/ObjectInput.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface ObjectInput { 14 | public int available(); 15 | public void close(); 16 | public void read(); 17 | public void read(byte[] b); 18 | public void read(byte[] b, int off, int len); 19 | public Object readObject(); 20 | public long skip(long n); 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/ObjectOutput.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface ObjectOutput { 14 | public void close(); 15 | public void flush(); 16 | public void write(byte[] b); 17 | public void write(byte[] b, int off, int len); 18 | public void write(int b); 19 | public void writeObject(Object obj); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/ObjectStreamException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class ObjectStreamException extends IOException { 14 | public ObjectStreamException(String message) { 15 | super(message); 16 | } 17 | 18 | public ObjectStreamException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/OutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public abstract class OutputStream { 14 | public abstract void write(int c) throws IOException; 15 | 16 | public void write(byte[] buffer) throws IOException { 17 | write(buffer, 0, buffer.length); 18 | } 19 | 20 | public void write(byte[] buffer, int offset, int length) throws IOException { 21 | for (int i = 0; i < length; ++i) { 22 | write(buffer[offset + i]); 23 | } 24 | } 25 | 26 | public void flush() throws IOException { } 27 | 28 | public void close() throws IOException { } 29 | } 30 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/OutputStreamWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | import avian.Utf8; 14 | 15 | public class OutputStreamWriter extends Writer { 16 | private final OutputStream out; 17 | 18 | public OutputStreamWriter(OutputStream out) { 19 | this.out = out; 20 | } 21 | 22 | public void write(char[] b, int offset, int length) throws IOException { 23 | out.write(Utf8.encode(b, offset, length)); 24 | } 25 | 26 | public void flush() throws IOException { 27 | out.flush(); 28 | } 29 | 30 | public void close() throws IOException { 31 | out.close(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/PushbackReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class PushbackReader extends Reader { 14 | private final Reader in; 15 | private char savedChar; 16 | private boolean hasSavedChar; 17 | 18 | public PushbackReader(Reader in, int bufferSize) { 19 | if (bufferSize > 1) { 20 | throw new IllegalArgumentException(bufferSize + " > 1"); 21 | } 22 | this.in = in; 23 | this.hasSavedChar = false; 24 | } 25 | 26 | public PushbackReader(Reader in) { 27 | this(in, 1); 28 | } 29 | 30 | public int read(char[] b, int offset, int length) throws IOException { 31 | int count = 0; 32 | if (hasSavedChar && length > 0) { 33 | length--; 34 | b[offset++] = savedChar; 35 | hasSavedChar = false; 36 | count = 1; 37 | } 38 | if (length > 0) { 39 | int c = in.read(b, offset, length); 40 | if (c == -1) { 41 | if (count == 0) { 42 | count = -1; 43 | } 44 | } else { 45 | count += c; 46 | } 47 | } 48 | 49 | return count; 50 | } 51 | 52 | public void unread(char[] b, int offset, int length) throws IOException { 53 | if (length != 1) { 54 | throw new IOException("Can only push back 1 char, not " + length); 55 | } else if (hasSavedChar) { 56 | throw new IOException("Already have a saved char"); 57 | } else { 58 | hasSavedChar = true; 59 | savedChar = b[offset]; 60 | } 61 | } 62 | 63 | public void unread(char[] b) throws IOException { 64 | unread(b, 0, b.length); 65 | } 66 | 67 | public void unread(int c) throws IOException { 68 | unread(new char[] { (char) c }); 69 | } 70 | 71 | public void close() throws IOException { 72 | in.close(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/Reader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public abstract class Reader { 14 | public int read() throws IOException { 15 | char[] buffer = new char[1]; 16 | int c = read(buffer); 17 | if (c <= 0) { 18 | return -1; 19 | } else { 20 | return (int) buffer[0]; 21 | } 22 | } 23 | 24 | public int read(char[] buffer) throws IOException { 25 | return read(buffer, 0, buffer.length); 26 | } 27 | 28 | public abstract int read(char[] buffer, int offset, int length) 29 | throws IOException; 30 | 31 | public boolean markSupported() { 32 | return false; 33 | } 34 | 35 | public void mark(int readAheadLimit) throws IOException { 36 | throw new IOException("mark not supported"); 37 | } 38 | 39 | public void reset() throws IOException { 40 | throw new IOException("reset not supported"); 41 | } 42 | 43 | public abstract void close() throws IOException; 44 | } 45 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/Serializable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface Serializable { } 14 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/StreamCorruptedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StreamCorruptedException extends IOException { 14 | public StreamCorruptedException(String message) { 15 | super(message); 16 | } 17 | 18 | public StreamCorruptedException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/StringReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StringReader extends Reader { 14 | private final String in; 15 | private int position = 0; 16 | 17 | public StringReader(String in) { 18 | this.in = in; 19 | } 20 | 21 | public int read(char[] b, int offset, int length) throws IOException { 22 | if (length > in.length() - position) { 23 | length = in.length() - position; 24 | if (length <= 0) { 25 | return -1; 26 | } 27 | } 28 | in.getChars(position, position+length, b, offset); 29 | position += length; 30 | return length; 31 | } 32 | 33 | public void close() throws IOException { } 34 | } 35 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/StringWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StringWriter extends Writer { 14 | private final StringBuilder out = new StringBuilder(); 15 | 16 | public void write(char[] b, int offset, int length) throws IOException { 17 | out.append(b, offset, length); 18 | } 19 | 20 | public String toString() { 21 | return out.toString(); 22 | } 23 | 24 | public void flush() throws IOException { } 25 | 26 | public void close() throws IOException { } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/UnsupportedEncodingException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class UnsupportedEncodingException extends IOException { 14 | public UnsupportedEncodingException(String message) { 15 | super(message); 16 | } 17 | 18 | public UnsupportedEncodingException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/io/Writer.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public abstract class Writer { 14 | public void write(int c) throws IOException { 15 | char[] buffer = new char[] { (char) c }; 16 | write(buffer); 17 | } 18 | 19 | public void write(char[] buffer) throws IOException { 20 | write(buffer, 0, buffer.length); 21 | } 22 | 23 | public void write(String s) throws IOException { 24 | write(s.toCharArray()); 25 | } 26 | 27 | public void write(String s, int offset, int length) throws IOException { 28 | char[] b = new char[length]; 29 | s.getChars(offset, offset + length, b, 0); 30 | write(b); 31 | } 32 | 33 | public abstract void write(char[] buffer, int offset, int length) 34 | throws IOException; 35 | 36 | public abstract void flush() throws IOException; 37 | 38 | public abstract void close() throws IOException; 39 | } 40 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/AbstractMethodError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class AbstractMethodError extends IncompatibleClassChangeError { 4 | public AbstractMethodError() { 5 | super(); 6 | } 7 | 8 | public AbstractMethodError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Appendable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | import java.io.IOException; 14 | 15 | public interface Appendable { 16 | public Appendable append(char c) throws IOException; 17 | 18 | public Appendable append(CharSequence sequence) throws IOException; 19 | 20 | public Appendable append(CharSequence sequence, int start, int end) 21 | throws IOException; 22 | } 23 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ArithmeticException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ArithmeticException extends RuntimeException { 4 | public ArithmeticException() { 5 | super(); 6 | } 7 | 8 | public ArithmeticException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ArrayIndexOutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException { 4 | public ArrayIndexOutOfBoundsException() { 5 | super(); 6 | } 7 | 8 | public ArrayIndexOutOfBoundsException(java.lang.String message) { 9 | super(message); 10 | } 11 | 12 | public ArrayIndexOutOfBoundsException(int index) { 13 | super("index: " + index); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ArrayStoreException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ArrayStoreException extends RuntimeException { 4 | public ArrayStoreException() { 5 | super(); 6 | } 7 | 8 | public ArrayStoreException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Boolean.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public final class Boolean implements Comparable { 14 | // this field is filled by ReflectionGenerator#initializePrimitiveTypes() 15 | public static Class TYPE; 16 | 17 | public static final Boolean FALSE = new Boolean(false); 18 | public static final Boolean TRUE = new Boolean(true); 19 | 20 | private final boolean value; 21 | 22 | public Boolean(boolean value) { 23 | this.value = value; 24 | } 25 | 26 | public Boolean(String s) { 27 | this.value = "true".equals(s); 28 | } 29 | 30 | public static Boolean valueOf(boolean value) { 31 | return (value ? Boolean.TRUE : Boolean.FALSE); 32 | } 33 | 34 | public static Boolean valueOf(String s) { 35 | Boolean.TRUE.booleanValue(); 36 | return ("true".equals(s) ? Boolean.TRUE : Boolean.FALSE); 37 | } 38 | 39 | public int compareTo(Boolean o) { 40 | return (value ? (o.value ? 0 : 1) : (o.value ? -1 : 0)); 41 | } 42 | 43 | public boolean equals(Object o) { 44 | return o instanceof Boolean && ((Boolean) o).value == value; 45 | } 46 | 47 | public int hashCode() { 48 | return (value ? 1 : 0); 49 | } 50 | 51 | public String toString() { 52 | return toString(value); 53 | } 54 | 55 | public static String toString(boolean v) { 56 | return (v ? "true" : "false"); 57 | } 58 | 59 | public boolean booleanValue() { 60 | return value; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Byte.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public final class Byte extends Number implements Comparable { 14 | // this field is filled by ReflectionGenerator#initializePrimitiveTypes() 15 | public static Class TYPE; 16 | 17 | private final byte value; 18 | 19 | public Byte(byte value) { 20 | this.value = value; 21 | } 22 | 23 | public static Byte valueOf(byte value) { 24 | return new Byte(value); 25 | } 26 | 27 | public boolean equals(Object o) { 28 | return o instanceof Byte && ((Byte) o).value == value; 29 | } 30 | 31 | public int hashCode() { 32 | return value; 33 | } 34 | 35 | public String toString() { 36 | return toString(value); 37 | } 38 | 39 | public int compareTo(Byte o) { 40 | return value - o.value; 41 | } 42 | 43 | public static String toString(byte v, int radix) { 44 | return Long.toString(v, radix); 45 | } 46 | 47 | public static String toString(byte v) { 48 | return toString(v, 10); 49 | } 50 | 51 | public static byte parseByte(String s) { 52 | return (byte) Integer.parseInt(s); 53 | } 54 | 55 | public byte byteValue() { 56 | return value; 57 | } 58 | 59 | public short shortValue() { 60 | return value; 61 | } 62 | 63 | public int intValue() { 64 | return value; 65 | } 66 | 67 | public long longValue() { 68 | return value; 69 | } 70 | 71 | public float floatValue() { 72 | return (float) value; 73 | } 74 | 75 | public double doubleValue() { 76 | return (double) value; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/CharSequence.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public interface CharSequence { 14 | public char charAt(int index); 15 | 16 | int length(); 17 | 18 | CharSequence subSequence(int start, int end); 19 | 20 | String toString(); 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ClassCastException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ClassCastException extends RuntimeException { 4 | public ClassCastException() { 5 | super(); 6 | } 7 | 8 | public ClassCastException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ClassCircularityError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ClassCircularityError extends LinkageError { 4 | public ClassCircularityError() { 5 | super(); 6 | } 7 | 8 | public ClassCircularityError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ClassFormatError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ClassFormatError extends LinkageError { 4 | public ClassFormatError() { 5 | super(); 6 | } 7 | 8 | public ClassFormatError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ClassNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public class ClassNotFoundException extends Exception { 14 | private final Throwable cause2; 15 | 16 | public ClassNotFoundException(String message, Throwable cause) { 17 | super(message, cause); 18 | cause2 = cause; 19 | } 20 | 21 | public ClassNotFoundException(String message) { 22 | this(message, null); 23 | } 24 | 25 | public ClassNotFoundException() { 26 | this(null, null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Cloneable.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public interface Cloneable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Comparable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public interface Comparable { 14 | public int compareTo(T o); 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Enum.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | import java.lang.reflect.Method; 14 | 15 | public abstract class Enum> implements Comparable { 16 | private final String name; 17 | protected final int ordinal; 18 | 19 | public Enum(String name, int ordinal) { 20 | this.name = name; 21 | this.ordinal = ordinal; 22 | } 23 | 24 | public int compareTo(E other) { 25 | if (getDeclaringClass() != other.getDeclaringClass()) { 26 | throw new ClassCastException(); 27 | } 28 | 29 | return ordinal - other.ordinal; 30 | } 31 | 32 | public static > T valueOf(Class enumType, String name) { 33 | if (name == null) throw new NullPointerException(); 34 | 35 | try { 36 | Method method = enumType.getMethod("values"); 37 | Enum values[] = (Enum[]) method.invoke(null); 38 | for (Enum value: values) { 39 | if (name.equals(value.name)) { 40 | return (T) value; 41 | } 42 | } 43 | } catch (Exception ex) { 44 | throw new RuntimeException(ex); 45 | } 46 | 47 | throw new IllegalArgumentException(name); 48 | } 49 | 50 | public int ordinal() { 51 | return ordinal; 52 | } 53 | 54 | public final String name() { 55 | return name; 56 | } 57 | 58 | public String toString() { 59 | return name; 60 | } 61 | 62 | public Class getDeclaringClass() { 63 | Class c = getClass(); 64 | while (c.getSuperclass() != Enum.class) { 65 | c = c.getSuperclass(); 66 | } 67 | return c; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Error.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class Error extends Throwable { 4 | public Error() { 5 | super(); 6 | } 7 | 8 | public Error(java.lang.String message, java.lang.Throwable cause) { 9 | super(message, cause); 10 | } 11 | 12 | public Error(java.lang.String message) { 13 | super(message); 14 | } 15 | 16 | public Error(java.lang.Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Exception.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class Exception extends Throwable { 4 | public Exception() { 5 | super(); 6 | } 7 | 8 | public Exception(java.lang.String message, java.lang.Throwable cause) { 9 | super(message, cause); 10 | } 11 | 12 | public Exception(java.lang.String message) { 13 | super(message); 14 | } 15 | 16 | public Exception(java.lang.Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IllegalAccessError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IllegalAccessError extends IncompatibleClassChangeError { 4 | public IllegalAccessError() { 5 | super(); 6 | } 7 | 8 | public IllegalAccessError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IllegalAccessException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IllegalAccessException extends Exception { 4 | public IllegalAccessException() { 5 | super(); 6 | } 7 | 8 | public IllegalAccessException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IllegalArgumentException extends RuntimeException { 4 | public IllegalArgumentException() { 5 | super(); 6 | } 7 | 8 | public IllegalArgumentException(java.lang.String message, 9 | java.lang.Throwable cause) { 10 | super(message, cause); 11 | } 12 | 13 | public IllegalArgumentException(java.lang.String message) { 14 | super(message); 15 | } 16 | 17 | public IllegalArgumentException(java.lang.Throwable cause) { 18 | super(cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IllegalMonitorStateException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IllegalMonitorStateException extends RuntimeException { 4 | public IllegalMonitorStateException() { 5 | super(); 6 | } 7 | 8 | public IllegalMonitorStateException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IllegalStateException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IllegalStateException extends RuntimeException { 4 | public IllegalStateException() { 5 | super(); 6 | } 7 | 8 | public IllegalStateException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IncompatibleClassChangeError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IncompatibleClassChangeError extends LinkageError { 4 | public IncompatibleClassChangeError() { 5 | super(); 6 | } 7 | 8 | public IncompatibleClassChangeError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/IndexOutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class IndexOutOfBoundsException extends RuntimeException { 4 | public IndexOutOfBoundsException() { 5 | super(); 6 | } 7 | 8 | public IndexOutOfBoundsException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/InstantiationError.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | /** 14 | * TODO : current Avian runtime doesn't check, need to be implemented. 15 | * 16 | */ 17 | public class InstantiationError extends IncompatibleClassChangeError { 18 | 19 | public InstantiationError(String message) { 20 | super(message); 21 | } 22 | 23 | public InstantiationError() { 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/InstantiationException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public class InstantiationException extends Exception { 14 | public InstantiationException(String message) { 15 | super(message); 16 | } 17 | 18 | public InstantiationException() { 19 | super(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/InternalError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class InternalError extends VirtualMachineError { 4 | public InternalError() { 5 | super(); 6 | } 7 | 8 | public InternalError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Iterable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | import java.util.Iterator; 14 | 15 | public interface Iterable { 16 | public Iterator iterator(); 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/LinkageError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class LinkageError extends Error { 4 | public LinkageError() { 5 | super(); 6 | } 7 | 8 | public LinkageError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NegativeArraySizeException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NegativeArraySizeException extends RuntimeException { 4 | public NegativeArraySizeException() { 5 | super(); 6 | } 7 | 8 | public NegativeArraySizeException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NoClassDefFoundError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NoClassDefFoundError extends LinkageError { 4 | public NoClassDefFoundError() { 5 | super(); 6 | } 7 | 8 | public NoClassDefFoundError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NoSuchFieldError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NoSuchFieldError extends IncompatibleClassChangeError { 4 | public NoSuchFieldError() { 5 | super(); 6 | } 7 | 8 | public NoSuchFieldError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NoSuchFieldException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public class NoSuchFieldException extends Exception { 14 | public NoSuchFieldException(String message) { 15 | super(message); 16 | } 17 | 18 | public NoSuchFieldException() { 19 | super(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NoSuchMethodError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NoSuchMethodError extends LinkageError { 4 | public NoSuchMethodError() { 5 | super(); 6 | } 7 | 8 | public NoSuchMethodError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NoSuchMethodException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public class NoSuchMethodException extends Exception { 14 | public NoSuchMethodException(String message) { 15 | super(message); 16 | } 17 | 18 | public NoSuchMethodException() { 19 | super(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NullPointerException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NullPointerException extends RuntimeException { 4 | public NullPointerException() { 5 | super(); 6 | } 7 | 8 | public NullPointerException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Number.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public abstract class Number { 14 | public abstract byte byteValue(); 15 | 16 | public abstract short shortValue(); 17 | 18 | public abstract int intValue(); 19 | 20 | public abstract long longValue(); 21 | 22 | public abstract float floatValue(); 23 | 24 | public abstract double doubleValue(); 25 | } 26 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/NumberFormatException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class NumberFormatException extends IllegalArgumentException { 4 | public NumberFormatException() { 5 | super(); 6 | } 7 | 8 | public NumberFormatException(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Object.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | import java.lang.annotation.DirectNative; 4 | 5 | // FIXME vm 6 | @DirectNative 7 | public class Object { 8 | protected Object clone() { 9 | return null; 10 | } 11 | 12 | public boolean equals(Object obj) { 13 | return false; 14 | } 15 | 16 | protected void finalize() { 17 | } 18 | 19 | public Class getClass() { 20 | return null; 21 | } 22 | 23 | public native int hashCode(); 24 | 25 | public void notify() { 26 | } 27 | 28 | public void notifyAll() { 29 | } 30 | 31 | public String toString() { 32 | return null; 33 | } 34 | 35 | public void wait() { 36 | } 37 | 38 | public void wait(long timeout) { 39 | } 40 | 41 | public void wait(long timeout, int nanos) { 42 | } 43 | } -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/OutOfMemoryError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class OutOfMemoryError extends VirtualMachineError { 4 | public OutOfMemoryError() { 5 | super(); 6 | } 7 | 8 | public OutOfMemoryError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Override.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public @interface Override { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/RuntimeException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class RuntimeException extends Exception { 4 | public RuntimeException() { 5 | super(); 6 | } 7 | 8 | public RuntimeException(java.lang.String message, java.lang.Throwable cause) { 9 | super(message, cause); 10 | } 11 | 12 | public RuntimeException(java.lang.String message) { 13 | super(message); 14 | } 15 | 16 | public RuntimeException(java.lang.Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Short.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public final class Short extends Number implements Comparable { 14 | // this field is filled by ReflectionGenerator#initializePrimitiveTypes() 15 | public static Class TYPE; 16 | public static final short MAX_VALUE = 32767; 17 | 18 | private final short value; 19 | 20 | public Short(short value) { 21 | this.value = value; 22 | } 23 | 24 | public static Short valueOf(short value) { 25 | return new Short(value); 26 | } 27 | 28 | public int compareTo(Short o) { 29 | return value - o.value; 30 | } 31 | 32 | public boolean equals(Object o) { 33 | return o instanceof Short && ((Short) o).value == value; 34 | } 35 | 36 | public int hashCode() { 37 | return value; 38 | } 39 | 40 | public String toString() { 41 | return toString(value); 42 | } 43 | 44 | public static String toString(short v, int radix) { 45 | return Long.toString(v, radix); 46 | } 47 | 48 | public static String toString(short v) { 49 | return toString(v, 10); 50 | } 51 | 52 | public byte byteValue() { 53 | return (byte) value; 54 | } 55 | 56 | public short shortValue() { 57 | return value; 58 | } 59 | 60 | public int intValue() { 61 | return value; 62 | } 63 | 64 | public long longValue() { 65 | return value; 66 | } 67 | 68 | public float floatValue() { 69 | return (float) value; 70 | } 71 | 72 | public double doubleValue() { 73 | return (double) value; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/StackOverflowError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class StackOverflowError extends VirtualMachineError { 4 | public StackOverflowError() { 5 | super(); 6 | } 7 | 8 | public StackOverflowError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/StackTraceElement.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public class StackTraceElement { 14 | private static int NativeLine = -1; 15 | 16 | private String class_; 17 | private String method; 18 | private String file; 19 | private int line; 20 | 21 | public StackTraceElement(String class_, String method, String file, int line) { 22 | this.class_ = class_; 23 | this.method = method; 24 | this.file = file; 25 | this.line = line; 26 | } 27 | 28 | public int hashCode() { 29 | return class_.hashCode() ^ method.hashCode() ^ line; 30 | } 31 | 32 | public boolean equals(Object o) { 33 | if (o instanceof StackTraceElement) { 34 | StackTraceElement e = (StackTraceElement) o; 35 | return class_.equals(e.class_) && method.equals(e.method) 36 | && line == e.line; 37 | } else { 38 | return false; 39 | } 40 | } 41 | 42 | public String toString() { 43 | StringBuilder sb = new StringBuilder(); 44 | sb.append(class_).append(".").append(method); 45 | 46 | if (line == NativeLine) { 47 | sb.append(" (native)"); 48 | } else if (line >= 0) { 49 | sb.append(" (line ").append(line).append(")"); 50 | } 51 | 52 | return sb.toString(); 53 | } 54 | 55 | public String getClassName() { 56 | return class_; 57 | } 58 | 59 | public String getMethodName() { 60 | return method; 61 | } 62 | 63 | public String getFileName() { 64 | return file; 65 | } 66 | 67 | public int getLineNumber() { 68 | return line; 69 | } 70 | 71 | public boolean isNativeMethod() { 72 | return line == NativeLine; 73 | } 74 | } -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/System.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class System { 4 | public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length) { 5 | // FIXME vm 6 | } 7 | 8 | public static String getProperty(String key) { 9 | // FIXME vm 10 | if(key.equals("line.separator")) return "\n"; 11 | return null; 12 | } 13 | 14 | public static long currentTimeMillis() { 15 | // FIXME vm 16 | return 0; 17 | } 18 | 19 | public static int identityHashCode(Object x) { 20 | // FIXME vm 21 | return 0; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ThreadDeath.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class ThreadDeath extends Error { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Throwable.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | import java.io.PrintStream; 4 | import java.io.PrintWriter; 5 | 6 | public class Throwable { 7 | private String message; 8 | private Throwable cause; 9 | private StackTraceElement[] stackTrace; 10 | 11 | public Throwable() { 12 | } 13 | 14 | public Throwable(String message) { 15 | this(message, null); 16 | } 17 | 18 | public Throwable(String message, Throwable cause) { 19 | this.message = message; 20 | this.cause = cause; 21 | } 22 | 23 | public Throwable(Throwable cause) { 24 | this(null, cause); 25 | } 26 | 27 | public Throwable fillInStackTrace() { 28 | // FIXME exceptions 29 | return this; 30 | } 31 | 32 | public Throwable getCause() { 33 | return cause; 34 | } 35 | 36 | public String getLocalizedMessage() { 37 | // FIXME exceptions 38 | return getMessage(); 39 | } 40 | 41 | public String getMessage() { 42 | return message; 43 | } 44 | 45 | public StackTraceElement[] getStackTraces() { 46 | // FIXME exceptions 47 | return stackTrace; 48 | } 49 | 50 | public void printStackTrace() { 51 | // FIXME exceptions 52 | } 53 | 54 | public void printStackTrace(PrintStream s) { 55 | // FIXME exceptions 56 | } 57 | 58 | public void printStackTrace(PrintWriter s) { 59 | // FIXME exceptions 60 | } 61 | 62 | public void setStackTrace(StackTraceElement[] stackTrace) { 63 | this.stackTrace = stackTrace; 64 | } 65 | 66 | public String toString() { 67 | // FIXME exceptions 68 | return super.toString(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/UnknownError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class UnknownError extends VirtualMachineError { 4 | public UnknownError() { 5 | super(); 6 | } 7 | 8 | public UnknownError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/UnsatisfiedLinkError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class UnsatisfiedLinkError extends LinkageError { 4 | public UnsatisfiedLinkError() { 5 | super(); 6 | } 7 | 8 | public UnsatisfiedLinkError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/UnsupportedOperationException.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class UnsupportedOperationException extends RuntimeException { 4 | public UnsupportedOperationException() { 5 | super(); 6 | } 7 | 8 | public UnsupportedOperationException(java.lang.String message, 9 | java.lang.Throwable cause) { 10 | super(message, cause); 11 | } 12 | 13 | public UnsupportedOperationException(java.lang.String message) { 14 | super(message); 15 | } 16 | 17 | public UnsupportedOperationException(java.lang.Throwable cause) { 18 | super(cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/VerifyError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class VerifyError extends LinkageError { 4 | public VerifyError() { 5 | super(); 6 | } 7 | 8 | public VerifyError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/VirtualMachineError.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public class VirtualMachineError extends Error { 4 | public VirtualMachineError() { 5 | super(); 6 | } 7 | 8 | public VirtualMachineError(java.lang.String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/Void.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang; 12 | 13 | public final class Void { 14 | // this field is filled by ReflectionGenerator#initializePrimitiveTypes() 15 | public static Class TYPE; 16 | 17 | private Void() { } 18 | } 19 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/Annotation.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.annotation; 12 | 13 | public interface Annotation { 14 | } 15 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/DirectNative.java: -------------------------------------------------------------------------------- 1 | package java.lang.annotation; 2 | 3 | /** 4 | * Tags classes and/or methods, signaling that the native method implementation(s) 5 | * are directly done in C++. This allows to circumnavigate JNI for kernel classes 6 | * like java.lang.Class. Jack will not emit C++ method implementations for 7 | * any native method tagged with this annotation or any native methods of a class 8 | * tagged with this annotation. The C++ methods need to be implemented manually 9 | * to avoid linking errors. 10 | * 11 | * @author mzechner 12 | * 13 | */ 14 | public @interface DirectNative { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/ElementType.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.annotation; 12 | 13 | public enum ElementType { 14 | ANNOTATION_TYPE, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/Retention.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.annotation; 12 | 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Retention { 15 | public RetentionPolicy value(); 16 | } 17 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/RetentionPolicy.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.annotation; 12 | 13 | public enum RetentionPolicy { 14 | CLASS, RUNTIME, SOURCE 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/annotation/Target.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.annotation; 12 | 13 | @Retention(value = RetentionPolicy.RUNTIME) 14 | @Target(value = ElementType.ANNOTATION_TYPE) 15 | public @interface Target { 16 | public ElementType[] value(); 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ref/PhantomReference.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.ref; 12 | 13 | public class PhantomReference extends Reference { 14 | public PhantomReference(T target, ReferenceQueue queue) { 15 | super(target, queue); 16 | } 17 | 18 | public PhantomReference(T target) { 19 | this(target, null); 20 | } 21 | 22 | public T get() { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ref/Reference.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.ref; 12 | 13 | public abstract class Reference { 14 | private Object vmNext; 15 | private T target; 16 | private ReferenceQueue queue; 17 | 18 | Reference jNext; 19 | 20 | protected Reference(T target, ReferenceQueue queue) { 21 | this.target = target; 22 | this.queue = queue; 23 | } 24 | 25 | protected Reference(T target) { 26 | this(target, null); 27 | } 28 | 29 | public T get() { 30 | return target; 31 | } 32 | 33 | public void clear() { 34 | target = null; 35 | } 36 | 37 | public boolean isEnqueued() { 38 | return jNext != null; 39 | } 40 | 41 | public boolean enqueue() { 42 | if (queue != null) { 43 | queue.add(this); 44 | queue = null; 45 | return true; 46 | } else { 47 | return false; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ref/ReferenceQueue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.ref; 12 | 13 | public class ReferenceQueue { 14 | private Reference front; 15 | 16 | public Reference poll() { 17 | Reference r = front; 18 | if (front != null) { 19 | if (front == front.jNext) { 20 | front = null; 21 | } else { 22 | front = front.jNext; 23 | } 24 | } 25 | return r; 26 | } 27 | 28 | void add(Reference r) { 29 | if (front == null) { 30 | r.jNext = r; 31 | } else { 32 | r.jNext = front; 33 | } 34 | front = r; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ref/SoftReference.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.ref; 12 | 13 | public class SoftReference extends Reference { 14 | public SoftReference(T target, ReferenceQueue queue) { 15 | super(target, queue); 16 | } 17 | 18 | public SoftReference(T target) { 19 | this(target, null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/ref/WeakReference.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.lang.ref; 12 | 13 | public class WeakReference extends Reference { 14 | public WeakReference(T target, ReferenceQueue queue) { 15 | super(target, queue); 16 | } 17 | 18 | public WeakReference(T target) { 19 | this(target, null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/reflect/Array.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class Array { 4 | 5 | public static Object newInstance(Class componentType, int size) { 6 | // FIXME reflection 7 | return null; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/reflect/Constructor.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class Constructor { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/reflect/Field.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class Field { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/reflect/InvocationTargetException.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class InvocationTargetException extends Exception { 4 | private Throwable target; 5 | 6 | public InvocationTargetException() { 7 | super(); 8 | } 9 | 10 | public InvocationTargetException(Throwable target) { 11 | this(target, null); 12 | } 13 | 14 | public InvocationTargetException(Throwable target, String s) { 15 | super(s); 16 | this.target = target; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/lang/reflect/Method.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class Method { 4 | public Object invoke(Object obj, Object ... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { 5 | // FIXME reflection 6 | return null; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/AbstractList.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractList extends AbstractCollection 14 | implements List 15 | { 16 | protected int modCount; 17 | 18 | public boolean add(T o) { 19 | add(size(), o); 20 | return true; 21 | } 22 | 23 | public Iterator iterator() { 24 | return listIterator(); 25 | } 26 | 27 | public ListIterator listIterator() { 28 | return new Collections.ArrayListIterator(this); 29 | } 30 | 31 | public int indexOf(Object o) { 32 | int i = 0; 33 | for (T v: this) { 34 | if (o == null) { 35 | if (v == null) { 36 | return i; 37 | } 38 | } else if (o.equals(v)) { 39 | return i; 40 | } 41 | 42 | ++ i; 43 | } 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/AbstractMap.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractMap extends Object implements Map { } 14 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/AbstractQueue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractQueue extends AbstractCollection implements Queue { 14 | 15 | protected AbstractQueue() { 16 | super(); 17 | } 18 | 19 | public boolean add(T element) { 20 | if (offer(element)) { 21 | return true; 22 | } else { 23 | throw new IllegalStateException(); 24 | } 25 | } 26 | 27 | public boolean addAll(Collection collection) { 28 | if (collection == null) { 29 | throw new NullPointerException(); 30 | } 31 | 32 | for (T element : collection) { 33 | add(element); 34 | } 35 | 36 | return true; 37 | } 38 | 39 | public void clear() { 40 | while (size() > 0) { 41 | poll(); 42 | } 43 | } 44 | 45 | public T element() { 46 | emptyCheck(); 47 | return peek(); 48 | } 49 | 50 | public T remove() { 51 | emptyCheck(); 52 | return poll(); 53 | } 54 | 55 | private void emptyCheck() { 56 | if (size() == 0) { 57 | throw new NoSuchElementException(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/AbstractSequentialList.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractSequentialList extends AbstractList 14 | implements List 15 | { } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/AbstractSet.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractSet extends AbstractCollection implements Set { 14 | } 15 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Collection.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Collection extends Iterable { 14 | public int size(); 15 | 16 | public boolean isEmpty(); 17 | 18 | public boolean contains(Object element); 19 | 20 | public boolean add(T element); 21 | 22 | public boolean addAll(Collection collection); 23 | 24 | public boolean remove(Object element); 25 | 26 | public Object[] toArray(); 27 | 28 | public S[] toArray(S[] array); 29 | 30 | public void clear(); 31 | } 32 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Comparator.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Comparator { 14 | public int compare(T o1, T o2); 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/ConcurrentModificationException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | /** 14 | * @author zsombor 15 | * 16 | */ 17 | public class ConcurrentModificationException extends RuntimeException { 18 | 19 | /** 20 | * @param message 21 | * @param cause 22 | */ 23 | public ConcurrentModificationException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | /** 28 | * @param message 29 | */ 30 | public ConcurrentModificationException(String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param cause 36 | */ 37 | public ConcurrentModificationException(Throwable cause) { 38 | super(cause); 39 | } 40 | 41 | /** 42 | * 43 | */ 44 | public ConcurrentModificationException() { 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Date.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Date { 14 | public final long when; 15 | 16 | public Date() { 17 | when = System.currentTimeMillis(); 18 | } 19 | 20 | public Date(long when) { 21 | this.when = when; 22 | } 23 | 24 | public long getTime() { 25 | return when; 26 | } 27 | 28 | public String toString() { 29 | return toString(when); 30 | } 31 | 32 | private static native String toString(long when); 33 | } 34 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Enumeration.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Enumeration { 14 | public T nextElement(); 15 | 16 | public boolean hasMoreElements(); 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/EventListener.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface EventListener { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/EventObject.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class EventObject { 14 | protected Object source; 15 | 16 | public EventObject(Object source) { 17 | this.source = source; 18 | } 19 | 20 | public Object getSource() { 21 | return source; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/IdentityHashMap.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class IdentityHashMap implements Map { 14 | private final HashMap map; 15 | 16 | public IdentityHashMap(int capacity) { 17 | map = new HashMap(capacity, new MyHelper()); 18 | } 19 | 20 | public IdentityHashMap() { 21 | this(0); 22 | } 23 | 24 | public boolean isEmpty() { 25 | return map.isEmpty(); 26 | } 27 | 28 | public int size() { 29 | return map.size(); 30 | } 31 | 32 | public boolean containsKey(Object key) { 33 | return map.containsKey(key); 34 | } 35 | 36 | public boolean containsValue(Object value) { 37 | return map.containsValue(value); 38 | } 39 | 40 | public V get(Object key) { 41 | return map.get(key); 42 | } 43 | 44 | public V put(K key, V value) { 45 | return map.put(key, value); 46 | } 47 | 48 | public void putAll(Map elts) { 49 | map.putAll(elts); 50 | } 51 | 52 | public V remove(Object key) { 53 | return map.remove(key); 54 | } 55 | 56 | public void clear() { 57 | map.clear(); 58 | } 59 | 60 | public Set> entrySet() { 61 | return map.entrySet(); 62 | } 63 | 64 | public Set keySet() { 65 | return map.keySet(); 66 | } 67 | 68 | public Collection values() { 69 | return map.values(); 70 | } 71 | 72 | private static class MyHelper 73 | extends HashMap.MyHelper 74 | { 75 | public int hash(K a) { 76 | return (a == null ? 0 : System.identityHashCode(a)); 77 | } 78 | 79 | public boolean equal(K a, K b) { 80 | return a == b; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Iterator.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Iterator { 14 | public T next(); 15 | 16 | public boolean hasNext(); 17 | 18 | public void remove(); 19 | } 20 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/List.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface List extends Collection { 14 | public T get(int index); 15 | 16 | public T set(int index, T value); 17 | 18 | public T remove(int index); 19 | 20 | public boolean add(T element); 21 | 22 | public void add(int index, T element); 23 | 24 | public int indexOf(Object value); 25 | 26 | public int lastIndexOf(Object value); 27 | 28 | public boolean isEmpty(); 29 | 30 | public ListIterator listIterator(int index); 31 | 32 | public ListIterator listIterator(); 33 | } 34 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/ListIterator.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface ListIterator extends Iterator { 14 | public boolean hasPrevious(); 15 | public E previous(); 16 | } 17 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Locale.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Locale { 14 | private static final Locale DEFAULT; 15 | public static final Locale ENGLISH = new Locale("en", ""); 16 | 17 | private final String language; 18 | private final String country; 19 | private final String variant; 20 | 21 | static { 22 | DEFAULT = new Locale(System.getProperty("user.language"), 23 | System.getProperty("user.region")); 24 | } 25 | 26 | public Locale(String language, String country, String variant) { 27 | this.language = language; 28 | this.country = country; 29 | this.variant = variant; 30 | } 31 | 32 | public Locale(String language, String country) { 33 | this(language, country, ""); 34 | } 35 | 36 | public Locale(String language) { 37 | this(language, ""); 38 | } 39 | 40 | public String getLanguage() { 41 | return language; 42 | } 43 | 44 | public String getCountry() { 45 | return country; 46 | } 47 | 48 | public String getVariant() { 49 | return variant; 50 | } 51 | 52 | public static Locale getDefault() { 53 | return DEFAULT; 54 | } 55 | 56 | public final String toString() { 57 | boolean hasLanguage = language != ""; 58 | boolean hasCountry = country != ""; 59 | boolean hasVariant = variant != ""; 60 | 61 | if (!hasLanguage && !hasCountry) return ""; 62 | return language + (hasCountry || hasVariant ? '_' + country : "") + (hasVariant ? '_' + variant : ""); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Map.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Map { 14 | public boolean isEmpty(); 15 | 16 | public int size(); 17 | 18 | public boolean containsKey(Object obj); 19 | 20 | public boolean containsValue(Object obj); 21 | 22 | public V get(Object key); 23 | 24 | public V put(K key, V value); 25 | 26 | public void putAll(Map elts); 27 | 28 | public V remove(Object key); 29 | 30 | public void clear(); 31 | 32 | public Set> entrySet(); 33 | 34 | public Set keySet(); 35 | 36 | public Collection values(); 37 | 38 | public interface Entry { 39 | public K getKey(); 40 | 41 | public V getValue(); 42 | 43 | public V setValue(V value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/MissingResourceException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class MissingResourceException extends RuntimeException { 14 | private final String class_; 15 | private final String key; 16 | 17 | public MissingResourceException(String message, String class_, String key) { 18 | super(message); 19 | this.class_ = class_; 20 | this.key = key; 21 | } 22 | 23 | public String getClassName() { 24 | return class_; 25 | } 26 | 27 | public String getKey() { 28 | return key; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/NoSuchElementException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class NoSuchElementException extends RuntimeException { 14 | public NoSuchElementException(String message) { 15 | super(message); 16 | } 17 | 18 | public NoSuchElementException() { 19 | super(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Queue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Queue extends Collection, Iterable { 14 | public boolean add(T element); 15 | public T element(); 16 | public boolean offer(T element); 17 | public T peek(); 18 | public T poll(); 19 | public T remove(); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/RandomAccess.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface RandomAccess { 14 | } 15 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Set.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Set extends Collection { } 14 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/SortedSet.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface SortedSet extends Collection, Iterable, Set { 14 | public Comparator comparator(); 15 | public T first(); 16 | public SortedSet headSet(T toElement); 17 | public T last(); 18 | public SortedSet subSet(T fromElement, T toElement); 19 | public SortedSet tailSet(T fromElement); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/Stack.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Stack extends Vector { 14 | public boolean empty() { 15 | return size() == 0; 16 | } 17 | 18 | public T peek() { 19 | return get(size() - 1); 20 | } 21 | 22 | public T pop() { 23 | return remove(size() - 1); 24 | } 25 | 26 | public T push(T element) { 27 | add(element); 28 | return element; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /runtime/jack-kernel/src/java/util/UUID.java: -------------------------------------------------------------------------------- 1 | package java.util; 2 | 3 | public class UUID { 4 | private final byte[] data; 5 | 6 | private UUID(byte[] data) { 7 | this.data = data; 8 | } 9 | 10 | public static UUID randomUUID() { 11 | byte[] array = new byte[16]; 12 | 13 | new Random().nextBytes(array); 14 | 15 | array[6] &= 0x0f; 16 | array[6] |= 0x40; 17 | array[8] &= 0x3f; 18 | array[8] |= 0x80; 19 | 20 | return new UUID(array); 21 | } 22 | 23 | public String toString() { 24 | StringBuilder sb = new StringBuilder(); 25 | toHex(sb, data, 0, 4); sb.append('-'); 26 | toHex(sb, data, 4, 2); sb.append('-'); 27 | toHex(sb, data, 6, 2); sb.append('-'); 28 | toHex(sb, data, 8, 2); sb.append('-'); 29 | toHex(sb, data, 10, 6); 30 | return sb.toString(); 31 | } 32 | 33 | private static char toHex(int i) { 34 | return (char) (i < 10 ? i + '0' : (i - 10) + 'A'); 35 | } 36 | 37 | private static void toHex(StringBuilder sb, byte[] array, int offset, 38 | int length) 39 | { 40 | for (int i = offset; i < offset + length; ++i) { 41 | sb.append(toHex((array[i] >> 4) & 0xf)); 42 | sb.append(toHex((array[i] ) & 0xf)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /runtime/jack-library/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /runtime/jack-library/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jack-library 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/BufferedOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class BufferedOutputStream extends OutputStream { 14 | private final OutputStream out; 15 | private final byte[] buffer; 16 | private int position; 17 | 18 | public BufferedOutputStream(OutputStream out, int size) { 19 | this.out = out; 20 | this.buffer = new byte[size]; 21 | } 22 | 23 | public BufferedOutputStream(OutputStream out) { 24 | this(out, 4096); 25 | } 26 | 27 | private void drain() throws IOException { 28 | if (position > 0) { 29 | out.write(buffer, 0, position); 30 | position = 0; 31 | } 32 | } 33 | 34 | public void write(int c) throws IOException { 35 | if (position >= buffer.length) { 36 | drain(); 37 | } 38 | 39 | buffer[position++] = (byte) (c & 0xFF); 40 | } 41 | 42 | public void write(byte[] b, int offset, int length) throws IOException { 43 | if (length > buffer.length - position) { 44 | drain(); 45 | out.write(b, offset, length); 46 | } else { 47 | System.arraycopy(b, offset, buffer, position, length); 48 | position += length; 49 | } 50 | } 51 | 52 | public void flush() throws IOException { 53 | drain(); 54 | out.flush(); 55 | } 56 | 57 | public void close() throws IOException { 58 | flush(); 59 | out.close(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/BufferedWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class BufferedWriter extends Writer { 14 | private final Writer out; 15 | private final char[] buffer; 16 | private int position; 17 | 18 | public BufferedWriter(Writer out, int size) { 19 | this.out = out; 20 | this.buffer = new char[size]; 21 | } 22 | 23 | public BufferedWriter(Writer out) { 24 | this(out, 4096); 25 | } 26 | 27 | private void drain() throws IOException { 28 | if (position > 0) { 29 | out.write(buffer, 0, position); 30 | position = 0; 31 | } 32 | } 33 | 34 | public void write(char[] b, int offset, int length) throws IOException { 35 | if (length > buffer.length - position) { 36 | drain(); 37 | out.write(b, offset, length); 38 | } else { 39 | System.arraycopy(b, offset, buffer, position, length); 40 | position += length; 41 | } 42 | } 43 | 44 | public void flush() throws IOException { 45 | drain(); 46 | out.flush(); 47 | } 48 | 49 | public void close() throws IOException { 50 | flush(); 51 | out.close(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/EOFException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class EOFException extends IOException { 14 | public EOFException(String message) { 15 | super(message); 16 | } 17 | 18 | public EOFException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/Externalizable.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface Externalizable { 14 | public void readExternal(ObjectInput in); 15 | public void writeExternal(ObjectOutput out); 16 | } 17 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileDescriptor.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileDescriptor { 14 | public static final FileDescriptor in = new FileDescriptor(0); 15 | public static final FileDescriptor out = new FileDescriptor(1); 16 | public static final FileDescriptor err = new FileDescriptor(2); 17 | 18 | final int value; 19 | 20 | public FileDescriptor(int value) { 21 | this.value = value; 22 | } 23 | 24 | public FileDescriptor() { 25 | this(-1); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileInputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileInputStream extends InputStream { 14 | // static { 15 | // System.loadLibrary("natives"); 16 | // } 17 | 18 | private int fd; 19 | private int remaining; 20 | 21 | public FileInputStream(FileDescriptor fd) { 22 | this.fd = fd.value; 23 | } 24 | 25 | public FileInputStream(String path) throws IOException { 26 | fd = open(path); 27 | remaining = (int) new File(path).length(); 28 | } 29 | 30 | public FileInputStream(File file) throws IOException { 31 | this(file.getPath()); 32 | } 33 | 34 | public int available() throws IOException { 35 | return remaining; 36 | } 37 | 38 | private static native int open(String path) throws IOException; 39 | 40 | private static native int read(int fd) throws IOException; 41 | 42 | private static native int read(int fd, byte[] b, int offset, int length) 43 | throws IOException; 44 | 45 | public static native void close(int fd) throws IOException; 46 | 47 | public int read() throws IOException { 48 | int c = read(fd); 49 | if (c >= 0 && remaining > 0) { 50 | -- remaining; 51 | } 52 | return c; 53 | } 54 | 55 | public int read(byte[] b, int offset, int length) throws IOException { 56 | if (b == null) { 57 | throw new NullPointerException(); 58 | } 59 | 60 | if (offset < 0 || offset + length > b.length) { 61 | throw new ArrayIndexOutOfBoundsException(); 62 | } 63 | 64 | int c = read(fd, b, offset, length); 65 | if (c > 0 && remaining > 0) { 66 | remaining -= c; 67 | } 68 | return c; 69 | } 70 | 71 | public void close() throws IOException { 72 | if (fd != -1) { 73 | close(fd); 74 | fd = -1; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileNotFoundException extends IOException { 14 | public FileNotFoundException(String message) { 15 | super(message); 16 | } 17 | 18 | public FileNotFoundException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileOutputStream extends OutputStream { 14 | // static { 15 | // System.loadLibrary("natives"); 16 | // } 17 | 18 | private int fd; 19 | 20 | public FileOutputStream(FileDescriptor fd) { 21 | this.fd = fd.value; 22 | } 23 | 24 | public FileOutputStream(String path) throws IOException { 25 | this(path, false); 26 | } 27 | 28 | public FileOutputStream(String path, boolean append) throws IOException { 29 | fd = open(path, append); 30 | } 31 | 32 | 33 | public FileOutputStream(File file) throws IOException { 34 | this(file.getPath()); 35 | } 36 | 37 | private static native int open(String path, boolean append) throws IOException; 38 | 39 | private static native void write(int fd, int c) throws IOException; 40 | 41 | private static native void write(int fd, byte[] b, int offset, int length) 42 | throws IOException; 43 | 44 | private static native void close(int fd) throws IOException; 45 | 46 | public void write(int c) throws IOException { 47 | write(fd, c); 48 | } 49 | 50 | public void write(byte[] b, int offset, int length) throws IOException { 51 | if (b == null) { 52 | throw new NullPointerException(); 53 | } 54 | 55 | if (offset < 0 || offset + length > b.length) { 56 | throw new ArrayIndexOutOfBoundsException(); 57 | } 58 | 59 | write(fd, b, offset, length); 60 | } 61 | 62 | public void close() throws IOException { 63 | if (fd != -1) { 64 | close(fd); 65 | fd = -1; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileReader extends Reader { 14 | private final Reader in; 15 | 16 | public FileReader(FileInputStream in) { 17 | this.in = new InputStreamReader(in); 18 | } 19 | 20 | public FileReader(FileDescriptor fd) { 21 | this(new FileInputStream(fd)); 22 | } 23 | 24 | public FileReader(String path) throws IOException { 25 | this(new FileInputStream(path)); 26 | } 27 | 28 | public FileReader(File file) throws IOException { 29 | this(new FileInputStream(file)); 30 | } 31 | 32 | public int read(char[] b, int offset, int length) throws IOException { 33 | return in.read(b, offset, length); 34 | } 35 | 36 | public void close() throws IOException { 37 | in.close(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FileWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FileWriter extends Writer { 14 | private final Writer out; 15 | 16 | private FileWriter(FileOutputStream out) { 17 | this.out = new OutputStreamWriter(out); 18 | } 19 | 20 | public FileWriter(FileDescriptor fd) { 21 | this(new FileOutputStream(fd)); 22 | } 23 | 24 | public FileWriter(String path) throws IOException { 25 | this(new FileOutputStream(path)); 26 | } 27 | 28 | public FileWriter(File file) throws IOException { 29 | this(new FileOutputStream(file)); 30 | } 31 | 32 | public void write(char[] b, int offset, int length) throws IOException { 33 | out.write(b, offset, length); 34 | } 35 | 36 | public void flush() throws IOException { 37 | out.flush(); 38 | } 39 | 40 | public void close() throws IOException { 41 | out.close(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FilenameFilter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface FilenameFilter { 14 | 15 | boolean accept(File dir, String name); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/FilterOutputStream.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class FilterOutputStream extends OutputStream { 14 | protected OutputStream out; 15 | 16 | public FilterOutputStream(OutputStream out) { 17 | this.out = out; 18 | } 19 | 20 | public void close() throws IOException { 21 | out.close(); 22 | } 23 | 24 | public void flush() throws IOException { 25 | out.flush(); 26 | } 27 | 28 | public void write(byte[] b) throws IOException { 29 | out.write(b); 30 | } 31 | 32 | public void write(byte[] b, int off, int len) throws IOException { 33 | out.write(b, off, len); 34 | } 35 | 36 | public void write(int b) throws IOException { 37 | out.write(b); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/LineNumberReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class LineNumberReader extends BufferedReader { 14 | private int line; 15 | 16 | public LineNumberReader(Reader in, int bufferSize) { 17 | super(in, bufferSize); 18 | } 19 | 20 | public LineNumberReader(Reader in) { 21 | super(in); 22 | } 23 | 24 | public int getLineNumber() { 25 | return line; 26 | } 27 | 28 | public void setLineNumber(int v) { 29 | line = v; 30 | } 31 | 32 | public int read(char[] b, int offset, int length) throws IOException { 33 | int c = super.read(b, offset, length); 34 | for (int i = 0; i < c; ++i) { 35 | if (b[i] == '\n') { 36 | ++ line; 37 | } 38 | } 39 | return c; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/NotSerializableException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class NotSerializableException extends ObjectStreamException { 14 | public NotSerializableException(String message) { 15 | super(message); 16 | } 17 | 18 | public NotSerializableException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/ObjectInput.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface ObjectInput { 14 | public int available(); 15 | public void close(); 16 | public void read(); 17 | public void read(byte[] b); 18 | public void read(byte[] b, int off, int len); 19 | public Object readObject(); 20 | public long skip(long n); 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/ObjectOutput.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public interface ObjectOutput { 14 | public void close(); 15 | public void flush(); 16 | public void write(byte[] b); 17 | public void write(byte[] b, int off, int len); 18 | public void write(int b); 19 | public void writeObject(Object obj); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/ObjectStreamException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class ObjectStreamException extends IOException { 14 | public ObjectStreamException(String message) { 15 | super(message); 16 | } 17 | 18 | public ObjectStreamException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/PushbackReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class PushbackReader extends Reader { 14 | private final Reader in; 15 | private char savedChar; 16 | private boolean hasSavedChar; 17 | 18 | public PushbackReader(Reader in, int bufferSize) { 19 | if (bufferSize > 1) { 20 | throw new IllegalArgumentException(bufferSize + " > 1"); 21 | } 22 | this.in = in; 23 | this.hasSavedChar = false; 24 | } 25 | 26 | public PushbackReader(Reader in) { 27 | this(in, 1); 28 | } 29 | 30 | public int read(char[] b, int offset, int length) throws IOException { 31 | int count = 0; 32 | if (hasSavedChar && length > 0) { 33 | length--; 34 | b[offset++] = savedChar; 35 | hasSavedChar = false; 36 | count = 1; 37 | } 38 | if (length > 0) { 39 | int c = in.read(b, offset, length); 40 | if (c == -1) { 41 | if (count == 0) { 42 | count = -1; 43 | } 44 | } else { 45 | count += c; 46 | } 47 | } 48 | 49 | return count; 50 | } 51 | 52 | public void unread(char[] b, int offset, int length) throws IOException { 53 | if (length != 1) { 54 | throw new IOException("Can only push back 1 char, not " + length); 55 | } else if (hasSavedChar) { 56 | throw new IOException("Already have a saved char"); 57 | } else { 58 | hasSavedChar = true; 59 | savedChar = b[offset]; 60 | } 61 | } 62 | 63 | public void unread(char[] b) throws IOException { 64 | unread(b, 0, b.length); 65 | } 66 | 67 | public void unread(int c) throws IOException { 68 | unread(new char[] { (char) c }); 69 | } 70 | 71 | public void close() throws IOException { 72 | in.close(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/StreamCorruptedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StreamCorruptedException extends IOException { 14 | public StreamCorruptedException(String message) { 15 | super(message); 16 | } 17 | 18 | public StreamCorruptedException() { 19 | this(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/StringReader.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StringReader extends Reader { 14 | private final String in; 15 | private int position = 0; 16 | 17 | public StringReader(String in) { 18 | this.in = in; 19 | } 20 | 21 | public int read(char[] b, int offset, int length) throws IOException { 22 | if (length > in.length() - position) { 23 | length = in.length() - position; 24 | if (length <= 0) { 25 | return -1; 26 | } 27 | } 28 | in.getChars(position, position+length, b, offset); 29 | position += length; 30 | return length; 31 | } 32 | 33 | public void close() throws IOException { } 34 | } 35 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/io/StringWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.io; 12 | 13 | public class StringWriter extends Writer { 14 | private final StringBuilder out = new StringBuilder(); 15 | 16 | public void write(char[] b, int offset, int length) throws IOException { 17 | out.append(b, offset, length); 18 | } 19 | 20 | public String toString() { 21 | return out.toString(); 22 | } 23 | 24 | public void flush() throws IOException { } 25 | 26 | public void close() throws IOException { } 27 | } 28 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/AbstractList.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractList extends AbstractCollection 14 | implements List 15 | { 16 | protected int modCount; 17 | 18 | public boolean add(T o) { 19 | add(size(), o); 20 | return true; 21 | } 22 | 23 | public Iterator iterator() { 24 | return listIterator(); 25 | } 26 | 27 | public ListIterator listIterator() { 28 | return new Collections.ArrayListIterator(this); 29 | } 30 | 31 | public int indexOf(Object o) { 32 | int i = 0; 33 | for (T v: this) { 34 | if (o == null) { 35 | if (v == null) { 36 | return i; 37 | } 38 | } else if (o.equals(v)) { 39 | return i; 40 | } 41 | 42 | ++ i; 43 | } 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/AbstractMap.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractMap extends Object implements Map { } 14 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/AbstractQueue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractQueue extends AbstractCollection implements Queue { 14 | 15 | protected AbstractQueue() { 16 | super(); 17 | } 18 | 19 | public boolean add(T element) { 20 | if (offer(element)) { 21 | return true; 22 | } else { 23 | throw new IllegalStateException(); 24 | } 25 | } 26 | 27 | public boolean addAll(Collection collection) { 28 | if (collection == null) { 29 | throw new NullPointerException(); 30 | } 31 | 32 | for (T element : collection) { 33 | add(element); 34 | } 35 | 36 | return true; 37 | } 38 | 39 | public void clear() { 40 | while (size() > 0) { 41 | poll(); 42 | } 43 | } 44 | 45 | public T element() { 46 | emptyCheck(); 47 | return peek(); 48 | } 49 | 50 | public T remove() { 51 | emptyCheck(); 52 | return poll(); 53 | } 54 | 55 | private void emptyCheck() { 56 | if (size() == 0) { 57 | throw new NoSuchElementException(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/AbstractSequentialList.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractSequentialList extends AbstractList 14 | implements List 15 | { } 16 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/AbstractSet.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public abstract class AbstractSet extends AbstractCollection implements Set { 14 | } 15 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/ConcurrentModificationException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | /** 14 | * @author zsombor 15 | * 16 | */ 17 | public class ConcurrentModificationException extends RuntimeException { 18 | 19 | /** 20 | * @param message 21 | * @param cause 22 | */ 23 | public ConcurrentModificationException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | /** 28 | * @param message 29 | */ 30 | public ConcurrentModificationException(String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param cause 36 | */ 37 | public ConcurrentModificationException(Throwable cause) { 38 | super(cause); 39 | } 40 | 41 | /** 42 | * 43 | */ 44 | public ConcurrentModificationException() { 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Date.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Date { 14 | public final long when; 15 | 16 | public Date() { 17 | when = System.currentTimeMillis(); 18 | } 19 | 20 | public Date(long when) { 21 | this.when = when; 22 | } 23 | 24 | public long getTime() { 25 | return when; 26 | } 27 | 28 | public String toString() { 29 | return toString(when); 30 | } 31 | 32 | private static native String toString(long when); 33 | } 34 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Enumeration.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Enumeration { 14 | public T nextElement(); 15 | 16 | public boolean hasMoreElements(); 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/EventListener.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface EventListener { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/EventObject.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class EventObject { 14 | protected Object source; 15 | 16 | public EventObject(Object source) { 17 | this.source = source; 18 | } 19 | 20 | public Object getSource() { 21 | return source; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/IdentityHashMap.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2009, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class IdentityHashMap implements Map { 14 | private final HashMap map; 15 | 16 | public IdentityHashMap(int capacity) { 17 | map = new HashMap(capacity, new MyHelper()); 18 | } 19 | 20 | public IdentityHashMap() { 21 | this(0); 22 | } 23 | 24 | public boolean isEmpty() { 25 | return map.isEmpty(); 26 | } 27 | 28 | public int size() { 29 | return map.size(); 30 | } 31 | 32 | public boolean containsKey(Object key) { 33 | return map.containsKey(key); 34 | } 35 | 36 | public boolean containsValue(Object value) { 37 | return map.containsValue(value); 38 | } 39 | 40 | public V get(Object key) { 41 | return map.get(key); 42 | } 43 | 44 | public V put(K key, V value) { 45 | return map.put(key, value); 46 | } 47 | 48 | public void putAll(Map elts) { 49 | map.putAll(elts); 50 | } 51 | 52 | public V remove(Object key) { 53 | return map.remove(key); 54 | } 55 | 56 | public void clear() { 57 | map.clear(); 58 | } 59 | 60 | public Set> entrySet() { 61 | return map.entrySet(); 62 | } 63 | 64 | public Set keySet() { 65 | return map.keySet(); 66 | } 67 | 68 | public Collection values() { 69 | return map.values(); 70 | } 71 | 72 | private static class MyHelper 73 | extends HashMap.MyHelper 74 | { 75 | public int hash(K a) { 76 | return (a == null ? 0 : System.identityHashCode(a)); 77 | } 78 | 79 | public boolean equal(K a, K b) { 80 | return a == b; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Locale.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Locale { 14 | private static final Locale DEFAULT; 15 | public static final Locale ENGLISH = new Locale("en", ""); 16 | 17 | private final String language; 18 | private final String country; 19 | private final String variant; 20 | 21 | static { 22 | DEFAULT = new Locale(System.getProperty("user.language"), 23 | System.getProperty("user.region")); 24 | } 25 | 26 | public Locale(String language, String country, String variant) { 27 | this.language = language; 28 | this.country = country; 29 | this.variant = variant; 30 | } 31 | 32 | public Locale(String language, String country) { 33 | this(language, country, ""); 34 | } 35 | 36 | public Locale(String language) { 37 | this(language, ""); 38 | } 39 | 40 | public String getLanguage() { 41 | return language; 42 | } 43 | 44 | public String getCountry() { 45 | return country; 46 | } 47 | 48 | public String getVariant() { 49 | return variant; 50 | } 51 | 52 | public static Locale getDefault() { 53 | return DEFAULT; 54 | } 55 | 56 | public final String toString() { 57 | boolean hasLanguage = language != ""; 58 | boolean hasCountry = country != ""; 59 | boolean hasVariant = variant != ""; 60 | 61 | if (!hasLanguage && !hasCountry) return ""; 62 | return language + (hasCountry || hasVariant ? '_' + country : "") + (hasVariant ? '_' + variant : ""); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Map.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008-2010, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Map { 14 | public boolean isEmpty(); 15 | 16 | public int size(); 17 | 18 | public boolean containsKey(Object obj); 19 | 20 | public boolean containsValue(Object obj); 21 | 22 | public V get(Object key); 23 | 24 | public V put(K key, V value); 25 | 26 | public void putAll(Map elts); 27 | 28 | public V remove(Object key); 29 | 30 | public void clear(); 31 | 32 | public Set> entrySet(); 33 | 34 | public Set keySet(); 35 | 36 | public Collection values(); 37 | 38 | public interface Entry { 39 | public K getKey(); 40 | 41 | public V getValue(); 42 | 43 | public V setValue(V value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/MissingResourceException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class MissingResourceException extends RuntimeException { 14 | private final String class_; 15 | private final String key; 16 | 17 | public MissingResourceException(String message, String class_, String key) { 18 | super(message); 19 | this.class_ = class_; 20 | this.key = key; 21 | } 22 | 23 | public String getClassName() { 24 | return class_; 25 | } 26 | 27 | public String getKey() { 28 | return key; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Queue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Queue extends Collection, Iterable { 14 | public boolean add(T element); 15 | public T element(); 16 | public boolean offer(T element); 17 | public T peek(); 18 | public T poll(); 19 | public T remove(); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/RandomAccess.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface RandomAccess { 14 | } 15 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Set.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface Set extends Collection { } 14 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/SortedSet.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public interface SortedSet extends Collection, Iterable, Set { 14 | public Comparator comparator(); 15 | public T first(); 16 | public SortedSet headSet(T toElement); 17 | public T last(); 18 | public SortedSet subSet(T fromElement, T toElement); 19 | public SortedSet tailSet(T fromElement); 20 | } 21 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/Stack.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Avian Contributors 2 | 3 | Permission to use, copy, modify, and/or distribute this software 4 | for any purpose with or without fee is hereby granted, provided 5 | that the above copyright notice and this permission notice appear 6 | in all copies. 7 | 8 | There is NO WARRANTY for this software. See license.txt for 9 | details. */ 10 | 11 | package java.util; 12 | 13 | public class Stack extends Vector { 14 | public boolean empty() { 15 | return size() == 0; 16 | } 17 | 18 | public T peek() { 19 | return get(size() - 1); 20 | } 21 | 22 | public T pop() { 23 | return remove(size() - 1); 24 | } 25 | 26 | public T push(T element) { 27 | add(element); 28 | return element; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /runtime/jack-library/src/java/util/UUID.java: -------------------------------------------------------------------------------- 1 | package java.util; 2 | 3 | public class UUID { 4 | private final byte[] data; 5 | 6 | private UUID(byte[] data) { 7 | this.data = data; 8 | } 9 | 10 | public static UUID randomUUID() { 11 | byte[] array = new byte[16]; 12 | 13 | new Random().nextBytes(array); 14 | 15 | array[6] &= 0x0f; 16 | array[6] |= 0x40; 17 | array[8] &= 0x3f; 18 | array[8] |= 0x80; 19 | 20 | return new UUID(array); 21 | } 22 | 23 | public String toString() { 24 | StringBuilder sb = new StringBuilder(); 25 | toHex(sb, data, 0, 4); sb.append('-'); 26 | toHex(sb, data, 4, 2); sb.append('-'); 27 | toHex(sb, data, 6, 2); sb.append('-'); 28 | toHex(sb, data, 8, 2); sb.append('-'); 29 | toHex(sb, data, 10, 6); 30 | return sb.toString(); 31 | } 32 | 33 | private static char toHex(int i) { 34 | return (char) (i < 10 ? i + '0' : (i - 10) + 'A'); 35 | } 36 | 37 | private static void toHex(StringBuilder sb, byte[] array, int offset, 38 | int length) 39 | { 40 | for (int i = offset; i < offset + length; ++i) { 41 | sb.append(toHex((array[i] >> 4) & 0xf)); 42 | sb.append(toHex((array[i] ) & 0xf)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /runtime/jack-tests/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /runtime/jack-tests/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jack-tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Arithmetic.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Arithmetic { 4 | public int arithmetic() { 5 | byte b = 1; 6 | short s = 1; 7 | char c = 1; 8 | int i = 1; 9 | long l = 1; 10 | float a = 1; 11 | double d = 1; 12 | 13 | double r = b + c * i / l; 14 | r %= d; 15 | r = -r; 16 | 17 | int shift = s << b; 18 | shift = s >> b; 19 | shift = s >>> b; 20 | return (int)(r + shift); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/ArrayTest.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class ArrayTest { 4 | public static final Object[] staticArray = new Object[1000000]; 5 | 6 | public ArrayTest() { 7 | int[] intArray = new int[1024*10]; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Arrays.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Arrays { 4 | int[] ia = new int[10]; 5 | 6 | public void arrays() { 7 | byte[] ba = new byte[120]; 8 | ba[20] = 20; 9 | int d = ba[20]; 10 | d = ba[d]; 11 | ia[0] = d; 12 | 13 | float[][] fa = new float[20][20]; 14 | int a = 13, b = 12, c = 13; 15 | Object[][][] oa = new Object[a][b][c]; 16 | fa[0][1] = 123.3f; 17 | oa[0][0][0] = null; 18 | 19 | byte[] i = { 0, 1, 2, 3, 4 }; 20 | String[] s = { "hello", "world" }; 21 | String[][] o = {{"hello"}, {"world"}}; 22 | 23 | 24 | // FIXME array covariance, gah :( 25 | // Object[] t = newStringArray(); 26 | // t[0] = ""; 27 | } 28 | 29 | // public Object[] newStringArray() { 30 | // return new String[10]; 31 | // } 32 | } 33 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Exceptions.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Exceptions { 4 | public void runtime() { 5 | throw new RuntimeException(); 6 | } 7 | 8 | public void checked() throws Exception { 9 | throw new Exception(); 10 | } 11 | 12 | public void simpleCatch() { 13 | try { 14 | checked(); 15 | } catch(Exception e) { 16 | return; 17 | } 18 | } 19 | 20 | public void ifCatch() { 21 | try { 22 | int i = 2; 23 | if(i == 3) { 24 | return; 25 | } 26 | } catch(Throwable t) { 27 | 28 | } 29 | } 30 | 31 | public void forCatch() { 32 | try { 33 | for(int i = 0; i< 10; i++) { 34 | if(i == 0) return; 35 | } 36 | } catch(Throwable t) { 37 | } 38 | } 39 | 40 | public void whileCatch() { 41 | try { 42 | int i = 0; 43 | while(true) { 44 | if(i == 0) return; 45 | } 46 | } catch(Throwable t) { 47 | } 48 | } 49 | 50 | public void doCatch() { 51 | try { 52 | int i = 0; 53 | do { 54 | if(i == 0) return; 55 | } while(true); 56 | } catch(Exception e) { 57 | 58 | } 59 | } 60 | 61 | public void complexCatch() { 62 | try { 63 | try { 64 | try { 65 | checked(); 66 | return; 67 | } catch(ClassNotFoundException e) { 68 | 69 | } catch(Throwable e) { 70 | 71 | } 72 | } catch(NullPointerException e) { 73 | 74 | } catch(Throwable e) { 75 | 76 | } 77 | } catch(Exception e) { 78 | 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/InstanceOf.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | import java.io.Serializable; 4 | 5 | public class InstanceOf { 6 | class A implements IB { 7 | 8 | } 9 | 10 | class B extends A implements IA { 11 | 12 | } 13 | 14 | class C implements IC { 15 | 16 | } 17 | 18 | interface IA { 19 | 20 | } 21 | 22 | interface IB { 23 | 24 | } 25 | 26 | interface IC extends IA, IB { 27 | 28 | } 29 | 30 | public void test() { 31 | A a = new A(); 32 | B b = new B(); 33 | C c = new C(); 34 | String[] arr = new String[0]; 35 | 36 | if(A.class != a.getClass()) throw new RuntimeException(); 37 | if(!(a instanceof A)) throw new RuntimeException(); 38 | if(a instanceof B) throw new RuntimeException(); 39 | if(!(arr instanceof Object[])) throw new RuntimeException(); 40 | if(((Object)arr) instanceof Object[][]) throw new RuntimeException(); 41 | if(!(arr instanceof Serializable)) throw new RuntimeException(); 42 | if(!(arr instanceof Cloneable)) throw new RuntimeException(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Main.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Main { 4 | Statics statics; 5 | Arithmetic arithmetic; 6 | Arrays arrays; 7 | Primes primes; 8 | } 9 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Primes.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Primes { 4 | 5 | private int[] primes; 6 | private int len; 7 | 8 | public Primes() { 9 | this.primes = new int[16]; 10 | this.len = 0; 11 | } 12 | 13 | public int size() { 14 | return this.len; 15 | } 16 | 17 | public int get(int i) { 18 | while (this.size() <= i) 19 | this.next(); 20 | return this.primes[i]; 21 | } 22 | 23 | public int next() { 24 | if (this.len == 0) { 25 | this.primes[this.len++] = 2; 26 | return 2; 27 | } 28 | 29 | int last = this.primes[this.len - 1]; 30 | int test = last; 31 | 32 | outer: while (true) { 33 | test += 1; 34 | 35 | for (int i = 0; i < this.len; i++) 36 | if (test % this.primes[i] == 0) 37 | continue outer; 38 | 39 | if (this.primes.length == this.len) { 40 | int[] newArray = new int[this.primes.length*2]; 41 | for(int i = 0; i < this.primes.length; i++) { 42 | newArray[i] = this.primes[i]; 43 | } 44 | this.primes = newArray; 45 | } 46 | 47 | this.primes[this.len++] = test; 48 | return test; 49 | } 50 | } 51 | 52 | // public static void main(String[] args) { 53 | // Primes primes = new Primes(); 54 | // long start = System.nanoTime(); 55 | // long sum = 0; 56 | // for(int i = 0; i < 10000; i++) { 57 | // sum += primes.next(); 58 | // if(i % 1000 == 0) System.out.println(i + ": " + (System.nanoTime() - start) / 1000000000.0f + ", " + sum); 59 | // } 60 | // System.out.println(sum); 61 | // System.out.println((System.nanoTime() - start) / 1000000000.0f); 62 | // } 63 | } -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Reflection.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Reflection { 4 | class Inner { 5 | } 6 | 7 | public void test() throws ClassNotFoundException { 8 | Class c = byte[].class; 9 | if(!c.getName().equals("[B")) throw new ClassNotFoundException(); 10 | 11 | c = byte[][][].class; 12 | if(!c.getName().equals("[[[B")) throw new ClassNotFoundException(); 13 | 14 | c = Object[][][].class; 15 | if(!c.getName().equals("[[[Ljava.lang.Object;")) throw new ClassNotFoundException(); 16 | 17 | c = int.class; 18 | if(!c.getName().equals("int")) throw new ClassNotFoundException(); 19 | 20 | c = Object.class; 21 | if(!c.getName().equals("java.lang.Object")) throw new ClassNotFoundException(); 22 | 23 | c = Inner[][].class; 24 | if(!c.getName().equals("[[Ljack.tests.Reflection$Inner;")) throw new ClassNotFoundException(); 25 | 26 | c = Class.forName("[C"); 27 | if(!c.isArray() || c.getComponentType() != char.class) throw new ClassNotFoundException(); 28 | 29 | Object[] arr = new Object[0]; 30 | c = arr.getClass(); 31 | if(!c.isArray() || !c.getName().equals("[Ljava.lang.Object;") || c.getComponentType() != Object.class) 32 | throw new ClassNotFoundException(); 33 | 34 | // if(Class.forName("[Ljava/lang/Object;") == Object.class) throw new RuntimeException(); 35 | } 36 | 37 | public static void main(String[] args) throws ClassNotFoundException { 38 | new Reflection().test(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Statics.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Statics { 4 | static final boolean z = true; 5 | static final byte b = 1; 6 | static final char c = 1; 7 | static final short s = 1; 8 | static final int i = 1; 9 | static final long l = 1; 10 | static final float f = 1; 11 | static double d = 1; 12 | static Object a; 13 | 14 | static { 15 | a = new Object(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Strings.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | public class Strings { 4 | static String staticString = "static string"; 5 | 6 | public void test() { 7 | String test = new String("this is a test"); 8 | String test2 = "This is another test"; 9 | 10 | test += test2; 11 | test2 = "a string" + "another string"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /runtime/jack-tests/src/jack/tests/Synchronized.java: -------------------------------------------------------------------------------- 1 | package jack.tests; 2 | 3 | 4 | public class Synchronized { 5 | public void test() { 6 | synchronized(this) { 7 | test2(); 8 | } 9 | } 10 | 11 | public void test2() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /vs10/vs10.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vs10", "vs10.vcxproj", "{AC967C16-FEC9-432A-BE58-AB19A8106846}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {AC967C16-FEC9-432A-BE58-AB19A8106846}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {AC967C16-FEC9-432A-BE58-AB19A8106846}.Debug|Win32.Build.0 = Debug|Win32 14 | {AC967C16-FEC9-432A-BE58-AB19A8106846}.Release|Win32.ActiveCfg = Release|Win32 15 | {AC967C16-FEC9-432A-BE58-AB19A8106846}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /xcode/jack.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /xcode/jack.xcodeproj/project.xcworkspace/xcuserdata/badlogic.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badlogic/jack/1fc147c697c0223b00223faf979321bcf52becd5/xcode/jack.xcodeproj/project.xcworkspace/xcuserdata/badlogic.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /xcode/jack.xcodeproj/xcuserdata/badlogic.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | jack.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 76D1765915EEDB6A00677583 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | --------------------------------------------------------------------------------