antlr / intellij-plugin-v4

An IntelliJ plugin for ANTLR v4
https://plugins.jetbrains.com/plugin/7358-antlr-v4
BSD 3-Clause "New" or "Revised" License
467 stars 104 forks source link

Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction()) #498

Closed igreenfield closed 1 year ago

igreenfield commented 2 years ago
Details: Current thread: Thread[Alarm Pool,4,main] 560889630
Dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 2107409562

java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:200)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:980)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:595)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.evaluateValidity(FileManagerImpl.java:591)
    at com.intellij.psi.impl.source.PsiFileImpl.isValid(PsiFileImpl.java:163)
    at com.intellij.psi.impl.source.PsiFileImpl.getText(PsiFileImpl.java:300)
    at org.antlr.intellij.plugin.validation.GrammarIssuesCollector.collectGrammarIssues(GrammarIssuesCollector.java:34)
    at org.antlr.intellij.plugin.ANTLRv4ExternalAnnotator.doAnnotate(ANTLRv4ExternalAnnotator.java:37)
    at org.antlr.intellij.plugin.ANTLRv4ExternalAnnotator.doAnnotate(ANTLRv4ExternalAnnotator.java:24)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:218)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:212)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:190)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:287)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:190)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:277)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:255)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:189)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
    at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:273)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:287)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:241)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:240)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:385)
    at com.intellij.util.Alarm$Request.run(Alarm.java:374)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:220)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:246)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:32)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:225)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:214)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
parrt commented 2 years ago

Hi @igreenfield can you give me a grammar that causes this problem? any ideas about what you were doing that might've triggered this? Thanks!

igreenfield commented 2 years ago

@parrt I was editing spark grammar change one rule.

parrt commented 2 years ago

@igreenfield can you tell me what operating system and which version of intellij? can you confirm 1.17 plugin? thanks!

parrt commented 2 years ago

@parrt I was editing spark grammar change one rule.

are you talking about this grammar?

https://github.com/apache/spark/blob/master/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4

parrt commented 2 years ago

Sounds like you probably have an old version of intellij:

https://github.com/JetBrains/idea-gitignore/issues/419

Thanks...

igreenfield commented 2 years ago

@parrt yes, my idea version is: so not so old

image

parrt commented 2 years ago

oh man!!! ok, reopening... and you are using 1.17 plug-in right? at this point I can't reproduce so any exact sequence editing information or whatever would be very helpful otherwise I don't know how to fix. thanks for the report!

igreenfield commented 2 years ago

image

What I remember I did: add a new rule and delete the second line from STRING and that happens.

parrt commented 2 years ago

Dang. I can't reproduce.

KaydenMiller commented 1 year ago

I just ran into this issue on Rider 2023.1 EAP 6 build. Switching back to the current 2022.3.2 build of Rider does work.

Stack Trace:

com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action or Event Dispatch Thread (EDT) only (see Application.runReadAction()); see https://jb.gg/ij-platform-threading for details
Current thread: Thread[ApplicationImpl pooled thread 25,4,main] 296579654 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 1285261168
    at com.intellij.openapi.application.impl.ApplicationImpl.throwThreadAccessException(ApplicationImpl.java:1046)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.checkAvailability(DirectoryIndexImpl.java:250)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getPackageName(DirectoryIndexImpl.java:213)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getPackageNameByDirectory(ProjectFileIndexImpl.java:250)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgs(RunANTLROnGrammarFile.java:197)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgsAsList(RunANTLROnGrammarFile.java:178)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.antlr(RunANTLROnGrammarFile.java:131)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.run(RunANTLROnGrammarFile.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:513)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:84)
    at com.intellij.codeWithMe.ClientId$Companion.decorateFunction$lambda$10(ClientId.kt:329)
    at com.intellij.codeWithMe.ClientId$Companion.decorateFunction$lambda$10(ClientId.kt:329)
    at com.intellij.codeWithMe.ClientId$Companion.decorateFunction$lambda$10(ClientId.kt:329)
    at com.intellij.codeWithMe.ClientId$Companion.decorateFunction$lambda$10(ClientId.kt:329)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

Grammar *.g4 file

grammar Exodia;

// LEXER

// COMMENTS
SINGLE_COMMENT: '//' ~[\r\n]* -> skip ;
BLOCK_COMMENT: '/*' .*? '*/' -> skip ;

// KEYWORDS
LET: 'let' ;
RETURN: 'return' ;
FN: 'fn' ;
IF: 'if' ;
ELSE: 'else' ;
WHILE: 'while' ;
DO: 'do' ;
FOR: 'for' ;
CLASS: 'class' ;
EXTENDS: 'extends' ;
THIS: 'this' ;
SUPER: 'super';
NEW: 'new' ;

WHITESPACE: [ \t\n\r\f]+ -> skip ;
NUMBER: [0-9]+ ;
STRING: '"' ~'"'* '"' ;
TRUE: 'true' ;
FALSE: 'false' ;
ADDITIVE_OPERATOR: [+\-] ;
MULTIPLICATIVE_OPERATOR: [*/] ;
EQUALITY_OPERATOR: [=!]'=' ;
RELATIONAL_OPERATOR: [><]'='? ;
LOGICAL_OR: '||' ;
LOGICAL_AND: '&&' ;

SIMPLE_ASSIGNMENT_OPERATOR: [=] ;
COMPLEX_ASSIGMENT_OPERATOR: [*/+\-]'=' ;

IDENTIFIER: [a-zA-Z] [a-zA-Z1-9]* ;

// PARSER

program: statement* EOF; // THE ? is so you can have an empty file

// STATEMENTS

statement
    : expression_statement 
    | empty_statement
    | block_statement
    | function_declaration
    | return_statement
    | variable_statement
    | if_statement
    | iteration_statement
    | class_declaration
    ;

class_declaration
    : CLASS identifier class_extends? statement
    ;

class_extends
    : EXTENDS identifier
    ;

iteration_statement
    : while_statement
    | do_while_statement
    | for_statement
    ;

for_statement
    : FOR '(' variable_statement equality_expression ';' expression ')' statement
    ;

do_while_statement
    : DO statement WHILE '(' expression ')'
    ;

while_statement
    : WHILE '(' expression ')' statement
    ;

variable_statement
    : LET variable_declaration_list ';'
    ;

variable_declaration_list
    : variable_declaration
    | variable_declaration_list ',' variable_declaration 
    ;

variable_declaration
    : identifier variable_initializer? 
    ;

variable_initializer
    : SIMPLE_ASSIGNMENT_OPERATOR assignment_expression
    ;

if_statement
    : IF '(' expression ')' statement
    | IF '(' expression ')' statement ELSE statement
    ;

empty_statement
    : ';'
    ;

return_statement
    : RETURN expression? ';'
    ;

block_statement
    : '{' statement* '}'
    ;

// FUNCTIONS

function_declaration
    : FN identifier '(' formal_parameter_list? ')' block_statement
    ;

formal_parameter_list
    : identifier
    | formal_parameter_list ',' identifier
    ;

// EXPRESSIONS

expression_statement
    : expression ';' 
    ;

expression
    : assignment_expression 
    ;

assignment_expression
    : logical_OR_expression
    | left_hand_side_expression assignment_operator assignment_expression
    ;

assignment_operator
    : SIMPLE_ASSIGNMENT_OPERATOR
    | COMPLEX_ASSIGMENT_OPERATOR
    ;

left_hand_side_expression
    : member_expression
    ;

member_expression
    : identifier
    | this_expression
    | member_expression '.' identifier
    | member_expression '[' expression ']'
    ;

this_expression
    : THIS
    ;

identifier
    : IDENTIFIER 
    ;

logical_OR_expression
    : logical_AND_expression
    | left=logical_OR_expression op=LOGICAL_OR right=logical_AND_expression
    ;

logical_AND_expression
    : equality_expression
    | left=logical_AND_expression op=LOGICAL_AND right=equality_expression
    ;

equality_expression
    : relational_expression
    | left=equality_expression op=EQUALITY_OPERATOR right=relational_expression 
    ;

relational_expression
    : additive_expression
    | left=relational_expression op=RELATIONAL_OPERATOR right=additive_expression
    ;

additive_expression
    : multiplicative_expression 
    | left=additive_expression op=ADDITIVE_OPERATOR right=multiplicative_expression
    ;

multiplicative_expression
    : unary_expression 
    | left=multiplicative_expression op=MULTIPLICATIVE_OPERATOR right=unary_expression 
    ;

