[java] stubs for 'requires' and 'exports' statement (NPE fix) appcode/163.6000 clion/163.5999 phpstorm/163.6003 pycharm/163.6002 webstorm/163.6001
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sun, 9 Oct 2016 08:51:36 +0000 (10:51 +0200)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sun, 9 Oct 2016 08:52:04 +0000 (10:52 +0200)
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaExportsStatementElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaRequiresStatementElementType.java

index e3d4c2cf3cfd45e52c1de4a6943a46b44c2d8738..ea95eef7a78854577d04efa7a9b22e98cd5b9d5e 100644 (file)
@@ -36,6 +36,8 @@ import org.jetbrains.annotations.NotNull;
 import java.io.IOException;
 import java.util.List;
 
+import static com.intellij.util.ObjectUtils.notNull;
+
 public class JavaExportsStatementElementType extends JavaStubElementType<PsiExportsStatementStub, PsiExportsStatement> {
   public JavaExportsStatementElementType() {
     super("EXPORTS_STATEMENT");
@@ -68,7 +70,7 @@ public class JavaExportsStatementElementType extends JavaStubElementType<PsiExpo
       else if (type == JavaElementType.MODULE_REFERENCE) to.add(JavaSourceUtil.getReferenceText(tree, child));
     }
 
-    return new PsiExportsStatementStubImpl(parentStub, refText, to);
+    return new PsiExportsStatementStubImpl(parentStub, notNull(refText, ""), to);
   }
 
   @Override
index 405f8f3478d70d622f195f6448bda2c2dcf74e85..43af3563fbb0211d6b87402a69715c138de5a1f6 100644 (file)
@@ -35,6 +35,8 @@ import org.jetbrains.annotations.NotNull;
 
 import java.io.IOException;
 
+import static com.intellij.util.ObjectUtils.notNull;
+
 public class JavaRequiresStatementElementType extends JavaStubElementType<PsiRequiresStatementStub, PsiRequiresStatement> {
   public JavaRequiresStatementElementType() {
     super("REQUIRES_STATEMENT");
@@ -68,7 +70,7 @@ public class JavaRequiresStatementElementType extends JavaStubElementType<PsiReq
       else if (type == JavaTokenType.STATIC_KEYWORD) isStatic = true;
     }
 
-    return new PsiRequiresStatementStubImpl(parentStub, refText, isPublic, isStatic);
+    return new PsiRequiresStatementStubImpl(parentStub, notNull(refText, ""), isPublic, isStatic);
   }
 
   @Override