Skip to content

Instantly share code, notes, and snippets.

Federico Tomassetti ftomassetti

View GitHub Profile
View gist:f10a690459eaed5b592d1ca57817b171
https://www.deezer.com/track/68116147
https://www.deezer.com/track/2514677
https://www.deezer.com/track/2514683
https://www.deezer.com/track/2263033
https://www.deezer.com/track/68513563
https://www.deezer.com/track/136332084
https://www.deezer.com/track/88003859
https://www.deezer.com/track/78671026
https://www.deezer.com/track/136334560
https://www.deezer.com/track/121921372
View FileVisitor.java
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.
*/
View FindWhileStatements.java
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
ftomassetti / FindWhileStatements.java
Created May 27, 2017
Selecting while statements using a reference as condition
View FindWhileStatements.java
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
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.io.File;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
@ftomassetti
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.