Auto-apply syntactic sugar

Open
#2,010 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

The issue names no files, tests, or entry points. Start by surveying the Spotless repository to locate Java formatting or plugin integration points, then determine which categories of syntactic sugar are in scope. Done should mean the agreed simplifications are applied automatically with coverage for representative Java examples.

Written by the indexing model from the issue text.

Description

enhancement

Many constructions in Java can be simplified with syntactic sugar. For example,

foo.ifPresent(value -> value.someMethod());

can be simplified to

foo.ifPresent(Foo::someMethod);

Also,

foo.methodWithCallback(new Foo.Callback() {
    @Override
    public void
    onDone(int result) {
        ...
    }
});

can be simplified to

foo.methodWithCallback(result -> ...);

It would be really helpful to have a plugin that could auto-apply all such simplifications.

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.