src/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java

Print this page
rev 10199 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz, prappo
Contributed-by: Otavio Santana <otaviojava@java.net>


  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.reflect;
  27 
  28 import java.lang.reflect.Field;
  29 
  30 class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl {
  31     UnsafeLongFieldAccessorImpl(Field field) {
  32         super(field);
  33     }
  34 
  35     public Object get(Object obj) throws IllegalArgumentException {
  36         return new Long(getLong(obj));
  37     }
  38 
  39     public boolean getBoolean(Object obj) throws IllegalArgumentException {
  40         throw newGetBooleanIllegalArgumentException();
  41     }
  42 
  43     public byte getByte(Object obj) throws IllegalArgumentException {
  44         throw newGetByteIllegalArgumentException();
  45     }
  46 
  47     public char getChar(Object obj) throws IllegalArgumentException {
  48         throw newGetCharIllegalArgumentException();
  49     }
  50 
  51     public short getShort(Object obj) throws IllegalArgumentException {
  52         throw newGetShortIllegalArgumentException();
  53     }
  54 
  55     public int getInt(Object obj) throws IllegalArgumentException {
  56         throw newGetIntIllegalArgumentException();




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.reflect;
  27 
  28 import java.lang.reflect.Field;
  29 
  30 class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl {
  31     UnsafeLongFieldAccessorImpl(Field field) {
  32         super(field);
  33     }
  34 
  35     public Object get(Object obj) throws IllegalArgumentException {
  36         return Long.valueOf(getLong(obj));
  37     }
  38 
  39     public boolean getBoolean(Object obj) throws IllegalArgumentException {
  40         throw newGetBooleanIllegalArgumentException();
  41     }
  42 
  43     public byte getByte(Object obj) throws IllegalArgumentException {
  44         throw newGetByteIllegalArgumentException();
  45     }
  46 
  47     public char getChar(Object obj) throws IllegalArgumentException {
  48         throw newGetCharIllegalArgumentException();
  49     }
  50 
  51     public short getShort(Object obj) throws IllegalArgumentException {
  52         throw newGetShortIllegalArgumentException();
  53     }
  54 
  55     public int getInt(Object obj) throws IllegalArgumentException {
  56         throw newGetIntIllegalArgumentException();