@@ -100,15 +100,12 @@ static class RuleInfo {
100100 this .intfClass = intfPackage + "." + intfClass ;
101101 this .implClass = implPackage + "." + implClass ;
102102 this .mixin = mixin ;
103- //this.stubName = stubName;
104- //this.classes = classes;
105- //this.mixedAST = mixedAST;
106103 }
107104 }
108105
109106 @ NotNull
110107 RuleInfo ruleInfo (BnfRule rule ) {
111- return ObjectUtils . notNull (myRuleInfos .get (rule .getName ()));
108+ return Objects . requireNonNull (myRuleInfos .get (rule .getName ()));
112109 }
113110
114111 private final Map <String , RuleInfo > myRuleInfos = new TreeMap <>();
@@ -430,7 +427,7 @@ private void generateVisitor(String psiClass, Map<String, BnfRule> sortedRules)
430427 String superIntf = ObjectUtils .notNull (ContainerUtil .getFirstItem (getRootAttribute (myFile , KnownAttribute .IMPLEMENTS )),
431428 KnownAttribute .IMPLEMENTS .getDefaultValue ().get (0 )).second ;
432429 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 <> ();
434431 for (BnfRule rule : sortedRules .values ()) {
435432 supers .putValues (rule .getName (), getSuperInterfaceNames (myFile , rule , myIntfClassFormat ));
436433 }
@@ -559,7 +556,7 @@ else if (!G.generateFQN) {
559556 generateRootParserContent ();
560557 }
561558 for (String ruleName : ownRuleNames ) {
562- BnfRule rule = ObjectUtils . assertNotNull (myFile .getRule (ruleName ));
559+ BnfRule rule = Objects . requireNonNull (myFile .getRule (ruleName ));
563560 if (Rule .isExternal (rule ) || Rule .isFake (rule )) continue ;
564561 if (myExpressionHelper .getExpressionInfo (rule ) != null ) continue ;
565562 out ("/* ********************************************************** */" );
@@ -611,7 +608,7 @@ private void generateRootParserContent() {
611608 BnfRule rootRule = myFile .getRule (myGrammarRoot );
612609 List <BnfRule > extraRoots = new ArrayList <>();
613610 for (String ruleName : myRuleInfos .keySet ()) {
614- BnfRule rule = ObjectUtils . assertNotNull (myFile .getRule (ruleName ));
611+ BnfRule rule = Objects . requireNonNull (myFile .getRule (ruleName ));
615612 if (getAttribute (rule , KnownAttribute .ELEMENT_TYPE ) != null ) continue ;
616613 if (!RuleGraphHelper .hasElementType (rule )) continue ;
617614 if (Rule .isFake (rule ) || Rule .isMeta (rule )) continue ;
@@ -1079,7 +1076,7 @@ public String generateFirstCheck(BnfRule rule, String frameName, boolean skipIfO
10791076 String t = firstToElementType (expressionString );
10801077 if (t == null ) return frameName ;
10811078
1082- ConsumeType childConsumeType = getRuleConsumeType (ObjectUtils . notNull (Rule .of (expression )), rule );
1079+ ConsumeType childConsumeType = getRuleConsumeType (Objects . requireNonNull (Rule .of (expression )), rule );
10831080 ConsumeType consumeType = ConsumeType .min (ruleConsumeType , childConsumeType );
10841081 ConsumeType existing = firstElementTypes .get (t );
10851082 firstElementTypes .put (t , ConsumeType .max (existing , consumeType ));
@@ -1409,7 +1406,7 @@ else if (nested instanceof BnfLiteralExpression) {
14091406 arguments .add (generateWrappedNodeCall (rule , nested , attributeName ));
14101407 }
14111408 else {
1412- arguments .add (new TextArgument (argument .startsWith ("\ ' " ) ? GrammarUtil .unquote (argument ) : argument ));
1409+ arguments .add (new TextArgument (argument .startsWith ("'" ) ? GrammarUtil .unquote (argument ) : argument ));
14131410 }
14141411 }
14151412 else if (nested instanceof BnfExternalExpression ) {
@@ -1562,7 +1559,7 @@ private void generateElementTypesHolder(String className, Map<String, BnfRule> s
15621559 else {
15631560 elementCreateCall = shorten (StringUtil .getPackageName (info .second )) + "." + StringUtil .getShortName (info .second );
15641561 }
1565- String fieldType = ObjectUtils . notNull (useExactElements ? exactType : IELEMENTTYPE_CLASS );
1562+ String fieldType = Objects . requireNonNull (useExactElements ? exactType : IELEMENTTYPE_CLASS );
15661563 String callFix = elementCreateCall .endsWith ("IElementType" ) ? ", null" : "" ;
15671564 out ("%s %s = %s(\" %s\" %s);" , shorten (fieldType ), elementType , elementCreateCall , elementType , callFix );
15681565 }
@@ -2020,7 +2017,7 @@ private String generatePsiAccessorImplCall(@NotNull BnfRule rule, @NotNull RuleM
20202017 private String getAccessorType (@ NotNull BnfRule rule ) {
20212018 if (Rule .isExternal (rule )) {
20222019 Pair <String , String > first = ContainerUtil .getFirstItem (getAttribute (rule , KnownAttribute .IMPLEMENTS ));
2023- return ObjectUtils . assertNotNull (first ).second ;
2020+ return Objects . requireNonNull (first ).second ;
20242021 }
20252022 else {
20262023 return ruleInfo (rule ).intfClass ;
0 commit comments