diff options
Diffstat (limited to 'libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java')
| -rw-r--r-- | libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index dafd089236e..f6135d1fc84 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -239,15 +239,15 @@ public abstract class AtomicLongFieldUpdater<T> { CASUpdater(Class<T> tclass, String fieldName) { Field field = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); } catch(Exception ex) { throw new RuntimeException(ex); } @@ -259,8 +259,8 @@ public abstract class AtomicLongFieldUpdater<T> { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; offset = unsafe.objectFieldOffset(field); } @@ -268,9 +268,9 @@ public abstract class AtomicLongFieldUpdater<T> { private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); - } + if (cclass != null) + ensureProtectedAccess(obj); + } public boolean compareAndSet(T obj, long expect, long update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); @@ -297,20 +297,20 @@ public abstract class AtomicLongFieldUpdater<T> { return unsafe.getLongVolatile(obj, offset); } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException ( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException ( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } @@ -322,15 +322,15 @@ public abstract class AtomicLongFieldUpdater<T> { LockedUpdater(Class<T> tclass, String fieldName) { Field field = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); } catch(Exception ex) { throw new RuntimeException(ex); } @@ -342,8 +342,8 @@ public abstract class AtomicLongFieldUpdater<T> { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; offset = unsafe.objectFieldOffset(field); } @@ -351,9 +351,9 @@ public abstract class AtomicLongFieldUpdater<T> { private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); - } + if (cclass != null) + ensureProtectedAccess(obj); + } public boolean compareAndSet(T obj, long expect, long update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); @@ -378,7 +378,7 @@ public abstract class AtomicLongFieldUpdater<T> { } public void lazySet(T obj, long newValue) { - set(obj, newValue); + set(obj, newValue); } public long get(T obj) { @@ -388,19 +388,19 @@ public abstract class AtomicLongFieldUpdater<T> { } } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException ( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException ( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } } |

