mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[lombok] IDEA-327463 added support for lombok.addNullAnnotations config option
GitOrigin-RevId: b69269c4c45e258ba5b624a4bfea24089a834648
This commit is contained in:
committed by
intellij-monorepo-bot
parent
05dbd4575d
commit
247cef0f82
@@ -1,4 +1,5 @@
|
|||||||
/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */
|
// Generated by JFlex 1.9.1 http://jflex.de/ (tweaked for IntelliJ platform)
|
||||||
|
// source: lombokConfig.flex
|
||||||
|
|
||||||
package de.plushnikov.intellij.plugin.language;
|
package de.plushnikov.intellij.plugin.language;
|
||||||
|
|
||||||
@@ -9,11 +10,6 @@ import com.intellij.psi.TokenType;
|
|||||||
import de.plushnikov.intellij.plugin.language.psi.LombokConfigTypes;
|
import de.plushnikov.intellij.plugin.language.psi.LombokConfigTypes;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is a scanner generated by
|
|
||||||
* <a href="http://www.jflex.de/">JFlex</a> 1.7.0
|
|
||||||
* from the specification file <tt>lombokConfig.flex</tt>
|
|
||||||
*/
|
|
||||||
class LombokConfigLexer implements FlexLexer {
|
class LombokConfigLexer implements FlexLexer {
|
||||||
|
|
||||||
/** This character denotes the end of file */
|
/** This character denotes the end of file */
|
||||||
@@ -33,141 +29,257 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
* at the beginning of a line
|
* at the beginning of a line
|
||||||
* l is of the form l = 2*k, k a non negative integer
|
* l is of the form l = 2*k, k a non negative integer
|
||||||
*/
|
*/
|
||||||
private static final int ZZ_LEXSTATE[] = {
|
private static final int ZZ_LEXSTATE[] = {
|
||||||
0, 0, 1, 1, 2, 2
|
0, 0, 1, 1, 2, 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates characters to character classes
|
* Top-level table for translating characters to character classes
|
||||||
* Chosen bits are [11, 6, 4]
|
|
||||||
* Total runtime size is 14016 bytes
|
|
||||||
*/
|
*/
|
||||||
public static int ZZ_CMAP(int ch) {
|
private static final int [] ZZ_CMAP_TOP = zzUnpackcmap_top();
|
||||||
return ZZ_CMAP_A[(ZZ_CMAP_Y[(ZZ_CMAP_Z[ch>>10]<<6)|((ch>>4)&0x3f)]<<4)|(ch&0xf)];
|
|
||||||
|
private static final String ZZ_CMAP_TOP_PACKED_0 =
|
||||||
|
"\1\0\1\u0100\1\u0200\1\u0300\1\u0400\1\u0500\1\u0600\1\u0700"+
|
||||||
|
"\1\u0800\1\u0900\1\u0a00\1\u0b00\1\u0c00\1\u0d00\1\u0e00\1\u0f00"+
|
||||||
|
"\1\u1000\1\u0100\1\u1100\1\u1200\1\u1300\1\u0100\1\u1400\1\u1500"+
|
||||||
|
"\1\u1600\1\u1700\1\u1800\1\u1900\1\u1a00\1\u1b00\1\u0100\1\u1c00"+
|
||||||
|
"\1\u1d00\1\u1e00\12\u1f00\1\u2000\1\u2100\1\u2200\1\u1f00\1\u2300"+
|
||||||
|
"\1\u2400\2\u1f00\31\u0100\1\u2500\121\u0100\1\u2600\4\u0100\1\u2700"+
|
||||||
|
"\1\u0100\1\u2800\1\u2900\1\u2a00\1\u2b00\1\u2c00\1\u2d00\53\u0100"+
|
||||||
|
"\1\u2e00\10\u2f00\31\u1f00\1\u0100\1\u3000\1\u3100\1\u0100\1\u3200"+
|
||||||
|
"\1\u3300\1\u3400\1\u3500\1\u1f00\1\u3600\1\u3700\1\u3800\1\u3900"+
|
||||||
|
"\1\u0100\1\u3a00\1\u3b00\1\u3c00\1\u3d00\1\u3e00\1\u3f00\1\u4000"+
|
||||||
|
"\1\u1f00\1\u4100\1\u4200\1\u4300\1\u4400\1\u4500\1\u4600\1\u4700"+
|
||||||
|
"\1\u4800\1\u4900\1\u4a00\1\u4b00\1\u4c00\1\u1f00\1\u4d00\1\u4e00"+
|
||||||
|
"\1\u4f00\1\u1f00\3\u0100\1\u5000\1\u5100\1\u5200\12\u1f00\4\u0100"+
|
||||||
|
"\1\u5300\17\u1f00\2\u0100\1\u5400\41\u1f00\2\u0100\1\u5500\1\u5600"+
|
||||||
|
"\2\u1f00\1\u5700\1\u5800\27\u0100\1\u5900\2\u0100\1\u5a00\45\u1f00"+
|
||||||
|
"\1\u0100\1\u5b00\1\u5c00\11\u1f00\1\u5d00\27\u1f00\1\u5e00\1\u5f00"+
|
||||||
|
"\1\u6000\1\u6100\11\u1f00\1\u6200\1\u6300\5\u1f00\1\u6400\1\u6500"+
|
||||||
|
"\4\u1f00\1\u6600\21\u1f00\246\u0100\1\u6700\20\u0100\1\u6800\1\u6900"+
|
||||||
|
"\25\u0100\1\u6a00\34\u0100\1\u6b00\14\u1f00\2\u0100\1\u6c00\u0e05\u1f00";
|
||||||
|
|
||||||
|
private static int [] zzUnpackcmap_top() {
|
||||||
|
int [] result = new int[4352];
|
||||||
|
int offset = 0;
|
||||||
|
offset = zzUnpackcmap_top(ZZ_CMAP_TOP_PACKED_0, offset, result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The ZZ_CMAP_Z table has 1088 entries */
|
private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
|
||||||
static final char ZZ_CMAP_Z[] = zzUnpackCMap(
|
int i = 0; /* index in packed string */
|
||||||
"\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\2\11\1\12\1\13\6\14\1\15\23\14\1\16"+
|
int j = offset; /* index in unpacked array */
|
||||||
"\1\14\1\17\1\20\12\14\1\21\10\11\1\22\1\23\1\24\1\25\1\26\1\27\1\30\1\31\1"+
|
int l = packed.length();
|
||||||
"\32\1\33\1\34\1\35\2\11\1\14\1\36\3\11\1\37\10\11\1\40\1\41\5\14\1\42\1\43"+
|
while (i < l) {
|
||||||
"\11\11\1\44\2\11\1\45\5\11\1\46\4\11\1\47\1\50\4\11\51\14\1\51\3\14\1\52\1"+
|
int count = packed.charAt(i++);
|
||||||
"\53\4\14\1\54\12\11\1\55\u0381\11");
|
int value = packed.charAt(i++);
|
||||||
|
do result[j++] = value; while (--count > 0);
|
||||||
|
}
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
/* The ZZ_CMAP_Y table has 2944 entries */
|
|
||||||
static final char ZZ_CMAP_Y[] = zzUnpackCMap(
|
|
||||||
"\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\1\1\11\1\12\1\13\1\14\1\13\1\14\34"+
|
|
||||||
"\13\1\15\1\16\1\17\10\1\1\20\1\21\1\13\1\22\4\13\1\23\10\13\1\24\12\13\1\4"+
|
|
||||||
"\1\13\1\25\1\4\1\13\1\26\4\1\1\13\1\27\1\30\2\1\2\13\1\27\1\1\1\31\1\4\5\13"+
|
|
||||||
"\1\32\1\33\1\34\1\1\1\35\1\13\1\1\1\36\5\13\1\37\1\40\2\13\1\27\1\41\1\13"+
|
|
||||||
"\1\42\1\43\1\1\1\13\1\44\4\1\1\13\1\45\4\1\1\46\2\13\1\47\1\1\1\50\1\15\1"+
|
|
||||||
"\4\1\51\1\52\1\53\1\54\1\55\1\56\1\15\1\16\1\57\1\52\1\53\1\60\1\1\1\61\1"+
|
|
||||||
"\62\1\63\1\64\1\22\1\53\1\65\1\1\1\66\1\15\1\67\1\70\1\52\1\53\1\65\1\1\1"+
|
|
||||||
"\56\1\15\1\40\1\71\1\72\1\73\1\74\1\1\1\66\1\62\1\1\1\75\1\35\1\53\1\47\1"+
|
|
||||||
"\1\1\76\1\15\1\1\1\77\1\35\1\53\1\100\1\1\1\55\1\15\1\101\1\75\1\35\1\13\1"+
|
|
||||||
"\102\1\55\1\103\1\15\1\104\1\105\1\106\1\13\1\107\1\110\1\1\1\62\1\1\1\4\2"+
|
|
||||||
"\13\1\111\1\110\1\74\2\1\1\112\1\113\1\114\1\115\1\116\1\117\2\1\1\66\1\1"+
|
|
||||||
"\1\74\1\1\1\120\1\13\1\121\1\1\1\122\7\1\2\13\1\27\1\123\1\74\1\124\1\125"+
|
|
||||||
"\1\126\1\127\1\74\2\13\1\130\2\13\1\131\24\13\1\132\1\133\2\13\1\132\2\13"+
|
|
||||||
"\1\134\1\135\1\14\3\13\1\135\3\13\1\27\2\1\1\13\1\1\5\13\1\136\1\4\45\13\1"+
|
|
||||||
"\34\1\13\1\4\1\27\4\13\1\27\1\137\1\140\1\16\1\13\1\16\1\13\1\16\1\140\1\66"+
|
|
||||||
"\3\13\1\141\1\1\1\142\1\74\2\1\1\74\5\13\1\26\1\143\1\13\1\144\4\13\1\37\1"+
|
|
||||||
"\13\1\145\2\1\1\62\1\13\1\146\1\147\2\13\1\150\1\13\2\74\2\1\1\13\1\110\3"+
|
|
||||||
"\13\1\147\2\1\2\74\1\151\5\1\1\105\2\13\1\141\1\152\1\74\2\1\1\153\1\13\1"+
|
|
||||||
"\154\3\13\1\37\1\1\2\13\1\141\1\1\1\155\2\13\1\146\1\44\5\1\1\156\1\157\14"+
|
|
||||||
"\13\4\1\21\13\1\136\2\13\1\136\1\160\1\13\1\146\3\13\1\161\1\162\1\163\1\121"+
|
|
||||||
"\1\162\2\1\1\164\4\1\1\165\1\1\1\121\6\1\1\166\1\167\1\170\1\117\1\171\3\1"+
|
|
||||||
"\1\172\147\1\2\13\1\145\2\13\1\145\10\13\1\173\1\174\2\13\1\130\3\13\1\175"+
|
|
||||||
"\1\1\1\13\1\110\4\176\4\1\1\123\35\1\1\177\2\1\1\200\1\4\4\13\1\201\1\4\4"+
|
|
||||||
"\13\1\131\1\105\1\13\1\146\1\4\4\13\1\145\1\1\1\13\1\27\3\1\1\13\40\1\133"+
|
|
||||||
"\13\1\37\4\1\135\13\1\37\2\1\10\13\1\121\4\1\2\13\1\146\20\13\1\121\1\13\1"+
|
|
||||||
"\150\1\1\2\13\1\145\1\123\1\13\1\146\4\13\1\37\2\1\1\202\1\203\5\13\1\204"+
|
|
||||||
"\1\13\1\145\1\26\3\1\1\202\1\205\1\13\1\30\1\1\3\13\1\141\1\203\2\13\1\141"+
|
|
||||||
"\1\1\1\74\1\1\1\206\2\13\1\37\1\13\1\110\1\1\1\13\1\121\1\46\2\13\1\30\1\123"+
|
|
||||||
"\1\74\1\207\1\145\2\13\1\44\1\1\1\210\1\74\1\13\1\211\3\13\1\212\1\213\1\214"+
|
|
||||||
"\1\27\1\63\1\215\1\216\1\176\2\13\1\131\1\37\7\13\1\30\1\74\72\13\1\141\1"+
|
|
||||||
"\13\1\217\2\13\1\150\20\1\26\13\1\146\6\13\1\74\2\1\1\110\1\220\1\53\1\221"+
|
|
||||||
"\1\222\6\13\1\16\1\1\1\153\25\13\1\146\1\1\4\13\1\203\2\13\1\26\2\1\1\150"+
|
|
||||||
"\7\1\1\207\7\13\1\121\1\1\1\74\1\4\1\27\1\4\1\27\1\62\4\13\1\145\1\223\1\224"+
|
|
||||||
"\2\1\1\225\1\13\1\14\1\226\2\146\2\1\7\13\1\27\30\1\1\13\1\121\3\13\1\66\2"+
|
|
||||||
"\1\2\13\1\1\1\13\1\227\2\13\1\37\1\13\1\146\2\13\1\230\3\1\11\13\1\146\1\74"+
|
|
||||||
"\2\13\1\230\1\13\1\150\2\13\1\26\3\13\1\141\11\1\23\13\1\110\1\13\1\37\1\26"+
|
|
||||||
"\11\1\1\231\2\13\1\232\1\13\1\37\1\13\1\110\1\13\1\145\4\1\1\13\1\233\1\13"+
|
|
||||||
"\1\37\1\13\1\74\4\1\3\13\1\234\4\1\1\66\1\235\1\13\1\141\2\1\1\13\1\121\1"+
|
|
||||||
"\13\1\121\2\1\1\120\1\13\1\147\1\1\3\13\1\37\1\13\1\37\1\13\1\30\1\13\1\16"+
|
|
||||||
"\6\1\4\13\1\44\3\1\3\13\1\30\3\13\1\30\60\1\1\153\2\13\1\26\2\1\1\62\1\1\1"+
|
|
||||||
"\153\2\13\2\1\1\13\1\44\1\74\1\153\1\13\1\110\1\62\1\1\2\13\1\236\1\153\2"+
|
|
||||||
"\13\1\30\1\237\1\240\2\1\1\13\1\22\1\150\5\1\1\241\1\242\1\44\2\13\1\145\1"+
|
|
||||||
"\1\1\74\1\70\1\52\1\53\1\65\1\1\1\243\1\16\11\1\3\13\1\147\1\244\1\74\2\1"+
|
|
||||||
"\3\13\1\1\1\245\1\74\12\1\2\13\1\145\2\1\1\246\2\1\3\13\1\1\1\247\1\74\2\1"+
|
|
||||||
"\2\13\1\27\1\1\1\74\3\1\1\13\1\74\1\1\1\74\26\1\4\13\1\74\1\123\34\1\3\13"+
|
|
||||||
"\1\44\20\1\1\53\1\13\1\145\1\1\1\66\1\74\1\1\1\203\1\13\67\1\71\13\1\74\16"+
|
|
||||||
"\1\14\13\1\141\53\1\2\13\1\145\75\1\44\13\1\110\33\1\43\13\1\44\1\13\1\145"+
|
|
||||||
"\1\74\6\1\1\13\1\146\1\1\3\13\1\1\1\141\1\74\1\153\1\250\1\13\67\1\4\13\1"+
|
|
||||||
"\147\1\66\3\1\1\153\4\1\1\66\1\1\76\13\1\121\1\1\57\13\1\30\20\1\1\16\77\1"+
|
|
||||||
"\6\13\1\27\1\121\1\44\1\74\66\1\5\13\1\207\3\13\1\140\1\251\1\252\1\253\3"+
|
|
||||||
"\13\1\254\1\255\1\13\1\256\1\257\1\35\24\13\1\260\1\13\1\35\1\131\1\13\1\131"+
|
|
||||||
"\1\13\1\207\1\13\1\207\1\145\1\13\1\145\1\13\1\53\1\13\1\53\1\13\1\261\17"+
|
|
||||||
"\13\1\147\3\1\4\13\1\141\1\74\112\1\1\253\1\13\1\262\1\263\1\264\1\265\1\266"+
|
|
||||||
"\1\267\1\270\1\150\1\271\1\150\24\1\55\13\1\110\2\1\103\13\1\147\15\13\1\146"+
|
|
||||||
"\150\13\1\16\25\1\41\13\1\146\36\1");
|
|
||||||
|
|
||||||
/* The ZZ_CMAP_A table has 2976 entries */
|
/**
|
||||||
static final char ZZ_CMAP_A[] = zzUnpackCMap(
|
* Second-level tables for translating characters to character classes
|
||||||
"\11\0\1\13\1\1\1\20\1\3\1\2\22\0\1\13\2\0\1\4\7\0\1\15\1\0\1\15\1\12\1\0\12"+
|
*/
|
||||||
"\12\1\16\2\0\1\14\3\0\32\12\1\0\1\17\4\0\1\10\1\12\1\5\1\12\1\7\6\12\1\6\5"+
|
private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
|
||||||
"\12\1\11\10\12\12\0\1\20\24\0\1\12\12\0\1\12\4\0\1\12\5\0\27\12\1\0\12\12"+
|
|
||||||
"\4\0\14\12\16\0\5\12\7\0\1\12\1\0\1\12\1\0\5\12\1\0\2\12\2\0\4\12\1\0\1\12"+
|
|
||||||
"\6\0\1\12\1\0\3\12\1\0\1\12\1\0\4\12\1\0\23\12\1\0\13\12\10\0\15\12\2\0\1"+
|
|
||||||
"\12\6\0\10\12\10\0\13\12\5\0\3\12\15\0\12\12\4\0\6\12\1\0\1\12\17\0\2\12\7"+
|
|
||||||
"\0\17\12\2\0\2\12\1\0\16\12\15\0\11\12\13\0\1\12\22\0\2\12\4\0\1\12\5\0\6"+
|
|
||||||
"\12\4\0\1\12\11\0\1\12\3\0\1\12\7\0\11\12\7\0\5\12\1\0\10\12\6\0\26\12\3\0"+
|
|
||||||
"\1\12\2\0\1\12\7\0\11\12\4\0\10\12\2\0\2\12\2\0\26\12\1\0\7\12\1\0\1\12\3"+
|
|
||||||
"\0\4\12\3\0\1\12\20\0\1\12\15\0\2\12\1\0\1\12\5\0\6\12\4\0\2\12\1\0\2\12\1"+
|
|
||||||
"\0\2\12\1\0\2\12\17\0\4\12\1\0\1\12\7\0\12\12\2\0\3\12\20\0\11\12\1\0\2\12"+
|
|
||||||
"\1\0\2\12\1\0\5\12\3\0\1\12\2\0\1\12\30\0\1\12\13\0\10\12\2\0\1\12\3\0\1\12"+
|
|
||||||
"\1\0\6\12\3\0\3\12\1\0\4\12\3\0\2\12\1\0\1\12\1\0\2\12\3\0\2\12\3\0\3\12\3"+
|
|
||||||
"\0\14\12\13\0\10\12\1\0\2\12\10\0\3\12\5\0\1\12\4\0\10\12\1\0\6\12\1\0\5\12"+
|
|
||||||
"\3\0\1\12\3\0\2\12\15\0\13\12\2\0\1\12\6\0\3\12\10\0\1\12\12\0\6\12\5\0\22"+
|
|
||||||
"\12\3\0\10\12\1\0\11\12\1\0\1\12\2\0\7\12\11\0\1\12\1\0\2\12\15\0\2\12\1\0"+
|
|
||||||
"\1\12\2\0\2\12\1\0\1\12\2\0\1\12\6\0\4\12\1\0\7\12\1\0\3\12\1\0\1\12\1\0\1"+
|
|
||||||
"\12\2\0\2\12\1\0\4\12\1\0\2\12\11\0\1\12\2\0\5\12\1\0\1\12\11\0\12\12\2\0"+
|
|
||||||
"\14\12\1\0\24\12\13\0\5\12\22\0\7\12\4\0\4\12\3\0\1\12\3\0\2\12\7\0\3\12\4"+
|
|
||||||
"\0\15\12\14\0\1\12\1\0\6\12\1\0\1\12\5\0\1\12\2\0\13\12\1\0\15\12\1\0\4\12"+
|
|
||||||
"\2\0\7\12\1\0\1\12\1\0\4\12\2\0\1\12\1\0\4\12\2\0\7\12\1\0\1\12\1\0\4\12\2"+
|
|
||||||
"\0\16\12\2\0\6\12\3\0\10\12\7\0\15\12\1\0\6\12\23\0\1\12\4\0\1\12\3\0\5\12"+
|
|
||||||
"\2\0\22\12\1\0\1\12\5\0\17\12\1\0\16\12\2\0\5\12\13\0\14\12\13\0\1\12\15\0"+
|
|
||||||
"\7\12\7\0\16\12\15\0\14\12\3\0\3\12\11\0\4\12\1\0\4\12\3\0\2\12\11\0\10\12"+
|
|
||||||
"\1\0\1\12\1\0\1\12\1\0\1\12\1\0\6\12\1\0\7\12\1\0\1\12\3\0\3\12\1\0\7\12\3"+
|
|
||||||
"\0\4\12\2\0\6\12\14\0\2\20\7\0\1\12\15\0\1\12\2\0\1\12\4\0\1\12\2\0\12\12"+
|
|
||||||
"\1\0\1\12\3\0\5\12\6\0\1\12\1\0\1\12\1\0\1\12\1\0\4\12\1\0\1\12\5\0\5\12\4"+
|
|
||||||
"\0\1\12\4\0\2\12\13\0\5\12\6\0\4\12\3\0\2\12\14\0\10\12\7\0\10\12\1\0\7\12"+
|
|
||||||
"\6\0\2\12\12\0\5\12\5\0\2\12\3\0\7\12\6\0\3\12\7\0\11\12\2\0\27\12\2\0\7\12"+
|
|
||||||
"\1\0\3\12\1\0\4\12\1\0\4\12\2\0\6\12\3\0\1\12\1\0\1\12\2\0\5\12\1\0\15\12"+
|
|
||||||
"\1\0\10\12\4\0\7\12\3\0\1\12\3\0\2\12\1\0\1\12\3\0\2\12\2\0\5\12\2\0\1\12"+
|
|
||||||
"\1\0\1\12\30\0\3\12\3\0\6\12\2\0\6\12\2\0\6\12\11\0\7\12\4\0\5\12\3\0\5\12"+
|
|
||||||
"\5\0\1\12\1\0\10\12\1\0\5\12\1\0\1\12\1\0\2\12\1\0\2\12\1\0\12\12\2\0\6\12"+
|
|
||||||
"\2\0\6\12\2\0\6\12\2\0\3\12\3\0\14\12\1\0\16\12\1\0\2\12\1\0\2\12\1\0\10\12"+
|
|
||||||
"\6\0\4\12\4\0\16\12\2\0\1\12\1\0\14\12\1\0\2\12\3\0\1\12\2\0\4\12\1\0\2\12"+
|
|
||||||
"\12\0\10\12\6\0\6\12\1\0\3\12\1\0\12\12\3\0\1\12\12\0\4\12\13\0\13\12\1\0"+
|
|
||||||
"\1\12\3\0\7\12\1\0\1\12\1\0\4\12\1\0\17\12\1\0\2\12\14\0\3\12\7\0\4\12\11"+
|
|
||||||
"\0\2\12\1\0\1\12\20\0\4\12\10\0\1\12\13\0\10\12\5\0\3\12\2\0\1\12\2\0\2\12"+
|
|
||||||
"\2\0\4\12\1\0\14\12\1\0\1\12\1\0\7\12\1\0\21\12\1\0\4\12\2\0\10\12\1\0\7\12"+
|
|
||||||
"\1\0\14\12\1\0\4\12\1\0\5\12\1\0\1\12\3\0\14\12\2\0\13\12\1\0\10\12\2\0\2"+
|
|
||||||
"\12\1\0\2\12\1\0\1\12\2\0\1\12\1\0\12\12\1\0\4\12\1\0\1\12\1\0\1\12\6\0\1"+
|
|
||||||
"\12\4\0\1\12\1\0\1\12\1\0\1\12\1\0\3\12\1\0\2\12\1\0\1\12\2\0\1\12\1\0\1\12"+
|
|
||||||
"\1\0\1\12\1\0\1\12\1\0\1\12\1\0\2\12\1\0\1\12\2\0\4\12\1\0\7\12\1\0\4\12\1"+
|
|
||||||
"\0\4\12\1\0\1\12\1\0\12\12\1\0\5\12\1\0\3\12\1\0\5\12\1\0\5\12");
|
|
||||||
|
|
||||||
/**
|
private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
|
||||||
|
"\11\0\1\1\1\2\1\3\1\4\1\5\22\0\1\1"+
|
||||||
|
"\2\0\1\6\7\0\1\7\1\0\1\7\1\10\1\0"+
|
||||||
|
"\12\10\3\0\1\11\3\0\32\10\1\0\1\12\4\0"+
|
||||||
|
"\1\13\1\10\1\14\1\10\1\15\6\10\1\16\5\10"+
|
||||||
|
"\1\17\10\10\12\0\1\3\44\0\1\10\12\0\1\10"+
|
||||||
|
"\4\0\1\10\5\0\27\10\1\0\37\10\1\0\u01ca\10"+
|
||||||
|
"\4\0\14\10\16\0\5\10\7\0\1\10\1\0\1\10"+
|
||||||
|
"\201\0\5\10\1\0\2\10\2\0\4\10\1\0\1\10"+
|
||||||
|
"\6\0\1\10\1\0\3\10\1\0\1\10\1\0\24\10"+
|
||||||
|
"\1\0\123\10\1\0\213\10\10\0\246\10\1\0\46\10"+
|
||||||
|
"\2\0\1\10\6\0\51\10\107\0\33\10\4\0\4\10"+
|
||||||
|
"\55\0\53\10\25\0\12\10\4\0\2\10\1\0\143\10"+
|
||||||
|
"\1\0\1\10\17\0\2\10\7\0\17\10\2\0\1\10"+
|
||||||
|
"\20\0\1\10\1\0\36\10\35\0\131\10\13\0\1\10"+
|
||||||
|
"\16\0\53\10\11\0\2\10\4\0\1\10\5\0\26\10"+
|
||||||
|
"\4\0\1\10\11\0\1\10\3\0\1\10\27\0\31\10"+
|
||||||
|
"\7\0\13\10\65\0\25\10\1\0\10\10\106\0\66\10"+
|
||||||
|
"\3\0\1\10\22\0\1\10\7\0\12\10\4\0\12\10"+
|
||||||
|
"\1\0\20\10\4\0\10\10\2\0\2\10\2\0\26\10"+
|
||||||
|
"\1\0\7\10\1\0\1\10\3\0\4\10\3\0\1\10"+
|
||||||
|
"\20\0\1\10\15\0\2\10\1\0\3\10\4\0\14\10"+
|
||||||
|
"\12\0\1\10\10\0\6\10\4\0\2\10\2\0\26\10"+
|
||||||
|
"\1\0\7\10\1\0\2\10\1\0\2\10\1\0\2\10"+
|
||||||
|
"\37\0\4\10\1\0\1\10\7\0\12\10\2\0\3\10"+
|
||||||
|
"\20\0\11\10\1\0\3\10\1\0\26\10\1\0\7\10"+
|
||||||
|
"\1\0\2\10\1\0\5\10\3\0\1\10\22\0\1\10"+
|
||||||
|
"\17\0\2\10\4\0\12\10\11\0\1\10\13\0\10\10"+
|
||||||
|
"\2\0\2\10\2\0\26\10\1\0\7\10\1\0\2\10"+
|
||||||
|
"\1\0\5\10\3\0\1\10\36\0\2\10\1\0\3\10"+
|
||||||
|
"\4\0\12\10\1\0\1\10\21\0\1\10\1\0\6\10"+
|
||||||
|
"\3\0\3\10\1\0\4\10\3\0\2\10\1\0\1\10"+
|
||||||
|
"\1\0\2\10\3\0\2\10\3\0\3\10\3\0\14\10"+
|
||||||
|
"\26\0\1\10\25\0\12\10\25\0\10\10\1\0\3\10"+
|
||||||
|
"\1\0\27\10\1\0\20\10\3\0\1\10\32\0\3\10"+
|
||||||
|
"\5\0\2\10\4\0\12\10\20\0\1\10\4\0\10\10"+
|
||||||
|
"\1\0\3\10\1\0\27\10\1\0\12\10\1\0\5\10"+
|
||||||
|
"\3\0\1\10\40\0\1\10\1\0\2\10\4\0\12\10"+
|
||||||
|
"\1\0\2\10\22\0\10\10\1\0\3\10\1\0\51\10"+
|
||||||
|
"\2\0\1\10\20\0\1\10\5\0\3\10\10\0\3\10"+
|
||||||
|
"\4\0\12\10\12\0\6\10\5\0\22\10\3\0\30\10"+
|
||||||
|
"\1\0\11\10\1\0\1\10\2\0\7\10\37\0\12\10"+
|
||||||
|
"\21\0\60\10\1\0\2\10\14\0\7\10\11\0\12\10"+
|
||||||
|
"\47\0\2\10\1\0\1\10\1\0\5\10\1\0\30\10"+
|
||||||
|
"\1\0\1\10\1\0\12\10\1\0\2\10\11\0\1\10"+
|
||||||
|
"\2\0\5\10\1\0\1\10\11\0\12\10\2\0\4\10"+
|
||||||
|
"\40\0\1\10\37\0\12\10\26\0\10\10\1\0\44\10"+
|
||||||
|
"\33\0\5\10\163\0\53\10\24\0\13\10\6\0\6\10"+
|
||||||
|
"\4\0\4\10\3\0\1\10\3\0\2\10\7\0\3\10"+
|
||||||
|
"\4\0\15\10\14\0\1\10\1\0\12\10\6\0\46\10"+
|
||||||
|
"\1\0\1\10\5\0\1\10\2\0\53\10\1\0\115\10"+
|
||||||
|
"\1\0\4\10\2\0\7\10\1\0\1\10\1\0\4\10"+
|
||||||
|
"\2\0\51\10\1\0\4\10\2\0\41\10\1\0\4\10"+
|
||||||
|
"\2\0\7\10\1\0\1\10\1\0\4\10\2\0\17\10"+
|
||||||
|
"\1\0\71\10\1\0\4\10\2\0\103\10\45\0\20\10"+
|
||||||
|
"\20\0\126\10\2\0\6\10\3\0\u016c\10\2\0\21\10"+
|
||||||
|
"\1\0\32\10\5\0\113\10\6\0\10\10\7\0\15\10"+
|
||||||
|
"\1\0\4\10\16\0\22\10\16\0\22\10\16\0\15\10"+
|
||||||
|
"\1\0\3\10\17\0\64\10\43\0\1\10\4\0\1\10"+
|
||||||
|
"\3\0\12\10\46\0\12\10\6\0\131\10\7\0\5\10"+
|
||||||
|
"\2\0\42\10\1\0\1\10\5\0\106\10\12\0\37\10"+
|
||||||
|
"\47\0\50\10\2\0\5\10\13\0\54\10\4\0\32\10"+
|
||||||
|
"\6\0\12\10\46\0\27\10\11\0\65\10\53\0\12\10"+
|
||||||
|
"\6\0\12\10\15\0\1\10\135\0\57\10\21\0\7\10"+
|
||||||
|
"\4\0\12\10\51\0\36\10\15\0\70\10\32\0\44\10"+
|
||||||
|
"\34\0\12\10\3\0\61\10\2\0\11\10\7\0\53\10"+
|
||||||
|
"\2\0\3\10\51\0\4\10\1\0\6\10\1\0\2\10"+
|
||||||
|
"\3\0\1\10\5\0\300\10\100\0\26\10\2\0\6\10"+
|
||||||
|
"\2\0\46\10\2\0\6\10\2\0\10\10\1\0\1\10"+
|
||||||
|
"\1\0\1\10\1\0\1\10\1\0\37\10\2\0\65\10"+
|
||||||
|
"\1\0\7\10\1\0\1\10\3\0\3\10\1\0\7\10"+
|
||||||
|
"\3\0\4\10\2\0\6\10\4\0\15\10\5\0\3\10"+
|
||||||
|
"\1\0\7\10\53\0\2\3\107\0\1\10\15\0\1\10"+
|
||||||
|
"\20\0\15\10\145\0\1\10\4\0\1\10\2\0\12\10"+
|
||||||
|
"\1\0\1\10\3\0\5\10\6\0\1\10\1\0\1\10"+
|
||||||
|
"\1\0\1\10\1\0\4\10\1\0\13\10\2\0\4\10"+
|
||||||
|
"\5\0\5\10\4\0\1\10\64\0\2\10\u017b\0\57\10"+
|
||||||
|
"\1\0\57\10\1\0\205\10\6\0\4\10\3\0\2\10"+
|
||||||
|
"\14\0\46\10\1\0\1\10\5\0\1\10\2\0\70\10"+
|
||||||
|
"\7\0\1\10\20\0\27\10\11\0\7\10\1\0\7\10"+
|
||||||
|
"\1\0\7\10\1\0\7\10\1\0\7\10\1\0\7\10"+
|
||||||
|
"\1\0\7\10\1\0\7\10\120\0\1\10\325\0\2\10"+
|
||||||
|
"\52\0\5\10\5\0\2\10\4\0\126\10\6\0\3\10"+
|
||||||
|
"\1\0\132\10\1\0\4\10\5\0\53\10\1\0\136\10"+
|
||||||
|
"\21\0\33\10\65\0\306\10\112\0\360\10\20\0\215\10"+
|
||||||
|
"\103\0\56\10\2\0\15\10\3\0\34\10\24\0\57\10"+
|
||||||
|
"\20\0\37\10\2\0\106\10\61\0\11\10\2\0\147\10"+
|
||||||
|
"\2\0\65\10\2\0\5\10\60\0\13\10\1\0\3\10"+
|
||||||
|
"\1\0\4\10\1\0\27\10\35\0\64\10\16\0\62\10"+
|
||||||
|
"\34\0\12\10\30\0\6\10\3\0\1\10\1\0\2\10"+
|
||||||
|
"\1\0\46\10\12\0\27\10\31\0\35\10\7\0\57\10"+
|
||||||
|
"\34\0\13\10\6\0\5\10\1\0\31\10\1\0\51\10"+
|
||||||
|
"\27\0\3\10\1\0\10\10\4\0\12\10\6\0\27\10"+
|
||||||
|
"\3\0\1\10\3\0\62\10\1\0\1\10\3\0\2\10"+
|
||||||
|
"\2\0\5\10\2\0\1\10\1\0\1\10\30\0\3\10"+
|
||||||
|
"\2\0\13\10\7\0\3\10\14\0\6\10\2\0\6\10"+
|
||||||
|
"\2\0\6\10\11\0\7\10\1\0\7\10\1\0\53\10"+
|
||||||
|
"\1\0\14\10\10\0\163\10\15\0\12\10\6\0\244\10"+
|
||||||
|
"\14\0\27\10\4\0\61\10\4\0\u0100\3\156\10\2\0"+
|
||||||
|
"\152\10\46\0\7\10\14\0\5\10\5\0\1\10\1\0"+
|
||||||
|
"\12\10\1\0\15\10\1\0\5\10\1\0\1\10\1\0"+
|
||||||
|
"\2\10\1\0\2\10\1\0\154\10\41\0\153\10\22\0"+
|
||||||
|
"\100\10\2\0\66\10\50\0\14\10\164\0\5\10\1\0"+
|
||||||
|
"\207\10\23\0\12\10\7\0\32\10\6\0\32\10\13\0"+
|
||||||
|
"\131\10\3\0\6\10\2\0\6\10\2\0\6\10\2\0"+
|
||||||
|
"\3\10\43\0\14\10\1\0\32\10\1\0\23\10\1\0"+
|
||||||
|
"\2\10\1\0\17\10\2\0\16\10\42\0\173\10\205\0"+
|
||||||
|
"\35\10\3\0\61\10\57\0\40\10\15\0\24\10\1\0"+
|
||||||
|
"\10\10\6\0\46\10\12\0\36\10\2\0\44\10\4\0"+
|
||||||
|
"\10\10\60\0\236\10\2\0\12\10\6\0\44\10\4\0"+
|
||||||
|
"\44\10\4\0\50\10\10\0\64\10\234\0\67\10\11\0"+
|
||||||
|
"\26\10\12\0\10\10\230\0\6\10\2\0\1\10\1\0"+
|
||||||
|
"\54\10\1\0\2\10\3\0\1\10\2\0\27\10\12\0"+
|
||||||
|
"\27\10\11\0\37\10\101\0\23\10\1\0\2\10\12\0"+
|
||||||
|
"\26\10\12\0\32\10\106\0\70\10\6\0\2\10\100\0"+
|
||||||
|
"\1\10\17\0\4\10\1\0\3\10\1\0\35\10\52\0"+
|
||||||
|
"\35\10\3\0\35\10\43\0\10\10\1\0\34\10\33\0"+
|
||||||
|
"\66\10\12\0\26\10\12\0\23\10\15\0\22\10\156\0"+
|
||||||
|
"\111\10\67\0\63\10\15\0\63\10\15\0\44\10\14\0"+
|
||||||
|
"\12\10\306\0\35\10\12\0\1\10\10\0\26\10\232\0"+
|
||||||
|
"\27\10\14\0\65\10\56\0\12\10\23\0\55\10\40\0"+
|
||||||
|
"\31\10\7\0\12\10\11\0\44\10\17\0\12\10\4\0"+
|
||||||
|
"\1\10\13\0\43\10\3\0\1\10\14\0\60\10\16\0"+
|
||||||
|
"\4\10\13\0\13\10\1\0\1\10\43\0\22\10\1\0"+
|
||||||
|
"\31\10\124\0\7\10\1\0\1\10\1\0\4\10\1\0"+
|
||||||
|
"\17\10\1\0\12\10\7\0\57\10\21\0\12\10\13\0"+
|
||||||
|
"\10\10\2\0\2\10\2\0\26\10\1\0\7\10\1\0"+
|
||||||
|
"\2\10\1\0\5\10\3\0\1\10\22\0\1\10\14\0"+
|
||||||
|
"\5\10\236\0\65\10\22\0\4\10\5\0\12\10\5\0"+
|
||||||
|
"\1\10\40\0\60\10\24\0\2\10\1\0\1\10\10\0"+
|
||||||
|
"\12\10\246\0\57\10\51\0\4\10\44\0\60\10\24\0"+
|
||||||
|
"\1\10\13\0\12\10\46\0\53\10\15\0\1\10\7\0"+
|
||||||
|
"\12\10\66\0\33\10\25\0\12\10\306\0\54\10\164\0"+
|
||||||
|
"\112\10\25\0\1\10\240\0\10\10\2\0\47\10\20\0"+
|
||||||
|
"\1\10\1\0\1\10\34\0\1\10\12\0\50\10\7\0"+
|
||||||
|
"\1\10\25\0\1\10\13\0\56\10\23\0\1\10\42\0"+
|
||||||
|
"\71\10\7\0\11\10\1\0\45\10\21\0\1\10\17\0"+
|
||||||
|
"\12\10\30\0\36\10\160\0\7\10\1\0\2\10\1\0"+
|
||||||
|
"\46\10\25\0\1\10\11\0\12\10\6\0\6\10\1\0"+
|
||||||
|
"\2\10\1\0\40\10\16\0\1\10\7\0\12\10\u0136\0"+
|
||||||
|
"\23\10\15\0\232\10\346\0\304\10\274\0\57\10\321\0"+
|
||||||
|
"\107\10\271\0\71\10\7\0\37\10\1\0\12\10\146\0"+
|
||||||
|
"\36\10\22\0\60\10\20\0\4\10\14\0\12\10\11\0"+
|
||||||
|
"\25\10\5\0\23\10\260\0\100\10\200\0\113\10\5\0"+
|
||||||
|
"\1\10\102\0\15\10\100\0\2\10\1\0\1\10\34\0"+
|
||||||
|
"\370\10\10\0\363\10\15\0\37\10\61\0\3\10\21\0"+
|
||||||
|
"\4\10\10\0\u018c\10\4\0\153\10\5\0\15\10\3\0"+
|
||||||
|
"\11\10\7\0\12\10\146\0\125\10\1\0\107\10\1\0"+
|
||||||
|
"\2\10\2\0\1\10\2\0\2\10\2\0\4\10\1\0"+
|
||||||
|
"\14\10\1\0\1\10\1\0\7\10\1\0\101\10\1\0"+
|
||||||
|
"\4\10\2\0\10\10\1\0\7\10\1\0\34\10\1\0"+
|
||||||
|
"\4\10\1\0\5\10\1\0\1\10\3\0\7\10\1\0"+
|
||||||
|
"\u0154\10\2\0\31\10\1\0\31\10\1\0\37\10\1\0"+
|
||||||
|
"\31\10\1\0\37\10\1\0\31\10\1\0\37\10\1\0"+
|
||||||
|
"\31\10\1\0\37\10\1\0\31\10\1\0\10\10\2\0"+
|
||||||
|
"\137\10\12\0\7\10\2\0\12\10\4\0\1\10\u0171\0"+
|
||||||
|
"\54\10\4\0\12\10\6\0\305\10\73\0\104\10\7\0"+
|
||||||
|
"\1\10\4\0\12\10\246\0\4\10\1\0\33\10\1\0"+
|
||||||
|
"\2\10\1\0\1\10\2\0\1\10\1\0\12\10\1\0"+
|
||||||
|
"\4\10\1\0\1\10\1\0\1\10\6\0\1\10\4\0"+
|
||||||
|
"\1\10\1\0\1\10\1\0\1\10\1\0\3\10\1\0"+
|
||||||
|
"\2\10\1\0\1\10\2\0\1\10\1\0\1\10\1\0"+
|
||||||
|
"\1\10\1\0\1\10\1\0\1\10\1\0\2\10\1\0"+
|
||||||
|
"\1\10\2\0\4\10\1\0\7\10\1\0\4\10\1\0"+
|
||||||
|
"\4\10\1\0\1\10\1\0\12\10\1\0\21\10\5\0"+
|
||||||
|
"\3\10\1\0\5\10\1\0\21\10\104\0\327\10\51\0"+
|
||||||
|
"\65\10\13\0\336\10\2\0\u0182\10\16\0\u0131\10\37\0"+
|
||||||
|
"\36\10\342\0";
|
||||||
|
|
||||||
|
private static int [] zzUnpackcmap_blocks() {
|
||||||
|
int [] result = new int[27904];
|
||||||
|
int offset = 0;
|
||||||
|
offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int zzUnpackcmap_blocks(String packed, int offset, int [] result) {
|
||||||
|
int i = 0; /* index in packed string */
|
||||||
|
int j = offset; /* index in unpacked array */
|
||||||
|
int l = packed.length();
|
||||||
|
while (i < l) {
|
||||||
|
int count = packed.charAt(i++);
|
||||||
|
int value = packed.charAt(i++);
|
||||||
|
do result[j++] = value; while (--count > 0);
|
||||||
|
}
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Translates DFA states to action switch labels.
|
* Translates DFA states to action switch labels.
|
||||||
*/
|
*/
|
||||||
private static final int [] ZZ_ACTION = zzUnpackAction();
|
private static final int [] ZZ_ACTION = zzUnpackAction();
|
||||||
|
|
||||||
private static final String ZZ_ACTION_PACKED_0 =
|
private static final String ZZ_ACTION_PACKED_0 =
|
||||||
"\3\0\1\1\1\2\1\3\2\4\1\5\1\6\1\5"+
|
"\3\0\1\1\1\2\1\3\2\4\2\5\1\6\1\1"+
|
||||||
"\1\1\1\2\1\7\1\10\1\4\1\0\1\5\2\4"+
|
"\1\2\1\7\1\10\1\4\1\0\1\5\2\4\1\11";
|
||||||
"\1\11";
|
|
||||||
|
|
||||||
private static int [] zzUnpackAction() {
|
private static int [] zzUnpackAction() {
|
||||||
int [] result = new int[21];
|
int [] result = new int[21];
|
||||||
@@ -189,15 +301,15 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a state to a row index in the transition table
|
* Translates a state to a row index in the transition table
|
||||||
*/
|
*/
|
||||||
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
||||||
|
|
||||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
private static final String ZZ_ROWMAP_PACKED_0 =
|
||||||
"\0\0\0\21\0\42\0\63\0\104\0\125\0\146\0\167"+
|
"\0\0\0\20\0\40\0\60\0\100\0\120\0\140\0\160"+
|
||||||
"\0\210\0\231\0\252\0\273\0\314\0\335\0\63\0\356"+
|
"\0\200\0\220\0\240\0\260\0\300\0\60\0\320\0\340"+
|
||||||
"\0\273\0\377\0\u0110\0\u0121\0\167";
|
"\0\260\0\360\0\u0100\0\u0110\0\140";
|
||||||
|
|
||||||
private static int [] zzUnpackRowMap() {
|
private static int [] zzUnpackRowMap() {
|
||||||
int [] result = new int[21];
|
int [] result = new int[21];
|
||||||
@@ -209,7 +321,7 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
|
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
|
||||||
int i = 0; /* index in packed string */
|
int i = 0; /* index in packed string */
|
||||||
int j = offset; /* index in unpacked array */
|
int j = offset; /* index in unpacked array */
|
||||||
int l = packed.length();
|
int l = packed.length() - 1;
|
||||||
while (i < l) {
|
while (i < l) {
|
||||||
int high = packed.charAt(i++) << 16;
|
int high = packed.charAt(i++) << 16;
|
||||||
result[j++] = high | packed.charAt(i++);
|
result[j++] = high | packed.charAt(i++);
|
||||||
@@ -217,33 +329,35 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The transition table of the DFA
|
* The transition table of the DFA
|
||||||
*/
|
*/
|
||||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
private static final int [] ZZ_TRANS = zzUnpacktrans();
|
||||||
|
|
||||||
private static final String ZZ_TRANS_PACKED_0 =
|
private static final String ZZ_TRANS_PACKED_0 =
|
||||||
"\1\4\3\5\1\6\1\7\5\10\1\5\4\4\1\0"+
|
"\1\4\2\5\1\0\2\5\1\6\1\4\1\7\2\4"+
|
||||||
"\1\11\2\12\1\5\7\11\1\13\1\4\1\11\1\4"+
|
"\1\7\1\10\3\7\1\11\1\12\1\13\1\11\1\5"+
|
||||||
"\1\14\1\11\1\4\2\12\1\5\7\4\1\15\1\16"+
|
"\1\13\3\11\1\4\1\14\5\11\1\4\1\15\1\13"+
|
||||||
"\1\17\2\4\23\0\3\5\7\0\1\5\5\0\1\6"+
|
"\1\0\1\5\1\13\1\4\1\16\1\4\1\17\6\4"+
|
||||||
"\2\0\16\6\5\0\1\10\1\20\4\10\13\0\6\10"+
|
"\21\0\2\5\1\0\2\5\12\0\2\6\1\0\2\6"+
|
||||||
"\6\0\1\11\3\0\10\11\1\0\1\11\1\0\1\21"+
|
"\1\0\12\6\10\0\1\7\2\0\5\7\10\0\1\7"+
|
||||||
"\1\11\1\0\3\12\7\0\1\12\5\0\1\11\3\5"+
|
"\2\0\3\7\1\20\1\7\2\11\1\0\1\11\2\0"+
|
||||||
"\7\11\1\13\1\0\1\11\1\0\1\21\3\11\1\22"+
|
"\3\11\1\0\1\21\6\11\1\12\1\5\1\11\2\5"+
|
||||||
"\1\0\14\11\2\0\3\5\7\0\1\15\1\16\1\17"+
|
"\3\11\1\0\1\21\5\11\1\0\2\13\1\0\2\13"+
|
||||||
"\16\0\1\16\12\0\2\10\1\23\3\10\6\0\2\11"+
|
"\12\0\3\11\2\0\1\22\12\11\1\0\1\15\1\5"+
|
||||||
"\2\0\10\11\1\0\1\11\1\0\1\21\1\11\5\0"+
|
"\1\0\2\5\1\0\1\16\1\0\1\17\7\0\1\17"+
|
||||||
"\3\10\1\24\2\10\13\0\4\10\1\25\1\10\6\0";
|
"\26\0\1\7\2\0\2\7\1\23\2\7\4\11\2\0"+
|
||||||
|
"\3\11\1\0\1\21\5\11\10\0\1\7\2\0\1\24"+
|
||||||
|
"\4\7\10\0\1\7\2\0\4\7\1\25";
|
||||||
|
|
||||||
private static int [] zzUnpackTrans() {
|
private static int [] zzUnpacktrans() {
|
||||||
int [] result = new int[306];
|
int [] result = new int[288];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int zzUnpackTrans(String packed, int offset, int [] result) {
|
private static int zzUnpacktrans(String packed, int offset, int [] result) {
|
||||||
int i = 0; /* index in packed string */
|
int i = 0; /* index in packed string */
|
||||||
int j = offset; /* index in unpacked array */
|
int j = offset; /* index in unpacked array */
|
||||||
int l = packed.length();
|
int l = packed.length();
|
||||||
@@ -270,12 +384,12 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
* ZZ_ATTRIBUTE[aState] contains the attributes of state {@code aState}
|
||||||
*/
|
*/
|
||||||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||||
|
|
||||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
||||||
"\3\0\1\11\12\1\1\11\1\1\1\0\4\1";
|
"\3\0\1\11\11\1\1\11\2\1\1\0\4\1";
|
||||||
|
|
||||||
private static int [] zzUnpackAttribute() {
|
private static int [] zzUnpackAttribute() {
|
||||||
int [] result = new int[21];
|
int [] result = new int[21];
|
||||||
@@ -322,15 +436,26 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
from input */
|
from input */
|
||||||
private int zzEndRead;
|
private int zzEndRead;
|
||||||
|
|
||||||
/**
|
|
||||||
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
|
|
||||||
*/
|
|
||||||
private boolean zzAtBOL = true;
|
|
||||||
|
|
||||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
/** zzAtEOF == true <=> the scanner is at the EOF */
|
||||||
private boolean zzAtEOF;
|
private boolean zzAtEOF;
|
||||||
|
|
||||||
/** denotes if the user-EOF-code has already been executed */
|
/** Number of newlines encountered up to the start of the matched text. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private int yyline;
|
||||||
|
|
||||||
|
/** Number of characters from the last newline up to the start of the matched text. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
protected int yycolumn;
|
||||||
|
|
||||||
|
/** Number of characters up to the start of the matched text. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private long yychar;
|
||||||
|
|
||||||
|
/** Whether the scanner is currently at the beginning of a line. */
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private boolean zzAtBOL = true;
|
||||||
|
|
||||||
|
/** Whether the user-EOF-code has already been executed. */
|
||||||
private boolean zzEOFDone;
|
private boolean zzEOFDone;
|
||||||
|
|
||||||
|
|
||||||
@@ -344,26 +469,22 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Returns the maximum size of the scanner buffer, which limits the size of tokens. */
|
||||||
* Unpacks the compressed character translation table.
|
private int zzMaxBufferLen() {
|
||||||
*
|
return Integer.MAX_VALUE;
|
||||||
* @param packed the packed character translation table
|
}
|
||||||
* @return the unpacked character translation table
|
|
||||||
|
/** Whether the scanner buffer can grow to accommodate a larger token. */
|
||||||
|
private boolean zzCanGrow() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates raw input code points to DFA table row
|
||||||
*/
|
*/
|
||||||
private static char [] zzUnpackCMap(String packed) {
|
private static int zzCMap(int input) {
|
||||||
int size = 0;
|
int offset = input & 255;
|
||||||
for (int i = 0, length = packed.length(); i < length; i += 2) {
|
return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset];
|
||||||
size += packed.charAt(i);
|
|
||||||
}
|
|
||||||
char[] map = new char[size];
|
|
||||||
int i = 0; /* index in packed string */
|
|
||||||
int j = 0; /* index in unpacked array */
|
|
||||||
while (i < packed.length()) {
|
|
||||||
int count = packed.charAt(i++);
|
|
||||||
char value = packed.charAt(i++);
|
|
||||||
do map[j++] = value; while (--count > 0);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getTokenStart() {
|
public final int getTokenStart() {
|
||||||
@@ -507,7 +628,8 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
* @return the next token
|
* @return the next token
|
||||||
* @exception java.io.IOException if any I/O-Error occurs
|
* @exception java.io.IOException if any I/O-Error occurs
|
||||||
*/
|
*/
|
||||||
public IElementType advance() throws java.io.IOException {
|
public IElementType advance() throws java.io.IOException
|
||||||
|
{
|
||||||
int zzInput;
|
int zzInput;
|
||||||
int zzAction;
|
int zzAction;
|
||||||
|
|
||||||
@@ -541,7 +663,7 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
if (zzCurrentPosL < zzEndReadL) {
|
if (zzCurrentPosL < zzEndReadL) {
|
||||||
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
|
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
|
||||||
zzCurrentPosL += Character.charCount(zzInput);
|
zzCurrentPosL += Character.charCount(zzInput);
|
||||||
}
|
}
|
||||||
else if (zzAtEOF) {
|
else if (zzAtEOF) {
|
||||||
@@ -563,11 +685,11 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
break zzForAction;
|
break zzForAction;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
|
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
|
||||||
zzCurrentPosL += Character.charCount(zzInput);
|
zzCurrentPosL += Character.charCount(zzInput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
|
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
|
||||||
if (zzNext == -1) break zzForAction;
|
if (zzNext == -1) break zzForAction;
|
||||||
zzState = zzNext;
|
zzState = zzNext;
|
||||||
|
|
||||||
@@ -586,55 +708,55 @@ class LombokConfigLexer implements FlexLexer {
|
|||||||
|
|
||||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||||
zzAtEOF = true;
|
zzAtEOF = true;
|
||||||
zzDoEOF();
|
zzDoEOF();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||||
case 1:
|
case 1:
|
||||||
{ return TokenType.BAD_CHARACTER;
|
{ return TokenType.BAD_CHARACTER;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 10: break;
|
case 10: break;
|
||||||
case 2:
|
case 2:
|
||||||
{ return TokenType.WHITE_SPACE;
|
{ return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 11: break;
|
case 11: break;
|
||||||
case 3:
|
case 3:
|
||||||
{ yybegin(YYINITIAL); return LombokConfigTypes.COMMENT;
|
{ yybegin(YYINITIAL); return LombokConfigTypes.COMMENT;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 12: break;
|
case 12: break;
|
||||||
case 4:
|
case 4:
|
||||||
{ yybegin(IN_KEY_VALUE_SEPARATOR); return LombokConfigTypes.KEY;
|
{ yybegin(IN_KEY_VALUE_SEPARATOR); return LombokConfigTypes.KEY;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 13: break;
|
case 13: break;
|
||||||
case 5:
|
case 5:
|
||||||
{ yybegin(YYINITIAL); return LombokConfigTypes.VALUE;
|
{ yybegin(YYINITIAL); return LombokConfigTypes.VALUE;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 14: break;
|
case 14: break;
|
||||||
case 6:
|
case 6:
|
||||||
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
|
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 15: break;
|
case 15: break;
|
||||||
case 7:
|
case 7:
|
||||||
{ yybegin(IN_VALUE); return LombokConfigTypes.SEPARATOR;
|
|
||||||
}
|
|
||||||
// fall through
|
|
||||||
case 16: break;
|
|
||||||
case 8:
|
|
||||||
{ yybegin(IN_KEY_VALUE_SEPARATOR); return LombokConfigTypes.SIGN;
|
{ yybegin(IN_KEY_VALUE_SEPARATOR); return LombokConfigTypes.SIGN;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
|
case 16: break;
|
||||||
|
case 8:
|
||||||
|
{ yybegin(IN_VALUE); return LombokConfigTypes.SEPARATOR;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
case 17: break;
|
case 17: break;
|
||||||
case 9:
|
case 9:
|
||||||
{ yybegin(YYINITIAL); return LombokConfigTypes.CLEAR;
|
{ yybegin(YYINITIAL); return LombokConfigTypes.CLEAR;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case 18: break;
|
case 18: break;
|
||||||
default:
|
default:
|
||||||
zzScanError(ZZ_NO_MATCH);
|
zzScanError(ZZ_NO_MATCH);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import org.jetbrains.annotations.*;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
|
|
||||||
public interface LombokConfigCleaner extends PsiElement {
|
public interface LombokConfigCleaner extends PsiElement {
|
||||||
|
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import de.plushnikov.intellij.plugin.language.psi.LombokConfigProperty;
|
|||||||
import de.plushnikov.intellij.plugin.language.psi.LombokConfigPsiUtil;
|
import de.plushnikov.intellij.plugin.language.psi.LombokConfigPsiUtil;
|
||||||
import de.plushnikov.intellij.plugin.language.psi.LombokConfigTypes;
|
import de.plushnikov.intellij.plugin.language.psi.LombokConfigTypes;
|
||||||
import de.plushnikov.intellij.plugin.lombokconfig.ConfigKey;
|
import de.plushnikov.intellij.plugin.lombokconfig.ConfigKey;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.LombokNullAnnotationLibraryDefned;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -21,6 +22,7 @@ public class LombokConfigCompletionContributor extends CompletionContributor {
|
|||||||
private static final String LOMBOK_EQUALS_AND_HASH_CODE_CALL_SUPER = ConfigKey.EQUALSANDHASHCODE_CALL_SUPER.getConfigKey();
|
private static final String LOMBOK_EQUALS_AND_HASH_CODE_CALL_SUPER = ConfigKey.EQUALSANDHASHCODE_CALL_SUPER.getConfigKey();
|
||||||
private static final String LOMBOK_TOSTRING_CALL_SUPER = ConfigKey.TOSTRING_CALL_SUPER.getConfigKey();
|
private static final String LOMBOK_TOSTRING_CALL_SUPER = ConfigKey.TOSTRING_CALL_SUPER.getConfigKey();
|
||||||
private static final String LOMBOK_ACCESSORS_JAVA_BEANS_SPEC_CAPITALIZATION = ConfigKey.ACCESSORS_JAVA_BEANS_SPEC_CAPITALIZATION.getConfigKey();
|
private static final String LOMBOK_ACCESSORS_JAVA_BEANS_SPEC_CAPITALIZATION = ConfigKey.ACCESSORS_JAVA_BEANS_SPEC_CAPITALIZATION.getConfigKey();
|
||||||
|
private static final String LOMBOK_ADD_NULL_ANNOTATIONS = ConfigKey.ADD_NULL_ANNOTATIONS.getConfigKey();
|
||||||
|
|
||||||
public LombokConfigCompletionContributor() {
|
public LombokConfigCompletionContributor() {
|
||||||
final Collection<String> booleanOptions = Set.of(
|
final Collection<String> booleanOptions = Set.of(
|
||||||
@@ -60,7 +62,8 @@ public class LombokConfigCompletionContributor extends CompletionContributor {
|
|||||||
ConfigKey.NONNULL_EXCEPTIONTYPE.getConfigKey(), ConfigKey.EQUALSANDHASHCODE_CALL_SUPER.getConfigKey(),
|
ConfigKey.NONNULL_EXCEPTIONTYPE.getConfigKey(), ConfigKey.EQUALSANDHASHCODE_CALL_SUPER.getConfigKey(),
|
||||||
ConfigKey.FIELD_NAME_CONSTANTS_PREFIX.getConfigKey(), ConfigKey.FIELD_NAME_CONSTANTS_SUFFIX.getConfigKey(),
|
ConfigKey.FIELD_NAME_CONSTANTS_PREFIX.getConfigKey(), ConfigKey.FIELD_NAME_CONSTANTS_SUFFIX.getConfigKey(),
|
||||||
ConfigKey.FIELD_NAME_CONSTANTS_TYPENAME.getConfigKey(), ConfigKey.FIELD_NAME_CONSTANTS_UPPERCASE.getConfigKey(),
|
ConfigKey.FIELD_NAME_CONSTANTS_TYPENAME.getConfigKey(), ConfigKey.FIELD_NAME_CONSTANTS_UPPERCASE.getConfigKey(),
|
||||||
ConfigKey.TOSTRING_CALL_SUPER.getConfigKey(), ConfigKey.BUILDER_CLASS_NAME.getConfigKey());
|
ConfigKey.TOSTRING_CALL_SUPER.getConfigKey(), ConfigKey.BUILDER_CLASS_NAME.getConfigKey(),
|
||||||
|
ConfigKey.ADD_NULL_ANNOTATIONS.getConfigKey());
|
||||||
|
|
||||||
final Collection<String> allOptions = new HashSet<>(booleanOptions);
|
final Collection<String> allOptions = new HashSet<>(booleanOptions);
|
||||||
allOptions.addAll(flagUsageOptions);
|
allOptions.addAll(flagUsageOptions);
|
||||||
@@ -99,6 +102,12 @@ public class LombokConfigCompletionContributor extends CompletionContributor {
|
|||||||
resultSet.addElement(LookupElementBuilder.create("BASIC"));
|
resultSet.addElement(LookupElementBuilder.create("BASIC"));
|
||||||
resultSet.addElement(LookupElementBuilder.create("BEANSPEC"));
|
resultSet.addElement(LookupElementBuilder.create("BEANSPEC"));
|
||||||
}
|
}
|
||||||
|
else if (LOMBOK_ADD_NULL_ANNOTATIONS.equals(configPropertyKey)) {
|
||||||
|
for (LombokNullAnnotationLibraryDefned library : LombokNullAnnotationLibraryDefned.values()) {
|
||||||
|
resultSet.addElement(LookupElementBuilder.create(library.getKey()));
|
||||||
|
}
|
||||||
|
resultSet.addElement(LookupElementBuilder.create("CUSTOM:[TYPE_USE:]nonnull.annotation.type:nullable.annotation.type"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,23 @@ public class ConfigDiscovery {
|
|||||||
return ApplicationManager.getApplication().getService(ConfigDiscovery.class);
|
return ApplicationManager.getApplication().getService(ConfigDiscovery.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @NotNull LombokNullAnnotationLibrary getAddNullAnnotationLombokConfigProperty(@NotNull PsiClass psiClass) {
|
||||||
|
final String configProperty = getStringLombokConfigProperty(ConfigKey.ADD_NULL_ANNOTATIONS, psiClass);
|
||||||
|
if (StringUtil.isNotEmpty(configProperty)) {
|
||||||
|
for (LombokNullAnnotationLibraryDefned library : LombokNullAnnotationLibraryDefned.values()) {
|
||||||
|
if (library.getKey().equalsIgnoreCase(configProperty)) {
|
||||||
|
return library;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final LombokNullAnnotationLibrary parsedCustom = LombokNullAnnotationLibraryCustom.parseCustom(configProperty);
|
||||||
|
if (null != parsedCustom) {
|
||||||
|
return parsedCustom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return LombokNullAnnotationLibraryDefned.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
public @NotNull Collection<String> getMultipleValueLombokConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) {
|
public @NotNull Collection<String> getMultipleValueLombokConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) {
|
||||||
return getConfigProperty(configKey, psiClass);
|
return getConfigProperty(configKey, psiClass);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package de.plushnikov.intellij.plugin.lombokconfig;
|
package de.plushnikov.intellij.plugin.lombokconfig;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public enum ConfigKey {
|
public enum ConfigKey {
|
||||||
|
|
||||||
CONFIG_STOP_BUBBLING("config.stopBubbling", "false"),
|
CONFIG_STOP_BUBBLING("config.stopBubbling", "false"),
|
||||||
@@ -51,7 +49,9 @@ public enum ConfigKey {
|
|||||||
|
|
||||||
NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE("lombok.noArgsConstructor.extraPrivate", "false"),
|
NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE("lombok.noArgsConstructor.extraPrivate", "false"),
|
||||||
|
|
||||||
BUILDER_CLASS_NAME("lombok.builder.className", "*Builder");
|
BUILDER_CLASS_NAME("lombok.builder.className", "*Builder"),
|
||||||
|
ADD_NULL_ANNOTATIONS("lombok.addNullAnnotations", "");
|
||||||
|
//ADD_LOMBOK_GENERATED_ANNOTATION("lombok.addLombokGeneratedAnnotation", "false");
|
||||||
/*
|
/*
|
||||||
ACCESSORS_FLAG_USAGE("lombok.accessors.flagUsage", ""),
|
ACCESSORS_FLAG_USAGE("lombok.accessors.flagUsage", ""),
|
||||||
ALLARGSCONSTRUCTOR_FLAG_USAGE("lombok.allArgsConstructor.flagUsage", ""),
|
ALLARGSCONSTRUCTOR_FLAG_USAGE("lombok.allArgsConstructor.flagUsage", ""),
|
||||||
@@ -99,7 +99,7 @@ public enum ConfigKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigKey(String configKey, String configDefaultValue, boolean configScalarValue) {
|
ConfigKey(String configKey, String configDefaultValue, boolean configScalarValue) {
|
||||||
this.configKey = configKey.toLowerCase(Locale.ENGLISH);
|
this.configKey = configKey;
|
||||||
this.configDefaultValue = configDefaultValue;
|
this.configDefaultValue = configDefaultValue;
|
||||||
this.configScalarValue = configScalarValue;
|
this.configScalarValue = configScalarValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ public class LombokConfigIndex extends FileBasedIndexExtension<ConfigKey, Config
|
|||||||
if (null != canonicalPath) {
|
if (null != canonicalPath) {
|
||||||
final Map<String, String> configValues = extractValues((LombokConfigFile)inputData.getPsiFile());
|
final Map<String, String> configValues = extractValues((LombokConfigFile)inputData.getPsiFile());
|
||||||
|
|
||||||
final boolean stopBubblingValue = Boolean.parseBoolean(configValues.get(ConfigKey.CONFIG_STOP_BUBBLING.getConfigKey()));
|
final boolean stopBubblingValue = Boolean.parseBoolean(configValues.get(StringUtil.toLowerCase(ConfigKey.CONFIG_STOP_BUBBLING.getConfigKey())));
|
||||||
result = ContainerUtil.map2Map(ConfigKey.values(),
|
result = ContainerUtil.map2Map(ConfigKey.values(),
|
||||||
key -> Pair.create(key,
|
key -> Pair.create(key,
|
||||||
new ConfigValue(configValues.get(key.getConfigKey()), stopBubblingValue)));
|
new ConfigValue(configValues.get(StringUtil.toLowerCase(key.getConfigKey())), stopBubblingValue)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -132,6 +132,6 @@ public class LombokConfigIndex extends FileBasedIndexExtension<ConfigKey, Config
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getVersion() {
|
public int getVersion() {
|
||||||
return 12;
|
return 14;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package de.plushnikov.intellij.plugin.lombokconfig;
|
||||||
|
|
||||||
|
public interface LombokNullAnnotationLibrary {
|
||||||
|
String getNonNullAnnotation();
|
||||||
|
|
||||||
|
String getNullableAnnotation();
|
||||||
|
|
||||||
|
boolean isTypeUse();
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package de.plushnikov.intellij.plugin.lombokconfig;
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class LombokNullAnnotationLibraryCustom implements LombokNullAnnotationLibrary {
|
||||||
|
private final String nonNullAnnotation;
|
||||||
|
private final String nullableAnnotation;
|
||||||
|
private final boolean typeUse;
|
||||||
|
|
||||||
|
public LombokNullAnnotationLibraryCustom(String nonNullAnnotation, String nullableAnnotation, boolean typeUse) {
|
||||||
|
this.nonNullAnnotation = nonNullAnnotation;
|
||||||
|
this.nullableAnnotation = nullableAnnotation;
|
||||||
|
this.typeUse = typeUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNonNullAnnotation() {
|
||||||
|
return nonNullAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNullableAnnotation() {
|
||||||
|
return nullableAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTypeUse() {
|
||||||
|
return typeUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static LombokNullAnnotationLibrary parseCustom(String value) {
|
||||||
|
if (StringUtil.toLowerCase(value).startsWith("custom:")) {
|
||||||
|
String customConfigValue = value.substring("custom:".length());
|
||||||
|
final boolean useType = StringUtil.toLowerCase(customConfigValue).startsWith("type_use:");
|
||||||
|
if (useType) {
|
||||||
|
customConfigValue = customConfigValue.substring("type_use:".length());
|
||||||
|
}
|
||||||
|
|
||||||
|
String nonNullAnnotation, nullableAnnotation = null;
|
||||||
|
final int splitIndex = customConfigValue.indexOf(':');
|
||||||
|
if (splitIndex == -1) {
|
||||||
|
nonNullAnnotation = customConfigValue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nonNullAnnotation = customConfigValue.substring(0, splitIndex);
|
||||||
|
nullableAnnotation = customConfigValue.substring(splitIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verifyTypeName(nonNullAnnotation) &&
|
||||||
|
(null == nullableAnnotation || verifyTypeName(nullableAnnotation))) {
|
||||||
|
return new LombokNullAnnotationLibraryCustom(nonNullAnnotation, nullableAnnotation, useType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean verifyTypeName(String fqn) {
|
||||||
|
boolean atStart = true;
|
||||||
|
for (int i = 0; i < fqn.length(); i++) {
|
||||||
|
char c = fqn.charAt(i);
|
||||||
|
if (Character.isJavaIdentifierStart(c)) {
|
||||||
|
atStart = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (atStart) return false;
|
||||||
|
if (c == '.') {
|
||||||
|
atStart = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (Character.isJavaIdentifierPart(c)) continue;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !atStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package de.plushnikov.intellij.plugin.lombokconfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based on <a href="https://github.com/projectlombok/lombok/blob/master/src/core/lombok/core/configuration/NullAnnotationLibrary.java">Lombok's NullAnnotationLibrary</a>
|
||||||
|
*/
|
||||||
|
public enum LombokNullAnnotationLibraryDefned implements LombokNullAnnotationLibrary {
|
||||||
|
NONE("none", null, null, false),
|
||||||
|
JAVAX("javax", "javax.annotation.Nonnull", "javax.annotation.Nullable", false),
|
||||||
|
JAKARTA("jakarta", "jakarta.annotation.Nonnull", "jakarta.annotation.Nullable", false),
|
||||||
|
ECLIPSE("eclipse", "org.eclipse.jdt.annotation.NonNull", "org.eclipse.jdt.annotation.Nullable", true),
|
||||||
|
JETBRAINS("jetbrains", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable", false),
|
||||||
|
NETBEANS("netbeans", "org.netbeans.api.annotations.common.NonNull", "org.netbeans.api.annotations.common.NullAllowed", false),
|
||||||
|
ANDROIDX("androidx", "androidx.annotation.NonNull", "androidx.annotation.Nullable", false),
|
||||||
|
ANDROID_SUPPORT("android.support", "android.support.annotation.NonNull", "android.support.annotation.Nullable", false),
|
||||||
|
CHECKERFRAMEWORK("checkerframework", "org.checkerframework.checker.nullness.qual.NonNull",
|
||||||
|
"org.checkerframework.checker.nullness.qual.Nullable", true),
|
||||||
|
FINDBUGS("findbugs", "edu.umd.cs.findbugs.annotations.NonNull", "edu.umd.cs.findbugs.annotations.Nullable", false),
|
||||||
|
SPRING("spring", "org.springframework.lang.NonNull", "org.springframework.lang.Nullable", false),
|
||||||
|
JML("jml", "org.jmlspecs.annotation.NonNull", "org.jmlspecs.annotation.Nullable", false);
|
||||||
|
|
||||||
|
|
||||||
|
private final String key;
|
||||||
|
private final String nonNullAnnotation;
|
||||||
|
private final String nullableAnnotation;
|
||||||
|
private final boolean typeUse;
|
||||||
|
|
||||||
|
LombokNullAnnotationLibraryDefned(String key, String nonNullAnnotation, String nullableAnnotation, boolean typeUse) {
|
||||||
|
this.key = key;
|
||||||
|
this.nonNullAnnotation = nonNullAnnotation;
|
||||||
|
this.nullableAnnotation = nullableAnnotation;
|
||||||
|
this.typeUse = typeUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fully qualified annotation name to apply to non-null elements. If {@code null} is returned, apply no annotation.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getNonNullAnnotation() {
|
||||||
|
return nonNullAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fully qualified annotation name to apply to nullable elements. If {@code null} is returned, apply no annotation.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getNullableAnnotation() {
|
||||||
|
return nullableAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If {@code true}, the annotation can only be used in TYPE_USE form, otherwise, prefer to annotate the parameter, not the type of the parameter (or the method, not the return type, etc).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isTypeUse() {
|
||||||
|
return typeUse;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import de.plushnikov.intellij.plugin.processor.handler.EqualsAndHashCodeToString
|
|||||||
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
||||||
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
||||||
|
import de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil;
|
import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil;
|
||||||
import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil;
|
import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil;
|
||||||
@@ -186,13 +187,17 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor {
|
|||||||
.withNavigationElement(psiAnnotation)
|
.withNavigationElement(psiAnnotation)
|
||||||
.withFinalParameter("o", PsiType.getJavaLangObject(psiManager, psiClass.getResolveScope()));
|
.withFinalParameter("o", PsiType.getJavaLangObject(psiManager, psiClass.getResolveScope()));
|
||||||
|
|
||||||
copyOnXAnnotationsForFirstParam(psiAnnotation, methodBuilder);
|
LombokLightParameter parameter = methodBuilder.getParameterList().getParameter(0);
|
||||||
|
if (null != parameter) {
|
||||||
|
LombokAddNullAnnotations.createRelevantNullableAnnotation(psiClass, parameter);
|
||||||
|
copyOnXAnnotationsForFirstParam(psiAnnotation, parameter);
|
||||||
|
}
|
||||||
|
|
||||||
methodBuilder.withBodyText(m -> {
|
methodBuilder.withBodyText(m -> {
|
||||||
PsiClass aClass = m.getContainingClass();
|
PsiClass containingClass = m.getContainingClass();
|
||||||
PsiAnnotation anno = (PsiAnnotation)m.getNavigationElement();
|
PsiAnnotation anno = (PsiAnnotation)m.getNavigationElement();
|
||||||
return createEqualsBlockString(aClass, anno, hasCanEqualMethod,
|
return createEqualsBlockString(containingClass, anno, hasCanEqualMethod,
|
||||||
EqualsAndHashCodeToStringHandler.filterMembers(aClass, anno, true, INCLUDE_ANNOTATION_METHOD, null));
|
EqualsAndHashCodeToStringHandler.filterMembers(containingClass, anno, true, INCLUDE_ANNOTATION_METHOD, null));
|
||||||
});
|
});
|
||||||
return methodBuilder;
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
@@ -207,10 +212,10 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor {
|
|||||||
.withContainingClass(psiClass)
|
.withContainingClass(psiClass)
|
||||||
.withNavigationElement(psiAnnotation)
|
.withNavigationElement(psiAnnotation)
|
||||||
.withBodyText(m -> {
|
.withBodyText(m -> {
|
||||||
PsiClass aClass = m.getContainingClass();
|
PsiClass containingClass = m.getContainingClass();
|
||||||
PsiAnnotation anno = (PsiAnnotation)m.getNavigationElement();
|
PsiAnnotation anno = (PsiAnnotation)m.getNavigationElement();
|
||||||
return createHashcodeBlockString(aClass, anno,
|
return createHashcodeBlockString(containingClass, anno,
|
||||||
EqualsAndHashCodeToStringHandler.filterMembers(aClass, anno, true, INCLUDE_ANNOTATION_METHOD,
|
EqualsAndHashCodeToStringHandler.filterMembers(containingClass, anno, true, INCLUDE_ANNOTATION_METHOD,
|
||||||
null));
|
null));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -227,18 +232,19 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor {
|
|||||||
.withNavigationElement(psiAnnotation)
|
.withNavigationElement(psiAnnotation)
|
||||||
.withFinalParameter("other", PsiType.getJavaLangObject(psiManager, psiClass.getResolveScope()));
|
.withFinalParameter("other", PsiType.getJavaLangObject(psiManager, psiClass.getResolveScope()));
|
||||||
|
|
||||||
copyOnXAnnotationsForFirstParam(psiAnnotation, methodBuilder);
|
LombokLightParameter parameter = methodBuilder.getParameterList().getParameter(0);
|
||||||
|
if (null != parameter) {
|
||||||
|
LombokAddNullAnnotations.createRelevantNullableAnnotation(psiClass, parameter);
|
||||||
|
copyOnXAnnotationsForFirstParam(psiAnnotation, parameter);
|
||||||
|
}
|
||||||
|
|
||||||
methodBuilder.withBodyText(blockText);
|
methodBuilder.withBodyText(blockText);
|
||||||
return methodBuilder;
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void copyOnXAnnotationsForFirstParam(@NotNull PsiAnnotation psiAnnotation, LombokLightMethodBuilder methodBuilder) {
|
private static void copyOnXAnnotationsForFirstParam(@NotNull PsiAnnotation psiAnnotation, @NotNull LombokLightParameter lightParameter) {
|
||||||
LombokLightParameter parameter = methodBuilder.getParameterList().getParameter(0);
|
PsiModifierList methodParameterModifierList = lightParameter.getModifierList();
|
||||||
if (null != parameter) {
|
|
||||||
PsiModifierList methodParameterModifierList = parameter.getModifierList();
|
|
||||||
LombokCopyableAnnotations.copyOnXAnnotations(psiAnnotation, methodParameterModifierList, "onParam");
|
LombokCopyableAnnotations.copyOnXAnnotations(psiAnnotation, methodParameterModifierList, "onParam");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull String createEqualsBlockString(@NotNull PsiClass psiClass,
|
private @NotNull String createEqualsBlockString(@NotNull PsiClass psiClass,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import de.plushnikov.intellij.plugin.processor.handler.EqualsAndHashCodeToString
|
|||||||
import de.plushnikov.intellij.plugin.processor.handler.EqualsAndHashCodeToStringHandler.MemberInfo;
|
import de.plushnikov.intellij.plugin.processor.handler.EqualsAndHashCodeToStringHandler.MemberInfo;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
||||||
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
||||||
|
import de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil;
|
import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil;
|
||||||
import de.plushnikov.intellij.plugin.util.PsiClassUtil;
|
import de.plushnikov.intellij.plugin.util.PsiClassUtil;
|
||||||
import de.plushnikov.intellij.plugin.util.PsiMethodUtil;
|
import de.plushnikov.intellij.plugin.util.PsiMethodUtil;
|
||||||
@@ -114,12 +115,16 @@ public final class ToStringProcessor extends AbstractClassProcessor {
|
|||||||
final String paramString = createParamString(psiClass, memberInfos, psiAnnotation, forceCallSuper);
|
final String paramString = createParamString(psiClass, memberInfos, psiAnnotation, forceCallSuper);
|
||||||
final String blockText = String.format("return \"%s(%s)\";", getSimpleClassName(psiClass), paramString);
|
final String blockText = String.format("return \"%s(%s)\";", getSimpleClassName(psiClass), paramString);
|
||||||
|
|
||||||
return new LombokLightMethodBuilder(psiManager, TO_STRING_METHOD_NAME)
|
final LombokLightMethodBuilder methodBuilder = new LombokLightMethodBuilder(psiManager, TO_STRING_METHOD_NAME)
|
||||||
.withMethodReturnType(PsiType.getJavaLangString(psiManager, GlobalSearchScope.allScope(psiClass.getProject())))
|
.withMethodReturnType(PsiType.getJavaLangString(psiManager, GlobalSearchScope.allScope(psiClass.getProject())))
|
||||||
.withContainingClass(psiClass)
|
.withContainingClass(psiClass)
|
||||||
.withNavigationElement(psiAnnotation)
|
.withNavigationElement(psiAnnotation)
|
||||||
.withModifier(PsiModifier.PUBLIC)
|
.withModifier(PsiModifier.PUBLIC)
|
||||||
.withBodyText(blockText);
|
.withBodyText(blockText);
|
||||||
|
|
||||||
|
LombokAddNullAnnotations.createRelevantNonNullAnnotation(psiClass, methodBuilder);
|
||||||
|
|
||||||
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getSimpleClassName(@NotNull PsiClass psiClass) {
|
private static String getSimpleClassName(@NotNull PsiClass psiClass) {
|
||||||
@@ -127,7 +132,7 @@ public final class ToStringProcessor extends AbstractClassProcessor {
|
|||||||
|
|
||||||
PsiClass containingClass = psiClass;
|
PsiClass containingClass = psiClass;
|
||||||
do {
|
do {
|
||||||
if (psiClassName.length() > 0) {
|
if (!psiClassName.isEmpty()) {
|
||||||
psiClassName.insert(0, '.');
|
psiClassName.insert(0, '.');
|
||||||
}
|
}
|
||||||
psiClassName.insert(0, containingClass.getName());
|
psiClassName.insert(0, containingClass.getName());
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import de.plushnikov.intellij.plugin.processor.clazz.AbstractClassProcessor;
|
|||||||
import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo;
|
import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
||||||
|
import de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
||||||
import de.plushnikov.intellij.plugin.util.*;
|
import de.plushnikov.intellij.plugin.util.*;
|
||||||
@@ -114,12 +115,12 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro
|
|||||||
if (null != existedStaticMethod) {
|
if (null != existedStaticMethod) {
|
||||||
if (paramTypes.isEmpty()) {
|
if (paramTypes.isEmpty()) {
|
||||||
builder.addErrorMessage("inspection.message.method.s.matched.static.constructor.name.already.defined", staticConstructorName)
|
builder.addErrorMessage("inspection.message.method.s.matched.static.constructor.name.already.defined", staticConstructorName)
|
||||||
.withLocalQuickFixes(()->new SafeDeleteFix(existedStaticMethod));
|
.withLocalQuickFixes(() -> new SafeDeleteFix(existedStaticMethod));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.addErrorMessage("inspection.message.method.s.with.d.parameters.matched.static.constructor.name.already.defined",
|
builder.addErrorMessage("inspection.message.method.s.with.d.parameters.matched.static.constructor.name.already.defined",
|
||||||
staticConstructorName, paramTypes.size())
|
staticConstructorName, paramTypes.size())
|
||||||
.withLocalQuickFixes(()->new SafeDeleteFix(existedStaticMethod));
|
.withLocalQuickFixes(() -> new SafeDeleteFix(existedStaticMethod));
|
||||||
}
|
}
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
@@ -147,11 +148,11 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro
|
|||||||
if (null != existedMethod) {
|
if (null != existedMethod) {
|
||||||
if (paramTypes.isEmpty()) {
|
if (paramTypes.isEmpty()) {
|
||||||
builder.addErrorMessage("inspection.message.constructor.without.parameters.already.defined")
|
builder.addErrorMessage("inspection.message.constructor.without.parameters.already.defined")
|
||||||
.withLocalQuickFixes(()-> new SafeDeleteFix(existedMethod));
|
.withLocalQuickFixes(() -> new SafeDeleteFix(existedMethod));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builder.addErrorMessage("inspection.message.constructor.with.d.parameters.already.defined", paramTypes.size())
|
builder.addErrorMessage("inspection.message.constructor.with.d.parameters.already.defined", paramTypes.size())
|
||||||
.withLocalQuickFixes(()->new SafeDeleteFix(existedMethod));
|
.withLocalQuickFixes(() -> new SafeDeleteFix(existedMethod));
|
||||||
}
|
}
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
@@ -349,7 +350,8 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro
|
|||||||
final LombokLightParameter parameter = new LombokLightParameter(parameterName, parameterField.getType(), constructorBuilder);
|
final LombokLightParameter parameter = new LombokLightParameter(parameterName, parameterField.getType(), constructorBuilder);
|
||||||
parameter.setNavigationElement(parameterField);
|
parameter.setNavigationElement(parameterField);
|
||||||
constructorBuilder.withParameter(parameter);
|
constructorBuilder.withParameter(parameter);
|
||||||
LombokCopyableAnnotations.copyCopyableAnnotations(parameterField, parameter.getModifierList(), LombokCopyableAnnotations.BASE_COPYABLE);
|
LombokCopyableAnnotations.copyCopyableAnnotations(parameterField, parameter.getModifierList(),
|
||||||
|
LombokCopyableAnnotations.BASE_COPYABLE);
|
||||||
|
|
||||||
blockText.append(String.format("this.%s = %s;\n", parameterField.getName(), parameterName));
|
blockText.append(String.format("this.%s = %s;\n", parameterField.getName(), parameterName));
|
||||||
}
|
}
|
||||||
@@ -404,6 +406,8 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro
|
|||||||
final String codeBlockText = createStaticCodeBlockText(returnType, useJavaDefaults, methodBuilder.getParameterList());
|
final String codeBlockText = createStaticCodeBlockText(returnType, useJavaDefaults, methodBuilder.getParameterList());
|
||||||
methodBuilder.withBodyText(codeBlockText);
|
methodBuilder.withBodyText(codeBlockText);
|
||||||
|
|
||||||
|
LombokAddNullAnnotations.createRelevantNonNullAnnotation(psiClass, methodBuilder);
|
||||||
|
|
||||||
return methodBuilder;
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
|||||||
import de.plushnikov.intellij.plugin.psi.LombokLightModifierList;
|
import de.plushnikov.intellij.plugin.psi.LombokLightModifierList;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
||||||
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
||||||
|
import de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
||||||
import de.plushnikov.intellij.plugin.util.LombokProcessorUtil;
|
import de.plushnikov.intellij.plugin.util.LombokProcessorUtil;
|
||||||
@@ -144,6 +145,10 @@ public final class SetterFieldProcessor extends AbstractFieldProcessor {
|
|||||||
final String codeBlockText = createCodeBlockText(psiField, psiClass, returnType, isStatic, setterParameter);
|
final String codeBlockText = createCodeBlockText(psiField, psiClass, returnType, isStatic, setterParameter);
|
||||||
methodBuilder.withBodyText(codeBlockText);
|
methodBuilder.withBodyText(codeBlockText);
|
||||||
|
|
||||||
|
if (!PsiTypes.voidType().equals(returnType)) {
|
||||||
|
LombokAddNullAnnotations.createRelevantNonNullAnnotation(psiClass, methodBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
return methodBuilder;
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
|||||||
import de.plushnikov.intellij.plugin.psi.LombokLightModifierList;
|
import de.plushnikov.intellij.plugin.psi.LombokLightModifierList;
|
||||||
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
||||||
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory;
|
||||||
|
import de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokCopyableAnnotations;
|
||||||
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
||||||
import de.plushnikov.intellij.plugin.util.LombokProcessorUtil;
|
import de.plushnikov.intellij.plugin.util.LombokProcessorUtil;
|
||||||
@@ -222,6 +223,8 @@ public final class WitherFieldProcessor extends AbstractFieldProcessor {
|
|||||||
paramString);
|
paramString);
|
||||||
methodBuilder.withBodyText(blockText);
|
methodBuilder.withBodyText(blockText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LombokAddNullAnnotations.createRelevantNonNullAnnotation(psiFieldContainingClass, methodBuilder);
|
||||||
}
|
}
|
||||||
return methodBuilder;
|
return methodBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.intellij.psi.impl.source.PsiClassReferenceType;
|
|||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import de.plushnikov.intellij.plugin.LombokClassNames;
|
import de.plushnikov.intellij.plugin.LombokClassNames;
|
||||||
import de.plushnikov.intellij.plugin.lombokconfig.ConfigDiscovery;
|
import de.plushnikov.intellij.plugin.lombokconfig.ConfigDiscovery;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.LombokNullAnnotationLibrary;
|
||||||
import de.plushnikov.intellij.plugin.problem.ProblemProcessingSink;
|
import de.plushnikov.intellij.plugin.problem.ProblemProcessingSink;
|
||||||
import de.plushnikov.intellij.plugin.problem.ProblemSink;
|
import de.plushnikov.intellij.plugin.problem.ProblemSink;
|
||||||
import de.plushnikov.intellij.plugin.processor.JacksonizedProcessor;
|
import de.plushnikov.intellij.plugin.processor.JacksonizedProcessor;
|
||||||
@@ -34,6 +35,7 @@ import java.util.stream.Stream;
|
|||||||
import static com.intellij.openapi.util.text.StringUtil.capitalize;
|
import static com.intellij.openapi.util.text.StringUtil.capitalize;
|
||||||
import static com.intellij.openapi.util.text.StringUtil.replace;
|
import static com.intellij.openapi.util.text.StringUtil.replace;
|
||||||
import static de.plushnikov.intellij.plugin.lombokconfig.ConfigKey.BUILDER_CLASS_NAME;
|
import static de.plushnikov.intellij.plugin.lombokconfig.ConfigKey.BUILDER_CLASS_NAME;
|
||||||
|
import static de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations.createRelevantNonNullAnnotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler methods for Builder-processing
|
* Handler methods for Builder-processing
|
||||||
@@ -410,6 +412,9 @@ public class BuilderHandler {
|
|||||||
if (null == psiMethod || psiMethod.isConstructor() || psiMethod.hasModifierProperty(PsiModifier.STATIC)) {
|
if (null == psiMethod || psiMethod.isConstructor() || psiMethod.hasModifierProperty(PsiModifier.STATIC)) {
|
||||||
methodBuilder.withModifier(PsiModifier.STATIC);
|
methodBuilder.withModifier(PsiModifier.STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(containingClass, methodBuilder);
|
||||||
|
|
||||||
return Optional.of(methodBuilder);
|
return Optional.of(methodBuilder);
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@@ -457,10 +462,11 @@ public class BuilderHandler {
|
|||||||
|
|
||||||
final String canonicalText = psiTypeWithGenerics.getCanonicalText(false);
|
final String canonicalText = psiTypeWithGenerics.getCanonicalText(false);
|
||||||
final String blockText;
|
final String blockText;
|
||||||
if(toBuilderAppendStatements.isEmpty()) {
|
if (toBuilderAppendStatements.isEmpty()) {
|
||||||
blockText = toBuilderPrependStatements +
|
blockText = toBuilderPrependStatements +
|
||||||
String.format("\nreturn new %s()%s;", canonicalText, toBuilderMethodCalls);
|
String.format("\nreturn new %s()%s;", canonicalText, toBuilderMethodCalls);
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
blockText = toBuilderPrependStatements +
|
blockText = toBuilderPrependStatements +
|
||||||
String.format("\nfinal %s %s = new %s()%s;\n", canonicalText, BUILDER_TEMP_VAR, canonicalText, toBuilderMethodCalls) +
|
String.format("\nfinal %s %s = new %s()%s;\n", canonicalText, BUILDER_TEMP_VAR, canonicalText, toBuilderMethodCalls) +
|
||||||
toBuilderAppendStatements +
|
toBuilderAppendStatements +
|
||||||
@@ -469,6 +475,8 @@ public class BuilderHandler {
|
|||||||
|
|
||||||
methodBuilder.withBodyText(blockText);
|
methodBuilder.withBodyText(blockText);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(containingClass, methodBuilder);
|
||||||
|
|
||||||
return Optional.of(methodBuilder);
|
return Optional.of(methodBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,12 +511,14 @@ public class BuilderHandler {
|
|||||||
final PsiSubstitutor builderSubstitutor = getBuilderSubstitutor(psiClass, builderClass);
|
final PsiSubstitutor builderSubstitutor = getBuilderSubstitutor(psiClass, builderClass);
|
||||||
final String accessVisibility = getBuilderInnerAccessVisibility(psiAnnotation);
|
final String accessVisibility = getBuilderInnerAccessVisibility(psiAnnotation);
|
||||||
final String setterPrefix = getSetterPrefix(psiAnnotation);
|
final String setterPrefix = getSetterPrefix(psiAnnotation);
|
||||||
|
final LombokNullAnnotationLibrary nullAnnotationLibrary = ConfigDiscovery.getInstance().getAddNullAnnotationLombokConfigProperty(psiClass);
|
||||||
|
|
||||||
return createBuilderInfos(psiClass, psiClassMethod)
|
return createBuilderInfos(psiClass, psiClassMethod)
|
||||||
.map(info -> info.withSubstitutor(builderSubstitutor))
|
.map(info -> info.withSubstitutor(builderSubstitutor))
|
||||||
.map(info -> info.withBuilderClass(builderClass))
|
.map(info -> info.withBuilderClass(builderClass))
|
||||||
.map(info -> info.withVisibilityModifier(accessVisibility))
|
.map(info -> info.withVisibilityModifier(accessVisibility))
|
||||||
.map(info -> info.withSetterPrefix(setterPrefix))
|
.map(info -> info.withSetterPrefix(setterPrefix))
|
||||||
|
.map(info -> info.withNullAnnotationLibrary(nullAnnotationLibrary))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,6 +726,10 @@ public class BuilderHandler {
|
|||||||
createBuildMethodCodeBlockText(psiMethod, builderClass, returnType, buildMethodPrepare, buildMethodParameters);
|
createBuildMethodCodeBlockText(psiMethod, builderClass, returnType, buildMethodPrepare, buildMethodParameters);
|
||||||
methodBuilder.withBodyText(codeBlockText);
|
methodBuilder.withBodyText(codeBlockText);
|
||||||
|
|
||||||
|
if (!PsiTypes.voidType().equals(returnType)) {
|
||||||
|
createRelevantNonNullAnnotation(builderClass, methodBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
Optional<PsiMethod> definedConstructor = Optional.ofNullable(psiMethod);
|
Optional<PsiMethod> definedConstructor = Optional.ofNullable(psiMethod);
|
||||||
if (definedConstructor.isEmpty()) {
|
if (definedConstructor.isEmpty()) {
|
||||||
definedConstructor = getExistingConstructorForParameters(parentClass, builderInfos);
|
definedConstructor = getExistingConstructorForParameters(parentClass, builderInfos);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.intellij.psi.*;
|
|||||||
import com.intellij.psi.impl.PsiImplUtil;
|
import com.intellij.psi.impl.PsiImplUtil;
|
||||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||||
import de.plushnikov.intellij.plugin.LombokClassNames;
|
import de.plushnikov.intellij.plugin.LombokClassNames;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.LombokNullAnnotationLibrary;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.LombokNullAnnotationLibraryDefned;
|
||||||
import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo;
|
import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo;
|
||||||
import de.plushnikov.intellij.plugin.processor.handler.singular.BuilderElementHandler;
|
import de.plushnikov.intellij.plugin.processor.handler.singular.BuilderElementHandler;
|
||||||
import de.plushnikov.intellij.plugin.processor.handler.singular.SingularHandlerFactory;
|
import de.plushnikov.intellij.plugin.processor.handler.singular.SingularHandlerFactory;
|
||||||
@@ -52,6 +54,8 @@ public class BuilderInfo {
|
|||||||
private String instanceVariableName = "this";
|
private String instanceVariableName = "this";
|
||||||
private CapitalizationStrategy capitalizationStrategy;
|
private CapitalizationStrategy capitalizationStrategy;
|
||||||
|
|
||||||
|
private LombokNullAnnotationLibrary nullAnnotationLibrary;
|
||||||
|
|
||||||
public static BuilderInfo fromPsiParameter(@NotNull PsiParameter psiParameter) {
|
public static BuilderInfo fromPsiParameter(@NotNull PsiParameter psiParameter) {
|
||||||
final BuilderInfo result = new BuilderInfo();
|
final BuilderInfo result = new BuilderInfo();
|
||||||
|
|
||||||
@@ -63,6 +67,7 @@ public class BuilderInfo {
|
|||||||
|
|
||||||
result.fieldInBuilderName = psiParameter.getName();
|
result.fieldInBuilderName = psiParameter.getName();
|
||||||
result.capitalizationStrategy = CapitalizationStrategy.defaultValue();
|
result.capitalizationStrategy = CapitalizationStrategy.defaultValue();
|
||||||
|
result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE;
|
||||||
|
|
||||||
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiParameter, LombokClassNames.SINGULAR);
|
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiParameter, LombokClassNames.SINGULAR);
|
||||||
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiParameter, null!=result.singularAnnotation);
|
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiParameter, null!=result.singularAnnotation);
|
||||||
@@ -86,6 +91,7 @@ public class BuilderInfo {
|
|||||||
final AccessorsInfo accessorsInfo = AccessorsInfo.buildFor(psiField);
|
final AccessorsInfo accessorsInfo = AccessorsInfo.buildFor(psiField);
|
||||||
result.fieldInBuilderName = accessorsInfo.removePrefix(psiField.getName());
|
result.fieldInBuilderName = accessorsInfo.removePrefix(psiField.getName());
|
||||||
result.capitalizationStrategy = accessorsInfo.getCapitalizationStrategy();
|
result.capitalizationStrategy = accessorsInfo.getCapitalizationStrategy();
|
||||||
|
result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE;
|
||||||
|
|
||||||
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.SINGULAR);
|
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.SINGULAR);
|
||||||
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiField, null!=result.singularAnnotation);
|
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiField, null!=result.singularAnnotation);
|
||||||
@@ -104,6 +110,7 @@ public class BuilderInfo {
|
|||||||
|
|
||||||
result.fieldInBuilderName = psiRecordComponent.getName();
|
result.fieldInBuilderName = psiRecordComponent.getName();
|
||||||
result.capitalizationStrategy = CapitalizationStrategy.defaultValue();
|
result.capitalizationStrategy = CapitalizationStrategy.defaultValue();
|
||||||
|
result.nullAnnotationLibrary = LombokNullAnnotationLibraryDefned.NONE;
|
||||||
|
|
||||||
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiRecordComponent, LombokClassNames.SINGULAR);
|
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiRecordComponent, LombokClassNames.SINGULAR);
|
||||||
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiRecordComponent, null!=result.singularAnnotation);
|
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiRecordComponent, null!=result.singularAnnotation);
|
||||||
@@ -156,6 +163,11 @@ public class BuilderInfo {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BuilderInfo withNullAnnotationLibrary(LombokNullAnnotationLibrary annotationLibrary) {
|
||||||
|
nullAnnotationLibrary = annotationLibrary;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean useForBuilder() {
|
public boolean useForBuilder() {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
|
|
||||||
@@ -201,6 +213,10 @@ public class BuilderInfo {
|
|||||||
return capitalizationStrategy;
|
return capitalizationStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LombokNullAnnotationLibrary getNullAnnotationLibrary() {
|
||||||
|
return nullAnnotationLibrary;
|
||||||
|
}
|
||||||
|
|
||||||
public PsiType getFieldType() {
|
public PsiType getFieldType() {
|
||||||
return fieldInBuilderType;
|
return fieldInBuilderType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import java.util.Optional;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations.createRelevantNonNullAnnotation;
|
||||||
|
|
||||||
public class SuperBuilderHandler extends BuilderHandler {
|
public class SuperBuilderHandler extends BuilderHandler {
|
||||||
|
|
||||||
private static final String SELF_METHOD = "self";
|
private static final String SELF_METHOD = "self";
|
||||||
@@ -136,6 +138,8 @@ public class SuperBuilderHandler extends BuilderHandler {
|
|||||||
final String blockText = String.format("return new %s();", PsiClassUtil.getTypeWithGenerics(builderImplClass).getCanonicalText(false));
|
final String blockText = String.format("return new %s();", PsiClassUtil.getTypeWithGenerics(builderImplClass).getCanonicalText(false));
|
||||||
methodBuilder.withBodyText(blockText);
|
methodBuilder.withBodyText(blockText);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(containingClass, methodBuilder);
|
||||||
|
|
||||||
return Optional.of(methodBuilder);
|
return Optional.of(methodBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +163,8 @@ public class SuperBuilderHandler extends BuilderHandler {
|
|||||||
FILL_VALUES_METHOD_NAME);
|
FILL_VALUES_METHOD_NAME);
|
||||||
methodBuilder.withBodyText(blockText);
|
methodBuilder.withBodyText(blockText);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(containingClass, methodBuilder);
|
||||||
|
|
||||||
return Optional.of(methodBuilder);
|
return Optional.of(methodBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,6 +370,9 @@ public class SuperBuilderHandler extends BuilderHandler {
|
|||||||
.withNavigationElement(psiClass)
|
.withNavigationElement(psiClass)
|
||||||
.withModifier(PsiModifier.ABSTRACT)
|
.withModifier(PsiModifier.ABSTRACT)
|
||||||
.withModifier(PsiModifier.PUBLIC);
|
.withModifier(PsiModifier.PUBLIC);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(psiClass, buildMethod);
|
||||||
|
|
||||||
result.add(buildMethod);
|
result.add(buildMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,6 +460,9 @@ public class SuperBuilderHandler extends BuilderHandler {
|
|||||||
final String buildCodeBlockText =
|
final String buildCodeBlockText =
|
||||||
String.format("return new %s(this);", PsiClassUtil.getTypeWithGenerics(psiClass).getCanonicalText(false));
|
String.format("return new %s(this);", PsiClassUtil.getTypeWithGenerics(psiClass).getCanonicalText(false));
|
||||||
buildMethod.withBodyText(buildCodeBlockText);
|
buildMethod.withBodyText(buildCodeBlockText);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(psiClass, buildMethod);
|
||||||
|
|
||||||
result.add(buildMethod);
|
result.add(buildMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations.createRelevantNonNullAnnotation;
|
||||||
|
|
||||||
public abstract class AbstractSingularHandler implements BuilderElementHandler {
|
public abstract class AbstractSingularHandler implements BuilderElementHandler {
|
||||||
|
|
||||||
private static final String BUILDER_TEMP_VAR = "builder";
|
private static final String BUILDER_TEMP_VAR = "builder";
|
||||||
@@ -70,6 +72,8 @@ public abstract class AbstractSingularHandler implements BuilderElementHandler {
|
|||||||
final String oneMethodBody = getOneMethodBody(singularName, info);
|
final String oneMethodBody = getOneMethodBody(singularName, info);
|
||||||
oneAddMethodBuilder.withBodyText(oneMethodBody);
|
oneAddMethodBuilder.withBodyText(oneMethodBody);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(info.getNullAnnotationLibrary(), oneAddMethodBuilder);
|
||||||
|
|
||||||
methods.add(oneAddMethodBuilder);
|
methods.add(oneAddMethodBuilder);
|
||||||
|
|
||||||
final LombokLightMethodBuilder allAddMethodBuilder = new LombokLightMethodBuilder(
|
final LombokLightMethodBuilder allAddMethodBuilder = new LombokLightMethodBuilder(
|
||||||
@@ -88,6 +92,8 @@ public abstract class AbstractSingularHandler implements BuilderElementHandler {
|
|||||||
final String allMethodBody = getAllMethodBody(fieldName, info);
|
final String allMethodBody = getAllMethodBody(fieldName, info);
|
||||||
allAddMethodBuilder.withBodyText(allMethodBody);
|
allAddMethodBuilder.withBodyText(allMethodBody);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(info.getNullAnnotationLibrary(), allAddMethodBuilder);
|
||||||
|
|
||||||
methods.add(allAddMethodBuilder);
|
methods.add(allAddMethodBuilder);
|
||||||
|
|
||||||
final LombokLightMethodBuilder clearMethodBuilder = new LombokLightMethodBuilder(
|
final LombokLightMethodBuilder clearMethodBuilder = new LombokLightMethodBuilder(
|
||||||
@@ -100,6 +106,8 @@ public abstract class AbstractSingularHandler implements BuilderElementHandler {
|
|||||||
final String clearMethodBlockText = getClearMethodBody(info);
|
final String clearMethodBlockText = getClearMethodBody(info);
|
||||||
clearMethodBuilder.withBodyText(clearMethodBlockText);
|
clearMethodBuilder.withBodyText(clearMethodBlockText);
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(info.getNullAnnotationLibrary(), clearMethodBuilder);
|
||||||
|
|
||||||
methods.add(clearMethodBuilder);
|
methods.add(clearMethodBuilder);
|
||||||
|
|
||||||
return methods;
|
return methods;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations.createRelevantNonNullAnnotation;
|
||||||
|
|
||||||
class NonSingularHandler implements BuilderElementHandler {
|
class NonSingularHandler implements BuilderElementHandler {
|
||||||
NonSingularHandler() {
|
NonSingularHandler() {
|
||||||
}
|
}
|
||||||
@@ -50,6 +52,9 @@ class NonSingularHandler implements BuilderElementHandler {
|
|||||||
if(info.getVariable() instanceof PsiField psiField) {
|
if(info.getVariable() instanceof PsiField psiField) {
|
||||||
LombokCopyableAnnotations.copyCopyableAnnotations(psiField, methodBuilder.getModifierList(), LombokCopyableAnnotations.COPY_TO_SETTER);
|
LombokCopyableAnnotations.copyCopyableAnnotations(psiField, methodBuilder.getModifierList(), LombokCopyableAnnotations.COPY_TO_SETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createRelevantNonNullAnnotation(info.getNullAnnotationLibrary(), methodBuilder);
|
||||||
|
|
||||||
return Collections.singleton(methodBuilder);
|
return Collections.singleton(methodBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ public class LombokLightFieldBuilder extends LightFieldBuilder implements Synthe
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LombokLightFieldBuilder withAnnotation(@NotNull String annotation) {
|
||||||
|
myModifierList.addAnnotation(annotation);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public LombokLightFieldBuilder withNavigationElement(PsiElement navigationElement) {
|
public LombokLightFieldBuilder withNavigationElement(PsiElement navigationElement) {
|
||||||
setNavigationElement(navigationElement);
|
setNavigationElement(navigationElement);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.intellij.psi.impl.CheckUtil;
|
|||||||
import com.intellij.psi.impl.light.LightMethodBuilder;
|
import com.intellij.psi.impl.light.LightMethodBuilder;
|
||||||
import com.intellij.psi.impl.light.LightModifierList;
|
import com.intellij.psi.impl.light.LightModifierList;
|
||||||
import com.intellij.psi.impl.light.LightTypeParameterListBuilder;
|
import com.intellij.psi.impl.light.LightTypeParameterListBuilder;
|
||||||
import com.intellij.util.Function;
|
|
||||||
import com.intellij.util.IncorrectOperationException;
|
import com.intellij.util.IncorrectOperationException;
|
||||||
import de.plushnikov.intellij.plugin.extension.LombokInferredAnnotationProvider;
|
import de.plushnikov.intellij.plugin.extension.LombokInferredAnnotationProvider;
|
||||||
import icons.LombokIcons;
|
import icons.LombokIcons;
|
||||||
@@ -18,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Plushnikov Michail
|
* @author Plushnikov Michail
|
||||||
@@ -162,7 +162,7 @@ public class LombokLightMethodBuilder extends LightMethodBuilder implements Synt
|
|||||||
Function<LombokLightMethodBuilder, String> builderBodyFunction = myBuilderBodyFunction;
|
Function<LombokLightMethodBuilder, String> builderBodyFunction = myBuilderBodyFunction;
|
||||||
if (null == myBodyCodeBlock && (bodyAsText != null || builderBodyFunction != null)) {
|
if (null == myBodyCodeBlock && (bodyAsText != null || builderBodyFunction != null)) {
|
||||||
if (bodyAsText == null) {
|
if (bodyAsText == null) {
|
||||||
bodyAsText = builderBodyFunction.fun(this);
|
bodyAsText = builderBodyFunction.apply(this);
|
||||||
}
|
}
|
||||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getProject());
|
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getProject());
|
||||||
myBodyCodeBlock = elementFactory.createCodeBlockFromText("{" + bodyAsText + "}", this);
|
myBodyCodeBlock = elementFactory.createCodeBlockFromText("{" + bodyAsText + "}", this);
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ public class LombokLightParameter extends LightParameter implements SyntheticEle
|
|||||||
return (LombokLightModifierList)super.getModifierList();
|
return (LombokLightModifierList)super.getModifierList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LombokLightParameter withAnnotation(@NotNull String annotation) {
|
||||||
|
getModifierList().addAnnotation(annotation);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextRange getTextRange() {
|
public TextRange getTextRange() {
|
||||||
TextRange r = super.getTextRange();
|
TextRange r = super.getTextRange();
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package de.plushnikov.intellij.plugin.thirdparty;
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
|
import com.intellij.psi.PsiClass;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.ConfigDiscovery;
|
||||||
|
import de.plushnikov.intellij.plugin.lombokconfig.LombokNullAnnotationLibrary;
|
||||||
|
import de.plushnikov.intellij.plugin.psi.LombokLightFieldBuilder;
|
||||||
|
import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder;
|
||||||
|
import de.plushnikov.intellij.plugin.psi.LombokLightParameter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public final class LombokAddNullAnnotations {
|
||||||
|
public static LombokLightMethodBuilder createRelevantNonNullAnnotation(@NotNull PsiClass psiClass, @NotNull LombokLightMethodBuilder methodBuilder) {
|
||||||
|
final LombokNullAnnotationLibrary annotationLibrary = ConfigDiscovery.getInstance().getAddNullAnnotationLombokConfigProperty(psiClass);
|
||||||
|
return createRelevantNonNullAnnotation(annotationLibrary, methodBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LombokLightMethodBuilder createRelevantNonNullAnnotation(@NotNull LombokNullAnnotationLibrary annotationLibrary,
|
||||||
|
@NotNull LombokLightMethodBuilder methodBuilder) {
|
||||||
|
if (StringUtil.isNotEmpty(annotationLibrary.getNonNullAnnotation())) {
|
||||||
|
methodBuilder.withAnnotation(annotationLibrary.getNonNullAnnotation());
|
||||||
|
}
|
||||||
|
return methodBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LombokLightFieldBuilder createRelevantNonNullAnnotation(@NotNull PsiClass psiClass, @NotNull LombokLightFieldBuilder fieldBuilder) {
|
||||||
|
final LombokNullAnnotationLibrary annotationLibrary = ConfigDiscovery.getInstance().getAddNullAnnotationLombokConfigProperty(psiClass);
|
||||||
|
if (StringUtil.isNotEmpty(annotationLibrary.getNonNullAnnotation())) {
|
||||||
|
fieldBuilder.withAnnotation(annotationLibrary.getNonNullAnnotation());
|
||||||
|
}
|
||||||
|
return fieldBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LombokLightParameter createRelevantNullableAnnotation(@NotNull PsiClass psiClass,
|
||||||
|
@NotNull LombokLightParameter lightParameter) {
|
||||||
|
final LombokNullAnnotationLibrary annotationLibrary = ConfigDiscovery.getInstance().getAddNullAnnotationLombokConfigProperty(psiClass);
|
||||||
|
if (StringUtil.isNotEmpty(annotationLibrary.getNullableAnnotation())) {
|
||||||
|
lightParameter.withAnnotation(annotationLibrary.getNullableAnnotation());
|
||||||
|
}
|
||||||
|
return lightParameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ CLEAR="clear"
|
|||||||
KEY_CHARACTER=([:letter:] | [:digit:] | ".")+
|
KEY_CHARACTER=([:letter:] | [:digit:] | ".")+
|
||||||
SEPARATOR=[\ \t]* [=] [\ \t]*
|
SEPARATOR=[\ \t]* [=] [\ \t]*
|
||||||
SIGN=[\ \t]*[\-\+]
|
SIGN=[\ \t]*[\-\+]
|
||||||
VALUE_CHARACTER=[^:=\n\r\f\\] | "\\"{CRLF} | "\\".
|
VALUE_CHARACTER=[^:=\n\r\f\\] | "\\"{CRLF} | "\\". | :
|
||||||
|
|
||||||
%state IN_VALUE
|
%state IN_VALUE
|
||||||
%state IN_KEY_VALUE_SEPARATOR
|
%state IN_KEY_VALUE_SEPARATOR
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||||
package com.intellij.java.lomboktest;
|
package com.intellij.java.lomboktest;
|
||||||
|
|
||||||
import com.intellij.codeInsight.Nullability;
|
|
||||||
import com.intellij.codeInsight.NullableNotNullManager;
|
import com.intellij.codeInsight.NullableNotNullManager;
|
||||||
import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
|
import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass;
|
||||||
|
import com.intellij.psi.PsiMethod;
|
||||||
|
import com.intellij.psi.PsiParameter;
|
||||||
import com.intellij.testFramework.LightProjectDescriptor;
|
import com.intellij.testFramework.LightProjectDescriptor;
|
||||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||||
import de.plushnikov.intellij.plugin.LombokClassNames;
|
import de.plushnikov.intellij.plugin.LombokClassNames;
|
||||||
import de.plushnikov.intellij.plugin.LombokTestUtil;
|
import de.plushnikov.intellij.plugin.LombokTestUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.intellij.codeInsight.Nullability.NOT_NULL;
|
||||||
|
import static com.intellij.codeInsight.Nullability.NULLABLE;
|
||||||
|
|
||||||
public class LombokNonNullManagerTest extends LightJavaCodeInsightFixtureTestCase {
|
public class LombokNonNullManagerTest extends LightJavaCodeInsightFixtureTestCase {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
@@ -31,7 +36,97 @@ public class LombokNonNullManagerTest extends LightJavaCodeInsightFixtureTestCas
|
|||||||
private String test(@NonNull Integer param) {
|
private String test(@NonNull Integer param) {
|
||||||
return String.valueOf(param.hashCode());
|
return String.valueOf(param.hashCode());
|
||||||
}}""");
|
}}""");
|
||||||
assertEquals(Nullability.NOT_NULL, DfaPsiUtil.getTypeNullability(clazz.getMethods()[0].getReturnType()));
|
assertEquals(NOT_NULL, DfaPsiUtil.getTypeNullability(clazz.getMethods()[0].getReturnType()));
|
||||||
assertEquals(Nullability.NOT_NULL, DfaPsiUtil.getTypeNullability(clazz.getMethods()[0].getParameterList().getParameter(0).getType()));
|
assertEquals(NOT_NULL, DfaPsiUtil.getTypeNullability(clazz.getMethods()[0].getParameterList().getParameter(0).getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testLombokAddNullAnnotationJavaxConfigProperty() {
|
||||||
|
doAddNullAnnotationTest("javax");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testLombokAddNullAnnotationJetbrainsConfigProperty() {
|
||||||
|
doAddNullAnnotationTest("jetbrains");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testLombokAddNullAnnotationCustomConfigProperty() {
|
||||||
|
doAddNullAnnotationTest("custom:lombok.NonNull:org.jetbrains.annotations.Nullable");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doAddNullAnnotationTest(String addNullAnnotation) {
|
||||||
|
myFixture.addFileToProject("lombok.config", """
|
||||||
|
lombok.addNullAnnotations = #PLACEHOLDER#
|
||||||
|
config.stopBubbling = true
|
||||||
|
""".replace("#PLACEHOLDER#", addNullAnnotation));
|
||||||
|
|
||||||
|
myFixture.addClass("""
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
public class App {
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public static class MyObjectB {
|
||||||
|
private String myString;
|
||||||
|
private String nonNullString;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
public static class MyObjectS {
|
||||||
|
private String myString;
|
||||||
|
private String nonNullString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
final MyObjectB myObjectB = MyObjectB.builder()
|
||||||
|
.nonNullString("someString builder")
|
||||||
|
.myString("myString builder")
|
||||||
|
.build();
|
||||||
|
System.out.println(myObjectB);
|
||||||
|
|
||||||
|
final MyObjectS myObjectS = MyObjectS.builder()
|
||||||
|
.nonNullString("someString super builder")
|
||||||
|
.myString("myString super builder")
|
||||||
|
.build();
|
||||||
|
System.out.println(myObjectS);
|
||||||
|
}
|
||||||
|
}""");
|
||||||
|
|
||||||
|
final PsiClass myObjectBClass = myFixture.findClass("App.MyObjectB");
|
||||||
|
final PsiClass myObjectBBuilderClass = myFixture.findClass("App.MyObjectB.MyObjectBBuilder");
|
||||||
|
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectBClass, "builder")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectBClass, "toString")));
|
||||||
|
|
||||||
|
assertEquals(NULLABLE, DfaPsiUtil.getElementNullability(null, findMethodParam(myObjectBClass, "equals", 0)));
|
||||||
|
assertEquals(NULLABLE, DfaPsiUtil.getElementNullability(null, findMethodParam(myObjectBClass, "canEqual", 0)));
|
||||||
|
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectBBuilderClass, "nonNullString")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectBBuilderClass, "myString")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectBBuilderClass, "build")));
|
||||||
|
|
||||||
|
|
||||||
|
final PsiClass myObjectSClass = myFixture.findClass("App.MyObjectS");
|
||||||
|
final PsiClass myObjectSBuilderClass = myFixture.findClass("App.MyObjectS.MyObjectSBuilder");
|
||||||
|
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectSClass, "builder")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectSClass, "toString")));
|
||||||
|
|
||||||
|
assertEquals(NULLABLE, DfaPsiUtil.getElementNullability(null, findMethodParam(myObjectSClass, "equals", 0)));
|
||||||
|
assertEquals(NULLABLE, DfaPsiUtil.getElementNullability(null, findMethodParam(myObjectSClass, "canEqual", 0)));
|
||||||
|
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectSBuilderClass, "nonNullString")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectSBuilderClass, "myString")));
|
||||||
|
assertEquals(NOT_NULL, DfaPsiUtil.getElementNullability(null, findMethod(myObjectSBuilderClass, "build")));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PsiMethod findMethod(PsiClass myObjectBClass, String name) {
|
||||||
|
return myObjectBClass.findMethodsByName(name, false)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static PsiParameter findMethodParam(PsiClass myObjectBClass, String name, int parameterIndex) {
|
||||||
|
return findMethod(myObjectBClass, name).getParameterList().getParameter(parameterIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package de.plushnikov.intellij.plugin.lombokconfig;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class LombokNullAnnotationLibraryCustomTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseCustom() {
|
||||||
|
String valueCustom = "custom:type_use:some.nonNull:some.nullable";
|
||||||
|
|
||||||
|
LombokNullAnnotationLibrary result = LombokNullAnnotationLibraryCustom.parseCustom(valueCustom);
|
||||||
|
|
||||||
|
assertNotNull(result, "The result should not be null");
|
||||||
|
assertTrue(result.isTypeUse());
|
||||||
|
assertEquals("some.nonNull", result.getNonNullAnnotation());
|
||||||
|
assertEquals("some.nullable", result.getNullableAnnotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseCustomWithoutType() {
|
||||||
|
String valueCustom = "custom:some.nonNull:some.nullable";
|
||||||
|
|
||||||
|
LombokNullAnnotationLibrary result = LombokNullAnnotationLibraryCustom.parseCustom(valueCustom);
|
||||||
|
|
||||||
|
assertNotNull(result, "The result should not be null");
|
||||||
|
assertFalse(result.isTypeUse());
|
||||||
|
assertEquals("some.nonNull", result.getNonNullAnnotation());
|
||||||
|
assertEquals("some.nullable", result.getNullableAnnotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseCustomWithoutCustom() {
|
||||||
|
String valueCustom = "type_use:some.nonNull:some.nullable";
|
||||||
|
|
||||||
|
LombokNullAnnotationLibrary result = LombokNullAnnotationLibraryCustom.parseCustom(valueCustom);
|
||||||
|
|
||||||
|
assertNull(result, "The result should be null as the input string doesn't start with 'custom:'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseCustomWithoutValidAnnotations() {
|
||||||
|
String valueCustom = "custom:type_use:some%nonNull:some.1nullable";
|
||||||
|
|
||||||
|
LombokNullAnnotationLibrary result = LombokNullAnnotationLibraryCustom.parseCustom(valueCustom);
|
||||||
|
|
||||||
|
assertNull(result, "The result should be null as the annotations are not valid");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user