├── .fossil-settings └── ignore-glob ├── .hgtags ├── COPYING.harmony ├── COPYING.luje ├── README ├── build.xml ├── doc ├── chart1.png ├── chart2.png ├── copying.wiki ├── faq.wiki └── index.wiki ├── lib ├── com │ └── cowlark │ │ └── luje │ │ ├── Fannkuch.java │ │ ├── FieldBench.java │ │ ├── LocalBench.java │ │ ├── Mandelbrot.java │ │ ├── OTest.java │ │ └── harmony │ │ ├── Messages.java │ │ ├── UCharacter.java │ │ └── VM.java ├── java │ ├── io │ │ ├── BufferedWriter.java │ │ ├── ByteArrayInputStream.java │ │ ├── ByteArrayOutputStream.java │ │ ├── Closeable.java │ │ ├── File.java │ │ ├── FileDescriptor.java │ │ ├── FileFilter.java │ │ ├── FileInputStream.java │ │ ├── FileNotFoundException.java │ │ ├── FileOutputStream.java │ │ ├── FilenameFilter.java │ │ ├── FilterOutputStream.java │ │ ├── Flushable.java │ │ ├── IOException.java │ │ ├── InputStream.java │ │ ├── OutputStream.java │ │ ├── OutputStreamWriter.java │ │ ├── PrintStream.java │ │ ├── Reader.java │ │ ├── Serializable.java │ │ ├── SyncFailedException.java │ │ ├── UTFDataFormatException.java │ │ ├── UnsupportedEncodingException.java │ │ └── Writer.java │ ├── lang │ │ ├── AbstractMethodError.java │ │ ├── AbstractStringBuilder.java │ │ ├── Appendable.java │ │ ├── ArithmeticException.java │ │ ├── ArrayIndexOutOfBoundsException.java │ │ ├── ArrayStoreException.java │ │ ├── AssertionError.java │ │ ├── Boolean.java │ │ ├── Byte.java │ │ ├── CharSequence.java │ │ ├── Character.java │ │ ├── Class.java │ │ ├── ClassCastException.java │ │ ├── ClassCircularityError.java │ │ ├── ClassFormatError.java │ │ ├── CloneNotSupportedException.java │ │ ├── Cloneable.java │ │ ├── Comparable.java │ │ ├── Deprecated.java │ │ ├── Double.java │ │ ├── Enum.java │ │ ├── EnumConstantNotPresentException.java │ │ ├── Error.java │ │ ├── Exception.java │ │ ├── Float.java │ │ ├── IllegalAccessError.java │ │ ├── IllegalArgumentException.java │ │ ├── IllegalMonitorStateException.java │ │ ├── IllegalStateException.java │ │ ├── IncompatibleClassChangeError.java │ │ ├── IndexOutOfBoundsException.java │ │ ├── InstantiationError.java │ │ ├── Integer.java │ │ ├── InternalError.java │ │ ├── Iterable.java │ │ ├── LinkageError.java │ │ ├── Long.java │ │ ├── Math.java │ │ ├── NegativeArraySizeException.java │ │ ├── NoClassDefFoundError.java │ │ ├── NoSuchFieldError.java │ │ ├── NoSuchMethodError.java │ │ ├── NullPointerException.java │ │ ├── Number.java │ │ ├── NumberFormatException.java │ │ ├── Object.java │ │ ├── OutOfMemoryError.java │ │ ├── Override.java │ │ ├── Readable.java │ │ ├── RuntimeException.java │ │ ├── Short.java │ │ ├── StackOverflowError.java │ │ ├── StackTraceElement.java │ │ ├── StrictMath.java │ │ ├── String.java │ │ ├── StringBuffer.java │ │ ├── StringBuilder.java │ │ ├── StringIndexOutOfBoundsException.java │ │ ├── SuppressWarnings.java │ │ ├── System.java │ │ ├── ThreadDeath.java │ │ ├── Throwable.java │ │ ├── UnknownError.java │ │ ├── UnsatisfiedLinkError.java │ │ ├── UnsupportedOperationException.java │ │ ├── VerifyError.java │ │ ├── VirtualMachineError.java │ │ ├── Void.java │ │ ├── annotation │ │ │ ├── Annotation.java │ │ │ ├── AnnotationFormatError.java │ │ │ ├── Documented.java │ │ │ ├── ElementType.java │ │ │ ├── IncompleteAnnotationException.java │ │ │ ├── Inherited.java │ │ │ ├── Retention.java │ │ │ ├── RetentionPolicy.java │ │ │ └── Target.java │ │ └── reflect │ │ │ └── Array.java │ ├── net │ │ ├── MalformedURLException.java │ │ ├── URI.java │ │ ├── URIEncoderDecoder.java │ │ └── URISyntaxException.java │ ├── nio │ │ ├── Buffer.java │ │ ├── BufferFactory.java │ │ ├── BufferOverflowException.java │ │ ├── BufferUnderflowException.java │ │ ├── ByteBuffer.java │ │ ├── ByteOrder.java │ │ ├── CharArrayBuffer.java │ │ ├── CharBuffer.java │ │ ├── CharSequenceAdapter.java │ │ ├── CharToByteBufferAdapter.java │ │ ├── DirectByteBuffer.java │ │ ├── DoubleArrayBuffer.java │ │ ├── DoubleBuffer.java │ │ ├── DoubleToByteBufferAdapter.java │ │ ├── FloatArrayBuffer.java │ │ ├── FloatBuffer.java │ │ ├── FloatToByteBufferAdapter.java │ │ ├── HeapByteBuffer.java │ │ ├── IntArrayBuffer.java │ │ ├── IntBuffer.java │ │ ├── IntToByteBufferAdapter.java │ │ ├── InvalidMarkException.java │ │ ├── LongArrayBuffer.java │ │ ├── LongBuffer.java │ │ ├── LongToByteBufferAdapter.java │ │ ├── MappedByteBuffer.java │ │ ├── ReadOnlyBufferException.java │ │ ├── ReadOnlyCharArrayBuffer.java │ │ ├── ReadOnlyDirectByteBuffer.java │ │ ├── ReadOnlyDoubleArrayBuffer.java │ │ ├── ReadOnlyFloatArrayBuffer.java │ │ ├── ReadOnlyHeapByteBuffer.java │ │ ├── ReadOnlyIntArrayBuffer.java │ │ ├── ReadOnlyLongArrayBuffer.java │ │ ├── ReadOnlyShortArrayBuffer.java │ │ ├── ReadWriteCharArrayBuffer.java │ │ ├── ReadWriteDirectByteBuffer.java │ │ ├── ReadWriteDoubleArrayBuffer.java │ │ ├── ReadWriteFloatArrayBuffer.java │ │ ├── ReadWriteHeapByteBuffer.java │ │ ├── ReadWriteIntArrayBuffer.java │ │ ├── ReadWriteLongArrayBuffer.java │ │ ├── ReadWriteShortArrayBuffer.java │ │ ├── ShortArrayBuffer.java │ │ ├── ShortBuffer.java │ │ ├── ShortToByteBufferAdapter.java │ │ └── charset │ │ │ ├── CharacterCodingException.java │ │ │ ├── Charset.java │ │ │ ├── CharsetDecoder.java │ │ │ ├── CharsetEncoder.java │ │ │ ├── CoderMalfunctionError.java │ │ │ ├── CoderResult.java │ │ │ ├── CodingErrorAction.java │ │ │ ├── IllegalCharsetNameException.java │ │ │ ├── MalformedInputException.java │ │ │ ├── UnmappableCharacterException.java │ │ │ └── UnsupportedCharsetException.java │ └── util │ │ ├── AbstractCollection.java │ │ ├── AbstractList.java │ │ ├── AbstractMap.java │ │ ├── AbstractSequentialList.java │ │ ├── AbstractSet.java │ │ ├── ArrayList.java │ │ ├── Arrays.java │ │ ├── Collection.java │ │ ├── Collections.java │ │ ├── Comparator.java │ │ ├── ConcurrentModificationException.java │ │ ├── Dictionary.java │ │ ├── Enumeration.java │ │ ├── HashMap.java │ │ ├── HashSet.java │ │ ├── Hashtable.java │ │ ├── Iterator.java │ │ ├── LinkedList.java │ │ ├── List.java │ │ ├── ListIterator.java │ │ ├── Locale.java │ │ ├── Map.java │ │ ├── MapEntry.java │ │ ├── MissingResourceException.java │ │ ├── NoSuchElementException.java │ │ ├── Queue.java │ │ ├── Random.java │ │ ├── RandomAccess.java │ │ ├── Set.java │ │ ├── SortedMap.java │ │ ├── SortedSet.java │ │ ├── StringTokenizer.java │ │ ├── TreeMap.java │ │ └── Vector.java ├── lib.iml └── org │ └── apache │ └── harmony │ ├── annotation │ └── internal │ │ └── nls │ │ └── Messages.java │ ├── luni │ ├── internal │ │ ├── io │ │ │ └── FileCanonPathCache.java │ │ └── nls │ │ │ └── Messages.java │ ├── platform │ │ ├── Endianness.java │ │ ├── ICommonDataTypes.java │ │ ├── IFileSystem.java │ │ ├── IMemorySpy.java │ │ ├── IMemorySystem.java │ │ ├── MappedPlatformAddress.java │ │ ├── NoopMemorySpy.java │ │ ├── OSFileSystem.java │ │ ├── OSMemory.java │ │ ├── Platform.java │ │ ├── PlatformAddress.java │ │ └── PlatformAddressFactory.java │ └── util │ │ ├── BinarySearch.java │ │ ├── DeleteOnExit.java │ │ ├── FloatingPointParser.java │ │ ├── HistoricalNamesUtil.java │ │ ├── NumberConverter.java │ │ ├── SneakyThrow.java │ │ └── Util.java │ ├── nio │ └── internal │ │ ├── DirectBuffer.java │ │ └── nls │ │ └── Messages.java │ ├── niochar │ ├── charset │ │ ├── UTF_16.java │ │ ├── UTF_16BE.java │ │ ├── UTF_16LE.java │ │ └── UTF_8.java │ └── internal │ │ └── nls │ │ └── Messages.java │ └── text │ └── internal │ └── nls │ └── Messages.java ├── luje └── vm ├── Cast.lua ├── Climp.lua ├── ClimpLoader.lua ├── Options.lua ├── Runtime.lua ├── String.lua ├── Utils.lua ├── classanalyser.lua ├── classreader.lua ├── main.lua └── natives.lua /.fossil-settings/ignore-glob: -------------------------------------------------------------------------------- 1 | bin 2 | 3 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 0ece98f5f7c071b0cfd3be26593b22ae65cc83ea release-0.2.1 2 | b5bf1662e74e219f6473d20857e3185bb126d977 release-0.2 3 | 53ec12bd78e98ec7a8b56b4e54bfdd4122319a87 release-0.1 4 | -------------------------------------------------------------------------------- /COPYING.luje: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, David Given 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 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | The views and conclusions contained in the software and documentation are those 25 | of the authors and should not be interpreted as representing official policies, 26 | either expressed or implied, of the FreeBSD Project. 27 | 28 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/chart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgiven/luje/c580adea62d30cec68505fa99b68e815c59f702c/doc/chart1.png -------------------------------------------------------------------------------- /doc/chart2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgiven/luje/c580adea62d30cec68505fa99b68e815c59f702c/doc/chart2.png -------------------------------------------------------------------------------- /doc/copying.wiki: -------------------------------------------------------------------------------- 1 | License 2 | 3 | Copyright © 2013, David Given
4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | # Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | # Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY 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 | 26 | The views and conclusions contained in the software and documentation are those 27 | of the authors and should not be interpreted as representing official policies, 28 | either expressed or implied, of the FreeBSD Project. -------------------------------------------------------------------------------- /lib/com/cowlark/luje/FieldBench.java: -------------------------------------------------------------------------------- 1 | /* Luje 2 | * © 2013 David Given 3 | * This file is redistributable under the terms of the 4 | * New BSD License. Please see the COPYING file in the 5 | * project root for the full text. 6 | */ 7 | 8 | package com.cowlark.luje; 9 | 10 | public class FieldBench 11 | { 12 | public static int TIME = 2000; 13 | public static int STEP = 10000; 14 | 15 | public static abstract class Benchmark 16 | { 17 | public abstract void iterate(); 18 | }; 19 | 20 | public static class IntBenchmark extends Benchmark 21 | { 22 | private int result = 1; 23 | private int count = 1; 24 | 25 | public void iterate() 26 | { 27 | result -= count++; 28 | result += count++; 29 | result *= count++; 30 | result /= count++; 31 | } 32 | } 33 | 34 | public static class LongBenchmark extends Benchmark 35 | { 36 | private long result = 1; 37 | private long count = 1; 38 | 39 | public void iterate() 40 | { 41 | result -= count++; 42 | result += count++; 43 | result *= count++; 44 | result /= count++; 45 | } 46 | } 47 | 48 | public static class FloatBenchmark extends Benchmark 49 | { 50 | private float result = 1; 51 | private float count = 1; 52 | 53 | public void iterate() 54 | { 55 | result -= count++; 56 | result += count++; 57 | result *= count++; 58 | result /= count++; 59 | } 60 | } 61 | 62 | public static class DoubleBenchmark extends Benchmark 63 | { 64 | private double result = 1; 65 | private double count = 1; 66 | 67 | public void iterate() 68 | { 69 | result -= count++; 70 | result += count++; 71 | result *= count++; 72 | result /= count++; 73 | } 74 | } 75 | 76 | public static void bench(Benchmark b, String name) 77 | { 78 | long startTime = System.currentTimeMillis(); 79 | long elapsed; 80 | int iterations = 0; 81 | for (;;) 82 | { 83 | elapsed = System.currentTimeMillis() - startTime; 84 | if (elapsed > TIME) 85 | break; 86 | 87 | for (int i=0; i 4.0) && --i > 0); 65 | 66 | bits = bits << 1; 67 | if (i == 0) bits++; 68 | 69 | if (x%8 == 7) { 70 | bufLocal[bufLen++] = (byte) bits; 71 | if ( bufLen == BUFFER_SIZE) { 72 | //out.write(bufLocal, 0, BUFFER_SIZE); 73 | bufLen = 0; 74 | } 75 | bits = 0; 76 | } 77 | } 78 | if (shift!=0) { 79 | bits = bits << shift; 80 | bufLocal[bufLen++] = (byte) bits; 81 | if ( bufLen == BUFFER_SIZE) { 82 | //out.write(bufLocal, 0, BUFFER_SIZE); 83 | bufLen = 0; 84 | } 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/com/cowlark/luje/OTest.java: -------------------------------------------------------------------------------- 1 | package com.cowlark.luje; 2 | 3 | import java.util.*; 4 | import java.io.*; 5 | 6 | public class OTest 7 | { 8 | public static long STEP = 20000*5000; 9 | 10 | public static abstract class Benchmark 11 | { 12 | public abstract void iterate(); 13 | }; 14 | 15 | public static class Benchmark1 extends Benchmark 16 | { 17 | public void iterate() 18 | { 19 | } 20 | } 21 | 22 | public static class Benchmark2 extends Benchmark 23 | { 24 | public void iterate() 25 | { 26 | } 27 | } 28 | 29 | public static class Benchmark3 extends Benchmark 30 | { 31 | public void iterate() 32 | { 33 | } 34 | } 35 | 36 | public static void bench(Benchmark b) 37 | { 38 | for (int i=0; i _internSet = new HashMap(); 13 | 14 | public static synchronized String intern(String s) 15 | { 16 | String si = _internSet.get(s); 17 | if (si != null) 18 | return si; 19 | 20 | _internSet.put(s, s); 21 | return s; 22 | } 23 | 24 | public static void deleteOnExit() 25 | {} 26 | } 27 | -------------------------------------------------------------------------------- /lib/java/io/Closeable.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.io; 18 | 19 | /** 20 | * Defines an interface for classes that can (or need to) be closed once they 21 | * are not used any longer. This usually includes all sorts of 22 | * {@link InputStream}s and {@link OutputStream}s. Calling the {@code close} 23 | * method releases resources that the object holds. 24 | */ 25 | public interface Closeable { 26 | 27 | /** 28 | * Closes the object and release any system resources it holds. If the 29 | * object has already been closed, then invoking this method has no effect. 30 | * 31 | * @throws IOException 32 | * if any error occurs when closing the object. 33 | */ 34 | public void close() throws IOException; 35 | } -------------------------------------------------------------------------------- /lib/java/io/FileFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * An interface for filtering {@link File} objects based on their names 22 | * or other information. 23 | * 24 | * @see File#listFiles(FileFilter) 25 | */ 26 | public abstract interface FileFilter { 27 | 28 | /** 29 | * Indicating whether a specific file should be included in a pathname list. 30 | * 31 | * @param pathname 32 | * the abstract file to check. 33 | * @return {@code true} if the file should be included, {@code false} 34 | * otherwise. 35 | */ 36 | public abstract boolean accept(File pathname); 37 | } 38 | -------------------------------------------------------------------------------- /lib/java/io/FileNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * Thrown when a file specified by a program cannot be found. 22 | */ 23 | public class FileNotFoundException extends IOException { 24 | 25 | private static final long serialVersionUID = -897856973823710492L; 26 | 27 | /** 28 | * Constructs a new {@code FileNotFoundException} with its stack trace 29 | * filled in. 30 | */ 31 | public FileNotFoundException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructs a new {@code FileNotFoundException} with its stack trace and 37 | * detail message filled in. 38 | * 39 | * @param detailMessage 40 | * the detail message for this exception. 41 | */ 42 | public FileNotFoundException(String detailMessage) { 43 | super(detailMessage); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/java/io/FilenameFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * An interface for filtering {@link File} objects based on their names 22 | * or the directory they reside in. 23 | * 24 | * @see File 25 | * @see File#list(FilenameFilter) 26 | */ 27 | public interface FilenameFilter { 28 | 29 | /** 30 | * Indicates if a specific filename matches this filter. 31 | * 32 | * @param dir 33 | * the directory in which the {@code filename} was found. 34 | * @param filename 35 | * the name of the file in {@code dir} to test. 36 | * @return {@code true} if the filename matches the filter 37 | * and can be included in the list, {@code false} 38 | * otherwise. 39 | */ 40 | public abstract boolean accept(File dir, String filename); 41 | } 42 | -------------------------------------------------------------------------------- /lib/java/io/Flushable.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.io; 18 | 19 | /** 20 | * Defines an interface for classes that can (or need to) be flushed, typically 21 | * before some output processing is considered to be finished and the object 22 | * gets closed. 23 | */ 24 | public interface Flushable { 25 | /** 26 | * Flushes the object by writing out any buffered data to the underlying 27 | * output. 28 | * 29 | * @throws IOException 30 | * if there are any issues writing the data. 31 | */ 32 | void flush() throws IOException; 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/io/IOException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * Signals a general, I/O-related error. Error details may be specified when 22 | * calling the constructor, as usual. Note there are also several subclasses of 23 | * this class for more specific error situations, such as 24 | * {@link FileNotFoundException} or {@link EOFException}. 25 | */ 26 | public class IOException extends Exception { 27 | 28 | private static final long serialVersionUID = 7818375828146090155L; 29 | 30 | /** 31 | * Constructs a new {@code IOException} with its stack trace filled in. 32 | */ 33 | public IOException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Constructs a new {@code IOException} with its stack trace and detail 39 | * message filled in. 40 | * 41 | * @param detailMessage 42 | * the detail message for this exception. 43 | */ 44 | public IOException(String detailMessage) { 45 | super(detailMessage); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/java/io/Serializable.java: -------------------------------------------------------------------------------- 1 | package java.io; 2 | 3 | public interface Serializable 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /lib/java/io/SyncFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * Signals that the {@link FileDescriptor#sync()} method has failed to 22 | * complete. 23 | */ 24 | public class SyncFailedException extends IOException { 25 | 26 | private static final long serialVersionUID = -2353342684412443330L; 27 | 28 | /** 29 | * Constructs a new {@code SyncFailedException} with its stack trace and 30 | * detail message filled in. 31 | * 32 | * @param detailMessage 33 | * the detail message for this exception. 34 | */ 35 | public SyncFailedException(String detailMessage) { 36 | super(detailMessage); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/java/io/UTFDataFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * Signals that an incorrectly encoded UTF-8 string has been encountered, most 22 | * likely while reading some {@link DataInputStream}. 23 | * 24 | * @see DataInputStream#readUTF() 25 | */ 26 | public class UTFDataFormatException extends IOException { 27 | 28 | private static final long serialVersionUID = 420743449228280612L; 29 | 30 | /** 31 | * Constructs a new {@code UTFDataFormatException} with its stack trace 32 | * filled in. 33 | */ 34 | public UTFDataFormatException() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code UTFDataFormatException} with its stack trace and 40 | * detail message filled in. 41 | * 42 | * @param detailMessage 43 | * the detail message for this exception. 44 | */ 45 | public UTFDataFormatException(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/io/UnsupportedEncodingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.io; 19 | 20 | /** 21 | * Thrown when a program asks for a particular character converter that is 22 | * unavailable. 23 | */ 24 | public class UnsupportedEncodingException extends IOException { 25 | 26 | private static final long serialVersionUID = -4274276298326136670L; 27 | 28 | /** 29 | * Constructs a new {@code UnsupportedEncodingException} with its stack 30 | * trace filled in. 31 | */ 32 | public UnsupportedEncodingException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code UnsupportedEncodingException} with its stack 38 | * trace and detail message filled in. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public UnsupportedEncodingException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/AbstractMethodError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown by the virtual machine when an abstract method is called. 22 | *

