Java Code Examples for com.sun.tools.javac.code.Symbol.VarSymbol#flags()

The following examples show how to use com.sun.tools.javac.code.Symbol.VarSymbol#flags() . 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-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 2
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 3
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 4
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 5
Source File: SerializedForm.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Symbol sym : def.members().getSymbols(NON_RECURSIVE)) {
        if (sym != null && sym.kind == VAR) {
            VarSymbol f = (VarSymbol)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 6
Source File: SerializedForm.java    From openjdk-jdk9 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 (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
        if (sym.kind == VAR) {
            VarSymbol f = (VarSymbol)sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 7
Source File: WorkArounds.java    From openjdk-jdk9 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,
     */
    for (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
        if (sym.kind == VAR) {
            VarSymbol f = (VarSymbol) sym;
            if ((f.flags() & Flags.STATIC) != 0
                    && (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
Example 8
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 9
Source File: SerializedForm.java    From TencentKona-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 10
Source File: SerializedForm.java    From openjdk-8-source 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 11
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 12
Source File: SerializedForm.java    From openjdk-jdk8u 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 13
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 14
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 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: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Record an initialization of a trackable variable.
 */
void letInit(DiagnosticPosition pos, VarSymbol sym) {
    if (sym.adr >= firstadr && trackable(sym)) {
        if ((sym.flags() & EFFECTIVELY_FINAL) != 0) {
            if (!uninits.isMember(sym.adr)) {
                //assignment targeting an effectively final variable
                //makes the variable lose its status of effectively final
                //if the variable is _not_ definitively unassigned
                sym.flags_field &= ~EFFECTIVELY_FINAL;
            } else {
                uninit(sym);
            }
        }
        else if ((sym.flags() & FINAL) != 0) {
            if ((sym.flags() & PARAMETER) != 0) {
                if ((sym.flags() & UNION) != 0) { //multi-catch parameter
                    log.error(pos, Errors.MulticatchParameterMayNotBeAssigned(sym));
                }
                else {
                    log.error(pos,
                              Errors.FinalParameterMayNotBeAssigned(sym));
                }
            } else if (!uninits.isMember(sym.adr)) {
                log.error(pos, flowKind.errKey, sym);
            } else {
                uninit(sym);
            }
        }
        inits.incl(sym.adr);
    } else if ((sym.flags() & FINAL) != 0) {
        log.error(pos, Errors.VarMightAlreadyBeAssigned(sym));
    }
}
 
Example 17
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Initialize new trackable variable by setting its address field
 *  to the next available sequence number and entering it under that
 *  index into the vars array.
 */
void newVar(JCVariableDecl varDecl) {
    VarSymbol sym = varDecl.sym;
    vardecls = ArrayUtils.ensureCapacity(vardecls, nextadr);
    if ((sym.flags() & FINAL) == 0) {
        sym.flags_field |= EFFECTIVELY_FINAL;
    }
    sym.adr = nextadr;
    vardecls[nextadr] = varDecl;
    inits.excl(nextadr);
    uninits.incl(nextadr);
    nextadr++;
}
 
Example 18
Source File: WorkArounds.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void computeDefaultSerializableFields(ClassSymbol te) {
    for (Symbol sym : te.members().getSymbols(NON_RECURSIVE)) {
        if (sym != null && sym.kind == VAR) {
            VarSymbol f = (VarSymbol) sym;
            if ((f.flags() & Flags.STATIC) == 0
                    && (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.add(f);
            }
        }
    }
}
 
Example 19
Source File: DocEnv.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Check whether this member should be documented. */
public boolean shouldDocument(VarSymbol sym) {
    long mod = sym.flags();

    if ((mod & Flags.SYNTHETIC) != 0) {
        return false;
    }

    return showAccess.checkModifier(translateModifiers(mod));
}
 
Example 20
Source File: Gen.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
boolean trackVar(VarSymbol var) {
    return (var.owner.kind == MTH &&
            (var.flags() & (PARAMETER | HASINIT)) == 0 &&
            analyzer.trackable(var));
}