diff options
Diffstat (limited to 'annotation/src')
28 files changed, 0 insertions, 1833 deletions
diff --git a/annotation/src/main/java/java/lang/annotation/Annotation.java b/annotation/src/main/java/java/lang/annotation/Annotation.java deleted file mode 100644 index 43ad1bb..0000000 --- a/annotation/src/main/java/java/lang/annotation/Annotation.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines the interface implemented by all annotations. Note that the interface - * itself is <i>not</i> an annotation, and neither is an interface that simply - * extends this one. Only the compiler is able to create proper annotation - * types. - * - * @since Android 1.0 - */ -public interface Annotation { - - /** - * Returns the type of this annotation. - * - * @return A {@code Class} instance representing the annotation type. - * - * @since Android 1.0 - */ - Class<? extends Annotation> annotationType(); - - /** - * Determines whether or not this annotation is equivalent to the annotation - * passed. This is determined according to the following rules: - * - * <ul> - * <li> - * Two annotations {@code x} and {@code y} are equal if and only if - * they are members of the same annotation type and all the member - * values of {@code x} are equal to the corresponding member values - * of {@code y}. - * </li> - * <li> - * The equality of primitive member values {@code x} and {@code y} - * is determined (in a way similar to) using the corresponding - * wrapper classes. For example, - * {@code Integer.valueOf(x).equals(Integer.valueOf(y)} is used for - * {@code int} values. Note: The behavior is identical to the - * {@code ==} operator for all but the floating point type, so the - * implementation may as well use {@code ==} in these cases for - * performance reasons. Only for the {@code float} and {@code double} - * types the result will be slightly different: {@code NaN} is equal - * to {@code NaN}, and {@code -0.0} is equal to {@code 0.0}, both of - * which is normally not the case. - * </li> - * <li> - * The equality of two array member values {@code x} and {@code y} - * is determined using the corresponding {@code equals(x, y)} - * helper function in {@link java.util.Arrays}. - * </li> - * <li> - * The hash code for all other member values is determined by simply - * calling their {@code equals()} method. - * </li> - * </ul> - * - * @param obj - * The object to compare to. - * - * @return {@code true} if {@code obj} is equal to this annotation, - * {@code false} otherwise. - * - * @since Android 1.0 - */ - boolean equals(Object obj); - - /** - * Returns the hash code of this annotation. The hash code is determined - * according to the following rules: - * - * <ul> - * <li> - * The hash code of an annotation is the sum of the hash codes of - * its annotation members. - * </li> - * <li> - * The hash code of an annotation member is calculated as {@code - * (0x7f * n.hashCode()) ^ v.hashCode())}, where {@code n} is the - * name of the member (as a {@code String}) and {@code v} its value. - * </li> - * <li> - * The hash code for a primitive member value is determined using - * the corresponding wrapper type. For example, {@code - * Integer.valueOf(v).hashCode()} is used for an {@code int} value - * {@code v}. - * </li> - * <li> - * The hash code for an array member value {@code v} is determined - * using the corresponding {@code hashCode(v)} helper function in - * {@link java.util.Arrays}. - * </li> - * <li> - * The hash code for all other member values is determined by simply - * calling their {@code hashCode} method. - * </li> - * </ul> - * - * @return the hash code. - * - * @since Android 1.0 - */ - int hashCode(); - - /** - * Returns a {@code String} representation of this annotation. It is not - * strictly defined what the representation has to look like, but it usually - * consists of the name of the annotation, preceded by a "@". If the - * annotation contains field members, their names and values are also - * included in the result. - * - * @return the {@code String} that represents this annotation. - * - * @since Android 1.0 - */ - String toString(); -} diff --git a/annotation/src/main/java/java/lang/annotation/AnnotationFormatError.java b/annotation/src/main/java/java/lang/annotation/AnnotationFormatError.java deleted file mode 100644 index ce5c3a0..0000000 --- a/annotation/src/main/java/java/lang/annotation/AnnotationFormatError.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Indicates that an annotation in the binary representation of a class is - * syntactically incorrect and the annotation parser is unable to process it. - * This exception is unlikely to ever occur, given that the code has been - * compiled by an ordinary Java compiler. - * - * @since Android 1.0 - */ -public class AnnotationFormatError extends Error { - - private static final long serialVersionUID = -4256701562333669892L; - - /** - * Constructs an instance with the message provided. - * - * @param message - * the details of the error. - * - * @since Android 1.0 - */ - public AnnotationFormatError(String message) { - super(message); - } - - /** - * Constructs an instance with a message and a cause. - * - * @param message - * the details of the error. - * - * @param cause - * the cause of the error or {@code null} if none. - * - * @since Android 1.0 - */ - public AnnotationFormatError(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs an instance with a cause. If the cause is not - * {@code null}, then {@code cause.toString()} is used as the - * error's message. - * - * @param cause - * the cause of the error or {@code null} if none. - * - * @since Android 1.0 - */ - public AnnotationFormatError(Throwable cause) { - super(cause == null ? null : cause.toString(), cause); - } - -} diff --git a/annotation/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java b/annotation/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java deleted file mode 100644 index 5bb3cbf..0000000 --- a/annotation/src/main/java/java/lang/annotation/AnnotationTypeMismatchException.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -import java.lang.reflect.Method; - -import org.apache.harmony.annotation.internal.nls.Messages; - -/** - * Indicates that an annotation type has changed since it was compiled or - * serialized. - * - * @since Android 1.0 - */ -public class AnnotationTypeMismatchException extends RuntimeException { - - private static final long serialVersionUID = 8125925355765570191L; - - private Method element; - - private String foundType; - - /** - * Constructs an instance for the given type element and the type found. - * - * @param element - * the annotation type element. - * - * @param foundType - * the invalid type that was found. This is actually the textual - * type description found in the binary class representation, - * so it may not be human-readable. - * - * @since Android 1.0 - */ - public AnnotationTypeMismatchException(Method element, String foundType) { - super(Messages.getString("annotation.1", element, foundType)); //$NON-NLS-1$ - this.element = element; - this.foundType = foundType; - } - - /** - * Returns the method object for the invalid type. - * - * @return a {@link Method} instance. - * - * @since Android 1.0 - */ - public Method element() { - return element; - } - - /** - * Returns the invalid type. - * - * @return a string describing the invalid data. - * - * @since Android 1.0 - */ - public String foundType() { - return foundType; - } -} diff --git a/annotation/src/main/java/java/lang/annotation/Documented.java b/annotation/src/main/java/java/lang/annotation/Documented.java deleted file mode 100644 index 2849fd2..0000000 --- a/annotation/src/main/java/java/lang/annotation/Documented.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines a meta-annotation for indicating that an annotation is documented and - * considered part of the public API. - * - * @since Android 1.0 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.ANNOTATION_TYPE) -public @interface Documented { -} diff --git a/annotation/src/main/java/java/lang/annotation/ElementType.java b/annotation/src/main/java/java/lang/annotation/ElementType.java deleted file mode 100644 index 92f5109..0000000 --- a/annotation/src/main/java/java/lang/annotation/ElementType.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines an enumeration for Java program elements. It is used in conjunction - * with the {@link Target} meta-annotation to restrict the use of an annotation - * to certain program elements. - * - * @since Android 1.0 - */ -public enum ElementType { - /** - * Class, interface or enum declaration. - */ - TYPE, - /** - * Field declaration. - */ - FIELD, - /** - * Method declaration. - */ - METHOD, - /** - * Parameter declaration. - */ - PARAMETER, - /** - * Constructor declaration. - */ - CONSTRUCTOR, - /** - * Local variable declaration. - */ - LOCAL_VARIABLE, - /** - * Annotation type declaration. - */ - ANNOTATION_TYPE, - /** - * Package declaration. - */ - PACKAGE -} diff --git a/annotation/src/main/java/java/lang/annotation/IncompleteAnnotationException.java b/annotation/src/main/java/java/lang/annotation/IncompleteAnnotationException.java deleted file mode 100644 index 3a31551..0000000 --- a/annotation/src/main/java/java/lang/annotation/IncompleteAnnotationException.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -import org.apache.harmony.annotation.internal.nls.Messages; - -/** - * Indicates that an element of an annotation type was accessed that was added - * after the type was compiled or serialized. This does not apply to new - * elements that have default values. - * - * @since Android 1.0 - */ -public class IncompleteAnnotationException extends RuntimeException { - - private static final long serialVersionUID = 8445097402741811912L; - - private Class<? extends Annotation> annotationType; - - private String elementName; - - /** - * Constructs an instance with the incomplete annotation type and the name - * of the element that's missing. - * - * @param annotationType - * the annotation type. - * @param elementName - * the name of the incomplete element. - * - * @since Android 1.0 - */ - public IncompleteAnnotationException( - Class<? extends Annotation> annotationType, String elementName) { - super(Messages.getString("annotation.0", elementName, annotationType.getName())); //$NON-NLS-1$ - this.annotationType = annotationType; - this.elementName = elementName; - } - - /** - * Returns the annotation type. - * - * @return a Class instance. - * - * @since Android 1.0 - */ - public Class<? extends Annotation> annotationType() { - return annotationType; - } - - /** - * Returns the incomplete element's name. - * - * @return the name of the element. - * - * @since Android 1.0 - */ - public String elementName() { - return elementName; - } -} diff --git a/annotation/src/main/java/java/lang/annotation/Inherited.java b/annotation/src/main/java/java/lang/annotation/Inherited.java deleted file mode 100644 index cf16928..0000000 --- a/annotation/src/main/java/java/lang/annotation/Inherited.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines a meta-annotation for indicating that an annotation is automatically - * inherited. - * - * @since Android 1.0 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.ANNOTATION_TYPE) -public @interface Inherited { -} diff --git a/annotation/src/main/java/java/lang/annotation/Retention.java b/annotation/src/main/java/java/lang/annotation/Retention.java deleted file mode 100644 index 198fccc..0000000 --- a/annotation/src/main/java/java/lang/annotation/Retention.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines a meta-annotation for determining the scope of retention for an - * annotation. If the retention annotation is not set {@code - * RetentionPolicy.CLASS} is used as default retention. - * - * @since Android 1.0 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.ANNOTATION_TYPE) -public @interface Retention { - // BEGIN android-changed - // copied from newer version of harmony - RetentionPolicy value(); - // END android-changed -} diff --git a/annotation/src/main/java/java/lang/annotation/RetentionPolicy.java b/annotation/src/main/java/java/lang/annotation/RetentionPolicy.java deleted file mode 100644 index 014b910..0000000 --- a/annotation/src/main/java/java/lang/annotation/RetentionPolicy.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines an enumeration for annotation retention policies. Used in conjunction - * with the {@link Retention} annotation to specify an annotation's time-to-live - * in the overall development life cycle. - * - * @since Android 1.0 - */ -public enum RetentionPolicy { - /** - * Annotation is only available in the source code. - */ - SOURCE, - /** - * Annotation is available in the source code and in the class file, but not - * at runtime. This is the default policy. - */ - CLASS, - /** - * Annotation is available in the source code, the class file and is - * available at runtime. - */ - RUNTIME -} diff --git a/annotation/src/main/java/java/lang/annotation/Target.java b/annotation/src/main/java/java/lang/annotation/Target.java deleted file mode 100644 index 1f53fa0..0000000 --- a/annotation/src/main/java/java/lang/annotation/Target.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package java.lang.annotation; - -/** - * Defines a meta-annotation for determining what {@link ElementType}s an - * annotation can be applied to. - * - * @since Android 1.0 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.ANNOTATION_TYPE) -public @interface Target { - ElementType[] value(); -} diff --git a/annotation/src/main/java/java/lang/annotation/package.html b/annotation/src/main/java/java/lang/annotation/package.html deleted file mode 100644 index 99c98cc..0000000 --- a/annotation/src/main/java/java/lang/annotation/package.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> - <body> - <p> - Defines interfaces and exceptions necessary for annotation support. Also - provides some predefined annotations that are used throughout the Android - libraries. - </p> - @since Android 1.0 - </body> -</html>
\ No newline at end of file diff --git a/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/Messages.java b/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/Messages.java deleted file mode 100644 index 91f3548..0000000 --- a/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/Messages.java +++ /dev/null @@ -1,146 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL. - * All changes made to this file manually will be overwritten - * if this tool runs again. Better make changes in the template file. - */ - -// BEGIN android-note -// Redundant code has been removed and is now called from MsgHelp. -// END android-note - -package org.apache.harmony.annotation.internal.nls; - - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -// BEGIN android-changed -import org.apache.harmony.luni.util.MsgHelp; -// END android-changed - -/** - * This class retrieves strings from a resource bundle and returns them, - * formatting them with MessageFormat when required. - * <p> - * It is used by the system classes to provide national language support, by - * looking up messages in the <code> - * org.apache.harmony.annotation.internal.nls.messages - * </code> - * resource bundle. Note that if this file is not available, or an invalid key - * is looked up, or resource bundle support is not available, the key itself - * will be returned as the associated message. This means that the <em>KEY</em> - * should a reasonable human-readable (english) string. - * - */ -public class Messages { - - // BEGIN android-changed - private static final String sResource = - "org.apache.harmony.annotation.internal.nls.messages"; - // END android-changed - - /** - * Retrieves a message which has no arguments. - * - * @param msg - * String the key to look up. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg) { - // BEGIN android-changed - return MsgHelp.getString(sResource, msg); - // END android-changed - } - - /** - * Retrieves a message which takes 1 argument. - * - * @param msg - * String the key to look up. - * @param arg - * Object the object to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object arg) { - return getString(msg, new Object[] { arg }); - } - - /** - * Retrieves a message which takes 1 integer argument. - * - * @param msg - * String the key to look up. - * @param arg - * int the integer to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, int arg) { - return getString(msg, new Object[] { Integer.toString(arg) }); - } - - /** - * Retrieves a message which takes 1 character argument. - * - * @param msg - * String the key to look up. - * @param arg - * char the character to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, char arg) { - return getString(msg, new Object[] { String.valueOf(arg) }); - } - - /** - * Retrieves a message which takes 2 arguments. - * - * @param msg - * String the key to look up. - * @param arg1 - * Object an object to insert in the formatted output. - * @param arg2 - * Object another object to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object arg1, Object arg2) { - return getString(msg, new Object[] { arg1, arg2 }); - } - - /** - * Retrieves a message which takes several arguments. - * - * @param msg - * String the key to look up. - * @param args - * Object[] the objects to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object[] args) { - // BEGIN android-changed - return MsgHelp.getString(sResource, msg, args); - // END android-changed - } - - // BEGIN android-note - // Duplicate code was dropped in favor of using MsgHelp. - // END android-note -} diff --git a/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/messages.properties b/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/messages.properties deleted file mode 100644 index 613c54d..0000000 --- a/annotation/src/main/java/org/apache/harmony/annotation/internal/nls/messages.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# messages for EN locale -annotation.0=The element, {0}, is not complete for the annotation {1}. -annotation.1=The annotation element, {0}, doesn't match the type {1}. diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java deleted file mode 100644 index a5453df..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import org.apache.harmony.nio_char.tests.java.nio.charset.ASCIICharsetEncoderTest; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite for java.nio.charset package. - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = tests.TestSuiteFactory.createTestSuite("Test for java.lang.annotation"); - // $JUnit-BEGIN$ - - suite.addTestSuite(AnnotationTest.class); - suite.addTestSuite(AnnotationFormatErrorTest.class); - suite.addTestSuite(AnnotationTypeMismatchExceptionTest.class); - suite.addTestSuite(ElementTypeTest.class); - suite.addTestSuite(IncompleteAnnotationExceptionTest.class); - suite.addTestSuite(RetentionPolicyTest.class); - - // $JUnit-END$ - return suite; - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java deleted file mode 100644 index c2a32b8..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestTargets; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import java.lang.annotation.AnnotationFormatError; - -/** - * Test case of java.lang.annotation.AnnotationFormatError - */ -@TestTargetClass(AnnotationFormatError.class) -public class AnnotationFormatErrorTest extends TestCase { - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(String) - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "AnnotationFormatError", - args = {java.lang.String.class} - ) - @SuppressWarnings("nls") - public void test_constructorLjava_lang_String() { - AnnotationFormatError e = new AnnotationFormatError("some message"); - assertEquals("some message", e.getMessage()); - } - - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(Throwable) - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "AnnotationFormatError", - args = {java.lang.Throwable.class} - ) - public void test_constructorLjava_lang_Throwable() { - IllegalArgumentException iae = new IllegalArgumentException(); - AnnotationFormatError e = new AnnotationFormatError(iae); - assertSame(iae, e.getCause()); - } - - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(String,Throwable) - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "AnnotationFormatError", - args = {java.lang.String.class, java.lang.Throwable.class} - ) - @SuppressWarnings("nls") - public void test_constructorLjava_lang_StringLjava_lang_Throwable() { - IllegalArgumentException iae = new IllegalArgumentException(); - AnnotationFormatError e = new AnnotationFormatError("some message", iae); - assertEquals("some message", e.getMessage()); - assertSame(iae, e.getCause()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java deleted file mode 100644 index c50c0e8..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargets; - -import junit.framework.TestCase; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Test case of java.lang.annotation.Annotation - */ -@TestTargetClass(value = Annotation.class, - untestedMethods = { - @TestTargetNew( - level = TestLevel.NOT_NECESSARY, - notes = "the spec does not require any specific output (although @something is probable)", - method = "toString", - args = {} - )} -) -public class AnnotationTest extends TestCase { - - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "annotationType", - args = {} - ) - public void test_annotationType() { - Annotation [] annotations = AnnotatedClass.class.getDeclaredAnnotations(); - assertEquals(1, annotations.length); - Annotation anno = annotations[0]; - assertEquals(TestAnnotation1.class, anno.annotationType()); - } - - @TestTargets({ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "equals", - args = { Object.class} - ), - @TestTargetNew( - level = TestLevel.PARTIAL_COMPLETE, - notes = "", - method = "hashCode", - args = {} - ) - }) - public void test_equals() throws Exception { - // test type - Method m1 = AnnotatedClass2.class - .getDeclaredMethod("a", new Class[] {}); - Method m2 = AnnotatedClass2.class - .getDeclaredMethod("b", new Class[] {}); - assertFalse("other annotation class type", - m1.getDeclaredAnnotations()[0].equals(m2 - .getDeclaredAnnotations()[0])); - - // test equality / non equality for base types and compound types - List<Method> methods = Arrays.asList(AnnotatedClass.class.getDeclaredMethods()); - Map<String, List<Method>> eqs = new HashMap<String, List<Method>>(); - Map<String, List<Method>> neqs = new HashMap<String, List<Method>>(); - for (Method m : methods) { - String name = m.getName(); - //System.out.println("name "+name); - Map<String, List<Method>> curT = name.charAt(0) == 'e'? eqs : neqs; - String testNum = name.substring(1,3); // 01 - List<Method> mlist = curT.get(testNum); - if (mlist == null) { - mlist = new ArrayList<Method>(); - curT.put(testNum, mlist); - } - mlist.add(AnnotatedClass.class.getDeclaredMethod(name, new Class[] {})); - } - - for (List<Method> eqList : eqs.values()) { - for (int i = 0; i < eqList.size() -1; i++) { - for (int j = i+1; j < eqList.size(); j++) { - Method me1 = eqList.get(i); - Method me2 = eqList.get(j); - //System.out.println("eq test for "+me1.getName()+", "+me2.getName()); - Annotation a1 = me1.getDeclaredAnnotations()[0]; - Annotation a2 = me2.getDeclaredAnnotations()[0]; - assertEquals("must be equal : method1:"+me1.getName()+", method2: "+me2.getName(), a1, a2); - assertEquals("same hashcode", a1.hashCode(), a2.hashCode()); - } - } - } - - for (List<Method> eqList : neqs.values()) { - for (int i = 0; i < eqList.size() -1; i++) { - for (int j = i+1; j < eqList.size(); j++) { - Method me1 = eqList.get(i); - Method me2 = eqList.get(j); - Annotation a1 = me1.getDeclaredAnnotations()[0]; - Annotation a2 = me2.getDeclaredAnnotations()[0]; - //System.out.println("ne test for "+me1.getName()+", "+me2.getName()); - assertFalse("must not be equal : method1:"+me1.getName()+", method2: "+me2.getName(), - a1.equals(a2)); - if (a1.hashCode() != a2.hashCode()) { - assertFalse("not same hashcode -> not equals", a1.equals(a2)); - } - } - - } - } - } - - @TestTargetNew( - level = TestLevel.PARTIAL_COMPLETE, - notes = "", - method = "hashCode", - args = {} - ) - public void test_hashCode() throws SecurityException, NoSuchMethodException { - Annotation a1 = AnnotatedClass.class.getDeclaredAnnotations()[0]; - assertEquals(a1.hashCode(), (127 * "value".hashCode() ^ "foobar".hashCode())); - // i+= 127 *(key.hashCode() ^ memberValHashCode(value); - - Method m1 = AnnotatedClass.class.getDeclaredMethod("e34c", new Class[] {}); - int arrHc = Arrays.hashCode(new Object[]{}); - /* - TestAnnotation3[] arrAnno() default {}; - String[] arrString() default {}; - Class[] arrClass() default {}; - TestEnum1[] arrEnum() default {}; - */ - assertEquals( - (127 * "arrAnno".hashCode() ^ arrHc) + - (127 * "arrString".hashCode() ^ arrHc)+ - (127 * "arrClass".hashCode() ^ arrHc) + - (127 * "arrEnum".hashCode() ^ arrHc) - , - m1.getDeclaredAnnotations()[0].hashCode()); - - Method m2 = AnnotatedClass3.class.getDeclaredMethod("a", new Class[] {}); - assertEquals( - (127 * "i".hashCode() ^ 12345), - m2.getDeclaredAnnotations()[0].hashCode()); - - } -} - -class AnnotatedClass2 { - @TestAnnotation3() - void a() {} - @TestAnnotation3b() - void b() {} -} - -class AnnotatedClass3 { - @TestAnnotation4(i = 12345) - void a() {} -} - -@TestAnnotation1("foobar") -class AnnotatedClass { - - // ----- boolean ----- - @TestAnnotation3(z = false) - void e01a() {} - @TestAnnotation3(z = false) - void e01b() {} - @TestAnnotation3() - void e01c() {} - - @TestAnnotation3(z = true) - void e02a() {} - @TestAnnotation3(z = true) - void e02b() {} - - @TestAnnotation3(z = false) - void n03a() {} - @TestAnnotation3(z = true) - void n03b() {} - - - // ----- byte ----- - @TestAnnotation3(b = 0) - void e04a() {} - @TestAnnotation3(b = 0) - void e04b() {} - @TestAnnotation3() - void e04c() {} - - @TestAnnotation3(b= 127) - void e05a() {} - @TestAnnotation3(b = 127) - void e05b() {} - - @TestAnnotation3(b = -128) - void n06a() {} - @TestAnnotation3(b = 127) - void n06b() {} - - - // ----- short ----- - @TestAnnotation3(s = 0) - void e07a() {} - @TestAnnotation3(s = 0) - void e07b() {} - @TestAnnotation3() - void e07c() {} - - @TestAnnotation3(s= 32767) - void e08a() {} - @TestAnnotation3(s = 32767) - void e08b() {} - - @TestAnnotation3(s = -32768) - void n09a() {} - @TestAnnotation3(s = 32767) - void n09b() {} - - - // ----- int ----- - @TestAnnotation3(i = 100) - void e10a() {} - @TestAnnotation3(i = 100) - void e10b() {} - @TestAnnotation3() - void e10c() {} - - @TestAnnotation3(i = Integer.MAX_VALUE) - void e11a() {} - @TestAnnotation3(i = Integer.MAX_VALUE) - void e11b() {} - - @TestAnnotation3(i = Integer.MAX_VALUE) - void n12a() {} - @TestAnnotation3(i = Integer.MIN_VALUE) - void n12b() {} - - - // ----- long ----- - @TestAnnotation3(j = 0) - void e13a() {} - @TestAnnotation3(j = 0) - void e13b() {} - @TestAnnotation3() - void e13c() {} - - @TestAnnotation3(j = Long.MAX_VALUE) - void e14a() {} - @TestAnnotation3(j = Long.MAX_VALUE) - void e14b() {} - - @TestAnnotation3(j = Long.MAX_VALUE) - void n15a() {} - @TestAnnotation3(j = Long.MIN_VALUE) - void n15b() {} - - - // ----- float ----- - @TestAnnotation3(f = 0.0f) - void e16a() {} - @TestAnnotation3(f = 0.0f) - void e16b() {} - @TestAnnotation3() - void e16c() {} - - @TestAnnotation3(f = Float.MAX_VALUE) - void e17a() {} - @TestAnnotation3(f = Float.MAX_VALUE) - void e17b() {} - - @TestAnnotation3(f = Float.NaN) - void e18a() {} - @TestAnnotation3(f = Float.NaN) - void e18b() {} - - @TestAnnotation3(f = Long.MAX_VALUE) - void n19a() {} - @TestAnnotation3(f = Long.MIN_VALUE) - void n19b() {} - - @TestAnnotation3(f = 0.0f) - void n20a() {} - @TestAnnotation3(f = -0.0f) - void n20b() {} - - - // ----- double ----- - @TestAnnotation3(d = 0.0d) - void e21a() {} - @TestAnnotation3(d = 0.0d) - void e21b() {} - @TestAnnotation3() - void e21c() {} - - @TestAnnotation3(d = Double.MAX_VALUE) - void e22a() {} - @TestAnnotation3(d = Double.MAX_VALUE) - void e22b() {} - - @TestAnnotation3(d = Double.NaN) - void e23a() {} - @TestAnnotation3(d = Double.NaN) - void e23b() {} - - - @TestAnnotation3(d = Double.MAX_VALUE) - void n24a() {} - @TestAnnotation3(d = Double.MIN_VALUE) - void n24b() {} - - @TestAnnotation3(d = 0.0d) - void n25a() {} - @TestAnnotation3(d = -0.0d) - void n25b() {} - - - // ----- String ----- - @TestAnnotation3(aString = "") - void e26a() {} - @TestAnnotation3(aString = "") - void e26b() {} - @TestAnnotation3() - void e26c() {} - - @TestAnnotation3(aString = "asjdfk jkls dfjklsd fklsd jklds kflds jfkldsfjd"+"d") - void e27a() {} - @TestAnnotation3(aString = "asjdfk jkls dfjklsd fklsd jklds kflds jfkldsfj"+"dd") - void e27b() {} - - @TestAnnotation3(aString = "a") - void n28a() {} - @TestAnnotation3(aString = "b") - void n28b() {} - - - // ----- Class----- - @TestAnnotation3(aClazz = Void.class) - void e29a() {} - @TestAnnotation3(aClazz = Void.class) - void e29b() {} - @TestAnnotation3() - void e29c() {} - - @TestAnnotation3(aClazz = Integer.class) - void n30a() {} - @TestAnnotation3(aClazz = int.class) - void n30b() {} - - - // ----- Enum----- - @TestAnnotation3(aEnum = TestEnum1.F) - void e31a() {} - @TestAnnotation3(aEnum = TestEnum1.F) - void e31b() {} - @TestAnnotation3() - void e31c() {} - - @TestAnnotation3(aEnum = TestEnum1.F) - void n32a() {} - @TestAnnotation3(aEnum = TestEnum1.A) - void n32b() {} - - @TestAnnotation3(aEnum = TestEnum1.F) - void n33a() {} - @TestAnnotation3(aEnum = TestEnum1.L) - void n33b() {} - - - // ----- String arr----- - @TestAnnotation2(arrString = {}) - void e34a() {} - @TestAnnotation2(arrString = {}) - void e34b() {} - @TestAnnotation2(arrString = {}) - void e34c() {} - - @TestAnnotation2(arrString = { "a", "b"}) - void e35a() {} - @TestAnnotation2(arrString = { "a", "b" }) - void e35b() {} - - @TestAnnotation2(arrString = { "a", "b"}) - void n36a() {} - @TestAnnotation2(arrString = { "a", "c" }) - void n36b() {} - - - // ----- Class arr----- - @TestAnnotation2(arrClass= {}) - void e37a() {} - @TestAnnotation2(arrClass = {}) - void e37b() {} - @TestAnnotation2(arrClass = {}) - void e37c() {} - - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void e38a() {} - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void e38b() {} - - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void n39a() {} - @TestAnnotation2(arrClass = { Void.class, int.class}) - void n39b() {} - - // ----- Enum arr----- - @TestAnnotation2(arrEnum= {}) - void e40a() {} - @TestAnnotation2(arrEnum = {}) - void e40b() {} - @TestAnnotation2(arrEnum = {}) - void e40c() {} - - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void e41a() {} - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void e41b() {} - - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void n42a() {} - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.L }) - void n42b() {} - - - // ----- Annotation arr----- - @TestAnnotation2(arrAnno= {}) - void e43a() {} - @TestAnnotation2(arrAnno = {}) - void e43b() {} - @TestAnnotation2() - void e43c() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void e44a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void e44b() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void n45a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 124)}) - void n45b() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void n46a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = -20), @TestAnnotation3(j = 123)}) - void n46b() {} - -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java deleted file mode 100644 index 1134887..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestTargets; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.reflect.Method; - -/** - * Test case of java.lang.annotation.AnnotationTypeMismatchException - */ -@TestTargetClass(AnnotationTypeMismatchException.class) -public class AnnotationTypeMismatchExceptionTest extends TestCase { - - /** - * @throws ClassNotFoundException - * @throws SecurityException - * @tests java.lang.annotation.AnnotationTypeMismatchException#AnnotationTypeMismatchException(Method, - * String) - */ - @TestTargets({ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "AnnotationTypeMismatchException", - args = {java.lang.reflect.Method.class, java.lang.String.class} - ), - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "element", - args = {} - ), - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "foundType", - args = {} - ) - }) - @SuppressWarnings("nls") - public void test_constructorLjava_lang_reflect_MethodLjava_lang_String() throws SecurityException, ClassNotFoundException { - Method[] methods = Class.forName("java.lang.String").getMethods(); - Method m = methods[0]; - AnnotationTypeMismatchException e = new AnnotationTypeMismatchException( - m, "some type"); - assertNotNull("can not instanciate AnnotationTypeMismatchException", e); - assertSame("wrong method name", m, e.element()); - assertEquals("wrong found type", "some type", e.foundType()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java deleted file mode 100644 index dec9bf7..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestTargets; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import java.lang.annotation.ElementType; -import java.util.Arrays; - -/** - * Test case of java.lang.annotation.ElementType - */ -@TestTargetClass(ElementType.class) -public class ElementTypeTest extends TestCase { - - /** - * @throws Exception - * @tests java.lang.annotation.ElementType#valueOf(String) - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "valueOf", - args = {java.lang.String.class} - ) - @SuppressWarnings("nls") - public void test_valueOfLjava_lang_String() throws Exception { - assertSame(ElementType.ANNOTATION_TYPE, ElementType - .valueOf("ANNOTATION_TYPE")); - assertSame(ElementType.CONSTRUCTOR, ElementType.valueOf("CONSTRUCTOR")); - assertSame(ElementType.FIELD, ElementType.valueOf("FIELD")); - assertSame(ElementType.LOCAL_VARIABLE, ElementType - .valueOf("LOCAL_VARIABLE")); - assertSame(ElementType.METHOD, ElementType.valueOf("METHOD")); - assertSame(ElementType.PACKAGE, ElementType.valueOf("PACKAGE")); - assertSame(ElementType.PARAMETER, ElementType.valueOf("PARAMETER")); - assertSame(ElementType.TYPE, ElementType.valueOf("TYPE")); - try { - ElementType.valueOf("OTHER"); - fail("Should throw an IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.ElementType#values() - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "values", - args = {} - ) - @SuppressWarnings("nls") - public void test_values() throws Exception { - ElementType[] values = ElementType.values(); - assertTrue(values.length > 1); - Arrays.sort(values); - assertTrue(Arrays.binarySearch(values, ElementType.METHOD) >= 0); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java deleted file mode 100644 index de56330..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestTargets; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import java.lang.annotation.IncompleteAnnotationException; - -@TestTargetClass(IncompleteAnnotationException.class) -public class IncompleteAnnotationExceptionTest extends TestCase { - - /* - * Class under test for void IncompleteAnnotationException(String) - * Regression for HARMONY-2477 - */ - @TestTargetNew( - level = TestLevel.PARTIAL, - notes = "Verifies NullPointerException.", - method = "IncompleteAnnotationException", - args = {java.lang.Class.class, java.lang.String.class} - ) - public void testNullType() { - try { - new IncompleteAnnotationException(null, "str"); - fail("NullPointerException must be thrown"); - } catch (NullPointerException e) { - // Expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.IncompleteAnnotationException#IncompleteAnnotationException(Class, - * String) - */ - @TestTargets({ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "IncompleteAnnotationException", - args = {java.lang.Class.class, java.lang.String.class} - ), - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "annotationType", - args = {} - ), - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "elementName", - args = {} - ) - }) - @SuppressWarnings("nls") - public void test_constructorLjava_lang_Class_Ljava_lang_String() - throws Exception { - Class clazz = String.class; - String elementName = "some element"; - IncompleteAnnotationException e = new IncompleteAnnotationException( - clazz, elementName); - assertNotNull("can not instanciate IncompleteAnnotationException", e); - assertSame("wrong annotation type", clazz, e.annotationType()); - assertSame("wrong element name", elementName, e.elementName()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java deleted file mode 100644 index 1827b7d..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import dalvik.annotation.TestTargets; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import java.lang.annotation.RetentionPolicy; -import java.util.Arrays; - -/** - * Test case of java.lang.annotation.RetentionPolicy - */ -@TestTargetClass(RetentionPolicy.class) -public class RetentionPolicyTest extends TestCase { - /** - * @throws Exception - * @tests java.lang.annotation.RetentionPolicy#valueOf(String) - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "valueOf", - args = {java.lang.String.class} - ) - @SuppressWarnings("nls") - public void test_valueOfLjava_lang_String() throws Exception { - assertSame(RetentionPolicy.CLASS, RetentionPolicy - .valueOf("CLASS")); - assertSame(RetentionPolicy.RUNTIME, RetentionPolicy - .valueOf("RUNTIME")); - assertSame(RetentionPolicy.SOURCE, RetentionPolicy - .valueOf("SOURCE")); - try { - RetentionPolicy.valueOf("OTHER"); - fail("Should throw an IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.RetentionPolicy#values() - */ - @TestTargetNew( - level = TestLevel.COMPLETE, - notes = "", - method = "values", - args = {} - ) - @SuppressWarnings("nls") - public void test_values() throws Exception { - RetentionPolicy[] values = RetentionPolicy.values(); - assertTrue(values.length > 1); - Arrays.sort(values); - assertTrue(Arrays.binarySearch(values, RetentionPolicy.RUNTIME) >= 0); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java deleted file mode 100644 index 64393ef..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface TestAnnotation1 { - String value(); -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java deleted file mode 100644 index d3c7d42..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation2 { - TestAnnotation3[] arrAnno() default {}; - String[] arrString() default {}; - Class[] arrClass() default {}; - TestEnum1[] arrEnum() default {}; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java deleted file mode 100644 index 3228c66..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation3 { - /* - * only primitive type, String, Class, annotation, - * enumeration are permitted - * or 1-dimensional arrays thereof - */ - boolean z() default false; - byte b() default 0; - short s() default 0; - int i() default 100; - long j() default 0; - - float f() default 0.0f; - double d() default 0.0d; - - String aString() default ""; - Class aClazz() default Void.class; - TestEnum1 aEnum() default TestEnum1.F; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java deleted file mode 100644 index 5411011..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation3b { - /* - * only primitive type, String, Class, annotation, - * enumeration are permitted - * or 1-dimensional arrays thereof - */ - boolean z() default false; - byte b() default 0; - short s() default 0; - int i() default 100; - long l() default 0; - - float f() default 0.0f; - double d() default 0.0d; - - String aString() default ""; - Class aClazz() default Void.class; - TestEnum1 aEnum() default TestEnum1.F; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java deleted file mode 100644 index 2267536..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation4 { - int i() default 0; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java deleted file mode 100644 index f8ed73d..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -public enum TestEnum1 { - Z, F, L, A, B -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java deleted file mode 100644 index 874d893..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -public enum TestEnum1b { - Z, F, L, A, B -} diff --git a/annotation/src/test/java/tests/annotation/AllTests.java b/annotation/src/test/java/tests/annotation/AllTests.java deleted file mode 100644 index 172cc10..0000000 --- a/annotation/src/test/java/tests/annotation/AllTests.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package tests.annotation; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite that includes all tests for the NIO_Char project. - */ -public class AllTests { - - public static void main(String[] args) { - junit.textui.TestRunner.run(AllTests.suite()); - } - - public static Test suite() { - TestSuite suite = tests.TestSuiteFactory.createTestSuite("All Annotation test suites"); - // $JUnit-BEGIN$ - suite.addTest(org.apache.harmony.annotation.tests.java.lang.annotation.AllTests.suite()); - // $JUnit-END$ - return suite; - } -} |