GrPackageDefinition () { final StubElement<?> stub = getStub(); if (stub != null) { for (StubElement element : stub.getChildrenStubs()) { if (element instanceof GrPackageDefinitionStub) return (GrPackageDefinition)element.getPsi(); } return null; } ASTNode node = calcTreeElement().findChildByType(GroovyStubElementTypes.PACKAGE_DEFINITION); return node != null ? (GrPackageDefinition)node.getPsi() : null; }