Package com.sun.source.tree

Examples of com.sun.source.tree.Scope


    protected JCBlock processElement(BlockTree tree, final CompilationUnitTree cut, Tree scopeTree) {
        if (tree == null) {
            return null;
        }
        boolean dummyInjected = false;
        Scope scope = null;
        if (scopeTree instanceof MethodTree) {
            if (!((MethodTree) scopeTree).getParameters().isEmpty()) { //work-around
                final JCMethodInvocation dummyMi = getMethodInvoc("System.out.print", StringUtils.EMPTY);
                final JCStatement dummyStmt = tm.Exec(dummyMi);
                final JCMethodDecl mt = (JCMethodDecl) scopeTree;
View Full Code Here


                    final int varMods = (int) (s.flags_field) & ~java.lang.reflect.Modifier.FINAL;
                    final JCLiteral mod = tm.Literal(varMods);
                    final JCAssign constChange = tm.Assign(fieldMods, mod);
                    JCExpressionStatement constChangeStmt = tm.Exec(constChange);
                    encBlock.stats = injectBefore((JCStatement) n.actual, encBlock.stats, constChangeStmt);
                    Scope validScope = trees.getScope(trees.getPath(cut, constChangeStmt));
                    encBlock.stats = (com.sun.tools.javac.util.List<JCStatement>) processStmt(constChangeStmt, cut, encBlock, validScope);
                }
                return processCond(reflectedFieldSetter, cut, n, encBlock);
            }
        }
View Full Code Here

        assert tool != null;
        final JavacTask ct = (JavacTask)tool.getTask(null, null, null, Arrays.asList("-bootclasspath",  bootPath), null, Arrays.asList(new MyFileObject()));

        CompilationUnitTree cut = ct.parse().iterator().next();
        TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
        Scope s = Trees.instance(ct).getScope(tp);
        TypeElement type = ct.getElements().getTypeElement("com.sun.java.util.jar.pack.Package.File");

        if (Trees.instance(ct).isAccessible(s, type)) {
            //com.sun.java.util.jar.pack.Package.File is a public innerclass inside a non-accessible class, so
            //"false" would be expected here.
View Full Code Here

    }

    public Symbol getSymbol(CompilationUnitTree cut, JCStatement stmt, List<JCExpression> typeParams, Name varName, List<JCExpression> args) {
        java.util.List<Type> typeSyms = getArgTypes(typeParams, cut, stmt);
        java.util.List<Type> argsSyms = getArgTypes(args, cut, stmt);
        final Scope scope = getScope(cut, stmt);
        Symbol t = contains(scope, typeSyms, varName, argsSyms); //first lookup scope for all public identifiers
        TypeElement cl = scope.getEnclosingClass();
        while (t == null && cl != null) { //lookup hierarchy for inacessible identifiers too
            t = contains(elementUtils.getAllMembers(cl), typeSyms, varName, argsSyms);
            final TypeMirror superclass = cl.getSuperclass();
            if (superclass != null) {
                cl = (TypeElement) ((Type) superclass).asElement();
View Full Code Here

TOP

Related Classes of com.sun.source.tree.Scope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.