Example usage for org.eclipse.jdt.internal.compiler.classfmt MethodInfo u2At

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt MethodInfo u2At

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt MethodInfo u2At.

Prototype

public int u2At(int relativeOffset) 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.CopyInheritanceSourceAttribute.java

License:Open Source License

/**
 *  Read a CopyInheritanceSrc from byte code.
 *//*from  w w  w .  j  a v a2  s. com*/
public static AbstractAttribute readcopyInherSrc(MethodInfo info, int readOffset, int structOffset,
        int[] constantPoolOffsets) {
    int idx = info.u2At(readOffset);
    int utf8Offset = constantPoolOffsets[idx] - structOffset;
    char[] value = info.utf8At(utf8Offset + 3, info.u2At(utf8Offset + 1));
    int lineOffset = 0;
    if (info.u2At(readOffset - 2) > 2) // old attribute length was 2 (without lineOffset)
        lineOffset = (int) info.u4At(readOffset + 2);
    AbstractAttribute result = new CopyInheritanceSourceAttribute(value, lineOffset);
    result._methodInfo = info;
    return result;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute.java

License:Open Source License

/**
 * Read and evaluate a "Modifiers" attribute from byte code.
 * @param method  this method shall be modified.
 * @param readOffset where to read//from   w  ww  . j  av  a2  s  .c  o m
 */
public static void readModifiers(MethodInfo method, int readOffset) {
    int value = method.u2At(readOffset);
    method.setAccessFlags(value);
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute.java

License:Open Source License

public static void readRoleClassMethodModifiersAttribute(MethodInfo info, int readOffset) {
    int binaryFlags = info.getModifiers() & ~ExtraCompilerModifiers.AccVisibilityMASK; // reset these bits first
    int newFlags = info.u2At(readOffset);
    info.setAccessFlags(binaryFlags | newFlags);
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute.java

License:Open Source License

/**
 * Read and evaluate a "CallinFlags" attribute from byte code.
 * @param method  this method shall be modified.
 * @param readOffset where to read/*from  w  w  w  . j  a v a2 s .  c  om*/
 */
public static WordValueAttribute readCallinFlags(MethodInfo method, int readOffset) {
    int value = method.u2At(readOffset);
    method.setAccessFlags(method.getModifiers() | ExtraCompilerModifiers.AccCallin);
    // create and store an attribute anyway, in order to store the actual bits.
    WordValueAttribute result = callinFlagsAttribute(value);
    result._methodInfo = method;
    return result;
}