Spoon v6.0.0 Release Notes

Release Date: 2017-11-17 // over 6 years ago
  • 🆕 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

    • 🍱 ⚠️ [BREAKING] Fix ClassTypingContext#isSameSignature for generic methods. (PR: #1639)
    • 🍱 ⚠️ [BREAKING] SetVisibility should only be used with private, public or protected. (PR: #1705)
    • 🍱 ⚠️ [MAYBE BREAKING] Less hashcode collisions for CtReference. (PR: #1717)
    • 🍱 ⚠️ [BREAKING] Move deprecated classes to spoon.legacy. (PR: #1518)
    • 🍱 ⚠️ [BREAKING] Template: Replacing of field access by refining behaviour of String parameter. (PR: #1476)
    • 🍱 ⚠️ [BREAKING] Remove the useless factory in Environment. (PR: #1673)
    • 🍱 ⚠️ 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

    • 🍱 ⚠️ [BREAKING] Get rid of snapshotLength and hasNewContent. (PR: #1576)
    • 🍱 ⚠️ [BREAKING] CompilationUnit#create renamed to getOrCreate. (PR: #1645)
    • 🍱 ⚠️ [BREAKING] CtModifiable add/removeModifier stick to convention on returned object. (PR: #1706)
    • 🍱 ⚠️ [BREAKING] Remove ant related code and dependency. (PR: #1540)
    • 📦 ⚠️ [BREAKING] Move ElementPrinterHelper to the appropriate package. (PR: #1551)
    • 🍱 ⚠️ [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)
    • 0️⃣ 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)
    • 0️⃣ 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