Skip to content

Releases: INRIA/spoon

spoon-core-5.5.0

11 Jan 15:57
Compare
Choose a tag to compare

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 adb2fd7. (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 documen...
Read more

spoon-core-5.4.0

27 Oct 16:07
Compare
Choose a tag to compare

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)

spoon-core-5.3.0

19 Sep 13:13
Compare
Choose a tag to compare

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)

Spoon 5.2.0

30 Jun 08:57
Compare
Choose a tag to compare

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)

spoon-core-5.1.1

22 Jun 15:21
Compare
Choose a tag to compare

Hotfix

  • Updates remote repository to download JDT.

spoon-core-5.1.0

21 Mar 15:44
Compare
Choose a tag to compare

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

spoon-core-5.0.2

12 Feb 09:32
Compare
Choose a tag to compare

Fixes

  • Local type shouldn't start its name with its identifier in a constructor.
  • Uses CtFieldRead for class access in values of annotations.

spoon-core-5.0.1

03 Feb 16:18
Compare
Choose a tag to compare

Features

  • replace: Adds replace in CtElement. #511
  • Local type have a number in their name. #513

Fixes

  • noclasspath: FieldAccess in an invocation. #512
  • targeted: A class can be declared in a lambda expression. #513
  • template: Replace an invocation in a BlockTemplate. #511

spoon-core-5.0.0

25 Jan 09:25
Compare
Choose a tag to compare

API major changes

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

API minor changes

  • Never throw an UnsupportedOpException in getters. #438
  • Delegates type information handling of CtInvocation, CtNewClass and CtConstructorCall to their executable. #433
  • Puts CtAnonymousExecutable under CtExecutable. #430
  • Minor changes in Snippet helper. #443

Features

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

Fixes

  • No classpath
    • Arguments of an inv should be a CtFieldRead. #502
    • Checks if this access parent is final. #497
    • Gets package of types in the class declaration. #477
    • With an unkown argument, prints . #459
    • Supports superclass declared in an interface. #435
    • Supports superclass of a nested class. #434
    • Supports CtLiteral of char. #429
    • Supports CtParameter. #428
    • Supports CtFieldAccess. #424, #417
    • Supports CtConstructorCall. #416
    • Anonymous class in noclasspathmode throws NPE. #415
  • Fixes fully qualified name of type ref with generics. #500
  • Fixes getDeclaration which throws a NPE in anonymous class. #496
  • Prints (i++).toString() and no more i++.toString(). #493
  • Fixed the FieldWrite bug in OperatorAssignment. #487
  • Allows serialization of SourcePosition. #486
  • Fixes the position in the spoon model. #421, #441
  • Fixes bug related to insertBefore, insertAfter, insertEnd and getSignature. #450

spoon-core-4.4.1

18 Nov 13:48
Compare
Choose a tag to compare

Fixes

  • Supports circular type reference on declaring method: #410