Java Code Examples for sun.reflect.FieldAccessor

The following examples show how to use sun.reflect.FieldAccessor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jdk1.8-source-analysis   Source File: Field.java    License: Apache License 2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 2
Source Project: dragonwell8_jdk   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 3
Source Project: TencentKona-8   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 4
Source Project: jdk8u60   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: Field.java    License: MIT License 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 6
Source Project: openjdk-jdk8u   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 7
Source Project: openjdk-jdk8u-backup   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 8
Source Project: jdk8u-jdk   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 9
Source Project: Java8CN   Source File: Field.java    License: Apache License 2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 10
Source Project: hottub   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 11
Source Project: openjdk-8-source   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 12
Source Project: openjdk-8   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 13
Source Project: jdk8u_jdk   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 14
public static void setFailsafeFieldValue(Field field, Object target, Object value)
        throws NoSuchFieldException, IllegalAccessException {

    // let's make the field accessible
    field.setAccessible(true);

    // next we change the modifier in the Field instance to
    // not be final anymore, thus tricking reflection into
    // letting us modify the static final field
    Field modifiersField = Field.class.getDeclaredField("modifiers");
    modifiersField.setAccessible(true);
    int modifiers = modifiersField.getInt(field);

    // blank out the final bit in the modifiers int
    modifiers &= ~Modifier.FINAL;
    modifiersField.setInt(field, modifiers);

    try {
        FieldAccessor fa = ReflectionFactory.getReflectionFactory().newFieldAccessor(field, false);
        fa.set(target, value);
    } catch (NoSuchMethodError error) {
        field.set(target, value);
    }
}
 
Example 15
Source Project: jdk8u-jdk   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 16
Source Project: jdk-1.7-annotated   Source File: Field.java    License: Apache License 2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 17
Source Project: jdk8u-dev-jdk   Source File: Field.java    License: GNU General Public License v2.0 6 votes vote down vote up
private FieldAccessor acquireFieldAccessor(boolean overrideFinalCheck) {
    // First check to see if one has been created yet, and take it
    // if so
    FieldAccessor tmp = null;
    if (root != null) tmp = root.getFieldAccessor(overrideFinalCheck);
    if (tmp != null) {
        if (overrideFinalCheck)
            overrideFieldAccessor = tmp;
        else
            fieldAccessor = tmp;
    } else {
        // Otherwise fabricate one and propagate it up to the root
        tmp = reflectionFactory.newFieldAccessor(this, overrideFinalCheck);
        setFieldAccessor(tmp, overrideFinalCheck);
    }

    return tmp;
}
 
Example 18
Source Project: jdk1.8-source-analysis   Source File: Field.java    License: Apache License 2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 19
Source Project: jdk1.8-source-analysis   Source File: Field.java    License: Apache License 2.0 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 20
Source Project: dragonwell8_jdk   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 21
Source Project: dragonwell8_jdk   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 22
Source Project: TencentKona-8   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 23
Source Project: TencentKona-8   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 24
Source Project: jdk8u60   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 25
Source Project: jdk8u60   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 26
Source Project: JDKSourceCode1.8   Source File: Field.java    License: MIT License 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 27
Source Project: JDKSourceCode1.8   Source File: Field.java    License: MIT License 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 28
Source Project: openjdk-jdk8u   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}
 
Example 29
Source Project: openjdk-jdk8u   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setFieldAccessor(FieldAccessor accessor, boolean overrideFinalCheck) {
    if (overrideFinalCheck)
        overrideFieldAccessor = accessor;
    else
        fieldAccessor = accessor;
    // Propagate up
    if (root != null) {
        root.setFieldAccessor(accessor, overrideFinalCheck);
    }
}
 
Example 30
Source Project: openjdk-jdk8u-backup   Source File: Field.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FieldAccessor getFieldAccessor(Object obj)
    throws IllegalAccessException
{
    boolean ov = override;
    FieldAccessor a = (ov) ? overrideFieldAccessor : fieldAccessor;
    return (a != null) ? a : acquireFieldAccessor(ov);
}