@@ -100,15 +100,12 @@ static class RuleInfo {
100
100
this .intfClass = intfPackage + "." + intfClass ;
101
101
this .implClass = implPackage + "." + implClass ;
102
102
this .mixin = mixin ;
103
- //this.stubName = stubName;
104
- //this.classes = classes;
105
- //this.mixedAST = mixedAST;
106
103
}
107
104
}
108
105
109
106
@ NotNull
110
107
RuleInfo ruleInfo (BnfRule rule ) {
111
- return ObjectUtils . notNull (myRuleInfos .get (rule .getName ()));
108
+ return Objects . requireNonNull (myRuleInfos .get (rule .getName ()));
112
109
}
113
110
114
111
private final Map <String , RuleInfo > myRuleInfos = new TreeMap <>();
@@ -430,7 +427,7 @@ private void generateVisitor(String psiClass, Map<String, BnfRule> sortedRules)
430
427
String superIntf = ObjectUtils .notNull (ContainerUtil .getFirstItem (getRootAttribute (myFile , KnownAttribute .IMPLEMENTS )),
431
428
KnownAttribute .IMPLEMENTS .getDefaultValue ().get (0 )).second ;
432
429
Set <String > imports = new LinkedHashSet <>(Arrays .asList ("org.jetbrains.annotations.*" , PSI_ELEMENT_VISITOR_CLASS , superIntf ));
433
- MultiMap <String , String > supers = MultiMap . createSmart ();
430
+ MultiMap <String , String > supers = new MultiMap <> ();
434
431
for (BnfRule rule : sortedRules .values ()) {
435
432
supers .putValues (rule .getName (), getSuperInterfaceNames (myFile , rule , myIntfClassFormat ));
436
433
}
@@ -559,7 +556,7 @@ else if (!G.generateFQN) {
559
556
generateRootParserContent ();
560
557
}
561
558
for (String ruleName : ownRuleNames ) {
562
- BnfRule rule = ObjectUtils . assertNotNull (myFile .getRule (ruleName ));
559
+ BnfRule rule = Objects . requireNonNull (myFile .getRule (ruleName ));
563
560
if (Rule .isExternal (rule ) || Rule .isFake (rule )) continue ;
564
561
if (myExpressionHelper .getExpressionInfo (rule ) != null ) continue ;
565
562
out ("/* ********************************************************** */" );
@@ -611,7 +608,7 @@ private void generateRootParserContent() {
611
608
BnfRule rootRule = myFile .getRule (myGrammarRoot );
612
609
List <BnfRule > extraRoots = new ArrayList <>();
613
610
for (String ruleName : myRuleInfos .keySet ()) {
614
- BnfRule rule = ObjectUtils . assertNotNull (myFile .getRule (ruleName ));
611
+ BnfRule rule = Objects . requireNonNull (myFile .getRule (ruleName ));
615
612
if (getAttribute (rule , KnownAttribute .ELEMENT_TYPE ) != null ) continue ;
616
613
if (!RuleGraphHelper .hasElementType (rule )) continue ;
617
614
if (Rule .isFake (rule ) || Rule .isMeta (rule )) continue ;
@@ -1079,7 +1076,7 @@ public String generateFirstCheck(BnfRule rule, String frameName, boolean skipIfO
1079
1076
String t = firstToElementType (expressionString );
1080
1077
if (t == null ) return frameName ;
1081
1078
1082
- ConsumeType childConsumeType = getRuleConsumeType (ObjectUtils . notNull (Rule .of (expression )), rule );
1079
+ ConsumeType childConsumeType = getRuleConsumeType (Objects . requireNonNull (Rule .of (expression )), rule );
1083
1080
ConsumeType consumeType = ConsumeType .min (ruleConsumeType , childConsumeType );
1084
1081
ConsumeType existing = firstElementTypes .get (t );
1085
1082
firstElementTypes .put (t , ConsumeType .max (existing , consumeType ));
@@ -1409,7 +1406,7 @@ else if (nested instanceof BnfLiteralExpression) {
1409
1406
arguments .add (generateWrappedNodeCall (rule , nested , attributeName ));
1410
1407
}
1411
1408
else {
1412
- arguments .add (new TextArgument (argument .startsWith ("\ ' " ) ? GrammarUtil .unquote (argument ) : argument ));
1409
+ arguments .add (new TextArgument (argument .startsWith ("'" ) ? GrammarUtil .unquote (argument ) : argument ));
1413
1410
}
1414
1411
}
1415
1412
else if (nested instanceof BnfExternalExpression ) {
@@ -1562,7 +1559,7 @@ private void generateElementTypesHolder(String className, Map<String, BnfRule> s
1562
1559
else {
1563
1560
elementCreateCall = shorten (StringUtil .getPackageName (info .second )) + "." + StringUtil .getShortName (info .second );
1564
1561
}
1565
- String fieldType = ObjectUtils . notNull (useExactElements ? exactType : IELEMENTTYPE_CLASS );
1562
+ String fieldType = Objects . requireNonNull (useExactElements ? exactType : IELEMENTTYPE_CLASS );
1566
1563
String callFix = elementCreateCall .endsWith ("IElementType" ) ? ", null" : "" ;
1567
1564
out ("%s %s = %s(\" %s\" %s);" , shorten (fieldType ), elementType , elementCreateCall , elementType , callFix );
1568
1565
}
@@ -2020,7 +2017,7 @@ private String generatePsiAccessorImplCall(@NotNull BnfRule rule, @NotNull RuleM
2020
2017
private String getAccessorType (@ NotNull BnfRule rule ) {
2021
2018
if (Rule .isExternal (rule )) {
2022
2019
Pair <String , String > first = ContainerUtil .getFirstItem (getAttribute (rule , KnownAttribute .IMPLEMENTS ));
2023
- return ObjectUtils . assertNotNull (first ).second ;
2020
+ return Objects . requireNonNull (first ).second ;
2024
2021
}
2025
2022
else {
2026
2023
return ruleInfo (rule ).intfClass ;
0 commit comments