mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[lombok] Fixed ignoring @Tolerate methods for @With processing
merged PR(#1001) and corresponding changes from github updated Readme.md GitOrigin-RevId: 69e65839eb6f83becc8a6d05a02b7350353b7a6b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
866d5ad690
commit
16c52e8087
@@ -1,54 +1,10 @@
|
||||
lombok-intellij-plugin [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3F9HXD7A2SMCN)
|
||||
======================
|
||||
[![Build Status][badge-travis-img]][badge-travis] [](https://codecov.io/github/mplushnikov/lombok-intellij-plugin?branch=master)
|
||||
## **Lombok IntelliJ Plugin**
|
||||
|
||||
[](https://plugins.jetbrains.com/plugin/6317-lombok-plugin)
|
||||
[](https://plugins.jetbrains.com/plugin/6317-lombok-plugin)
|
||||
[](https://plugins.jetbrains.com/plugin/6317-lombok-plugin)
|
||||
Integrated into IntelliJ starting with 2020.3 Release
|
||||
|
||||
[![Gitter][badge-gitter-img]][badge-gitter] [![Donate][badge-paypal-img]][badge-paypal]
|
||||
Originally developed on Github in https://github.com/mplushnikov/lombok-intellij-plugin, starting on Sun Sep 11 11:16:31 2011
|
||||
|
||||
|
||||
## Plugin for [IntelliJ IDEA](http://plugins.jetbrains.com/plugin/6317-lombok-plugin) to support [Lombok](https://projectlombok.org) annotations.
|
||||
|
||||
Provides support for lombok annotations to write great Java code with IntelliJ IDEA.
|
||||
|
||||
**Last version (0.32) released on 25.09.2020**
|
||||
|
||||
---
|
||||
:collision: **Unfortunately the current IntelliJ 2020.2 version has a bug and lombok plugin can't be used normally.** :collision:
|
||||
|
||||
:hammer_and_wrench: Use previous IntelliJ version 2020.1 or update to IntelliJ IDEA 2020.2.1 or newer
|
||||
---
|
||||
|
||||
:collision: **The latest IntelliJ IDEA versions still contains a BUG :beetle: for several plugins (including plugin for Lombok) were shown as incompatible with the updated version of the IDE.** :collision:
|
||||
|
||||
You can find the issue with a detailed explanation here: https://youtrack.jetbrains.com/issue/IDEA-237113 and https://youtrack.jetbrains.com/issue/IDEA-246822
|
||||
|
||||
:hammer_and_wrench: As of now, the workaround is to re-install the plugin in the IDE settings.
|
||||
---
|
||||
|
||||
36th version of plugin released.
|
||||
|
||||
Install it automatically from IntelliJ Idea plugin repository.
|
||||
|
||||
Tested and supports IntelliJ versions: 2017.X, 2018.X, 2019.X, 2020.1 and 2020.2.1+, 2020.3 EAP
|
||||
|
||||
Last support for IntelliJ 2016.2 and 2016.3 by plugin version 0.31!
|
||||
|
||||
Last support for IntelliJ 15.0.6 and 2016.1 by plugin version 0.19!
|
||||
|
||||
Last support for IntelliJ 14.1.7 by plugin version 0.14!
|
||||
|
||||
Last support for IntelliJ 11.1.5, 12.1.7, 13.1.6 by plugin version 0.11
|
||||
|
||||
Last support for IntelliJ 10.5.4 by plugin version 0.8.7
|
||||
|
||||
With this plugin your IntelliJ can recognize all of generated getters, setters and some other things from lombok project, so that you get code completion and are able to work without errors stating the methods don't exists.
|
||||
|
||||
|
||||
Features / Supports
|
||||
--------
|
||||
### Features / Supports
|
||||
- [@Getter and @Setter](http://projectlombok.org/features/GetterSetter.html)
|
||||
- [@ToString](http://projectlombok.org/features/ToString.html)
|
||||
- [@EqualsAndHashCode](http://projectlombok.org/features/EqualsAndHashCode.html)
|
||||
@@ -64,6 +20,7 @@ Features / Supports
|
||||
- [@SneakyThrows](https://projectlombok.org/features/SneakyThrows.html)
|
||||
- [@val](https://projectlombok.org/features/val.html) available from IntelliJ 14.1 (improved in 2016.2)
|
||||
- [@UtilityClass](https://projectlombok.org/features/experimental/UtilityClass.html) available from IntelliJ 2016.2
|
||||
- [@ExtensionMethod](https://projectlombok.org/features/experimental/ExtensionMethod.html) experimental in IntelliJ 2019.2-2020.2, available from IntelliJ 2021
|
||||
- [lombok config files syntax highlighting](https://projectlombok.org/features/configuration.html)
|
||||
- code inspections
|
||||
- refactoring actions (lombok and delombok)
|
||||
@@ -71,77 +28,7 @@ Features / Supports
|
||||
|
||||
Many features of the plugin (including warnings) could be disabled through per-project settings.
|
||||
|
||||
Installation
|
||||
------------
|
||||
### Plugin Installation
|
||||
- Using IDE built-in plugin system on Windows:
|
||||
- <kbd>File</kbd> > <kbd>Settings</kbd> > <kbd>Plugins</kbd> > <kbd>Browse repositories...</kbd> > <kbd>Search for "lombok"</kbd> > <kbd>Install Plugin</kbd>
|
||||
- Using IDE built-in plugin system on MacOs:
|
||||
- <kbd>Preferences</kbd> > <kbd>Settings</kbd> > <kbd>Plugins</kbd> > <kbd>Browse repositories...</kbd> > <kbd>Search for "lombok"</kbd> > <kbd>Install Plugin</kbd>
|
||||
- Manually:
|
||||
- Download the [latest release](https://github.com/mplushnikov/lombok-intellij-plugin/releases/latest) and install it manually using <kbd>Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Install plugin from disk...</kbd>
|
||||
|
||||
Restart IDE.
|
||||
|
||||
### Required IntelliJ Configuration
|
||||
In your project: Click <kbd>Preferences</kbd> -> <kbd>Build, Execution, Deployment</kbd> -> <kbd>Compiler, Annotation Processors</kbd>. Click <kbd>Enable Annotation Processing</kbd>
|
||||
|
||||
Afterwards you might need to do a complete rebuild of your project via <kbd>Build</kbd> -> <kbd>Rebuild Project</kbd>.
|
||||
|
||||
### Lombok project dependency
|
||||
Make sure you have Lombok dependency added to your project. This plugin **does not** automatically add it for you.
|
||||
|
||||
**Please Note:** Using newest version of the Lombok dependency is recommended, but does not guarantee that all the features introduced will be available. See [Lombok changelog](https://projectlombok.org/changelog.html) for more details.
|
||||
|
||||
If you are using Gradle/Maven/Ivy, see example below:
|
||||
|
||||
##### Gradle
|
||||
In your `build.gradle`:
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.projectlombok:lombok:1.18.12'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.12'
|
||||
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.12'
|
||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
|
||||
}
|
||||
```
|
||||
|
||||
##### Maven
|
||||
In your `pom.xml`:
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
##### Ivy
|
||||
In your `ivy.xml`:
|
||||
```xml
|
||||
<dependency org="org.projectlombok" name="lombok" rev="1.18.12" conf="build" />
|
||||
```
|
||||
|
||||
IntelliJ and Eclipse compiler
|
||||
-----------------------------
|
||||
If you're using Eclipse compiler with lombok, try this setup:
|
||||
- install plugin
|
||||
- make sure Lombok dependency is added to the project
|
||||
- change compiler setting:
|
||||
- <kbd>...</kbd> > <kbd>Compiler</kbd> > <kbd>Java Compiler</kbd> > <kbd>Use Compiler: Eclipse</kbd>
|
||||
- <kbd>...</kbd> > <kbd>Compiler</kbd> > <kbd>Annotation Processors</kbd> > <kbd>Enable annotation processing: checked (default configuration)</kbd>
|
||||
- <kbd>...</kbd> > <kbd>Compiler</kbd> > <kbd>Additional build process VM options: -javaagent:lombok.jar</kbd>
|
||||
|
||||
Developed By
|
||||
------------
|
||||
### Developed by
|
||||
[**@mplushnikov** Michail Plushnikov](https://github.com/mplushnikov)
|
||||
|
||||
**Contributors**
|
||||
@@ -151,6 +38,7 @@ Developed By
|
||||
- [**@AlexejK** Alexej Kubarev](https://github.com/AlexejK)
|
||||
- [**@bulgakovalexander** Alexander Bulgakov](https://github.com/bulgakovalexander)
|
||||
- [**@GingerGeek** Zed Spencer-Milnes](https://github.com/GingerGeek)
|
||||
- [**@iProdigy** Sidd](https://github.com/iProdigy)
|
||||
- [**@jeromewaibel** Jérôme Waibel](https://github.com/jeromewaibel)
|
||||
- [**@Jessevanbekkum** Jesse van Bekkum](https://github.com/Jessevanbekkum)
|
||||
- [**@juriad** Adam Juraszek](https://github.com/juriad)
|
||||
@@ -175,24 +63,3 @@ Developed By
|
||||
- [**@wyhasany** Michał Rowicki](https://github.com/wyhasany)
|
||||
- [**@ocadaruma** Haruki Okada](https://github.com/ocadaruma)
|
||||
- [**@mackatozis** Alexandros Efthymiadis](https://github.com/mackatozis)
|
||||
|
||||
Supporters
|
||||
--------
|
||||
[<img src="https://www.yourkit.com/images/yklogo.png" />](https://www.yourkit.com/)
|
||||
|
||||
YourKit supports open source projects with its full-featured Java Profiler.
|
||||
YourKit, LLC is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp) and [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/index.jsp), innovative and intelligent tools for profiling Java and .NET applications.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
Copyright (c) 2011-2020 Michail Plushnikov. See the [LICENSE](./LICENSE) file for license rights and limitations (Apache 2.0).
|
||||
|
||||
[badge-gitter-img]: https://badges.gitter.im/mplushnikov/lombok-intellij-plugin.svg
|
||||
[badge-gitter]: https://gitter.im/mplushnikov/lombok-intellij-plugin
|
||||
[badge-travis-img]: https://travis-ci.org/mplushnikov/lombok-intellij-plugin.svg
|
||||
[badge-travis]: https://travis-ci.org/mplushnikov/lombok-intellij-plugin
|
||||
[badge-coveralls-img]: https://coveralls.io/repos/github/mplushnikov/lombok-intellij-plugin/badge.svg?branch=master
|
||||
[badge-coveralls]: https://coveralls.io/github/mplushnikov/lombok-intellij-plugin?branch=master
|
||||
[badge-paypal-img]: https://img.shields.io/badge/donate-paypal-yellow.svg
|
||||
[badge-paypal]: https://www.paypal.me/mplushnikov
|
||||
|
||||
@@ -99,6 +99,7 @@ public class WitherFieldProcessor extends AbstractFieldProcessor {
|
||||
final String psiFieldName = psiField.getName();
|
||||
if (fieldContainingClass != null) {
|
||||
final Collection<PsiMethod> classMethods = PsiClassUtil.collectClassMethodsIntern(fieldContainingClass);
|
||||
filterToleratedElements(classMethods);
|
||||
|
||||
final AccessorsInfo accessorsInfo = buildAccessorsInfo(psiField);
|
||||
final Collection<String> possibleWitherNames = LombokUtils.toAllWitherNames(accessorsInfo, psiFieldName, PsiType.BOOLEAN.equals(psiField.getType()));
|
||||
|
||||
@@ -2,14 +2,16 @@ package de.plushnikov.intellij.plugin.processor;
|
||||
|
||||
import de.plushnikov.intellij.plugin.AbstractLombokParsingTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Unit tests for IntelliJPlugin for Lombok, based on lombok test classes
|
||||
*/
|
||||
public class TolerateTest extends AbstractLombokParsingTestCase {
|
||||
|
||||
public void testTolerateTest() throws IOException {
|
||||
doTest();
|
||||
public void testTolerate$TolerateTest() {
|
||||
doTest(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void testTolerate$WitherTolerateTest() {
|
||||
doTest(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
public class WitherTolerateTest {
|
||||
private final Integer score;
|
||||
|
||||
public WitherTolerateTest withScore(String score) {
|
||||
return withScore(Integer.parseInt(score));
|
||||
}
|
||||
|
||||
public WitherTolerateTest(Integer score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public WitherTolerateTest withScore(Integer score) {
|
||||
return this.score == score ? this : new WitherTolerateTest(score);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.With;
|
||||
import lombok.experimental.Tolerate;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class WitherTolerateTest {
|
||||
@With
|
||||
private final Integer score;
|
||||
|
||||
@Tolerate
|
||||
public WitherTolerateTest withScore(String score) {
|
||||
return withScore(Integer.parseInt(score));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user