unary_expression
    : primary_expression
    | call_expression
    | ADDITIVE_OPERATOR unary_expression
    ;

call_expression
    : callee args=arguments                      
    | super args=arguments                       
    | call_expression args=arguments             
    ;

super
    : SUPER
    ;

callee
    : lhse=left_hand_side_expression
    ;

arguments
    : '(' argument_list? ')'
    ;

argument_list
    : assignment_expression 
    | argument_list ',' assignment_expression
    ;

new_expression
    : NEW exp=member_expression args=arguments
    ;

primary_expression
    : literal
    | member_expression
    | parenthesized_expression
    | new_expression
    ;

parenthesized_expression
    : '(' expression ')'
    ;

// LITERALS

literal
    : numeric_literal       #atom
    | string_literal        #atom
    | true_literal          #atom
    | false_literal         #atom
    ;

true_literal
    : TRUE
    ;

false_literal
    : FALSE
    ;

numeric_literal
    : NUMBER
    ;

string_literal
    : STRING
    ;
bjansen commented 1 year ago

Fixed in #605

LucasHenrique-dev commented 1 year ago

Same error here and I'm using ANTLR v4 1.20

This error triggered when I clicked "Generate ANTLR Recognizer"

image image

ANTLR Configure

image

Stack Trace

java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
Current thread: Thread[ApplicationImpl pooled thread 124,4,main] 937709905 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 765331596
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.checkAvailability(DirectoryIndexImpl.java:250)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getPackageName(DirectoryIndexImpl.java:213)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getPackageNameByDirectory(ProjectFileIndexImpl.java:250)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgs(RunANTLROnGrammarFile.java:197)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgsAsList(RunANTLROnGrammarFile.java:178)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.antlr(RunANTLROnGrammarFile.java:131)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.run(RunANTLROnGrammarFile.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:513)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:84)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

Induced

Following exceptions happened soon after this one, most probably they are induced.

2023-04-02T20:34:20.010
java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
Current thread: Thread[ApplicationImpl pooled thread 124,4,main] 937709905 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 765331596
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:127)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:70)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getPackageName(WorkspaceFileIndexDataImpl.kt:279)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getPackageName(WorkspaceFileIndexImpl.kt:228)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getPackageName(DirectoryIndexImpl.java:215)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getPackageNameByDirectory(ProjectFileIndexImpl.java:250)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgs(RunANTLROnGrammarFile.java:197)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgsAsList(RunANTLROnGrammarFile.java:178)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.antlr(RunANTLROnGrammarFile.java:131)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.run(RunANTLROnGrammarFile.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:513)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:84)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

2023-04-02T20:34:20.010
java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
Current thread: Thread[ApplicationImpl pooled thread 124,4,main] 937709905 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 765331596
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:127)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:70)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:220)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSetWithCustomData(WorkspaceFileIndexImpl.kt:205)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getContentRootForFile(ProjectFileIndexImpl.java:219)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getContentRootForFile(ProjectFileIndexImpl.java:213)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getContentRoot(RunANTLROnGrammarFile.java:269)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgs(RunANTLROnGrammarFile.java:209)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.getANTLRArgsAsList(RunANTLROnGrammarFile.java:178)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.antlr(RunANTLROnGrammarFile.java:131)
    at org.antlr.intellij.plugin.parsing.RunANTLROnGrammarFile.run(RunANTLROnGrammarFile.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$9(CoreProgressManager.java:513)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:84)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)

Grammar *.g4 file

grammar GeradorRelatorio;

//SÍMBOLOS TERMINAIS
NUM: [0-9]+;
STRING: ["][a-zA-Z0-9 \\/:._]+["];

ESPACO: [ \t\n\r]+ -> skip ;

//SÍMBOLOS NÃO TERMINAIS
program
    : exp+ EOF
    ;

exp
    : 'getTopEmpresasMaisContratam' '(' NUM ')'
    | 'extrairDados' '(' STRING ')'
    | 'estagiosPorCurso' '(' STRING ')'
    ;

I can visualize the Parse tree, by the way

image

It also seems to create the files correctly

image

This is my first time using it, is there something that I should do or is this expected?

bjansen commented 1 year ago

Thanks for reporting the problem. It looks like a different stack trace, could you open a separate issue? This error is not expected, I'll fix it asap.

LucasHenrique-dev commented 1 year ago

Sure! Here it is: #631