Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException in Android Studio #5

Open
ahshah opened this issue Sep 17, 2019 · 4 comments
Open

IllegalStateException in Android Studio #5

ahshah opened this issue Sep 17, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@ahshah
Copy link

ahshah commented Sep 17, 2019

Attempting to edit the buffer in Neovim 0.4.2 (As well as the previous version 0.3.x i was using)
results in a readonly buffer in neovim (Unable to edit the file) and the following Stack trace in Android Studio 3.5
Build #AI-191.8026.42.35.5791312, built on August 8, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6

java.lang.IllegalStateException: This SyncBuffer has been released already.
at org.beeender.comradeneovim.buffer.SyncBuffer.checkReleased(SyncBuffer.kt:142)
at org.beeender.comradeneovim.buffer.SyncBuffer.navigate(SyncBuffer.kt:76)
at org.beeender.comradeneovim.buffer.SyncBufferManager$nvimBufLinesEvent$1.invoke(SyncBufferManager.kt:148)
at org.beeender.comradeneovim.buffer.SyncBufferManager$nvimBufLinesEvent$1.invoke(SyncBufferManager.kt:28)
at org.beeender.comradeneovim.UtilsKt$sam$java_lang_Runnable$0.run(Utils.kt)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:757)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:706)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:375)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
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)

@ahshah
Copy link
Author

ahshah commented Sep 17, 2019

Android Studio had set the file to Read-only mode as it was confused as to the state of it's own buffer, compared to the file on disk. Once I cleared this read-only state by refreshing Studio's buffer by reading the file from disk into the buffer, this exception also went away.

@beeender
Copy link
Owner

Hmm, what was the file that AndroidStudio set it o readonly?

Android Studio had set the file to Read-only mode as it was confused as to the state of it's own buffer, compared to the file on disk.

Is there any other process tries to change that file?

When Comrade connect to the AndroidStudio, it won't save to disk anymore to avoid this kind of situation. Instead, it will just sync the changes to AndroidStudio's buffer.

Is there any way that i can reprodcue the issue? thanks!

@beeender beeender added the bug Something isn't working label Sep 18, 2019
@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

Let me look into reproducing for you. This happened I think in the following order:

  1. Open file foo.java in vim-Comrade
  2. Open same file, foo.java, in regular vim
  3. Make a change in foo.java using regular vim and write to disk
  4. Switch to vim-comrade and attempt to make changes (cloberring the old changes) and attempt to write the buffer
  5. Navigating to studio, which was alerted to the buffer change made in step 3.

@ahshah
Copy link
Author

ahshah commented Sep 19, 2019

I've been able to reproduce something like what I saw, but not exactly.
Essentially you need two editors open on the same file in the project. One editor is Comrade enabled, the other one is regular vanilla nvim. If non-comrade instances write to the file, and then the comrade-enabled instance writes to the same file, clobbering over each other. causes (sometimes) an IllegalStateException.

Here's another Exception I saw

java.lang.IllegalStateException
at com.intellij.codeInsight.daemon.impl.quickfix.AddMethodQualifierFix.getText(AddMethodQualifierFix.java:59)
at com.intellij.codeInsight.daemon.impl.HighlightInfo$IntentionActionDescriptor.toString(HighlightInfo.java:883)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at com.intellij.openapi.util.Pair.toString(Pair.java:81)
at java.lang.String.valueOf(String.java:2994)
at java.util.Arrays.toString(Arrays.java:4571)
at com.intellij.util.containers.LockFreeCopyOnWriteArrayList.toString(LockFreeCopyOnWriteArrayList.java:779)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at com.intellij.codeInsight.daemon.impl.HighlightInfo.toString(HighlightInfo.java:375)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at org.beeender.comradeneovim.insight.InsightItem.(InsightItem.kt:26)
at org.beeender.comradeneovim.insight.InsightProcessor$process$1$itemMap$2.invoke(InsightProcessor.kt:78)
at org.beeender.comradeneovim.insight.InsightProcessor$process$1$itemMap$2.invoke(InsightProcessor.kt:34)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:172)
at kotlin.collections.MapsKt__MapsKt.putAll(Maps.kt:372)
at kotlin.collections.MapsKt__MapsKt.toMap(Maps.kt:540)
at kotlin.collections.MapsKt__MapsKt.toMap(Maps.kt:534)
at org.beeender.comradeneovim.insight.InsightProcessor$process$1.run(InsightProcessor.kt:80)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:757)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:706)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:375)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants