Java Code Examples for com.sun.tools.javac.code.Kinds#VAR

The following examples show how to use com.sun.tools.javac.code.Kinds#VAR . 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 File: SerializedForm.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 2
Source File: SerializedForm.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 3
Source File: SerializedForm.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 4
Source File: SerializedForm.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 5
Source File: JavadocMemberEnter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitVarDef(JCVariableDecl tree) {
    if (tree.init != null) {
        boolean isFinal = (tree.mods.flags & FINAL) != 0
                || (env.enclClass.mods.flags & INTERFACE) != 0;
        if (!isFinal || containsNonConstantExpression(tree.init)) {
            // Avoid unnecessary analysis and release resources.
            // In particular, remove non-constant expressions
            // which may trigger Attr.attribClass, since
            // method bodies are also removed, in visitMethodDef.
            tree.init = null;
        }
    }
    super.visitVarDef(tree);
    if (tree.sym != null &&
            tree.sym.kind == Kinds.VAR &&
            !isParameter(tree.sym)) {
        docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
    }
}
 
Example 6
Source File: SerializedForm.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 7
Source File: SerializedForm.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 8
Source File: SerializedForm.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 9
Source File: JavadocMemberEnter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitVarDef(JCVariableDecl tree) {
    if (tree.init != null) {
        boolean isFinal = (tree.mods.flags & FINAL) != 0
                || (env.enclClass.mods.flags & INTERFACE) != 0;
        if (!isFinal || containsNonConstantExpression(tree.init)) {
            // Avoid unnecessary analysis and release resources.
            // In particular, remove non-constant expressions
            // which may trigger Attr.attribClass, since
            // method bodies are also removed, in visitMethodDef.
            tree.init = null;
        }
    }
    super.visitVarDef(tree);
    if (tree.sym != null &&
            tree.sym.kind == Kinds.VAR &&
            !isParameter(tree.sym)) {
        docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
    }
}
 
Example 10
Source File: JavadocMemberEnter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitVarDef(JCVariableDecl tree) {
    if (tree.init != null) {
        boolean isFinal = (tree.mods.flags & FINAL) != 0
                || (env.enclClass.mods.flags & INTERFACE) != 0;
        if (!isFinal || containsNonConstantExpression(tree.init)) {
            // Avoid unnecessary analysis and release resources.
            // In particular, remove non-constant expressions
            // which may trigger Attr.attribClass, since
            // method bodies are also removed, in visitMethodDef.
            tree.init = null;
        }
    }
    super.visitVarDef(tree);
    if (tree.sym != null &&
            tree.sym.kind == Kinds.VAR &&
            !isParameter(tree.sym)) {
        docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
    }
}
 
Example 11
Source File: JavadocMemberEnter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitVarDef(JCVariableDecl tree) {
    if (tree.init != null) {
        boolean isFinal = (tree.mods.flags & FINAL) != 0
                || (env.enclClass.mods.flags & INTERFACE) != 0;
        if (!isFinal || containsNonConstantExpression(tree.init)) {
            // Avoid unnecessary analysis and release resources.
            // In particular, remove non-constant expressions
            // which may trigger Attr.attribClass, since
            // method bodies are also removed, in visitMethodDef.
            tree.init = null;
        }
    }
    super.visitVarDef(tree);
    if (tree.sym != null &&
            tree.sym.kind == Kinds.VAR &&
            !isParameter(tree.sym)) {
        docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
    }
}
 
Example 12
Source File: SerializedForm.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 13
Source File: SerializedForm.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 14
Source File: JavadocMemberEnter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitVarDef(JCVariableDecl tree) {
    if (tree.init != null) {
        boolean isFinal = (tree.mods.flags & FINAL) != 0
                || (env.enclClass.mods.flags & INTERFACE) != 0;
        if (!isFinal || containsNonConstantExpression(tree.init)) {
            // Avoid unnecessary analysis and release resources.
            // In particular, remove non-constant expressions
            // which may trigger Attr.attribClass, since
            // method bodies are also removed, in visitMethodDef.
            tree.init = null;
        }
    }
    super.visitVarDef(tree);
    if (tree.sym != null &&
            tree.sym.kind == Kinds.VAR &&
            !isParameter(tree.sym)) {
        docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
    }
}
 
Example 15
Source File: SerializedForm.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 16
Source File: SerializedForm.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
Example 17
Source File: Pool.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    int expectedKind = -1;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = Kinds.VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}
 
Example 18
Source File: Pool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    int expectedKind = -1;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = Kinds.VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}
 
Example 19
Source File: Pool.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    int expectedKind = -1;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = Kinds.VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}
 
Example 20
Source File: Pool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    int expectedKind = -1;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = Kinds.VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}