001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.vmmagic;
014
015import java.lang.annotation.Retention;
016import java.lang.annotation.RetentionPolicy;
017import java.lang.annotation.Target;
018import java.lang.annotation.ElementType;
019import java.lang.annotation.Inherited;
020
021/**
022 * The Unboxed annotation marks a type as unboxed. Besides the primitive types, all Java values
023 * are boxed types. Conceptually, they are represented by a pointer to a heap object. However,
024 * an unboxed type is represented by the value itself. All methods on an unboxed type are
025 * {@link Intrinsic}s.
026 *
027 * <p>As an unboxed type is not a regular java object there are a few constraints on the way unboxed
028 * types are handled;</p>
029 * <ul>
030 *   <li>All methods are {@link Intrinsic} and thus there can be no virtual methods.</li>
031 *   <li>An unboxed type can not be synchronized on.</li>
032 *   <li>An unboxed type has no hashcode.</li>
033 *   <li>An unboxed type MUST NOT be passed where an object is expected or when two overloaded methods
034 *       can only be distinguished by by Object vs unboxed parameter type.</li>
035 * </ul>
036 *
037 * <p>NOTE: At the current time the Unboxed annotation is only used for documentation
038 * purposes but in the near future it is expected that the semantics of the annotation will
039 * be enforced by the compiler.</p>
040 */
041@Retention(RetentionPolicy.RUNTIME)
042@Target(ElementType.TYPE)
043@Inherited
044public @interface Unboxed { }