23 | * Note that this can only occur when inconsistent class files have been loaded, 24 | * since invoking an abstract method is a compile time error. 25 | */ 26 | public class AbstractMethodError extends IncompatibleClassChangeError { 27 | 28 | private static final long serialVersionUID = -1654391082989018462L; 29 | 30 | /** 31 | * Constructs a new {@code AbstractMethodError} that includes the current 32 | * stack trace. 33 | */ 34 | public AbstractMethodError() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code AbstractMethodError} with the current stack trace 40 | * and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this error. 44 | */ 45 | public AbstractMethodError(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/lang/ArithmeticException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the an invalid arithmetic operation is attempted. 22 | */ 23 | public class ArithmeticException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = 2256477558314496007L; 26 | 27 | /** 28 | * Constructs a new {@code ArithmeticException} that includes the current 29 | * stack trace. 30 | */ 31 | public ArithmeticException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructs a new {@code ArithmeticException} with the current stack trace 37 | * and the specified detail message. 38 | * 39 | * @param detailMessage 40 | * the detail message for this exception. 41 | */ 42 | public ArithmeticException(String detailMessage) { 43 | super(detailMessage); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/java/lang/ArrayIndexOutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | import org.apache.harmony.luni.internal.nls.Messages; 21 | 22 | /** 23 | * Thrown when the an array is indexed with a value less than zero, or greater 24 | * than or equal to the size of the array. 25 | */ 26 | public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException { 27 | 28 | private static final long serialVersionUID = -5116101128118950844L; 29 | 30 | /** 31 | * Constructs a new {@code ArrayIndexOutOfBoundsException} that includes the 32 | * current stack trace. 33 | */ 34 | public ArrayIndexOutOfBoundsException() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code ArrayIndexOutOfBoundsException} with the current 40 | * stack trace and a detail message that is based on the specified invalid 41 | * {@code index}. 42 | * 43 | * @param index 44 | * the invalid index. 45 | */ 46 | public ArrayIndexOutOfBoundsException(int index) { 47 | // luni.36=Array index out of range\: {0} 48 | super(Messages.getString("luni.36", index)); //$NON-NLS-1$ 49 | } 50 | 51 | /** 52 | * Constructs a new {@code ArrayIndexOutOfBoundsException} with the current 53 | * stack trace and the specified detail message. 54 | * 55 | * @param detailMessage 56 | * the detail message for this exception. 57 | */ 58 | public ArrayIndexOutOfBoundsException(String detailMessage) { 59 | super(detailMessage); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/java/lang/ArrayStoreException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a program attempts to store an element of an incompatible type in 22 | * an array. 23 | */ 24 | public class ArrayStoreException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = -4522193890499838241L; 27 | 28 | /** 29 | * Constructs a new {@code ArrayStoreException} that includes the current 30 | * stack trace. 31 | */ 32 | public ArrayStoreException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code ArrayStoreException} with the current stack trace 38 | * and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public ArrayStoreException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/CharSequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * This interface represents an ordered set of characters and defines the 23 | * methods to probe them. 24 | */ 25 | public interface CharSequence { 26 | 27 | /** 28 | * Returns the number of characters in this sequence. 29 | * 30 | * @return the number of characters. 31 | */ 32 | public int length(); 33 | 34 | /** 35 | * Returns the character at the specified index, with the first character 36 | * having index zero. 37 | * 38 | * @param index 39 | * the index of the character to return. 40 | * @return the requested character. 41 | * @throws IndexOutOfBoundsException 42 | * if {@code index < 0} or {@code index} is greater than the 43 | * length of this sequence. 44 | */ 45 | public char charAt(int index); 46 | 47 | /** 48 | * Returns a {@code CharSequence} from the {@code start} index (inclusive) 49 | * to the {@code end} index (exclusive) of this sequence. 50 | * 51 | * @param start 52 | * the start offset of the sub-sequence. It is inclusive, that 53 | * is, the index of the first character that is included in the 54 | * sub-sequence. 55 | * @param end 56 | * the end offset of the sub-sequence. It is exclusive, that is, 57 | * the index of the first character after those that are included 58 | * in the sub-sequence 59 | * @return the requested sub-sequence. 60 | * @throws IndexOutOfBoundsException 61 | * if {@code start < 0}, {@code end < 0}, {@code start > end}, 62 | * or if {@code start} or {@code end} are greater than the 63 | * length of this sequence. 64 | */ 65 | public CharSequence subSequence(int start, int end); 66 | 67 | /** 68 | * Returns a string with the same characters in the same order as in this 69 | * sequence. 70 | * 71 | * @return a string based on this sequence. 72 | */ 73 | public String toString(); 74 | } 75 | -------------------------------------------------------------------------------- /lib/java/lang/Class.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | public abstract class Class 4 | { 5 | public native boolean isInstance(Object o); 6 | public native boolean isPrimitive(); 7 | public native boolean isArray(); 8 | public native Class getSuperclass(); 9 | public native Class getComponentType(); 10 | public native Class getArrayType(); 11 | private Class _arrayType; 12 | public native String getName(); 13 | 14 | public final boolean desiredAssertionStatus() 15 | { 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/java/lang/ClassCastException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | import org.apache.harmony.luni.internal.nls.Messages; 21 | 22 | /** 23 | * Thrown when a program attempts to cast a an object to a type with which it is 24 | * not compatible. 25 | */ 26 | public class ClassCastException extends RuntimeException { 27 | private static final long serialVersionUID = -9223365651070458532L; 28 | 29 | /** 30 | * Constructs a new {@code ClassCastException} that includes the current 31 | * stack trace. 32 | */ 33 | public ClassCastException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Constructs a new {@code ClassCastException} with the current stack trace 39 | * and the specified detail message. 40 | * 41 | * @param detailMessage 42 | * the detail message for this exception. 43 | */ 44 | public ClassCastException(String detailMessage) { 45 | super(detailMessage); 46 | } 47 | 48 | /** 49 | * Constructs a new {@code ClassCastException} with the current stack trace 50 | * and a detail message based on the source and target class. 51 | * 52 | * @param instanceClass 53 | * the class being cast from. 54 | * @param castClass 55 | * the class being cast to. 56 | */ 57 | ClassCastException(Class instanceClass, Class castClass) { 58 | super(Messages.getString("luni.4B", instanceClass.getName(), castClass //$NON-NLS-1$ 59 | .getName())); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/java/lang/ClassCircularityError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 19 | package java.lang; 20 | 21 | /** 22 | * Thrown when the virtual machine notices that an attempt is made to load a 23 | * class which would directly or indirectly inherit from one of its subclasses. 24 | *

25 | * Note that this error can only occur when inconsistent class files are loaded, 26 | * since it would normally be detected at compile time. 27 | */ 28 | public class ClassCircularityError extends LinkageError { 29 | 30 | private static final long serialVersionUID = 1054362542914539689L; 31 | 32 | /** 33 | * Constructs a new {@code ClassCircularityError} that include the current 34 | * stack trace. 35 | */ 36 | public ClassCircularityError() { 37 | super(); 38 | } 39 | 40 | /** 41 | * Constructs a new {@code ClassCircularityError} with the current stack 42 | * trace and the specified detail message. 43 | * 44 | * @param detailMessage 45 | * the detail message for this error. 46 | */ 47 | public ClassCircularityError(String detailMessage) { 48 | super(detailMessage); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/java/lang/ClassFormatError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown by a class loader when a class file has an illegal format or if the 22 | * data that it contains can not be interpreted as a class. 23 | */ 24 | public class ClassFormatError extends LinkageError { 25 | 26 | private static final long serialVersionUID = -8420114879011949195L; 27 | 28 | /** 29 | * Constructs a new {@code ClassFormatError} that includes the current stack 30 | * trace. 31 | */ 32 | public ClassFormatError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code ClassFormatError} with the current stack trace 38 | * and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this error. 42 | */ 43 | public ClassFormatError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/CloneNotSupportedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a program attempts to clone an object which does not support the 22 | * {@link Cloneable} interface. 23 | * 24 | * @see Cloneable 25 | */ 26 | public class CloneNotSupportedException extends Exception { 27 | 28 | private static final long serialVersionUID = 5195511250079656443L; 29 | 30 | /** 31 | * Constructs a new {@code CloneNotSupportedException} that includes the 32 | * current stack trace. 33 | */ 34 | public CloneNotSupportedException() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code CloneNotSupportedException} with the current 40 | * stack trace and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this exception. 44 | */ 45 | public CloneNotSupportedException(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/lang/Cloneable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * This (empty) interface must be implemented by all classes that wish to 23 | * support cloning. The implementation of {@code clone()} in {@code Object} 24 | * checks if the object being cloned implements this interface and throws 25 | * {@code CloneNotSupportedException} if it does not. 26 | * 27 | * @see Object#clone 28 | * @see CloneNotSupportedException 29 | */ 30 | public interface Cloneable { 31 | // Marker interface 32 | } 33 | -------------------------------------------------------------------------------- /lib/java/lang/Comparable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * This interface should be implemented by all classes that wish to define a 22 | * natural order of their instances. 23 | * {@link java.util.Collections#sort} and {@code java.util.Arrays#sort} can then 24 | * be used to automatically sort lists of classes that implement this interface. 25 | *

26 | * The order rule must be both transitive (if {@code x.compareTo(y) < 0} and 27 | * {@code y.compareTo(z) < 0}, then {@code x.compareTo(z) < 0} must hold) and 28 | * invertible (the sign of the result of x.compareTo(y) must be equal to the 29 | * negation of the sign of the result of y.compareTo(x) for all combinations of 30 | * x and y). 31 | *

32 | * In addition, it is recommended (but not required) that if and only if the 33 | * result of x.compareTo(y) is zero, then the result of x.equals(y) should be 34 | * {@code true}. 35 | */ 36 | public interface Comparable { 37 | 38 | /** 39 | * Compares this object to the specified object to determine their relative 40 | * order. 41 | * 42 | * @param another 43 | * the object to compare to this instance. 44 | * @return a negative integer if this instance is less than {@code another}; 45 | * a positive integer if this instance is greater than 46 | * {@code another}; 0 if this instance has the same order as 47 | * {@code another}. 48 | * @throws ClassCastException 49 | * if {@code another} cannot be converted into something 50 | * comparable to {@code this} instance. 51 | */ 52 | int compareTo(T another); 53 | } 54 | -------------------------------------------------------------------------------- /lib/java/lang/Deprecated.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | 23 | /** 24 | * Annotation type used to mark program elements that should no longer be used 25 | * by programmers. Compilers produce a warning if a deprecated program element 26 | * is used. 27 | * 28 | * @since 1.5 29 | */ 30 | @Documented 31 | @Retention(RetentionPolicy.RUNTIME) 32 | public @interface Deprecated { 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/lang/EnumConstantNotPresentException.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import org.apache.harmony.luni.internal.nls.Messages; 20 | 21 | /** 22 | * Thrown if an {@code enum} constant does not exist for a particular name. 23 | * 24 | * @since 1.5 25 | */ 26 | public class EnumConstantNotPresentException extends RuntimeException { 27 | 28 | private static final long serialVersionUID = -6046998521960521108L; 29 | 30 | @SuppressWarnings("unchecked") 31 | private final Class enumType; 32 | 33 | private final String constantName; 34 | 35 | /** 36 | * Constructs a new {@code EnumConstantNotPresentException} with the current 37 | * stack trace and a detail message based on the specified enum type and 38 | * missing constant name. 39 | * 40 | * @param enumType 41 | * the enum type. 42 | * @param constantName 43 | * the missing constant name. 44 | */ 45 | @SuppressWarnings("unchecked") 46 | public EnumConstantNotPresentException(Class enumType, 47 | String constantName) { 48 | // luni.03=The enum constant {0}.{1} is missing 49 | super(Messages.getString("luni.03", enumType.getName(), constantName)); //$NON-NLS-1$ 50 | this.enumType = enumType; 51 | this.constantName = constantName; 52 | } 53 | 54 | /** 55 | * Gets the enum type for which the constant name is missing. 56 | * 57 | * @return the enum type for which a constant name has not been found. 58 | */ 59 | @SuppressWarnings("unchecked") 60 | public Class enumType() { 61 | return enumType; 62 | } 63 | 64 | /** 65 | * Gets the name of the missing constant. 66 | * 67 | * @return the name of the constant that has not been found in the enum 68 | * type. 69 | */ 70 | public String constantName() { 71 | return constantName; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/java/lang/Error.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * {@code Error} is the superclass of all classes that represent unrecoverable 23 | * errors. When errors are thrown, they should not be caught by application 24 | * code. 25 | * 26 | * @see Throwable 27 | * @see Exception 28 | * @see RuntimeException 29 | */ 30 | public class Error extends Throwable { 31 | 32 | private static final long serialVersionUID = 4980196508277280342L; 33 | 34 | /** 35 | * Constructs a new {@code Error} that includes the current stack trace. 36 | */ 37 | public Error() { 38 | super(); 39 | } 40 | 41 | /** 42 | * Constructs a new {@code Error} with the current stack trace and the 43 | * specified detail message. 44 | * 45 | * @param detailMessage 46 | * the detail message for this error. 47 | */ 48 | public Error(String detailMessage) { 49 | super(detailMessage); 50 | } 51 | 52 | /** 53 | * Constructs a new {@code Error} with the current stack trace, the 54 | * specified detail message and the specified cause. 55 | * 56 | * @param detailMessage 57 | * the detail message for this error. 58 | * @param throwable 59 | * the cause of this error. 60 | */ 61 | public Error(String detailMessage, Throwable throwable) { 62 | super(detailMessage, throwable); 63 | } 64 | 65 | /** 66 | * Constructs a new {@code Error} with the current stack trace and the 67 | * specified cause. 68 | * 69 | * @param throwable 70 | * the cause of this error. 71 | */ 72 | public Error(Throwable throwable) { 73 | super(throwable); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/java/lang/Exception.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * {@code Exception} is the superclass of all classes that represent recoverable 23 | * exceptions. When exceptions are thrown, they may be caught by application 24 | * code. 25 | * 26 | * @see Throwable 27 | * @see Error 28 | * @see RuntimeException 29 | */ 30 | public class Exception extends Throwable { 31 | private static final long serialVersionUID = -3387516993124229948L; 32 | 33 | /** 34 | * Constructs a new {@code Exception} that includes the current stack trace. 35 | */ 36 | public Exception() { 37 | super(); 38 | } 39 | 40 | /** 41 | * Constructs a new {@code Exception} with the current stack trace and the 42 | * specified detail message. 43 | * 44 | * @param detailMessage 45 | * the detail message for this exception. 46 | */ 47 | public Exception(String detailMessage) { 48 | super(detailMessage); 49 | } 50 | 51 | /** 52 | * Constructs a new {@code Exception} with the current stack trace, the 53 | * specified detail message and the specified cause. 54 | * 55 | * @param detailMessage 56 | * the detail message for this exception. 57 | * @param throwable 58 | * the cause of this exception. 59 | */ 60 | public Exception(String detailMessage, Throwable throwable) { 61 | super(detailMessage, throwable); 62 | } 63 | 64 | /** 65 | * Constructs a new {@code Exception} with the current stack trace and the 66 | * specified cause. 67 | * 68 | * @param throwable 69 | * the cause of this exception. 70 | */ 71 | public Exception(Throwable throwable) { 72 | super(throwable); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/java/lang/IllegalAccessError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that a program tries access a field 22 | * which is not accessible from where it is referenced. 23 | *

24 | * Note that this can only occur when inconsistent class files have been loaded. 25 | */ 26 | public class IllegalAccessError extends IncompatibleClassChangeError { 27 | 28 | private static final long serialVersionUID = -8988904074992417891L; 29 | 30 | /** 31 | * Constructs a new {@code IllegalAccessError} that includes the current 32 | * stack trace. 33 | */ 34 | public IllegalAccessError() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code IllegalAccessError} with the current stack trace 40 | * and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this error. 44 | */ 45 | public IllegalAccessError(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/lang/IllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a method is invoked with an argument which it can not reasonably 22 | * deal with. 23 | */ 24 | public class IllegalArgumentException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = -5365630128856068164L; 27 | 28 | /** 29 | * Constructs a new {@code IllegalArgumentException} that includes the 30 | * current stack trace. 31 | */ 32 | public IllegalArgumentException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code IllegalArgumentException} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public IllegalArgumentException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | 47 | /** 48 | * Constructs a new {@code IllegalArgumentException} with the current stack 49 | * trace, the specified detail message and the specified cause. 50 | * 51 | * @param message 52 | * the detail message for this exception. 53 | * @param cause 54 | * the cause of this exception, may be {@code null}. 55 | * @since 1.5 56 | */ 57 | public IllegalArgumentException(String message, Throwable cause) { 58 | super(message, cause); 59 | } 60 | 61 | /** 62 | * Constructs a new {@code IllegalArgumentException} with the current stack 63 | * trace and the specified cause. 64 | * 65 | * @param cause 66 | * the cause of this exception, may be {@code null}. 67 | * @since 1.5 68 | */ 69 | public IllegalArgumentException(Throwable cause) { 70 | super((cause == null ? null : cause.toString()), cause); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/java/lang/IllegalMonitorStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a monitor operation is attempted when the monitor is not in the 22 | * correct state, for example when a thread attempts to exit a monitor which it 23 | * does not own. 24 | */ 25 | public class IllegalMonitorStateException extends RuntimeException { 26 | 27 | private static final long serialVersionUID = 3713306369498869069L; 28 | 29 | /** 30 | * Constructs a new {@code IllegalMonitorStateException} that includes the 31 | * current stack trace. 32 | */ 33 | public IllegalMonitorStateException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Constructs a new {@code IllegalArgumentException} with the current stack 39 | * trace and the specified detail message. 40 | * 41 | * @param detailMessage 42 | * the detail message for this exception. 43 | */ 44 | public IllegalMonitorStateException(String detailMessage) { 45 | super(detailMessage); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/java/lang/IllegalStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when an action is attempted at a time when the virtual machine is not 22 | * in the correct state. 23 | */ 24 | public class IllegalStateException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = -1848914673093119416L; 27 | 28 | /** 29 | * Constructs a new {@code IllegalStateException} that includes the current 30 | * stack trace. 31 | */ 32 | public IllegalStateException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code IllegalStateException} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public IllegalStateException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | 47 | /** 48 | * Constructs a new {@code IllegalStateException} with the current stack 49 | * trace, the specified detail message and the specified cause. 50 | * 51 | * @param message 52 | * the detail message for this exception. 53 | * @param cause 54 | * the cause of this exception. 55 | * @since 1.5 56 | */ 57 | public IllegalStateException(String message, Throwable cause) { 58 | super(message, cause); 59 | } 60 | 61 | /** 62 | * Constructs a new {@code IllegalStateException} with the current stack 63 | * trace and the specified cause. 64 | * 65 | * @param cause 66 | * the cause of this exception, may be {@code null}. 67 | * @since 1.5 68 | */ 69 | public IllegalStateException(Throwable cause) { 70 | super((cause == null ? null : cause.toString()), cause); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/java/lang/IncompatibleClassChangeError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * {@code IncompatibleClassChangeError} is the superclass of all classes which 23 | * represent errors that occur when inconsistent class files are loaded into 24 | * the same running image. 25 | * 26 | * @see Error 27 | */ 28 | public class IncompatibleClassChangeError extends LinkageError { 29 | 30 | private static final long serialVersionUID = -4914975503642802119L; 31 | 32 | /** 33 | * Constructs a new {@code IncompatibleClassChangeError} that includes the 34 | * current stack trace. 35 | */ 36 | public IncompatibleClassChangeError() { 37 | super(); 38 | } 39 | 40 | /** 41 | * Constructs a new {@code IncompatibleClassChangeError} with the current 42 | * stack trace and the specified detail message. 43 | * 44 | * @param detailMessage 45 | * the detail message for this error. 46 | */ 47 | public IncompatibleClassChangeError(String detailMessage) { 48 | super(detailMessage); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/java/lang/IndexOutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a program attempts to access a value in an indexable collection 22 | * using a value which is outside of the range of valid indices. 23 | */ 24 | public class IndexOutOfBoundsException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = 234122996006267687L; 27 | 28 | /** 29 | * Constructs a new {@code IndexOutOfBoundsException} that includes the 30 | * current stack trace. 31 | */ 32 | public IndexOutOfBoundsException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code IndexOutOfBoundsException} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public IndexOutOfBoundsException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/InstantiationError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that a program tries to create a new 22 | * instance of a class which has no visible constructors from the location where 23 | * {@code new} is invoked. 24 | *

25 | * Note that this can only occur when inconsistent class files are being loaded. 26 | */ 27 | public class InstantiationError extends IncompatibleClassChangeError { 28 | private static final long serialVersionUID = -4885810657349421204L; 29 | 30 | /** 31 | * Constructs a new {@code InstantiationError} that includes the current 32 | * stack trace. 33 | */ 34 | public InstantiationError() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code InstantiationError} with the current stack trace 40 | * and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this error. 44 | */ 45 | public InstantiationError(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | 49 | /** 50 | * Constructs a new {@code InstantiationError} with the current stack trace 51 | * and the class that caused this error. 52 | * 53 | * @param clazz 54 | * the class that can not be instantiated. 55 | */ 56 | InstantiationError(Class clazz) { 57 | super(clazz.getName()); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /lib/java/lang/InternalError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that it has gotten into an undefined 22 | * state. 23 | */ 24 | public class InternalError extends VirtualMachineError { 25 | 26 | private static final long serialVersionUID = -9062593416125562365L; 27 | 28 | /** 29 | * Constructs a new {@code InternalError} that includes the current stack 30 | * trace. 31 | */ 32 | public InternalError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code InternalError} with the current stack trace and 38 | * the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this error. 42 | */ 43 | public InternalError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/Iterable.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import java.util.Iterator; 20 | 21 | /** 22 | * Objects of classes that implement this interface can be used within a 23 | * {@code foreach} statement. 24 | * 25 | * @since 1.5 26 | */ 27 | public interface Iterable { 28 | 29 | /** 30 | * Returns an {@link Iterator} for the elements in this object. 31 | * 32 | * @return An {@code Iterator} instance. 33 | */ 34 | Iterator iterator(); 35 | } 36 | -------------------------------------------------------------------------------- /lib/java/lang/LinkageError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * {@code LinkageError} is the superclass of all error classes that occur when 23 | * loading and linking class files. 24 | * 25 | * @see Error 26 | */ 27 | public class LinkageError extends Error { 28 | 29 | private static final long serialVersionUID = 3579600108157160122L; 30 | 31 | /** 32 | * Constructs a new {@code LinkageError} that includes the current stack 33 | * trace. 34 | */ 35 | public LinkageError() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new {@code LinkageError} with the current stack trace and 41 | * the specified detail message. 42 | * 43 | * @param detailMessage 44 | * the detail message for this error. 45 | */ 46 | public LinkageError(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/java/lang/NegativeArraySizeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when an attempt is made to create an array with a size of less than 22 | * zero. 23 | */ 24 | public class NegativeArraySizeException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = -8960118058596991861L; 27 | 28 | /** 29 | * Constructs a new {@code NegativeArraySizeException} that includes the 30 | * current stack trace. 31 | */ 32 | public NegativeArraySizeException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code NegativeArraySizeException} with the current 38 | * stack trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public NegativeArraySizeException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/NoClassDefFoundError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine is unable to locate a class which it has been 22 | * asked to load. 23 | */ 24 | public class NoClassDefFoundError extends LinkageError { 25 | 26 | private static final long serialVersionUID = 9095859863287012458L; 27 | 28 | /** 29 | * Constructs a new {@code NoClassDefFoundError} that includes the current 30 | * stack trace. 31 | */ 32 | public NoClassDefFoundError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code NoClassDefFoundError} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this error. 42 | */ 43 | public NoClassDefFoundError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/NoSuchFieldError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that a program tries to reference, 22 | * on a class or object, a field that does not exist. 23 | *

24 | * Note that this can only occur when inconsistent class files are being loaded. 25 | */ 26 | public class NoSuchFieldError extends IncompatibleClassChangeError { 27 | 28 | private static final long serialVersionUID = -3456430195886129035L; 29 | 30 | /** 31 | * Constructs a new {@code NoSuchFieldError} that includes the current stack 32 | * trace. 33 | */ 34 | public NoSuchFieldError() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code NoSuchFieldError} with the current stack trace 40 | * and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this error. 44 | */ 45 | public NoSuchFieldError(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/lang/NoSuchMethodError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that a program tries to reference, 22 | * on a class or object, a method that does not exist. 23 | */ 24 | public class NoSuchMethodError extends IncompatibleClassChangeError { 25 | 26 | private static final long serialVersionUID = -3765521442372831335L; 27 | 28 | /** 29 | * Constructs a new {@code NoSuchMethodError} that includes the current 30 | * stack trace. 31 | */ 32 | public NoSuchMethodError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code NoSuchMethodError} with the current stack trace 38 | * and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public NoSuchMethodError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /lib/java/lang/NullPointerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a program tries to access a field or method of an object or an 22 | * element of an array when there is no instance or array to use, that is if the 23 | * object or array points to {@code null}. It also occurs in some other, less 24 | * obvious circumstances, like a {@code throw e} statement where the {@link 25 | * Throwable} reference is {@code null}. 26 | */ 27 | public class NullPointerException extends RuntimeException { 28 | 29 | private static final long serialVersionUID = 5162710183389028792L; 30 | 31 | /** 32 | * Constructs a new {@code NullPointerException} that includes the current 33 | * stack trace. 34 | */ 35 | public NullPointerException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new {@code NullPointerException} with the current stack 41 | * trace and the specified detail message. 42 | * 43 | * @param detailMessage 44 | * the detail message for this exception. 45 | */ 46 | public NullPointerException(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /lib/java/lang/Number.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * The abstract superclass of the classes which represent numeric base types 23 | * (that is {@link Byte}, {@link Short}, {@link Integer}, {@link Long}, 24 | * {@link Float}, and {@link Double}. 25 | */ 26 | public abstract class Number implements java.io.Serializable { 27 | 28 | private static final long serialVersionUID = -8742448824652078965L; 29 | 30 | /** 31 | * Empty default constructor. 32 | */ 33 | public Number() { 34 | } 35 | 36 | /** 37 | * Returns this object's value as a byte. Might involve rounding and/or 38 | * truncating the value, so it fits into a byte. 39 | * 40 | * @return the primitive byte value of this object. 41 | */ 42 | public byte byteValue() { 43 | return (byte) intValue(); 44 | } 45 | 46 | /** 47 | * Returns this object's value as a double. Might involve rounding. 48 | * 49 | * @return the primitive double value of this object. 50 | */ 51 | public abstract double doubleValue(); 52 | 53 | /** 54 | * Returns this object's value as a float. Might involve rounding. 55 | * 56 | * @return the primitive float value of this object. 57 | */ 58 | public abstract float floatValue(); 59 | 60 | /** 61 | * Returns this object's value as an int. Might involve rounding and/or 62 | * truncating the value, so it fits into an int. 63 | * 64 | * @return the primitive int value of this object. 65 | */ 66 | public abstract int intValue(); 67 | 68 | /** 69 | * Returns this object's value as a long. Might involve rounding and/or 70 | * truncating the value, so it fits into a long. 71 | * 72 | * @return the primitive long value of this object. 73 | */ 74 | public abstract long longValue(); 75 | 76 | /** 77 | * Returns this object's value as a short. Might involve rounding and/or 78 | * truncating the value, so it fits into a short. 79 | * 80 | * @return the primitive short value of this object. 81 | */ 82 | public short shortValue() { 83 | return (short) intValue(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/java/lang/NumberFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when an invalid value is passed to a string-to-number conversion 22 | * method. 23 | */ 24 | public class NumberFormatException extends java.lang.IllegalArgumentException { 25 | 26 | private static final long serialVersionUID = -2848938806368998894L; 27 | 28 | /** 29 | * Constructs a new {@code NumberFormatException} that includes the current 30 | * stack trace. 31 | */ 32 | public NumberFormatException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code NumberFormatException} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public NumberFormatException(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/Object.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | import java.io.IOException; 4 | 5 | public class Object 6 | { 7 | public native int hashCode(); 8 | 9 | public native Class getClass(); 10 | 11 | public native boolean equals(Object object); 12 | 13 | public String toString() 14 | { 15 | return "[" + hashCode() + "]"; 16 | } 17 | 18 | protected Object clone() throws CloneNotSupportedException 19 | { 20 | throw new CloneNotSupportedException(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/java/lang/OutOfMemoryError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when a request for memory is made that can not be satisfied using the 22 | * available platform resources. Such a request may be made by both the running 23 | * application or by an internal function of the virtual machine. 24 | */ 25 | public class OutOfMemoryError extends java.lang.VirtualMachineError { 26 | 27 | private static final long serialVersionUID = 8228564086184010517L; 28 | 29 | /** 30 | * Constructs a new {@code OutOfMemoryError} that includes the current stack 31 | * trace. 32 | */ 33 | public OutOfMemoryError() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Constructs a new {@code OutOfMemoryError} with the current stack trace 39 | * and the specified detail message. 40 | * 41 | * @param detailMessage 42 | * the detail message for this error. 43 | */ 44 | public OutOfMemoryError(String detailMessage) { 45 | super(detailMessage); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/java/lang/Override.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Annotation type used to mark methods that override a method declaration in a 26 | * superclass. Compilers produce an error if a method annotated with @Override 27 | * does not actually override a method in a superclass. 28 | * 29 | * @since 1.5 30 | */ 31 | @Target(ElementType.METHOD) 32 | @Retention(RetentionPolicy.SOURCE) 33 | public @interface Override { 34 | } 35 | -------------------------------------------------------------------------------- /lib/java/lang/Readable.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import java.io.IOException; 20 | import java.nio.CharBuffer; 21 | 22 | /** 23 | * Represents a sequence of characters that can be incrementally read (copied) 24 | * into a {@link CharBuffer}. 25 | */ 26 | public interface Readable { 27 | 28 | /** 29 | * Reads characters into the specified {@code CharBuffer}. The maximum 30 | * number of characters read is {@code CharBuffer.remaining()}. 31 | * 32 | * @param cb 33 | * the buffer to be filled with characters read. 34 | * @return the number of characters actually read, or -1 if this 35 | * {@code Readable} reaches its end 36 | * @throws IOException 37 | * if an I/O error occurs. 38 | */ 39 | int read(CharBuffer cb) throws IOException; 40 | } 41 | -------------------------------------------------------------------------------- /lib/java/lang/RuntimeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * {@code RuntimeException} is the superclass of all classes that represent 22 | * exceptional conditions which occur as a result of executing an application in 23 | * the virtual machine. Unlike checked exceptions (exceptions where the type 24 | * doesn't extend {@code RuntimeException} or {@link Error}), the compiler does 25 | * not require code to handle runtime exceptions. 26 | */ 27 | public class RuntimeException extends Exception { 28 | 29 | private static final long serialVersionUID = -7034897190745766939L; 30 | 31 | /** 32 | * Constructs a new {@code RuntimeException} that includes the current stack 33 | * trace. 34 | */ 35 | public RuntimeException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new {@code RuntimeException} with the current stack trace 41 | * and the specified detail message. 42 | * 43 | * @param detailMessage 44 | * the detail message for this exception. 45 | */ 46 | public RuntimeException(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | 50 | /** 51 | * Constructs a new {@code RuntimeException} with the current stack trace, 52 | * the specified detail message and the specified cause. 53 | * 54 | * @param detailMessage 55 | * the detail message for this exception. 56 | * @param throwable 57 | * the cause of this exception. 58 | */ 59 | public RuntimeException(String detailMessage, Throwable throwable) { 60 | super(detailMessage, throwable); 61 | } 62 | 63 | /** 64 | * Constructs a new {@code RuntimeException} with the current stack trace 65 | * and the specified cause. 66 | * 67 | * @param throwable 68 | * the cause of this exception. 69 | */ 70 | public RuntimeException(Throwable throwable) { 71 | super(throwable); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/java/lang/StackOverflowError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the depth of the callstack of the running program excedes some 22 | * platform or virtual machine specific limit. Typically, this will occur only 23 | * when a program becomes infinitely recursive, but it can also occur in 24 | * correctly written (but deeply recursive) programs. 25 | */ 26 | public class StackOverflowError extends java.lang.VirtualMachineError { 27 | 28 | private static final long serialVersionUID = 8609175038441759607L; 29 | 30 | /** 31 | * Constructs a new {@code StackOverflowError} that includes the current 32 | * stack trace. 33 | */ 34 | public StackOverflowError() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructs a new {@code StackOverflowError} with the current stack trace 40 | * and the specified detail message. 41 | * 42 | * @param detailMessage 43 | * the detail message for this exception. 44 | */ 45 | public StackOverflowError(String detailMessage) { 46 | super(detailMessage); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/java/lang/StringIndexOutOfBoundsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | import org.apache.harmony.luni.internal.nls.Messages; 22 | 23 | /** 24 | * Thrown when the a string is indexed with a value less than zero, or greater 25 | * than or equal to the size of the array. 26 | */ 27 | public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException { 28 | 29 | private static final long serialVersionUID = -6762910422159637258L; 30 | 31 | /** 32 | * Constructs a new {@code StringIndexOutOfBoundsException} that includes 33 | * the current stack trace. 34 | */ 35 | public StringIndexOutOfBoundsException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new {@code StringIndexOutOfBoundsException} with the current 41 | * stack trace and a detail message that is based on the specified invalid 42 | * {@code index}. 43 | * 44 | * @param index 45 | * the index which is out of bounds. 46 | */ 47 | public StringIndexOutOfBoundsException(int index) { 48 | super(Messages.getString("luni.55", index)); //$NON-NLS-1$ 49 | } 50 | 51 | /** 52 | * Constructs a new {@code StringIndexOutOfBoundsException} with the current 53 | * stack trace and the specified detail message. 54 | * 55 | * @param detailMessage 56 | * the detail message for this exception. 57 | */ 58 | public StringIndexOutOfBoundsException(String detailMessage) { 59 | super(detailMessage); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/java/lang/SuppressWarnings.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.lang; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Annotation type used to indicate that the compiler should not issue the 26 | * specified warnings for the marked program element. Warnings are not only 27 | * suppressed for the annotated element but also for all program elements 28 | * contained in that element. 29 | *

30 | * It is recommended that programmers always use this annotation on the most 31 | * deeply nested element where it is actually needed. 32 | * 33 | * @since 1.5 34 | */ 35 | @Target( { ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, 36 | ElementType.PARAMETER, ElementType.CONSTRUCTOR, 37 | ElementType.LOCAL_VARIABLE }) 38 | @Retention(RetentionPolicy.SOURCE) 39 | public @interface SuppressWarnings { 40 | 41 | /** 42 | * The list of warnings a compiler should not issue. 43 | */ 44 | public String[] value(); 45 | } 46 | -------------------------------------------------------------------------------- /lib/java/lang/System.java: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | import java.io.FileDescriptor; 4 | import java.io.FileOutputStream; 5 | import java.io.PrintStream; 6 | 7 | public class System 8 | { 9 | public static PrintStream out = new PrintStream(new FileOutputStream(FileDescriptor.out)); 10 | public static PrintStream err = new PrintStream(new FileOutputStream(FileDescriptor.err)); 11 | 12 | public static String getProperty(String key) 13 | { 14 | return ""; 15 | } 16 | 17 | public static String getProperty(String key, String defaultValue) 18 | { 19 | return defaultValue; 20 | } 21 | 22 | /** 23 | * Copies the number of {@code length} elements of the Array {@code src} 24 | * starting at the offset {@code srcPos} into the Array {@code dest} at 25 | * the position {@code destPos}. 26 | * 27 | * @param src 28 | * the source array to copy the content. 29 | * @param srcPos 30 | * the starting index of the content in {@code src}. 31 | * @param dest 32 | * the destination array to copy the data into. 33 | * @param destPos 34 | * the starting index for the copied content in {@code dest}. 35 | * @param length 36 | * the number of elements of the {@code array1} content they have 37 | * to be copied. 38 | */ 39 | public static void arraycopy(Object src, int srcPos, Object dest, int destPos, 40 | int length) { 41 | // sending getClass() to both arguments will check for null 42 | Class type1 = src.getClass(); 43 | Class type2 = dest.getClass(); 44 | if (!type1.isArray() || !type2.isArray()) { 45 | throw new ArrayStoreException(); 46 | } 47 | Class componentType1 = type1.getComponentType(); 48 | Class componentType2 = type2.getComponentType(); 49 | if (!componentType1.isPrimitive()) { 50 | if (componentType2.isPrimitive()) { 51 | throw new ArrayStoreException(); 52 | } 53 | } else { 54 | if (componentType2 != componentType1) { 55 | throw new ArrayStoreException(); 56 | } 57 | } 58 | arraycopyImpl(src, srcPos, dest, destPos, length); 59 | } 60 | 61 | public static native void arraycopyImpl(Object src, int srcPos, Object dest, int destPos, 62 | int length); 63 | 64 | public static native long currentTimeMillis(); 65 | 66 | public static native void gc(); 67 | 68 | public static native void log(String s); 69 | } 70 | -------------------------------------------------------------------------------- /lib/java/lang/ThreadDeath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * ThreadDeath is thrown when a thread stops executing. It is used to aid in the 22 | * orderly unrolling of the thread's stack (eg. cleanup of monitors). 23 | */ 24 | public class ThreadDeath extends Error { 25 | 26 | private static final long serialVersionUID = -4417128565033088268L; 27 | 28 | /** 29 | * Constructs a new instance of this class. Note that in the case of 30 | * ThreadDeath, the stacktrace may not be filled in a way which 31 | * allows a stack trace to be printed. 32 | */ 33 | public ThreadDeath() { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/java/lang/UnknownError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine must throw an error which does not match any 22 | * known exceptional condition. 23 | */ 24 | public class UnknownError extends VirtualMachineError { 25 | 26 | private static final long serialVersionUID = 2524784860676771849L; 27 | 28 | /** 29 | * Constructs a new {@code UnknownError} that includes the current stack 30 | * trace. 31 | */ 32 | public UnknownError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code UnknownError} with the current stack trace and 38 | * the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public UnknownError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/UnsatisfiedLinkError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when an attempt is made to invoke a native for which an implementation 22 | * could not be found. 23 | */ 24 | public class UnsatisfiedLinkError extends LinkageError { 25 | 26 | private static final long serialVersionUID = -4019343241616879428L; 27 | 28 | /** 29 | * Constructs a new {@code UnsatisfiedLinkError} that includes the current 30 | * stack trace. 31 | */ 32 | public UnsatisfiedLinkError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code UnsatisfiedLinkError} with the current stack 38 | * trace and the specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public UnsatisfiedLinkError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/UnsupportedOperationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when an unsupported operation is attempted. 22 | */ 23 | public class UnsupportedOperationException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -1242599979055084673L; 26 | 27 | /** 28 | * Constructs a new {@code UnsupportedOperationException} that includes the 29 | * current stack trace. 30 | */ 31 | public UnsupportedOperationException() { 32 | } 33 | 34 | /** 35 | * Constructs a new {@code UnsupportedOperationException} with the current 36 | * stack trace and the specified detail message. 37 | * 38 | * @param detailMessage 39 | * the detail message for this exception. 40 | */ 41 | public UnsupportedOperationException(String detailMessage) { 42 | super(detailMessage); 43 | } 44 | 45 | /** 46 | * Constructs a new {@code UnsupportedOperationException} with the current 47 | * stack trace, the specified detail message and the specified cause. 48 | * 49 | * @param message 50 | * the detail message for this exception. 51 | * @param cause 52 | * the optional cause of this exception, may be {@code null}. 53 | * @since 1.5 54 | */ 55 | public UnsupportedOperationException(String message, Throwable cause) { 56 | super(message, cause); 57 | } 58 | 59 | /** 60 | * Constructs a new {@code UnsupportedOperationException} with the current 61 | * stack trace and the specified cause. 62 | * 63 | * @param cause 64 | * the optional cause of this exception, may be {@code null}. 65 | * @since 1.5 66 | */ 67 | public UnsupportedOperationException(Throwable cause) { 68 | super((cause == null ? null : cause.toString()), cause); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/java/lang/VerifyError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | /** 21 | * Thrown when the virtual machine notices that an attempt is made to load a 22 | * class which does not pass the class verification phase. 23 | */ 24 | public class VerifyError extends LinkageError { 25 | 26 | private static final long serialVersionUID = 7001962396098498785L; 27 | 28 | /** 29 | * Constructs a new {@code VerifyError} that includes the current stack 30 | * trace. 31 | */ 32 | public VerifyError() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs a new {@code VerifyError} with the current stack trace and the 38 | * specified detail message. 39 | * 40 | * @param detailMessage 41 | * the detail message for this exception. 42 | */ 43 | public VerifyError(String detailMessage) { 44 | super(detailMessage); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/java/lang/VirtualMachineError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.lang; 19 | 20 | 21 | /** 22 | * {@code VirtualMachineError} is the superclass of all error classes that occur 23 | * during the operation of the virtual machine. 24 | * 25 | * @see Error 26 | */ 27 | public abstract class VirtualMachineError extends Error { 28 | 29 | private static final long serialVersionUID = 4161983926571568670L; 30 | 31 | /** 32 | * Constructs a new {@code VirtualMachineError} that includes the current 33 | * stack trace. 34 | */ 35 | public VirtualMachineError() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new {@code VirtualMachineError} with the current stack trace 41 | * and the specified detail message. 42 | * 43 | * @param detailMessage 44 | * the detail message for this exception. 45 | */ 46 | public VirtualMachineError(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/java/lang/Void.java: -------------------------------------------------------------------------------- 1 | /* Luje 2 | * © 2013 David Given 3 | * This file is redistributable under the terms of the 4 | * New BSD License. Please see the COPYING file in the 5 | * project root for the full text. 6 | */ 7 | 8 | package java.lang; 9 | 10 | public class Void 11 | { 12 | public static Class TYPE; 13 | 14 | private static native Class getVoidClass(); 15 | 16 | static 17 | { 18 | TYPE = getVoidClass(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/AnnotationFormatError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Indicates that an annotation in the binary representation of a class is 22 | * syntactically incorrect and the annotation parser is unable to process it. 23 | * This exception is unlikely to ever occur, given that the code has been 24 | * compiled by an ordinary Java compiler. 25 | * 26 | * @since 1.5 27 | */ 28 | public class AnnotationFormatError extends Error { 29 | 30 | private static final long serialVersionUID = -4256701562333669892L; 31 | 32 | /** 33 | * Constructs an instance with the message provided. 34 | * 35 | * @param message 36 | * the details of the error. 37 | */ 38 | public AnnotationFormatError(String message) { 39 | super(message); 40 | } 41 | 42 | /** 43 | * Constructs an instance with a message and a cause. 44 | * 45 | * @param message 46 | * the details of the error. 47 | * @param cause 48 | * the cause of the error or {@code null} if none. 49 | */ 50 | public AnnotationFormatError(String message, Throwable cause) { 51 | super(message, cause); 52 | } 53 | 54 | /** 55 | * Constructs an instance with a cause. If the cause is not 56 | * {@code null}, then {@code cause.toString()} is used as the 57 | * error's message. 58 | * 59 | * @param cause 60 | * the cause of the error or {@code null} if none. 61 | */ 62 | public AnnotationFormatError(Throwable cause) { 63 | super(cause == null ? null : cause.toString(), cause); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/Documented.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines a meta-annotation for indicating that an annotation is documented and 22 | * considered part of the public API. 23 | * 24 | * @since 1.5 25 | */ 26 | @Documented 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.ANNOTATION_TYPE) 29 | public @interface Documented { 30 | } 31 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/ElementType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines an enumeration for Java program elements. It is used in conjunction 22 | * with the {@link Target} meta-annotation to restrict the use of an annotation 23 | * to certain program elements. 24 | * 25 | * @since 1.5 26 | */ 27 | public enum ElementType { 28 | /** 29 | * Class, interface or enum declaration. 30 | */ 31 | TYPE, 32 | /** 33 | * Field declaration. 34 | */ 35 | FIELD, 36 | /** 37 | * Method declaration. 38 | */ 39 | METHOD, 40 | /** 41 | * Parameter declaration. 42 | */ 43 | PARAMETER, 44 | /** 45 | * Constructor declaration. 46 | */ 47 | CONSTRUCTOR, 48 | /** 49 | * Local variable declaration. 50 | */ 51 | LOCAL_VARIABLE, 52 | /** 53 | * Annotation type declaration. 54 | */ 55 | ANNOTATION_TYPE, 56 | /** 57 | * Package declaration. 58 | */ 59 | PACKAGE 60 | } 61 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/IncompleteAnnotationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | import org.apache.harmony.annotation.internal.nls.Messages; 21 | 22 | /** 23 | * Indicates that an element of an annotation type was accessed that was added 24 | * after the type was compiled or serialized. This does not apply to new 25 | * elements that have default values. 26 | * 27 | * @since 1.5 28 | */ 29 | public class IncompleteAnnotationException extends RuntimeException { 30 | 31 | private static final long serialVersionUID = 8445097402741811912L; 32 | 33 | private Class annotationType; 34 | 35 | private String elementName; 36 | 37 | /** 38 | * Constructs an instance with the incomplete annotation type and the name 39 | * of the element that's missing. 40 | * 41 | * @param annotationType 42 | * the annotation type. 43 | * @param elementName 44 | * the name of the incomplete element. 45 | */ 46 | public IncompleteAnnotationException( 47 | Class annotationType, String elementName) { 48 | super(Messages.getString("annotation.0", elementName, annotationType.getName())); //$NON-NLS-1$ 49 | this.annotationType = annotationType; 50 | this.elementName = elementName; 51 | } 52 | 53 | /** 54 | * Returns the annotation type. 55 | * 56 | * @return a Class instance. 57 | */ 58 | public Class annotationType() { 59 | return annotationType; 60 | } 61 | 62 | /** 63 | * Returns the incomplete element's name. 64 | * 65 | * @return the name of the element. 66 | */ 67 | public String elementName() { 68 | return elementName; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/Inherited.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines a meta-annotation for indicating that an annotation is automatically 22 | * inherited. 23 | * 24 | * @since 1.5 25 | */ 26 | @Documented 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.ANNOTATION_TYPE) 29 | public @interface Inherited { 30 | } 31 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/Retention.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines a meta-annotation for determining the scope of retention for an 22 | * annotation. If the retention annotation is not set {@code 23 | * RetentionPolicy.CLASS} is used as default retention. 24 | * 25 | * @see RetentionPolicy 26 | * @since 1.5 27 | */ 28 | @Documented 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.ANNOTATION_TYPE) 31 | public @interface Retention { 32 | 33 | /** 34 | * Returns the retention policy for the annotation. 35 | * 36 | * @return a retention policy as defined in {@code RetentionPolicy} 37 | */ 38 | RetentionPolicy value(); 39 | } 40 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/RetentionPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines an enumeration for annotation retention policies. Used in conjunction 22 | * with the {@link Retention} annotation to specify an annotation's time-to-live 23 | * in the overall development life cycle. 24 | * 25 | * @since 1.5 26 | */ 27 | public enum RetentionPolicy { 28 | /** 29 | * Annotation is only available in the source code. 30 | */ 31 | SOURCE, 32 | /** 33 | * Annotation is available in the source code and in the class file, but not 34 | * at runtime. This is the default policy. 35 | */ 36 | CLASS, 37 | /** 38 | * Annotation is available in the source code, the class file and is 39 | * available at runtime. 40 | */ 41 | RUNTIME 42 | } 43 | -------------------------------------------------------------------------------- /lib/java/lang/annotation/Target.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with this 4 | * work for additional information regarding copyright ownership. The ASF 5 | * licenses this file to you under the Apache License, Version 2.0 (the 6 | * "License"); you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations under 15 | * the License. 16 | */ 17 | 18 | package java.lang.annotation; 19 | 20 | /** 21 | * Defines a meta-annotation for determining what {@link ElementType}s an 22 | * annotation can be applied to. 23 | * 24 | * @see ElementType 25 | * @since 1.5 26 | */ 27 | @Documented 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.ANNOTATION_TYPE) 30 | public @interface Target { 31 | 32 | /** 33 | * Returns the program element types for which this annotation is applied. 34 | * 35 | * @return the types of element as defined by {@code ElementType} 36 | */ 37 | ElementType[] value(); 38 | } 39 | -------------------------------------------------------------------------------- /lib/java/lang/reflect/Array.java: -------------------------------------------------------------------------------- 1 | package java.lang.reflect; 2 | 3 | public class Array 4 | { 5 | public static native Object newInstance(Class componentType, int size); 6 | } 7 | -------------------------------------------------------------------------------- /lib/java/net/MalformedURLException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.net; 19 | 20 | import java.io.IOException; 21 | 22 | /** 23 | * This exception is thrown when a program attempts to create an URL from an 24 | * incorrect specification. 25 | * 26 | * @see URL 27 | */ 28 | public class MalformedURLException extends IOException { 29 | 30 | private static final long serialVersionUID = -182787522200415866L; 31 | 32 | /** 33 | * Constructs a new instance of this class with its walkback filled in. 34 | */ 35 | public MalformedURLException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * Constructs a new instance of this class with its walkback and message 41 | * filled in. 42 | * 43 | * @param detailMessage 44 | * the detail message for this exception instance. 45 | */ 46 | public MalformedURLException(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/java/nio/BufferOverflowException.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio; 18 | 19 | /** 20 | * A BufferOverflowException is thrown when elements are written 21 | * to a buffer but there is not enough remaining space in the buffer. 22 | */ 23 | public class BufferOverflowException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -5484897634319144535L; 26 | 27 | /** 28 | * Constructs a BufferOverflowException. 29 | */ 30 | public BufferOverflowException() { 31 | super(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/nio/BufferUnderflowException.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio; 18 | 19 | /** 20 | * A BufferUnderflowException is thrown when elements are read 21 | * from a buffer but there are not enough remaining elements in the buffer. 22 | */ 23 | public class BufferUnderflowException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -1713313658691622206L; 26 | 27 | /** 28 | * Constructs a BufferUnderflowException. 29 | */ 30 | public BufferUnderflowException() { 31 | super(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/nio/ByteOrder.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio; 18 | 19 | import org.apache.harmony.luni.platform.Platform; 20 | 21 | /** 22 | * Defines byte order constants. 23 | */ 24 | public final class ByteOrder { 25 | 26 | /** 27 | * This constant represents big endian. 28 | */ 29 | public static final ByteOrder BIG_ENDIAN = new ByteOrder("BIG_ENDIAN"); //$NON-NLS-1$ 30 | 31 | /** 32 | * This constant represents little endian. 33 | */ 34 | public static final ByteOrder LITTLE_ENDIAN = new ByteOrder("LITTLE_ENDIAN"); //$NON-NLS-1$ 35 | 36 | private static final ByteOrder NATIVE_ORDER; 37 | 38 | static { 39 | if (Platform.getMemorySystem().isLittleEndian()) { 40 | NATIVE_ORDER = LITTLE_ENDIAN; 41 | } else { 42 | NATIVE_ORDER = BIG_ENDIAN; 43 | } 44 | } 45 | 46 | /** 47 | * Returns the current platform byte order. 48 | * 49 | * @return the byte order object, which is either LITTLE_ENDIAN or 50 | * BIG_ENDIAN. 51 | */ 52 | public static ByteOrder nativeOrder() { 53 | return NATIVE_ORDER; 54 | } 55 | 56 | private final String name; 57 | 58 | private ByteOrder(String name) { 59 | super(); 60 | this.name = name; 61 | } 62 | 63 | /** 64 | * Returns a string that describes this object. 65 | * 66 | * @return "BIG_ENDIAN" for {@link #BIG_ENDIAN ByteOrder.BIG_ENDIAN} 67 | * objects, "LITTLE_ENDIAN" for 68 | * {@link #LITTLE_ENDIAN ByteOrder.LITTLE_ENDIAN} objects. 69 | */ 70 | @Override 71 | public String toString() { 72 | return name; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/java/nio/IntArrayBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio; 19 | 20 | /** 21 | * IntArrayBuffer, ReadWriteIntArrayBuffer and ReadOnlyIntArrayBuffer compose 22 | * the implementation of array based int buffers. 23 | *

24 | * IntArrayBuffer implements all the shared readonly methods and is extended by 25 | * the other two classes. 26 | *

27 | *

28 | * All methods are marked final for runtime performance. 29 | *

30 | * 31 | */ 32 | abstract class IntArrayBuffer extends IntBuffer { 33 | 34 | protected final int[] backingArray; 35 | 36 | protected final int offset; 37 | 38 | IntArrayBuffer(int[] array) { 39 | this(array.length, array, 0); 40 | } 41 | 42 | IntArrayBuffer(int capacity) { 43 | this(capacity, new int[capacity], 0); 44 | } 45 | 46 | IntArrayBuffer(int capacity, int[] backingArray, int offset) { 47 | super(capacity); 48 | this.backingArray = backingArray; 49 | this.offset = offset; 50 | } 51 | 52 | @Override 53 | public final int get() { 54 | if (position == limit) { 55 | throw new BufferUnderflowException(); 56 | } 57 | return backingArray[offset + position++]; 58 | } 59 | 60 | @Override 61 | public final int get(int index) { 62 | if (index < 0 || index >= limit) { 63 | throw new IndexOutOfBoundsException(); 64 | } 65 | return backingArray[offset + index]; 66 | } 67 | 68 | @Override 69 | public final IntBuffer get(int[] dest, int off, int len) { 70 | int length = dest.length; 71 | if (off < 0 || len < 0 || (long) len + (long) off > length) { 72 | throw new IndexOutOfBoundsException(); 73 | } 74 | if (len > remaining()) { 75 | throw new BufferUnderflowException(); 76 | } 77 | System.arraycopy(backingArray, offset + position, dest, off, len); 78 | position += len; 79 | return this; 80 | } 81 | 82 | @Override 83 | public final boolean isDirect() { 84 | return false; 85 | } 86 | 87 | @Override 88 | public final ByteOrder order() { 89 | return ByteOrder.nativeOrder(); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /lib/java/nio/InvalidMarkException.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio; 18 | 19 | /** 20 | * An {@code InvalidMarkException} is thrown when {@code reset()} is called on a 21 | * buffer, but no mark has been set previously. 22 | */ 23 | public class InvalidMarkException extends IllegalStateException { 24 | 25 | private static final long serialVersionUID = 1698329710438510774L; 26 | 27 | /** 28 | * Constructs an {@code InvalidMarkException}. 29 | */ 30 | public InvalidMarkException() { 31 | super(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/nio/LongArrayBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio; 19 | 20 | /** 21 | * LongArrayBuffer, ReadWriteLongArrayBuffer and ReadOnlyLongArrayBuffer compose 22 | * the implementation of array based long buffers. 23 | *

24 | * LongArrayBuffer implements all the shared readonly methods and is extended by 25 | * the other two classes. 26 | *

27 | *

28 | * All methods are marked final for runtime performance. 29 | *

30 | * 31 | */ 32 | abstract class LongArrayBuffer extends LongBuffer { 33 | 34 | protected final long[] backingArray; 35 | 36 | protected final int offset; 37 | 38 | LongArrayBuffer(long[] array) { 39 | this(array.length, array, 0); 40 | } 41 | 42 | LongArrayBuffer(int capacity) { 43 | this(capacity, new long[capacity], 0); 44 | } 45 | 46 | LongArrayBuffer(int capacity, long[] backingArray, int offset) { 47 | super(capacity); 48 | this.backingArray = backingArray; 49 | this.offset = offset; 50 | } 51 | 52 | @Override 53 | public final long get() { 54 | if (position == limit) { 55 | throw new BufferUnderflowException(); 56 | } 57 | return backingArray[offset + position++]; 58 | } 59 | 60 | @Override 61 | public final long get(int index) { 62 | if (index < 0 || index >= limit) { 63 | throw new IndexOutOfBoundsException(); 64 | } 65 | return backingArray[offset + index]; 66 | } 67 | 68 | @Override 69 | public final LongBuffer get(long[] dest, int off, int len) { 70 | int length = dest.length; 71 | if (off < 0 || len < 0 || (long) len + (long) off > length) { 72 | throw new IndexOutOfBoundsException(); 73 | } 74 | if (len > remaining()) { 75 | throw new BufferUnderflowException(); 76 | } 77 | System.arraycopy(backingArray, offset + position, dest, off, len); 78 | position += len; 79 | return this; 80 | } 81 | 82 | @Override 83 | public final boolean isDirect() { 84 | return false; 85 | } 86 | 87 | @Override 88 | public final ByteOrder order() { 89 | return ByteOrder.nativeOrder(); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /lib/java/nio/ReadOnlyBufferException.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio; 18 | 19 | /** 20 | * A {@code ReadOnlyBufferException} is thrown when some write operation is 21 | * called on a read-only buffer. 22 | */ 23 | public class ReadOnlyBufferException extends UnsupportedOperationException { 24 | 25 | private static final long serialVersionUID = -1210063976496234090L; 26 | 27 | /** 28 | * Constructs a {@code ReadOnlyBufferException}. 29 | */ 30 | public ReadOnlyBufferException() { 31 | super(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/java/nio/charset/CharacterCodingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | import java.io.IOException; 21 | 22 | /** 23 | * A {@code CharacterCodingException} is thrown when an encoding or decoding 24 | * error occurs. 25 | */ 26 | public class CharacterCodingException extends IOException { 27 | 28 | /* 29 | * This constant is used during deserialization to check the version 30 | * which created the serialized object. 31 | */ 32 | private static final long serialVersionUID = 8421532232154627783L; 33 | 34 | /** 35 | * Constructs a new {@code CharacterCodingException}. 36 | */ 37 | public CharacterCodingException() { 38 | super(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/java/nio/charset/CoderMalfunctionError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | /** 21 | * A {@code CoderMalfunctionError} is thrown when the encoder/decoder is 22 | * malfunctioning. 23 | */ 24 | public class CoderMalfunctionError extends Error { 25 | 26 | /* 27 | * This constant is used during deserialization to check the version 28 | * which created the serialized object. 29 | */ 30 | private static final long serialVersionUID = -1151412348057794301L; 31 | 32 | /** 33 | * Constructs a new {@code CoderMalfunctionError}. 34 | * 35 | * @param ex 36 | * the original exception thrown by the encoder/decoder. 37 | */ 38 | public CoderMalfunctionError(Exception ex) { 39 | super(ex); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/java/nio/charset/CodingErrorAction.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package java.nio.charset; 18 | 19 | /** 20 | * Used to indicate what kind of actions to take in case of encoding/decoding 21 | * errors. Currently three actions are defined: {@code IGNORE}, {@code REPLACE} 22 | * and {@code REPORT}. 23 | */ 24 | public class CodingErrorAction { 25 | 26 | /** 27 | * Denotes the action to ignore any errors. 28 | */ 29 | public static final CodingErrorAction IGNORE = new CodingErrorAction( 30 | "IGNORE"); //$NON-NLS-1$ 31 | 32 | /** 33 | * Denotes the action to fill in the output with a replacement character 34 | * when malformed input or an unmappable character is encountered. 35 | */ 36 | public static final CodingErrorAction REPLACE = new CodingErrorAction( 37 | "REPLACE"); //$NON-NLS-1$ 38 | 39 | /** 40 | * Denotes the action to report the encountered error in an appropriate 41 | * manner, for example to throw an exception or return an informative 42 | * result. 43 | */ 44 | public static final CodingErrorAction REPORT = new CodingErrorAction( 45 | "REPORT"); //$NON-NLS-1$ 46 | 47 | // The name of this action 48 | private String action; 49 | 50 | /* 51 | * Can't instantiate outside. 52 | */ 53 | private CodingErrorAction(String action) { 54 | this.action = action; 55 | } 56 | 57 | /** 58 | * Returns a text description of this action indication. 59 | * 60 | * @return a text description of this action indication. 61 | */ 62 | @Override 63 | public String toString() { 64 | return "Action: " + this.action; //$NON-NLS-1$ 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/java/nio/charset/IllegalCharsetNameException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | import org.apache.harmony.niochar.internal.nls.Messages; 21 | 22 | /** 23 | * An {@code IllegalCharsetNameException} is thrown when an illegal charset name 24 | * is encountered. 25 | */ 26 | public class IllegalCharsetNameException extends IllegalArgumentException { 27 | 28 | /* 29 | * This constant is used during deserialization to check the version 30 | * which created the serialized object. 31 | */ 32 | private static final long serialVersionUID = 1457525358470002989L; 33 | 34 | // The illegal charset name 35 | private String charsetName; 36 | 37 | /** 38 | * Constructs a new {@code IllegalCharsetNameException} with the supplied 39 | * charset name. 40 | * 41 | * @param charset 42 | * the encountered illegal charset name. 43 | */ 44 | public IllegalCharsetNameException(String charset) { 45 | // niochar.0F=The illegal charset name is "{0}". 46 | super(Messages.getString("niochar.0F", charset)); //$NON-NLS-1$ 47 | this.charsetName = charset; 48 | } 49 | 50 | /** 51 | * Gets the encountered illegal charset name. 52 | * 53 | * @return the encountered illegal charset name. 54 | */ 55 | public String getCharsetName() { 56 | return this.charsetName; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/java/nio/charset/MalformedInputException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | import org.apache.harmony.niochar.internal.nls.Messages; 21 | 22 | /** 23 | * A {@code MalformedInputException} is thrown when a malformed input is 24 | * encountered, for example if a byte sequence is illegal for the given charset. 25 | */ 26 | public class MalformedInputException extends CharacterCodingException { 27 | 28 | /* 29 | * This constant is used during deserialization to check the version 30 | * which created the serialized object. 31 | */ 32 | private static final long serialVersionUID = -3438823399834806194L; 33 | 34 | // the length of the malformed input 35 | private int inputLength; 36 | 37 | /** 38 | * Constructs a new {@code MalformedInputException}. 39 | * 40 | * @param length 41 | * the length of the malformed input. 42 | */ 43 | public MalformedInputException(int length) { 44 | this.inputLength = length; 45 | } 46 | 47 | /** 48 | * Gets the length of the malformed input. 49 | * 50 | * @return the length of the malformed input. 51 | */ 52 | public int getInputLength() { 53 | return this.inputLength; 54 | } 55 | 56 | /** 57 | * Gets a message describing this exception. 58 | * 59 | * @return a message describing this exception. 60 | */ 61 | @Override 62 | public String getMessage() { 63 | // niochar.05=Malformed input length is {0}. 64 | return Messages.getString("niochar.05", this.inputLength); //$NON-NLS-1$ 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/java/nio/charset/UnmappableCharacterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | import org.apache.harmony.niochar.internal.nls.Messages; 21 | 22 | /** 23 | * An {@code UnmappableCharacterException} is thrown when an unmappable 24 | * character for the given charset is encountered. 25 | */ 26 | public class UnmappableCharacterException extends CharacterCodingException { 27 | 28 | /* 29 | * This constant is used during deserialization to check the version 30 | * which created the serialized object. 31 | */ 32 | private static final long serialVersionUID = -7026962371537706123L; 33 | 34 | // The length of the unmappable character 35 | private int inputLength; 36 | 37 | /** 38 | * Constructs a new {@code UnmappableCharacterException}. 39 | * 40 | * @param length 41 | * the length of the unmappable character. 42 | */ 43 | public UnmappableCharacterException(int length) { 44 | this.inputLength = length; 45 | } 46 | 47 | /** 48 | * Gets the length of the unmappable character. 49 | * 50 | * @return the length of the unmappable character. 51 | */ 52 | public int getInputLength() { 53 | return this.inputLength; 54 | } 55 | 56 | /** 57 | * Gets a message describing this exception. 58 | * 59 | * @return a message describing this exception. 60 | */ 61 | @Override 62 | public String getMessage() { 63 | // niochar.0A=The unmappable character length is {0}. 64 | return Messages.getString("niochar.0A", this.inputLength); //$NON-NLS-1$ 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/java/nio/charset/UnsupportedCharsetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.nio.charset; 19 | 20 | import org.apache.harmony.niochar.internal.nls.Messages; 21 | 22 | /** 23 | * An {@code UnsupportedCharsetException} is thrown when an unsupported charset 24 | * name is encountered. 25 | */ 26 | public class UnsupportedCharsetException extends IllegalArgumentException { 27 | 28 | /* 29 | * This constant is used during deserialization to check the version 30 | * which created the serialized object. 31 | */ 32 | private static final long serialVersionUID = 1490765524727386367L; 33 | 34 | // the unsupported charset name 35 | private String charsetName; 36 | 37 | /** 38 | * Constructs a new {@code UnsupportedCharsetException} with the supplied 39 | * charset name. 40 | * 41 | * @param charset 42 | * the encountered unsupported charset name. 43 | */ 44 | public UnsupportedCharsetException(String charset) { 45 | // niochar.04=The unsupported charset name is "{0}". 46 | super(Messages.getString("niochar.04", charset)); //$NON-NLS-1$ 47 | this.charsetName = charset; 48 | } 49 | 50 | /** 51 | * Gets the encountered unsupported charset name. 52 | * 53 | * @return the encountered unsupported charset name. 54 | */ 55 | public String getCharsetName() { 56 | return this.charsetName; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/java/util/ConcurrentModificationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | /** 21 | * An {@code ConcurrentModificationException} is thrown when a Collection is 22 | * modified and an existing iterator on the Collection is used to modify the 23 | * Collection as well. 24 | * 25 | * @see java.lang.RuntimeException 26 | */ 27 | public class ConcurrentModificationException extends RuntimeException { 28 | 29 | private static final long serialVersionUID = -3666751008965953603L; 30 | 31 | /** 32 | * Constructs a new {@code ConcurrentModificationException} with the current 33 | * stack trace filled in. 34 | */ 35 | public ConcurrentModificationException() { 36 | /*empty*/ 37 | } 38 | 39 | /** 40 | * Constructs a new {@code ConcurrentModificationException} with the current 41 | * stack trace and message filled in. 42 | * 43 | * @param detailMessage 44 | * the detail message for the exception. 45 | */ 46 | public ConcurrentModificationException(String detailMessage) { 47 | super(detailMessage); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /lib/java/util/Enumeration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | /** 21 | * An Enumeration is used to sequence over a collection of objects. 22 | *

23 | * Preferably an {@link Iterator} should be used. {@code Iterator} replaces the 24 | * enumeration interface and adds a way to remove elements from a collection. 25 | * 26 | * @see Hashtable 27 | * @see Properties 28 | * @see Vector 29 | * @version 1.0 30 | */ 31 | public interface Enumeration { 32 | 33 | /** 34 | * Returns whether this {@code Enumeration} has more elements. 35 | * 36 | * @return {@code true} if there are more elements, {@code false} otherwise. 37 | * @see #nextElement 38 | */ 39 | public boolean hasMoreElements(); 40 | 41 | /** 42 | * Returns the next element in this {@code Enumeration}. 43 | * 44 | * @return the next element.. 45 | * @throws NoSuchElementException 46 | * if there are no more elements. 47 | * @see #hasMoreElements 48 | */ 49 | public E nextElement(); 50 | } 51 | -------------------------------------------------------------------------------- /lib/java/util/Iterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | /** 21 | * An {@code Iterator} is used to sequence over a collection of objects. 22 | * Conceptually, an iterator is always positioned between two elements of a 23 | * collection. A fresh iterator is always positioned in front of the first 24 | * element. 25 | * 26 | * If a collection has been changed since its creation, methods {@code next} and 27 | * {@code hasNext()} may throw a {@code ConcurrentModificationException}. 28 | * Iterators with this behavior are called fail-fast iterators. 29 | * 30 | * @param 31 | * the type of object returned by the iterator. 32 | */ 33 | public interface Iterator { 34 | /** 35 | * Returns whether there are more elements to iterate, i.e. whether the 36 | * iterator is positioned in front of an element. 37 | * 38 | * @return {@code true} if there are more elements, {@code false} otherwise. 39 | * @see #next 40 | */ 41 | public boolean hasNext(); 42 | 43 | /** 44 | * Returns the next object in the iteration, i.e. returns the element in 45 | * front of the iterator and advances the iterator by one position. 46 | * 47 | * @return the next object. 48 | * @throws NoSuchElementException 49 | * if there are no more elements. 50 | * @see #hasNext 51 | */ 52 | public E next(); 53 | 54 | /** 55 | * Removes the last object returned by {@code next} from the collection. 56 | * This method can only be called once after {@code next} was called. 57 | * 58 | * @throws UnsupportedOperationException 59 | * if removing is not supported by the collection being 60 | * iterated. 61 | * @throws IllegalStateException 62 | * if {@code next} has not been called, or {@code remove} has 63 | * already been called after the last call to {@code next}. 64 | */ 65 | public void remove(); 66 | } 67 | -------------------------------------------------------------------------------- /lib/java/util/MapEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | /** 21 | * MapEntry is an internal class which provides an implementation of Map.Entry. 22 | */ 23 | class MapEntry implements Map.Entry, Cloneable { 24 | 25 | K key; 26 | V value; 27 | 28 | interface Type { 29 | RT get(MapEntry entry); 30 | } 31 | 32 | MapEntry(K theKey) { 33 | key = theKey; 34 | } 35 | 36 | MapEntry(K theKey, V theValue) { 37 | key = theKey; 38 | value = theValue; 39 | } 40 | 41 | @Override 42 | public Object clone() { 43 | try { 44 | return super.clone(); 45 | } catch (CloneNotSupportedException e) { 46 | return null; 47 | } 48 | } 49 | 50 | @Override 51 | public boolean equals(Object object) { 52 | if (this == object) { 53 | return true; 54 | } 55 | if (object instanceof Map.Entry) { 56 | Map.Entry entry = (Map.Entry) object; 57 | return (key == null ? entry.getKey() == null : key.equals(entry 58 | .getKey())) 59 | && (value == null ? entry.getValue() == null : value 60 | .equals(entry.getValue())); 61 | } 62 | return false; 63 | } 64 | 65 | public K getKey() { 66 | return key; 67 | } 68 | 69 | public V getValue() { 70 | return value; 71 | } 72 | 73 | @Override 74 | public int hashCode() { 75 | return (key == null ? 0 : key.hashCode()) 76 | ^ (value == null ? 0 : value.hashCode()); 77 | } 78 | 79 | public V setValue(V object) { 80 | V result = value; 81 | value = object; 82 | return result; 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return key + "=" + value; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/java/util/MissingResourceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | 21 | /** 22 | * A {@code MissingResourceException} is thrown by ResourceBundle when a 23 | * resource bundle cannot be found or a resource is missing from a resource 24 | * bundle. 25 | * 26 | * @see ResourceBundle 27 | * @see java.lang.RuntimeException 28 | */ 29 | public class MissingResourceException extends RuntimeException { 30 | 31 | private static final long serialVersionUID = -4876345176062000401L; 32 | 33 | String className, key; 34 | 35 | /** 36 | * Constructs a new {@code MissingResourceException} with the stack trace, 37 | * message, the class name of the resource bundle and the name of the 38 | * missing resource filled in. 39 | * 40 | * @param detailMessage 41 | * the detail message for the exception. 42 | * @param className 43 | * the class name of the resource bundle. 44 | * @param resourceName 45 | * the name of the missing resource. 46 | */ 47 | public MissingResourceException(String detailMessage, String className, 48 | String resourceName) { 49 | super(detailMessage); 50 | this.className = className; 51 | key = resourceName; 52 | } 53 | 54 | /** 55 | * Returns the class name of the resource bundle from which a resource could 56 | * not be found, or in the case of a missing resource, the name of the 57 | * missing resource bundle. 58 | * 59 | * @return the class name of the resource bundle. 60 | */ 61 | public String getClassName() { 62 | return className; 63 | } 64 | 65 | /** 66 | * Returns the name of the missing resource, or an empty string if the 67 | * resource bundle is missing. 68 | * 69 | * @return the name of the missing resource. 70 | */ 71 | public String getKey() { 72 | return key; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /lib/java/util/NoSuchElementException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | 21 | /** 22 | * A {@code NoSuchElementException} is thrown when trying to retrieve an element 23 | * past the end of an Enumeration, or the first or last element from an empty 24 | * Vector. 25 | * 26 | * @see Enumeration 27 | * @see java.lang.RuntimeException 28 | */ 29 | public class NoSuchElementException extends RuntimeException { 30 | 31 | private static final long serialVersionUID = 6769829250639411880L; 32 | 33 | /** 34 | * Constructs a new {@code NoSuchElementException} with the current stack 35 | * trace filled in. 36 | */ 37 | public NoSuchElementException() { 38 | super(); 39 | } 40 | 41 | /** 42 | * Constructs a new {@code NoSuchElementException} with the current stack 43 | * trace and message filled in. 44 | * 45 | * @param detailMessage 46 | * the detail message for the exception. 47 | */ 48 | public NoSuchElementException(String detailMessage) { 49 | super(detailMessage); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /lib/java/util/RandomAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package java.util; 19 | 20 | /** 21 | * RandomAccess is implemented by {@code List} implementations that support fast 22 | * (usually constant time) random access. 23 | */ 24 | public interface RandomAccess { 25 | /* empty */ 26 | } 27 | -------------------------------------------------------------------------------- /lib/lib.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/annotation/internal/nls/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.annotation.internal.nls; 19 | 20 | public class Messages extends com.cowlark.luje.harmony.Messages 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/internal/nls/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.internal.nls; 19 | 20 | public class Messages extends com.cowlark.luje.harmony.Messages 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/platform/Endianness.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.harmony.luni.platform; 18 | 19 | 20 | /** 21 | * Endianness 22 | * 23 | */ 24 | public final class Endianness { 25 | /** 26 | * Private mapping mode (equivalent to copy on write). 27 | */ 28 | public static final Endianness BIG_ENDIAN = new Endianness("BIG_ENDIAN"); //$NON-NLS-1$ 29 | 30 | /** 31 | * Read-only mapping mode. 32 | */ 33 | public static final Endianness LITTLE_ENDIAN = new Endianness( 34 | "LITTLE_ENDIAN"); //$NON-NLS-1$ 35 | 36 | // The string used to display the mapping mode. 37 | private final String displayName; 38 | 39 | /* 40 | * Private constructor prevents others creating new Endians. 41 | */ 42 | private Endianness(String displayName) { 43 | super(); 44 | this.displayName = displayName; 45 | } 46 | 47 | /** 48 | * Answers a string version of the endianness 49 | * 50 | * @return the mode string. 51 | */ 52 | public String toString() { 53 | return displayName; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/platform/IMemorySpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.platform; 19 | 20 | 21 | /** 22 | * This is the interface that the memory watchers implement -- what they do with 23 | * this information is largely undefined. 24 | * 25 | */ 26 | public interface IMemorySpy { 27 | 28 | public void alloc(PlatformAddress address); 29 | 30 | // Has a veto: true == do free,false = don't 31 | public boolean free(PlatformAddress address); 32 | 33 | public void rangeCheck(PlatformAddress address, int offset, int length) 34 | throws IndexOutOfBoundsException; 35 | 36 | /** 37 | * Requests that the given address is freed automatically when it becomes 38 | * garbage. If the address is alredy freed, or has not been notified as 39 | * allocated via this memory spy, then this call has no effect and completes 40 | * quietly. 41 | * 42 | * @param address 43 | * the address to be freed. 44 | */ 45 | public void autoFree(PlatformAddress address); 46 | } 47 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/platform/MappedPlatformAddress.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.harmony.luni.platform; 17 | 18 | public class MappedPlatformAddress extends PlatformAddress { 19 | 20 | MappedPlatformAddress(long address, long size) { 21 | super(address, size); 22 | } 23 | 24 | public final void mmapLoad() { 25 | memorySpy.rangeCheck(this, 0, (int) size * SIZEOF_JBYTE); 26 | osMemory.load(osaddr, size); 27 | } 28 | 29 | public final boolean mmapIsLoaded() { 30 | memorySpy.rangeCheck(this, 0, (int) size * SIZEOF_JBYTE); 31 | return osMemory.isLoaded(osaddr, size); 32 | } 33 | 34 | public final void mmapFlush() { 35 | memorySpy.rangeCheck(this, 0, (int) size * SIZEOF_JBYTE); 36 | osMemory.flush(osaddr, size); 37 | } 38 | 39 | public final void free(){ 40 | if(memorySpy.free(this)){ 41 | osMemory.unmap(osaddr, size); 42 | } 43 | } 44 | 45 | public PlatformAddress duplicate(){ 46 | return PlatformAddressFactory.mapOn(osaddr, size); 47 | } 48 | 49 | public final PlatformAddress offsetBytes(int offset) { 50 | return PlatformAddressFactory.mapOn(osaddr + offset, size - offset); 51 | } 52 | 53 | public final PlatformAddress offsetBytes(long offset) { 54 | return PlatformAddressFactory.mapOn(osaddr + offset, size - offset); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/platform/NoopMemorySpy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.platform; 19 | 20 | public class NoopMemorySpy implements IMemorySpy 21 | { 22 | public void alloc(PlatformAddress address) 23 | { 24 | } 25 | 26 | public boolean free(PlatformAddress address) 27 | { 28 | return true; 29 | } 30 | 31 | public void rangeCheck(PlatformAddress address, int offset, int length) 32 | throws IndexOutOfBoundsException 33 | { 34 | } 35 | 36 | public void autoFree(PlatformAddress address) 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/util/BinarySearch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.util; 19 | 20 | 21 | public class BinarySearch { 22 | 23 | /** 24 | * Search the sorted characters in the string and return an exact index or 25 | * -1. 26 | * 27 | * @param data 28 | * the String to search 29 | * @param value 30 | * the character to search for 31 | * @return the matching index, or -1 32 | */ 33 | public static int binarySearch(String data, char value) { 34 | int low = 0, high = data.length() - 1; 35 | while (low <= high) { 36 | int mid = (low + high) >> 1; 37 | char target = data.charAt(mid); 38 | if (value == target) 39 | return mid; 40 | else if (value < target) 41 | high = mid - 1; 42 | else 43 | low = mid + 1; 44 | } 45 | return -1; 46 | } 47 | 48 | /** 49 | * Search the sorted characters in the string and return the nearest index. 50 | * 51 | * @param data 52 | * the String to search 53 | * @param c 54 | * the character to search for 55 | * @return the nearest index 56 | */ 57 | public static int binarySearchRange(String data, char c) { 58 | char value = 0; 59 | int low = 0, mid = -1, high = data.length() - 1; 60 | while (low <= high) { 61 | mid = (low + high) >> 1; 62 | value = data.charAt(mid); 63 | if (c > value) 64 | low = mid + 1; 65 | else if (c == value) 66 | return mid; 67 | else 68 | high = mid - 1; 69 | } 70 | return mid - (c < value ? 1 : 0); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/util/DeleteOnExit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.util; 19 | 20 | 21 | import java.io.File; 22 | import java.util.Vector; 23 | import com.cowlark.luje.harmony.VM; 24 | 25 | public class DeleteOnExit { 26 | private static Vector deleteList = new Vector(); 27 | 28 | static { 29 | VM.deleteOnExit(); 30 | } 31 | 32 | public static void addFile(String toDelete) { 33 | deleteList.addElement(toDelete); 34 | } 35 | 36 | public static void deleteOnExit() { 37 | for (int i = deleteList.size() - 1; i >= 0; i--) { 38 | String name = deleteList.elementAt(i); 39 | new File(name).delete(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/util/FloatingPointParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.util; 19 | 20 | public class FloatingPointParser 21 | { 22 | public static float parseFloat(String s) 23 | { 24 | return (float) parseDouble(s); 25 | } 26 | 27 | public static native double parseDouble(String s); 28 | } 29 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/util/NumberConverter.java: -------------------------------------------------------------------------------- 1 | package org.apache.harmony.luni.util; 2 | 3 | public class NumberConverter 4 | { 5 | public static native String convert(double d); 6 | } 7 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/luni/util/SneakyThrow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.luni.util; 19 | 20 | /** 21 | * Exploits a weakness in the runtime to throw an arbitrary throwable without 22 | * the traditional declaration. This is a dangerous API that should be 23 | * used with great caution. Typically this is useful when rethrowing 24 | * throwables that are of a known range of types. 25 | * 26 | *

The following code must enumerate several types to rethrow: 27 | *

28 |  * public void close() throws IOException {
29 |  *     Throwable thrown = null;
30 |  *     ...
31 |  *
32 |  *     if (thrown != null) {
33 |  *         if (thrown instanceof IOException) {
34 |  *             throw (IOException) thrown;
35 |  *         } else if (thrown instanceof RuntimeException) {
36 |  *             throw (RuntimeException) thrown;
37 |  *         } else if (thrown instanceof Error) {
38 |  *             throw (Error) thrown;
39 |  *         } else {
40 |  *             throw new AssertionError();
41 |  *         }
42 |  *     }
43 |  * }
44 | * With SneakyThrow, rethrowing is easier: 45 | *
46 |  * public void close() throws IOException {
47 |  *     Throwable thrown = null;
48 |  *     ...
49 |  *
50 |  *     if (thrown != null) {
51 |  *         SneakyThrow.sneakyThrow(thrown);
52 |  *     }
53 |  * }
54 | */ 55 | public final class SneakyThrow { 56 | private SneakyThrow() {} 57 | 58 | public static void sneakyThrow(Throwable t) { 59 | SneakyThrow.sneakyThrow2(t); 60 | } 61 | 62 | /** 63 | * Exploits unsafety to throw an exception that the compiler wouldn't permit 64 | * but that the runtime doesn't check. See Java Puzzlers #43. 65 | */ 66 | @SuppressWarnings("unchecked") 67 | private static void sneakyThrow2(Throwable t) throws T { 68 | throw (T) t; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/nio/internal/DirectBuffer.java: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.harmony.nio.internal; 17 | 18 | import org.apache.harmony.luni.platform.PlatformAddress; 19 | 20 | public interface DirectBuffer { 21 | 22 | PlatformAddress getEffectiveAddress(); 23 | 24 | PlatformAddress getBaseAddress(); 25 | 26 | boolean isAddressValid(); 27 | 28 | void addressValidityCheck(); 29 | 30 | void free(); 31 | 32 | int getByteCapacity(); 33 | } 34 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/nio/internal/nls/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.nio.internal.nls; 19 | 20 | public class Messages extends com.cowlark.luje.harmony.Messages 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/niochar/charset/UTF_16BE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.niochar.charset; 19 | 20 | public class UTF_16BE extends UTF_16 { 21 | 22 | public UTF_16BE(String canonicalName, String[] aliases) { 23 | super(canonicalName, aliases); 24 | } 25 | 26 | protected int getDefaultEndian() { 27 | return BIG; 28 | } 29 | 30 | protected int getDetectedEndian(int b1, int b2) { 31 | return (b1 == 0xFE && b2 == 0xFF) ? getDefaultEndian() : NOT_DETECTED; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/niochar/charset/UTF_16LE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.niochar.charset; 19 | 20 | public class UTF_16LE extends UTF_16 { 21 | 22 | public UTF_16LE(String canonicalName, String[] aliases) { 23 | super(canonicalName, aliases); 24 | } 25 | 26 | protected int getDefaultEndian() { 27 | return LITTLE; 28 | } 29 | 30 | protected int getDetectedEndian(int b1, int b2) { 31 | return (b1 == 0xFF && b2 == 0xFE) ? getDefaultEndian() : NOT_DETECTED; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/niochar/internal/nls/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.niochar.internal.nls; 19 | 20 | public class Messages extends com.cowlark.luje.harmony.Messages 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /lib/org/apache/harmony/text/internal/nls/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.harmony.text.internal.nls; 19 | 20 | public class Messages extends com.cowlark.luje.harmony.Messages 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /luje: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Luje 3 | # © 2013 David Given 4 | # This file is redistributable under the terms of the 5 | # New BSD License. Please see the COPYING file in the 6 | # project root for the full text. 7 | 8 | export LUA_CPATH='/usr/lib/'$(gcc -dumpmachine)'/lua/5.1/?.so;;' 9 | export LUA_PATH='/usr/share/lua/5.1/?.lua;;' 10 | 11 | # If you want to use a different LuaJIT, change it here. 12 | 13 | #luajit=luajit-2.1.0-alpha 14 | luajit=luajit 15 | 16 | exec $luajit vm/main.lua "$@" 17 | 18 | -------------------------------------------------------------------------------- /vm/Cast.lua: -------------------------------------------------------------------------------- 1 | -- Luje 2 | -- © 2013 David Given 3 | -- This file is redistributable under the terms of the 4 | -- New BSD License. Please see the COPYING file in the 5 | -- project root for the full text. 6 | 7 | local Utils = require("Utils") 8 | local dbg = Utils.Debug 9 | local ffi = require("ffi") 10 | local string_byte = string.byte 11 | 12 | ffi.cdef([[ 13 | union reader 14 | { 15 | uint8_t b[8]; 16 | int8_t sb[8]; 17 | uint16_t w[4]; 18 | int16_t sw[4]; 19 | uint32_t i[2]; 20 | int32_t si[2]; 21 | uint64_t l[1]; 22 | int64_t sl[1]; 23 | float f[2]; 24 | double d[1]; 25 | }; 26 | ]]) 27 | 28 | local r = ffi.new("union reader") 29 | 30 | local writers = 31 | { 32 | B = function(i) r.b[0] = i end, 33 | SB = function(i) r.sb[0] = i end, 34 | BB = function(hi, lo) r.b[0] = lo r.b[1] = hi end, 35 | W = function(i) r.w[0] = i end, 36 | SW = function(i) r.sw[0] = i end, 37 | WW = function(hi, lo) r.w[0] = lo r.w[1] = hi end, 38 | I = function(i) r.i[0] = i end, 39 | SI = function(i) r.si[0] = i end, 40 | II = function(hi, lo) r.i[0] = lo r.i[1] = hi end, 41 | L = function(i) r.l[0] = i end, 42 | SL = function(i) r.sl[0] = i end, 43 | F = function(i) r.f[0] = i end, 44 | D = function(i) r.d[0] = i end, 45 | } 46 | 47 | local readers = 48 | { 49 | B = function() return r.b[0] end, 50 | SB = function() return r.sb[0] end, 51 | W = function() return r.w[0] end, 52 | SW = function() return r.sw[0] end, 53 | I = function() return r.i[0] end, 54 | SI = function() return r.si[0] end, 55 | L = function() return r.l[0] end, 56 | SL = function() return r.si[0] end, 57 | F = function() return r.f[0] end, 58 | D = function() return r.d[0] end, 59 | } 60 | 61 | local methods = {} 62 | for rn, r in pairs(readers) do 63 | for wn, w in pairs(writers) do 64 | local rf = r 65 | local wf = w 66 | methods[wn.."to"..rn] = function(hi, lo) 67 | wf(hi, lo) 68 | return rf() 69 | end 70 | end 71 | end 72 | 73 | return methods 74 | 75 | -------------------------------------------------------------------------------- /vm/ClimpLoader.lua: -------------------------------------------------------------------------------- 1 | -- Luje 2 | -- © 2013 David Given 3 | -- This file is redistributable under the terms of the 4 | -- New BSD License. Please see the COPYING file in the 5 | -- project root for the full text. 6 | 7 | local Utils = require("Utils") 8 | local Options = require("Options") 9 | local dbg = Utils.Debug 10 | local classanalyser = require("classanalyser") 11 | local string_find = string.find 12 | 13 | local cache = {} 14 | local path = "../bin/" 15 | 16 | -- module reference resolved lazily to avoid startup issues 17 | local Climp 18 | 19 | local function LoadClimp(self, name) 20 | local c = cache[name] 21 | if c then 22 | return c 23 | end 24 | 25 | if not Climp then 26 | Climp = require("Climp") 27 | end 28 | 29 | if Options.TraceCompilations then 30 | dbg("loading: ", name) 31 | end 32 | 33 | local t 34 | if string_find(name, "^[[VZBCSIJDF]") then 35 | t = { 36 | ThisClass = name, 37 | SuperClass = "java/lang/Object", 38 | Fields = {}, 39 | Methods = {}, 40 | } 41 | else 42 | local s = Utils.LoadFile(path..name..".class") 43 | t = classanalyser(s) 44 | end 45 | 46 | c = Climp(self) 47 | cache[name] = c 48 | c:Init(t) 49 | 50 | -- Call the static constructor for the class. 51 | 52 | local m = c.Methods["()V"] 53 | --dbg("class init: ", name, " = ", m) 54 | if m then 55 | m() 56 | end 57 | return c 58 | end 59 | 60 | local function New() 61 | return { 62 | LoadClimp = LoadClimp, 63 | } 64 | end 65 | 66 | local default = New() 67 | return { 68 | Default = default, 69 | New = New 70 | } 71 | 72 | -------------------------------------------------------------------------------- /vm/Options.lua: -------------------------------------------------------------------------------- 1 | -- Luje 2 | -- © 2013 David Given 3 | -- This file is redistributable under the terms of the 4 | -- New BSD License. Please see the COPYING file in the 5 | -- project root for the full text. 6 | 7 | return { 8 | CheckNullPointers = true, 9 | DumpCompilations = false, 10 | TraceCompilations = false 11 | } 12 | 13 | -------------------------------------------------------------------------------- /vm/String.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- © 2013 David Given 3 | -- This file is redistributable under the terms of the 4 | -- New BSD License. Please see the COPYING file in the 5 | -- project root for the full text. 6 | 7 | return function(utf8) 8 | dbg(utf8) 9 | return {} 10 | end 11 | -------------------------------------------------------------------------------- /vm/main.lua: -------------------------------------------------------------------------------- 1 | -- Luje 2 | -- © 2013 David Given 3 | -- This file is redistributable under the terms of the 4 | -- New BSD License. Please see the COPYING file in the 5 | -- project root for the full text. 6 | 7 | -- Add the directory containing this script to the package path. 8 | 9 | ServerDir = arg[0]:gsub("[^/]+$", "") 10 | package.path = ServerDir .. "?.lua;" .. ServerDir .. "?/init.lua;" .. package.path 11 | 12 | local Utils = require("Utils") 13 | local ClimpLoader = require("ClimpLoader") 14 | local Runtime = require("Runtime") 15 | local Options = require("Options") 16 | local string_gsub = string.gsub 17 | require("natives") 18 | 19 | -- Parse command line arguments. 20 | 21 | local classtoload = nil 22 | do 23 | local function do_help(arg) 24 | io.stderr:write("luje © 2013 David Given\n".. 25 | "Usage: luje [] \n".. 26 | "The classpath is currently hard coded to be ./bin.\n".. 27 | "\n".. 28 | "Options:\n".. 29 | " -h --help produce this message\n".. 30 | " -n --no-null-checks don't check for null pointers\n".. 31 | " -d --dump dump out generated Lua source\n".. 32 | " -t --trace trace compilations and class loads\n".. 33 | "\n".. 34 | "Here be dragons!\n") 35 | os.exit(0) 36 | end 37 | 38 | local function do_no_null_checks(arg) 39 | Options.CheckNullPointers = false 40 | return 0 41 | end 42 | 43 | local function do_dump(arg) 44 | Options.DumpCompilations = true 45 | return 0 46 | end 47 | 48 | local function do_trace(arg) 49 | Options.TraceCompilations = true 50 | return 0 51 | end 52 | 53 | Utils.ParseCommandLine({...}, 54 | { 55 | ["h"] = do_help, 56 | ["help"] = do_help, 57 | 58 | ["n"] = do_no_null_checks, 59 | ["no-null-checks"] = do_no_null_checks, 60 | 61 | ["d"] = do_dump, 62 | ["dump"] = do_dump, 63 | 64 | ["t"] = do_trace, 65 | ["trace"] = do_trace, 66 | 67 | [" unrecognised"] = function(arg) 68 | Utils.UserError("option not recognised (try --help)") 69 | end, 70 | 71 | [" filename"] = function(arg) 72 | if classtoload then 73 | Utils.UserError("you may only specify one class to run (try --help)") 74 | end 75 | classtoload = arg 76 | return 1 77 | end 78 | } 79 | ) 80 | end 81 | 82 | if not classtoload then 83 | Utils.UserError("you must specify a class to run (try --help)") 84 | end 85 | classtoload = string_gsub(classtoload, "%.", "/") 86 | 87 | -- Load the destination class and run the main method on it. 88 | 89 | local t, e = ClimpLoader.Default:LoadClimp(classtoload) 90 | local m = t.Methods["main([Ljava/lang/String;)V"] 91 | if not m then 92 | Utils.UserError("this isn't a main class (try --help)") 93 | end 94 | 95 | local r, e = m(t, nil) 96 | if e then 97 | local es = e.Methods["toString()Ljava/lang/String;"](e) 98 | Utils.Debug("uncaught exception: ", Runtime.FromString(es)) 99 | end 100 | 101 | --------------------------------------------------------------------------------