diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java index ac63d3385c35..5708d3c22165 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import com.intellij.execution.configurations.RunConfiguration; import com.intellij.execution.configurations.RunProfile; import com.intellij.execution.executors.DefaultDebugExecutor; import com.intellij.execution.runners.JavaProgramPatcher; -import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.PluginPathManager; import com.intellij.openapi.application.ReadAction; @@ -49,28 +48,20 @@ import java.io.IOException; import java.util.jar.Attributes; import java.util.regex.Pattern; - /** * @author peter */ public class GroovyHotSwapper extends JavaProgramPatcher { private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.debugger.GroovyHotSwapper"); private static final String GROOVY_HOTSWAP_AGENT_PATH = "groovy.hotswap.agent.path"; - private static final Pattern SPRING_LOADED_PATTERN = Pattern.compile("-javaagent:.+springloaded-[^/\\\\]+\\.jar"); - private static boolean containsGroovyClasses(final Project project) { - return CachedValuesManager.getManager(project).getCachedValue(project, () -> { - AccessToken accessToken = ReadAction.start(); - try { - return CachedValueProvider.Result - .create(FileTypeIndex.containsFileOfType(GroovyFileType.GROOVY_FILE_TYPE, GlobalSearchScope.projectScope(project)), - PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT); - } - finally { - accessToken.finish(); - } - }); + private static boolean containsGroovyClasses(Project project) { + return CachedValuesManager.getManager(project).getCachedValue(project, () -> + ReadAction.compute(() -> + CachedValueProvider.Result.create( + FileTypeIndex.containsFileOfType(GroovyFileType.GROOVY_FILE_TYPE, GlobalSearchScope.projectScope(project)), + PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT))); } private static boolean hasSpringLoadedReloader(JavaParameters javaParameters) { @@ -124,7 +115,7 @@ public class GroovyHotSwapper extends JavaProgramPatcher { if (jdk != null) { String vendor = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VENDOR); if (vendor != null && vendor.contains("IBM")) { - LOG.info("Due to IBM JDK pecularities (IDEA-59070) we don't add groovy agent when running applications under it"); + LOG.info("Due to IBM JDK peculiarities (IDEA-59070) we don't add Groovy agent when running applications under it"); return; } } @@ -143,7 +134,8 @@ public class GroovyHotSwapper extends JavaProgramPatcher { final File dir = new File(PathManager.getSystemPath(), "groovyHotSwap"); if (dir.getAbsolutePath().contains(" ")) { LOG.info("Groovy hot-swap not used since the agent path contains spaces: " + agentPath + "\n" + - "One can move the agent to a directory with no spaces in path and specify its path in /bin/idea.properties as " + GROOVY_HOTSWAP_AGENT_PATH + "="); + "One can move the agent to a directory with no spaces in path," + + " and specify its path in /bin/idea.properties as " + GROOVY_HOTSWAP_AGENT_PATH + "="); return null; } @@ -173,5 +165,4 @@ public class GroovyHotSwapper extends JavaProgramPatcher { final File pluginDir = ourJar.getParentFile(); return pluginDir.getPath() + File.separator + "agent" + File.separator + "gragent.jar"; } - -} +} \ No newline at end of file