From 908f629a269feca5d9347aa5d475c63308c44fe3 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 21 Jun 2023 10:58:53 +0200 Subject: [PATCH 01/11] add UnsafeFieldAccessorFactory from JDK 22+1 [GR-46732] --- .../svm/core/reflect/FieldAccessorImpl.java | 267 ++++++++++++++++++ .../UnsafeBooleanFieldAccessorImpl.java | 140 +++++++++ .../reflect/UnsafeByteFieldAccessorImpl.java | 140 +++++++++ .../UnsafeCharacterFieldAccessorImpl.java | 140 +++++++++ .../UnsafeDoubleFieldAccessorImpl.java | 164 +++++++++++ .../reflect/UnsafeFieldAccessorFactory.java | 129 +++++++++ .../core/reflect/UnsafeFieldAccessorImpl.java | 54 ++++ .../reflect/UnsafeFloatFieldAccessorImpl.java | 160 +++++++++++ .../UnsafeIntegerFieldAccessorImpl.java | 152 ++++++++++ .../reflect/UnsafeLongFieldAccessorImpl.java | 156 ++++++++++ .../UnsafeObjectFieldAccessorImpl.java | 134 +++++++++ ...safeQualifiedBooleanFieldAccessorImpl.java | 142 ++++++++++ .../UnsafeQualifiedByteFieldAccessorImpl.java | 142 ++++++++++ ...feQualifiedCharacterFieldAccessorImpl.java | 142 ++++++++++ ...nsafeQualifiedDoubleFieldAccessorImpl.java | 166 +++++++++++ .../UnsafeQualifiedFieldAccessorImpl.java | 52 ++++ ...UnsafeQualifiedFloatFieldAccessorImpl.java | 162 +++++++++++ ...safeQualifiedIntegerFieldAccessorImpl.java | 154 ++++++++++ .../UnsafeQualifiedLongFieldAccessorImpl.java | 158 +++++++++++ ...nsafeQualifiedObjectFieldAccessorImpl.java | 136 +++++++++ ...UnsafeQualifiedShortFieldAccessorImpl.java | 146 ++++++++++ ...alifiedStaticBooleanFieldAccessorImpl.java | 139 +++++++++ ...eQualifiedStaticByteFieldAccessorImpl.java | 139 +++++++++ ...ifiedStaticCharacterFieldAccessorImpl.java | 139 +++++++++ ...ualifiedStaticDoubleFieldAccessorImpl.java | 163 +++++++++++ ...nsafeQualifiedStaticFieldAccessorImpl.java | 45 +++ ...QualifiedStaticFloatFieldAccessorImpl.java | 159 +++++++++++ ...alifiedStaticIntegerFieldAccessorImpl.java | 151 ++++++++++ ...eQualifiedStaticLongFieldAccessorImpl.java | 155 ++++++++++ ...ualifiedStaticObjectFieldAccessorImpl.java | 134 +++++++++ ...QualifiedStaticShortFieldAccessorImpl.java | 143 ++++++++++ .../reflect/UnsafeShortFieldAccessorImpl.java | 144 ++++++++++ .../UnsafeStaticBooleanFieldAccessorImpl.java | 137 +++++++++ .../UnsafeStaticByteFieldAccessorImpl.java | 137 +++++++++ ...nsafeStaticCharacterFieldAccessorImpl.java | 137 +++++++++ .../UnsafeStaticDoubleFieldAccessorImpl.java | 161 +++++++++++ .../UnsafeStaticFieldAccessorImpl.java | 50 ++++ .../UnsafeStaticFloatFieldAccessorImpl.java | 157 ++++++++++ .../UnsafeStaticIntegerFieldAccessorImpl.java | 149 ++++++++++ .../UnsafeStaticLongFieldAccessorImpl.java | 153 ++++++++++ .../UnsafeStaticObjectFieldAccessorImpl.java | 132 +++++++++ .../UnsafeStaticShortFieldAccessorImpl.java | 141 +++++++++ 42 files changed, 5901 insertions(+) create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java new file mode 100644 index 000000000000..baeb6bf89569 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +/** Package-private implementation of the FieldAccessor interface + which has access to all classes and all fields, regardless of + language restrictions. See MagicAccessorImpl. */ + +abstract class FieldAccessorImpl extends MagicAccessorImpl + implements FieldAccessor { + protected final Field field; + + FieldAccessorImpl(Field field) { + this.field = field; + } + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract Object get(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract boolean getBoolean(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract byte getByte(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract char getChar(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract short getShort(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract int getInt(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract long getLong(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract float getFloat(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract double getDouble(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field} */ + public abstract void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException; + + + protected void ensureObj(Object o) { + // NOTE: will throw NullPointerException, as specified, if o is null + if (!field.getDeclaringClass().isAssignableFrom(o.getClass())) { + throwSetIllegalArgumentException(o); + } + } + + protected String getQualifiedFieldName() { + return field.getDeclaringClass().getName() + "." +field.getName(); + } + + protected IllegalArgumentException newGetIllegalArgumentException(String type) { + return new IllegalArgumentException( + "Attempt to get "+field.getType().getName()+" field \"" + + getQualifiedFieldName() + "\" with illegal data type conversion to "+type + ); + } + + protected void throwFinalFieldIllegalAccessException(String attemptedType, + String attemptedValue) + throws IllegalAccessException { + throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue)); + } + + protected void throwFinalFieldIllegalAccessException(Object o) throws IllegalAccessException { + throwFinalFieldIllegalAccessException(o != null ? o.getClass().getName() : "", ""); + } + + protected void throwFinalFieldIllegalAccessException(boolean z) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("boolean", Boolean.toString(z)); + } + + protected void throwFinalFieldIllegalAccessException(char b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("char", Character.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(byte b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("byte", Byte.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(short b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("short", Short.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(int i) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("int", Integer.toString(i)); + } + + protected void throwFinalFieldIllegalAccessException(long i) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("long", Long.toString(i)); + } + + protected void throwFinalFieldIllegalAccessException(float f) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("float", Float.toString(f)); + } + + protected void throwFinalFieldIllegalAccessException(double f) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("double", Double.toString(f)); + } + + protected IllegalArgumentException newGetBooleanIllegalArgumentException() { + return newGetIllegalArgumentException("boolean"); + } + + protected IllegalArgumentException newGetByteIllegalArgumentException() { + return newGetIllegalArgumentException("byte"); + } + + protected IllegalArgumentException newGetCharIllegalArgumentException() { + return newGetIllegalArgumentException("char"); + } + + protected IllegalArgumentException newGetShortIllegalArgumentException() { + return newGetIllegalArgumentException("short"); + } + + protected IllegalArgumentException newGetIntIllegalArgumentException() { + return newGetIllegalArgumentException("int"); + } + + protected IllegalArgumentException newGetLongIllegalArgumentException() { + return newGetIllegalArgumentException("long"); + } + + protected IllegalArgumentException newGetFloatIllegalArgumentException() { + return newGetIllegalArgumentException("float"); + } + + protected IllegalArgumentException newGetDoubleIllegalArgumentException() { + return newGetIllegalArgumentException("double"); + } + + protected String getSetMessage(String attemptedType, String attemptedValue) { + String err = "Can not set"; + if (Modifier.isStatic(field.getModifiers())) + err += " static"; + if (Modifier.isFinal(field.getModifiers())) + err += " final"; + err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to "; + if (!attemptedValue.isEmpty()) { + err += "(" + attemptedType + ")" + attemptedValue; + } else { + if (!attemptedType.isEmpty()) + err += attemptedType; + else + err += "null value"; + } + return err; + } + + protected void throwSetIllegalArgumentException(String attemptedType, + String attemptedValue) { + throw new IllegalArgumentException(getSetMessage(attemptedType,attemptedValue)); + } + + protected void throwSetIllegalArgumentException(Object o) { + throwSetIllegalArgumentException(o != null ? o.getClass().getName() : "", ""); + } + + protected void throwSetIllegalArgumentException(boolean b) { + throwSetIllegalArgumentException("boolean", Boolean.toString(b)); + } + + protected void throwSetIllegalArgumentException(byte b) { + throwSetIllegalArgumentException("byte", Byte.toString(b)); + } + + protected void throwSetIllegalArgumentException(char c) { + throwSetIllegalArgumentException("char", Character.toString(c)); + } + + protected void throwSetIllegalArgumentException(short s) { + throwSetIllegalArgumentException("short", Short.toString(s)); + } + + protected void throwSetIllegalArgumentException(int i) { + throwSetIllegalArgumentException("int", Integer.toString(i)); + } + + protected void throwSetIllegalArgumentException(long l) { + throwSetIllegalArgumentException("long", Long.toString(l)); + } + + protected void throwSetIllegalArgumentException(float f) { + throwSetIllegalArgumentException("float", Float.toString(f)); + } + + protected void throwSetIllegalArgumentException(double d) { + throwSetIllegalArgumentException("double", Double.toString(d)); + } + +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java new file mode 100644 index 000000000000..32b33bed6253 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeBooleanFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeBooleanFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Boolean.valueOf(getBoolean(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getBoolean(obj, fieldOffset); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Boolean) { + unsafe.putBoolean(obj, fieldOffset, ((Boolean) value).booleanValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(z); + } + unsafe.putBoolean(obj, fieldOffset, z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java new file mode 100644 index 000000000000..df6a8be164bb --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeByteFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeByteFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Byte.valueOf(getByte(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getByte(obj, fieldOffset); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putByte(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(b); + } + unsafe.putByte(obj, fieldOffset, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java new file mode 100644 index 000000000000..4dcf0756eb1b --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeCharacterFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeCharacterFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Character.valueOf(getChar(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getChar(obj, fieldOffset); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Character) { + unsafe.putChar(obj, fieldOffset, ((Character) value).charValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(c); + } + unsafe.putChar(obj, fieldOffset, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java new file mode 100644 index 000000000000..17b7377c6f0b --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeDoubleFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeDoubleFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Double.valueOf(getDouble(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getDouble(obj, fieldOffset); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putDouble(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putDouble(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putDouble(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putDouble(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putDouble(obj, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putDouble(obj, fieldOffset, ((Float) value).floatValue()); + return; + } + if (value instanceof Double) { + unsafe.putDouble(obj, fieldOffset, ((Double) value).doubleValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(d); + } + unsafe.putDouble(obj, fieldOffset, d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java new file mode 100644 index 000000000000..d13043ce988c --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +class UnsafeFieldAccessorFactory { + static FieldAccessor newFieldAccessor(Field field, boolean isReadOnly) { + Class type = field.getType(); + boolean isStatic = Modifier.isStatic(field.getModifiers()); + boolean isFinal = Modifier.isFinal(field.getModifiers()); + boolean isVolatile = Modifier.isVolatile(field.getModifiers()); + boolean isQualified = isFinal || isVolatile; + if (isStatic) { + // This code path does not guarantee that the field's + // declaring class has been initialized, but it must be + // before performing reflective operations. + UnsafeFieldAccessorImpl.unsafe.ensureClassInitialized(field.getDeclaringClass()); + + if (!isQualified) { + if (type == Boolean.TYPE) { + return new UnsafeStaticBooleanFieldAccessorImpl(field); + } else if (type == Byte.TYPE) { + return new UnsafeStaticByteFieldAccessorImpl(field); + } else if (type == Short.TYPE) { + return new UnsafeStaticShortFieldAccessorImpl(field); + } else if (type == Character.TYPE) { + return new UnsafeStaticCharacterFieldAccessorImpl(field); + } else if (type == Integer.TYPE) { + return new UnsafeStaticIntegerFieldAccessorImpl(field); + } else if (type == Long.TYPE) { + return new UnsafeStaticLongFieldAccessorImpl(field); + } else if (type == Float.TYPE) { + return new UnsafeStaticFloatFieldAccessorImpl(field); + } else if (type == Double.TYPE) { + return new UnsafeStaticDoubleFieldAccessorImpl(field); + } else { + return new UnsafeStaticObjectFieldAccessorImpl(field); + } + } else { + if (type == Boolean.TYPE) { + return new UnsafeQualifiedStaticBooleanFieldAccessorImpl(field, isReadOnly); + } else if (type == Byte.TYPE) { + return new UnsafeQualifiedStaticByteFieldAccessorImpl(field, isReadOnly); + } else if (type == Short.TYPE) { + return new UnsafeQualifiedStaticShortFieldAccessorImpl(field, isReadOnly); + } else if (type == Character.TYPE) { + return new UnsafeQualifiedStaticCharacterFieldAccessorImpl(field, isReadOnly); + } else if (type == Integer.TYPE) { + return new UnsafeQualifiedStaticIntegerFieldAccessorImpl(field, isReadOnly); + } else if (type == Long.TYPE) { + return new UnsafeQualifiedStaticLongFieldAccessorImpl(field, isReadOnly); + } else if (type == Float.TYPE) { + return new UnsafeQualifiedStaticFloatFieldAccessorImpl(field, isReadOnly); + } else if (type == Double.TYPE) { + return new UnsafeQualifiedStaticDoubleFieldAccessorImpl(field, isReadOnly); + } else { + return new UnsafeQualifiedStaticObjectFieldAccessorImpl(field, isReadOnly); + } + } + } else { + if (!isQualified) { + if (type == Boolean.TYPE) { + return new UnsafeBooleanFieldAccessorImpl(field); + } else if (type == Byte.TYPE) { + return new UnsafeByteFieldAccessorImpl(field); + } else if (type == Short.TYPE) { + return new UnsafeShortFieldAccessorImpl(field); + } else if (type == Character.TYPE) { + return new UnsafeCharacterFieldAccessorImpl(field); + } else if (type == Integer.TYPE) { + return new UnsafeIntegerFieldAccessorImpl(field); + } else if (type == Long.TYPE) { + return new UnsafeLongFieldAccessorImpl(field); + } else if (type == Float.TYPE) { + return new UnsafeFloatFieldAccessorImpl(field); + } else if (type == Double.TYPE) { + return new UnsafeDoubleFieldAccessorImpl(field); + } else { + return new UnsafeObjectFieldAccessorImpl(field); + } + } else { + if (type == Boolean.TYPE) { + return new UnsafeQualifiedBooleanFieldAccessorImpl(field, isReadOnly); + } else if (type == Byte.TYPE) { + return new UnsafeQualifiedByteFieldAccessorImpl(field, isReadOnly); + } else if (type == Short.TYPE) { + return new UnsafeQualifiedShortFieldAccessorImpl(field, isReadOnly); + } else if (type == Character.TYPE) { + return new UnsafeQualifiedCharacterFieldAccessorImpl(field, isReadOnly); + } else if (type == Integer.TYPE) { + return new UnsafeQualifiedIntegerFieldAccessorImpl(field, isReadOnly); + } else if (type == Long.TYPE) { + return new UnsafeQualifiedLongFieldAccessorImpl(field, isReadOnly); + } else if (type == Float.TYPE) { + return new UnsafeQualifiedFloatFieldAccessorImpl(field, isReadOnly); + } else if (type == Double.TYPE) { + return new UnsafeQualifiedDoubleFieldAccessorImpl(field, isReadOnly); + } else { + return new UnsafeQualifiedObjectFieldAccessorImpl(field, isReadOnly); + } + } + } + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java new file mode 100644 index 000000000000..683ecf2b5f0d --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import jdk.internal.misc.Unsafe; + +/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors. The + observation is that there are only nine types of fields from the + standpoint of reflection code: the eight primitive types and + Object. Using class Unsafe instead of generated bytecodes saves + memory and loading time for the dynamically-generated + FieldAccessors. */ + +abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl { + static final Unsafe unsafe = Unsafe.getUnsafe(); + + protected final long fieldOffset; + protected final boolean isFinal; + + UnsafeFieldAccessorImpl(Field field) { + super(field); + int mods = field.getModifiers(); + this.isFinal = Modifier.isFinal(mods); + if (Modifier.isStatic(mods)) + fieldOffset = unsafe.staticFieldOffset(field); + else + fieldOffset = unsafe.objectFieldOffset(field); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java new file mode 100644 index 000000000000..690fe8f49656 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeFloatFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeFloatFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Float.valueOf(getFloat(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getFloat(obj, fieldOffset); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getFloat(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putFloat(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putFloat(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putFloat(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putFloat(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putFloat(obj, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putFloat(obj, fieldOffset, ((Float) value).floatValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(f); + } + unsafe.putFloat(obj, fieldOffset, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java new file mode 100644 index 000000000000..c0993abeb23c --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeIntegerFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeIntegerFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Integer.valueOf(getInt(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getInt(obj, fieldOffset); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putInt(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putInt(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putInt(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putInt(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(i); + } + unsafe.putInt(obj, fieldOffset, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java new file mode 100644 index 000000000000..d92023dc0796 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeLongFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Long.valueOf(getLong(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getLong(obj, fieldOffset); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putLong(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putLong(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putLong(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putLong(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putLong(obj, fieldOffset, ((Long) value).longValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(l); + } + unsafe.putLong(obj, fieldOffset, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java new file mode 100644 index 000000000000..0b267d86a15f --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeObjectFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getReference(obj, fieldOffset); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value != null) { + if (!field.getType().isInstance(value)) { + throwSetIllegalArgumentException(value); + } + } + unsafe.putReference(obj, fieldOffset, value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java new file mode 100644 index 000000000000..5144a8fbd797 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedBooleanFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedBooleanFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Boolean.valueOf(getBoolean(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getBooleanVolatile(obj, fieldOffset); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Boolean) { + unsafe.putBooleanVolatile(obj, fieldOffset, ((Boolean) value).booleanValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(z); + } + unsafe.putBooleanVolatile(obj, fieldOffset, z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java new file mode 100644 index 000000000000..7cd87931a52b --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedByteFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedByteFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Byte.valueOf(getByte(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getByteVolatile(obj, fieldOffset); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putByteVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(b); + } + unsafe.putByteVolatile(obj, fieldOffset, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java new file mode 100644 index 000000000000..634f6abe0d25 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedCharacterFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedCharacterFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Character.valueOf(getChar(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getCharVolatile(obj, fieldOffset); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Character) { + unsafe.putCharVolatile(obj, fieldOffset, ((Character) value).charValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(c); + } + unsafe.putCharVolatile(obj, fieldOffset, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java new file mode 100644 index 000000000000..48b59ca72515 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedDoubleFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedDoubleFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Double.valueOf(getDouble(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getDoubleVolatile(obj, fieldOffset); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Float) value).floatValue()); + return; + } + if (value instanceof Double) { + unsafe.putDoubleVolatile(obj, fieldOffset, ((Double) value).doubleValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(d); + } + unsafe.putDoubleVolatile(obj, fieldOffset, d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java new file mode 100644 index 000000000000..fcfa9f16b004 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import jdk.internal.misc.Unsafe; + +/** + * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for fields with + * final or volatile qualifiers. These differ from unqualified + * versions in that (1) they check for read-only status (2) they use + * the volatile forms of Unsafe get/put methods. (When accessed via + * reflection, finals act as slightly "lighter" forms of volatiles. So + * the volatile forms are heavier than necessary in terms of + * underlying reordering rules and memory barriers, but preserve + * correctness.) + */ + +abstract class UnsafeQualifiedFieldAccessorImpl + extends UnsafeFieldAccessorImpl +{ + protected final boolean isReadOnly; + + UnsafeQualifiedFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field); + this.isReadOnly = isReadOnly; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java new file mode 100644 index 000000000000..9b44e1379a03 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedFloatFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedFloatFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Float.valueOf(getFloat(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getFloatVolatile(obj, fieldOffset); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getFloat(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putFloatVolatile(obj, fieldOffset, ((Float) value).floatValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(f); + } + unsafe.putFloatVolatile(obj, fieldOffset, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java new file mode 100644 index 000000000000..f960425638d6 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedIntegerFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedIntegerFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Integer.valueOf(getInt(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getIntVolatile(obj, fieldOffset); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putIntVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putIntVolatile(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putIntVolatile(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putIntVolatile(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(i); + } + unsafe.putIntVolatile(obj, fieldOffset, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java new file mode 100644 index 000000000000..25434e84f004 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedLongFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedLongFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Long.valueOf(getLong(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getLongVolatile(obj, fieldOffset); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putLongVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putLongVolatile(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putLongVolatile(obj, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putLongVolatile(obj, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putLongVolatile(obj, fieldOffset, ((Long) value).longValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(l); + } + unsafe.putLongVolatile(obj, fieldOffset, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java new file mode 100644 index 000000000000..da95cb3bbf1b --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedObjectFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedObjectFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getReferenceVolatile(obj, fieldOffset); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value != null) { + if (!field.getType().isInstance(value)) { + throwSetIllegalArgumentException(value); + } + } + unsafe.putReferenceVolatile(obj, fieldOffset, value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java new file mode 100644 index 000000000000..1e68e3dad98a --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedShortFieldAccessorImpl + extends UnsafeQualifiedFieldAccessorImpl +{ + UnsafeQualifiedShortFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Short.valueOf(getShort(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getShortVolatile(obj, fieldOffset); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putShortVolatile(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putShortVolatile(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setShort(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isReadOnly) { + throwFinalFieldIllegalAccessException(s); + } + unsafe.putShortVolatile(obj, fieldOffset, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java new file mode 100644 index 000000000000..67d982809386 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticBooleanFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticBooleanFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Boolean.valueOf(getBoolean(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + return unsafe.getBooleanVolatile(base, fieldOffset); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Boolean) { + unsafe.putBooleanVolatile(base, fieldOffset, ((Boolean) value).booleanValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(z); + } + unsafe.putBooleanVolatile(base, fieldOffset, z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java new file mode 100644 index 000000000000..93ffb209a3a0 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticByteFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticByteFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Byte.valueOf(getByte(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + return unsafe.getByteVolatile(base, fieldOffset); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putByteVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(b); + } + unsafe.putByteVolatile(base, fieldOffset, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java new file mode 100644 index 000000000000..8c9cfe03e41c --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticCharacterFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticCharacterFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Character.valueOf(getChar(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + return unsafe.getCharVolatile(base, fieldOffset); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Character) { + unsafe.putCharVolatile(base, fieldOffset, ((Character) value).charValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(c); + } + unsafe.putCharVolatile(base, fieldOffset, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java new file mode 100644 index 000000000000..5178d639961d --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticDoubleFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticDoubleFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Double.valueOf(getDouble(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return unsafe.getDoubleVolatile(base, fieldOffset); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Float) value).floatValue()); + return; + } + if (value instanceof Double) { + unsafe.putDoubleVolatile(base, fieldOffset, ((Double) value).doubleValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(d); + } + unsafe.putDoubleVolatile(base, fieldOffset, d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java new file mode 100644 index 000000000000..c086fc3d3e9f --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.security.AccessController; +import jdk.internal.misc.Unsafe; + +/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for final or + static volatile fields. */ + +abstract class UnsafeQualifiedStaticFieldAccessorImpl + extends UnsafeStaticFieldAccessorImpl +{ + protected final boolean isReadOnly; + + UnsafeQualifiedStaticFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field); + this.isReadOnly = isReadOnly; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java new file mode 100644 index 000000000000..410a99cd1689 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticFloatFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticFloatFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Float.valueOf(getFloat(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return unsafe.getFloatVolatile(base, fieldOffset); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getFloat(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putFloatVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putFloatVolatile(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putFloatVolatile(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putFloatVolatile(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putFloatVolatile(base, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putFloatVolatile(base, fieldOffset, ((Float) value).floatValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(f); + } + unsafe.putFloatVolatile(base, fieldOffset, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java new file mode 100644 index 000000000000..1411f364b5b2 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticIntegerFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticIntegerFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Integer.valueOf(getInt(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return unsafe.getIntVolatile(base, fieldOffset); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putIntVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putIntVolatile(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putIntVolatile(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putIntVolatile(base, fieldOffset, ((Integer) value).intValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(i); + } + unsafe.putIntVolatile(base, fieldOffset, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java new file mode 100644 index 000000000000..dc357e1f0053 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticLongFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticLongFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Long.valueOf(getLong(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return unsafe.getLongVolatile(base, fieldOffset); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putLongVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putLongVolatile(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putLongVolatile(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putLongVolatile(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putLongVolatile(base, fieldOffset, ((Long) value).longValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(l); + } + unsafe.putLongVolatile(base, fieldOffset, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java new file mode 100644 index 000000000000..ed4ba40450d4 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticObjectFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticObjectFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return unsafe.getReferenceVolatile(base, fieldOffset); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value != null) { + if (!field.getType().isInstance(value)) { + throwSetIllegalArgumentException(value); + } + } + unsafe.putReferenceVolatile(base, fieldOffset, value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java new file mode 100644 index 000000000000..632850544972 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeQualifiedStaticShortFieldAccessorImpl + extends UnsafeQualifiedStaticFieldAccessorImpl +{ + UnsafeQualifiedStaticShortFieldAccessorImpl(Field field, boolean isReadOnly) { + super(field, isReadOnly); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Short.valueOf(getShort(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return unsafe.getShortVolatile(base, fieldOffset); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putShortVolatile(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putShortVolatile(base, fieldOffset, ((Short) value).shortValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setShort(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + if (isReadOnly) { + throwFinalFieldIllegalAccessException(s); + } + unsafe.putShortVolatile(base, fieldOffset, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java new file mode 100644 index 000000000000..d864fb4b8557 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeShortFieldAccessorImpl extends UnsafeFieldAccessorImpl { + UnsafeShortFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Short.valueOf(getShort(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + ensureObj(obj); + return unsafe.getShort(obj, fieldOffset); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putShort(obj, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putShort(obj, fieldOffset, ((Short) value).shortValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setShort(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + ensureObj(obj); + if (isFinal) { + throwFinalFieldIllegalAccessException(s); + } + unsafe.putShort(obj, fieldOffset, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java new file mode 100644 index 000000000000..26bb655cbead --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticBooleanFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticBooleanFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Boolean.valueOf(getBoolean(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + return unsafe.getBoolean(base, fieldOffset); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Boolean) { + unsafe.putBoolean(base, fieldOffset, ((Boolean) value).booleanValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(z); + } + unsafe.putBoolean(base, fieldOffset, z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java new file mode 100644 index 000000000000..c3e93ee38bbd --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticByteFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticByteFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Byte.valueOf(getByte(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + return unsafe.getByte(base, fieldOffset); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getByte(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putByte(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(b); + } + unsafe.putByte(base, fieldOffset, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java new file mode 100644 index 000000000000..7f2acd4e99c5 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticCharacterFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticCharacterFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Character.valueOf(getChar(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + return unsafe.getChar(base, fieldOffset); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getChar(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Character) { + unsafe.putChar(base, fieldOffset, ((Character) value).charValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(c); + } + unsafe.putChar(base, fieldOffset, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java new file mode 100644 index 000000000000..1f010ad9832e --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticDoubleFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticDoubleFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Double.valueOf(getDouble(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return unsafe.getDouble(base, fieldOffset); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putDouble(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putDouble(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putDouble(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putDouble(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putDouble(base, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putDouble(base, fieldOffset, ((Float) value).floatValue()); + return; + } + if (value instanceof Double) { + unsafe.putDouble(base, fieldOffset, ((Double) value).doubleValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + setDouble(obj, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(d); + } + unsafe.putDouble(base, fieldOffset, d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java new file mode 100644 index 000000000000..a52eae4edae3 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; +import java.util.Set; + +/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for static + fields. The observation is that there are only nine types of + fields from the standpoint of reflection code: the eight primitive + types and Object. Using class Unsafe instead of generated + bytecodes saves memory and loading time for the + dynamically-generated FieldAccessors. */ + +abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl { + static { + Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class, + Set.of("base")); + } + + protected final Object base; // base + + UnsafeStaticFieldAccessorImpl(Field field) { + super(field); + base = unsafe.staticFieldBase(field); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java new file mode 100644 index 000000000000..10ba9cdef393 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticFloatFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticFloatFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Float.valueOf(getFloat(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return unsafe.getFloat(base, fieldOffset); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getFloat(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putFloat(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putFloat(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putFloat(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putFloat(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putFloat(base, fieldOffset, ((Long) value).longValue()); + return; + } + if (value instanceof Float) { + unsafe.putFloat(base, fieldOffset, ((Float) value).floatValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + setFloat(obj, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(f); + } + unsafe.putFloat(base, fieldOffset, f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java new file mode 100644 index 000000000000..f6ae4e156508 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticIntegerFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticIntegerFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Integer.valueOf(getInt(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return unsafe.getInt(base, fieldOffset); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getInt(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putInt(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putInt(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putInt(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putInt(base, fieldOffset, ((Integer) value).intValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setInt(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(i); + } + unsafe.putInt(base, fieldOffset, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java new file mode 100644 index 000000000000..a1d086b1931c --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticLongFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticLongFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Long.valueOf(getLong(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return unsafe.getLong(base, fieldOffset); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getLong(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putLong(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putLong(base, fieldOffset, ((Short) value).shortValue()); + return; + } + if (value instanceof Character) { + unsafe.putLong(base, fieldOffset, ((Character) value).charValue()); + return; + } + if (value instanceof Integer) { + unsafe.putLong(base, fieldOffset, ((Integer) value).intValue()); + return; + } + if (value instanceof Long) { + unsafe.putLong(base, fieldOffset, ((Long) value).longValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + setLong(obj, i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(l); + } + unsafe.putLong(base, fieldOffset, l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java new file mode 100644 index 000000000000..bf9bf6b0dbdf --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticObjectFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return unsafe.getReference(base, fieldOffset); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + throw newGetShortIllegalArgumentException(); + } + + public int getInt(Object obj) throws IllegalArgumentException { + throw newGetIntIllegalArgumentException(); + } + + public long getLong(Object obj) throws IllegalArgumentException { + throw newGetLongIllegalArgumentException(); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + throw newGetFloatIllegalArgumentException(); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + throw newGetDoubleIllegalArgumentException(); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value != null) { + if (!field.getType().isInstance(value)) { + throwSetIllegalArgumentException(value); + } + } + unsafe.putReference(base, fieldOffset, value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java new file mode 100644 index 000000000000..8e17a6f4ff17 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.reflect; + +import java.lang.reflect.Field; + +class UnsafeStaticShortFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { + UnsafeStaticShortFieldAccessorImpl(Field field) { + super(field); + } + + public Object get(Object obj) throws IllegalArgumentException { + return Short.valueOf(getShort(obj)); + } + + public boolean getBoolean(Object obj) throws IllegalArgumentException { + throw newGetBooleanIllegalArgumentException(); + } + + public byte getByte(Object obj) throws IllegalArgumentException { + throw newGetByteIllegalArgumentException(); + } + + public char getChar(Object obj) throws IllegalArgumentException { + throw newGetCharIllegalArgumentException(); + } + + public short getShort(Object obj) throws IllegalArgumentException { + return unsafe.getShort(base, fieldOffset); + } + + public int getInt(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public long getLong(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public float getFloat(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public double getDouble(Object obj) throws IllegalArgumentException { + return getShort(obj); + } + + public void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(value); + } + if (value == null) { + throwSetIllegalArgumentException(value); + } + if (value instanceof Byte) { + unsafe.putShort(base, fieldOffset, ((Byte) value).byteValue()); + return; + } + if (value instanceof Short) { + unsafe.putShort(base, fieldOffset, ((Short) value).shortValue()); + return; + } + throwSetIllegalArgumentException(value); + } + + public void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(z); + } + + public void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException + { + setShort(obj, b); + } + + public void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(c); + } + + public void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException + { + if (isFinal) { + throwFinalFieldIllegalAccessException(s); + } + unsafe.putShort(base, fieldOffset, s); + } + + public void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(i); + } + + public void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(l); + } + + public void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(f); + } + + public void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException + { + throwSetIllegalArgumentException(d); + } +} From 049272d26b1f0865883e819a4eae57e40571a584 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 21 Jun 2023 11:13:30 +0200 Subject: [PATCH 02/11] svm: use UnsafeFieldAccessorFactory [GR-46732] --- .../com/oracle/svm/core/hub/DynamicHub.java | 26 +++++++++++++------ .../svm/core/reflect/FieldAccessorImpl.java | 7 ++--- .../UnsafeBooleanFieldAccessorImpl.java | 2 +- .../reflect/UnsafeByteFieldAccessorImpl.java | 2 +- .../UnsafeCharacterFieldAccessorImpl.java | 2 +- .../UnsafeDoubleFieldAccessorImpl.java | 2 +- .../reflect/UnsafeFieldAccessorFactory.java | 8 +++--- .../core/reflect/UnsafeFieldAccessorImpl.java | 2 +- .../reflect/UnsafeFloatFieldAccessorImpl.java | 2 +- .../UnsafeIntegerFieldAccessorImpl.java | 2 +- .../reflect/UnsafeLongFieldAccessorImpl.java | 2 +- .../UnsafeObjectFieldAccessorImpl.java | 2 +- ...safeQualifiedBooleanFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedByteFieldAccessorImpl.java | 2 +- ...feQualifiedCharacterFieldAccessorImpl.java | 2 +- ...nsafeQualifiedDoubleFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedFieldAccessorImpl.java | 2 +- ...UnsafeQualifiedFloatFieldAccessorImpl.java | 2 +- ...safeQualifiedIntegerFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedLongFieldAccessorImpl.java | 2 +- ...nsafeQualifiedObjectFieldAccessorImpl.java | 2 +- ...UnsafeQualifiedShortFieldAccessorImpl.java | 2 +- ...alifiedStaticBooleanFieldAccessorImpl.java | 2 +- ...eQualifiedStaticByteFieldAccessorImpl.java | 2 +- ...ifiedStaticCharacterFieldAccessorImpl.java | 2 +- ...ualifiedStaticDoubleFieldAccessorImpl.java | 2 +- ...nsafeQualifiedStaticFieldAccessorImpl.java | 2 +- ...QualifiedStaticFloatFieldAccessorImpl.java | 2 +- ...alifiedStaticIntegerFieldAccessorImpl.java | 2 +- ...eQualifiedStaticLongFieldAccessorImpl.java | 2 +- ...ualifiedStaticObjectFieldAccessorImpl.java | 2 +- ...QualifiedStaticShortFieldAccessorImpl.java | 2 +- .../reflect/UnsafeShortFieldAccessorImpl.java | 2 +- .../UnsafeStaticBooleanFieldAccessorImpl.java | 2 +- .../UnsafeStaticByteFieldAccessorImpl.java | 2 +- ...nsafeStaticCharacterFieldAccessorImpl.java | 2 +- .../UnsafeStaticDoubleFieldAccessorImpl.java | 2 +- .../UnsafeStaticFieldAccessorImpl.java | 6 ++--- .../UnsafeStaticFloatFieldAccessorImpl.java | 2 +- .../UnsafeStaticIntegerFieldAccessorImpl.java | 2 +- .../UnsafeStaticLongFieldAccessorImpl.java | 2 +- .../UnsafeStaticObjectFieldAccessorImpl.java | 2 +- .../UnsafeStaticShortFieldAccessorImpl.java | 2 +- 43 files changed, 69 insertions(+), 56 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java index f3b3e7cc1b00..3910d2d81281 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java @@ -72,6 +72,9 @@ import java.util.Optional; import java.util.StringJoiner; +import com.oracle.svm.core.reflect.UnsafeFieldAccessorFactory; +import jdk.internal.access.JavaLangReflectAccess; +import jdk.internal.reflect.FieldAccessor; import org.graalvm.compiler.core.common.NumUtil; import org.graalvm.compiler.core.common.SuppressFBWarnings; import org.graalvm.nativeimage.AnnotationAccess; @@ -1881,6 +1884,9 @@ final class Target_jdk_internal_reflect_ReflectionFactory { @Alias // private static ReflectionFactory soleInstance; + @Alias // + private JavaLangReflectAccess langReflectAccess; + /** * This substitution eliminates the SecurityManager check in the original method, which would * make some build-time verifications fail. @@ -1890,15 +1896,19 @@ public static ReflectionFactory getReflectionFactory() { return soleInstance; } - /** - * Do not use the field handle based field accessor but the one based on unsafe. It takes effect - * when {@code Target_java_lang_reflect_Field#fieldAccessorField#fieldAccessor} is recomputed at - * runtime. See also GR-39586. - */ - @TargetElement(onlyWith = JDK19OrLater.class) @Substitute - static boolean useFieldHandleAccessor() { - return false; + public FieldAccessor newFieldAccessor(Field field, boolean override) { + Field root = langReflectAccess.getRoot(field); + if (root != null) { + // FieldAccessor will use the root unless the modifiers have + // been overridden + if (root.getModifiers() == field.getModifiers() || !override) { + field = root; + } + } + boolean isFinal = Modifier.isFinal(field.getModifiers()); + boolean isReadOnly = isFinal && (!override || langReflectAccess.isTrustedFinalField(field)); + return UnsafeFieldAccessorFactory.newFieldAccessor(field, isReadOnly); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java index baeb6bf89569..9afcc93fdc4c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -23,7 +23,9 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; + +import jdk.internal.reflect.FieldAccessor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -32,8 +34,7 @@ which has access to all classes and all fields, regardless of language restrictions. See MagicAccessorImpl. */ -abstract class FieldAccessorImpl extends MagicAccessorImpl - implements FieldAccessor { +abstract class FieldAccessorImpl implements FieldAccessor { protected final Field field; FieldAccessorImpl(Field field) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java index 32b33bed6253..68d1319139e7 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java index df6a8be164bb..b4390378fc0c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java index 4dcf0756eb1b..a71ac432f87f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java index 17b7377c6f0b..b3186353cec0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java index d13043ce988c..e174474262af 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java @@ -23,13 +23,15 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; + +import jdk.internal.reflect.FieldAccessor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -class UnsafeFieldAccessorFactory { - static FieldAccessor newFieldAccessor(Field field, boolean isReadOnly) { +public class UnsafeFieldAccessorFactory { + public static FieldAccessor newFieldAccessor(Field field, boolean isReadOnly) { Class type = field.getType(); boolean isStatic = Modifier.isStatic(field.getModifiers()); boolean isFinal = Modifier.isFinal(field.getModifiers()); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java index 683ecf2b5f0d..1ea7b1281749 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java index 690fe8f49656..ed1be36b332d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java index c0993abeb23c..0692c73f107c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java index d92023dc0796..734e2d649858 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java index 0b267d86a15f..097ecdc23b4b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java index 5144a8fbd797..459e678b7992 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java index 7cd87931a52b..7e1a728a26d5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java index 634f6abe0d25..2cfc4cd1f35e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java index 48b59ca72515..d7c7ae3de812 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java index fcfa9f16b004..7a0f28a3daa8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java index 9b44e1379a03..c44a5c928075 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java index f960425638d6..2d963a6e5463 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java index 25434e84f004..bff000139826 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java index da95cb3bbf1b..6ea1b8c3d73a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java index 1e68e3dad98a..a2de71ce79bd 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java index 67d982809386..de94aa8e708c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java index 93ffb209a3a0..387666b59ea9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java index 8c9cfe03e41c..a569aaa0ed19 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java index 5178d639961d..0f66126346b4 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java index c086fc3d3e9f..24056e0d0c57 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java index 410a99cd1689..749a5fb30ddd 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java index 1411f364b5b2..f5ac15ab7282 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java index dc357e1f0053..9d3c8af9e3d3 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java index ed4ba40450d4..d5a6837da474 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java index 632850544972..0995bea5f338 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java index d864fb4b8557..243863100511 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java index 26bb655cbead..b50b8f2dc9ef 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java index c3e93ee38bbd..ab2ac0adf3fd 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java index 7f2acd4e99c5..acba3afabd8c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java index 1f010ad9832e..af7a6b8bd87c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java index a52eae4edae3..b0ca275d096f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; import java.util.Set; @@ -37,8 +37,8 @@ abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl { static { - Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class, - Set.of("base")); +// Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class, +// Set.of("base")); } protected final Object base; // base diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java index 10ba9cdef393..110b84548f90 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java index f6ae4e156508..cb86faa0dca2 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java index a1d086b1931c..5459b058aede 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java index bf9bf6b0dbdf..02d5948f9848 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java index 8e17a6f4ff17..47d46952c45a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.internal.reflect; +package com.oracle.svm.core.reflect; import java.lang.reflect.Field; From a7e2ad8bd6390e9a3e9ef7711fe14d13319becbd Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 21 Jun 2023 12:36:51 +0200 Subject: [PATCH 03/11] svm: UnsafeFieldAccessorFactory fix missing @Override --- .../com/oracle/svm/core/hub/DynamicHub.java | 3 ++- .../svm/core/reflect/FieldAccessorImpl.java | 22 +++++++++++++++++-- .../UnsafeBooleanFieldAccessorImpl.java | 18 +++++++++++++++ .../reflect/UnsafeByteFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeCharacterFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeDoubleFieldAccessorImpl.java | 18 +++++++++++++++ .../reflect/UnsafeFloatFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeIntegerFieldAccessorImpl.java | 18 +++++++++++++++ .../reflect/UnsafeLongFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeObjectFieldAccessorImpl.java | 18 +++++++++++++++ ...safeQualifiedBooleanFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeQualifiedByteFieldAccessorImpl.java | 18 +++++++++++++++ ...feQualifiedCharacterFieldAccessorImpl.java | 18 +++++++++++++++ ...nsafeQualifiedDoubleFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeQualifiedFieldAccessorImpl.java | 2 -- ...UnsafeQualifiedFloatFieldAccessorImpl.java | 18 +++++++++++++++ ...safeQualifiedIntegerFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeQualifiedLongFieldAccessorImpl.java | 18 +++++++++++++++ ...nsafeQualifiedObjectFieldAccessorImpl.java | 18 +++++++++++++++ ...UnsafeQualifiedShortFieldAccessorImpl.java | 18 +++++++++++++++ ...alifiedStaticBooleanFieldAccessorImpl.java | 18 +++++++++++++++ ...eQualifiedStaticByteFieldAccessorImpl.java | 18 +++++++++++++++ ...ifiedStaticCharacterFieldAccessorImpl.java | 18 +++++++++++++++ ...ualifiedStaticDoubleFieldAccessorImpl.java | 18 +++++++++++++++ ...nsafeQualifiedStaticFieldAccessorImpl.java | 3 --- ...QualifiedStaticFloatFieldAccessorImpl.java | 18 +++++++++++++++ ...alifiedStaticIntegerFieldAccessorImpl.java | 18 +++++++++++++++ ...eQualifiedStaticLongFieldAccessorImpl.java | 18 +++++++++++++++ ...ualifiedStaticObjectFieldAccessorImpl.java | 18 +++++++++++++++ ...QualifiedStaticShortFieldAccessorImpl.java | 18 +++++++++++++++ .../reflect/UnsafeShortFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticBooleanFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticByteFieldAccessorImpl.java | 18 +++++++++++++++ ...nsafeStaticCharacterFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticDoubleFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticFieldAccessorImpl.java | 1 - .../UnsafeStaticFloatFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticIntegerFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticLongFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticObjectFieldAccessorImpl.java | 18 +++++++++++++++ .../UnsafeStaticShortFieldAccessorImpl.java | 18 +++++++++++++++ 41 files changed, 670 insertions(+), 9 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java index 3910d2d81281..258287a7eb43 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java @@ -1897,7 +1897,8 @@ public static ReflectionFactory getReflectionFactory() { } @Substitute - public FieldAccessor newFieldAccessor(Field field, boolean override) { + public FieldAccessor newFieldAccessor(Field field0, boolean override) { + Field field = field0; Field root = langReflectAccess.getRoot(field); if (root != null) { // FieldAccessor will use the root unless the modifiers have diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java index 9afcc93fdc4c..e5e41d145115 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -25,11 +25,11 @@ package com.oracle.svm.core.reflect; -import jdk.internal.reflect.FieldAccessor; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import jdk.internal.reflect.FieldAccessor; + /** Package-private implementation of the FieldAccessor interface which has access to all classes and all fields, regardless of language restrictions. See MagicAccessorImpl. */ @@ -42,74 +42,92 @@ abstract class FieldAccessorImpl implements FieldAccessor { } /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract Object get(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract boolean getBoolean(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract byte getByte(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract char getChar(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract short getShort(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract int getInt(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract long getLong(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract float getFloat(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract double getDouble(Object obj) throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ + @Override public abstract void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java index 68d1319139e7..38d8cea45832 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeBooleanFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Boolean.valueOf(getBoolean(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getBoolean(obj, fieldOffset); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,6 +96,7 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { @@ -96,42 +107,49 @@ public void setBoolean(Object obj, boolean z) unsafe.putBoolean(obj, fieldOffset, z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java index b4390378fc0c..eb33f54bde88 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeByteFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Byte.valueOf(getByte(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getByte(obj, fieldOffset); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,12 +96,14 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { @@ -102,36 +114,42 @@ public void setByte(Object obj, byte b) unsafe.putByte(obj, fieldOffset, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java index a71ac432f87f..4c4d94bf7088 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeCharacterFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Character.valueOf(getChar(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getChar(obj, fieldOffset); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,18 +96,21 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { @@ -108,30 +121,35 @@ public void setChar(Object obj, char c) unsafe.putChar(obj, fieldOffset, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java index b3186353cec0..cfd85615debf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeDoubleFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Double.valueOf(getDouble(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getDouble(obj, fieldOffset); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -110,48 +120,56 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java index ed1be36b332d..c131751f8cba 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeFloatFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Float.valueOf(getFloat(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getFloat(obj, fieldOffset); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getFloat(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -106,42 +116,49 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { @@ -152,6 +169,7 @@ public void setFloat(Object obj, float f) unsafe.putFloat(obj, fieldOffset, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java index 0692c73f107c..1c67d678087c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeIntegerFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Integer.valueOf(getInt(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getInt(obj, fieldOffset); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -98,30 +108,35 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { @@ -132,18 +147,21 @@ public void setInt(Object obj, int i) unsafe.putInt(obj, fieldOffset, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java index 734e2d649858..6c4032ae244d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Long.valueOf(getLong(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getLong(obj, fieldOffset); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -102,36 +112,42 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { @@ -142,12 +158,14 @@ public void setLong(Object obj, long l) unsafe.putLong(obj, fieldOffset, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java index 097ecdc23b4b..dc550be8c859 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getReference(obj, fieldOffset); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -84,48 +94,56 @@ public void set(Object obj, Object value) unsafe.putReference(obj, fieldOffset, value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java index 459e678b7992..637380360be8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedBooleanFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Boolean.valueOf(getBoolean(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getBooleanVolatile(obj, fieldOffset); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -88,6 +98,7 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { @@ -98,42 +109,49 @@ public void setBoolean(Object obj, boolean z) unsafe.putBooleanVolatile(obj, fieldOffset, z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java index 7e1a728a26d5..959395ce353a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedByteFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Byte.valueOf(getByte(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getByteVolatile(obj, fieldOffset); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -88,12 +98,14 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { @@ -104,36 +116,42 @@ public void setByte(Object obj, byte b) unsafe.putByteVolatile(obj, fieldOffset, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java index 2cfc4cd1f35e..34fda6d1fe68 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedCharacterFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Character.valueOf(getChar(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getCharVolatile(obj, fieldOffset); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -88,18 +98,21 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { @@ -110,30 +123,35 @@ public void setChar(Object obj, char c) unsafe.putCharVolatile(obj, fieldOffset, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java index d7c7ae3de812..d851321726b5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedDoubleFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Double.valueOf(getDouble(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getDoubleVolatile(obj, fieldOffset); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -112,48 +122,56 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java index 7a0f28a3daa8..fb51214ef4a6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -26,8 +26,6 @@ package com.oracle.svm.core.reflect; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import jdk.internal.misc.Unsafe; /** * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for fields with diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java index c44a5c928075..12021b06a9ca 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedFloatFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Float.valueOf(getFloat(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getFloatVolatile(obj, fieldOffset); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getFloat(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -108,42 +118,49 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { @@ -154,6 +171,7 @@ public void setFloat(Object obj, float f) unsafe.putFloatVolatile(obj, fieldOffset, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java index 2d963a6e5463..79627841cc65 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedIntegerFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Integer.valueOf(getInt(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getIntVolatile(obj, fieldOffset); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -100,30 +110,35 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { @@ -134,18 +149,21 @@ public void setInt(Object obj, int i) unsafe.putIntVolatile(obj, fieldOffset, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java index bff000139826..5c4071247e3c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedLongFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Long.valueOf(getLong(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getLongVolatile(obj, fieldOffset); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -104,36 +114,42 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { @@ -144,12 +160,14 @@ public void setLong(Object obj, long l) unsafe.putLongVolatile(obj, fieldOffset, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java index 6ea1b8c3d73a..bc06a6364105 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedObjectFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getReferenceVolatile(obj, fieldOffset); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,48 +96,56 @@ public void set(Object obj, Object value) unsafe.putReferenceVolatile(obj, fieldOffset, value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java index a2de71ce79bd..82a04053d85c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java @@ -34,43 +34,53 @@ class UnsafeQualifiedShortFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Short.valueOf(getShort(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getShortVolatile(obj, fieldOffset); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -92,24 +102,28 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { @@ -120,24 +134,28 @@ public void setShort(Object obj, short s) unsafe.putShortVolatile(obj, fieldOffset, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java index de94aa8e708c..fc4d55e530cb 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticBooleanFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Boolean.valueOf(getBoolean(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { return unsafe.getBooleanVolatile(base, fieldOffset); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,6 +96,7 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { @@ -95,42 +106,49 @@ public void setBoolean(Object obj, boolean z) unsafe.putBooleanVolatile(base, fieldOffset, z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java index 387666b59ea9..db4dab60a797 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticByteFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Byte.valueOf(getByte(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { return unsafe.getByteVolatile(base, fieldOffset); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,12 +96,14 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { @@ -101,36 +113,42 @@ public void setByte(Object obj, byte b) unsafe.putByteVolatile(base, fieldOffset, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java index a569aaa0ed19..2cb43a382c7f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticCharacterFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Character.valueOf(getChar(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { return unsafe.getCharVolatile(base, fieldOffset); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -86,18 +96,21 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { @@ -107,30 +120,35 @@ public void setChar(Object obj, char c) unsafe.putCharVolatile(base, fieldOffset, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java index 0f66126346b4..4d74e2a0b336 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticDoubleFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Double.valueOf(getDouble(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return unsafe.getDoubleVolatile(base, fieldOffset); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -110,48 +120,56 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java index 24056e0d0c57..a7bf7eea1d91 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -26,9 +26,6 @@ package com.oracle.svm.core.reflect; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.security.AccessController; -import jdk.internal.misc.Unsafe; /** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for final or static volatile fields. */ diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java index 749a5fb30ddd..970773efeaee 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticFloatFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Float.valueOf(getFloat(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return unsafe.getFloatVolatile(base, fieldOffset); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getFloat(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -106,42 +116,49 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { @@ -151,6 +168,7 @@ public void setFloat(Object obj, float f) unsafe.putFloatVolatile(base, fieldOffset, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java index f5ac15ab7282..fe7c86fac18c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticIntegerFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Integer.valueOf(getInt(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return unsafe.getIntVolatile(base, fieldOffset); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -98,30 +108,35 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { @@ -131,18 +146,21 @@ public void setInt(Object obj, int i) unsafe.putIntVolatile(base, fieldOffset, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java index 9d3c8af9e3d3..eea6fd31c46f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticLongFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Long.valueOf(getLong(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return unsafe.getLongVolatile(base, fieldOffset); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -102,36 +112,42 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { @@ -141,12 +157,14 @@ public void setLong(Object obj, long l) unsafe.putLongVolatile(base, fieldOffset, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java index d5a6837da474..92100bf884f7 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticObjectFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return unsafe.getReferenceVolatile(base, fieldOffset); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -84,48 +94,56 @@ public void set(Object obj, Object value) unsafe.putReferenceVolatile(base, fieldOffset, value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java index 0995bea5f338..006bec9b80e0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -34,42 +34,52 @@ class UnsafeQualifiedStaticShortFieldAccessorImpl super(field, isReadOnly); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Short.valueOf(getShort(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return unsafe.getShortVolatile(base, fieldOffset); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -90,24 +100,28 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { @@ -117,24 +131,28 @@ public void setShort(Object obj, short s) unsafe.putShortVolatile(base, fieldOffset, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java index 243863100511..9189d1f3916f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java @@ -32,43 +32,53 @@ class UnsafeShortFieldAccessorImpl extends UnsafeFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Short.valueOf(getShort(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { ensureObj(obj); return unsafe.getShort(obj, fieldOffset); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -90,24 +100,28 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { @@ -118,24 +132,28 @@ public void setShort(Object obj, short s) unsafe.putShort(obj, fieldOffset, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java index b50b8f2dc9ef..bfc394d1875b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticBooleanFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Boolean.valueOf(getBoolean(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { return unsafe.getBoolean(base, fieldOffset); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -84,6 +94,7 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { @@ -93,42 +104,49 @@ public void setBoolean(Object obj, boolean z) unsafe.putBoolean(base, fieldOffset, z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java index ab2ac0adf3fd..88c9ee021753 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticByteFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Byte.valueOf(getByte(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { return unsafe.getByte(base, fieldOffset); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getByte(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -84,12 +94,14 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { @@ -99,36 +111,42 @@ public void setByte(Object obj, byte b) unsafe.putByte(base, fieldOffset, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java index acba3afabd8c..2fdd7444ff0f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticCharacterFieldAccessorImpl extends UnsafeStaticFieldAccessorIm super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Character.valueOf(getChar(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { return unsafe.getChar(base, fieldOffset); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getChar(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -84,18 +94,21 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { @@ -105,30 +118,35 @@ public void setChar(Object obj, char c) unsafe.putChar(base, fieldOffset, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java index af7a6b8bd87c..8e67ac2f17e3 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticDoubleFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Double.valueOf(getDouble(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return unsafe.getDouble(base, fieldOffset); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -108,48 +118,56 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java index b0ca275d096f..0cd19cd7b4c4 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java @@ -26,7 +26,6 @@ package com.oracle.svm.core.reflect; import java.lang.reflect.Field; -import java.util.Set; /** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for static fields. The observation is that there are only nine types of diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java index 110b84548f90..d060f674f985 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticFloatFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Float.valueOf(getFloat(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return unsafe.getFloat(base, fieldOffset); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getFloat(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -104,42 +114,49 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { @@ -149,6 +166,7 @@ public void setFloat(Object obj, float f) unsafe.putFloat(base, fieldOffset, f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java index cb86faa0dca2..f46fd03d1d71 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticIntegerFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Integer.valueOf(getInt(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return unsafe.getInt(base, fieldOffset); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getInt(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -96,30 +106,35 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { @@ -129,18 +144,21 @@ public void setInt(Object obj, int i) unsafe.putInt(base, fieldOffset, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java index 5459b058aede..e52eaddb411c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticLongFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Long.valueOf(getLong(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return unsafe.getLong(base, fieldOffset); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getLong(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -100,36 +110,42 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { @@ -139,12 +155,14 @@ public void setLong(Object obj, long l) unsafe.putLong(base, fieldOffset, l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java index 02d5948f9848..260c0a44d779 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return unsafe.getReference(base, fieldOffset); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { throw newGetShortIllegalArgumentException(); } + @Override public int getInt(Object obj) throws IllegalArgumentException { throw newGetIntIllegalArgumentException(); } + @Override public long getLong(Object obj) throws IllegalArgumentException { throw newGetLongIllegalArgumentException(); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { throw newGetFloatIllegalArgumentException(); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { throw newGetDoubleIllegalArgumentException(); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -82,48 +92,56 @@ public void set(Object obj, Object value) unsafe.putReference(base, fieldOffset, value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java index 47d46952c45a..dceefa757391 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java @@ -32,42 +32,52 @@ class UnsafeStaticShortFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl { super(field); } + @Override public Object get(Object obj) throws IllegalArgumentException { return Short.valueOf(getShort(obj)); } + @Override public boolean getBoolean(Object obj) throws IllegalArgumentException { throw newGetBooleanIllegalArgumentException(); } + @Override public byte getByte(Object obj) throws IllegalArgumentException { throw newGetByteIllegalArgumentException(); } + @Override public char getChar(Object obj) throws IllegalArgumentException { throw newGetCharIllegalArgumentException(); } + @Override public short getShort(Object obj) throws IllegalArgumentException { return unsafe.getShort(base, fieldOffset); } + @Override public int getInt(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public long getLong(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public float getFloat(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public double getDouble(Object obj) throws IllegalArgumentException { return getShort(obj); } + @Override public void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException { @@ -88,24 +98,28 @@ public void set(Object obj, Object value) throwSetIllegalArgumentException(value); } + @Override public void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } + @Override public void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } + @Override public void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } + @Override public void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException { @@ -115,24 +129,28 @@ public void setShort(Object obj, short s) unsafe.putShort(base, fieldOffset, s); } + @Override public void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } + @Override public void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } + @Override public void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } + @Override public void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException { From 4001128269d7535916e30815bfd3bdc9716075b2 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 21 Jun 2023 12:37:47 +0200 Subject: [PATCH 04/11] svm: UnsafeFieldAccessors reformat --- .../svm/core/reflect/FieldAccessorImpl.java | 59 +++++++++---------- .../UnsafeBooleanFieldAccessorImpl.java | 27 +++------ .../reflect/UnsafeByteFieldAccessorImpl.java | 27 +++------ .../UnsafeCharacterFieldAccessorImpl.java | 27 +++------ .../UnsafeDoubleFieldAccessorImpl.java | 27 +++------ .../core/reflect/UnsafeFieldAccessorImpl.java | 14 ++--- .../reflect/UnsafeFloatFieldAccessorImpl.java | 27 +++------ .../UnsafeIntegerFieldAccessorImpl.java | 27 +++------ .../reflect/UnsafeLongFieldAccessorImpl.java | 27 +++------ .../UnsafeObjectFieldAccessorImpl.java | 27 +++------ ...safeQualifiedBooleanFieldAccessorImpl.java | 30 ++++------ .../UnsafeQualifiedByteFieldAccessorImpl.java | 30 ++++------ ...feQualifiedCharacterFieldAccessorImpl.java | 30 ++++------ ...nsafeQualifiedDoubleFieldAccessorImpl.java | 30 ++++------ .../UnsafeQualifiedFieldAccessorImpl.java | 16 ++--- ...UnsafeQualifiedFloatFieldAccessorImpl.java | 30 ++++------ ...safeQualifiedIntegerFieldAccessorImpl.java | 30 ++++------ .../UnsafeQualifiedLongFieldAccessorImpl.java | 30 ++++------ ...nsafeQualifiedObjectFieldAccessorImpl.java | 30 ++++------ ...UnsafeQualifiedShortFieldAccessorImpl.java | 30 ++++------ ...alifiedStaticBooleanFieldAccessorImpl.java | 30 ++++------ ...eQualifiedStaticByteFieldAccessorImpl.java | 30 ++++------ ...ifiedStaticCharacterFieldAccessorImpl.java | 30 ++++------ ...ualifiedStaticDoubleFieldAccessorImpl.java | 30 ++++------ ...nsafeQualifiedStaticFieldAccessorImpl.java | 8 +-- ...QualifiedStaticFloatFieldAccessorImpl.java | 30 ++++------ ...alifiedStaticIntegerFieldAccessorImpl.java | 30 ++++------ ...eQualifiedStaticLongFieldAccessorImpl.java | 30 ++++------ ...ualifiedStaticObjectFieldAccessorImpl.java | 30 ++++------ ...QualifiedStaticShortFieldAccessorImpl.java | 30 ++++------ .../reflect/UnsafeShortFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticBooleanFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticByteFieldAccessorImpl.java | 27 +++------ ...nsafeStaticCharacterFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticDoubleFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticFieldAccessorImpl.java | 12 ++-- .../UnsafeStaticFloatFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticIntegerFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticLongFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticObjectFieldAccessorImpl.java | 27 +++------ .../UnsafeStaticShortFieldAccessorImpl.java | 27 +++------ 41 files changed, 394 insertions(+), 741 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java index e5e41d145115..a1ef11c07fd0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -30,9 +30,10 @@ import jdk.internal.reflect.FieldAccessor; -/** Package-private implementation of the FieldAccessor interface - which has access to all classes and all fields, regardless of - language restrictions. See MagicAccessorImpl. */ +/** + * Package-private implementation of the FieldAccessor interface which has access to all classes and + * all fields, regardless of language restrictions. See MagicAccessorImpl. + */ abstract class FieldAccessorImpl implements FieldAccessor { protected final Field field; @@ -44,93 +45,92 @@ abstract class FieldAccessorImpl implements FieldAccessor { /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract Object get(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract boolean getBoolean(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract byte getByte(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract char getChar(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract short getShort(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract int getInt(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract long getLong(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract float getFloat(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract double getDouble(Object obj) - throws IllegalArgumentException; + throws IllegalArgumentException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException; + throws IllegalArgumentException, IllegalAccessException; /** Matches specification in {@link java.lang.reflect.Field} */ @Override public abstract void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException; - + throws IllegalArgumentException, IllegalAccessException; protected void ensureObj(Object o) { // NOTE: will throw NullPointerException, as specified, if o is null @@ -140,19 +140,18 @@ protected void ensureObj(Object o) { } protected String getQualifiedFieldName() { - return field.getDeclaringClass().getName() + "." +field.getName(); + return field.getDeclaringClass().getName() + "." + field.getName(); } protected IllegalArgumentException newGetIllegalArgumentException(String type) { return new IllegalArgumentException( - "Attempt to get "+field.getType().getName()+" field \"" + - getQualifiedFieldName() + "\" with illegal data type conversion to "+type - ); + "Attempt to get " + field.getType().getName() + " field \"" + + getQualifiedFieldName() + "\" with illegal data type conversion to " + type); } protected void throwFinalFieldIllegalAccessException(String attemptedType, - String attemptedValue) - throws IllegalAccessException { + String attemptedValue) + throws IllegalAccessException { throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue)); } @@ -243,8 +242,8 @@ protected String getSetMessage(String attemptedType, String attemptedValue) { } protected void throwSetIllegalArgumentException(String attemptedType, - String attemptedValue) { - throw new IllegalArgumentException(getSetMessage(attemptedType,attemptedValue)); + String attemptedValue) { + throw new IllegalArgumentException(getSetMessage(attemptedType, attemptedValue)); } protected void throwSetIllegalArgumentException(Object o) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java index 38d8cea45832..2305de838e6f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -98,8 +97,7 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(z); @@ -109,50 +107,43 @@ public void setBoolean(Object obj, boolean z) @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java index eb33f54bde88..9d2c3a1d628e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -98,15 +97,13 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(b); @@ -116,43 +113,37 @@ public void setByte(Object obj, byte b) @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java index 4c4d94bf7088..089305dea327 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -98,22 +97,19 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(c); @@ -123,36 +119,31 @@ public void setChar(Object obj, char c) @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java index cfd85615debf..4d3f9f8d04e7 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -122,57 +121,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(d); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java index 1ea7b1281749..58550c455a65 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java @@ -29,17 +29,17 @@ import java.lang.reflect.Modifier; import jdk.internal.misc.Unsafe; -/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors. The - observation is that there are only nine types of fields from the - standpoint of reflection code: the eight primitive types and - Object. Using class Unsafe instead of generated bytecodes saves - memory and loading time for the dynamically-generated - FieldAccessors. */ +/** + * Base class for jdk.internal.misc.Unsafe-based FieldAccessors. The observation is that there are + * only nine types of fields from the standpoint of reflection code: the eight primitive types and + * Object. Using class Unsafe instead of generated bytecodes saves memory and loading time for the + * dynamically-generated FieldAccessors. + */ abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl { static final Unsafe unsafe = Unsafe.getUnsafe(); - protected final long fieldOffset; + protected final long fieldOffset; protected final boolean isFinal; UnsafeFieldAccessorImpl(Field field) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java index c131751f8cba..74357d519f50 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -118,50 +117,43 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(f); @@ -171,8 +163,7 @@ public void setFloat(Object obj, float f) @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java index 1c67d678087c..dffc8cb0e811 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -110,36 +109,31 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(i); @@ -149,22 +143,19 @@ public void setInt(Object obj, int i) @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java index 6c4032ae244d..bc0e3ba08255 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -114,43 +113,37 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(l); @@ -160,15 +153,13 @@ public void setLong(Object obj, long l) @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java index dc550be8c859..27a93b639464 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -96,57 +95,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java index 637380360be8..f430fa6a934b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedBooleanFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedBooleanFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -100,8 +98,7 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(z); @@ -111,50 +108,43 @@ public void setBoolean(Object obj, boolean z) @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java index 959395ce353a..66024df12afb 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedByteFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedByteFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -100,15 +98,13 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(b); @@ -118,43 +114,37 @@ public void setByte(Object obj, byte b) @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java index 34fda6d1fe68..fe6a4df0c0de 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedCharacterFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedCharacterFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -100,22 +98,19 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(c); @@ -125,36 +120,31 @@ public void setChar(Object obj, char c) @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java index d851321726b5..51d3e80e43f5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedDoubleFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedDoubleFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -124,57 +122,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(d); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java index fb51214ef4a6..30f459ffdb30 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -28,19 +28,15 @@ import java.lang.reflect.Field; /** - * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for fields with - * final or volatile qualifiers. These differ from unqualified - * versions in that (1) they check for read-only status (2) they use - * the volatile forms of Unsafe get/put methods. (When accessed via - * reflection, finals act as slightly "lighter" forms of volatiles. So - * the volatile forms are heavier than necessary in terms of - * underlying reordering rules and memory barriers, but preserve - * correctness.) + * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for fields with final or volatile + * qualifiers. These differ from unqualified versions in that (1) they check for read-only status + * (2) they use the volatile forms of Unsafe get/put methods. (When accessed via reflection, finals + * act as slightly "lighter" forms of volatiles. So the volatile forms are heavier than necessary in + * terms of underlying reordering rules and memory barriers, but preserve correctness.) */ abstract class UnsafeQualifiedFieldAccessorImpl - extends UnsafeFieldAccessorImpl -{ + extends UnsafeFieldAccessorImpl { protected final boolean isReadOnly; UnsafeQualifiedFieldAccessorImpl(Field field, boolean isReadOnly) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java index 12021b06a9ca..0138328bef8e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedFloatFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedFloatFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -120,50 +118,43 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(f); @@ -173,8 +164,7 @@ public void setFloat(Object obj, float f) @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java index 79627841cc65..5b7786d9fd20 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedIntegerFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedIntegerFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -112,36 +110,31 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(i); @@ -151,22 +144,19 @@ public void setInt(Object obj, int i) @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java index 5c4071247e3c..e8bd49f66be1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedLongFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedLongFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -116,43 +114,37 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(l); @@ -162,15 +154,13 @@ public void setLong(Object obj, long l) @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java index bc06a6364105..d0e043ffa6b3 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedObjectFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedObjectFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -98,57 +96,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java index 82a04053d85c..0602c809bcf9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedShortFieldAccessorImpl - extends UnsafeQualifiedFieldAccessorImpl -{ + extends UnsafeQualifiedFieldAccessorImpl { UnsafeQualifiedShortFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -82,8 +81,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(value); @@ -104,29 +102,25 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isReadOnly) { throwFinalFieldIllegalAccessException(s); @@ -136,29 +130,25 @@ public void setShort(Object obj, short s) @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java index fc4d55e530cb..0117325ebdd6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticBooleanFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticBooleanFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -98,8 +96,7 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(z); } @@ -108,50 +105,43 @@ public void setBoolean(Object obj, boolean z) @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java index db4dab60a797..ea3b9a062f57 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticByteFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticByteFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -98,15 +96,13 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(b); } @@ -115,43 +111,37 @@ public void setByte(Object obj, byte b) @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java index 2cb43a382c7f..18f92d1841e0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticCharacterFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticCharacterFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -98,22 +96,19 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(c); } @@ -122,36 +117,31 @@ public void setChar(Object obj, char c) @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java index 4d74e2a0b336..fdaf3afd2300 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticDoubleFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticDoubleFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -122,57 +120,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(d); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java index a7bf7eea1d91..7db905c16fd0 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -27,12 +27,12 @@ import java.lang.reflect.Field; -/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for final or - static volatile fields. */ +/** + * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for final or static volatile fields. + */ abstract class UnsafeQualifiedStaticFieldAccessorImpl - extends UnsafeStaticFieldAccessorImpl -{ + extends UnsafeStaticFieldAccessorImpl { protected final boolean isReadOnly; UnsafeQualifiedStaticFieldAccessorImpl(Field field, boolean isReadOnly) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java index 970773efeaee..066a6feff3b1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticFloatFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticFloatFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -118,50 +116,43 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(f); } @@ -170,8 +161,7 @@ public void setFloat(Object obj, float f) @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java index fe7c86fac18c..bdf3c7ea2937 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticIntegerFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticIntegerFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -110,36 +108,31 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(i); } @@ -148,22 +141,19 @@ public void setInt(Object obj, int i) @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java index eea6fd31c46f..6276deaaf50a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticLongFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticLongFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -114,43 +112,37 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(l); } @@ -159,15 +151,13 @@ public void setLong(Object obj, long l) @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java index 92100bf884f7..c082334ba99d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticObjectFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticObjectFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -96,57 +94,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java index 006bec9b80e0..b3fce5305db1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -28,8 +28,7 @@ import java.lang.reflect.Field; class UnsafeQualifiedStaticShortFieldAccessorImpl - extends UnsafeQualifiedStaticFieldAccessorImpl -{ + extends UnsafeQualifiedStaticFieldAccessorImpl { UnsafeQualifiedStaticShortFieldAccessorImpl(Field field, boolean isReadOnly) { super(field, isReadOnly); } @@ -81,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(value); } @@ -102,29 +100,25 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isReadOnly) { throwFinalFieldIllegalAccessException(s); } @@ -133,29 +127,25 @@ public void setShort(Object obj, short s) @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java index 9189d1f3916f..da83cf09092e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java @@ -80,8 +80,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(value); @@ -102,29 +101,25 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { ensureObj(obj); if (isFinal) { throwFinalFieldIllegalAccessException(s); @@ -134,29 +129,25 @@ public void setShort(Object obj, short s) @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java index bfc394d1875b..3dbcbc44c072 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -96,8 +95,7 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(z); } @@ -106,50 +104,43 @@ public void setBoolean(Object obj, boolean z) @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java index 88c9ee021753..89f3969174e5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -96,15 +95,13 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(b); } @@ -113,43 +110,37 @@ public void setByte(Object obj, byte b) @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java index 2fdd7444ff0f..5823aeee273c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -96,22 +95,19 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(c); } @@ -120,36 +116,31 @@ public void setChar(Object obj, char c) @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java index 8e67ac2f17e3..f94eec6ab3b7 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -120,57 +119,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setDouble(obj, f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(d); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java index 0cd19cd7b4c4..d893cf09c00f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java @@ -27,12 +27,12 @@ import java.lang.reflect.Field; -/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors for static - fields. The observation is that there are only nine types of - fields from the standpoint of reflection code: the eight primitive - types and Object. Using class Unsafe instead of generated - bytecodes saves memory and loading time for the - dynamically-generated FieldAccessors. */ +/** + * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for static fields. The observation + * is that there are only nine types of fields from the standpoint of reflection code: the eight + * primitive types and Object. Using class Unsafe instead of generated bytecodes saves memory and + * loading time for the dynamically-generated FieldAccessors. + */ abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl { static { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java index d060f674f985..fbc763817bbd 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -116,50 +115,43 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setFloat(obj, l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(f); } @@ -168,8 +160,7 @@ public void setFloat(Object obj, float f) @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java index f46fd03d1d71..fcbd37750479 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -108,36 +107,31 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setInt(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(i); } @@ -146,22 +140,19 @@ public void setInt(Object obj, int i) @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java index e52eaddb411c..dfa9a99f9351 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -112,43 +111,37 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setLong(obj, i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(l); } @@ -157,15 +150,13 @@ public void setLong(Object obj, long l) @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java index 260c0a44d779..6fdff16caf9d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -94,57 +93,49 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(s); } @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java index dceefa757391..04269c7ab8d6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java @@ -79,8 +79,7 @@ public double getDouble(Object obj) throws IllegalArgumentException { @Override public void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(value); } @@ -100,29 +99,25 @@ public void set(Object obj, Object value) @Override public void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(z); } @Override public void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { setShort(obj, b); } @Override public void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(c); } @Override public void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { if (isFinal) { throwFinalFieldIllegalAccessException(s); } @@ -131,29 +126,25 @@ public void setShort(Object obj, short s) @Override public void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(i); } @Override public void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(l); } @Override public void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(f); } @Override public void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException - { + throws IllegalArgumentException, IllegalAccessException { throwSetIllegalArgumentException(d); } } From ec89e02545a617cb1ca4fa7537043261804d5eeb Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 21 Jun 2023 15:55:37 +0200 Subject: [PATCH 05/11] svm: FieldAccessors fix/ignore checkstyle --- .../src/com/oracle/svm/core/reflect/FieldAccessorImpl.java | 1 + .../com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java | 1 + .../svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java | 2 +- .../core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java index a1ef11c07fd0..9ccb27214013 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +// Checkstyle: stop package com.oracle.svm.core.reflect; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java index 58550c455a65..81100a1be79c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +// Checkstyle: stop package com.oracle.svm.core.reflect; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java index 30f459ffdb30..6f0fcdbaf3d1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java index 7db905c16fd0..ce74ef242c71 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it From f0ed319cfee03e7f7de336de1cbf37a4327c64e2 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Fri, 23 Jun 2023 10:41:11 +0200 Subject: [PATCH 06/11] svm: fix checkstyle in FieldAccessorImpl --- .../svm/core/reflect/FieldAccessorImpl.java | 48 ++++++++++--------- .../core/reflect/UnsafeFieldAccessorImpl.java | 6 +-- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java index 9ccb27214013..11cb26aa52ae 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -// Checkstyle: stop package com.oracle.svm.core.reflect; @@ -43,92 +42,92 @@ abstract class FieldAccessorImpl implements FieldAccessor { this.field = field; } - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract Object get(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract boolean getBoolean(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract byte getByte(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract char getChar(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract short getShort(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract int getInt(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract long getLong(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract float getFloat(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract double getDouble(Object obj) throws IllegalArgumentException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void set(Object obj, Object value) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setBoolean(Object obj, boolean z) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException; - /** Matches specification in {@link java.lang.reflect.Field} */ + /** Matches specification in {@link java.lang.reflect.Field}. */ @Override public abstract void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException; @@ -226,18 +225,21 @@ protected IllegalArgumentException newGetDoubleIllegalArgumentException() { protected String getSetMessage(String attemptedType, String attemptedValue) { String err = "Can not set"; - if (Modifier.isStatic(field.getModifiers())) + if (Modifier.isStatic(field.getModifiers())) { err += " static"; - if (Modifier.isFinal(field.getModifiers())) + } + if (Modifier.isFinal(field.getModifiers())) { err += " final"; + } err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to "; if (!attemptedValue.isEmpty()) { err += "(" + attemptedType + ")" + attemptedValue; } else { - if (!attemptedType.isEmpty()) + if (!attemptedType.isEmpty()) { err += attemptedType; - else + } else { err += "null value"; + } } return err; } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java index 81100a1be79c..f861dd343dc2 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -// Checkstyle: stop package com.oracle.svm.core.reflect; @@ -47,9 +46,10 @@ abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl { super(field); int mods = field.getModifiers(); this.isFinal = Modifier.isFinal(mods); - if (Modifier.isStatic(mods)) + if (Modifier.isStatic(mods)) { fieldOffset = unsafe.staticFieldOffset(field); - else + } else { fieldOffset = unsafe.objectFieldOffset(field); + } } } From d2a42422bfbce959478f845d01f0ccfeb406f12f Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 26 Jun 2023 07:34:54 +0200 Subject: [PATCH 07/11] svm: move UnsafeFieldAccessors into separate package --- .../src/com/oracle/svm/core/hub/DynamicHub.java | 2 +- .../svm/core/reflect/{ => fieldaccessor}/FieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeBooleanFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeByteFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeCharacterFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeDoubleFieldAccessorImpl.java | 2 +- .../reflect/{ => fieldaccessor}/UnsafeFieldAccessorFactory.java | 2 +- .../reflect/{ => fieldaccessor}/UnsafeFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeFloatFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeIntegerFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeLongFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeObjectFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedBooleanFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedByteFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedCharacterFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedDoubleFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeQualifiedFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedFloatFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedIntegerFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedLongFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedObjectFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedShortFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticBooleanFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticByteFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticCharacterFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticDoubleFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticFloatFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticIntegerFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticLongFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticObjectFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedStaticShortFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeShortFieldAccessorImpl.java | 2 +- .../UnsafeStaticBooleanFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeStaticByteFieldAccessorImpl.java | 2 +- .../UnsafeStaticCharacterFieldAccessorImpl.java | 2 +- .../UnsafeStaticDoubleFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeStaticFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeStaticFloatFieldAccessorImpl.java | 2 +- .../UnsafeStaticIntegerFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeStaticLongFieldAccessorImpl.java | 2 +- .../UnsafeStaticObjectFieldAccessorImpl.java | 2 +- .../{ => fieldaccessor}/UnsafeStaticShortFieldAccessorImpl.java | 2 +- 43 files changed, 43 insertions(+), 43 deletions(-) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/FieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeBooleanFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeByteFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeCharacterFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeDoubleFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeFieldAccessorFactory.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeFieldAccessorImpl.java (97%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeFloatFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeIntegerFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeLongFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeObjectFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedBooleanFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedByteFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedCharacterFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedDoubleFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedFieldAccessorImpl.java (97%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedFloatFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedIntegerFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedLongFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedObjectFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedShortFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticByteFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticFieldAccessorImpl.java (97%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticFloatFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticLongFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticObjectFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeQualifiedStaticShortFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeShortFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticBooleanFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticByteFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticCharacterFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticDoubleFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticFieldAccessorImpl.java (97%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticFloatFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticIntegerFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticLongFieldAccessorImpl.java (99%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticObjectFieldAccessorImpl.java (98%) rename substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/{ => fieldaccessor}/UnsafeStaticShortFieldAccessorImpl.java (98%) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java index 258287a7eb43..cf6fe7e14ab9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java @@ -72,7 +72,7 @@ import java.util.Optional; import java.util.StringJoiner; -import com.oracle.svm.core.reflect.UnsafeFieldAccessorFactory; +import com.oracle.svm.core.reflect.fieldaccessor.UnsafeFieldAccessorFactory; import jdk.internal.access.JavaLangReflectAccess; import jdk.internal.reflect.FieldAccessor; import org.graalvm.compiler.core.common.NumUtil; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java index 11cb26aa52ae..f353db673bcf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/FieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeBooleanFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeBooleanFieldAccessorImpl.java index 2305de838e6f..2b02775ac740 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeByteFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeByteFieldAccessorImpl.java index 9d2c3a1d628e..d4b1146d362c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeCharacterFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeCharacterFieldAccessorImpl.java index 089305dea327..ed0d04cd2b12 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeDoubleFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeDoubleFieldAccessorImpl.java index 4d3f9f8d04e7..c3d6d951e7e4 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorFactory.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorFactory.java index e174474262af..314131fe4849 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorFactory.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorFactory.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import jdk.internal.reflect.FieldAccessor; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java similarity index 97% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java index f861dd343dc2..9a745d4d7066 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFloatFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFloatFieldAccessorImpl.java index 74357d519f50..e7c285f0caeb 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeIntegerFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeIntegerFieldAccessorImpl.java index dffc8cb0e811..c11b868e6e7a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeLongFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeLongFieldAccessorImpl.java index bc0e3ba08255..d5baa1a39d79 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeObjectFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeObjectFieldAccessorImpl.java index 27a93b639464..2661d0cd7e28 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedBooleanFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedBooleanFieldAccessorImpl.java index f430fa6a934b..cd4820b9e36d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedByteFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedByteFieldAccessorImpl.java index 66024df12afb..1675067e62f9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedCharacterFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedCharacterFieldAccessorImpl.java index fe6a4df0c0de..3e7171077e68 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedDoubleFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedDoubleFieldAccessorImpl.java index 51d3e80e43f5..3c3213262a36 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFieldAccessorImpl.java similarity index 97% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFieldAccessorImpl.java index 6f0fcdbaf3d1..dd50323895ac 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFloatFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFloatFieldAccessorImpl.java index 0138328bef8e..4c27edb05a64 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedIntegerFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedIntegerFieldAccessorImpl.java index 5b7786d9fd20..a666652ea8a8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedLongFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedLongFieldAccessorImpl.java index e8bd49f66be1..efcad055613c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedObjectFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedObjectFieldAccessorImpl.java index d0e043ffa6b3..c42d131e49e5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedShortFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedShortFieldAccessorImpl.java index 0602c809bcf9..1195c19ca52f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java index 0117325ebdd6..d011e21505b8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticByteFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticByteFieldAccessorImpl.java index ea3b9a062f57..1436a3e85bd5 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java index 18f92d1841e0..39c0c6be2863 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java index fdaf3afd2300..f56ae102a343 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFieldAccessorImpl.java similarity index 97% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFieldAccessorImpl.java index ce74ef242c71..a772fb49da2c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFloatFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFloatFieldAccessorImpl.java index 066a6feff3b1..79ab415e368d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java index bdf3c7ea2937..c34ee359e7c6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticLongFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticLongFieldAccessorImpl.java index 6276deaaf50a..3a98475b42ac 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticObjectFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticObjectFieldAccessorImpl.java index c082334ba99d..b5f962c0d47c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticShortFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticShortFieldAccessorImpl.java index b3fce5305db1..3e82010d6c31 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeShortFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeShortFieldAccessorImpl.java index da83cf09092e..c3cccac17f78 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticBooleanFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticBooleanFieldAccessorImpl.java index 3dbcbc44c072..8e121943bca9 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticBooleanFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticByteFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticByteFieldAccessorImpl.java index 89f3969174e5..42f817c9909b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticByteFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticCharacterFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticCharacterFieldAccessorImpl.java index 5823aeee273c..4b570bd06ae8 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticCharacterFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticDoubleFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticDoubleFieldAccessorImpl.java index f94eec6ab3b7..fa5eb8b807e1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticDoubleFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java similarity index 97% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java index d893cf09c00f..bb61de6dffdf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFloatFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFloatFieldAccessorImpl.java index fbc763817bbd..a28502e967f7 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticFloatFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticIntegerFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticIntegerFieldAccessorImpl.java index fcbd37750479..8da78c2f1d83 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticIntegerFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticLongFieldAccessorImpl.java similarity index 99% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticLongFieldAccessorImpl.java index dfa9a99f9351..fb7312e1a00e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticLongFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticObjectFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticObjectFieldAccessorImpl.java index 6fdff16caf9d..fe8caee94e57 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticObjectFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticShortFieldAccessorImpl.java similarity index 98% rename from substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java rename to substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticShortFieldAccessorImpl.java index 04269c7ab8d6..3e3590742d35 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/UnsafeStaticShortFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package com.oracle.svm.core.reflect; +package com.oracle.svm.core.reflect.fieldaccessor; import java.lang.reflect.Field; From 8f18b04012513706a44c74b8a6eb4a2bf90aaae8 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 26 Jun 2023 07:39:43 +0200 Subject: [PATCH 08/11] svm: merge FieldAccessorImpl and UnsafeFieldAccessorImpl --- .../fieldaccessor/FieldAccessorImpl.java | 288 ------------------ .../UnsafeFieldAccessorImpl.java | 251 ++++++++++++++- 2 files changed, 249 insertions(+), 290 deletions(-) delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java deleted file mode 100644 index f353db673bcf..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/FieldAccessorImpl.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.oracle.svm.core.reflect.fieldaccessor; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -import jdk.internal.reflect.FieldAccessor; - -/** - * Package-private implementation of the FieldAccessor interface which has access to all classes and - * all fields, regardless of language restrictions. See MagicAccessorImpl. - */ - -abstract class FieldAccessorImpl implements FieldAccessor { - protected final Field field; - - FieldAccessorImpl(Field field) { - this.field = field; - } - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract Object get(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract boolean getBoolean(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract byte getByte(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract char getChar(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract short getShort(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract int getInt(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract long getLong(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract float getFloat(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract double getDouble(Object obj) - throws IllegalArgumentException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void set(Object obj, Object value) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setBoolean(Object obj, boolean z) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setByte(Object obj, byte b) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setChar(Object obj, char c) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setShort(Object obj, short s) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setInt(Object obj, int i) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setLong(Object obj, long l) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setFloat(Object obj, float f) - throws IllegalArgumentException, IllegalAccessException; - - /** Matches specification in {@link java.lang.reflect.Field}. */ - @Override - public abstract void setDouble(Object obj, double d) - throws IllegalArgumentException, IllegalAccessException; - - protected void ensureObj(Object o) { - // NOTE: will throw NullPointerException, as specified, if o is null - if (!field.getDeclaringClass().isAssignableFrom(o.getClass())) { - throwSetIllegalArgumentException(o); - } - } - - protected String getQualifiedFieldName() { - return field.getDeclaringClass().getName() + "." + field.getName(); - } - - protected IllegalArgumentException newGetIllegalArgumentException(String type) { - return new IllegalArgumentException( - "Attempt to get " + field.getType().getName() + " field \"" + - getQualifiedFieldName() + "\" with illegal data type conversion to " + type); - } - - protected void throwFinalFieldIllegalAccessException(String attemptedType, - String attemptedValue) - throws IllegalAccessException { - throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue)); - } - - protected void throwFinalFieldIllegalAccessException(Object o) throws IllegalAccessException { - throwFinalFieldIllegalAccessException(o != null ? o.getClass().getName() : "", ""); - } - - protected void throwFinalFieldIllegalAccessException(boolean z) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("boolean", Boolean.toString(z)); - } - - protected void throwFinalFieldIllegalAccessException(char b) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("char", Character.toString(b)); - } - - protected void throwFinalFieldIllegalAccessException(byte b) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("byte", Byte.toString(b)); - } - - protected void throwFinalFieldIllegalAccessException(short b) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("short", Short.toString(b)); - } - - protected void throwFinalFieldIllegalAccessException(int i) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("int", Integer.toString(i)); - } - - protected void throwFinalFieldIllegalAccessException(long i) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("long", Long.toString(i)); - } - - protected void throwFinalFieldIllegalAccessException(float f) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("float", Float.toString(f)); - } - - protected void throwFinalFieldIllegalAccessException(double f) throws IllegalAccessException { - throwFinalFieldIllegalAccessException("double", Double.toString(f)); - } - - protected IllegalArgumentException newGetBooleanIllegalArgumentException() { - return newGetIllegalArgumentException("boolean"); - } - - protected IllegalArgumentException newGetByteIllegalArgumentException() { - return newGetIllegalArgumentException("byte"); - } - - protected IllegalArgumentException newGetCharIllegalArgumentException() { - return newGetIllegalArgumentException("char"); - } - - protected IllegalArgumentException newGetShortIllegalArgumentException() { - return newGetIllegalArgumentException("short"); - } - - protected IllegalArgumentException newGetIntIllegalArgumentException() { - return newGetIllegalArgumentException("int"); - } - - protected IllegalArgumentException newGetLongIllegalArgumentException() { - return newGetIllegalArgumentException("long"); - } - - protected IllegalArgumentException newGetFloatIllegalArgumentException() { - return newGetIllegalArgumentException("float"); - } - - protected IllegalArgumentException newGetDoubleIllegalArgumentException() { - return newGetIllegalArgumentException("double"); - } - - protected String getSetMessage(String attemptedType, String attemptedValue) { - String err = "Can not set"; - if (Modifier.isStatic(field.getModifiers())) { - err += " static"; - } - if (Modifier.isFinal(field.getModifiers())) { - err += " final"; - } - err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to "; - if (!attemptedValue.isEmpty()) { - err += "(" + attemptedType + ")" + attemptedValue; - } else { - if (!attemptedType.isEmpty()) { - err += attemptedType; - } else { - err += "null value"; - } - } - return err; - } - - protected void throwSetIllegalArgumentException(String attemptedType, - String attemptedValue) { - throw new IllegalArgumentException(getSetMessage(attemptedType, attemptedValue)); - } - - protected void throwSetIllegalArgumentException(Object o) { - throwSetIllegalArgumentException(o != null ? o.getClass().getName() : "", ""); - } - - protected void throwSetIllegalArgumentException(boolean b) { - throwSetIllegalArgumentException("boolean", Boolean.toString(b)); - } - - protected void throwSetIllegalArgumentException(byte b) { - throwSetIllegalArgumentException("byte", Byte.toString(b)); - } - - protected void throwSetIllegalArgumentException(char c) { - throwSetIllegalArgumentException("char", Character.toString(c)); - } - - protected void throwSetIllegalArgumentException(short s) { - throwSetIllegalArgumentException("short", Short.toString(s)); - } - - protected void throwSetIllegalArgumentException(int i) { - throwSetIllegalArgumentException("int", Integer.toString(i)); - } - - protected void throwSetIllegalArgumentException(long l) { - throwSetIllegalArgumentException("long", Long.toString(l)); - } - - protected void throwSetIllegalArgumentException(float f) { - throwSetIllegalArgumentException("float", Float.toString(f)); - } - - protected void throwSetIllegalArgumentException(double d) { - throwSetIllegalArgumentException("double", Double.toString(d)); - } - -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java index 9a745d4d7066..f95b25990131 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java @@ -27,7 +27,9 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; + import jdk.internal.misc.Unsafe; +import jdk.internal.reflect.FieldAccessor; /** * Base class for jdk.internal.misc.Unsafe-based FieldAccessors. The observation is that there are @@ -35,15 +37,16 @@ * Object. Using class Unsafe instead of generated bytecodes saves memory and loading time for the * dynamically-generated FieldAccessors. */ +abstract class UnsafeFieldAccessorImpl implements FieldAccessor { + protected final Field field; -abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl { static final Unsafe unsafe = Unsafe.getUnsafe(); protected final long fieldOffset; protected final boolean isFinal; UnsafeFieldAccessorImpl(Field field) { - super(field); + this.field = field; int mods = field.getModifiers(); this.isFinal = Modifier.isFinal(mods); if (Modifier.isStatic(mods)) { @@ -52,4 +55,248 @@ abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl { fieldOffset = unsafe.objectFieldOffset(field); } } + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract Object get(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract boolean getBoolean(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract byte getByte(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract char getChar(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract short getShort(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract int getInt(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract long getLong(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract float getFloat(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract double getDouble(Object obj) + throws IllegalArgumentException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void set(Object obj, Object value) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setBoolean(Object obj, boolean z) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setByte(Object obj, byte b) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setChar(Object obj, char c) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setShort(Object obj, short s) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setInt(Object obj, int i) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setLong(Object obj, long l) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setFloat(Object obj, float f) + throws IllegalArgumentException, IllegalAccessException; + + /** Matches specification in {@link java.lang.reflect.Field}. */ + @Override + public abstract void setDouble(Object obj, double d) + throws IllegalArgumentException, IllegalAccessException; + + protected void ensureObj(Object o) { + // NOTE: will throw NullPointerException, as specified, if o is null + if (!field.getDeclaringClass().isAssignableFrom(o.getClass())) { + throwSetIllegalArgumentException(o); + } + } + + protected String getQualifiedFieldName() { + return field.getDeclaringClass().getName() + "." + field.getName(); + } + + protected IllegalArgumentException newGetIllegalArgumentException(String type) { + return new IllegalArgumentException( + "Attempt to get " + field.getType().getName() + " field \"" + + getQualifiedFieldName() + "\" with illegal data type conversion to " + type); + } + + protected void throwFinalFieldIllegalAccessException(String attemptedType, + String attemptedValue) + throws IllegalAccessException { + throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue)); + } + + protected void throwFinalFieldIllegalAccessException(Object o) throws IllegalAccessException { + throwFinalFieldIllegalAccessException(o != null ? o.getClass().getName() : "", ""); + } + + protected void throwFinalFieldIllegalAccessException(boolean z) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("boolean", Boolean.toString(z)); + } + + protected void throwFinalFieldIllegalAccessException(char b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("char", Character.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(byte b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("byte", Byte.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(short b) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("short", Short.toString(b)); + } + + protected void throwFinalFieldIllegalAccessException(int i) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("int", Integer.toString(i)); + } + + protected void throwFinalFieldIllegalAccessException(long i) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("long", Long.toString(i)); + } + + protected void throwFinalFieldIllegalAccessException(float f) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("float", Float.toString(f)); + } + + protected void throwFinalFieldIllegalAccessException(double f) throws IllegalAccessException { + throwFinalFieldIllegalAccessException("double", Double.toString(f)); + } + + protected IllegalArgumentException newGetBooleanIllegalArgumentException() { + return newGetIllegalArgumentException("boolean"); + } + + protected IllegalArgumentException newGetByteIllegalArgumentException() { + return newGetIllegalArgumentException("byte"); + } + + protected IllegalArgumentException newGetCharIllegalArgumentException() { + return newGetIllegalArgumentException("char"); + } + + protected IllegalArgumentException newGetShortIllegalArgumentException() { + return newGetIllegalArgumentException("short"); + } + + protected IllegalArgumentException newGetIntIllegalArgumentException() { + return newGetIllegalArgumentException("int"); + } + + protected IllegalArgumentException newGetLongIllegalArgumentException() { + return newGetIllegalArgumentException("long"); + } + + protected IllegalArgumentException newGetFloatIllegalArgumentException() { + return newGetIllegalArgumentException("float"); + } + + protected IllegalArgumentException newGetDoubleIllegalArgumentException() { + return newGetIllegalArgumentException("double"); + } + + protected String getSetMessage(String attemptedType, String attemptedValue) { + String err = "Can not set"; + if (Modifier.isStatic(field.getModifiers())) { + err += " static"; + } + if (Modifier.isFinal(field.getModifiers())) { + err += " final"; + } + err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to "; + if (!attemptedValue.isEmpty()) { + err += "(" + attemptedType + ")" + attemptedValue; + } else { + if (!attemptedType.isEmpty()) { + err += attemptedType; + } else { + err += "null value"; + } + } + return err; + } + + protected void throwSetIllegalArgumentException(String attemptedType, + String attemptedValue) { + throw new IllegalArgumentException(getSetMessage(attemptedType, attemptedValue)); + } + + protected void throwSetIllegalArgumentException(Object o) { + throwSetIllegalArgumentException(o != null ? o.getClass().getName() : "", ""); + } + + protected void throwSetIllegalArgumentException(boolean b) { + throwSetIllegalArgumentException("boolean", Boolean.toString(b)); + } + + protected void throwSetIllegalArgumentException(byte b) { + throwSetIllegalArgumentException("byte", Byte.toString(b)); + } + + protected void throwSetIllegalArgumentException(char c) { + throwSetIllegalArgumentException("char", Character.toString(c)); + } + + protected void throwSetIllegalArgumentException(short s) { + throwSetIllegalArgumentException("short", Short.toString(s)); + } + + protected void throwSetIllegalArgumentException(int i) { + throwSetIllegalArgumentException("int", Integer.toString(i)); + } + + protected void throwSetIllegalArgumentException(long l) { + throwSetIllegalArgumentException("long", Long.toString(l)); + } + + protected void throwSetIllegalArgumentException(float f) { + throwSetIllegalArgumentException("float", Float.toString(f)); + } + + protected void throwSetIllegalArgumentException(double d) { + throwSetIllegalArgumentException("double", Double.toString(d)); + } + } From 324acffd6d12c8049b467888c5b55e3b8fb9932b Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 26 Jun 2023 07:42:02 +0200 Subject: [PATCH 09/11] svm: ensure that UnsafeFieldAccessorImpl is only created at runtime --- .../core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java index f95b25990131..7309e6626018 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeFieldAccessorImpl.java @@ -28,6 +28,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import com.oracle.svm.core.SubstrateUtil; +import com.oracle.svm.core.util.VMError; import jdk.internal.misc.Unsafe; import jdk.internal.reflect.FieldAccessor; @@ -46,6 +48,7 @@ abstract class UnsafeFieldAccessorImpl implements FieldAccessor { protected final boolean isFinal; UnsafeFieldAccessorImpl(Field field) { + VMError.guarantee(!SubstrateUtil.HOSTED, "UnsafeFieldAccessors must only be create at runtime."); this.field = field; int mods = field.getModifiers(); this.isFinal = Modifier.isFinal(mods); From d6e414089ec2551b97ba21e20b6a8d204561615a Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Mon, 26 Jun 2023 08:04:45 +0200 Subject: [PATCH 10/11] svm: add package-info to com.oracle.svm.core.reflect.fieldaccessor --- .../reflect/fieldaccessor/package-info.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/package-info.java diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/package-info.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/package-info.java new file mode 100644 index 000000000000..b62829ac261e --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * This package includes the implementation of the + * {@link com.oracle.svm.core.reflect.fieldaccessor.UnsafeFieldAccessorImpl}. + * + * Background: JDK 19 ships with JEP 416, which + * reimplements core reflection with method + * handles. However, the old Unsafe-based implementation was still available and used by Native + * Image. In JDK 22, the old core reflection + * implementation was removed. Since the method handle based implementation is designed with + * Just-in-Time compilation in mind, and would have bad performance in an Ahead-of-Time scenario, we + * decided to keep old implementation. + * + * This package contains the Unsafe-based core reflection implementation as available until JDK + * 22 build +1. + */ +package com.oracle.svm.core.reflect.fieldaccessor; From 2aeb5be0d28ba5b01ab7025e86d47833c53d624f Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Wed, 28 Jun 2023 13:25:18 +0200 Subject: [PATCH 11/11] svm: remove commented out code from UnsafeStaticFieldAccessorImpl --- .../reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java index bb61de6dffdf..dd2c6289805e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/fieldaccessor/UnsafeStaticFieldAccessorImpl.java @@ -35,10 +35,6 @@ */ abstract class UnsafeStaticFieldAccessorImpl extends UnsafeFieldAccessorImpl { - static { -// Reflection.registerFieldsToFilter(UnsafeStaticFieldAccessorImpl.class, -// Set.of("base")); - } protected final Object base; // base