apache / apache/grails-intellij-plugin

Grails: MakePropertyNullable/MakePropertyUnique intentions should correctly process read-only files

Open
#201 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

141.712.1

consider some domain class located in read-only file
invoke MakePropertyNullable or MakePropertyUnique for it - exceptions instead of ClearReadOnlyStatus dialog

Cannot modify a read-only file 'C:\Users\<hidden-personal-data>\IdeaProjects\GrailsTests\test0\grails-app\domain\test0\Person.groovy'.

com.intellij.util.IncorrectOperationException: Cannot modify a read-only file 'C:\Users\<hidden-personal-data>\IdeaProjects\GrailsTests\test0\grails-app\domain\test0\Person.groovy'.

```
at com.intellij.psi.impl.CheckUtil.checkWritable(CheckUtil.java:48)
at com.intellij.extapi.psi.ASTDelegatePsiElement.addAfter(ASTDelegatePsiElement.java:303)
at org.jetbrains.plugins.groovy.lang.psi.impl.statements.arguments.GrArgumentListImpl.addAfter(GrArgumentListImpl.java:195)
at org.jetbrains.plugins.groovy.lang.psi.impl.statements.arguments.GrArgumentListImpl.addBefore(GrArgumentListImpl.java:182)
at org.jetbrains.plugins.groovy.lang.psi.impl.statements.arguments.GrArgumentListImpl.addNamedArgument(GrArgumentListImpl.java:160)
at org.jetbrains.plugins.grails.actions.DomainFieldIntention.invoke(DomainFieldIntention.java:211)
at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:61)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler$2.run(ShowIntentionActionsHandler.java:181)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:937)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler$3.run(ShowIntentionActionsHandler.java:195)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:200)
at com.intellij.codeInsight.intention.impl.IntentionListStep$2$1.run(IntentionListStep.java:260)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:702)
at java.awt.EventQueue$3.run(EventQueue.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:734)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
```

---

*Imported from [IDEA-139367](https://youtrack.jetbrains.com/issue/IDEA-139367) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in DomainFieldIntention.java at the invoke path shown in the stack trace, then reproduce the MakePropertyNullable or MakePropertyUnique intention on the read-only Person.groovy file described in the issue. Check how read-only status is handled and verify that the ClearReadOnlyStatus dialog appears instead of an IncorrectOperationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.