Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). :spoon: is made with :heart:, :beers: and :sparkles:. It parses source files to build a well-designed AST with powerful analysis and transformation API.

Overview

Maven Central Travis Build Status Coverage Status Maintainability Rating

Spoon

Spoon is an open-source library to analyze, rewrite, transform, transpile Java source code. It parses source files to build a well-designed AST with powerful analysis and transformation API. It fully supports modern Java versions up to Java 11, 12, 13, 14. Spoon is an official Inria open-source project, and member of the OW2 open-source consortium.

Documentation

The latest official documentation is available at http://spoon.gforge.inria.fr/ and a regularly updated PDF version is as https://projects.ow2.org/download/spoon/WebHome/spoon-user-manual.pdf.

Academic usage

If you use Spoon for academic purposes, please cite: Renaud Pawlak, Martin Monperrus, Nicolas Petitprez, Carlos Noguera, Lionel Seinturier. “Spoon: A Library for Implementing Analyses and Transformations of Java Source Code”. In Software: Practice and Experience, Wiley-Blackwell, 2015. Doi: 10.1002/spe.2346.

@article{pawlak:hal-01169705,
  TITLE = "{Spoon: A Library for Implementing Analyses and Transformations of Java Source Code}",
  AUTHOR = {Pawlak, Renaud and Monperrus, Martin and Petitprez, Nicolas and Noguera, Carlos and Seinturier, Lionel},
  JOURNAL = "{Software: Practice and Experience}",
  PUBLISHER = "{Wiley-Blackwell}",
  PAGES = {1155-1179},
  VOLUME = {46},
  URL = {https://hal.archives-ouvertes.fr/hal-01078532/document},
  YEAR = {2015},
  doi = {10.1002/spe.2346},
}

Professional support

If you need professional support on Spoon (development, training, extension), you are welcome to post a comment on https://github.com/INRIA/spoon/issues/3251

Getting started in 2 seconds

Get latest stable version with Maven, see https://search.maven.org/artifact/fr.inria.gforge.spoon/spoon-core

And start using it:

CtClass l = Launcher.parseClass("class A { void m() { System.out.println(\"yeah\");} }");

Documentation:

Contributing in 2 seconds

Create your first pull-request to improve the documentation, see doc! Proceed with your first bug fix! The community is open-minded, respectful and patient. All external contributions are welcome.

Design Philosophy

R1) The Spoon metamodel is as close as possible to the language concepts.

R2) The Spoon model of a program is complete and sound.

R3) The text version of a Spoon model is well-formed and semantically equivalent to the original program.

R4) The analysis and transformation API is intuitive and regular.

R5) Transformation operators are designed to warn as fast as possible about invalid programs. This is done either with static type checking or with dynamic checks when the operators are used.

R6) When feasible, the text version of a Spoon model is close to the original one.

Compiling

To compile Spoon, you need a Java Development Kit (JDK) and Maven:

git clone https://github.com/INRIA/spoon
cd spoon
mvn compile

To run the tests:

mvn test

Download

Latest version: https://search.maven.org/remote_content?g=fr.inria.gforge.spoon&a=spoon-core&v=LATEST&c=jar-with-dependencies - Javadoc

Maven:

<dependency>
    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-core</artifactId>
    <!-- See rendered release value at http://spoon.gforge.inria.fr/ -->
    <version>{{site.spoon_release}}</version>
</dependency>

Releases

  • July 2020: Spoon 8.2.0 (changelog)
  • March 2020: Spoon 8.1.0 (changelog)
  • November 2019, Spoon 8.0.0 (changelog)
  • July 2019: Spoon 7.5.0 is released (changelog)
  • May 2019: Spoon 7.4.0 is released (changelog)
  • Februray 10, 2019: Spoon 7.3.0 is released (changelog)
  • December 4, 2018: Spoon 7.2.0 is released (changelog)
  • October 10, 2018: Spoon 7.1.0 is released (changelog)
  • July 4, 2018: Spoon 7.0.0 is released (changelog)
  • March 8, 2018: Spoon 6.2.0 is released (changelog)
  • December 20, 2017: Spoon 6.1.0 is released, merry christmas! 🎄 (changelog)
  • November 17, 2017: Spoon 6.0.0 is released! Check the (changelog) as there are few non backward-compatible changes ⚠️
  • September 6, 2017: Spoon 5.9.0 is released (changelog) back-to-work release!
  • July 11, 2017: Spoon 5.8.0 is released (changelog) Summer release 🍺 To be prefered wrt the previous one: fix lot of bugs.
  • June 01, 2017: Spoon 5.7.0 is released (changelog)
  • March 16, 2017: Spoon 5.6.0 is released (changelog) Spring release :-)
  • January 11, 2017: Spoon 5.5.0 is released (changelog). Happy new year!
  • October 27, 2016: Spoon 5.4.0 is released (changelog).
  • September 19, 2016: Spoon 5.3.0 is released (changelog).
  • June 30, 2016: Spoon 5.2.0 is released (changelog).
  • June 22, 2016: Spoon 5.1.1 is released (changelog).
  • March 21, 2016: Spoon 5.1.0 is released (changelog).
  • February 12, 2016: Spoon 5.0.2 is released (changelog).
  • February 3, 2016: Spoon 5.0.1 is released (changelog).
  • January 25, 2016: Spoon 5.0.0 is released (changelog).
  • November 18, 2015: Spoon 4.4.1 is released (changelog).
  • November 16, 2015: Spoon 4.4.0 is released (changelog).
  • September 22, 2015: Spoon 4.3.0 is released (changelog).
  • June 15, 2015: Spoon 4.2.0 is released (changelog).
  • May 7, 2015: Spoon 4.1.0 is released (changelog).
  • April 8, 2015: Spoon 4.0.0 is released (changelog).
  • February 11, 2015: Spoon 3.1 is released (changelog).
  • December 9, 2014: Spoon 3.0 is released (changelog).
  • November 12, 2014: Spoon 2.4 is released (changelog).
  • October 9, 2014: Spoon 2.3.1 is released (changelog).
  • September 12, 2014: Spoon 2.1 is released (changelog).
  • April 2, 2014: Spoon 2.0 is released (changelog).
  • September 30, 2013: Spoon 1.6 is released.
  • April 12, 2012: Spoon 1.5 is released.

Github Contributors

Alphabetical order of last names

git log --pretty="%an" | sed -e '/Spoon Bot/d' | sort -u | awk 'NF>=2 {print "* " $0}' | sort -k3
  • David Bernard
  • Artur Bosch
  • Egor Bredikhin
  • Maxime CLEMENT
  • Benoit Cornu
  • Andre Cruz
  • Benjamin DANGLOT
  • Scott Dickerson
  • Yann Diorcet
  • Thomas Durieux
  • Sergey Fedorov
  • Alcides Fonseca
  • Clement Fournier
  • Jan Galinski
  • Nicolas Harrand
  • Mickael Istria
  • Mehdi Kaytoue
  • Urs Keller
  • Filip Krakowski
  • Lukas Krejci
  • Ashutosh Kumar Verma
  • Roman Leventov
  • Fan Long
  • Kai Luo
  • Matias Martinez
  • Luke Merrick
  • Martin Monperrus
  • Vincenzo Musco
  • Carlos Noguera
  • Gerard Paligot
  • Renaud Pawlak
  • Nicolas Petitprez
  • Phillip Schichtel
  • Lionel Seinturier
  • Miguel Sozinho Ramalho
  • Marcel Steinbeck
  • Christopher Stokes
  • Eddie T
  • Simon Urli
  • Pavel Vojtechovsky
  • Stefan Wolf
  • Diorcet Yann
  • Gregor Zeitlinger
  • Tomasz Zielinski

Early contributors:

  • Olivier Barais
  • David Bernard
  • Benoit Cornu
  • Favio DeMarco
  • Didier Donsez
  • Christophe Dufour
  • Sebastian Lamelas Marcote
  • Matias Martinez
  • Carlos Noguera
  • Renaud Pawlak
  • Nicolas Pessemier
Issues
  • review: feature: introduce the concept of

    review: feature: introduce the concept of "Pattern"

    This PR introduces a new concept Pattern, which is an improvement of TemplateMatcher, it allows to match EVERY attribute of Spoon model - not only a subset like current TemplateMatcher.

    The concept of Pattern is like this:

    • Pattern consists of List of RootNodes. Main implementation of RootNode is ConstantNode, which handles constant values of attributes and ElementNode, which knows the node type and a Map<CtRole, RootNode> of nodes for handling of specific attributes. So ElementNodes and ConstantNodes together makes up the tree of the pattern - it mirrors to be generated/matched Spoon AST.
    • The variables in Pattern are represented by ParameterNode which links ParameterInfo, which defines which value from Map of parameters (ParameterValueProvider) has to substituted.
    • Structure of Pattern is usually created by copying/mirroring of an example template Spoon AST, but after it is initialized the Pattern processing is based on implementations of RootNode interface only. It doesn't need origin Spoon AST - so the matching and generating algorithms are much simpler and more flexible then before. The pattern can be created dynamically by code. No need to declare it in source as Template class. But there is of course a way how to create Pattern from legacy Template class too because in some cases it is possible. More complex patters can be first created from Template (like before) and then adapted by extra PatternBuilder calls to adjust things which were not possible with legacy Templates.
    • The Patterns are created by PatternBuilder, which accept any spoon AST. Even the legacy Template can be used to initialize Pattern. It is subject of future work to make a PatternBuilder intuitive and usable for clients.

    Both algorithms generating of code from template and matching code by template are primary behavior of new patterns and are 100% compatible. Everything what can be generated can be matched and opposite.

    opened by pvojtechovsky 112
  • [question] method call hierarchy

    [question] method call hierarchy

    Hello, I'm new to spoon and I'm wondering if following is possible to do with spoon.

    I have method externalServiceCall(...) which is called from many places in my application. Can I have call hierarchy to this method? What I want to achieve is that I will generate mappings of my @RestController to externalServiceCall(...).

    this is what I'm thinking about:

    • get all calls of method externalServiceCall(...)
    • from all methods extracted from previous step extract first parameter which is some enumeration implementing Service interface (with this I can extract the name of service)
    • continue with call hierarchy of externalServiceCall(...) and go upper until I find some annotation on method. In this case I'm searching for spring's @RequestMapping

    So in final I can have something like:

    • EXTERNAL_SERVICE1:
      • GET /endpoint1
      • POST /endpoint1/{id}
    • EXTERNAL_SERVICE2:
      • DELETE: /endpoint1
      • DELETE: /endpoint2

    this is example of how the externalService call looks like externalServiceCall(ProductServiceEnum.GET_DETAIL, request)

    ...

    opened by bilak 109
  • review: introduction of CtScannerFunction

    review: introduction of CtScannerFunction

    As I mentioned in #1005 it is sometime needed to

    • R1 to know when query step of type filterChildren enter/exit an element on one selected query step.
    • R2 to be able to skip processing of children of current element
    • R3 to be able to skip processing of siblings and children of current elements
    • R4 to be able to make mapping functions aware of query processing state (actually mainly whether query is terminated)

    There is already a Query Execution Context (QEC) impelemented by class CtQueryImpl$CurrentStep.

    There are needed these two things to implement this PR:

    1. to get access to the QEC, or to provide own extension of that context
    2. to define API of that QEC, which can be used to
      • drive execution of query
      • or to get query processing state.
        • the list of all Functions of the query
        • the index of actually processed Function
        • the depth of current node in the tree of nodes visited by this query

    Access to QEC

    The client might get access to QEC, by these ways: Access1) CtQuery#createQueryContext() By creation of QEC before query is executed. Then that instance can be used in functions of query to drive query

    //1) create instance of QEC
     CtQueryContext cc = anElement.map(...).createQueryContext();
    //2) use QEC to process query and to drive query, etc.
    cc.forEach(...)
    

    Access2) CtQuery#setQueryContext() By creating an own instance of QEC and setting it to query

    //1) create instance of QEC
     CtQueryContext cc = new QEC();
    //assign that instance to query
    anElement.map(...).setQueryContext(cc).forEach(...)
    

    Access3) (CtQueryContext)outputConsumer By conversion of outputConsumer of CtConsumableFunction(Object,CtConsumer) to QEC.

    anElement.map((input, output)->{
    CtQueryContext cc = (CtQueryContext)output;
    //use cc to drive query
    }).forEach((output)->{
    CtQueryContext cc = (CtQueryContext)output;
    //use the same cc instance like above to drive query
    });
    

    Access4) CtQuery extends CtQueryContext CtQuery extends CtQueryContext, so all the methods are available through query instance.

    API of QEC

    There might be these methods on QEC:

    • setOutputConsumer(CtConsumer) - sets the CtConsumer which will get results of this query execution
    • accept(Object input) - executes the query with input.
    • setTerminated(boolean) - terminates whole query
    • boolean isTerminated() - returns true if query is terminated
    • void onEnter(CtQueryListener) - register listener which is called before element is sent to mapping function
    • void onEnter(Filter, CtQueryListener) - some like onEnter, but calls listener only for elements which match the filter.
    • void onExit(CtQueryListener) - register listener which is called after element is sent to mapping function
    • void onExit(Filter, CtQueryListener) - same like onExit, but but calls listener only for elements which match the filter.
    • void onExitOf(Object, CtQueryListener) - same like onExit, but calls listener only when element is same like provided object.
    • void skipElement(CtElement); - skips element and all children. The mapping function is not called for such element and it's children
    • void setSkipMode(SkipMode); - skips elements depending mode until next call of setSkipMode or end of query.
    interface CtQueryListener<T> {
       void onElement(T element, CtQueryContext QEC);
    }
    

    Example

    //create query listener which skips all children of method
    CtQueryListener ql = new CtQueryListener() {
      boolean skipping = false;
       //return false to skip current element
       boolean onElement(CtElement e, CtQueryContext context) {
           if(skipping) return false;
           if(e instanceof CtMethod) {
              //if client wants to be called on exit of this element, then he can register listener for that
              context.onExitOf(e, (e, context)->{
                 skipping = false;
              });
              return false;
           }
           return true;
       }
    }
    anElement.map(...)..onEnter(ql).forEach(...);
    

    ...to be continued... Feedbacks and suggestions are welcome

    opened by pvojtechovsky 98
  • feature: all you want for queries

    feature: all you want for queries

    Requirements/goals for new features of queries:

    1. support of lazy foreach (better performance for large queries because no creation of useless intermediate lists)
      • CtQuery extends Iterator would an elegant solution but not possible because a Scanner is not iterable
    2. support for chaining of foreach
      • what should be the elements given for the next steps?
    3. support for lazy evaluation in map for functions that returns an iterator (already works for functions returning Iterable).
    4. support for queries reusable over multiple inputs (CtQuery query = new CtBaseQueryImpl().map(...).map(...) )
    5. support for sending of results of one step directly to next step, without necessity to build helper lists.
    interface CtQuery { // already exists
      /** Performs an action on each element of the query results.
        * Implemented efficiently for CtScanner based queries */
      CtQuery forEach(CtQueryStep);
    }
    
    interface CtQueryStep {
      /** 
       * evaluates query step and applies mapping of one input element to many output elements.
       * The output elements are `returned` by call of `outputConsumer.accept(outputElement)`, 
       * which is called once for each outputElement
       */
       void evaluate(Object input, CtConsumer<Object> outputConsumer);
    }
    
    /**This interface is equivavlent to java 8 Consumer. 
    We can remove it after we upgrade to java 8 */
    interface CtConsumer<T> {
     void accept(T item);
    }
    

    The method CtQuery#map(CtQueryStep) is semantically equal to the existing method CtQuery#map(CtFunction). The only difference is the way how result of mapping is delivered to the next query step.

    • Implementation of CtFunction - returns result by return objectBooleanOrList;. This is optimal for mapping functions which returns 1 or few elements.
    • Implementation of CtQueryStep- returns result by outputConsumer.apply(item), which is called for each spoon model element, which has to be returned by this step. This is optimal for mapping functions, which returns many elements.

    I need a spoon query, which correctly returns all the references to an private or protected class field. It means that query must search for references in correct scope(s).

    There was an idea how to implement it during development of PR #1018, but then we removed that code for simplicity reasons.

    @monperrus does it makes sense to create a new PR, which will reuse the same ideas again or do you know some better way?

    opened by pvojtechovsky 75
  • review: feat: TokenWriter - support for custom pretty printed formatting

    review: feat: TokenWriter - support for custom pretty printed formatting

    This PR implements new interface

    /**
     * The token based and context aware printer.
     */
    public interface PrinterTokenWriter {
    	/**
    	 * Writes one token of printed java source code to the registered {@link PrinterHelper}
    	 * @param type The type of the token
    	 * @param token the value of the token. The value type depends on TokenType. See {@link TokenType#getTokenClass()}
    	 */
    	void writeToken(TokenType type, Object token);
    	/**
    	 * @return {@link PrinterHelper} which this {@link PrinterTokenWriter} delegates printing to
    	 */
    	PrinterHelper getPrintHelper();
    	/**
    	 * @param printerHelper {@link PrinterHelper} which this {@link PrinterTokenWriter} delegates printing to
    	 */
    	void setPrintHelper(PrinterHelper printerHelper);
    
    	/**
    	 * Notifies about actually printed AST node
    	 * @param element to be printed element
    	 */
    	void onElementEnter(CtElement element);
    	/**
    	 * Notifies that printing of AST node was finished
    	 * @param element just printed element
    	 */
    	void onElementExit(CtElement element);
    
    	/**
    	 * resets to the initial state
    	 */
    	void reset();
    }
    /**
     * Defines type of token produced by PrettyPrinter
     */
    public enum TokenType {
    	/**
    	 * One of the separator characters (){}[];,.:@=&lt;&gt;?
    	 */
    	SEPARATOR(String.class),
    	/**
    	 * The operator of an expression. For example "==", "*", ...
    	 */
    	OPERATOR(String.class),
    	/**
    	 * java keyword. For example "class", "public", ...
    	 */
    	KEYWORD(String.class),
    	/**
    	 * identifier. For example "TheNameOfMyClass_Or_VariableEtc"
    	 */
    	IDENTIFIER(String.class),
    	/**
    	 * all the spaces, new lines and tabs
    	 */
    	WHITESPACE(String.class),
    	/**
    	 * the java literals. For example
    	 * "I am string"
    	 * 'c'
    	 * -4785.45
    	 * 4456.65e10
    	 * 0x00101011B
    	 */
    	LITERAL(String.class),
    	/**
    	 * The java comment. The token is instance of {@link CtComment}
    	 */
    	COMMENT(CtComment.class),
    	/**
    	 * The java doc tag. The token is instance of {@link CtJavaDocTag}
    	 */
    	JAVA_DOC_TAG(CtJavaDocTag.class),
    	/**
    	 * Special case of printing of CtCodeSnippetStatement.
    	 * The tokens are not resolved here!
    	 * Note:  the token value is {@link CtComment}
    	 */
    	CODE_SNIPPET(String.class),
    	/**
    	 * Special case of printing method signature.
    	 * It does not happen during printing of full sources,
    	 * but happen when printing an individual {@link CtExecutableReference}
    	 */
    	METHOD_SIGNATURE(String.class),
    	/**
    	 * represents new line
    	 * Note:  there is no token value expected here
    	 */
    	NEW_LINE(Void.class),
    	/**
    	 * represents the defined number of tabs
    	 * Note:  there is no token value expected here
    	 */
    	TABS(Void.class);
    }
    

    and there is method DefaultJavaPrettyPrinter#setPrinterTokenWriter(PrinterTokenWriter) which can be used to register that token based writer.

    The implementer of `PrinterTokenWriter#writeToken(...)' has to call registered PrinterHelper to print that token. The implementer can ignore/add some tokens, depending on context. It makes sense when client wants to influence formatting of pretty printed source code. Thanks to #onElementEnter and #onElementExit client is aware of the printed context and can influence formatting in context specific way.

    This PR keeps complexity of DefaultJavaPrettyPrinter on the same level. The detection of tokens is done automatically by new PrinterWriterTokenStreamAdapter.

    It even makes possible to simplify DefaultJavaPrettyPrinter in future, because it does not have to call PrinterHelper#writeTabs(), which might be called automatically by DefaultPrinterTokenWriter.

    I believe that in future we can write a PrinterTokenWriter implementation, which uses same formatting (autodetected) like origin source code or template which was used to generate new source code ... but is just a far dream yet ;-)

    opened by pvojtechovsky 70
  • review: feature: add support for sniper mode

    review: feature: add support for sniper mode

    fix #1284

    opened by pvojtechovsky 54
  • feature: new query architecture with support for Java8 queries

    feature: new query architecture with support for Java8 queries

    Requirements for a new query architecture:

    • [x] map functions with arbitrary return types (incl. that are not CtElement)
    • [x] support for queries with Java 8 lambdas
    • [x] chained queries ( "chaining" means writing filterChildren(x).filterChildren(y)... or map(z).map(t)... or even filterChildren(p).map(q)...)
    • [x] lazy evaluation

    With this PR you can write code like

    CtMethod<?> method = ...
    List<CtMethod<?>> overridenMethods = Query.getElements(new OverriddenMethodFilter(method));
    

    Which makes usage of complex filters more reliable, because these filters can automatically define correct searching context. For example

    • OverriddenMethodFilter will search in root package
    • local variable reference filter will search in scope of its CtBock element
    • member variable reference filter will search in scope of its Class and depending on visibility in all inherited class, in current package or in root package
    • ...

    or you can write

    CtMethod<?> method = ...
    List<CtMethod<?>> overridenMethods = method.getElements(new OverriddenMethodFilter())
    

    which 1) is shortest code and 2) which will let us chain filters (later) into complex filters chains, which are able to browse spoon model in sequence of searching steps. I will probably need something like this for refactoring methods, I am preparing.

    opened by pvojtechovsky 52
  • tests fail with windows

    tests fail with windows

    cannot be built on windows see https://ci.inria.fr/sos/job/spoon-windows/

    bug 
    opened by spoon-bot 46
  • CtExecutableReference in cloned method should refer to the clone, not to the method being cloned.

    CtExecutableReference in cloned method should refer to the clone, not to the method being cloned.

    Diff of the test which fails:

    diff --git a/src/test/java/spoon/test/method/MethodTest.java b/src/test/java/spoon/test/method/MethodTest.java
    index 0b585aa0..d689d4c0 100644
    --- a/src/test/java/spoon/test/method/MethodTest.java
    +++ b/src/test/java/spoon/test/method/MethodTest.java
    @@ -17,6 +17,7 @@
    
     package spoon.test.method;
    
    +import org.junit.Assert;
     import org.junit.Test;
     import spoon.Launcher;
     import spoon.reflect.declaration.CtClass;
    @@ -24,6 +25,8 @@ import spoon.reflect.declaration.CtMethod;
     import spoon.reflect.declaration.CtType;
     import spoon.reflect.declaration.ModifierKind;
     import spoon.reflect.factory.Factory;
    +import spoon.reflect.reference.CtExecutableReference;
    +import spoon.reflect.visitor.CtScanner;
     import spoon.reflect.visitor.filter.NamedElementFilter;
     import spoon.test.delete.testclasses.Adobada;
     import spoon.test.method.testclasses.Tacos;
    @@ -110,4 +113,22 @@ public class MethodTest {
     		assertTrue(compareFound);
     	}
    
    +	@Test
    +	public void testCloneMethod() throws Exception {
    +		Launcher l = new Launcher();
    +		l.getEnvironment().setNoClasspath(true);
    +		l.addInputResource("src/test/resources/noclasspath/A2.java");
    +		l.buildModel();
    +		CtMethod<?> methodB = l.getFactory().Class().get("A2").getMethodsByName("b").get(0);
    +		CtMethod<?> methodClone = methodB.clone();
    +		methodClone.accept(new CtScanner() {
    +			@Override
    +			public <T> void visitCtExecutableReference(CtExecutableReference<T> reference) {
    +				if (reference.getDeclaration() == methodB) {
    +					Assert.fail("Cloned method shouldn't have references to the former method");
    +				}
    +				super.visitCtExecutableReference(reference);
    +			}
    +		});
    +	}
     }
    
    opened by leventov 42
  • regression in gumtree-spoon-ast-diff

    regression in gumtree-spoon-ast-diff

    See https://ci.inria.fr/sos/job/gumtree-spoon-ast-diff/

    bug 
    opened by spoon-bot 40
  • Handling of receiver parameters

    Handling of receiver parameters

    This issue covers the general handling of receiver parameters in spoon.

    Receiver parameters were introduced with Java 8. They are specified in JLS 8.4 with example code in JLS 8.4.1.

    Spoon got support for this feature with this Pull request (related issue). Currently, spoon handles receiver parameters in the same way other parameters are handled too. This brings us to the first issue: When creating a CtExecutableReference (using CtExecutable#getReference() or ExecutableFactory#createReference(CtExecutable<?>)), the receiver parameter is included. For me, this is unexpected or even wrong, and a call to CtExecutableReference#getActualMethod() will always return null.

    Having the receiver parameter in the parameter list also makes the creation of invocations harder, as you manually need to ignore receiver parameters on your own.

    A second issue becomes visible when looking at the example code in the JLS: For now, spoon only handles methods. A receiver parameter in a constructor of an inner class (referencing the enclosing class) will simply be ignored and does not appear in the model created by spoon.

    Adding support for constructors in the same way as with methods should be pretty simple, but I'd like to discuss alternatives of how to represent receiver parameters in the metamodel altogether.

    I thought about several solutions with different pros and cons:

    1) Add a isReceiver(): boolean method to CtParameter

    Pros:

    • Backwards compatible
    • Allows to check if a parameter is a receiver parameter without the need to check CtParameter#getSimpleName().equals("this")
    • Can be implemented by either setting a boolean or just checking CtParameter#getSimpleName().equals("this") internally
    • Works for both constructors and methods directly

    Cons:

    • Only one parameter (the first) can be a receiver parameter - we have very specific code in a less specific class
    • Static methods and non-inner constructors do not allow receiver parameters - this is not modeled with this solution
    • CtExecutableReference#getParameters() still returns a list of CtTypeReferences including the receiver parameters
      • Duplicating the isReceiver() method in CtTypeReference would increase code that does not really belong there
      • In best case, you should not need to check the CtParameters of the CtExecutable to see if a CtTypeReference is a receiver
    • The receiver parameter is not part of the method signature but in the list of method parameters - this might be unexpected for any work with the API

    2) Add a hasReceiver(): boolean method to CtExecutable

    a) but keep the parameter in the parameter list

    Pros:

    • Backwards compatible
    • Easy to implement, basically the same way as mentioned in 1) by checking the first parameter (if present) or a boolean
    • Works for both constructors and methods directly
    • The receiver parameter is unique in its name (besides qualified names like Outer.Inner.this) and position (0) and is represented in the model this way

    Cons:

    • Should be reflected in CtExecutableReference too
    • The receiver parameter is still in the list of parameters

    b) and remove it from the parameter list

    Pros:

    • Easy to implement
    • Works for both constructors and methods directly
    • Does not infer with the parameter list for invocations and references

    Cons:

    • Not backwards compatible if the current way is considered to be correct, although I'm not sure what to expect when reading the current documentation of CtExecutable#getParameters() or CtParameter

    3) Add a CtReceiver

    Do not add it to the parameter list but add get/setReceiver() methods. Add the respective properties to CtExecutable. I'm not sure if it should be part of CtExecutableReference with a CtReceiverReference or similar.

    (super types of CtReceiver might be discussed)

    Pros:

    • Makes it easy to deal with other parameters
    • Makes dealing with receiver parameters easy as well
    • Allows to keep track of additional information (as e.g. qualified names)
    • Does not infer with the parameter list for invocations and references
    • Works for both constructors and methods directly

    Cons:

    • Not backwards compatible in the way described in 2b)

    4) Only add support for constructors the same way as for methods

    Pros:

    • Easy to implement

    Cons:

    • None of the points I considered above are applied
    • Handling receiver parameters is more difficult
    • Handling constructors without thinking about receivers will be error prone (could even break existing code)

    Some general questions:

    • How to deal with a CtExecutable#addParameterAt(int, CtParameter) with 0 as position? (e.g. refactoring a method and its invocations by adding a parameter at 0 would fail currently)
    • Would anyone expect receiver parameters in the parameter list? Would it makes sense to clarify the docs in such places?

    Side note: When looking at the code, I was super confused because the JDT Receiver is never traversed by JDT itself - in contrast to the other arguments, annotations, type parameters, etc. I don't know if this is a bug in JDT, but calling the traverse method ourselves is fine I guess.


    I'm happy to implement any of this, or modified variants depending on your opinions and ideas. Feedback is very welcome.

    opened by SirYwell 0
  • Fix keyword list not accounting for compliance level

    Fix keyword list not accounting for compliance level

    This PR fixes #4067

    Added a test case similar to the problem encountered with the example from astor.

    opened by andre15silva 0
  • Compliance level is not used in keyword constraint

    Compliance level is not used in keyword constraint

    Context

    In CtReferenceImpl, the function checkIdentiferForJLSCorrectness checks names for correctness, which includes checking wether any part of it is a keyword:

    https://github.com/INRIA/spoon/blob/34cfb5d6178c63f34e851acf24b22f9c10fa175b/src/main/java/spoon/support/reflect/reference/CtReferenceImpl.java#L123-L125

    Issue

    Not all keywords have been in the Java specification since the beggining (see https://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html). Namely, enum was only introduced in 5.0.

    The issue with setting keywords in this way is that there is no way of using the specified compliance level to build models that do use keywords like enum with lower than 5.0 compliance level.

    Example: https://github.com/SpoonLabs/astor/blob/ff5dc0b1a4fbc1cb2fe72c68189a5ba02fa81a9b/examples/lang_63/src/test/java/org/apache/commons/lang/enum/EnumTest.java#L18

    opened by andre15silva 0
  • Bug: CtInvocation<Void> matches invocations of non-void methods in inner classes

    Bug: CtInvocation matches invocations of non-void methods in inner classes

    When executing the following processor

    public class InvocationProcessor extends AbstractProcessor<CtInvocation<Void>> {
        @Override
        public void process(CtInvocation<Void> element) {
            CtExecutableReference<Void> executable = element.getExecutable();
            Method method = executable.getActualMethod();
        }
    

    on the class

    public final class Outer {
        public final class Inner {
            public Inner foo() {
    	        return new Inner();
            }
            public Inner bar() {
    	        return foo();
            }
        }
    }
    

    a SpoonClassNotFoundException("cannot load class Outer$Inner") with "ClassNotFoundException: Outer$Inner" as its cause is thrown when calling executable.getActualMethod().

    Actually foo() returns an object of type Inner, so the processor shouldn't trigger.

    opened by Feuermagier 0
  • WIP: fix: Fix the insertion order for CtStatementListImpl.insertBegin

    WIP: fix: Fix the insertion order for CtStatementListImpl.insertBegin

    WIP

    #4060

    In #4063, I fixed CtCaseImpl.insertBegin, this PR aims to fix CtStatementListImpl.insertBegin. They have a similar bug and a similar fix, so I thought it's best to fix them simultaneously, so that we are able to close #4060 in concrete terms.

    Also, this test is killing this mutation

    Screenshot 2021-07-26 at 3 13 14 PM

    link to #3967

    opened by Rohitesh-Kumar-Jain 0
  • Renovate is updating GHA commit hashes to the latest version on the main branch, as opposed to latest release version

    Renovate is updating GHA commit hashes to the latest version on the main branch, as opposed to latest release version

    This is a problem. We only want stable versions of actions, unless we specifically request otherwise.

    Perhaps there's a setting somewhere to adjust this?

    chore 
    opened by slarse 0
  • review: fix: Fix the insertion order for CtCaseImpl.insertBegin

    review: fix: Fix the insertion order for CtCaseImpl.insertBegin

    WIP

    #4060

    Also, this test is killing this mutation

    Screenshot 2021-07-26 at 11 32 58 AM

    link to #3967

    opened by Rohitesh-Kumar-Jain 3
  • Spoon integrators are on vacation

    Spoon integrators are on vacation

    If you've been active in the repo during the past week, you may have noted an alarming absence of input from the Spoon integrators. That's due to circumstances of work and life, we had to go on somewhat overlapping vacations (not completely, but somewhat).

    We are not ignoring your issues or pull requests, we're just taking some much needed time off. We'll start trickling back in the first half of August. Until then, feedback from integrators on PRs and issues will not be as frequent as usual.

    community 
    opened by slarse 1
  • bug: insertBegin method is inserting list in reverse order than it should be

    bug: insertBegin method is inserting list in reverse order than it should be

    Context

    Hi while writing test for CtCaseImpl.insertBegin, I feel that the core logic of this method is implemented incorrectly.

    JavaDoc for this method states :

    Screenshot 2021-07-23 at 5 13 24 PM

    Problem

    insertBegin should add the list at the beginning of the block in the order of the elements inside the list, but it is adding in the reverse order of the elements inside the list.

    What I mean is that after inserting a list consisting of statements :

    [first statement, second statement, third statement] they should be added like this :

    first statement 
    second statement 
    third statement
    existing statement(s)
    

    But they are being added like

    third statement 
    second statement 
    first statement 
    existing statement(s)
    

    The existing code is working in the way as you are inserting individual statements, and not the whole list

    It is based on the reasoning that the addition should be like this :

    list
    existing statements(s)
    

    And as the list is inserted in the beginning, the content of the list shouldn't be altered

    Failing test Case

    I have written this test to enforce this

    @Test
        void testInsertBeginWithListOfStatements() {
            // contract: insertBegin add a list of statements at the beginning of a case, i.e above two already existing statements
    
            // arrange
            Launcher spoon = new Launcher();
            spoon.addInputResource(new FileSystemFile("./src/test/java/spoon/test/ctCase/testclasses/ClassWithSwitchExample.java"));
            spoon.buildModel();
    
            CtClass classWithSwitchExample = spoon.getFactory().Class().get(ClassWithSwitchExample.class);
    
            CtStatement firstStatementToBeInserted = classWithSwitchExample.getFactory().Code().createCodeSnippetStatement("first Statement");
            CtStatement secondStatementToBeInserted = classWithSwitchExample.getFactory().Code().createCodeSnippetStatement("second Statement");
            CtStatement thirdStatementToBeInserted = classWithSwitchExample.getFactory().Code().createCodeSnippetStatement("third Statement");
            CtCase testCase = classWithSwitchExample.getElements(new TypeFilter<>(CtCase.class)).get(0);
    
            CtStatementList ctStatementList =  new CtStatementListImpl<CtStatement>();
    
            ctStatementList.addStatement(firstStatementToBeInserted);
            ctStatementList.addStatement(secondStatementToBeInserted);
            ctStatementList.addStatement(thirdStatementToBeInserted);
    
            // act
            testCase.insertBegin(ctStatementList);
    
            // assert
            assertEquals(firstStatementToBeInserted, testCase.getStatement(0));
            assertEquals(secondStatementToBeInserted, testCase.getStatement(1));
            assertEquals(thirdStatementToBeInserted, testCase.getStatement(2));
        }
    

    Solution

    I will be happy to fix this bug, once given permission to work upon this from the community : )

    I will be pushing this test along with other tests I have written for this Class.

    bug 
    opened by Rohitesh-Kumar-Jain 8
Releases(spoon-core-9.0.0)
  • spoon-core-9.0.0(Mar 18, 2021)

  • spoon-core-8.3.0(Oct 26, 2020)

  • spoon-core-8.2.0(Jul 29, 2020)

  • spoon-core-8.1.0(Mar 23, 2020)

  • spoon-core-8.0.0(Nov 6, 2019)

    New features

    • Add new variable refactoring class. (PR: #3162)
    • Add role EMODIFIER for extended modifier. (PR: #3098)
    • CtImportVisitor#visitUnresolvedImport. (PR: #3086)
    • DecompiledResource: Add a SpoonResource that can be used in any launcher. (PR: #3124)
    • SpoonifierVisitor: A visitor that generates the spoon code to recreate a spoon model. (PR: #3105)
    • decompiler: Add support for procyon. (PR: #3123)
    • visualisation
      • Panel added to show Spoon objects' properties. (PR: #3107)
      • Spoon visualiser improvement for accessing JavaDoc. (PR: #3101)
    • spoon-visualisation: Spoon AST visualisation tool. (PR: #3072)

    Bug Fixes

    • CreateVariableAssignment now creates a CtVariableWrite. (PR: #3157)
    • Fixes the toString() call on an array. (PR: #3134)
    • CtCompilationUnitImpl: Fix regression after auto-import refactoring. (PR: #3131)
    • Fix regression when rewriting static field access. (PR: #3115)
    • The type of string concatenation is not null. (PR: #3075)
    • (ParentExiter.java): set position for implicit loop body block. (PR: #3084)
    • Fix regression in field accesses of static fields. (PR: #3139)
    • Improve backward compatibility of toString and add toDebugString. (PR: #3099)
    • Don't check modifiers in CtVariable#getDeclaringType. (PR: #3066)
    • Fix regression in pretty printer (default DJPP is fully qualified). (PR: #3132)
    • Fix incorrect model for empty for loop. (PR: #3108)
    • Fix more regressions after auto-import refactoring. (PR: #3127)
    • ToStringWithImports works even with no position. (PR: #3110)
    • Fix regression in auto-import. (PR: #3125)
    • Indeed call the preprocessors in toString/autoimports. (PR: #3103)
    • CtElementImpl#toString: Fix toString for SniperPrinter. (PR: #3147)
    • DefaultJavaPrettyPrinter: Support for inline else if. (PR: #3088)
    • ImportCleaner: Import must be kept when they are used in Javadoc. (PR: #3160)
    • Iterators: Next() first checks hasNext and throws the correct error. (PR: #3164)
    • PositionBuilder: Fix lambda parameters position. (PR: #3137)
    • SourceFragmentContext: Visit field reference in import as well. (PR: #3161)
    • SourceOptions: Close the output stream in SourceOptions. (PR: #3089)
    • TypeNameScope: Order of processing LexicalScope elements of Type. (PR: #3085)
    • core: Parsing a one-line class produces correct line numbers. (PR: #3069)
    • import: Fix regression after import refactoring. (PR: #3149)
    • pom: Update/add license header in poms. (PR: #3143)

    Documentation

    • Add API documentation to public methods. (PR: #3152)
    • Add archunit to related work in architecture enforcement. (PR: #3146)
    • Improve documentation while preparing the MadridJUG meetup. (PR: #3141)
    • Improve landing page. (PR: #3128)
    • Minor improvement to example page. (PR: #3100)
    • Add example for snippet filtering. (PR: #3062)
    • ROADMAP.md: Roadmap 100% points to issues. (PR: #3119)
    • launcher.md: Improve decompilation doc. (PR: #3130)
    • visualisation: Mention the visualisation tool on the website. (PR: #3102)

    Refactoring

    • Use .equals() when comparing Strings and Boxed types. (PR: #3165)
    • Rename internal method with particularly confusing name. (PR: #3109)
    • Handling of imports in pretty printer. (PR: #2683)
    • Decompiler: Update interface (in preparation for DecompiledResource). (PR: #3122)
    • NoSourcePosition: Applies the null design pattern to compilation units. (PR: #3151)

    Authors

    | Name | Nb Commit | |---------|-----------| | Martin Monperrus | 30 | | Nicolas Harrand | 14 | | arno | 5 | | Haris Adzemovic | 3 | | Pavel Vojtechovsky | 3 | | Egor Bredikhin | 2 | | Rhys Compton | 1 | | Muhammet Ali AKBAY | 1 | | Simon Urli | 1 | | Thomas Durieux | 1 | | HectorSM | 1 | | Lionel Seinturier | 1 |

    Source code(tar.gz)
    Source code(zip)
  • spoon-decompiler-0.1.0(Sep 26, 2019)

  • spoon-core-7.5.0(Jul 28, 2019)

  • spoon-core-7.4.0(May 13, 2019)

    New features

    • Add CtType#toStringWithImports. (PR: #2945)
    • Check if a CtType is an array type. (PR: #2882)
    • CtBFSIterator: Add an iterator that explores a CtElement's children in breadth first order. (PR: #2904)
    • CtElement: Add a method to get all direct children of an element. (PR: #2906)
    • CtCommentImpl: Add _setRawContent to be able to bypass cleanComment. (PR: #2889)

    Bug Fixes

    • Handle special cases in CtAnnotationType. (PR: #2947)
    • Test and fix untested method createNewClass(). (PR: #2943)
    • Give appropriate permissions of files in doc folder. (PR: #2949)
    • Improve getCorrespondingRuntimeObject/convertElementToRuntimeObject to handle shadow fields. (PR: #2899)
    • JarLauncher: Fix #2951, Really delete temporary decompiled source directory. (PR: #2952)
    • ContextBuilder: Catch PositionBuilder exception and log it instead of crashing. (PR: #2907)
    • CtCompilationUnitImpl: ToString() no longer throws a NPE. (PR: #2918)
    • position: Type of CtNewClass is implicit without position. (PR: #2834)
    • TypeFactory: Raise an exception for deprecated createTypeParameterReference wildcard. (PR: #2890)

    Documentation

    • Add example for CtAssert#setExpressiont #2917. (PR: #2917)
    • Fix links in doc page "Examples of Spoon Usages". (PR: #2932)
    • CONTRIBUTING.md mentions our architectural rules. (PR: #2929)
    • Add & update links in the example page. (PR: #2925)
    • Fix jenkins badge. (PR: #2924)
    • Fix typos in slides. (PR: #2948)
    • Add example for CtAssert#setExpression. (PR: #2917)
    • Fix broken documentation. (PR: #2968)
    • Fix remaining Javadoc issues. (PR: #2910)
    • Fix doc in JavadocDescription.java. (PR: #2909)
    • Improve documentation on AST traversal. (PR: #2905)
    • Add slide decks. (PR: #2937)
    • Release.md: Improve documentation about releasing after release of 7.3.0. (PR: #2881)
    • spoon-control-flow: Fix javadoc errors. (PR: #2916)
    • command_line.md: Remove link to decommissioned Gforge. (PR: #2900)

    Refactoring

    • JDTCommentBuilder: Improve error message with position of offending comment. (PR: #2908)

    Tests

    • SourcePositionTest: Don't save temporary files in ./src. (PR: #2969)
    • Rename ArchitectureTest into DecompilerArchitectureTest in spoon-decompiler to avoid confusion. (PR: #2930)
    • CtTypeReference: Add test for methods CtTypeReference#unbox() and box(), fix #1842. (PR: #2919)
    • FieldAccessTest: Nested field access, and example for #2884.

    Other

    • Exclude GUI from coverage. (PR: #2940)
    • Switch to junit5. (PR: #2939)
    • Add Sonar Quality Gate badge. (PR: #2935)
    • Fix javadoc and reporting config and check it in CI. (PR: #2911)
    • Clean parent pom.xml. (PR: #2883)
    • Bump to 7.4.0-snapshot. (PR: #2874)

    Unknown

    • Adopt dual licensing MIT-CECILL-C (#2950). (PR: #2950)
    • Up. (PR: #2941)
    • Update the list of contributors. (PR: #2912)
    • Eclipse` in README. (PR: #2903)

    Authors

    | Name | Nb Commit | |---------|-----------| | Martin Monperrus | 28 | | Nicolas Harrand | 9 | | Alexander Shopov | 2 | | Charm | 1 | | Pavel Vojtechovsky | 1 | | GluckZhang | 1 | | Fabien DUMINY | 1 | | Simon Urli | 1 | | Mickael Istria | 1 |

    Source code(tar.gz)
    Source code(zip)
  • spoon-core-7.3.0(Feb 10, 2019)

    New features

    • Introduce the concept of lexical scope (interface LexicalScope). (PR: #2813)
    • Allow spoon to support duplicate definitions. (PR: #2772)
    • Add module for control-flow analysis. (PR: #2827)

    Bug Fixes

    • Fix NPE for multicatch qualified exceptions. (PR: #2862)
    • Reference of CtImport is fully qualified and has no generics. (PR: #2819)
    • IndexOutOfBoundsException in JDTCommentBuilder. (PR: #2840)
    • Fix static type wildcard imports. (PR: #2865)
    • Refactor code->runtime methods so that CtAnnotation#getValueOfObject does not overflow. (PR: #2866)
    • Fix classpath error with surefire. (PR: #2867)
    • Security issue with jackson-databind. (PR: #2856)
    • CompilationUnit has lineSeparatorPositions even for empty class. (PR: #2824)
    • Fix position of type modifier after comment. (PR: #2825)
    • NPE in JDTCommentBuilder. (PR: #2822)
    • PositionBuilder: Prevents exception for incomplete modifiers' position information. (PR: #2848)
    • position
      • Source position of CtFieldReference. (PR: #2830)
      • Position of reference of import and package declaration. (PR: #2832)
      • Fix source position of new ArrayList<>(). (PR: #2833)
    • doc: Fixes#2790 javadoc site deployment, adapting to new modules organization. (PR: #2826)

    Documentation

    • Fix broken link. (PR: #2871)
    • Fix unrendered link in doc. (PR: #2851)
    • Fix broken snippet. (PR: #2841)

    Refactoring

    • Rename getCurrentNameScope to getCurrentLexicalScope. (PR: #2857)
    • Access to JDK CompilationUnit contents and lineSeparatorPositions. (PR: #2831)
    • Refactor refactoring code :-) in Refactoring#copyType(). (PR: #2820)
    • performance: Optimize incremental launcher. (PR: #2821)

    Tests

    • MavenLauncher: Test that system dependencies are resolved in classpath fix #1682. (PR: #2836)

    Other

    • pom.xml: Updating commons-io and commons-lang3. (PR: #2853)
    • Moves JUnit dependency to parent pom. (PR: #2828)
    • Clean old Travis scripts. (PR: #2829)

    Community

    • Nicolas Harrand becomes integrator. (PR: #2818)

    Authors

    | Name | Nb Commit | |---------|-----------| | Pavel Vojtechovsky | 10 | | Martin Monperrus | 9 | | Egor Bredikhin | 3 | | Nicolas Harrand | 3 | | Thomas Durieux | 1 | | Kai Luo | 1 | | Benjamin DANGLOT | 1 | | Lionel Seinturier | 1 | | Simon Urli | 1 | | Clément Fournier | 1 |

    Source code(tar.gz)
    Source code(zip)
  • spoon-core-7.2.0(Dec 4, 2018)

    New features

    • Add CtImportVisitor. (PR: #2730)
    • Add CtTypeReference#canAccess(CtTypeMember). (PR: #2815)
    • AllTypeMembersFunction has new mode SKIP_PRIVATE. (PR: #2803)
    • Add support for javadoc inline tags. (PR: #2802)
    • Add encoding detection callback. (PR: #2788)
    • EarlyTerminatingScanner can scan content of compilation units. (PR: #2793)
    • Add assertCtElementEquals. (PR: #2767)
    • Add CtAbstractImportVisitor. (PR: #2764)
    • Add CtTypeReference#implicitParent. (PR: #2805)
    • Add CtComment#getRawContent(). (PR: #2746)
    • New CtTypeMemberWildcardImportReference for import package.Type.*. (PR: #2731)
    • CtScannerListener knows role of scanned element. (PR: #2739)
    • Add CtCompilationUnit for future import and sniper improvements. (PR: #2702)
    • Use Apache Common Compressor API to [de]compress serialized models. (PR: #2165)
    • Add metamodel concept CtPackageDeclaration. (PR: #2707)
    • Add support for Fernflower for decompilation. (PR: #2668)
    • Add support for transformation at load-time in the JVM. (PR: #2645)

    Bug Fixes

    • CtQueryImpl#detectTargetClassFromCCE, FilterTest#testInvalidQueryStep: Adapt parsing of ClassCastException message which has changed in oracle jdk 11. (PR: #2787)
    • FieldAccessTest: Adapt FieldAccessTest to oracle jdk 11/jdt changes. (PR: #2789)
    • MainTest: Quickfix for Travis 10min timeout. (PR: #2667)
    • doc: Explain the different kinds of pull-requests. (PR: #2647)
    • documentation: Pattern.md. (PR: #2735)
    • javadoc: Replace deprecated by better javadoc. (PR: #2663)
    • printer: Add space before else of if statement. (PR: #2679)
    • test
      • MainTest#testGenericContract on MS Windows. (PR: #2814)
      • ImportTest. (PR: #2816)
    • Modifiers of enum members. (PR: #2630)
    • One can call getModifiers on ".class" of "Aclass.class". (PR: #2776)
    • Fix incomplete behavior: Javadoc#setContent should parse tags. (PR: #2765)
    • Parsing of java version not starting with "1." in pom.xml. (PR: #2729)
    • CtPackageDeclaration has a valid source position. (PR: #2760)
    • JDT spoon compiler builds imports and then comments. (PR: #2807)
    • Broken link in papers.md. (PR: #2749)
    • CtImport position includes its comment. (PR: #2810)
    • PatternMatcher ignores isImplicit. (PR: #2726)
    • CtExecutableReference cannot use CtTypeParameterReference. (PR: #2725)
    • Upgrade insecure commons-compress to latest version. (PR: #2717)
    • Fix comment of CtAnnotation value. (PR: #2587)
    • MetamodelProperty#containerKindOf knows Collection. (PR: #2705)
    • Invalid error log message in ContextBuilder#getVariableDeclaration. (PR: #2677)
    • CtPackageDeclaration position doesn't include top file comment. (PR: #2811)
    • Sniper printer leaves when no more child tokens. (PR: #2808)
    • ChangeCollector detects changes in CtCompilationUnit too. (PR: #2794)
    • Use Environment encoding when writing files on disk. (PR: #2796)
    • Fix invalid if model with empty statements in then/else branch. (PR: #2733)

    Documentation

    • Improve documentation about release process. (PR: #2650)
    • Remove all hard coded version numbers to simplify release. (PR: #2786)
    • Spoon-decompiler is not spoon-bytecode. (PR: #2784)
    • Getting started for external dependency. (PR: #2752)
    • Fix broken link in doc. (PR: #2743)
    • Fix javadoc in TypeFactory.java. (PR: #2688)
    • Remove link to decommissioned Gforge. (PR: #2792)
    • Updated spelling and formatting of path.md page. (PR: #2696)
    • Add missing javadoc for PatternPrinter. (PR: #2689)
    • Fix @link in javadoc. (PR: #2685)
    • Fix contract sentence. (PR: #2691)
    • Add example in path.md. (PR: #2661)
    • website: Document IncrementalLauncher. (PR: #2651)

    Refactoring

    • Fix sonarqube - use Java array syntax (not C-like). (PR: #2686)
    • Better handling of SourceFragment in CompilationUnit. (PR: #2806)
    • Sort modifiers in ModelStreamerTest.java. (PR: #2755)
    • Excluding decompiler related features from spoon-core. (PR: #2766)
    • GetDocComment uses the same implementation as pretty-printer. (PR: #2775)
    • Improve error message with Spoon testing fluent API. (PR: #2769)
    • In clone code, builder.copy is called first. (PR: #2768)
    • JavaOutputProcessor uses Environment#createPrinter(). (PR: #2759)
    • Better error handling in CtFieldReference#getActualField. (PR: #2754)
    • Replace List<? extends Object> by List<?> in PatternTest. (PR: #2753)
    • Remove redundant cast. (PR: #2700)
    • Remove useless assignment in JDTTreeBuilderHelper.java. (PR: #2690)
    • Simplify negation (fix SonarQube). (PR: #2695)
    • CtTypeAccess#implicit is derived now. (PR: #2804)
    • Change assertion from assertSame to assertEquals. (PR: #2687)
    • Remove redundant parentheses in PatternBuilder. (PR: #2653)
    • Use static import for asserts in tests. (PR: #2655)
    • Remove redundant 'super' call from SpoonClassFileTransformerTest.java. (PR: #2678)
    • SourcePosition#equals should take into account all information. (PR: #2660)
    • Replace by . (PR: #2675)
    • Flip order of comparison - put literal first to lower risk of NPE. (PR: #2674)
    • Add missing braces to tests. (PR: #2673)
    • Remove deprecated annotation (for sonarqube). (PR: #2665)
    • Add final modifier. (PR: #2664)
    • Stream handling in SerializationModelStreamer#load(InputStream). (PR: #2635)
    • Replace length()==0 by isEmpty(). (PR: #2658)

    Performance

    • .travis.yml: Merge travis builds to fall under 5 builds. (PR: #2782)
    • MainTest: Parallelize execution of testElementToPathToElementEquivalency. (PR: #2694)
    • Cache result of CtTypeReference#findClass(). (PR: #2591)

    Tests

    • Remove long logs fof CtGenerationTest which makes CI log unreadable. (PR: #2750)
    • Minimize logs in FilterTest. (PR: #2756)
    • Generic contracts are run only on .testclasses.. (PR: #2716)
    • Use contains instead of indexOf. (PR: #2715)
    • Relax intercession test to prepare #2615. (PR: #2706)
    • Remove redundant cast. (PR: #2704)
    • Relax intercession test to prepare #2615.
    • Constructor with this(xxx) replaced by super(xxx)?. (PR: #2680)
    • In tests also, windows's classpath elements are separated by semi column. (PR: #2692)
    • IncrementalLauncherTest: Attempt to remove flackiness on windows CI. (PR: #2745)

    Other

    • Do not execute checkstyle for all jobs. (PR: #2799)
    • Maven-javadoc-plugin now supports the doclint parameter. (PR: #2800)
    • Check style doesn't check left curly on lambda. (PR: #2795)
    • Update build.sh to use the correct snapshot repo in Jenkins. (PR: #2777)
    • Change jenkins/build.sh to allow passing maven parameters. (PR: #2723)
    • Fix security issue in dependency. (PR: #2697)
    • Prepares checkstyle checking for src/test/java. (PR: #2611)
    • Remove deprecated methods after release. (PR: #2649)
    • Bump info after release of 7.1.0. (PR: #2648)

    Unknown

    • 7.2.0 released on Central.
    • Explicit rule on how integrators are chosen. (PR: #2791)
    • AccessFullyQualifiedFieldTest.java. (PR: #2656)

    Authors

    | Name | Nb Commit | |---------|-----------| | Pavel Vojtechovsky | 38 | | Martin Monperrus | 27 | | Tomasz Zieliński | 23 | | Nicolas Harrand | 12 | | Egor Bredikhin | 3 | | Simon Urli | 3 | | Mehdi Kaytoue | 1 | | lodart | 1 | | raymogg | 1 |

    Source code(tar.gz)
    Source code(zip)
  • spoon-core-7.1.0(Oct 10, 2018)

  • spoon-core-7.0.0(Jul 4, 2018)

    Changelog

    All potentially breaking changes are marked with a ":warning:"

    Major new features

    • Java 10 is now fully supported in Spoon (PR: #2054)
    • A new mechanism for matching code called "Pattern", see http://spoon.gforge.inria.fr/pattern.html. Kudos to @pvojtechovsky for this amazing job! (PR: #1686)

    New features

    • :warning: Explicitly fail when an element is added twice to two different parents. (PR: #2009)
    • :warning: Enable comments by default. (PR: #2065)
    • One can get annotation values directly. (PR: #2036)
    • Add the ability to follow the progress of the creation of the Spoon model. (PR: #2043)
    • Add support for incremental build. (PR: #1905)
    • Handles range version in MavenLauncher. (PR: #2057)
    • Introduce the concept of "Pattern". (PR: #1686)
    • Add CtAnnotation#getAllValues to reason about all annotation values. (PR: #2042)
    • Gzip model serialization. (PR: #2103)
    • EqualsVisitor can report which attribute is not equal. (PR: #1998)
    • Add CtElement#descendantIterator and CtElement#asIterable. (PR: #1986)
    • Add CtIterator for dfs-based iteration of CtElement's descendants. (PR: #1980)
    • Add SourcePosition#isValidPosition(), to detect invalid position without null or -1 checks. (PR: #1964)
    • Add #getSourceDetails to debug source code positions. (PR: #1950)
    • API methods to know when the initial model is built. (PR: #2138)
    • Add support to Java 10. (PR: #2054)
    • Add CtAnnotation#getWrappedValue to provide a regular interface for annotation values. (PR: #1935)
    • experimental: Add ChangeCollector to listen on changes and remembers them. (PR: #1941)
    • position: Add the position of the modifier in the ast. (PR: #1959)

    Bug Fixes

    • executable: Fix npe in getExecutableDeclaration when declaring type is null. (PR: #2021)
    • mavenlauncher: Add support for Maven dependency management. (PR: #2024)
    • metamodel: Mark unsettable setters of name, modifier and label. (PR: #2048)
    • module: Spoon is able to build Java 9 code with modules in full classpath. (PR: #2070)
    • pattern: Improve handling of CtTypeReference Pattern parameters. (PR: #2078)
    • position
      • Fix enum constructor call. (PR: #2146)
      • Fix position of nested type arguments like List<List<?>>. (PR: #2142)
      • Fix position of CtForEach. (PR: #2152)
      • Invalid end column. (PR: #2159)
      • Position of expressions ending with wildcard. (PR: #2151)
      • Position of CtCase includes it's statements. (PR: #2150)
      • Fix position of String arg[] and lambda parameter. (PR: #2149)
      • CtCatch has no modifiers, they are in CatchVariable. (PR: #2156)
      • Fix source position of empty method body. (PR: #2145)
    • reference: Fix npe in getTypeReference when the reference is null. (PR: #2020)
    • Bug in AccessibleVariablesFinder when executed after PartialEvaluation. (PR: #2123)
    • Fix line separators in test. (PR: #2111)
    • The imports are properly computed after processing. (PR: #2083)
    • Finish the change about the default classpath mode. (PR: #2074)
    • Enum#valueOf is now well shadowed. (PR: #2096)
    • Bug when getting CU from a parsed snippet. (PR: #2086)
    • Fix source position of CtCatch and CtCatchVariable. (PR: #2128)
    • DJPP is more tolerant to inconsistent model. (PR: #1903)
    • Init RoleHandler lazily to pass when RoleHandler is generated. (PR: #2068)
    • Fix missing license header. (PR: #2075)
    • Fix regression in Template. (PR: #2069)
    • Proper support for "Object[]::new" constructs. (PR: #1945)
    • NPE when calling getQualifiedName on some CtFieldReference. (PR: #2135)
    • Fix position of (String arg[]). (PR: #2015)
    • Support creation of partial shadow classes. (PR: #2040)
    • VarArgs parameters always have a CtArrayTypeReference type. (PR: #2131)
    • Prevent NPE due to getDeclaringType. (PR: #2039)
    • Fix regression due to #2009. (PR: #2035)
    • CtAnnotation#getValue returns the default value if one exists. (PR: #2034)
    • Detection of lambda expression method. (PR: #2023)
    • Expression type cast source positions. (PR: #2113)
    • Fix low-level JDT error due to some annotations (in particular @Nullable). (PR: #1975)
    • Npe in getEnclosingType when getTypeDeclaration is null. (PR: #2033)
    • Fix when interface method overrides object method. (PR: #2025)
    • Fix CtTypeParameter creation in shadow mode. (PR: #2031)
    • Consistent contract for getActualClass: never returns null. (PR: #2027)
    • Fix SonarQube warning by addiing transient modifiers in SpoonObjectFieldsTable. (PR: #2121)
    • EOL were not fully taken into account in Spoon. (PR: #2122)
    • Clarify Environment#checksAreSkipped and associated setters. (PR: #2011)
    • Set parent of auto-created CtExecutableReference. (PR: #2007)
    • Manage generics from interfaces in shadow mode. (PR: #1914)
    • Fix visibility of enum values. (PR: #1999)
    • Fix actualTypeArguments of array type reference. (PR: #1997)
    • SetModifiers(Collections.emptySet()) resets modifiers now. (PR: #1992)
    • Don't fail on ClassNotFoundException in CtQueryImpl. (PR: #1996)
    • NPE when CtQueryImpl#detectTargetClassFromCCE return null. (PR: #1995)
    • Handle comments at the bottom of a file. (PR: #1976)
    • Catch NoClassDefFoundError when we try to import a class absent from the classpath. (PR: #1974)
    • Fix LineFilter for loops with no body. (PR: #1973)
    • Fix the position of catch variables. (PR: #1969)
    • Set the constructor implicitness directly in JDTTreeBuilder. (PR: #1958)
    • Fix the source start and source end of package. (PR: #1957)
    • Fix failing build because of the usage of random in CompilationUnit comparison. (PR: #1954)
    • Provide default sorting of compilation units. (PR: #1938)
    • Remove useless CtPackageImpl#getPosition. (PR: #1952)
    • Fix position of new new SomeInterface() {...}. (PR: #1949)
    • Fix positions of TypeParameter, annonymous classes, and methods without modifiers. (PR: #1948)
    • Add a log warning in verifySourceClasspath. (PR: #1937)
    • Fix class class-level comments' position. (PR: #1931)
    • Always create new type reference for primitive type. (PR: #1940)
    • Comments after class name and before type members are associated to correct node. (PR: #1939)
    • Typo in javadoc of CtModel. (PR: #1942)
    • CtCatchVariable#getType() in noclasspath mode may return null. (PR: #1932)
    • Fix bugs and resource leaks found with error-prone. (PR: #1924)
    • Derived properties return unmodifiable collections. (PR: #1923)
    • CompilationTest#testFilterResourcesDir file separators on Windows. (PR: #1925)
    • All unsettable properties in the metamodel are derived too. (PR: #1904)
    • Comment /*/ parsing in JDTCommentBuilder. (PR: #2032)

    Refactoring

    • :warning: comment: Creating an inline comment with newline separators throws an exception. (PR: #2080)
    • :warning: Move experimental.modelobs to support.modelobs. (PR: #2140)
    • :warning: Remove deprecated elements from last release of Spoon. (PR: #2098)
    • :warning: Remove usage of getActualClass() from CtTypeReferenceImpl. (PR: #2037)
    • :warning: Set noclasspath to true as default. (PR: #1936)
    • :warning: Launcher#setArgs cannot be called twice. (PR: #2141)
    • position: CompoundSourcePosition extends SourcePosition. (PR: #2115)
    • Avoid duplicated calls in ImportScannerImpl. (PR: #2134)
    • Refactor imports of CtRole. (PR: #2132)
    • Deprecate methods computeImports in DJPP. (PR: #2124)
    • Fix checkstyle in tests. (PR: #2127)
    • Add transient modifiers in StandardEnvironment.java. (PR: #2059)
    • Remove old broken untested mechanism "buildOnlyOutdatedFiles". (PR: #1913)
    • Slightly change the import API. (PR: #2110)
    • Report missing parameter value in exception. (PR: #2079)
    • Fix bad resource usage with try-with-resources. (PR: #2045)
    • Move metamodel from src/test to src/main. (PR: #2016)
    • GetTypeDeclaration cannot crash in noclasspath mode. (PR: #2028)
    • Introduce ModelList and ModelSet, collections specific to Spoon that handle parents and change events. (PR: #1917)
    • Get*Field now use shadow types. (PR: #2008)
    • EqualsChecker#setNotEqual can be used to debug non-equality. (PR: #1993)
    • PartialSourcePosition only supports getCompilationUnit for fail-fast behavior. (PR: #1963)
    • Encapsulate try-with-resources for printing lists in DefaultJavaPrettyPrinter. (PR: #1956)
    • Never return null from CtElement#getPosition() but NoSourcePosition. (PR: #1951)
    • EnumValues constructor call should be marked as implicit. (PR: #2090)
    • Remove old, unused, untested class Timer. (PR: #2017)
    • Allow to use @Experimental on a single method. (PR: #2099)

    Tests

    • Unify MetamodelTest and MetaModelTest. (PR: #2012)
    • Improve MainTest. (PR: #2144)
    • Fix CtGenerationTest#testGenerateRoleHandler egg/chicken problem. (PR: #2087)
    • Better tests for derived and unsettable properties. (PR: #2050)
    • Fix MavenLauncherTest. (PR: #2049)
    • Compare the computed imports against human imports. (PR: #1365)
    • Add test to check that all setters trigger a change event. (PR: #2010)
    • Fix MavenLauncherTest to find paths using File separator. (PR: #2129)
    • Ignore OS specific EOL. (PR: #2006)
    • SpoonMetaModel can be built without spoon sources, only using shadow classes. (PR: #1907)
    • Remove testIncrementalModel. (PR: #2004)
    • Add test for ExpressionTemplate. (PR: #2002)
    • Add new test for shadow enums. (PR: #1926)
    • Add a test to check that in NO_OUTPUT mode, nothing is created. (PR: #1915)
    • Remove unused imports from tests. (PR: #2104)
    • Make checkstyle happy. (PR: #2116)
    • refactor
      • Move ClassWithSwitchExample.java to testclasses. (PR: #2158)
      • Move Castings.java to testclasses. (PR: #2155)
      • Move ArrayClass.java to testclasses. (PR: #2154)
      • Move ExtendedStringLiteralTestClass to testclasses. (PR: #2153)
      • Move Ifoo.java to testclasses. (PR: #2157)
    • Typo: invokation -> invocation. (PR: #2114)

    Documentation

    • Give our definition of public API. (PR: #2092)
    • Add Youtube Links of Spoon presentations on Readme. (PR: #2082)
    • Move package.html to package-info.java. (PR: #2005)
    • Add link to Google Scholar. (PR: #1987)
    • Update documentation after release 6.2. (PR: #1899)
    • Update README.md to state Java 10 support. (PR: #2091)

    Other

    • Remove bold emphasis of component in changelog. (PR: #2046)
    • Run Spoon tests also on JDK10. (PR: #2053)
    • Coverage computation now uses JDK9. (PR: #2071)
    • Upgrade JDT version to 3.13.102. (PR: #2052)
    • Upgrade copyright to 2018. (PR: #2058)
    • Check license header presence in CI. (PR: #2066)
    • Add SonarQube dashboard link. (PR: #2044)
    • Change README to encourage usage/contribution. (PR: #2030)
    • Fix SCM info in pom.xml. (PR: #1966)
    • Fix revapi comparison against Snapshot. (PR: #1920)
    • Fix typo in snapshot repository URL. (PR: #1910)
    • Deploy snapshots on maven.inria.fr instead of gforge.inria.fr for better availability. (PR: #1900)
    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Simon Urli | 48 | | Pavel Vojtechovsky | 48 | | Martin Monperrus | 20 | | Thomas Durieux | 20 | | Tomasz Zielinski | 9 | | Egor18 | 5 | | Miguel Sozinho Ramalho | 2 | | Ashutosh Kumar Verma | 2 | | Lionel Seinturier | 2 | | Filip Krakowski | 1 | | Mehdi Kaytoue | 1 | | Roman Leventov | 1 | | André Cruz | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-7.0.0-jar-with-dependencies.jar(14.04 MB)
    spoon-core-7.0.0-javadoc.jar(4.60 MB)
    spoon-core-7.0.0-sources.jar(976.06 KB)
    spoon-core-7.0.0.jar(1.49 MB)
  • spoon-core-6.2.0(Mar 8, 2018)

    Thanks for the new contributors on this release 👍

    New features

    • Add support to change the destination file on disk for modules, packages and types. (PR: #1610)
    • Add CtScanner#scan(Map) for a better EarlyTerminatingScanner. (PR: #1805)
    • Add support for paths for all elements from model root (CtElement#getPath). (PR: #1874)
    • One could add a type member that already exists (equals but not same) and modify it afterwards. (PR: #1864)
    • Add method CtMethod#getTopDefinitions. (PR: #1844)
    • Add Refactoring#copyType and #copyMethod for advanced cloning. (PR: #1884)
    • All RoleHandlers supports set/add/remove. (PR: #1793)
    • Add methods getRoleHandlers(Class), forEachRoleHandler, getRoleHandlerWrtParent in RoleHandlerHelper. (PR: #1794)
    • SpoonModelTree GUI can be created with a custom root element. (PR: #1799)
    • Add support for clone process customization with CloneHelper#addClone. (PR: #1802)
    • Spoon Filter implements java.util.function.Predicate. (PR: #1798)

    Bug Fixes

    • GetDocComment returns the complete Javadoc comment, incl. tags. (PR: #1822)
    • Add RoleHandler setter for SUPER_TYPE and INTERFACE. (PR: #1890)
    • CtCatchVariable#multiType role TYPE changed to MULTI_TYPE. (PR: #1877)
    • Fully comply with the contract of CtScannerTest#testScannerCallsAllProperties. (PR: #1870)
    • Change how DJPP prints "return" so that it's checkstyle-compliant. (PR: #1871)
    • Unsettable properties are now really unsettable, and there is a test for this. (PR: #1893)
    • Fix equality for assignments. (PR: #1845)
    • GetDocComment() returns asterisk (*) and spaces before comment. (PR: #1841)
    • Small bugs in MethodTypingContext and CtTypeReference. (PR: #1838)
    • ClassTypingContext resolveTypeParameter can gracefully handle outer parameters. (PR: #1837)
    • Fix StringIndexOutOfBoundsException in CtJavadoc#getShortDescription. (PR: #1827)
    • TypeFactory#get(qualifiedName) for class names containing $. (PR: #1891)
    • Stackoverflow on AbstractTypingContext. (PR: #1817)
    • NPE when using MavenLauncher on module containing dependency with variable. (PR: #1810)
    • Undo #1798 for backward compatibility. (PR: #1811)
    • Filter extends Predicate is now working with projects in JDK7. (PR: #1808)
    • Shadow classes should be interpreted according to their kind (enum, interface, etc). (PR: #1806)
    • Easier specification of template parameters (without annotations). (PR: #1801)
    • DefaultJavaPrettyPrinter prints an ERROR comment instead of raising an exception when a field is missing in the model. (PR: #1797)
    • Various fixes in VisitorPartialEvaluator. (PR: #1800)
    • DefaultJavaPrettyPrinter exposes the tokenWriter for subclasses. (PR: #1796)
    • ParentFunction doesn't fail on null parent. (PR: #1795)
    • Add generic typing to TypeFactory constants. (PR: #1792)
    • serialization: SourcePosition#getFile() after deserialization. (PR: #1847)
    • Fix order of type members. (PR: #1787)

    Documentation

    • Add missing javadoc. (PR: #1843)
    • Add missing Javadoc in ModelsUtils. (PR: #1860)
    • Missing documentation in public methods used for pretty-printing. (PR: #1854)
    • Another set of Javadoc comments for public methods. (PR: #1856)
    • Add API documentation to interface JavaReflectionVisitor. (PR: #1850)
    • Add doc for public method in RtMethod. (PR: #1858)
    • Fix Javadoc (incorrect starting tag). (PR: #1839)
    • Fix missing javadoc. (PR: #1840)
    • Improve Javadoc of #getAllMethods. (PR: #1836)
    • Improves the documentation of getOverridingExecutable. (PR: #1828)
    • Bump Spoon number in doc. (PR: #1790)

    Refactoring

    • Improve Meta-Metamodel classes in src/test. (PR: #1894)
    • Refactor cloning code to increase extendability. (PR: #1878)
    • Remove CtParameterReferenceImpl#declaringExecutable. (PR: #1875)
    • Push down the equality checking code in EqualsVisitor. (PR: #1853)
    • Hide some methods that are clearly meant to be package visible. (PR: #1855)
    • Internal utility type in JDTTreeBuilder should be package-visible. (PR: #1848)
    • Package-visible class CommentHelper should have package-visible methods. (PR: #1849)
    • Remove wrong comments and unused imports. (PR: #1803)
    • prettyprinter: Restore DJPP#writeHeaders that clients can override. (PR: #1866)

    Tests

    • architecture: All public API methods should be documented with Javadoc. (PR: #1867)
    • Fix CI failure due to interaction between #1864 and #1787. (PR: #1868)
    • Move metamodel related method to class SpoonMetaModel for better discoverability. (PR: #1851)
    • Add method ModelUtils#getOptimizedString for handling EOL, TAB, etc in assertions. (PR: #1804)

    Chores

    • Enable unchecked compiler warnings. (PR: #1886)
    • Enables incremental compilation. (PR: #1885)
    • Fix javadoc linter config in pom.xml. (PR: #1881)
    • Add Eclipse's .checkstyle to .gitignore. (PR: #1882)
    • Add a script to update pom.xml for running pit-descartes. (PR: #1820)
    • Add CI script to check whether Spoon compiles with Maven 3.3.9. (PR: #1815)
    • revapi: Fix revapi commenting bot. (PR: #1863)
    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Martin Monperrus | 30 | | Pavel Vojtechovsky | 21 | | Simon Urli | 9 | | Egor18 | 4 | | Nicolas Harrand | 2 | | Thomas Durieux | 1 | | Shantanu | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-6.2.0-jar-with-dependencies.jar(10.62 MB)
    spoon-core-6.2.0-javadoc.jar(4.15 MB)
    spoon-core-6.2.0-sources.jar(851.03 KB)
    spoon-core-6.2.0.jar(1.29 MB)
  • spoon-core-6.1.0(Dec 20, 2017)

    Christmas release! 🎄 🎅 ✨

    The main new feature of this release is the integration of Java 9 module in Spoon model, but it also contains some other new features and bug fixes. Thanks for the contributors, merry christmas and happy new year for all of you :)

    New features

    • Add Factory#createQuery(Iterable). (PR: #1777)
    • Add a method to get the unit type of the compilation unit. (PR: #1776)
    • Add support for Java9 constructs in the Spoon metamodel (CtModule and related concepts). (PR: #1730)
    • Support partial evaluation of new Object[]{...}.length -> Literal. (PR: #1750)
    • Add an explicit construct for imports in the metamodel (CtImport). (PR: #1707)
    • Add method hasAnnotation. (PR: #1737)
    • Add inheritance between roles (CtRole#getSuperRole(), CtRole#getSubRole()). (PR: #1725)
    • CtModel implements CtQueryable. (PR: #1739)
    • Processor properties can be passed as string. (PR: #1734)

    Bug Fixes

    • CompilationUnits are created on demand. (PR: #1782)
    • Start prefix space in ElementPrinterHelper. (PR: #1768)
    • Fix a NPE in CtTypeImpl#isSameParameter in noclasspath. (PR: #1767)
    • CtQueryImpl handles well preallocated exceptions done by JVM optimization. (PR: #1759)
    • Fix bug in partial evaluator. (PR: #1751)
    • Fix dirty exception in checking code at the end of model building. (PR: #1749)
    • annotation: Bug when using an annotation targeting declaration and types. (PR: #1774)
    • test: Improve CtGenerationTest and CtScannerTest. (PR: #1736)

    Documentation

    • Add explanation in Javadoc of CtTypeReference#getActualClass. (PR: #1761)
    • Bump version number after release 6.0.0. (PR: #1732)

    Refactoring

    • OutputType is available in Environment. (PR: #1784)
    • CompilationUnit returns an unmodifiable collection. (PR: #1781)
    • Manage sourceOutputDirectory in Environment. (PR: #1770)
    • SetSourceClasspath throws an exception in case a .class is given. (PR: #1766)
    • Add a new way to build a query in QueryFactory. (PR: #1740)

    Tests

    • Check inheritance behaviour when using noclasspath with a sourceclasspath. (PR: #1760)
    • Refactor test to be independent from JDK version. (PR: #1764)
    • Metamodel's MMField valueTypes are not implicit. (PR: #1756)
    • Add test for substitution of return expression.S() with expressions. (PR: #1755)
    • Prepare upcoming behavioral change in template matcher. (PR: #1748)
    • Add test for getAnnotation().value() on shadow classes. (PR: #1738)

    Other

    • Skip checkstyle in Travis install phase. (PR: #1746)

    Unknown

    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Simon Urli | 20 | | Pavel Vojtechovsky | 9 | | Martin Monperrus | 3 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-6.1.0-jar-with-dependencies.jar(10.61 MB)
    spoon-core-6.1.0-javadoc.jar(4.08 MB)
    spoon-core-6.1.0-sources.jar(835.87 KB)
    spoon-core-6.1.0.jar(1.28 MB)
  • spoon-core-6.0.0(Nov 17, 2017)

    New major Spoon 6.0.0 release 🎉

    ⚠️ This release breaks some existing API. Here follows the changelog with indication of what is breaking. Thanks to all contributors on this amazing release 👍

    New features

    • Roles
      • Add method CtElement#getRoleInParent(). (PR: #1669)
      • CtScanner supports scanning based on roles. (PR: #1632)
      • Add CtRole to CtReference. (PR: #1586)
      • One can get and set children of elements based on roles. (PR: #1582)
      • Spoon GUI shows roles of nodes. (PR: #1715)
    • Introduction of TokenWriter to support custom formatting of pretty-printed code. (PR: #1494)
    • Spoon runs on Java9 JVM with JDK9. (PR: #1585)
    • Add TypeFactory LIST, SET, MAP, ... constant type references. (PR: #1660)
    • Add new create method in Factory. (PR: #1659)
    • Add CtPackage#getQualifiedName. (PR: #1652)
    • The cloning behavior can be subclassed. (PR: #1580)
    • Add a static method to getting started with one single line of code. (PR: #1559)
    • Add support for analyzing whether a type reference is generic or not (method isGeneric). (PR: #1562)
    • Add support for implicit / explicit modifiers (CtExtendedModifier). (PR: #1649)
    • Add simple support for enter/exit in DJPP as in CtScanner. (PR: #1538)
    • Create a launcher to analyze maven projects. (PR: #1533)
    • Add utility methods in CtModifiable. (PR: #1726)

    Bug Fixes

    • :warning: [BREAKING] Fix ClassTypingContext#isSameSignature for generic methods. (PR: #1639)
    • :warning: [BREAKING] SetVisibility should only be used with private, public or protected. (PR: #1705)
    • :warning: [MAYBE BREAKING] Less hashcode collisions for CtReference. (PR: #1717)
    • :warning: [BREAKING] Move deprecated classes to spoon.legacy. (PR: #1518)
    • :warning: [BREAKING] Template: Replacing of field access by refining behaviour of String parameter. (PR: #1476)
    • :warning: [BREAKING] Remove the useless factory in Environment. (PR: #1673)
    • :warning: Fix bug with repeatable annotations. (PR: #1724)
    • Typo in RoleHandlersGenerator. (PR: #1709)
    • Method with varargs should never be transient. (PR: #1701)
    • JDTImportBuilder should not import all public methods from interfaces. (PR: #1620)
    • Explicit "final" modifier are possible in catch variables and should be kept when pretty-printing. (PR: #1690)
    • CtVariableAccess#getVariable() sets the type of "super". (PR: #1684)
    • MavenLauncher warns when a provided dependency is not loaded. (PR: #1681)
    • Add position for implicit blocks. (PR: #1678)
    • Bug related with cloning newClass invocation with anonymous class. (PR: #1667)
    • Improve contract+test of CtScanner and it relation to roles. (PR: #1642)
    • In CtCatchVariable set/getType is derived from multiType. (PR: #1668)
    • AbstractTypingContext should set consistent parents. (PR: #1664)
    • [BREAKING] CtTypeParameterReference#getBoundingType() consistently returns null when Object is the bound. (PR: #1661)
    • Remove useless code on CtElement#setParent. (PR: #1662)
    • Change default log level. (PR: #1646)
    • Fix StackOverflow in MethodTypingContext on <T, U extends T>. (PR: #1640)
    • Fix NPE in MavenLauncher when there is no build section. (PR: #1720)
    • CtTypeInformationTest now use patch JDK version for the expected test number. (PR: #1721)
    • Optional maven dependencies should not be passed to SpoonMavenLauncher. (PR: #1619)
    • Fix bug related to generics in CtTypeReference in noclasspath. (PR: #1609)
    • Auto-imports works for package-info. (PR: #1611)
    • CtNewClassImpl#setAnonymousClass has CtRole.NESTED_TYPE not CtRole.EXECUTABLE. (PR: #1605)
    • Pretty printer adds no space before comma in new array expression. (PR: #1602)
    • Spoon model is a tree not a lattice. (PR: #1592)
    • ImportBuilder checks visibility when importing starred imports. (PR: #1588)
    • The query engine also works on JVMs where lambdas are not in stack trace elements. (PR: #1579)
    • Cleaning of method signature computation. (PR: #1561)
    • DJPP sends "class" as keyword and wildcard "?" as separator token. (PR: #1568)
    • PotentialVariableDeclarationFunction should consider static scopes. (PR: #1536)
    • Fix issue with recursively defined annotation in shadow class. (PR: #1711)
    • Remove an hardcoded encoding value in CompilationUnitWrapper. (PR: #1544)
    • SetSimpleName of CtRootPackage if now fail-silent to simplify client code. (PR: #1523)
    • File resource leak in pretty printing. (PR: #1521)
    • Bump commons-io version. (PR: #1530)
    • prettyprinter
      • Invalid use of type access generics. (PR: #1454)
      • Bug related with "--lines" argument. (PR: #1558)
    • role
      • CtPackage.types is CtRole.CONTAINED_TYPE. (PR: #1600)
      • CtTypeAccess getTypeAccess uses CtRole.ACCESSED_TYPE. (PR: #1637)
      • CtTypeAccess.getAccessedType has CtRole.TYPE. (PR: #1630)
    • template
      • Relax template parameter constraint. (PR: #1535)

    Refactoring

    • :warning: [BREAKING] Get rid of snapshotLength and hasNewContent. (PR: #1576)
    • :warning: [BREAKING] CompilationUnit#create renamed to getOrCreate. (PR: #1645)
    • :warning: [BREAKING] CtModifiable add/removeModifier stick to convention on returned object. (PR: #1706)
    • :warning: [BREAKING] Remove ant related code and dependency. (PR: #1540)
    • :warning: [BREAKING] Move ElementPrinterHelper to the appropriate package. (PR: #1551)
    • :warning: [BREAKING] GetBoundingType returns Object by default. (PR: #1672)
    • All non-leaf interfaces of the metamodel should be visited by CtInheritanceScanner. (PR: #1703)
    • Remove replace methods which pollute code completion and do not provide additional behavior. (PR: #1704)
    • Move package spoon.generating.* from src/main to src/test. (PR: #1647)
    • Introduce CommentHelper, LiteralHelper and OperatorHelper. (PR: #1525)
    • Compute CtRole#forName automatically based on enum value names. (PR: #1702)
    • PrinterHelper prints tabs automatically. (PR: #1566)
    • DefaultJavaPrettyPrinter better uses OperatorHelper. (PR: #1553)
    • Delete old/useless config files. (PR: #1548)
    • Launcher#buildModel returns a CtModel. (PR: #1549)
    • Add constant for code compliance level. (PR: #1543)
    • Test code assumes java 8 compliance so as to allow lambdas in spoon code. (PR: #1539)
    • Use LiteralHelper in DefaultJavaPrettyPrinter. (PR: #1529)
    • modifier: CreateCtModifierHandler that handles the modifiers. (PR: #1677)
    • role
      • New CtRoles ARGUMENT_TYPE and TYPE_ARGUMENT. (PR: #1622)
      • Add CtRole.TYPE_MEMBER. (PR: #1625)
      • CtThrows uses EXPRESSION now. Rolls back usage of THROWN. (PR: #1624)
      • CtCodeSnippet has CtRole.SNIPPET. (PR: #1623)
      • Add and refactor CtRole annotations of model. (PR: #1606)

    Performance

    • MainTest#checkModelIsTree needs less memory. (PR: #1596)
    • Avoid slow CCE. Check acceptable type when possible. (PR: #1541)

    Tests

    • Add a test about the behavior of PropertySetter. (PR: #1612)
    • SpoonMetaModel checks whether provided model is complete. (PR: #1714)
    • Add an architectural test to catch package creation during code review. (PR: #1696)
    • Fix typo in MMType. (PR: #1708)
    • Check that CtComment works with \r separator. (PR: #1679)
    • Add explicit Spoon metamodel to facilitate consistency checks and code generation. (PR: #1627)
    • Declares missing packages for new architecture enforcing test. (PR: #1710)
    • Adds a test on roles for CtReference fields. (PR: #1601)
    • Don't use Junit3 classes in test suite, only use Junit4 org.junit.*. (PR: #1577)
    • Add a test to verify an important contract of setParent. (PR: #1591)
    • Add a new test to check if static imports are placed after type imports. (PR: #1572)
    • Enforce test naming discipline. (PR: #1554)
    • The ant dependency was removed so the test should be changed. (PR: #1547)
    • Fix test assertion with JDK8 1.8.0_15 on Travis. (PR: #1718)
    • Refactor: Faster test execution. (PR: #1552)

    Documentation

    • Improve getting started. (PR: #1676)
    • Clarify CtType#getAllMethods documentation. (PR: #1644)
    • End-of-life for mailing list spoon-discuss. (PR: #1643)
    • Clarifies contracts of @DerivedProperty. (PR: #1613)
    • Move around some documentation items for easier finding. (PR: #1564)
    • Add recent papers that use Spoon. (PR: #1556)
    • Update version number after the new release 5.9.0. (PR: #1517)

    Other

    • Change Revapi template to have class name shortening by a bunch of Freemarker macros. (PR: #1697)
    • Revapi reports are smaller on screen to save space on the corresponding Github page. (PR: #1692)
    • Revapi now deletes its own comments before commenting. (PR: #1683)
    • Improve Travis configuration for parallel jobs. (PR: #1655)
    • Bump revapi version. (PR: #1665)
    • Upgrade to org.eclipse.tycho:org.eclipse.jdt.core:3.13.0. (PR: #1492)
    • Now depends on Java8/JDK8. (PR: #1528)
    • maven: Remove maven reporting plugins that we never use. (PR: #1560)
    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Simon Urli | 49 | | Pavel Vojtechovsky | 44 | | Martin Monperrus | 22 | | Thomas Durieux | 4 | | tiagodrcarvalho | 1 | | Lukas Krejci | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-6.0.0-jar-with-dependencies.jar(8.47 MB)
    spoon-core-6.0.0-javadoc.jar(3.89 MB)
    spoon-core-6.0.0-sources.jar(803.20 KB)
    spoon-core-6.0.0.jar(1.21 MB)
  • spoon-core-5.9.0(Sep 6, 2017)

    Spoon release on this back-to-work times!

    Thanks to all contributors 👍

    Changelog

    New features

    • Introduce NamedElementFilter (because NameFilter is ill-designed). (PR: #1500)
    • In auto-import mode, imports from original source code are reused. (PR: #1499)
    • Add automatically generated comments in template-produced code. (PR: #1465)
    • Add support for short pretty-printing of annotation value when appropriate. (PR: #1485)
    • prettyprinter: DefaultJavaPrettyPrinter#setLineSeparator(String). (PR: #1490)

    Bug Fixes

    • Fix a stack overflow when calling getDeclaration in noclasspath. (PR: #1515)
    • Fix issue related to processing generic types. (PR: #1504)
    • Fix NPE in noclasspath mode. (PR: #1502)
    • Compute positions of elements. (PR: #1493)
    • Support substitution of references to target type in inner type. (PR: #1477)
    • setInputClassloader: Bug when using a URLClassLoader with standard URLs. (PR: #1507)
    • comment: Splitting of comment by EOL. (PR: #1455)
    • template: Object is not an template parameter implicitly. (PR: #1461)
    • reference: Fix getReference of an unknown class that has the same name as an existing class. (PR: #1480)

    Documentation

    • Update usage of maven plugin to latest version 2.5. (PR: #1508)
    • Remove information about deleted stable branch. (PR: #1474)
    • release: Update release information in documentation. (PR: #1471)

    Refactoring

    • Encoding is correctly handled in Environment. (PR: #1498)
    • Deprecate PrettyPrinter#getPackageDeclaration. (PR: #1489)
    • printer: Remove deprecated method from PrinterHelper. (PR: #1472)

    Performance

    • Compile comments only if needed. (PR: #1487)
    • Collect list of source files only once. (PR: #1486)
    • No call to expensive toString in DoNotFurtherTemplateThisElement. (PR: #1478)

    Tests

    • Fix CtRenameLocalVariableRefactoringTest#testRenameAllLocalVariablesOfRenameTestSubject. (PR: #1491)

    Community

    • @pvojtechovsky gets merge honor and responsibility. (PR: #1468)

    Other

    • Fix pom.xml to allow deploying snapshots. (PR: #1495)
    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Pavel Vojtechovsky | 11 | | Simon Urli | 10 | | Wreulicke | 1 | | Marcel Steinbeck | 1 | | Lionel Seinturier | 1 | | Thomas Durieux | 1 | | Jan Galinski | 1 | | Martin Monperrus | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.9.0-jar-with-dependencies.jar(7.16 MB)
    spoon-core-5.9.0-javadoc.jar(3.81 MB)
    spoon-core-5.9.0-sources.jar(788.71 KB)
    spoon-core-5.9.0.jar(1.09 MB)
  • spoon-core-5.8.0(Jul 11, 2017)

    This summer release mainly fixes a lot of bugs, in particular in the resolution of TypeParameters which were introduced in previous version. New experimental features are also introduced in this release.

    Thanks all our amazing contributors 👍

    New features

    • experimental: Add experimental support for model change listeners. (PR: https://github.com/INRIA/spoon/pull/1417)
    • import: Sort imports alphabetically. (PR: https://github.com/INRIA/spoon/pull/1434)
    • metamodel
      • CtTypeMember extends CtNamedElement. (PR: https://github.com/INRIA/spoon/pull/1452)
      • Add a method to insert a statement at a specific position. (PR: https://github.com/INRIA/spoon/pull/1423)
      • Annotes getter and setter with a CtRole. (PR: https://github.com/INRIA/spoon/pull/1377)
      • Add first metamodel support. (PR: https://github.com/INRIA/spoon/pull/1378)
    • role: Add field annotation with a role. (PR: https://github.com/INRIA/spoon/pull/1368)
    • template: SubstitutionVisitor can replace substrings in NamedElements and References. (PR: https://github.com/INRIA/spoon/pull/1441)
    • Add support for replacement by multiple elements CtElement#replace(Collection). (PR: https://github.com/INRIA/spoon/pull/1369)
    • Add generic type information in shadow classes. (PR: https://github.com/INRIA/spoon/pull/1352)
    • The template engine supports insertion of literals. (PR: https://github.com/INRIA/spoon/pull/1403)

    Bug Fixes

    • Ignore null items in ReplacementVisitor. (PR: https://github.com/INRIA/spoon/pull/1400)
    • CtComment#getContent should never return "null". (PR: https://github.com/INRIA/spoon/pull/1442)
    • Fix a bug with import static. (PR: https://github.com/INRIA/spoon/pull/1412)
    • Fix issue related to overridden methods in getAllMethods. (PR: https://github.com/INRIA/spoon/pull/1375)
    • Fix issue in ClassTypingContext#isOverriding. (PR: https://github.com/INRIA/spoon/pull/1411)
    • Fix bug related to CtTypeParameterReference and getDeclaration. (PR: https://github.com/INRIA/spoon/pull/1383)
    • Refactor SubstitutionVisitor to support null parameter values. (PR: https://github.com/INRIA/spoon/pull/1359)
    • Bug with escaped literal. (PR: https://github.com/INRIA/spoon/pull/1394)
    • Use getTypeDeclaration in CtTypeParameterReference. (PR: https://github.com/INRIA/spoon/pull/1387)
    • Ignore only ClassCastException in query code. (PR: https://github.com/INRIA/spoon/pull/1462)
    • Bugs related to continue algorithm of ClassTypingContext. (PR: https://github.com/INRIA/spoon/pull/1379)
    • Fix regression related to ReferenceBuilder and generics. (PR: https://github.com/INRIA/spoon/pull/1373)
    • Fix stackoverflow in ReferenceBuilder. (PR: https://github.com/INRIA/spoon/pull/1367)
    • Calls to default constructors outside the factory should still be possible, and a default factory is made available. (PR: https://github.com/INRIA/spoon/pull/1448)
    • Fix NPE with union catch inside lambda in noclasspath. (PR: https://github.com/INRIA/spoon/pull/1416)
    • comment: Printing of comments on MS Windows. (PR: https://github.com/INRIA/spoon/pull/1435)
    • factory: Create type reference from inner class. (PR: https://github.com/INRIA/spoon/pull/1361)
    • import: Fix NPE with import scanner. (PR: https://github.com/INRIA/spoon/pull/1437)
    • prettyprinter: Throws SpoonException with info instead of NPE in Pretty Printer on missing variable declaration. (PR: https://github.com/INRIA/spoon/pull/1451)
    • reflection: Add annotation value in the model. (PR: https://github.com/INRIA/spoon/pull/1384)
    • role: Fix wrong roles. (PR: https://github.com/INRIA/spoon/pull/1397)
    • template
      • Clarifies the contract of proxy template parameters. (PR: https://github.com/INRIA/spoon/pull/1457)
      • Substitution#insertAll should bypass Template methods. (PR: https://github.com/INRIA/spoon/pull/1348)
    • printer: Reset import context on reset. (PR: https://github.com/INRIA/spoon/pull/1360)

    Documentation

    • community: Add the integrator rules. (PR: https://github.com/INRIA/spoon/pull/1413)
    • Explicit the difference between isOverriding and isSubsignature. (PR: https://github.com/INRIA/spoon/pull/1449)
    • Update roadmap (inline comments are supported + link to 'features' issues). (PR: https://github.com/INRIA/spoon/pull/1440)
    • Add cool idea in roadmap (by @tdurieux). (PR: https://github.com/INRIA/spoon/pull/1433)
    • Improve explanation of getDeclaration. (PR: https://github.com/INRIA/spoon/pull/1429)
    • Update roadmap. (PR: https://github.com/INRIA/spoon/pull/1432)
    • Adds AutoJMH in the ecosystem page. (PR: https://github.com/INRIA/spoon/pull/1401)
    • Clean bad comment. (PR: https://github.com/INRIA/spoon/pull/1380)

    Refactoring

    • Change Substitution#createTypeFromTemplate return type to avoid cast. (PR: https://github.com/INRIA/spoon/pull/1464)
    • Add not-null check. (PR: https://github.com/INRIA/spoon/pull/1443)
    • Explicit handlingErrorPolicy of JDT in noClasspath and normal mode. (PR: https://github.com/INRIA/spoon/pull/1424)
    • Printing of lists in Spoon pretty printer. (PR: https://github.com/INRIA/spoon/pull/1428)
    • GetLabelledStatement is a derived propertty shared between CtContinue and CtBreak. (PR: https://github.com/INRIA/spoon/pull/1398)
    • role: Rename CtPathRole to CtRole and add new roles. (PR: https://github.com/INRIA/spoon/pull/1372)

    Tests

    • Use the factory instead of the constructor. (PR: https://github.com/INRIA/spoon/pull/1395)
    • Add test for template substitution of enum values. (PR: https://github.com/INRIA/spoon/pull/1389)
    • Add test for template substitution of variable access. (PR: https://github.com/INRIA/spoon/pull/1390)
    • Add test for template substitution of return. (PR: https://github.com/INRIA/spoon/pull/1391)
    • Add test for SubstitionVisitor class access. (PR: https://github.com/INRIA/spoon/pull/1388)
    • Test Template array access. (PR: https://github.com/INRIA/spoon/pull/1353)

    Other

    • Remove old useless file. (PR: https://github.com/INRIA/spoon/pull/1421)
    • Change revapi config for more relevant messages. (PR: https://github.com/INRIA/spoon/pull/1392)
    • Removes one checkstyle rule. (PR: https://github.com/INRIA/spoon/pull/1336)
    • Add new architectural rule. (PR: https://github.com/INRIA/spoon/pull/1355)
    • travis: Fix issue by using the last image on Travis https://github.com/INRIA/spoon/issues/1414. (PR: https://github.com/INRIA/spoon/pull/1418)
    • Update release numbers in documentation. (PR: https://github.com/INRIA/spoon/pull/1351)
    • Prepare for next development iteration.
    • Remove deprecated methods in ImportScanner. (PR: https://github.com/INRIA/spoon/pull/1366)

    Authors

    | Name | Nb Commit | | --- | --- | | Pavel Vojtechovsky | 23 | | Simon Urli | 16 | | Martin Monperrus | 12 | | Thomas Durieux | 11 | | Benjamin DANGLOT | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.8.0-jar-with-dependencies.jar(7.15 MB)
    spoon-core-5.8.0-javadoc.jar(3.79 MB)
    spoon-core-5.8.0-sources.jar(782.21 KB)
    spoon-core-5.8.0.jar(1.08 MB)
  • spoon-core-5.7.0(Jun 1, 2017)

    New features

    • Add support for Java 8 receiver parameters. (PR: #1298)
    • Function to find all executables with the same signature. (PR: #1291)
    • Add new filter for finding lamdas (class LambdaFilter). (PR: #1315)
    • Add new function to collect subtypes (class SubInheritanceHierarchyFunction). (PR: #1290)
    • Add refactoring class CtParameterRemoveRefactoring. (PR: #1317)
    • Add SubInheritanceHierarchyResolver as helper for query mechanisms. (PR: #1309)
    • New filter ExecutableReferenceFilter. (PR: #1318)
    • Add public method MethodTypingContext#adaptMethod. (PR: #1288)
    • Add method GenericTypeAdapter#getAdaptationScope. (PR: #1287)
    • Add CtMethod#isOverriding(CtMethod). (PR: #1220)
    • Add support for typing analysis of generic types. (PR: #1218)
    • Add support for type erasure (CtType/CtTypeReference#getTypeErasure()). (PR: #1216)
    • Support for better analysis of generic type arguments (TypeReference#getTypeParameterReference() and TypeFactory#createReference(type,includingFormalTypeParams)). (PR: #1237)
    • SuperInheritanceHierarchyFunction supports references and listener. (PR: #1242)
    • Add support for renaming local variables. (PR: #1005)
    • comment: Add an AST node for the javadoc tags. (PR: #1310)
    • template: The template engine supports substitution of method names in method calls. (PR: #1325)

    Bug Fixes

    • Fix bug in CtExecutableReference#getActualMethod when parameters are generically typed. (PR: #1277)
    • Fix bug in getActualMethod() due to missing information in CtTypeParameterReference. (PR: #1286)
    • Improve line preservation mode. (PR: #1335)
    • Auto-import works for compilation units with multiple classes in the same file. (PR: #1322)
    • Fix import bug with java.lang.subpackage. (PR: #1327)
    • Fix NPE in isTypeInCollision. (PR: #1326)
    • Improve ImportScanner to support variables called "java". (PR: #1321)
    • Fix bug in qualified names in a special case due to missing information in JDT. Fix #1307. (PR: #1312)
    • Fix bug in import inference (auto-import mode). Close #1306. (PR: #1308)
    • In noClasspath, a type without import should be considered in the same package as the current class. (PR: #1302)
    • Fix SuperInheritanceHierarchyFunction in noClassPath mode. (PR: #1281)
    • Fix AnnotationFactory#create. (PR: #1340)
    • Fix JDT error when input resource contains an entirely commented class. (PR: #1279)
    • Fix special case not handled in factory.Annotation().annotate(). (PR: #1278)
    • Fix a couple of bugs in recent feature "generic type adaptation". (PR: #1275)
    • Fix regression regarding actual type arguments resolving. (PR: #1273)
    • #setParent is not a normal metamodel setter, and is excluded from SpoonTestHelpers#getAllSetters. (PR: #1261)
    • TestFactorySubFactory must only check public factory methods. (PR: #1263)
    • CtBlock#getLastStatement is a @DerivedProperty. (PR: #1262)
    • Fix a bug in wrongly qualified type in executable references. (PR: #1259)
    • Fix issue #1246. (PR: #1251)
    • Fix NPE in CtElement#getMetadataKeys. Closes #1239. (PR: #1240)

    Documentation

    • Add pointer to new Template example. (PR: #1343)
    • Document and refactor TemplateMatcher. (PR: #1319)
    • Update examples links from gforge.inria.fr to github.com. (PR: #1226)
    • Adds InspectorGuidget in ecosystem page. (PR: #1304)
    • Clarifies page on architectural rule checking with Spoon. (PR: #1301)
    • Fix link mix. (PR: #1297)
    • Fix javadoc of SuperInheritanceHierarchyFunction. (PR: #1289)
    • Update doc with release 5.6.0 information. (PR: #1227)

    Refactoring

    • Remove or update deprecation related to queries & filters. (PR: #1300)
    • Improve ImportScanner design, add getAllImports. (PR: #1339)
    • Renamed confusing duplicate classes. (PR: #1333)
    • Improve PrinterHelper (less duplication, more encapsulation). (PR: #1332)
    • Handle some rare limit cases. (PR: #1331)
    • Remove call to deprecated File#toURL. (PR: #1313)
    • Change generic type bound. (PR: #1314)
    • Replace string literals by constants. (PR: #1316)
    • Remove deprecated method computeImports. (PR: #1311)
    • Remove useless 'final' modifier in interface methods. (PR: #1334)
    • MethodTypingContext#isOverriding/isSameSignature/isSubSignature moved to ClassTypingContext. (PR: #1299)
    • MethodTypingContext#adaptMethod moved to ClassTypingContext. (PR: #1296)
    • AllTypeMembersFunction accepts now CtTypeInformation as parameter. (PR: #1285)
    • Use new CtMethod#isOverriding in method overriding/overriden filters. (PR: #1276)
    • Refactor and test initProperties. (PR: #1260)
    • Remove unused field. (PR: #1253)
    • Adds an architural rule for helper classes with static methods. (PR: #1247)
    • CtFormalTypeDeclarer extends CtTypeMember. (PR: #1235)
    • Refactor *VariableReferenceFunction around LocalVariableReferenceFunction. (PR: #1193)

    Performance

    • Use factory.Type().OBJECT to save memory. (PR: #1241)
    • Use TypeFactory#OBJECT. (PR: #1231)

    Tests

    • Improve TemplateMatcher test. (PR: #1323)

    Other

    • Checkstyle checks that the end of lines are consistent (unix-style \n only). (PR: #1344)
    • Fix broken revapi reports due to regression in revapi-reporter-text 0.8.0.
    • Revapi check should fail only for breaking changes. (PR: #1282)
    • Fix revapi bug. (PR: #1280)

    Unknown

    • Add 'getBinaryFiles' to CompilationUnit. Fixes #1230. (PR: #1232)
    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Pavel Vojtechovsky | 38 | | Simon Urli | 18 | | Martin Monperrus | 17 | | Thomas Durieux | 1 | | Marcel Steinbeck | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.7.0-jar-with-dependencies.jar(7.08 MB)
    spoon-core-5.7.0-javadoc.jar(3.63 MB)
    spoon-core-5.7.0-sources.jar(735.06 KB)
    spoon-core-5.7.0.jar(1.01 MB)
  • spoon-core-5.6.0(Mar 16, 2017)

    Thanks all contributors to this new release, and special thanks to @pvojtechovsky who continue to do an amazing work on Spoon!

    New features

    • Add filter helpers (FieldReferenceFunction, FieldScopeFunction, SubtypeFilter). (PR: #1141)
    • ParentFunction is able to terminate early. (PR: #1211)
    • Introduces CtScannerFunction as basic infrastructure for advanced functions and queries. (PR: #1180)
    • Add support for CtScannerListener in EarlyTerminatingScanner. (PR: #1210)
    • Automatic explicit ThisAccess for fields. (PR: #1192)
    • CtLambda#getMethod() and fix of #1159. (PR: #1164)
    • Add helper for query variables (VariableReferenceFunction, VariableScopeFunction). (PR: #1114)
    • Add helper for query to get parents of element. (PR: #1153)
    • Add query functions AllTypeMembersFunction and SuperInheritanceHierarchyFunction. (PR: #1195)
    • Add filter helpers (LocalVariableReferenceFunction, LocalVariableScopeFunction). (PR: #1144)
    • Add filtering helpers (CatchVariableReferenceFunction, CatchVariableScopeFunction). (PR: #1145)
    • Add filtering helpers (ParameterReferenceFunction, ParameterScopeFunction). (PR: #1136)
    • Add support for early terminating queries with CtQuery#first(). (PR: #1138)
    • Add support for getting all children with CtQuery#filterChildren(null). (PR: #1140)
    • Add CtQuery#select(Filter). (PR: #1142)
    • Add query factory. (PR: #1093)
    • Add metamodel method CtTypeParameter#getTypeParameterDeclarer(). (PR: #1217)
    • Reusable and efficient CtQueries. (PR: #1090)
    • filter: Template matchers can be used as filter. (PR: #1110)

    Bug Fixes

    • CtMethod#isDefaultMethod. (PR: #1165)
    • Fix wrong behavior for special cases in removeStatement. Closes #1221. (PR: #1224)
    • Inner interfaces should be properly handled in CtTypeReferenceImpl#canAccess. (PR: #1189)
    • LocalVariableScopeFunction handles CtFor, CtTryWithResource, local classes. (PR: #1154)
    • Fix regression with a lambda expression extends Function. (PR: #1178)
    • CtExecutableReference#isOverriding correctly handles anonymous classes. (PR: #1219)
    • Fix autoimport regression. (PR: #1162)
    • Bug in isSubtypeOf (broken contract X.isSubtypeOf(X)==true). (PR: #1157)
    • Improve static import support in auto-import mode. (PR: #1155)
    • Fix regression (NPE) in DefaultJavaPrettyPrinter. (PR: #1214)
    • GetSuperClass does not throw exception in noClassPath mode. (PR: #1128)
    • Fix NPE when Spoon in executed from an empty working dir. (PR: #1208)
    • Visibility detection issue in CtElement #1099. (PR: #1102)
    • CtQuery: CCE on Query#forEach call of CtConsumer#apply. (PR: #1126)
    • comment: Support comment on string concatenation. (PR: #1124)
    • noclasspath: Fix the qualified name of partial qualified reference (inner class). (PR: #1201)

    Documentation

    • Adds hyperlink to the Spoon paper.
    • Announces the OW2 membership. (PR: #1151)
    • Update ecosystem (one single file to maintain + added syringe). (PR: #1147)
    • Add links to changelogs (#1133). (PR: #1133)
    • Add support files for FOSDEM'17. (PR: #1148)
    • Remove outdated last-updated information on pages. (PR: #1177)
    • More specific doc about the release process. (PR: #1131)
    • Fixes broken menu (#1122). (PR: #1122)
    • Fix javadoc JDK8 rules. (PR: #1112)
    • Prepare internal doc for the new release. (PR: #1109)
    • license: Update license year. (PR: #1130)

    Refactoring

    • Improve and simplify usage of PotentialVariableDeclarationFunction. (PR: #1194)
    • Remove FieldScopeFunction. (PR: #1186)
    • Remove deprecated elements from version 5.4.0. (PR: #1135)

    Performance

    • Improve performance of DirectReferenceFilter. (PR: #1132)

    Tests

    • Reduce the scope of the testSettersAreAllGood test. (PR: #1196)

    Other

    • Only publish revapi report if the PR is edited or opened. (PR: #1161)
    • Revapi configuration and helper scripts to detect API breaking changes. (PR: #1115)
    • travis: Travis must check that javadoc is well-formed. (PR: #1107)

    Unknown

    • Prepare for next development iteration.

    Authors

    | Name | Nb Commit | |---------|-----------| | Pavel Vojtechovsky | 29 | | Simon Urli | 17 | | Martin Monperrus | 5 | | Thomas Durieux | 3 | | Marcel Steinbeck | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.6.0-jar-with-dependencies.jar(7.01 MB)
    spoon-core-5.6.0-javadoc.jar(3.50 MB)
    spoon-core-5.6.0-sources.jar(689.24 KB)
    spoon-core-5.6.0.jar(965.28 KB)
  • spoon-core-5.5.0(Jan 11, 2017)

    Thanks to all contributors!

    New features

    • New query architecture with support for Java8 queries. (PR: #1018)
    • Allow spoon to do static imports for methods and fields. (PR: #1040)
    • Interface to Exclude Compilation Units From CtModel. (PR: #1037)
    • API: Add CtTypeMember.getTopLevelType(). (PR: #1004)
    • CoreFactory
      • Add create(Class) so as to create elements by reflection. (PR: #949)
    • evaluation: Simplify classes based on static evaluation (first support). (PR: #1003)
    • filter: Compute filtered types by reflection from parameter of method matches. (PR: #1015)
    • getDeclaredOrInheritedField: Add CtTypeInformation.getDeclaredOrInheritedField(String fieldName). (PR: #967)
    • model: Add interface CtBodyHolder. (PR: #943)
    • position: Improve the element position. (PR: #984)
    • snippet:
      • Add support for compiling statements with return. (PR: #947)
      • Print Comment in CtSnippet. (PR: #1101)

    Bug Fixes

    • DefaultJavaPrettyPrinted: Fix bug when printing implicit accesses to static fields in autoimport. (PR: #913)
    • JDTBasedSpoonCompiler: Fix annotation bug when templates are used. (PR: #934)
    • NPE: Fix NullPointerException resulting from variable accesses in constructors. (PR: #1098)
    • Fixed name of test class. (PR: #1037)
    • Generate expected EOL even on Windows. (PR: #977)
    • No exception when writing to log. (PR: #920)
    • Test: APITest.testSetterInNodes() was not testing anything . fix #972. (PR: #1022)
    • Close input stream after creating a compilation unit to prevent TooManyOpenFilesException. (PR: #1097)
    • Fix ReferenceBuilder#getLambdaExecutableReference to return the innermost lambda #1100. (PR: #1103)
    • Set the type of a parameter declared in a lambda to Object instead of ommitting them when unknown. (PR: #1108)
    • Fixed formatting. (PR: #1037)
    • Fix inconsistencies between interface contract and double implementations of getAllExecutables. (PR: #1019)
    • Removes unused imports. (PR: #988)
    • Clean exception when Spoon is given a wrong path for input resource. (PR: #1057)
    • SignaturePrinter: Overrides visitCtAnnotationMethod in SignaturePrinter. (PR: #1030)
    • ThisAccess
      • The type access associated to a this must be the type containing the this. (PR: #1008)
      • Shorter this access. (PR: #1031)
    • access path: Fix regression with type parameters in access paths. (PR: #1007)
    • annotations: Fix Dropwazrd regression by fixing substituteAnnotation. (PR: #1032)
    • array: The qualified name of an array is not java.lang.reflect.Array. (PR: #995)
    • clone: Clone preserves comments and implicitness. (PR: #1028)
    • comments
      • Fixes pretty-printing bug for inline arrays with comments. (PR: #912)
      • Fix bug in comments in array initialization. (PR: #1088)
      • Fix a bug concerning multiple comments before a catch block. (PR: #1074)
      • Handle stacked comments in package-info.java. (PR: #1011)
      • Add support of comments in snippets. (PR: #930)
    • enum: GetAllMethods also returns the methods of Enum. (PR: #1016)
    • equal
      • Regenerate EqualVisitor based on new Scanner, which fixes a number of bugs incl. #978. (PR: #993)
      • Actual type references must be part of equality. (PR: #997)
    • getTypeDeclaration
      • First lookup in sources, then in classpath. (PR: #962)
      • GetTypeDeclaration('?') should point to Object. (PR: #973)
    • imports
      • Correct interplay between fully-qualified types and variable names . (PR: #1026)
      • Fix regressions with static imports and inner classes or enums. (PR: #1048)
      • Fix a static import bug, ripple of adb2fd7420b3bf01e696be87f4791759bfb6de53. (PR: #1060)
    • importscanner: Fix regression in fuly-qualified mode. (PR: #1052)
    • isAssignableFrom: Deprecate isAssignableFrom that is totally confusing, and for which there is an alternative. (PR: #948)
    • isSubtypeOf: Spoon can resolve anonymous references. (PR: #953)
    • launcher: Easy way to parse a complete class with package. (PR: #982)
    • log: Filter out some JDT errors in noclasspath. (PR: #926)
    • model
      • Fix NPE when compilation units array contains null elements. (PR: #928)
      • Complex access paths for types with visibility are now correctly handled. (PR: #974)
    • newinstance: Forces usage of the newest version of the class. (PR: #909)
    • parent: Stops furious useless exceptions. (PR: #963)
    • performance
      • Improves performance of VirtualFolder.getAllFiles() and getSubFolders(). (PR: #915)
      • Keep shadow classes. (PR: #898)
    • position: Implicit elements do not have position. (PR: #1086)
    • precompile: Specifies and fixes precompile option. (PR: #923)
    • pretty-print
      • Fix pretty-printing of 'this' access for inner classes. (PR: #1061)
      • The annotation values are now pretty-printed in the original order. (PR: #1067)
      • Parentheses are missing when pretty-pretting some ternary expressions. (PR: #927)
    • reference: Fix reference in ctconstructor. (PR: #1095)
    • scanner
      • Add missing scan properties based on a new powerful specification. (PR: #966)
    • serialization: Fix serialization issue in Factory. (PR: #955)
    • shadow: No ClassNotFoundException when building shadow classes by reflection. (PR: #1012)
    • subtype: Removes CtTypeImpl#isSubtypeOf that is wrong and anyway overridden by all subclasses. (PR: #954)
    • template: Check that Template is on source path of builder. (PR: #976)
    • test
      • Much stronger contracts for setter spec and tests. (PR: #975)
      • Fixes OS-dependent path in LauncherTest. (PR: #919)

    Documentation

    • Add --noclasspath for reducing first-usage friction.
    • Clarifies responsibility of CtNamedElement. (PR: #1062)
    • Adds adt poster and InDesign source. (PR: #1051)
    • Fix markdown issue in code_elements.md.
    • Improve readability and wording of doc/comments.md. (PR: #1079)
    • Fix broken link.
    • Improve navigability and first contact.
    • Update README.md (compiling, ecosystem, contributors). (PR: #1089)
    • Adds doc about constructor calls and the associated reference. (PR: #994)
    • Improve template documentation. (PR: #1068)
    • Adds documentation for explaining the code elements. (PR: #922)
    • SignaturePrinter: Improves doc of SignaturePrinter. (PR: #987)
    • info: Fix broken link to mailing list.
    • Fixes a typo in doc/gradle.md. (PR: #1078)
    • Fix issues related to javadoc in java 8. (PR: #1105)

    Refactoring

    • Same algorithm for building sources, templates and snippet. (PR: #946)
    • Remove code duplication and fix inconsistencies of class Substitution. (PR: #992)
    • Removes dead code. (PR: #989)
    • Check everywhere that Template is on source path of builder. (PR: #979)
    • Removes old unseless code. (PR: #983)
    • Remove unused printer code of visitCtCatchVariable. (PR: #965)
    • JDTBatchCompiler arg.sources not needed. (PR: #958)
    • Regenerate files with short this for future clean diffs. (PR: #1039)
    • Avoid creation of JDT hacking TMP files. (PR: #944)
    • JDTBatchCompiler.getUnits() parameter not required anymore. (PR: #942)
    • Remove old unmaintained/broken code. (PR: #937)
    • All factory methods are also in main Factory for usability and discoverability. (PR: #1082)
    • Removes duplicated code. (PR: #936)
    • Remove unused imports. (PR: #935)
    • Reuse existing CU in JDTBatchCompiler.getUnits(). (PR: #933)
    • Introduce JDTBasedSpoonCompiler.buildModel to remove code duplication. (PR: #931)
    • Improves JDTCommentBuilder. (PR: #924)
    • classloader: Adds test for classloader. (PR: #897)
    • printerContext: Assure correct restore of state. (PR: #999)
    • processingmanager: Removes duplicated code, improves readability. (PR: #1054)
    • Deprecate reference filtering that is now handled by standard element filtering. (PR: #1013)
    • Renamed label from units to unitLoop. (PR: #1037)
    • Remove dependency to CompilationUnitDeclaration. (PR: #1037)
    • Use filter to exclude instead of accapt units. (PR: #1037)
    • We must always have a source + exception handling. (PR: #996)
    • Added an interface used to filter particular CompilationUnitDeclaraions. (PR: #1037)

    Performance

    • Cache inputClassLoader corresponding to sourceClasspath. (PR: #990)
    • Improve performance of FindCommentParentScanner. (PR: #917)

    Tests

    • ParentContractTest: Improves contract about setting parents. (PR: #956)
    • TemplateMatcher: Add tests for named template matchers (uncovered cases). (PR: #1092)
    • VisitorPartialEvaluator: Add tests for VisitorPartialEvaluator. (PR: #939)
    • metamodel: Enforce the package design of the metamodel. (PR: #945)
    • superClass: Adds test that verifies the compilation of complex superclass references that use access paths with tricky visibility. (PR: #971)
    • template: Add test for super interface templates. (PR: #1020)
    • templatematcher: Add a new Junit test and dynamic assertion for TemplateMatcher. (PR: #1034)
    • Add test for method parameter templating. (PR: #1064)
    • Add tests and doc for template engine. (PR: #1072)
    • Add a test to check if TemplateMatcher can match two equivalent snippets. (PR: #1059)
    • Reduces I/O footprint (and found two IO bugs on the way). (PR: #969)
    • Add coverage for templates (and unify API thanks to this). (PR: #1049)
    • Add missing @Test. (PR: #950)
    • One test was not named correctly, hence was not run by Maven in CI, hiding a bug. (PR: #1036)
    • Update CompilationTest to match latest compiler changes. (PR: #940)
    • Remove unused imports. (PR: #941)
    • replacevisitor: Add a strong test and fix many bugs accordingly. (PR: #957)
    • Added a test for new compilation unit filter. (PR: #1037)

    Other

    • changelog: Improve the changelog generator. (PR: #1087)
    • jenkins: Purge local repository of all Spoon snapshots. (PR: #1065)
    • Change eclipse jdt core dependency now depends on Maven central only. (PR: #1063)
    • Update version of spoon-maven-plugin. (PR: #906)
    • build.sh: Update minimum version to fix problem with repo.eclipse.org.
    • coverage: Update coveralls version. (PR: #1001)
    • release: Update version number in documentation. (PR: #907)
    • Added license note to CompilationUnitFilter. (PR: #1037)

    Authors

    | Name | Nb Commit | | --- | --- | | Martin Monperrus | 52 | | Pavel Vojtechovsky | 36 | | Simon Urli | 21 | | Thomas Durieux | 13 | | Marcel Steinbeck | 11 | | Benjamin DANGLOT | 3 | | Дмитрий | 1 | | Artur Bosch | 1 | | Scott Dickerson | 1 | | arno_b | 1 | | Gérard Paligot | 1 | | Lionel Seinturier | 1 | | aveuiller | 1 |

    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.5.0-jar-with-dependencies.jar(6.98 MB)
    spoon-core-5.5.0-javadoc.jar(3.34 MB)
    spoon-core-5.5.0-sources.jar(657.28 KB)
    spoon-core-5.5.0.jar(929.61 KB)
  • spoon-core-5.4.0(Oct 27, 2016)

    Important changes

    • CtElement are not comparable anymore (no natural order), they cannot be put in raw TreeSet (PR: #844)
    • The processing and scanning order has changed, it now follows the source code order (Issue: #681) (PR: #841)

    New feature

    • ast
      • Always a block for CtIf and CtLoop. (PR: #805)
    • cttype : New method to know whether a given method is part of a CtType. (PR: #880)
    • position : Defines a default source position for all elements. (PR: #861)

    Fixes

    • factory : Handles null parameter in Type#createReference(Class) and isSubTypeOf. (Closes #825). (Issue: #825) (PR: #837)
    • getDeclaration : Incorrect between getReference and getDeclaration for local variables. (PR: #888)
    • Fixes potential NullPointerException in JDTTreeBuilderQuery. (PR: #887)
    • Enables parallel tests. (PR: #838)
    • GetAllMethods in noclasspath return when encounter an unknown class. (PR: #864)
    • Better getDeclaration of CtLocalVariable (Fixes #868). (Issue: #868) (PR: #873)
    • compilation : Always uses the content of the ast to compile the ast (fixes #878). (Issue: #878) (PR: #879)
    • exception : Improves snippet compilation error message. (PR: #858)
    • if : Print the else body when the body is not a block (closes #881). (Issue: #881) (PR: #883)
    • isLocalType : Proper support for creating internal classes (fixes #776). (Issue: #776) (PR: #860)
    • literal
      • Fix literal type. (PR: #891)
      • Set the type of the CtLiteral via the CodeFactory. (PR: #829)
    • loop : Always use CtBlock in CtForeach. (PR: #847)
    • method : Avoid Concurrent modification with CtType#addMethod. (PR: #850)
    • position : Add default compilation unit when pretty-printing a new CtClass (closes #885). (Issue: #885) (PR: #886)
    • travis : The logs of Travis are not polluted by Javadoc warnings. (PR: #866)

    Documentation

    • Add missing paper information. (PR: #889)
    • Adds doc about architecture checking. (PR: #843)
    • Update papers.md. (PR: #834)
    • Update on release doc. (PR: #830)
    • gradle : Improves Gradle doc (fixes #875). (Issue: #875) (PR: #876)
    • support : Improves support documentation. (PR: #865)
    • release : Update release number. (PR: #831)

    Refactoring

    • Allow Launcher to use an existing Factory (Closes #862). (Issue: #862) (PR: #863)
    • Fix a test that fails on Eclipse due to its classloader. (PR: #859)
    • Removes all useless conditions with CtReference. (Closes #824). (Issue: #824) (PR: #836)
    • ast : Improves generic parameter type of setActualTypeReferences. (Closes #823). (Issue: #823) (PR: #835)
    • release : Remove deprecated code. (PR: #833)

    Other

    • jenkins : Clean. (PR: #848)
    • pom : Updates commons-io from 1.3.2 to 1.4. (Closes #845). (Issue: #845) (PR: #851)
    • release
      • Scripts to publish automatically a release. (PR: #852)
      • Adds nodejs script to generate changelog. (PR: #832)
    • travis : Avoid running several times the tests on Travis. (PR: #839)
    • version : Update spoon maven plugin version. (PR: #849)
    • website : Add a link checker (fixes #797). (Issue: #797) (PR: #872)
    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.4.0-jar-with-dependencies.jar(6.97 MB)
    spoon-core-5.4.0-javadoc.jar(3.22 MB)
    spoon-core-5.4.0-sources.jar(639.19 KB)
    spoon-core-5.4.0.jar(922.89 KB)
  • spoon-core-5.3.0(Sep 19, 2016)

    New feature

    • ast
      • Adds CtTypeInformation#isGenerics method. (PR: #799)
      • Introduces new metamodel class CtTypeParameter for representing a generic type parameter. (Closes #606). (Issue: #606) (PR: #798)
    • wildcard : Creates a new metamodel element for representing a generics wildcard. (Closes #605). (Issue: #605) (PR: #796)

    Fixes

    • access
      • Qualified field access with import static. (PR: #789)
      • Qualified fieldaccess in noclasspath mode. (PR: #762)
    • Typecasts on conditionals are not scanned hence not cloned. (PR: #753)
    • Avoid NullPointerException in CtExecutableReferenceImpl.getDeclaration. (closes #808). (Issue: #808) (PR: #809)
    • Fix NPE in getUsedTypes (Closes #650). (Issue: #650) (PR: #800)
    • Fix regressions introduced by #748. (Issue: #748) (PR: #789)
    • GetAllMethods returns all methods, incl. those of library superclasses and java.lang.Object. (PR: #771)
    • annotation : Supports enum fields with Annotation#annotate() method. (Closes #750). (Issue: #750) (PR: #767)
    • actual : Rewrite actual types with their enclosing class. (PR: #789)
    • api : CtModel.processWith(). (PR: #821)
    • array
      • Builds dimensions with casts. (PR: #789)
      • Allows array in an array. (PR: #789)
    • docs : Changes target of getSignature in javadoc. (PR: #742)
    • enum : Handle synthetic methods of enums (fixes #793). (Issue: #793) (PR: #794)
    • executable
      • Allows block in executable. (PR: #789)
      • Fix method ExecutableFactory#createReference to handle static methods (Closes #817). (Issue: #817) (PR: #818)
    • factory : GetDeclaration from element created by factory should not return null. (closes #719). (Issue: #719) (PR: #735)
    • fieldaccess : Static field access in anonymous executable (closes #816). (Issue: #816) (PR: #819)
    • import : Skip findImport and createPackage if necessary. Fixes #759. (Issue: #759) (PR: #760)
    • lambda : Resolve Literal#constant if required. Fixes #755. (Issue: #755) (PR: #758)
    • method : Search method with generics. (Issue: #573) (PR: #799)
    • noclasspath
      • Mark target as implicit if it's an anonymous class. (Closes #707). (Issue: #707) (PR: #737)
      • Correct reference to parameters in lambda methods. (Closes #779). (Issue: #779) (PR: #802)
      • Access lookup in lambda expressions in noclasspath mode. (Issue: #813) (PR: #814)
      • Tolerates missing annotation types. (PR: #820)
      • Avoid exception when we call getAllFields method. (PR: #780)
    • package : Handle packages with only package-info.java. (Closes #748). (Issue: #748) (PR: #766)
    • reference
      • Allow creation of a reference from CtAnonymousExecutable. (Closes #739). (Issue: #739) (PR: #740)
      • Dynamically lookup the declaration of all variable references (closes #756). (Issue: #756) (PR: #764)
      • No declaring type in an executable reference of a lambda. (fixes #733). (Issue: #733) (PR: #734)
    • replace : Use generic replace with CtStatementList elements (closes #792). (Issue: #792) (PR: #795)
    • type : Fix exception in noclasspath due to PolyTypeBinding. (Closes #751). (Issue: #751) (PR: #804)

    Refactoring

    • ref : Removes unused CtCircularTypeReference. (PR: #799)
    • visitor : Rename EqualVisitor to DeepRepresentationVisitor. (Closes #791). (Issue: #791) (PR: #801)
    • Refactors DefaultJavaPrettyPrinter and JDTTreeBuilder to simplify future maintenance. (PR: #784)
    • Moves JDTTreeBuilder inner classes into top-level classes, adds one helper class with static methods. (PR: #746)
    • Removes getSignature() and create getShortRepresentation(). (PR: #738)
    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.3.0-jar-with-dependencies.jar(6.97 MB)
    spoon-core-5.3.0-javadoc.jar(3.17 MB)
    spoon-core-5.3.0-sources.jar(629.79 KB)
    spoon-core-5.3.0.jar(918.64 KB)
  • spoon-core-5.2.0(Jun 30, 2016)

    Metamodel

    • Clean reset of collections in intercession methods. (PR: #712)
    • All setters allow null parameters. (PR: #694)
    • Introduces CtModel (Issue: #584) (PR: #589)
    • Creates factory methods for primitives. (Issue: #651) (PR: #700)
    • Remove CtImplicitTypeRef and CtImplicitArrayTypeRef. (PR: #667)

    New features

    • shadow : Build shadow elements using Reflection API. (PR: #569)
    • checks : Disable AST checks. (Issue: #649) (PR: #684)
    • comment
      • All comments are handled by the same option (-c). (Issue: #666) (PR: #676)
      • Adds comment support. (PR: #554)
    • filter : Adds LineFilter to reason about statements in blocks. (PR: #678)
    • clone : Adds the handy CtElement#clone (and deprecates CoreFactory#clone). (PR: #677)
    • Refactoring of CtElement.equals for performance. (PR: #674)
    • A faster implementation of 'replace' based on code generation. (PR: #632)

    Fixes

    • annot : Reference to an annotation field as an invocation. (Issue: #578) (PR: #660)
    • ast : Align CtNewClass with CtConstructorCall. (PR: #595)
    • cache : Invalidate cache of the compiler. (Issue: #575) (PR: #577)
    • clone
      • Scan declaring executable of CtParameterRef (closes #729). (Issue: #729) (PR: #730)
      • Fix bug (modifiers not deep copied). (PR: #727)
    • comment
      • Fix bug in the usage of the new flag (closes #721). (Issue: #721) (PR: #723)
      • Handles comments in CtNewArray and in CtConditional. (Issue: #588) (PR: #590)
    • compiler : Add class generated to compilation unit. (PR: #564)
    • conditional : Puts parenthesis when it is necessary. (PR: #669)
    • factory : Gets inner type from Class/InterfaceFactory. (closes #640). (Issue: #640) (PR: #682)
    • filter : Fixes NPE in VariableAccessFilter when the getVariable() is null (e.g. super). (PR: #641)
    • getparent : GetParent(Filter) does not return the current element when it matches the filter. (PR: #638)
    • lambda : Builds executable ref from a lambda. (PR: #665)
    • noclasspath : NPE in a scope usage. (Issue: #574) (PR: #576)
    • parent
      • Avoid NPE with CtElement#hasParent(CtElement) (Closes #679). (Issue: #679) (PR: #685)
      • HasParent should not always return false. (PR: #686)
    • performance : Rewrite CtExecutableReference#isOverriding. (Issue: #586) (PR: #592)
    • printer : Protects each getParent invocation in DefaultJavaPrettyPrinter. (PR: #704)
    • ref : Scan declaring type for CtExecutableReference. (PR: #715)
    • unbox : Don't throw a SCNFException with #unbox(). (PR: #620)
    • Declaring type OR package should be set for a reference, not both. (PR: #613)
    • Annotation values traversal should be delegated to scan(), fixes #603. (Issue: #603) (PR: #614)
    • Fix bugs in ImportScannerImpl. (PR: #596)
    • Fix a number of bugs related to handling of unnamed packages. (PR: #705)
    • Fix bug introduced in #689 (order to iterate with a Deque and Stack are different). (Issue: #689) (PR: #710)
    • Fix nullpointer in hasTypeInImports. (PR: #672)
    • Use CtTypeParameterRef for formal ops. (PR: #620)
    • Fix bugs in ClassFactory.create() methods. (PR: #610)
    • Fix many small bugs with double usage of AST nodes in different subtrees,. (PR: #645)
    • Doesn't warn for implicit source code. (PR: #696)
    • Fix a bug in CodeFactory.createThisAccess() (target was not set). (PR: #612)
    • Fix bugs with creating CtTypeAccess without cloning reference, that leads to problems with replace() in graph. (PR: #611)
    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.2.0-jar-with-dependencies.jar(6.94 MB)
    spoon-core-5.2.0-javadoc.jar(3.12 MB)
    spoon-core-5.2.0-sources.jar(609.64 KB)
    spoon-core-5.2.0.jar(888.18 KB)
  • spoon-core-5.1.0(Mar 21, 2016)

    New features

    • Full support of intersection types. #535
    • Fluent api to test source code transformations. #517
    • Add field at the top of a type. #537

    Minor API changes

    • Annotation values are handled as CtExpression. #555 #556
    • CtVariableAccess#getType does not return null anymore, now delegates to getVariable().getType(). #548

    Fixes

    • No classpath:
      • NPE thrown with annotations on primitive type. #530
      • Anonymous class name must have an empty string. #530
      • NPE when build the type of a CtNewArray. #561
    • Generics:
      • Generics in declaring types of a constructor call. #538
      • A local type can have actual generic types. #542
      • Generics in declaring types of a new class. #545
    • Fields:
      • The qualified name of a type declared in an anonymous class. #541
    • Visibility:
      • Field access declared in a default class. #543

    Refactoring

    • Refactored responsabilities of equal/hashcode/signature. #532
    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.1.0-jar-with-dependencies.jar(6.59 MB)
    spoon-core-5.1.0-javadoc.jar(2.70 MB)
    spoon-core-5.1.0-sources.jar(514.70 KB)
    spoon-core-5.1.0.jar(640.34 KB)
  • spoon-core-5.0.2(Feb 12, 2016)

  • spoon-core-5.0.1(Feb 3, 2016)

  • spoon-core-5.0.0(Jan 25, 2016)

    API major changes

    • Better model for field accesses (now with implicitness information), *.class expressions, and method calls (better handling of static) https://github.com/INRIA/spoon/pull/475, https://github.com/INRIA/spoon/pull/473, https://github.com/INRIA/spoon/pull/458, https://github.com/INRIA/spoon/pull/458
    • Puts CtReference below CtElement (allows you to process, replace references and get signatures). https://github.com/INRIA/spoon/pull/391
    • Deprecates CtTypeAnnotation to use CtAnnotation in refs. https://github.com/INRIA/spoon/pull/391

    API minor changes

    • Never throw an UnsupportedOpException in getters. https://github.com/INRIA/spoon/pull/438
    • Delegates type information handling of CtInvocation, CtNewClass and CtConstructorCall to their executable. https://github.com/INRIA/spoon/pull/433
    • Puts CtAnonymousExecutable under CtExecutable. https://github.com/INRIA/spoon/pull/430
    • Minor changes in Snippet helper. https://github.com/INRIA/spoon/pull/443

    Features

    • Allow interruption of a processor. https://github.com/INRIA/spoon/pull/485
    • Search a package in imports. https://github.com/INRIA/spoon/pull/466
    • Apply filter on pretty-printed classes. https://github.com/INRIA/spoon/pull/456
    • New filters to get all overridden/overriding methods. https://github.com/INRIA/spoon/pull/452
    • Support filtering on parents (getParent(Filter) method in CtElement). https://github.com/INRIA/spoon/pull/439
    • Delete any element in a Spoon AST. https://github.com/INRIA/spoon/pull/423

    Fixes

    • No classpath
      • Arguments of an inv should be a CtFieldRead. https://github.com/INRIA/spoon/pull/502
      • Checks if this access parent is final. https://github.com/INRIA/spoon/pull/497
      • Gets package of types in the class declaration. https://github.com/INRIA/spoon/pull/477
      • With an unkown argument, prints . https://github.com/INRIA/spoon/pull/459
      • Supports superclass declared in an interface. https://github.com/INRIA/spoon/pull/435
      • Supports superclass of a nested class. https://github.com/INRIA/spoon/pull/434
      • Supports CtLiteral of char. https://github.com/INRIA/spoon/pull/429
      • Supports CtParameter. https://github.com/INRIA/spoon/pull/428
      • Supports CtFieldAccess. https://github.com/INRIA/spoon/pull/424, https://github.com/INRIA/spoon/pull/417
      • Supports CtConstructorCall. https://github.com/INRIA/spoon/pull/416
      • Anonymous class in noclasspathmode throws NPE. https://github.com/INRIA/spoon/pull/415
    • Fixes fully qualified name of type ref with generics. https://github.com/INRIA/spoon/pull/500
    • Fixes getDeclaration which throws a NPE in anonymous class. https://github.com/INRIA/spoon/pull/496
    • Prints (i++).toString() and no more i++.toString(). https://github.com/INRIA/spoon/pull/493
    • Fixed the FieldWrite bug in OperatorAssignment. https://github.com/INRIA/spoon/pull/487
    • Allows serialization of SourcePosition. https://github.com/INRIA/spoon/pull/486
    • Fixes the position in the spoon model. https://github.com/INRIA/spoon/pull/421, https://github.com/INRIA/spoon/pull/441
    • Fixes bug related to insertBefore, insertAfter, insertEnd and getSignature. https://github.com/INRIA/spoon/pull/450
    Source code(tar.gz)
    Source code(zip)
    spoon-core-5.0.0-jar-with-dependencies.jar(6.56 MB)
    spoon-core-5.0.0-javadoc.jar(2.56 MB)
    spoon-core-5.0.0-sources.jar(490.61 KB)
    spoon-core-5.0.0.jar(610.43 KB)
  • spoon-core-4.4.1(Nov 18, 2015)

  • spoon-core-4.4.0(Nov 16, 2015)

    Minor API Changes

    • Throws a SpoonException when a processor is not found: https://github.com/INRIA/spoon/pull/366
    • Deprecates process(List) method in SpoonModelBuilder for a new one: https://github.com/INRIA/spoon/pull/402
    • Removed deprecated secondary methods: https://github.com/INRIA/spoon/pull/370, https://github.com/INRIA/spoon/pull/358, https://github.com/INRIA/spoon/pull/343

    Documentation

    • New documentation:
      • Getting started (http://spoon.gforge.inria.fr/): https://github.com/INRIA/spoon/pull/342
      • Usage (http://spoon.gforge.inria.fr/command_line.html): https://github.com/INRIA/spoon/pull/344
      • Spoon Meta Model (http://spoon.gforge.inria.fr/structural_elements.html): https://github.com/INRIA/spoon/pull/351
      • Quering source code elements (http://spoon.gforge.inria.fr/filter.html): https://github.com/INRIA/spoon/pull/352
      • Processing source code elements (http://spoon.gforge.inria.fr/processor.html): https://github.com/INRIA/spoon/pull/357
      • Templating source code (http://spoon.gforge.inria.fr/template_definition.html): https://github.com/INRIA/spoon/pull/360
    • Documentation put in the master branch in the repo: https://github.com/INRIA/spoon/pull/331

    Fixes

    • Prints the parent class when it has generics: https://github.com/INRIA/spoon/pull/389
    • Fix method calls on annotation: https://github.com/INRIA/spoon/pull/388
    • Missing CtTypeReference for instanceof expressions when querying: https://github.com/INRIA/spoon/pull/392
    • Writes correctly field access in anonymous type: https://github.com/INRIA/spoon/pull/387
    • Handles unicode characters in string literals: https://github.com/INRIA/spoon/pull/382
    • CtTypeParameterReference doesn't print always full generic: https://github.com/INRIA/spoon/pull/381
    • Allows enum without fields: https://github.com/INRIA/spoon/pull/380
    • Removes array notation in a lambda parameter and diamond operator: https://github.com/INRIA/spoon/pull/379
    • Writes parameters in a lambda expression without their types if the original code didn't write them: https://github.com/INRIA/spoon/pull/384
    • Sets the parent when we used insertAfter and insertBefore methods: https://github.com/INRIA/spoon/pull/375
    • Fixes a bug with circular references in generic types: https://github.com/INRIA/spoon/pull/374
    • Fix CtClass.getConstructor with Array parameter: https://github.com/INRIA/spoon/pull/373
    • Better handles invocations in noclasspath mode: https://github.com/INRIA/spoon/pull/350

    CI

    • Integrates AppVeyor. AppVeyor is an alternative to Travis but in a Windows environment: https://github.com/INRIA/spoon/pull/394
    • Integrates INRIA Jenkins and Github (http://ci.inria.fr/sos)
    Source code(tar.gz)
    Source code(zip)
    spoon-core-4.4.0-jar-with-dependencies.jar(6.54 MB)
    spoon-core-4.4.0-javadoc.jar(2.50 MB)
    spoon-core-4.4.0-sources.jar(438.73 KB)
    spoon-core-4.4.0.jar(594.30 KB)
Owner
Inria
Inria, the French national research institute for the digital sciences
Inria
:coffee: SonarSource Static Analyzer for Java Code Quality and Security

Code Quality and Security for Java This SonarSource project is a code analyzer for Java projects. Information about the analysis of Java features is a

SonarSource 801 Jul 27, 2021
A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead

NullAway: Fast Annotation-Based Null Checking for Java NullAway is a tool to help eliminate NullPointerExceptions (NPEs) in your Java code. To use Nul

Uber Open Source 3k Jul 26, 2021
Burp plugin for the 1Password session protocol for use by security researchers. https://bugcrowd.com/agilebits

1Password session analyzer plugin for Burp Suite This repository contains a Burp plugin that adds a special message editor view to Burp to analyze and

1Password 12 Jul 3, 2021
Tackle Data-intensive Validity Analyzer

Tackle-DiVA (Data-intensive Validity Analyzer) Tackle-DiVA is a command-line tool for data-centric application analysis. It imports a set of target ap

Konveyor 7 Jul 13, 2021
⚡️Lightning-fast linter for .env files. Written in Rust 🦀

⚡️ Lightning-fast linter for .env files. Written in Rust ?? Dotenv-linter can check / fix / compare .env files for problems that may cause the applica

null 1.1k Jul 28, 2021
Sourcetrail - free and open-source interactive source explorer

Sourcetrail Sourcetrail is a free and open-source cross-platform source explorer that helps you get productive on unfamiliar source code. Windows: Lin

Coati Software 11.7k Jul 28, 2021
Astra: a Java tool for analysing and refactoring Java source code

What is Astra? Astra is a Java tool for analysing and refactoring Java source code. For example: "References to type A should instead reference type B

Alfa 33 Jul 23, 2021
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.

SpotBugs is the spiritual successor of FindBugs, carrying on from the point where it left off with support of its community. SpotBugs is licensed unde

null 2.4k Jul 23, 2021
An extensible multilanguage static code analyzer.

PMD About PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and

PMD 3.5k Jul 20, 2021
A static analyzer for Java, C, C++, and Objective-C

Infer Infer is a static analysis tool for Java, C++, Objective-C, and C. Infer is written in OCaml. Installation Read our Getting Started page for det

Facebook 12.4k Jul 27, 2021
OpenGrok is a fast and usable source code search and cross reference engine, written in Java

Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved. OpenGrok - a wicked fast source browser OpenGrok - a wicked fast source br

Oracle 3.3k Jul 26, 2021
Continuous Inspection

SonarQube Continuous Inspection SonarQube provides the capability to not only show health of an application but also to highlight issues newly introdu

SonarSource 5.9k Jul 24, 2021
Catch common Java mistakes as compile-time errors

Error Prone Error Prone is a static analysis tool for Java that catches common programming mistakes at compile-time. public class ShortSet { public

Google 5.7k Jul 27, 2021