Giter Club home page Giter Club logo

analyze-java-code-examples's People

Contributors

ftomassetti avatar gabriele-tomassetti avatar matozoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

analyze-java-code-examples's Issues

Anonymous inner classes cannot output

new VoidVisitorAdapter<Object>() {
        @Override
        public void visit(ClassOrInterfaceDeclaration n, Object arg) {
          super.visit(n, arg);
          System.out.println(" * " + n.getName());
        }
      }.visit(StaticJavaParser.parse(BFile_sourcePath), null);
package test;

public class B {
    public void print() {
        new BInternal(){}.test();
    }
}

class BInternal {
    void test() {

    }
}

only print

 * B
 * BInternal

need print

* B$1

also

Use of this examples in conjuntion with javasymbolsolver to filter specific variables delcarations.

Hi @ftomassetti ,

First of all, thank you very much for your explanations in your blog and your examples here. I'm trying to use JavaParser and JavaSymbolSolver to find all the declarations of variables belonging to specific classes (although project-defined ones) and I've started using this example and trying to combine with examples of JavaSymbolSolver in JavaSymbolSolverExamples, but using the build.gradle in this example and adding the dependency for JavaSymbolSolver found the build.gradle of that JavaSymbolSolver examples, I obtain one non-relevant error with node.getBeginLine() and node.getEndLine() methods. The important thing that I'm not able to solve is the use of ReflectionTypeSolver.

As I said before, I'm trying to find the way to search inside all code of one project to obtain all variables of one type. For example, finding all the variables of type javax.swing.JFrame. I would be grateful if you could help me.

ListClassesExample gives compile error on newest version of JavaParser

Hello,

First of all thank you for making this guide!
However, when I try to implement your code I run into an error concerning the JavaParser parse function
Specifically in the listClasses method:

        new DirExplorer((level, path, file) -> path.endsWith(".java"), (level, path, file) -> {
            System.out.println(path);
            System.out.println(Strings.repeat("=", path.length()));
            try {
                new VoidVisitorAdapter<Object>() {
                    @Override
                    public void visit(ClassOrInterfaceDeclaration n, Object arg) {
                        super.visit(n, arg);
                        System.out.println(" * " + n.getName());
                    }
                }.visit(JavaParser.parse(file), null);
                System.out.println(); // empty line
            } catch (ParseException | IOException e) {
                new RuntimeException(e);
            }
        }).explore(projectDir);
    }

the function call to visit(JavaParser.parse(file), null) gives a Non-static method 'parse(java.io.File, java.nio.charset.Charset)' cannot be referenced from a static context error.
Could this be due to compatibility errors due to versioning?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.