Example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants ATTR_VARS

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants ATTR_VARS

Introduction

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

Prototype

int ATTR_VARS

To view the source code for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants ATTR_VARS.

Click Source Link

Usage

From source file:com.google.gwt.dev.javac.JdtCompiler.java

License:Open Source License

public static CompilerOptions getCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = options.sourceLevel = options.targetJDK = ClassFileConstants.JDK1_6;

    // Generate debug info for debugging the output.
    options.produceDebugAttributes = ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_LINES
            | ClassFileConstants.ATTR_SOURCE;
    // Tricks like "boolean stopHere = true;" depend on this setting.
    options.preserveAllLocalVariables = true;

    // Turn off all warnings, saves some memory / speed.
    options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
    options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
    // Instantiations    options.warningThreshold = 0;
    options.inlineJsrBytecode = true;/*w  ww  .  j av a 2 s  . co m*/
    return options;
}

From source file:fr.inria.astor.core.manipulation.compiler.bytecode.JDTByteCodeCompiler.java

License:Open Source License

public CompilerOptions getCompilerOption() {
    if (compilerOption == null) {
        compilerOption = new CompilerOptions();
        compilerOption.sourceLevel = ClassFileConstants.JDK1_6;//ClassFileConstants.JDK1_5;
        compilerOption.suppressWarnings = true;

        ///*from  w  ww .  j  av a2s.  c  om*/

        compilerOption.targetJDK = ClassFileConstants.JDK1_6; //was 6

        compilerOption.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES
                | ClassFileConstants.ATTR_VARS;
        compilerOption.preserveAllLocalVariables = true;
        compilerOption.inlineJsrBytecode = true;

        //MM
        compilerOption.tolerateIllegalAmbiguousVarargsInvocation = true;
    }
    return compilerOption;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.SyntheticRoleFieldAccess.java

License:Open Source License

public void generateBodyForRead(FieldBinding fieldBinding, CodeStream codeStream) {
    if (fieldBinding.isStatic()) {
        fieldBinding = checkAdjustRoleFieldAccess(fieldBinding, codeStream); // may insert cast, too.
        codeStream.fieldAccess(Opcodes.OPC_getstatic, fieldBinding, fieldBinding.declaringClass);
        // FIXME(SH): throw new InternalCompilerError("accessor for static field not applicable.");
    } else {//from ww w  .jav  a2s .co m
        // prepare "this" and role args:
        LocalVariableBinding thisArg = createArgumentBinding(codeStream, "this".toCharArray(), //$NON-NLS-1$
                fieldBinding.declaringClass.enclosingType(), 0);
        char[] argName = typeNameToLower(this.parameters[0].sourceName());
        LocalVariableBinding arg1 = createArgumentBinding(codeStream, argName, this.parameters[0], 1);

        // generate code:
        codeStream.aload_1(); // not a static accessor, positions shifted by 1.
        fieldBinding = checkAdjustRoleFieldAccess(fieldBinding, codeStream); // may insert cast, too.
        codeStream.fieldAccess(Opcodes.OPC_getfield, fieldBinding, fieldBinding.declaringClass);

        // finish args:
        if ((codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS
                | ClassFileConstants.ATTR_STACK_MAP_TABLE | ClassFileConstants.ATTR_STACK_MAP)) == 0)
            return; // avoid NPE below
        thisArg.recordInitializationEndPC(codeStream.position);
        arg1.recordInitializationEndPC(codeStream.position);
    }
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.SyntheticRoleFieldAccess.java

License:Open Source License

public void generateBodyForWrite(FieldBinding fieldBinding, CodeStream codeStream) {
    if (fieldBinding.isStatic()) {
        fieldBinding = checkAdjustRoleFieldAccess(fieldBinding, codeStream);
        codeStream.load(fieldBinding.type, 1);
        codeStream.fieldAccess(Opcodes.OPC_putstatic, fieldBinding, fieldBinding.declaringClass);
    } else {/*from  w w  w.  ja v a 2 s.c  om*/
        // prepare "this" and role args:
        LocalVariableBinding thisArg = createArgumentBinding(codeStream, "this".toCharArray(), //$NON-NLS-1$
                fieldBinding.declaringClass.enclosingType(), 0);
        char[] argName = typeNameToLower(this.parameters[0].sourceName());
        LocalVariableBinding arg1 = createArgumentBinding(codeStream, argName, this.parameters[0], 1);
        LocalVariableBinding arg2 = createArgumentBinding(codeStream, "value".toCharArray(), this.parameters[1], //$NON-NLS-1$
                2);

        codeStream.aload_1(); // not a static accessor, positions shifted by 1.
        fieldBinding = checkAdjustRoleFieldAccess(fieldBinding, codeStream);
        codeStream.load(fieldBinding.type, 2);
        codeStream.fieldAccess(Opcodes.OPC_putfield, fieldBinding, fieldBinding.declaringClass);

        // finish args:
        if ((codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS
                | ClassFileConstants.ATTR_STACK_MAP_TABLE | ClassFileConstants.ATTR_STACK_MAP)) == 0)
            return; // avoid NPE below
        thisArg.recordInitializationEndPC(codeStream.position);
        arg1.recordInitializationEndPC(codeStream.position);
        arg2.recordInitializationEndPC(codeStream.position);
    }
}