新版IDEA特性–JAVA
2017.1 EAP
Replacing streams with loops
Replace complicated chains of stream API calls with for loops for better readability or debugging of complicated chains.
JUnit 5 inspections
All JUnit 4 inspections are now available for JUnit 5.
Regexp syntax highlighting
Dedicated section in Settings → Editor → Colors & Fonts for RegExp syntax highlighting.
Generating toString
Fields from superclasses are available when you’re generating toString methods.
Overriding methods
You can now choose which annotations will be copied to the overriding implementation from its super method.
2016.3 Nov 22
Refactoring to Java 8
Now, if you press Alt+Enter inside a non-trivial for-loop, the IDE will prompt you to replace it with a chain of stream API calls. It supports count, flatMap, map, mapToInt, collect, filter, anyMatch, and other Stream methods. learn more
Also, when appropriate, the IDE will prompt you to replace certain code with Map.computeIfAbsent, Collections.removeIf or ThreadLocal.withInitial. learn more
Reporting nullability issues
Now, if you have a method with a @NotNull or Guava’s Objects.requireNonNull contract and the IDE notices that this contract is broken somewhere in the project, it will notify you immediately about that next to your parameter definition.
The corresponding inspection also allows you to navigate to those usages breaking your contract–so you can fix that.
Inlining local variables used only by return statements
The new inspection finds local variables used only by return statements, and provides a quick fix that inlines these variables–by replacing their assignments with return statements.
When the returned value can’t be inlined into a return statement, the quick fix attempts to move the return statement as close to the computation of the returned value as possible.
learn more
Runtime assertions for not-null-annotated code
IntelliJ IDEA’s compiler (Settings → Build, Execution, Deployment → Compiler) has an option to generate runtime assertions for methods and parameters annotated with org.jetbrains.annotations.NotNull.
Starting now it supports non-JetBrains annotations as well, in particular JSR-305.
learn more
Some intentions became quick-fixes
Unlike intention actions, inspection quick-fixes can be applied to many files at once. We’ve chosen several intentions that may work better as quick-fixes and converted them: Lambda can be replaced with anonymous class and Diamond can be replaced with explicit type arguments to name a few.
Lambdas in Structure view
Now if you press Ctrl+L in the Structure view, it will show lambda expressions.
Unused declaration options
Now you can manage the Unused declaration inspection by choosing which members to report.
Meta-annotations hierarchy
The Type Hierarchy view now works for meta-annotations as well.