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

"java.lang.UnsupportedOperationException: Operation is not supported for read-only collection" #1571

Closed
nkibler opened this issue Jul 27, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@nkibler
Copy link
Contributor

commented Jul 27, 2017

Partial stacktrace from crash report:

java.lang.UnsupportedOperationException: Operation is not supported for read-only collection
	at kotlin.collections.EmptyList.add(Collections.kt)
	at com.google.cloud.tools.intellij.appengine.cloud.BuildDeploymentSourceType.setBuildBeforeRunTask(BuildDeploymentSourceType.java:81)
	at com.google.cloud.tools.intellij.appengine.cloud.BuildDeploymentSourceType.setBuildBeforeRunTask(BuildDeploymentSourceType.java:44)
	at com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType$DeployToServerConfigurationFactory.setupDeploymentSource(DeployToServerConfigurationType.java:98)
	at com.intellij.remoteServer.impl.configuration.deployment.DeployToServerConfigurationType$DeployToServerConfigurationFactory.onNewConfigurationCreated(DeployToServerConfigurationType.java:85)
	at com.intellij.remoteServer.impl.configuration.deployment.DeploymentConfigurationManagerImpl.createAndRunConfiguration(DeploymentConfigurationManagerImpl.java:57)
	at com.google.cloud.tools.intellij.appengine.cloud.AppEngineDeployToolsMenuAction.openRunConfiguration(AppEngineDeployToolsMenuAction.java:78)
	at com.google.cloud.tools.intellij.appengine.cloud.AppEngineDeployToolsMenuAction.actionPerformed(AppEngineDeployToolsMenuAction.java:64)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:216)
        ...

The problem lines of code are:

List<BeforeRunTask> tasks = runManager.getBeforeRunTasks(configuration);
tasks.add(buildTask);

The likely cause is that IDEA replaced the underlying implementation of the RunManagerEx with a Kotlin source, in the process returning a read-only collection (maybe only sometimes?) from .getBeforeRunTasks(). An easy fix is to change this logic to build a new list from its contents instead; I'll send a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.