A Personal Collection of Useful Extensions for the Eclipse IDE
This is a collection of various extensions to the Eclipse IDE, mainly the Java Development Tools (JDT). The update site URL is https://extensions.eclipse.maisikoleni.net/repository/latest/ for the most recent build of all Eclipse feature plugins.
As personal use is the main goal of my development efforts, I cannot guarantee that it will work in all Eclipse versions. The plugins often break the intended public API barrier of the JDT modules, as without the internal API I would need to reinvent the wheel a lot (or copy the code into my project). I prefer to adjust to internal API changes instead (should that ever be necessary). The main aim is that the plugin works with the latest Eclipse IDE release running on at least the latest LTS-JDK. Currently, this is Eclipse 2022-03 with JDK 17+. |
1. JDT Extensions
A feature plugin category that contains Extensions for the Eclipse Java Development Tools (https://www.eclipse.org/jdt/) of the Eclipse Java IDE.
1.1. JDT CleanUp Extensions
Clean-ups are actions performed on Java code
that refactor and clean up the code in various ways
such as formatting, simplifying expressions or
transformations from old structures to more expressive
new Java language features.
They are available for Java source folder/packages/files
using Source
→ Clean Up…
but you can configure
most of them to run automatically on save, too.
The "JDT CleanUp Extensions" plugin of this project extends the available clean-ups by the following Clean Ups.
1.1.1. Method Negation Pushdown
Similar to the Push down negation
clean-up
provided by the JDT this clean-up pushes negations
further down but instead of expressions, it eliminates
negations by swapping a method invocation A to
an invocation of its counterpart, B.
The table Supported Opposing Method Pairs lists all currently
supported method pairs.
Invocation Target Type | Method A | Method B |
---|---|---|
|
|
|
|
|
|
|
|
|
For example, the statements
boolean isNull = !Objects.nonNull(null);
boolean isEmpty = !Optional.of(42).isPresent();
boolean hasBlank = !(Stream.of("penguin").noneMatch(String::isBlank));
will get transformed into
boolean isNull = Objects.isNull(null);
boolean isEmpty = Optional.of(42).isEmpty();
boolean hasBlank = Stream.of("penguin").anyMatch(String::isBlank);
This clean-up can be used together with the standard
Push down negation
clean-up in most cases, but it may
be necessary to run the clean-ups multiple times in case
there is a lot to push down (this is already the case
without the extensions).