[LANG-1291] Provide annotations to document thread safety. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/a91f76da Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/a91f76da Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/a91f76da
Branch: refs/heads/release Commit: a91f76da21faf4e8b70f0f69c6db2521409e7d29 Parents: a5e76eb Author: Gary Gregory <garydgreg...@gmail.com> Authored: Mon Apr 17 12:00:09 2017 -0700 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Mon Apr 17 12:00:09 2017 -0700 ---------------------------------------------------------------------- .../concurrent/annotation/ContractTest.java | 38 ++++++++++++++++++++ .../annotation/ContractTestFixture.java | 25 +++++++++++++ 2 files changed, 63 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a91f76da/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTest.java b/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTest.java new file mode 100644 index 0000000..affa786 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTest.java @@ -0,0 +1,38 @@ +/* + * 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.commons.lang3.concurrent.annotation; + +import org.junit.Test; + +/** + * Tests {@link Contract}. + */ +public class ContractTest { + + @Test + public void testClassAnnotationInClassFile() throws Exception { + AnnotationTestUtils.testClassAnnotationInClassFile( + "org.apache.commons.lang3.concurrent.annotation.ContractTestFixture", + "Lorg/apache/commons/lang3/concurrent/annotation/Contract;"); + } + + @Test + public void testMethodAnnotationNotRetainedAtRuntime() { + AnnotationTestUtils.testMethodAnnotationNotRetainedAtRuntime(ContractTestFixture.class, Contract.class); + } + +} http://git-wip-us.apache.org/repos/asf/commons-lang/blob/a91f76da/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTestFixture.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTestFixture.java b/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTestFixture.java new file mode 100644 index 0000000..6d254b1 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/concurrent/annotation/ContractTestFixture.java @@ -0,0 +1,25 @@ +/* + * 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.commons.lang3.concurrent.annotation; + +/** + * Tests {@link Immutable}. + */ +@Contract() +public class ContractTestFixture { + // empty +}