Java Code Examples for java.lang.reflect.Field.getClass()

The following are Jave code examples for showing how to use getClass() of the java.lang.reflect.Field class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: MemberName.java   View Source Code Vote up 5 votes
@SuppressWarnings("LeakingThisInConstructor")
public MemberName(Field fld, boolean makeSetter) {
    fld.getClass();  // NPE check
    // fill in vmtarget, vmindex while we have fld in hand:
    MethodHandleNatives.init(this, fld);
    assert(isResolved() && this.clazz != null);
    this.name = fld.getName();
    this.type = fld.getType();
    assert((REF_putStatic - REF_getStatic) == (REF_putField - REF_getField));
    byte refKind = this.getReferenceKind();
    assert(refKind == (isStatic() ? REF_getStatic : REF_getField));
    if (makeSetter) {
        changeReferenceKind((byte)(refKind + (REF_putStatic - REF_getStatic)), refKind);
    }
}
 
Example 2
Project: jdk8u-jdk   File: MemberName.java   View Source Code Vote up 5 votes
@SuppressWarnings("LeakingThisInConstructor")
public MemberName(Field fld, boolean makeSetter) {
    fld.getClass();  // NPE check
    // fill in vmtarget, vmindex while we have fld in hand:
    MethodHandleNatives.init(this, fld);
    assert(isResolved() && this.clazz != null);
    this.name = fld.getName();
    this.type = fld.getType();
    assert((REF_putStatic - REF_getStatic) == (REF_putField - REF_getField));
    byte refKind = this.getReferenceKind();
    assert(refKind == (isStatic() ? REF_getStatic : REF_getField));
    if (makeSetter) {
        changeReferenceKind((byte)(refKind + (REF_putStatic - REF_getStatic)), refKind);
    }
}