View Javadoc
1   /*-
2    * #%L
3    * io.earcam.instrumental.module.auto
4    * %%
5    * Copyright (C) 2018 earcam
6    * %%
7    * SPDX-License-Identifier: (BSD-3-Clause OR EPL-1.0 OR Apache-2.0 OR MIT)
8    * 
9    * You <b>must</b> choose to accept, in full - any individual or combination of 
10   * the following licenses:
11   * <ul>
12   * 	<li><a href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</a></li>
13   * 	<li><a href="https://www.eclipse.org/legal/epl-v10.html">EPL-1.0</a></li>
14   * 	<li><a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></li>
15   * 	<li><a href="https://opensource.org/licenses/MIT">MIT</a></li>
16   * </ul>
17   * #L%
18   */
19  // EARCAM_SNIPPET_BEGIN: example-annotated-class
20  package io.earcam.acme;
21  
22  import java.io.UncheckedIOException;
23  import java.util.Comparator;
24  import java.util.Objects;
25  
26  import org.hamcrest.Matchers;
27  import org.hamcrest.core.IsAnything;
28  import org.junit.jupiter.api.Test;
29  import org.objectweb.asm.Label;
30  import org.objectweb.asm.signature.SignatureReader;
31  
32  import io.earcam.utilitarian.charstar.CharSequences;
33  
34  @AcmeAnnotation(CharSequences.class)
35  public class Annotated implements Comparable<@AcmeAnnotation(Test.class) Annotated> {
36  
37  	@AcmeAnnotation(Label.class)
38  	private int num = 42;
39  
40  
41  	@AcmeAnnotation(SignatureReader.class)
42  	public int getNum() throws @AcmeAnnotation(IllegalStateException.class) OutOfMemoryError
43  	{
44  		@AcmeAnnotation(Matchers.class)
45  		int numnum = num;
46  		return new @AcmeAnnotation(IsAnything.class) Integer(numnum).intValue();
47  	}
48  
49  
50  	@Override
51  	public int compareTo(@AcmeAnnotation(Comparator.class) Annotated o)
52  	{
53  		return 0;
54  	}
55  
56  
57  	public static <T extends Comparable<T>> boolean isNaNaNullALul(T instance, Class<@AcmeAnnotation(Objects.class) T> type)
58  	{
59  		try {
60  			return instance == null;
61  		} catch(@AcmeAnnotation(UncheckedIOException.class) Throwable t) {
62  			return true;
63  		}
64  	}
65  }
66  // EARCAM_SNIPPET_END: example-annotated-class