Skip to content

Instantly share code, notes, and snippets.

Federico Tomassetti ftomassetti

View GitHub Profile
View gist:f10a690459eaed5b592d1ca57817b171
package Visitor;
import com.github.javaparser.ast.expr.LambdaExpr;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
import com.github.javaparser.symbolsolver.model.typesystem.Type;
* Created by ameya on 6/3/17.
package me.tomassetti.examples;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.stmt.WhileStmt;
import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
import com.github.javaparser.symbolsolver.model.declarations.ValueDeclaration;
import com.github.javaparser.symbolsolver.model.resolution.SymbolReference;
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
ftomassetti /
Created May 27, 2017
Selecting while statements using a reference as condition
public class FindWhileStatements {
public static void main(String[] args) {
String code = "class A {\n" +
"\tstatic boolean f = true;\n" +
"\tvoid methodFoo() {\n" +
"\t\twhile (f) {\n" +
"\t\t\tmethodFoo();\n" +
"\t\t}\n" +
"\t}\n" +
ftomassetti / gist:74217a4063da29bf3ced
Last active Sep 5, 2015
Performance checks for JavaParser
View gist:74217a4063da29bf3ced
package com.github.javaparser.ast;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.visitor.DumpVisitor;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
ftomassetti / replacer.rb
Created Jul 25, 2015
Small script to update the comment at the top of all source files
View replacer.rb
$new_text = """/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
* Copyright (C) 2011, 2013-2015 The JavaParser Team.
* This file is part of JavaParser.
* JavaParser can be used either under the terms of
* a) the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
You can’t perform that action at this time.