Merge remote-tracking branch 'origin/master' into develar/is

This commit is contained in:
Vladimir Krivosheev
2016-07-21 17:39:09 +02:00
168 changed files with 2100 additions and 1001 deletions
@@ -15,6 +15,8 @@
*/
package org.jetbrains.intellij.build
import com.intellij.openapi.util.text.StringUtil
import java.text.MessageFormat
/**
@@ -30,6 +32,7 @@ class ApplicationInfoProperties {
final String minorVersionMainPart
final String productName
final String companyName
final String shortCompanyName
final boolean isEAP
@SuppressWarnings(["GrUnresolvedAccess", "GroovyAssignabilityCheck"])
@@ -45,6 +48,7 @@ class ApplicationInfoProperties {
companyName = root.company.first().@name
minorVersionMainPart = minorVersion.takeWhile { it != '.' }
isEAP = Boolean.parseBoolean(root.version.first().@eap)
shortCompanyName = StringUtil.trimEnd(companyName, "s.r.o.").trim()
}
public String getUpperCaseProductName() { shortProductName.toUpperCase() }
@@ -64,12 +64,18 @@ abstract class BuildContext {
*/
List<String> bootClassPathJarNames
abstract boolean includeBreakGenLibraries()
abstract String getAdditionalJvmArguments()
abstract void notifyArtifactBuilt(String artifactPath)
abstract File findApplicationInfoInSources()
abstract JpsModule findApplicationInfoModule()
abstract JpsModule findRequiredModule(String name)
abstract JpsModule findModule(String name)
abstract void signExeFile(String path)
@@ -16,6 +16,7 @@
package org.jetbrains.intellij.build
import org.jetbrains.intellij.build.impl.BuildTasksImpl
import org.jetbrains.intellij.build.impl.PluginLayout
/**
* @author nik
@@ -53,10 +54,14 @@ abstract class BuildTasks {
*/
abstract void buildDistributions()
abstract void compileModulesAndBuildDistributions(List<PluginLayout> allPlugins)
abstract void cleanOutput()
abstract void compileProjectAndTests(List<String> includingTestsInModules)
abstract void compileModules(List<String> moduleNames, List<String> includingTestsInModules = [])
public static BuildTasks create(BuildContext context) {
return new BuildTasksImpl(context)
}
@@ -0,0 +1,179 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.intellij.build
import org.jetbrains.intellij.build.impl.PluginLayout
import static org.jetbrains.intellij.build.impl.PluginLayout.plugin
/**
* @author nik
*/
class CommunityRepositoryModules {
static List<String> PLATFORM_API_MODULES = [
"analysis-api",
"built-in-server-api",
"core-api",
"diff-api",
"dvcs-api",
"editor-ui-api",
"external-system-api",
"indexing-api",
"jps-model-api",
"lang-api",
"lvcs-api",
"platform-api",
"projectModel-api",
"remote-servers-agent-rt",
"remote-servers-api",
"usageView",
"vcs-api-core",
"vcs-api",
"vcs-log-api",
"vcs-log-graph-api",
"xdebugger-api",
"xml-analysis-api",
"xml-openapi",
"xml-psi-api",
"xml-structure-view-api"
]
static List<String> PLATFORM_IMPLEMENTATION_MODULES = [
"analysis-impl",
"built-in-server",
"core-impl",
"diff-impl",
"dvcs-impl",
"editor-ui-ex",
"images",
"indexing-impl",
"jps-model-impl",
"jps-model-serialization",
"json",
"lang-impl",
"lvcs-impl",
"platform-impl",
"projectModel-impl",
"protocol-reader-runtime",
"RegExpSupport",
"relaxng",
"remote-servers-impl",
"script-debugger-backend",
"script-debugger-ui",
"smRunner",
"spellchecker",
"structure-view-impl",
"testRunner",
"vcs-impl",
"vcs-log-graph",
"vcs-log-impl",
"xdebugger-impl",
"xml-analysis-impl",
"xml-psi-impl",
"xml-structure-view-impl",
"xml",
"configuration-store-impl",
]
/**
* Specifies layout for all plugins which sources are located in 'community' and 'contrib' repositories
*/
static List<PluginLayout> COMMUNITY_REPOSITORY_PLUGINS = [
plugin("copyright"),
plugin("java-i18n"),
plugin("hg4idea"),
plugin("github"),
plugin("ant") {
mainJarName = "antIntegration.jar"
withModule("ant-jps-plugin")
},
plugin("ui-designer") {
directoryName = "uiDesigner"
mainJarName = "uiDesigner.jar"
withJpsModule("ui-designer-jps-plugin")
},
plugin("properties") {
withModule("properties-psi-api", "properties.jar")
withModule("properties-psi-impl", "properties.jar")
},
plugin("git4idea") {
withModule("git4idea-rt", "git4idea-rt.jar", false)
withOptionalModule("remote-servers-git")
withOptionalModule("remote-servers-git-java", "remote-servers-git.jar")
},
plugin("svn4idea") {
withResource("lib/licenses", "lib/licenses")
withResource("lib/sqljetsrc.zip", "lib")
withResource("lib/svnkit-javahl16.zip", "lib")
withResource("lib/trileadsrc.zip", "lib")
},
plugin("cvs-plugin") {
directoryName = "cvsIntegration"
mainJarName = "cvsIntegration.jar"
withModule("javacvs-src")
withModule("smartcvs-src")
withModule("cvs-core", "cvs_util.jar")
},
plugin("xpath") {
withModule("xslt-rt", "rt/xslt-rt.jar")
},
plugin("tasks-core") {
directoryName = "tasks"
withModule("tasks-api")
withModule("jira")
withOptionalModule("tasks-java")
doNotCreateSeperateJarForLocalizableResources()
},
plugin("terminal") {
withResource("lib/jediterm.in", "lib")
},
plugin("editorconfig"),
plugin("coverage"),
plugin("yaml"),
plugin("xslt-debugger") {
withModule("xslt-debugger-engine")
withModule("xslt-debugger-engine-impl", "rt/xslt-debugger-engine-impl.jar")
withModuleLibrary("Saxon-6.5.5", "xslt-debugger-engine-impl", "rt")
withModuleLibrary("Saxon-9HE", "xslt-debugger-engine-impl", "rt")
withModuleLibrary("Xalan-2.7.1", "xslt-debugger-engine-impl", "rt")
//todo[nik] unmark 'lib' directory as source root instead
excludeFromModule("xslt-debugger-engine-impl", "rmi-stubs.jar")
excludeFromModule("xslt-debugger-engine-impl", "saxon.jar")
excludeFromModule("xslt-debugger-engine-impl", "saxon9he.jar")
excludeFromModule("xslt-debugger-engine-impl", "serializer.jar")
excludeFromModule("xslt-debugger-engine-impl", "xalan.jar")
},
plugin("settings-repository")
]
}
@@ -29,11 +29,6 @@ class IdeaCommunityProperties extends ProductProperties {
buildCrossPlatformDistribution = true
}
@Override
String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) {
"IntelliJ IDEA Community Edition"
}
@Override
void copyAdditionalFiles(BuildContext buildContext, String targetDirectory) {
buildContext.ant.copy(todir: targetDirectory) {
@@ -57,6 +52,12 @@ class IdeaCommunityProperties extends ProductProperties {
@Override
String rootDirectoryName(String buildNumber) { "" }
@Override
String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { "IntelliJ IDEA Community Edition" }
@Override
String fullNameIncludingEditionAndVendor(ApplicationInfoProperties applicationInfo) { "IntelliJ IDEA Community Edition" }
@Override
String uninstallFeedbackPageUrl(ApplicationInfoProperties applicationInfo) {
"https://www.jetbrains.com/idea/uninstall/?edition=IC-${applicationInfo.majorVersion}.${applicationInfo.minorVersion}"
@@ -82,6 +83,7 @@ class IdeaCommunityProperties extends ProductProperties {
{
helpId = "IJ"
urlSchemes = ["idea"]
associateIpr = true
enableYourkitAgentInEAP = false
bundleIdentifier = "com.jetbrains.intellij.ce"
dmgImagePath = "$projectHome/build/conf/mac/communitydmg.png"
@@ -29,10 +29,15 @@ abstract class MacDistributionCustomizer {
*/
String minOSXVersion = "10.8"
String helpId = ""
String docTypes = null
String additionalDocTypes = ""
List<String> urlSchemes = []
List<String> architectures = ["x86_64"]
/**
* If {@code true} *.ipr files will be associated with the product in Info.plist
*/
boolean associateIpr = false
/**
* If {@code true} YourKit agent will be automatically attached when an EAP build of the product starts under Mac OS. This property is
* taken into account only if {@link ProductProperties#enableYourkitAgentInEAP} is {@code true}.
@@ -58,6 +63,8 @@ abstract class MacDistributionCustomizer {
abstract String rootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber)
Map<String, String> customIdeaProperties(ApplicationInfoProperties applicationInfo) { [:] }
void copyAdditionalFiles(BuildContext context, String targetDirectory) {
}
}
@@ -0,0 +1,111 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.intellij.build
import org.jetbrains.intellij.build.impl.PluginLayout
/**
* @author nik
*/
class ProductModulesLayout {
/**
* Name of the main product JAR file. Outputs of {@link #platformImplementationModules} will be packed into it.
*/
String mainJarName
/**
* Names of the modules which need to be packed into openapi.jar in the product's 'lib' directory.
* @see CommunityRepositoryModules#PLATFORM_API_MODULES
*/
List<String> platformApiModules = []
/**
* Names of the modules which need to be included into {@link #mainJarName} in the product's 'lib' directory
* @see CommunityRepositoryModules#PLATFORM_IMPLEMENTATION_MODULES
*/
List<String> platformImplementationModules = []
/**
* Names of the main modules (containing META-INF/plugin.xml) of the plugins which need to be bundled with the product. It may also
* includes names of optional modules from these plugins which need to be included into the plugin distribution for this product.
*/
List<String> bundledPluginModules = []
/**
* Names of the main modules (containing META-INF/plugin.xml) of the plugins which aren't bundled with the product but may be installed
* into it. Zip archives of these plugins will be built and placed under 'plugins' directory in the build artifacts.
*/
List<String> pluginModulesToPublish = []
/**
* Paths to JAR files which contents should be extracted into {@link #mainJarName} JAR.
*/
List<String> additionalJarsToUnpackIntoMainJar = []
/**
* Maps names of the modules to names of JARs; these modules will be packed into these JARs and copied to the product's 'lib' directory.
*/
Map<String, String> additionalPlatformModules = [:]
/**
* Name of the module which classpath will be used to build searchable options index
*/
String mainModule
/**
* Name of the module containing search/searchableOptions.xml file.
* //todo[nik] make this optional
*/
String searchableOptionsModule
/**
* Paths to license files which are required to start IDE in headless mode to generate searchable options index
*/
List<String> licenseFilesToBuildSearchableOptions = []
/**
* @param allPlugins descriptions of layout of all plugins which may be included into the product
* @return list of all modules which output is included into the product platform's JARs or the plugin's JARs
*/
List<String> getIncludedModules(List<PluginLayout> allPlugins) {
Set<String> enabledPluginModules = getEnabledPluginModules()
def allPluginModules = allPlugins.findAll { enabledPluginModules.contains(it.mainModule) }.collectMany { it.getActualModules(enabledPluginModules).values() }
((allPluginModules + platformApiModules + platformImplementationModules + additionalPlatformModules.keySet()) as Set<String>) as List<String>
}
Set<String> getEnabledPluginModules() {
(bundledPluginModules + pluginModulesToPublish) as Set<String>
}
}
@@ -39,6 +39,8 @@ public abstract class ProductProperties {
*/
String applicationInfoModule
String brandingModule
/**
* Name of the sh/bat script (without extension) which will contain the commands to run IDE in 'offline inspections' mode
*/
@@ -54,17 +56,39 @@ public abstract class ProductProperties {
*/
String additionalIdeJvmArguments = ""
/**
* @return name of the product which will be shown in Windows Installer
*/
String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { applicationInfo.productName }
/**
* An identifier which will be used to form names for directories where configuration and caches will be stored, usually a product name
* without spaces with added version ('IntelliJIdea2016.1' for IntelliJ IDEA 2016.1)
*/
abstract String systemSelector(ApplicationInfoProperties applicationInfo)
/**
* If {@code true} Alt+Button1 shortcut will be removed from 'Quick Evaluate Expression' action and assigned to 'Add/Remove Caret' action
* (instead of Alt+Shift+Button1) in the default keymap
*/
boolean reassignAltClickToMultipleCarets = false
/**
* If {@code true} a txt file containing information (in Atlassian Confluence format) about third-party libraries used in the product
* will be generated.
*/
boolean generateLibrariesLicensesTable = true
/**
* List of licenses information about all libraries which can be used in the product modules
*/
List<LibraryLicense> allLibraryLicenses = CommunityLibraryLicenses.LICENSES_LIST
/**
* If {@code true} the main product JAR file will be scrambled using {@link BuildContext#scrambleTool}
*/
boolean scrambleMainJar = false
/**
* Described which modules should be included into the product's platform and which plugins should be bundled with the product
*/
ProductModulesLayout productLayout = new ProductModulesLayout()
/**
* If {@code true} cross-platform ZIP archive containing binaries for all OS will be built
*/
@@ -115,6 +139,12 @@ public abstract class ProductProperties {
List<String> excludedPlugins = []
/**
* Prefix for names of environment variables used by Windows and Linux distributions to allow users customize location of the product JDK
* (&lt;PRODUCT&gt;_JDK variable), *.vmoptions file (&lt;PRODUCT&gt;_VM_OPTIONS variable), idea.properties file (&lt;PRODUCT&gt;_PROPERTIES variable)
*/
String environmentVariableBaseName(ApplicationInfoProperties applicationInfo) { applicationInfo.upperCaseProductName }
/**
* Override this method to copy additional files to distributions of all operating systems.
*/
@@ -22,8 +22,18 @@ package org.jetbrains.intellij.build
* @author nik
*/
interface ScrambleTool {
/**
* @return list of modules used by the tool which need to be compiled before {@link #scramble} method is invoked
*/
List<String> getAdditionalModulesToCompile()
/**
* Scramble {@code mainJarName} in {@code "$buildContext.paths.distAll/lib"} directory
*/
void scramble(String mainJarName, BuildContext buildContext)
/**
* @return list of names of JAR files which cannot be included into the product 'lib' directory in plain form
*/
List<String> getNamesOfJarsRequiredToBeScrambled()
}
@@ -61,6 +61,16 @@ abstract class WindowsDistributionCustomizer {
*/
void copyAdditionalFiles(BuildContext context, String targetDirectory) {}
/**
* The returned name will be shown in Windows Installer and used in Registry keys
*/
String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { applicationInfo.productName }
/**
* The returned name will be used to create links on Desktop
*/
String fullNameIncludingEditionAndVendor(ApplicationInfoProperties applicationInfo) { applicationInfo.shortCompanyName + " " + applicationInfo.productName }
String uninstallFeedbackPageUrl(ApplicationInfoProperties applicationInfo) {
return null
}
@@ -163,9 +163,14 @@ class BuildContextImpl extends BuildContext {
@Override
JpsModule findApplicationInfoModule() {
def module = findModule(productProperties.applicationInfoModule)
return findRequiredModule(productProperties.applicationInfoModule)
}
@Override
JpsModule findRequiredModule(String name) {
def module = findModule(name)
if (module == null) {
messages.error("Cannot find module '$productProperties.applicationInfoModule' containing ApplicationInfo.xml file")
messages.error("Cannot find required module '$name' in the project")
}
return module
}
@@ -196,6 +201,31 @@ class BuildContextImpl extends BuildContext {
}
}
@Override
boolean includeBreakGenLibraries() {
def productLayout = productProperties.productLayout
return productLayout.mainJarName == null || //todo[nik] remove this condition later
productLayout.additionalPlatformModules.containsKey("java-runtime")
}
@Override
String getAdditionalJvmArguments() {
String jvmArgs
if (productProperties.platformPrefix != null
//todo[nik] remove later. This is added to keep the current behavior (platform prefix for CE is set in MainImpl anyway)
&& productProperties.platformPrefix != "Idea") {
jvmArgs = "-Didea.platform.prefix=${productProperties.platformPrefix}"
}
else {
jvmArgs = ""
}
jvmArgs += " $productProperties.additionalIdeJvmArguments".trim()
if (productProperties.toolsJarRequired) {
jvmArgs += " -Didea.jre.check=true"
}
return jvmArgs.trim()
}
@Override
void notifyArtifactBuilt(String artifactPath) {
if (!underTeamCity) return
@@ -19,9 +19,6 @@ import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.intellij.build.BuildTasks
import org.jetbrains.intellij.build.LinuxDistributionCustomizer
import org.jetbrains.intellij.build.MacDistributionCustomizer
import org.jetbrains.intellij.build.WindowsDistributionCustomizer
import org.jetbrains.jps.model.java.JavaResourceRootType
import org.jetbrains.jps.model.java.JavaSourceRootType
import org.jetbrains.jps.model.module.JpsModule
@@ -86,9 +83,13 @@ class BuildTasksImpl extends BuildTasks {
}
}
//todo[nik] do we need 'cp' and 'jvmArgs' parameters?
@Override
void buildSearchableOptions(String targetModuleName, List<String> modulesToIndex, List<String> pathsToLicenses) {
buildSearchableOptions(new File(buildContext.projectBuilder.moduleOutput(buildContext.findModule(targetModuleName))), modulesToIndex, pathsToLicenses)
}
//todo[nik] do we need 'cp' and 'jvmArgs' parameters?
void buildSearchableOptions(File targetDirectory, List<String> modulesToIndex, List<String> pathsToLicenses) {
//todo[nik] create searchableOptions.xml in a separate directory instead of modifying it in the module output
buildContext.executeStep("Build searchable options index", BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP, {
def javaRuntimeClasses = "${buildContext.projectBuilder.moduleOutput(buildContext.findModule("java-runtime"))}"
@@ -98,8 +99,7 @@ class BuildTasksImpl extends BuildTasks {
buildContext.messages.progress("Building searchable options for modules $modulesToIndex")
def targetModuleOutput = buildContext.projectBuilder.moduleOutput(buildContext.findModule(targetModuleName))
String targetFile = "$targetModuleOutput/search/searchableOptions.xml"
String targetFile = "${targetDirectory.absolutePath}/search/searchableOptions.xml"
FileUtil.delete(new File(targetFile))
def tempDir = "$buildContext.paths.temp/searchableOptions"
@@ -123,6 +123,9 @@ class BuildTasksImpl extends BuildTasks {
sysproperty(key: "idea.home.path", value: buildContext.paths.projectHome)
sysproperty(key: "idea.system.path", value: systemPath)
sysproperty(key: "idea.config.path", value: configPath)
if (buildContext.productProperties.platformPrefix != null) {
sysproperty(key: "idea.platform.prefix", value: buildContext.productProperties.platformPrefix)
}
arg(value: "$classpathFile")
arg(line: "com.intellij.idea.Main traverseUI")
arg(value: targetFile)
@@ -244,6 +247,26 @@ idea.fatal.error.notification=disabled
}
}
@Override
void compileModulesAndBuildDistributions(List<PluginLayout> allPlugins) {
def productLayout = buildContext.productProperties.productLayout
cleanOutput()
def includedModules = productLayout.getIncludedModules(allPlugins)
compileModules(includedModules)
buildContext.messages.block("Build platform and plugin JARs") {
new DistributionJARsBuilder(buildContext, includedModules, allPlugins).buildJARs()
}
if (buildContext.productProperties.scrambleMainJar) {
if (buildContext.scrambleTool != null) {
buildContext.scrambleTool.scramble(buildContext.productProperties.productLayout.mainJarName, buildContext)
}
else {
buildContext.messages.warning("Scrambling skipped: 'srambleTool' isn't defined")
}
}
buildDistributions()
}
@Override
void cleanOutput() {
buildContext.messages.block("Clean output") {
@@ -262,6 +285,11 @@ idea.fatal.error.notification=disabled
@Override
void compileProjectAndTests(List<String> includingTestsInModules = []) {
compileModules(null, includingTestsInModules)
}
@Override
void compileModules(List<String> moduleNames, List<String> includingTestsInModules = []) {
if (buildContext.options.useCompiledClassesFromProjectOutput) {
buildContext.messages.info("Compilation skipped, the compiled classes from the project output will be used")
return
@@ -272,7 +300,18 @@ idea.fatal.error.notification=disabled
}
buildContext.projectBuilder.cleanOutput()
buildContext.projectBuilder.buildProduction()
if (moduleNames == null) {
buildContext.projectBuilder.buildProduction()
}
else {
List<String> modulesToBuild = ((moduleNames as Set<String>) + DistributionJARsBuilder.ADDITIONAL_MODULES_TO_COMPILE
+ buildContext.scrambleTool?.additionalModulesToCompile ?: []) as List<String>
List<String> invalidModules = modulesToBuild.findAll {buildContext.findModule(it) == null}
if (!invalidModules.empty) {
buildContext.messages.warning("The following modules won't be compiled: $invalidModules")
}
buildContext.projectBuilder.buildModules(modulesToBuild.collect {buildContext.findModule(it)}.findAll {it != null})
}
for (String moduleName : includingTestsInModules) {
buildContext.projectBuilder.makeModuleTests(buildContext.findModule(moduleName))
}
@@ -0,0 +1,405 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.PathUtilRt
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.jps.model.java.JpsJavaClasspathKind
import org.jetbrains.jps.model.java.JpsJavaExtensionService
import org.jetbrains.jps.model.module.JpsLibraryDependency
import org.jetbrains.jps.model.module.JpsModule
import org.jetbrains.jps.util.JpsPathUtil
/**
* @author nik
*/
class DistributionJARsBuilder {
public static final List<String> ADDITIONAL_MODULES_TO_COMPILE = [
"java-runtime",//required to build searchable options index
"colorSchemes", "platform-resources", "platform-resources-en", "boot", "icons", "forms_rt", "bootstrap"
]
private static final boolean COMPRESS_JARS = false
private static final String RESOURCES_INCLUDED = "resources.included"
private static final String RESOURCES_EXCLUDED = "resources.excluded"
private final BuildContext buildContext
private final List<PluginLayout> allPlugins
private final Set<String> usedModules = new LinkedHashSet<>()
private final List<String> includedModules
DistributionJARsBuilder(BuildContext buildContext, List<String> includedModules, List<PluginLayout> allPlugins) {
this.includedModules = includedModules
this.buildContext = buildContext
this.allPlugins = allPlugins
buildContext.ant.patternset(id: RESOURCES_INCLUDED) {
include(name: "**/*.properties")
include(name: "fileTemplates/**/*")
include(name: "inspectionDescriptions/**/*")
include(name: "intentionDescriptions/**/*")
include(name: "tips/**/*")
include(name: "search/**/*")
}
buildContext.ant.patternset(id: RESOURCES_EXCLUDED) {
exclude(name: "**/*.properties")
exclude(name: "fileTemplates/**/*")
exclude(name: "fileTemplates")
exclude(name: "inspectionDescriptions/**/*")
exclude(name: "inspectionDescriptions")
exclude(name: "intentionDescriptions/**/*")
exclude(name: "intentionDescriptions")
exclude(name: "tips/**/*")
exclude(name: "tips")
}
}
void buildJARs() {
buildLib()
buildPlugins()
def productProperties = buildContext.productProperties
if (productProperties.generateLibrariesLicensesTable) {
buildContext.messages.block("Generate table of licenses for used third-party libraries") {
def generator = new LibraryLicensesListGenerator(buildContext.projectBuilder, buildContext.project, productProperties.allLibraryLicenses)
generator.generateLicensesTable("$buildContext.paths.artifacts/${buildContext.applicationInfo.productName}-third-party-libraries.txt", usedModules)
}
}
if (productProperties.scrambleMainJar) {
createLayoutBuilder().layout(buildContext.paths.artifacts) {
jar("internalUtilities.jar") {
module("internalUtilities")
}
}
}
}
private void buildLib() {
def ant = buildContext.ant
def layoutBuilder = createLayoutBuilder()
def productLayout = buildContext.productProperties.productLayout
def searchableOptionsDir = new File(buildContext.paths.temp, "searchableOptions/result")
//todo[nik] move buildSearchableOptions and patchedApplicationInfo methods to this class
def buildTasks = new BuildTasksImpl(buildContext)
buildTasks.buildSearchableOptions(searchableOptionsDir, [productLayout.mainModule], productLayout.licenseFilesToBuildSearchableOptions)
if (!buildContext.options.buildStepsToSkip.contains(BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP)) {
layoutBuilder.patchModuleOutput(productLayout.searchableOptionsModule, FileUtil.toSystemIndependentName(searchableOptionsDir.absolutePath))
}
def applicationInfoFile = FileUtil.toSystemIndependentName(buildTasks.patchApplicationInfo().absolutePath)
def applicationInfoDir = "$buildContext.paths.temp/applicationInfo"
ant.copy(file: applicationInfoFile, todir: "$applicationInfoDir/idea")
layoutBuilder.patchModuleOutput(buildContext.productProperties.applicationInfoModule, applicationInfoDir)
if (buildContext.productProperties.reassignAltClickToMultipleCarets) {
def patchedKeyMapDir = createKeyMapWithAltClickReassignedToMultipleCarets()
layoutBuilder.patchModuleOutput("platform-resources", FileUtil.toSystemIndependentName(patchedKeyMapDir.absolutePath))
}
Set<String> usedJars = collectUsedJars(includedModules, []) - productLayout.additionalJarsToUnpackIntoMainJar.collect {FileUtil.toSystemIndependentName(it)}
if (buildContext.scrambleTool != null) {
def forbiddenJarNames = buildContext.scrambleTool.namesOfJarsRequiredToBeScrambled
def forbiddenJars = usedJars.findAll { forbiddenJarNames.contains(PathUtilRt.getFileName(it)) }
if (!forbiddenJars.empty) {
buildContext.messages.error("The following JARs cannot be included into the product 'lib' directory, they need to be scrambled with the main jar: ${forbiddenJars}")
}
}
def communityHome = "$buildContext.paths.communityHome"
def resourcesIncluded = RESOURCES_INCLUDED
def resourcesExcluded = RESOURCES_EXCLUDED
layoutBuilder.layout("$buildContext.paths.distAll/lib") {
jar("util.jar") {
module("util")
module("util-rt")
}
jar("openapi.jar") {
productLayout.platformApiModules.each { module it }
}
jar("annotations.jar") {
module("annotations-common")
module("annotations")
}
jar("extensions.jar") { module("extensions") }
jar("bootstrap.jar") { module("bootstrap") }
jar("resources.jar", true) {
modulePatches(["platform-resources"])
module("colorSchemes")
module("platform-resources")
}
jar("forms_rt.jar") { module("forms_rt") }
productLayout.additionalPlatformModules.entrySet().findAll { it.value != "resources_en.jar" }.each {
def moduleName = it.key
jar(it.value) {
module(moduleName)
}
}
jar("resources_en.jar", true) {
productLayout.additionalPlatformModules.entrySet().findAll { it.value == "resources_en.jar"}.each {
modulePatches([it.key])
module(it.key)
}
module("platform-resources-en")
module("coverage-common") {
ant.patternset(refid: resourcesIncluded)
}
}
jar("icons.jar") { module("icons") }
jar("boot.jar") { module("boot") }
projectLibrary("KotlinJavaRuntime")
jar(productLayout.mainJarName, true, false) {
modulePatches(productLayout.platformImplementationModules)
productLayout.platformImplementationModules.each { module it }
module("coverage-common") {
ant.patternset(refid: resourcesExcluded)
}
productLayout.additionalJarsToUnpackIntoMainJar.each {
ant.zipfileset(src: it)
}
}
usedJars.each {
ant.fileset(file: it)
}
dir("libpty") {
ant.fileset(dir: "$communityHome/lib/libpty") {
exclude(name: "*.txt")
}
}
dir("ext") {//why ext?
projectLibrary("CGLIB")
}
dir("src") {
ant.fileset(dir: "$communityHome/lib/src") {
include(name: "trove4j_changes.txt")
include(name: "trove4j_src.jar")
}
}
}
usedModules.addAll(layoutBuilder.usedModules)
}
private void buildPlugins() {
def ant = buildContext.ant
def productLayout = buildContext.productProperties.productLayout
def layoutBuilder = createLayoutBuilder()
if (buildContext.productProperties.setPluginAndIDEVersionInPluginXml) {
def pluginsToBuild = getPluginsByModules(productLayout.pluginModulesToPublish)
pluginsToBuild.each { plugin ->
def moduleOutput = buildContext.projectBuilder.moduleOutput(buildContext.findRequiredModule(plugin.mainModule))
def pluginXmlPath = "$moduleOutput/META-INF/plugin.xml"
if (!new File(pluginXmlPath)) {
buildContext.messages.error("plugin.xml not found in $plugin.mainModule module: $pluginXmlPath")
}
def patchedPluginXmlDir = "$buildContext.paths.temp/patched-plugin-xml/$plugin.mainModule"
ant.copy(file: pluginXmlPath, todir: "$patchedPluginXmlDir/META-INF")
setPluginVersionAndSince("$patchedPluginXmlDir/META-INF/plugin.xml", buildContext.buildNumber)
layoutBuilder.patchModuleOutput(plugin.mainModule, patchedPluginXmlDir)
}
}
buildPlugins(layoutBuilder, getPluginsByModules(productLayout.bundledPluginModules), "$buildContext.paths.distAll/plugins")
usedModules.addAll(layoutBuilder.usedModules)
def pluginsToPublishDir = "$buildContext.paths.temp/plugins-to-publish"
def pluginsToPublish = getPluginsByModules(productLayout.pluginModulesToPublish)
buildPlugins(layoutBuilder, pluginsToPublish, pluginsToPublishDir)
pluginsToPublish.each { plugin ->
def directory = plugin.directoryName
ant.zip(destfile: "$buildContext.paths.artifacts/plugins/$directory-${buildContext.buildNumber}.zip") {
zipfileset(dir: "$pluginsToPublishDir/$directory", prefix: directory)
}
}
}
private List<PluginLayout> getPluginsByModules(List<String> modules) {
def modulesToInclude = modules as Set<String>
allPlugins.findAll { modulesToInclude.contains(it.mainModule) }
}
private buildPlugins(LayoutBuilder layoutBuilder, List<PluginLayout> pluginsToInclude, String targetDirectory) {
def ant = buildContext.ant
def resourceExcluded = RESOURCES_EXCLUDED
def resourcesIncluded = RESOURCES_INCLUDED
def enabledModulesSet = buildContext.productProperties.productLayout.enabledPluginModules
layoutBuilder.layout(targetDirectory) {
pluginsToInclude.each { plugin ->
dir(plugin.directoryName) {
dir("lib") {
def actualModuleJars = plugin.getActualModules(enabledModulesSet)
actualModuleJars.entrySet().each {
def modules = it.value
def jarPath = it.key
jar(jarPath, true) {
modulePatches(modules)
modules.each { moduleName ->
module(moduleName) {
if (plugin.packLocalizableResourcesInCommonJar(moduleName)) {
ant.patternset(refid: resourceExcluded)
}
plugin.moduleExcludes.get(moduleName)?.each {
ant.exclude(name: "$it/**")
}
}
}
}
}
def modulesWithResources = actualModuleJars.values().findAll { plugin.packLocalizableResourcesInCommonJar(it) }
if (!modulesWithResources.empty) {
jar("resources_en.jar") {
modulesWithResources.each {
module(it) {
ant.patternset(refid: resourcesIncluded)
}
}
}
}
plugin.includedProjectLibraries.each {
projectLibrary(it)
}
//include all module libraries from the plugin modules added to IDE classpath to layout
actualModuleJars.entrySet().findAll {!it.key.contains("/")}.collectMany {it.value}.each { moduleName ->
findModule(moduleName).dependenciesList.dependencies.
findAll { it instanceof JpsLibraryDependency && it?.libraryReference?.parentReference?.resolve() instanceof JpsModule}.
findAll { JpsJavaExtensionService.instance.getDependencyExtension(it)?.scope?.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME) ?: false}.
each {
jpsLibrary(((JpsLibraryDependency)it).library)
}
}
plugin.includedModuleLibraries.each { data ->
dir(data.relativeOutputPath) {
moduleLibrary(data.moduleName, data.libraryName)
}
}
}
plugin.resourcePaths.entrySet().each {
def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
def path = "$contentRoot/$it.key"
dir(it.value) {
if (new File(path).isFile()) {
ant.fileset(file: path)
}
else {
ant.fileset(dir: path)
}
}
}
plugin.resourceArchivePaths.entrySet().each {
def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
def path = "$contentRoot/$it.key"
zip(it.value) {
ant.fileset(dir: path)
}
}
}
}
}
}
private LayoutBuilder createLayoutBuilder() {
new LayoutBuilder(buildContext.ant, buildContext.project, COMPRESS_JARS)
}
private void setPluginVersionAndSince(String pluginXmlPath, String buildNumber) {
buildContext.ant.replaceregexp(file: pluginXmlPath,
match: "<version>[\\d.]*</version>",
replace: "<version>${buildNumber}</version>")
buildContext.ant.replaceregexp(file: pluginXmlPath,
match: "<idea-version\\s*since-build=\"\\d+\\.\\d+\"",
replace: "<idea-version since-build=\"${buildNumber}\"")
buildContext.ant.replaceregexp(file: pluginXmlPath,
match: "<change-notes>\\s*<\\!\\[CDATA\\[\\s*Plugin version: \\\$\\{version\\}",
replace: "<change-notes>\n<![CDATA[\nPlugin version: ${buildNumber}")
def file = new File(pluginXmlPath)
def text = file.text
if (!text.contains("<version>")) {
def dotIndex = buildNumber.indexOf('.')
def untilBuild = dotIndex > 0 ? Integer.parseInt(buildNumber.substring(0, dotIndex)) + ".*" : buildNumber
def anchor = text.contains("</id>") ? "</id>" : "</name>"
file.text = text.replace(anchor,
"${anchor}\n <version>${buildNumber}</version>\n <idea-version since-build=\"${buildNumber}\" until-build=\"${untilBuild}\"/>\n")
}
}
private Set<String> collectUsedJars(List<String> modules, List<String> additionalLibFolders) {
def usedJars = new LinkedHashSet<String>();
List<String> approvedJars =
(["$buildContext.paths.communityHome/lib", "$buildContext.paths.projectHome/lib", "$buildContext.paths.communityHome/xml/relaxng/lib"] as List<String>) +
additionalLibFolders
modules.each {
def module = buildContext.findModule(it)
if (module != null) {
buildContext.projectBuilder.moduleRuntimeClasspath(module, false).each {
File file = new File(it)
if (file.exists()) {
String path = FileUtil.toSystemIndependentName(file.canonicalPath)
if (path.endsWith(".jar") && approvedJars.any { FileUtil.startsWith(path, it) }) {
if (usedJars.add(path)) {
buildContext.messages.info("\tADDED: $path for $module.name")
}
}
}
}
}
}
return usedJars
}
private File createKeyMapWithAltClickReassignedToMultipleCarets() {
def sourceFile = new File("${buildContext.projectBuilder.moduleOutput(buildContext.findModule("platform-resources"))}/idea/Keymap_Default.xml")
String defaultKeymapContent = sourceFile.text
defaultKeymapContent = defaultKeymapContent.replace("<mouse-shortcut keystroke=\"alt button1\"/>", "")
defaultKeymapContent = defaultKeymapContent.replace("<mouse-shortcut keystroke=\"alt shift button1\"/>",
"<mouse-shortcut keystroke=\"alt button1\"/>")
def patchedKeyMapDir = new File(buildContext.paths.temp, "patched-keymap")
def targetFile = new File(patchedKeyMapDir, "idea/Keymap_Default.xml")
FileUtil.createParentDirs(targetFile)
targetFile.text = defaultKeymapContent
return patchedKeyMapDir
}
}
@@ -0,0 +1,221 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.MultiValuesMap
import com.intellij.util.PathUtilRt
import org.apache.tools.ant.AntClassLoader
import org.jetbrains.jps.model.JpsProject
import org.jetbrains.jps.model.library.JpsLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType
import org.jetbrains.jps.model.module.JpsModule
/**
* This is replacement for {@link org.jetbrains.jps.gant.JpsGantTool} which doesn't depend on Gant. It also allows us to patch a module
* output before packing it into JAR.
*
* @author nik
*/
class LayoutBuilder {
private final AntBuilder ant
private final boolean compressJars
final Set<String> usedModules = new LinkedHashSet<>()
private final MultiValuesMap<String, String> moduleOutputPatches = new MultiValuesMap<>(true)
private final JpsProject project
LayoutBuilder(AntBuilder ant, JpsProject project, boolean compressJars) {
this.project = project
this.ant = ant
this.compressJars = compressJars
def contextLoaderRef = "GANT_CONTEXT_CLASS_LOADER";
if (!ant.project.hasReference(contextLoaderRef)) {
ClassLoader contextLoader = Thread.currentThread().contextClassLoader
if (!(contextLoader instanceof AntClassLoader)) {
contextLoader = new AntClassLoader(contextLoader, ant.project, null)
}
ant.project.addReference(contextLoaderRef, contextLoader)
ant.taskdef(name: "layout", loaderRef: contextLoaderRef, classname: "jetbrains.antlayout.tasks.LayoutTask")
}
}
/**
* Contents of {@code pathToDirectoryWithPatchedFiles} will be used to patch the module output. Set 'preserveDuplicates' to {@code true}
* when calling {@link LayoutSpec#jar} and call {@link LayoutSpec#modulePatches} from its body to apply the patches to the JAR.
*/
void patchModuleOutput(String moduleName, String pathToDirectoryWithPatchedFiles) {
moduleOutputPatches.put(moduleName, pathToDirectoryWithPatchedFiles)
}
/**
* Creates the output layout accordingly to {@code data} in {@code targetDirectory}. Please note that {@code data} may refer to local
* variables of its method only. It cannot refer to its fields or methods because data's 'owner' field is changed to support the internal DSL.
*/
void layout(String targetDirectory, @DelegatesTo(LayoutSpec) Closure data) {
def spec = new LayoutSpec()
//we cannot set 'spec' as delegate because 'delegate' will be overwritten by AntBuilder
def body = data.rehydrate(null, spec, data.thisObject)
body.resolveStrategy = Closure.OWNER_FIRST
ant.layout(toDir: targetDirectory, body)
}
class LayoutSpec {
/**
* Create a JAR file with name {@code relativePath} (it may also include parent directories names for the JAR) into the current place
* in the layout. The content of the JAR is specified by {@code body}.
*/
def jar(String relativePath, boolean preserveDuplicates = false, boolean mergeManifests = true, Closure body) {
def directory = PathUtilRt.getParentPath(relativePath)
if (directory == "") {
ant.jar(name: relativePath, compress: compressJars, duplicate: preserveDuplicates ? "preserve" : "fail",
filesetmanifest: mergeManifests ? "merge" : "skip", body)
}
else {
dir(directory) {
jar(PathUtilRt.getFileName(relativePath), preserveDuplicates, mergeManifests, body)
}
}
}
/**
* Create a Zip file with name {@code relativePath} (it may also include parent directories names for the JAR) into the current place
* in the layout. The content of the JAR is specified by {@code body}.
*/
def zip(String relativePath, Closure body) {
def directory = PathUtilRt.getParentPath(relativePath)
if (directory == "") {
ant.zip(name: relativePath, body)
}
else {
dir(directory) {
zip(PathUtilRt.getFileName(relativePath), body)
}
}
}
/**
* Create a directory (or several nested directories) {@code relativePath} in the current place in the layout. The content of the
* directory is specified by {@code body}.
*/
def dir(String relativePath, Closure body) {
def parent = PathUtilRt.getParentPath(relativePath)
if (relativePath.empty) {
body()
}
else if (parent.empty) {
ant.dir(name: relativePath, body)
}
else {
dir(parent) {
dir(PathUtilRt.getFileName(relativePath), body)
}
}
}
/**
* Include the patched outputs of {@code moduleNames} modules to the current place in the layout. This method is supposed to be called
* in the {@code body} of {@link #jar} with 'preserveDuplicates' set to {@code true}
*/
def modulePatches(Collection<String> moduleNames) {
moduleNames.each {
moduleOutputPatches.get(it)?.each {
ant.fileset(dir: it)
}
}
}
/**
* Include production output of {@code moduleName} to the current place in the layout
*/
def module(String moduleName, Closure body = {}) {
usedModules << moduleName
ant.module(name: moduleName, body)
}
/**
* Include test output of {@code moduleName} to the current place in the layout
*/
def moduleTests(String moduleName, Closure body = {}) {
ant.moduleTests(name: moduleName, body)
}
/**
* Include JARs added as classes roots of project library {@code libraryName} to the current place in the layout
*/
def projectLibrary(String libraryName) {
def library = project.libraryCollection.findLibrary(libraryName)
if (library == null) {
throw new IllegalArgumentException("Cannot find library $libraryName in the project")
}
jpsLibrary(library)
}
/**
* Include JARs added as classes roots of a module library {@code libraryName} from module {@code moduleName} to the current place in the layout
*/
def moduleLibrary(String moduleName, String libraryName) {
def module = findModule(moduleName)
def library = module.libraryCollection.libraries.find {getLibraryName(it) == libraryName}
if (library == null) {
throw new IllegalArgumentException("Cannot find library $libraryName in '$moduleName' module")
}
jpsLibrary(library)
}
def jpsLibrary(JpsLibrary library) {
library.getFiles(JpsOrderRootType.COMPILED).each {
ant.fileset(file: it.absolutePath)
}
}
def JpsModule findModule(String name) {
def module = project.modules.find { it.name == name }
if (module == null) {
throw new IllegalArgumentException("Cannot find module '$name' in the project")
}
module
}
private String getLibraryName(JpsLibrary lib) {
def name = lib.name
if (name.startsWith("#")) {
if (lib.getRoots(JpsOrderRootType.COMPILED).size() != 1) {
def urls = lib.getRoots(JpsOrderRootType.COMPILED).collect { it.url }
throw new IllegalStateException("Non-single entry module library $name: $urls");
}
File file = lib.getFiles(JpsOrderRootType.COMPILED)[0]
return file.name
}
return name
}
}
}
@@ -36,7 +36,11 @@ class LinuxDistributionBuilder {
//todo[nik] rename
void layoutUnix(File ideaProperties) {
buildContext.ant.copy(todir: "$unixDistPath/bin") {
fileset(dir: "$buildContext.paths.communityHome/bin/linux")
fileset(dir: "$buildContext.paths.communityHome/bin/linux") {
if (!buildContext.includeBreakGenLibraries()) {
exclude(name: "libbreakgen*")
}
}
if (buildContext.productProperties.yourkitAgentBinariesDirectoryPath != null) {
fileset(dir: buildContext.productProperties.yourkitAgentBinariesDirectoryPath) {
include(name: "libyjpagent-linux*.so")
@@ -47,7 +51,9 @@ class LinuxDistributionBuilder {
//todo[nik] converting line separators to unix-style make sense only when building Linux distributions under Windows on a local machine;
// for real installers we need to checkout all text files with 'lf' separators anyway
buildContext.ant.fixcrlf(file: "$unixDistPath/bin/idea.properties", eol: "unix")
buildContext.ant.copy(file: customizer.iconPngPath, tofile: "$unixDistPath/bin/${buildContext.productProperties.baseFileName}.png")
if (customizer.iconPngPath != null) {
buildContext.ant.copy(file: customizer.iconPngPath, tofile: "$unixDistPath/bin/${buildContext.productProperties.baseFileName}.png")
}
unixScripts()
unixVMOptions()
@@ -70,10 +76,8 @@ class LinuxDistributionBuilder {
String classPath = "CLASSPATH=\"\$IDE_HOME/lib/${buildContext.bootClassPathJarNames[0]}\"\n"
classPath += buildContext.bootClassPathJarNames[1..-1].collect { "CLASSPATH=\"\$CLASSPATH:\$IDE_HOME/lib/${it}\"" }.join("\n")
def jvmArgs = buildContext.productProperties.additionalIdeJvmArguments
if (buildContext.productProperties.toolsJarRequired) {
classPath += "\nCLASSPATH=\"\$CLASSPATH:\$JDK/lib/tools.jar\""
jvmArgs = "$jvmArgs -Didea.jre.check=true".trim()
}
buildContext.ant.copy(todir: "${unixDistPath}/bin") {
@@ -81,11 +85,11 @@ class LinuxDistributionBuilder {
filterset(begintoken: "@@", endtoken: "@@") {
filter(token: "product_full", value: fullName)
filter(token: "product_uc", value: buildContext.applicationInfo.upperCaseProductName)
filter(token: "product_uc", value: buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo))
filter(token: "vm_options", value: vmOptionsFileName)
filter(token: "isEap", value: buildContext.applicationInfo.isEAP)
filter(token: "system_selector", value: buildContext.systemSelector)
filter(token: "ide_jvm_args", value: jvmArgs)
filter(token: "ide_jvm_args", value: buildContext.additionalJvmArguments)
filter(token: "class_path", value: classPath)
filter(token: "script_name", value: name)
}
@@ -15,12 +15,14 @@
*/
package org.jetbrains.intellij.build.impl
import com.intellij.util.PathUtilRt
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.intellij.build.JvmArchitecture
import org.jetbrains.intellij.build.MacDistributionCustomizer
import java.time.LocalDate
/**
* @author nik
*/
@@ -36,21 +38,25 @@ class MacDistributionBuilder {
}
public layoutMac(File ideaPropertiesFile) {
def docTypes = customizer.docTypes ?: """
def docTypes = (customizer.associateIpr ? """
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ipr</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>${buildContext.productProperties.baseFileName}.icns</string>
<string>${PathUtilRt.getFileName(customizer.icnsPath ?: "idea.icns")}</string>
<key>CFBundleTypeName</key>
<string>${buildContext.applicationInfo.productName} Project File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
"""
Map<String, String> customIdeaProperties = ["idea.jre.check": "$buildContext.productProperties.toolsJarRequired"];
""" : "") + customizer.additionalDocTypes
Map<String, String> customIdeaProperties = [:]
if (buildContext.productProperties.toolsJarRequired) {
customIdeaProperties["idea.jre.check"] = "true"
}
customIdeaProperties.putAll(customizer.customIdeaProperties(buildContext.applicationInfo))
layoutMacApp(ideaPropertiesFile, customIdeaProperties, docTypes)
customizer.copyAdditionalFiles(buildContext, macDistPath)
def macZipPath = buildMacZip()
@@ -0,0 +1,200 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.MultiValuesMap
import groovy.transform.Immutable
/**
* @author nik
*/
class PluginLayout {
final String mainModule
String directoryName
/** JAR name (or path relative to 'lib' directory) to module name */
final MultiValuesMap<String, String> moduleJars = new MultiValuesMap<>(true)
/** source directory -> relative path to a target directory under the plugin directory */
final Map<String, String> resourcePaths = [:]
/** source directory -> relative path to a zip file under the plugin directory */
final Map<String, String> resourceArchivePaths = [:]
/** module name to entries which should be excluded from its output */
final MultiValuesMap<String, String> moduleExcludes = new MultiValuesMap<>(true)
final List<String> includedProjectLibraries = []
final List<ModuleLibraryData> includedModuleLibraries = []
private final Set<String> optionalModules = new LinkedHashSet<>()
private final Set<String> modulesWithLocalizableResourcesInCommonJar = new LinkedHashSet<>()
private boolean doNotCreateSeparateJarForLocalizableResources
private PluginLayout(String mainModule) {
this.mainModule = mainModule
}
/**
* Creates the plugin layout description. The default plugin layout is composed of a jar with name {@code mainModuleName}.jar containing output of
* {@code mainModuleName}, resources_en.jar containing translatable resources from {@code mainModuleName}, and the module libraries of
* {@code mainModuleName} with scopes 'Compile' and 'Runtime' placed under 'lib' directory in a directory with name {@code mainModuleName}.
* In you need to include additional resources or modules into the plugin layout specify them in {@code body} parameter.
*
* @param mainModuleName name of the module containing META-INF/plugin.xml file of the plugin
*/
static PluginLayout plugin(String mainModuleName, @DelegatesTo(PluginLayoutSpec) Closure body = {}) {
def layout = new PluginLayout(mainModuleName)
def spec = new PluginLayoutSpec(layout)
body.delegate = spec
body()
layout.directoryName = spec.directoryName
spec.withModule(mainModuleName, spec.mainJarName)
if (layout.doNotCreateSeparateJarForLocalizableResources) {
layout.modulesWithLocalizableResourcesInCommonJar.clear()
}
return layout
}
MultiValuesMap<String, String> getActualModules(Set<String> enabledPluginModules) {
def result = new MultiValuesMap<String, String>(true)
for (Map.Entry<String, Collection<String>> entry : moduleJars.entrySet()) {
for (String moduleName : entry.getValue()) {
if (!optionalModules.contains(moduleName) || enabledPluginModules.contains(moduleName)) {
result.put(entry.key, moduleName)
}
}
}
return result
}
boolean packLocalizableResourcesInCommonJar(String moduleName) {
return modulesWithLocalizableResourcesInCommonJar.contains(moduleName)
}
static class PluginLayoutSpec {
private final PluginLayout layout
/**
* Name of the directory (under 'plugins' directory) where the plugin should be placed
*/
String directoryName
/**
* Name of the main plugin JAR file
*/
String mainJarName
PluginLayoutSpec(PluginLayout layout) {
this.layout = layout
directoryName = layout.mainModule
mainJarName = "${layout.mainModule}.jar"
}
/**
* Register an optional module which may be excluded from the plugin distribution in some products
*/
void withOptionalModule(String moduleName, String relativeJarPath = "${moduleName}.jar") {
layout.optionalModules << moduleName
withModule(moduleName, relativeJarPath)
}
/**
* Register an additional module to be included into the plugin distribution. If {@code relativeJarPath} doesn't contain '/' (i.e. the
* JAR will be added to the plugin's classpath) this will also cause modules library from {@code moduleName} with scopes 'Compile' and
* 'Runtime' to be copied to the 'lib' directory of the plugin.
*
* @param relativeJarPath target JAR path relative to 'lib' directory of the plugin; different modules may be packed into the same JAR,
* but don't use this for new plugins; this parameter is temporary added to keep layout of old plugins.
* @param localizableResourcesInCommonJar if {@code true} the translatable resources from the module (messages, inspection descriptions, etc) will be
* placed into a separate 'resources_en.jar'. <strong>Do not use this for new plugins, this parameter is temporary added to keep layout of old plugins</strong>.
*/
void withModule(String moduleName, String relativeJarPath = "${moduleName}.jar", boolean localizableResourcesInCommonJar = true) {
if (localizableResourcesInCommonJar) {
layout.modulesWithLocalizableResourcesInCommonJar << moduleName
}
layout.moduleJars.put(relativeJarPath, moduleName)
}
void withJpsModule(String moduleName) {
withModule(moduleName, "jps/${moduleName}.jar")
}
/**
* @param resourcePath path to resource file or directory relative to the plugin's main module content root
* @param relativeOutputDirectory target path relative to the plugin root directory
*/
void withResource(String resourcePath, String relativeOutputDirectory) {
layout.resourcePaths[resourcePath] = relativeOutputDirectory
}
/**
* @param resourcePath path to resource file or directory relative to the plugin's main module content root
* @param relativeOutputFile target path relative to the plugin root directory
*/
void withResourceArchive(String resourcePath, String relativeOutputFile) {
layout.resourceArchivePaths[resourcePath] = relativeOutputFile
}
/**
* Include the project library to 'lib' directory of the plugin distribution
*/
void withProjectLibrary(String libraryName) {
layout.includedProjectLibraries << libraryName
}
/**
* Include the module library to the plugin distribution. Please note that it makes sense to call this method only
* for additional modules which aren't copied directly to the 'lib' directory of the plugin distribution, because for ordinary modules
* their module libraries are included into the layout automatically.
*/
void withModuleLibrary(String libraryName, String moduleName = layout.mainModule, String relativeOutputPath) {
layout.includedModuleLibraries << new ModuleLibraryData(moduleName: moduleName, libraryName: libraryName, relativeOutputPath: relativeOutputPath)
}
/**
* Exclude the specified directory when {@code moduleName} is packed into JAR file.
* <strong>This is a temporary method added to keep layout of some old plugins. If some directory from a module shouldn't be included into the
* module JAR it's strongly recommended to move that directory outside of the module source roots.</strong>
* @param excludedDirectory path to the directory to be exclude relatively to the module output root
*/
void excludeFromModule(String moduleName, String excludedDirectory) {
layout.moduleExcludes.put(moduleName, excludedDirectory)
}
/**
* Do not create 'resources_en.jar' and pack all resources into corresponding module JARs.
* <strong>Do not use this for new plugins, this method is temporary added to keep layout of old plugins</strong>.
*/
void doNotCreateSeperateJarForLocalizableResources() {
layout.doNotCreateSeparateJarForLocalizableResources = true
}
}
@Immutable
static class ModuleLibraryData {
String moduleName
String libraryName
String relativeOutputPath
}
}
@@ -122,13 +122,12 @@ class WinExeInstallerBuilder {
!define PRODUCT_VM_OPTIONS_FILE "${toSystemDependentName("$winDistPath/bin/")}\${PRODUCT_VM_OPTIONS_NAME}"
"""
String fullProductName = productProperties.fullNameIncludingEdition(buildContext.applicationInfo)
def extensionsList = customizer.fileAssociations
def fileAssociations = extensionsList.isEmpty() ? "NoAssociation" : extensionsList.join(",")
new File(box, "nsiconf/strings.nsi").text = """
!define MANUFACTURER "JetBrains"
!define MUI_PRODUCT "$fullProductName"
!define PRODUCT_FULL_NAME "$fullProductName"
!define MANUFACTURER "${buildContext.applicationInfo.shortCompanyName}"
!define MUI_PRODUCT "${customizer.fullNameIncludingEdition(buildContext.applicationInfo)}"
!define PRODUCT_FULL_NAME "${customizer.fullNameIncludingEditionAndVendor(buildContext.applicationInfo)}"
!define PRODUCT_EXE_FILE "${productProperties.baseFileName}.exe"
!define PRODUCT_EXE_FILE_64 "${productProperties.baseFileName}64.exe"
!define PRODUCT_ICON_FILE "install.ico"
@@ -138,7 +137,7 @@ class WinExeInstallerBuilder {
!define ASSOCIATION "$fileAssociations"
!define UNINSTALL_WEB_PAGE "${customizer.uninstallFeedbackPageUrl(buildContext.applicationInfo) ?: "feedback_web_page"}"
; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDEA build has been installed
; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDE build has been installed
; set to 1 for release build
!define SHOULD_SET_DEFAULT_INSTDIR "0"
@@ -20,6 +20,7 @@ import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.intellij.build.JvmArchitecture
import org.jetbrains.intellij.build.WindowsDistributionCustomizer
import org.jetbrains.jps.model.module.JpsModuleSourceRoot
/**
* @author nik
*/
@@ -37,7 +38,11 @@ class WindowsDistributionBuilder {
//todo[nik] rename
void layoutWin(File ideaProperties) {
buildContext.ant.copy(todir: "$winDistPath/bin") {
fileset(dir: "$buildContext.paths.communityHome/bin/win")
fileset(dir: "$buildContext.paths.communityHome/bin/win") {
if (!buildContext.includeBreakGenLibraries()) {
exclude(name: "breakgen*")
}
}
if (buildContext.productProperties.yourkitAgentBinariesDirectoryPath != null) {
fileset(dir: buildContext.productProperties.yourkitAgentBinariesDirectoryPath) {
include(name: "yjpagent*.dll")
@@ -47,7 +52,9 @@ class WindowsDistributionBuilder {
buildContext.ant.copy(file: ideaProperties.path, todir: "$winDistPath/bin")
buildContext.ant.fixcrlf(file: "$winDistPath/bin/idea.properties", eol: "dos")
buildContext.ant.copy(file: customizer.icoPath, tofile: "$winDistPath/bin/${buildContext.productProperties.baseFileName}.ico")
if (customizer.icoPath != null) {
buildContext.ant.copy(file: customizer.icoPath, tofile: "$winDistPath/bin/${buildContext.productProperties.baseFileName}.ico")
}
if (customizer.includeBatchLaunchers) {
winScripts()
}
@@ -58,7 +65,7 @@ class WindowsDistributionBuilder {
def arch = customizer.bundledJreArchitecture
def jreDirectoryPath = arch != null ? buildContext.bundledJreManager.extractWinJre(arch) : null
buildWinZip(jreDirectoryPath, ".win")
buildWinZip(jreDirectoryPath, buildContext.productProperties.buildCrossPlatformDistribution ? ".win" : "")
if (arch != null && customizer.buildZipWithBundledOracleJre) {
String oracleJrePath = buildContext.bundledJreManager.extractOracleWinJre(arch)
if (oracleJrePath != null) {
@@ -82,7 +89,6 @@ class WindowsDistributionBuilder {
String classPath = "SET CLASS_PATH=%IDE_HOME%\\lib\\${buildContext.bootClassPathJarNames[0]}\n"
classPath += buildContext.bootClassPathJarNames[1..-1].collect { "SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\\lib\\$it" }.join("\n")
def jvmArgs = getAdditionalJvmArguments()
if (buildContext.productProperties.toolsJarRequired) {
classPath += "\nSET CLASS_PATH=%CLASS_PATH%;%JDK%\\lib\\tools.jar"
}
@@ -93,11 +99,11 @@ class WindowsDistributionBuilder {
filterset(begintoken: "@@", endtoken: "@@") {
filter(token: "product_full", value: fullName)
filter(token: "product_uc", value: buildContext.applicationInfo.upperCaseProductName)
filter(token: "product_uc", value: buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo))
filter(token: "vm_options", value: vmOptionsFileName)
filter(token: "isEap", value: buildContext.applicationInfo.isEAP)
filter(token: "system_selector", value: buildContext.systemSelector)
filter(token: "ide_jvm_args", value: jvmArgs)
filter(token: "ide_jvm_args", value: buildContext.additionalJvmArguments)
filter(token: "class_path", value: classPath)
filter(token: "script_name", value: batName)
}
@@ -116,14 +122,6 @@ class WindowsDistributionBuilder {
buildContext.ant.fixcrlf(srcdir: "$winDistPath/bin", includes: "*.bat", eol: "dos")
}
private String getAdditionalJvmArguments() {
def jvmArgs = buildContext.productProperties.additionalIdeJvmArguments
if (buildContext.productProperties.toolsJarRequired) {
return "$jvmArgs -Didea.jre.check=true".trim()
}
return jvmArgs
}
//todo[nik] rename
private void winVMOptions() {
JvmArchitecture.values().each {
@@ -141,37 +139,32 @@ class WindowsDistributionBuilder {
def launcherPropertiesPath = "${buildContext.paths.temp}/launcher${arch.fileSuffix}.properties"
def upperCaseProductName = buildContext.applicationInfo.upperCaseProductName
def lowerCaseProductName = buildContext.applicationInfo.shortProductName.toLowerCase()
String vmOptions
if (buildContext.productProperties.platformPrefix != null
//todo[nik] remove later. This is added to keep current behavior (platform prefix for CE is set in MainImpl anyway)
&& buildContext.productProperties.platformPrefix != "Idea") {
vmOptions = "-Didea.platform.prefix=${buildContext.productProperties.platformPrefix}"
}
else {
vmOptions = ""
}
vmOptions = "$vmOptions -Didea.paths.selector=${buildContext.systemSelector} ${getAdditionalJvmArguments()}".trim()
String vmOptions = "$buildContext.additionalJvmArguments -Didea.paths.selector=${buildContext.systemSelector}".trim()
def productName = buildContext.applicationInfo.upperCaseProductName //todo[nik] use '.productName' instead
String jdkEnvVarSuffix = arch == JvmArchitecture.x64 ? "_64" : "";
def envVarBaseName = buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo)
new File(launcherPropertiesPath).text = """
IDS_JDK_ONLY=$buildContext.productProperties.toolsJarRequired
IDS_JDK_ENV_VAR=${upperCaseProductName}_JDK${jdkEnvVarSuffix}
IDS_APP_TITLE=${productName} Launcher
IDS_JDK_ENV_VAR=${envVarBaseName}_JDK$jdkEnvVarSuffix
IDS_APP_TITLE=$productName Launcher
IDS_VM_OPTIONS_PATH=%USERPROFILE%\\\\.$buildContext.systemSelector
IDS_VM_OPTION_ERRORFILE=-XX:ErrorFile=%USERPROFILE%\\\\java_error_in_${lowerCaseProductName}_%p.log
IDS_VM_OPTION_HEAPDUMPPATH=-XX:HeapDumpPath=%USERPROFILE%\\\\java_error_in_${lowerCaseProductName}.hprof
IDC_WINLAUNCHER=${upperCaseProductName}_LAUNCHER
IDS_PROPS_ENV_VAR=${upperCaseProductName}_PROPERTIES
IDS_VM_OPTIONS_ENV_VAR=${upperCaseProductName}${arch.fileSuffix}_VM_OPTIONS
IDS_ERROR_LAUNCHING_APP=Error launching ${productName}
IDS_PROPS_ENV_VAR=${envVarBaseName}_PROPERTIES
IDS_VM_OPTIONS_ENV_VAR=$envVarBaseName${arch.fileSuffix}_VM_OPTIONS
IDS_ERROR_LAUNCHING_APP=Error launching $productName
IDS_VM_OPTIONS=$vmOptions
""".trim()
def communityHome = "$buildContext.paths.communityHome"
String inputPath = "$communityHome/bin/WinLauncher/WinLauncher${arch.fileSuffix}.exe"
def outputPath = "$winDistPath/bin/$exeFileName"
def resourceModules = [buildContext.findApplicationInfoModule(), buildContext.findModule("icons")]
if (buildContext.productProperties.brandingModule != null) {
resourceModules << buildContext.findRequiredModule(buildContext.productProperties.brandingModule)
}
buildContext.ant.java(classname: "com.pme.launcher.LauncherGeneratorMain", fork: "true", failonerror: "true") {
sysproperty(key: "java.awt.headless", value: "true")
arg(value: inputPath)
@@ -186,7 +179,7 @@ IDS_VM_OPTIONS=$vmOptions
include(name: "jdom.jar")
include(name: "sanselan*.jar")
}
[buildContext.findApplicationInfoModule(), buildContext.findModule("icons")].collectMany { it.sourceRoots }.each { JpsModuleSourceRoot root ->
resourceModules.collectMany { it.sourceRoots }.each { JpsModuleSourceRoot root ->
pathelement(location: root.file.absolutePath)
}
}
@@ -16,6 +16,7 @@
package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInspection.dataFlow.instructions.*;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.openapi.diagnostic.Logger;
@@ -1041,9 +1042,9 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
((PsiResourceExpression)resource).getExpression().accept(this);
}
PsiMethod closer = PsiUtil.getResourceCloserMethod(resource);
if (closer != null) {
addMethodThrows(closer, null);
final List<PsiClassType> closerExceptions = ExceptionUtil.getCloserExceptions(resource);
if (!closerExceptions.isEmpty()) {
addThrows(null, findNextCatch(false), closerExceptions.toArray(new PsiClassType[closerExceptions.size()]));
}
}
}
@@ -1411,15 +1412,19 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
CatchDescriptor cd = findNextCatch(false);
if (method != null) {
PsiClassType[] refs = method.getThrowsList().getReferencedTypes();
for (PsiClassType ref : refs) {
pushUnknown();
ConditionalGotoInstruction cond = new ConditionalGotoInstruction(null, false, null);
addInstruction(cond);
addInstruction(new EmptyStackInstruction());
initException(ref, cd);
addThrowCode(cd, explicitCall);
cond.setOffset(myCurrentFlow.getInstructionCount());
}
addThrows(explicitCall, cd, refs);
}
}
private void addThrows(@Nullable PsiElement explicitCall, CatchDescriptor cd, PsiClassType[] refs) {
for (PsiClassType ref : refs) {
pushUnknown();
ConditionalGotoInstruction cond = new ConditionalGotoInstruction(null, false, null);
addInstruction(cond);
addInstruction(new EmptyStackInstruction());
initException(ref, cd);
addThrowCode(cd, explicitCall);
cond.setOffset(myCurrentFlow.getInstructionCount());
}
}
@@ -100,11 +100,6 @@ public class TryWithResourcesPostfixTemplate extends PostfixTemplate {
@NotNull
private static Collection<PsiClassType> getUnhandled(@NotNull PsiExpression expression) {
assert expression.getType() != null;
PsiMethod methodCloser = PsiUtil.getResourceCloserMethodForType((PsiClassType)expression.getType());
PsiSubstitutor substitutor = PsiUtil.resolveGenericsClassInType(expression.getType()).getSubstitutor();
return methodCloser != null
? ExceptionUtil.getUnhandledExceptions(methodCloser, expression, null, substitutor)
: Collections.<PsiClassType>emptyList();
return ExceptionUtil.getUnhandledCloserExceptions(expression, null, expression.getType());
}
}
@@ -216,36 +216,46 @@ public class LambdaUtil {
}
@Nullable
public static List<HierarchicalMethodSignature> findFunctionCandidates(PsiClass psiClass) {
public static List<HierarchicalMethodSignature> findFunctionCandidates(final PsiClass psiClass) {
if (psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType()) {
final List<HierarchicalMethodSignature> methods = new ArrayList<HierarchicalMethodSignature>();
final Map<MethodSignature, Set<PsiMethod>> overrideEquivalents = PsiSuperMethodUtil.collectOverrideEquivalents(psiClass);
final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
for (HierarchicalMethodSignature signature : visibleSignatures) {
final PsiMethod psiMethod = signature.getMethod();
if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) continue;
final Set<PsiMethod> equivalentMethods = overrideEquivalents.get(signature);
if (equivalentMethods != null && equivalentMethods.size() > 1) {
boolean hasNonAbstractOverrideEquivalent = false;
for (PsiMethod method : equivalentMethods) {
if (!method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(method, psiMethod)) {
hasNonAbstractOverrideEquivalent = true;
break;
}
}
if (hasNonAbstractOverrideEquivalent) continue;
return CachedValuesManager.getCachedValue(psiClass, new CachedValueProvider<List<HierarchicalMethodSignature>>() {
@Nullable
@Override
public Result<List<HierarchicalMethodSignature>> compute() {
return Result.create(calcFunctionCandidates(psiClass), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
if (!overridesPublicObjectMethod(signature)) {
methods.add(signature);
}
}
return hasSubsignature(methods);
});
}
return null;
}
private static List<HierarchicalMethodSignature> calcFunctionCandidates(PsiClass psiClass) {
final List<HierarchicalMethodSignature> methods = new ArrayList<HierarchicalMethodSignature>();
final Map<MethodSignature, Set<PsiMethod>> overrideEquivalents = PsiSuperMethodUtil.collectOverrideEquivalents(psiClass);
final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
for (HierarchicalMethodSignature signature : visibleSignatures) {
final PsiMethod psiMethod = signature.getMethod();
if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) continue;
final Set<PsiMethod> equivalentMethods = overrideEquivalents.get(signature);
if (equivalentMethods != null && equivalentMethods.size() > 1) {
boolean hasNonAbstractOverrideEquivalent = false;
for (PsiMethod method : equivalentMethods) {
if (!method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(method, psiMethod)) {
hasNonAbstractOverrideEquivalent = true;
break;
}
}
if (hasNonAbstractOverrideEquivalent) continue;
}
if (!overridesPublicObjectMethod(signature)) {
methods.add(signature);
}
}
return hasSubsignature(methods);
}
@Nullable
private static PsiType getReturnType(PsiClass psiClass, MethodSignature methodSignature) {
@@ -1137,20 +1137,9 @@ public final class PsiUtil extends PsiUtilCore {
return name != null && IGNORED_NAMES.contains(name);
}
@Nullable
public static PsiMethod getResourceCloserMethod(@NotNull PsiResourceListElement resource) {
PsiType resourceType = resource.getType();
return resourceType instanceof PsiClassType ? getResourceCloserMethodForType((PsiClassType)resourceType) : null;
}
/** @deprecated use {@link #getResourceCloserMethod(PsiResourceListElement)} (to be removed in IDEA 17) */
@SuppressWarnings("unused")
public static PsiMethod getResourceCloserMethod(@NotNull PsiResourceVariable resource) {
return getResourceCloserMethod((PsiResourceListElement)resource);
}
@Nullable
public static PsiMethod getResourceCloserMethodForType(@NotNull final PsiClassType resourceType) {
public static PsiMethod[] getResourceCloserMethodsForType(@NotNull final PsiClassType resourceType) {
final PsiClass resourceClass = resourceType.resolve();
if (resourceClass == null) return null;
@@ -1162,7 +1151,10 @@ public final class PsiUtil extends PsiUtilCore {
if (JavaClassSupers.getInstance().getSuperClassSubstitutor(autoCloseable, resourceClass, resourceType.getResolveScope(), PsiSubstitutor.EMPTY) == null) return null;
final PsiMethod[] closes = autoCloseable.findMethodsByName("close", false);
return closes.length == 1 ? resourceClass.findMethodBySignature(closes[0], true) : null;
if (closes.length == 1) {
return resourceClass.findMethodsBySignature(closes[0], true);
}
return null;
}
@Nullable
@@ -38,8 +38,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
import static com.intellij.openapi.util.Pair.pair;
/**
* @author mike
*/
@@ -533,38 +531,66 @@ public class ExceptionUtil {
if (psiType instanceof PsiClassType) {
ex.add((PsiClassType)psiType);
}
else if (psiType instanceof PsiCapturedWildcardType) {
final PsiCapturedWildcardType capturedWildcardType = (PsiCapturedWildcardType)psiType;
final PsiType upperBound = capturedWildcardType.getUpperBound();
if (upperBound instanceof PsiClassType) {
ex.add((PsiClassType)upperBound);
}
}
}
return ex;
}
@NotNull
public static List<PsiClassType> getCloserExceptions(@NotNull PsiResourceListElement resource) {
Pair<PsiMethod, PsiSubstitutor> closer = resolveCloser(resource);
return closer != null ? getExceptionsByMethod(closer.first, closer.second, resource) : Collections.<PsiClassType>emptyList();
List<PsiClassType> ex = getExceptionsFromClose(resource);
return ex != null ? ex : Collections.<PsiClassType>emptyList();
}
@NotNull
public static List<PsiClassType> getUnhandledCloserExceptions(@NotNull PsiResourceListElement resource, @Nullable PsiElement topElement) {
Pair<PsiMethod, PsiSubstitutor> closer = resolveCloser(resource);
return closer != null ? getUnhandledExceptions(closer.first, resource, topElement, closer.second) : Collections.<PsiClassType>emptyList();
final PsiType type = resource.getType();
return getUnhandledCloserExceptions(resource, topElement, type);
}
private static Pair<PsiMethod, PsiSubstitutor> resolveCloser(PsiResourceListElement resource) {
PsiMethod method = PsiUtil.getResourceCloserMethod(resource);
if (method != null) {
PsiClass closerClass = method.getContainingClass();
if (closerClass != null) {
PsiClassType.ClassResolveResult resourceType = PsiUtil.resolveGenericsClassInType(resource.getType());
if (resourceType != null) {
PsiClass resourceClass = resourceType.getElement();
if (resourceClass != null) {
PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(closerClass, resourceClass, resourceType.getSubstitutor());
if (substitutor != null) {
return pair(method, substitutor);
@NotNull
public static List<PsiClassType> getUnhandledCloserExceptions(PsiElement place, @Nullable PsiElement topElement, PsiType type) {
List<PsiClassType> ex = type instanceof PsiClassType ? getExceptionsFromClose(type, place.getResolveScope()) : null;
return ex != null ? getUnhandledExceptions(place, topElement, PsiSubstitutor.EMPTY, ex.toArray(new PsiClassType[ex.size()])) : Collections.<PsiClassType>emptyList();
}
private static List<PsiClassType> getExceptionsFromClose(PsiResourceListElement resource) {
final PsiType type = resource.getType();
return type instanceof PsiClassType ? getExceptionsFromClose(type, resource.getResolveScope()) : null;
}
private static List<PsiClassType> getExceptionsFromClose(PsiType type, GlobalSearchScope scope) {
PsiClassType.ClassResolveResult resourceType = PsiUtil.resolveGenericsClassInType(type);
PsiClass resourceClass = resourceType.getElement();
if (resourceClass == null) return null;
PsiMethod[] methods = PsiUtil.getResourceCloserMethodsForType((PsiClassType)type);
if (methods != null) {
List<PsiClassType> ex = null;
for (PsiMethod method : methods) {
PsiClass closerClass = method.getContainingClass();
if (closerClass != null) {
PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(closerClass, resourceClass, resourceType.getSubstitutor());
if (substitutor != null) {
final PsiClassType[] exceptionTypes = method.getThrowsList().getReferencedTypes();
if (exceptionTypes.length == 0) return Collections.emptyList();
if (ex == null) {
ex = collectSubstituted(substitutor, exceptionTypes, scope);
}
else {
retainExceptions(ex, collectSubstituted(substitutor, exceptionTypes, scope));
}
}
}
}
return ex;
}
return null;
@@ -20,6 +20,7 @@ import com.intellij.lang.LighterAST;
import com.intellij.lang.LighterASTNode;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.impl.cache.RecordUtil;
import com.intellij.psi.impl.cache.TypeInfo;
import com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl;
@@ -169,8 +170,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
if (paramStub instanceof PsiParameterStub) {
TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
if (type.arrayCount > 0) continue;
String typeName = type.getShortTypeText();
String typeName = PsiNameHelper.getShortClassName(type.text);
if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
@@ -38,7 +38,7 @@ import java.io.IOException;
* @author max
*/
public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileStub> {
public static final int STUB_VERSION = 27;
public static final int STUB_VERSION = 28;
public JavaFileElementType() {
super("java.FILE", JavaLanguage.INSTANCE);
@@ -28,6 +28,7 @@ import com.intellij.psi.util.PsiUtil;
import com.intellij.util.CharTable;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.JBIterable;
import com.intellij.util.containers.Stack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -92,7 +93,9 @@ public class JavaSharedImplUtil {
if (modifierList != null) {
PsiAnnotation[] annotations = modifierList.getAnnotations();
if (annotations.length > 0) {
TypeAnnotationProvider provider = new FilteringTypeAnnotationProvider(annotations);
TypeAnnotationProvider original =
modifierList.getParent() instanceof PsiMethod ? type.getAnnotationProvider() : TypeAnnotationProvider.EMPTY;
TypeAnnotationProvider provider = new FilteringTypeAnnotationProvider(annotations, original);
if (type instanceof PsiArrayType) {
Stack<PsiArrayType> types = new Stack<PsiArrayType>();
do {
@@ -196,10 +199,12 @@ public class JavaSharedImplUtil {
private static class FilteringTypeAnnotationProvider implements TypeAnnotationProvider {
private final PsiAnnotation[] myCandidates;
private final TypeAnnotationProvider myOriginalProvider;
private volatile PsiAnnotation[] myCache;
private FilteringTypeAnnotationProvider(PsiAnnotation[] candidates) {
private FilteringTypeAnnotationProvider(PsiAnnotation[] candidates, TypeAnnotationProvider originalProvider) {
myCandidates = candidates;
myOriginalProvider = originalProvider;
}
@NotNull
@@ -207,12 +212,15 @@ public class JavaSharedImplUtil {
public PsiAnnotation[] getAnnotations() {
PsiAnnotation[] result = myCache;
if (result == null) {
List<PsiAnnotation> filtered = ContainerUtil.filter(myCandidates, new Condition<PsiAnnotation>() {
@Override
public boolean value(PsiAnnotation annotation) {
return AnnotationTargetUtil.isTypeAnnotation(annotation);
}
});
List<PsiAnnotation> filtered = JBIterable.of(myCandidates)
.filter(new Condition<PsiAnnotation>() {
@Override
public boolean value(PsiAnnotation annotation) {
return AnnotationTargetUtil.isTypeAnnotation(annotation);
}
})
.append(myOriginalProvider.getAnnotations())
.toList();
myCache = result = filtered.isEmpty() ? PsiAnnotation.EMPTY_ARRAY : filtered.toArray(new PsiAnnotation[filtered.size()]);
}
return result;
@@ -0,0 +1,48 @@
import java.io.IOException;
class Ex extends Exception {}
interface IOCloseable {
void close() throws IOException;
}
interface ExCloseable {
void close() throws Ex;
}
interface NoExCloseable {
void close();
}
interface TCloseable<T extends Throwable> {
void close() throws T;
}
interface I1 extends AutoCloseable, IOCloseable {}
interface I1R extends IOCloseable, AutoCloseable {}
interface I2 extends AutoCloseable, IOCloseable, ExCloseable {}
interface I3 extends AutoCloseable, NoExCloseable {}
interface I3R extends NoExCloseable, AutoCloseable {}
interface IT extends AutoCloseable, TCloseable<IOException> {}
class Main {
{
try (<error descr="Unhandled exception from auto-closeable resource: java.io.IOException">I1 i1 = null</error>) {}
try (I1 i11 = null) {
} catch (IOException e){}
try (I1R i11r = null) {
} catch (IOException e){}
try (I2 i2 = null) {}
try (I2 i21 = null) {
} catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException e</error>) {}
try (I2 i22 = null) {
} catch (<error descr="Exception 'Ex' is never thrown in the corresponding try block">Ex e</error>) {}
try (I3 i3 = null) {}
try (I3R i3r = null) {}
try (<error descr="Unhandled exception from auto-closeable resource: java.io.IOException">IT it = null</error>) {}
}
}
@@ -0,0 +1,9 @@
class Foo {
Foo() { this(() -> 4); }
Foo(I i) {}
}
interface <caret>I {
int foo();
}
@@ -0,0 +1,6 @@
public interface <caret>I {
void m();
}
interface J extends I {}
@@ -237,7 +237,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase {
}
String qualifiedName = aClass.getQualifiedName();
if (qualifiedName.startsWith("java.lang.invoke")) continue; // java.lang.invoke.MethodHandle has weird access attributes in recent rt.jar which causes spurious highlighting errors
if ("Sink".equals(aClass.getName())) continue;
if (qualifiedName.contains(".Sink")) continue; // Sink has weird access in class files
imports.append("import " + qualifiedName + ";\n");
usages.append("/**/ "+aClass.getName() + " var" + v + " = null; var" + v + ".toString();\n");
aClasses.add(aClass);
@@ -248,7 +248,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase {
WriteCommandAction.runWriteCommandAction(null, () -> getEditor().getDocument().setText(text));
List<HighlightInfo> errors = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING);
assertEmpty(errors);
assertEmpty(text, errors);
Random random = new Random();
int unused = 0;
for (int i = 0; i < 100; i++) {
@@ -179,6 +179,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testUncheckedExtendedWarnings() { doTest(true, false); }
public void testInaccessibleInferredTypeForVarargsArgument() { doTest(false, false);}
public void testRuntimeClassCast() { doTest(true, false);}
public void testTryWithResourcesWithMultipleCloseInterfaces() { doTest(false, false);}
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon;
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
@@ -33,11 +32,6 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
private void doTest(boolean warnings, boolean weakWarnings) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, weakWarnings, false);
}
@@ -19,7 +19,6 @@ import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
@@ -34,11 +33,6 @@ public class LightAdvHighlightingJdk9Test extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable());
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
private void doTest(boolean checkWarnings, boolean checkInfos) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
}
@@ -15,12 +15,10 @@
*/
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiType;
import com.intellij.refactoring.ChangeSignatureBaseTest;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
import com.intellij.testFramework.IdeaTestUtil;
public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
@@ -52,9 +50,4 @@ public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
protected String getRelativePath() {
return "/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,8 +16,6 @@
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
@@ -70,9 +68,4 @@ public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
private void doTest(final boolean checkWarnings) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,8 +16,6 @@
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -70,9 +68,4 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
private void doTest() throws Exception {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -50,19 +50,25 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
myFixture.addClass("public class A {" +
" public I r;" +
"}");
for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 1; i++) {
myFixture.addClass("class B" + i + " { {Runnable r = () -> {};}}"); //ensure common case is used
}
addManyLambdas();
doTestOneExpression();
}
public void testVarargPosition() throws Exception {
myFixture.addClass("\n" +
"class A { \n" +
" <T> void foo(T... r) {}\n" +
" void bar(J i){foo(i, i, () -> {});}\n" +
"}");
addManyLambdas();
doTestOneExpression();
}
private void doTestOneExpression() {
myFixture.configureByFile(getTestName(false) + ".java");
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
assertNotNull(elementAtCaret);
final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
assertTrue(psiClass != null && psiClass.isInterface());
final PsiClass psiClass = findClassAtCaret();
final Collection<PsiFunctionalExpression> expressions = FunctionalExpressionSearch.search(psiClass).findAll();
int size = expressions.size();
assertEquals(1, size);
@@ -71,6 +77,15 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
assertEquals("() -> {}", next.getText());
}
@NotNull
private PsiClass findClassAtCaret() {
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
assertNotNull(elementAtCaret);
final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
assertTrue(psiClass != null && psiClass.isInterface());
return psiClass;
}
public void testFieldFromAnonymousClassScope() throws Exception {
myFixture.configureByFile(getTestName(false) + ".java");
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
@@ -95,9 +110,7 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
public void doTestIndexSearch(String expected) {
myFixture.configureByFile(getTestName(false) + ".java");
for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 5; i++) {
myFixture.addFileToProject("a" + i + ".java", "class Goo {{ Runnable r = () -> {} }}");
}
addManyLambdas();
PsiClass predicate = JavaPsiFacade.getInstance(getProject()).findClass(Predicate.class.getName(), GlobalSearchScope.allScope(getProject()));
assert predicate != null;
@@ -105,6 +118,28 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
assertEquals(expected, next.getText());
}
public void testConstructorReferences() {
myFixture.configureByFile(getTestName(false) + ".java");
myFixture.addClass("class Bar extends Foo {\n" +
" public Bar() { super(() -> 1); }\n" +
"\n" +
" {\n" +
" new Foo(() -> 2) { };\n" +
" new Foo(() -> 3);\n" +
" }\n" +
"}");
addManyLambdas();
assertSize(4, FunctionalExpressionSearch.search(findClassAtCaret()).findAll());
}
private void addManyLambdas() {
for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 5; i++) {
myFixture.addFileToProject("a" + i + ".java", "class Goo {{ Runnable r = () -> {} }}");
}
}
@Override
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/lambda/findUsages/";
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
public class FunctionalExpressionIncompleteHighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -45,9 +43,4 @@ public class FunctionalExpressionIncompleteHighlightingTest extends LightDaemonA
private void doTest(final boolean checkWarnings) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -48,9 +47,4 @@ public class FunctionalTypeWildcardParameterizationTest extends LightDaemonAnaly
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -44,11 +44,6 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
return new LocalInspectionTool[]{new UncheckedWarningLocalInspection(), new UnusedImportLocalInspection()};
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
public void testReferenceTypeParams() {
doTest();
}
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
@@ -26,11 +25,6 @@ import org.jetbrains.annotations.NonNls;
public class GenericsHighlightingGenerated8Test extends LightDaemonAnalyzerTestCase {
@NonNls private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/genericsHighlightingGenerated8";
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
public void testEmptyTestT() throws Exception {}
public void _testUnrelatedClasses() throws Exception {
@@ -491,9 +491,4 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.PlatformTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -37,9 +36,4 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,13 +18,11 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.ExpectedTypesProvider;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.psi.infos.MethodCandidateInfo;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
import java.util.Collection;
@@ -203,9 +201,4 @@ public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
}
}
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -83,9 +82,4 @@ public class Java8RegressionTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -111,9 +109,4 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
private void doTest(final boolean checkWarnings) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,8 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -89,9 +87,4 @@ public class LambdaRedundantCastTest extends LightDaemonAnalyzerTestCase {
private void doTest() {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -118,9 +117,4 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -142,9 +141,4 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -40,9 +39,4 @@ public class NewInferenceCollectingAdditionalConstraintsTest extends LightDaemon
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -337,11 +336,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
/*
/*
public static Test suite() {
final TestSuite suite = new TestSuite();
for (int i = 0; i < 1000; i++) {
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -530,9 +529,4 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.PlatformTestUtil;
import org.jetbrains.annotations.NonNls;
@@ -237,9 +236,4 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -15,9 +15,6 @@
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
/**
* @author Dmitry Batkovich
*/
@@ -30,9 +27,4 @@ public class AddExceptionFromFieldInitializerToConstructorThrowsTest extends Lig
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/addToConstructorThrows";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -1,8 +1,5 @@
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class AddExceptionToCatchTest extends LightQuickFixParameterizedTestCase {
public void test() throws Exception {
doAllTests();
@@ -12,9 +9,4 @@ public class AddExceptionToCatchTest extends LightQuickFixParameterizedTestCase
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/addCatchBlock";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -1,8 +1,5 @@
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase {
public void test() throws Exception {
doAllTests();
@@ -12,9 +9,4 @@ public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.AnonymousCanBeLambdaInspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class Anonymous2LambdaInspectionTest extends LightQuickFixParameterizedTe
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.AnonymousCanBeMethodReferenceInspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class Anonymous2MethodReferenceInspectionTest extends LightQuickFixParame
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -15,12 +15,7 @@
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import java.util.ArrayList;
import java.util.LinkedList;
public class ChangeMethodSignatureFromUsage8Test extends LightQuickFixParameterizedTestCase {
@@ -35,9 +30,4 @@ public class ChangeMethodSignatureFromUsage8Test extends LightQuickFixParameteri
protected LanguageLevel getLanguageLevel() {
return LanguageLevel.JDK_1_8;
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -1,8 +1,5 @@
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class GeneralizeCatchTest extends LightQuickFixParameterizedTestCase {
public void test() throws Exception {
doAllTests();
@@ -12,9 +9,4 @@ public class GeneralizeCatchTest extends LightQuickFixParameterizedTestCase {
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/generalizeCatch";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class Lambda2MethodReferenceInspectionTest extends LightQuickFixParameter
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.RedundantLambdaCodeBlockInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class RedundantLambdaCodeBlockInspectionTest extends LightQuickFixParamet
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -35,9 +33,4 @@ public class RedundantTypeArgsInspectionTest extends LightQuickFixParameterizedT
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -15,14 +15,13 @@
*/
package com.intellij.codeInsight.daemon.quickFix
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.dataFlow.DataFlowInspection
import com.intellij.openapi.Disposable
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.testFramework.IdeaTestUtil
import org.jetbrains.annotations.NotNull
public class ReplaceFromOfNullableFixTest extends LightQuickFixParameterizedTestCase {
@@ -82,8 +81,4 @@ public abstract class Optional<T> {
super.afterActionCompleted(testName, contents)
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -22,8 +22,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.dataFlow.DataFlowInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTestCase {
@@ -55,9 +53,4 @@ public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTest
ReplaceFromOfNullableFixTest.cleanupGuava();
super.afterActionCompleted(testName, contents);
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -18,11 +18,9 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.ExplicitTypeCanBeDiamondInspection;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -68,9 +66,4 @@ public class Simplify2DiamondInspectionsTest extends LightQuickFixParameterizedT
protected LanguageLevel getLanguageLevel() {
return LanguageLevel.JDK_1_8;
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.StreamApiMigrationInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class StreamApiMigrationInspectionTest extends LightQuickFixParameterized
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.TrivialFunctionalExpressionUsageInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class TrivialFunctionalExpressionUsageInspectionTest extends LightQuickFi
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/trivialFunctionalExpressionUsage";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.TrivialMethodReferenceInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -37,9 +35,4 @@ public class TrivialMethodReferenceInspectionTest extends LightQuickFixParameter
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/trivialMethodReference";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -15,9 +15,6 @@
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
/**
* @author Dmitry Batkovich
*/
@@ -30,9 +27,4 @@ public class WrapLongWithMathToIntExactFixTest extends LightQuickFixParameterize
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -15,9 +15,6 @@
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
/**
* @author Dmitry Batkovich
*/
@@ -30,9 +27,4 @@ public class WrapObjectWithOptionalFixTest extends LightQuickFixParameterizedTes
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapObjectWithOptional";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,8 +16,6 @@
package com.intellij.codeInsight.intention;
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class MergeFilterChainActionTest extends LightIntentionActionTestCase {
@@ -27,9 +25,4 @@ public class MergeFilterChainActionTest extends LightIntentionActionTestCase {
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/mergeFilter";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,8 +16,6 @@
package com.intellij.codeInsight.intention;
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
public class SplitFilterActionTest extends LightIntentionActionTestCase {
@@ -27,9 +25,4 @@ public class SplitFilterActionTest extends LightIntentionActionTestCase {
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/splitFilter";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -36,9 +36,7 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase {
@interface A { }
@Target(ElementType.TYPE_USE) @interface TA { int value() default 42; }
class O {
class I { }
}
class O { class I { } }
@SuppressWarnings("ExceptionClassNameDoesntEndWithException") class E1 extends Exception { }
@SuppressWarnings("ExceptionClassNameDoesntEndWithException") class E2 extends Exception { }""".stripIndent())
@@ -101,9 +99,9 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase {
}
public void testMethodReturnType() {
def psi = factory.createMethodFromText("@A @TA(1) String m() { return null; }", context)
assertTypeText psi.returnType, "java.lang.@pkg.TA(1) String", "java.lang.String"
assertAnnotations psi.returnType, "@TA(1)"
def psi = factory.createMethodFromText("@A @TA(1) <T> @TA(2) String m() { return null; }", context)
assertTypeText psi.returnType, "java.lang.@pkg.TA(1) @pkg.TA(2) String", "java.lang.String"
assertAnnotations psi.returnType, "@TA(1)", "@TA(2)"
}
private void doTest(String text, String annotated, String canonical) {
@@ -23,7 +23,6 @@ package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.InspectionTestCase;
@@ -63,11 +62,6 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_1_6, JavaAPIUsagesInspectionTest.this::doTest);
}
@Override
protected Sdk getTestProjectSdk() {
return IdeaTestUtil.getMockJdk18();
}
//generate apiXXX.txt
/*
//todo exclude inheritors of ConcurrentMap#putIfAbsent
@@ -38,6 +38,7 @@ import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.source.PsiClassImpl;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.FileTreeAccessFilter;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.InspectionTestCase;
import com.intellij.testFramework.PsiTestUtil;
import org.jetbrains.annotations.NotNull;
@@ -62,7 +63,8 @@ public class MagicConstantInspectionTest extends InspectionTestCase {
@Override
protected Sdk getTestProjectSdk() {
return PsiTestUtil.addJdkAnnotations(super.getTestProjectSdk());
// has to have JFrame and sources
return PsiTestUtil.addJdkAnnotations(IdeaTestUtil.getMockJdk17());
}
private void doTest() throws Exception {
@@ -3,6 +3,7 @@ package com.intellij.codeInspection;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.pom.java.LanguageLevel;
@@ -17,6 +18,12 @@ public class RedundantCast15Test extends InspectionTestCase {
ModuleRootModificationUtil.setModuleSdk(getModule(), getTestProjectSdk());
}
@Override
protected Sdk getTestProjectSdk() {
// in jdk 8 some casts are unnecessary
return IdeaTestUtil.getMockJdk17();
}
private void doTest() throws Exception {
final LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(new RedundantCastInspection());
doTest("redundantCast/generics/" + getTestName(false), toolWrapper, "java 1.5");
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.InspectionTestCase;
public class RedundantCast18Test extends InspectionTestCase {
@@ -35,11 +31,4 @@ public class RedundantCast18Test extends InspectionTestCase {
public void testForeachValue() throws Exception { doTest(); }
public void testConditional() throws Exception { doTest(); }
public void testInferApplicabilityError() throws Exception { doTest(); }
@Override
protected Sdk getTestProjectSdk() {
Sdk sdk = IdeaTestUtil.getMockJdk17();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
return sdk;
}
}
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.unneededThrows.RedundantThrows;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.InspectionTestCase;
public class RedundantThrowTest extends InspectionTestCase {
@@ -68,11 +64,4 @@ public class RedundantThrowTest extends InspectionTestCase {
public void testThrownClausesInFunctionalExpressions() throws Exception {
doTest();
}
@Override
protected Sdk getTestProjectSdk() {
Sdk sdk = IdeaTestUtil.getMockJdk17();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
return sdk;
}
}
@@ -16,8 +16,6 @@
package com.intellij.codeInspection;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
/**
@@ -35,11 +33,6 @@ public class SimplifyStreamApiCallChainsInspectionTest extends LightQuickFixPara
doAllTests();
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
@Override
protected String getBasePath() {
return "/inspection/streamApiCallChains";
@@ -16,8 +16,6 @@
package com.intellij.codeInspection;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
/**
@@ -39,9 +37,4 @@ public class StringTokenizerDelimiterInspectionTest extends LightQuickFixParamet
protected String getBasePath() {
return "/inspection/stringTokenizerDelimiter";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -12,10 +12,6 @@ package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.unusedReturnValue.UnusedReturnValue;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.InspectionTestCase;
public class UnusedReturnValueTest extends InspectionTestCase {
@@ -47,13 +43,6 @@ public class UnusedReturnValueTest extends InspectionTestCase {
doTest();
}
@Override
protected Sdk getTestProjectSdk() {
Sdk sdk = IdeaTestUtil.getMockJdk18();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
return sdk;
}
public void testSimpleSetter() throws Exception {
try {
myTool.IGNORE_BUILDER_PATTERN = true;
@@ -17,11 +17,9 @@ package com.intellij.ide.util;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.impl.FindSuperElementsHelper;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
@@ -38,11 +36,6 @@ public class JavaSuperMethodTest extends LightDaemonAnalyzerTestCase {
return "/codeInsight/gotosuper/";
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
public void testDoNotGoToSiblingInheritanceIfInLibrary() throws Throwable {
configureByFile(getBasePath() + "OverridingLibrary.java");
@@ -36,7 +36,6 @@ import com.intellij.testFramework.LightIdeaTestCase;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.LineReader;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -147,11 +146,11 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
doTest(getTestName(false) + ".java", getTestName(false) + "_after.java");
}
public void doTest(@NonNls String fileNameBefore, @NonNls String fileNameAfter) {
public void doTest(@NotNull String fileNameBefore, @NotNull String fileNameAfter) {
doTextTest(Action.REFORMAT, loadFile(fileNameBefore), loadFile(fileNameAfter));
}
public void doTestWithDetectableIndentOptions(@NonNls String text, @NonNls String textAfter) {
public void doTestWithDetectableIndentOptions(@NotNull String text, @NotNull String textAfter) {
DetectableIndentOptionsProvider provider = DetectableIndentOptionsProvider.getInstance();
assertNotNull("DetectableIndentOptionsProvider not found", provider);
provider.setEnabledInTest(true);
@@ -163,11 +162,11 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
}
}
public void doTextTest(@NonNls final String text, @NonNls String textAfter) throws IncorrectOperationException {
public void doTextTest(@NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
doTextTest(Action.REFORMAT, text, textAfter);
}
public void doTextTest(@NotNull final Action action, @NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
public void doTextTest(@NotNull Action action, @NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
final PsiFile file = createFile("A.java", text);
final PsiDocumentManager manager = PsiDocumentManager.getInstance(getProject());
final Document document = manager.getDocument(file);
@@ -226,7 +225,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
return document.getText();
}
public void doMethodTest(@NonNls final String before, @NonNls final String after) {
public void doMethodTest(@NotNull String before, @NotNull String after) {
doTextTest(
Action.REFORMAT,
"class Foo{\n" + " void foo() {\n" + before + '\n' + " }\n" + "}",
@@ -234,7 +233,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
);
}
public void doClassTest(@NonNls final String before, @NonNls final String after) {
public void doClassTest(@NotNull String before, @NotNull String after) {
doTextTest(
Action.REFORMAT,
"class Foo{\n" + before + '\n' + "}",
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -150,6 +150,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
doTextTest(initial, formatted); // Expect spaces to be inserted after unary operators
}
@SuppressWarnings("unused")
public void _testJavadocMethodParams() {
// Inspired by IDEA-42167
// Disabled because the contents of the {@code tag} is not necessarily Java code and
@@ -591,7 +592,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"};"
);
}
public void testCommentBetweenAnnotationAndModifierList() {
getSettings().KEEP_LINE_BREAKS = false;
getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
@@ -607,7 +608,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
" int a = 2;\n" +
"}");
}
public void testSpace_BeforeSemicolon_InsideFor() {
getSettings().SPACE_BEFORE_SEMICOLON = true;
doMethodTest(
@@ -619,7 +620,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"}\n"
);
}
public void testSpace_BeforeSemicolon_InsideFor_IfSpacesWithinForIsOn() {
getSettings().SPACE_WITHIN_FOR_PARENTHESES = true;
doMethodTest(
@@ -631,7 +632,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"}\n"
);
}
public void testSpaceBeforeTypeArgumentList() {
getSettings().SPACE_BEFORE_TYPE_PARAMETER_LIST = true;
doMethodTest(
@@ -643,7 +644,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"Bar. <Int, String>call();"
);
}
public void testKeepLineBreaksWorks_InsidePolyExpression() {
getSettings().KEEP_LINE_BREAKS = false;
doMethodTest(
@@ -652,5 +653,4 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"int x = (1 + 2 + 3) * (1 + 2 + 2) * (1 + 2);"
);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 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.
@@ -17,6 +17,7 @@ package com.intellij.psi.formatter.java;
import com.intellij.openapi.util.TextRange;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
/**
* @author Denis Zhdanov
@@ -43,7 +44,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
int end = initial.indexOf("\n", start);
myTextRange = new TextRange(start, end);
doTextTest(initial,
doTextTest(initial,
"class BrokenAlignment {\n" +
" public\n" +
"\tstatic int foo(String a, String b, String c,\n" +
@@ -64,7 +65,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
"<caret>\n" +
" }" +
"}",
"class Test {\n" +
" // some comment\n" +
" public void doSmth(int[] p) {\n" +
@@ -74,7 +75,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
}
@Override
public void doTextTest(String text, String textAfter) throws IncorrectOperationException {
public void doTextTest(@NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
doTextTest(Action.INDENT, adjustTextIfNecessary(text), textAfter);
}
@@ -91,4 +92,4 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
myTextRange = new TextRange(caretIndex, caretIndex);
return text.substring(0, caretIndex) + text.substring(caretIndex + CARET_TOKEN.length());
}
}
}
@@ -21,13 +21,11 @@
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.JavaCodeFragment;
import com.intellij.psi.JavaCodeFragmentFactory;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
@@ -314,9 +312,4 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
" }\n" +
" }");
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -22,13 +22,10 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectHandler;
import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectProcessor;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NotNull;
public class ExtractMethodObjectTest extends LightRefactoringTestCase {
@@ -145,9 +142,4 @@ public class ExtractMethodObjectTest extends LightRefactoringTestCase {
public void testWithPrivateMethodWhichCantBeMoved() throws Exception {
doTest();
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -17,12 +17,10 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.extractMethod.ExtractMethodHandler;
import com.intellij.refactoring.introduceParameter.IntroduceParameterHandler;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.annotations.NotNull;
@@ -83,11 +81,6 @@ public class IntroduceFunctionalParameterTest extends LightRefactoringTestCase
return LanguageLevel.JDK_1_8;
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
private void doTest() {
doTest(null);
}
@@ -18,7 +18,6 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiElement;
@@ -29,7 +28,6 @@ import com.intellij.refactoring.introduceVariable.InputValidator;
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
@@ -562,9 +560,4 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
testMe.invoke(getProject(), getEditor(), getFile(), null);
checkResultByFile(baseName + ".after.java");
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,7 +16,6 @@
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
@@ -26,7 +25,6 @@ import com.intellij.refactoring.memberPullUp.PullUpConflictsUtil;
import com.intellij.refactoring.memberPullUp.PullUpProcessor;
import com.intellij.refactoring.util.DocCommentPolicy;
import com.intellij.refactoring.util.classMembers.MemberInfo;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -281,9 +279,4 @@ public class PullUpTest extends LightRefactoringTestCase {
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -16,14 +16,12 @@
package com.intellij.refactoring;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.memberPushDown.PushDownProcessor;
import com.intellij.refactoring.util.DocCommentPolicy;
import com.intellij.refactoring.util.classMembers.MemberInfo;
import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
@@ -183,9 +181,4 @@ public class PushDownTest extends LightRefactoringTestCase {
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
@@ -14,15 +14,14 @@
* limitations under the License.
*/
package com.intellij.refactoring
import com.intellij.codeInsight.TargetElementUtil
import com.intellij.codeInsight.lookup.LookupEx
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.codeInsight.template.impl.TemplateState
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.psi.PsiElement
import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
import com.intellij.testFramework.IdeaTestUtil
import com.intellij.testFramework.LightCodeInsightTestCase
/**
* User: anna
@@ -71,10 +70,6 @@ class RenameSuggestionsTest extends LightCodeInsightTestCase {
doTestSuggestionAvailable(text, "foo")
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18()
}
public void "test by Optional_of initializer"() {
def suggestions = getNameSuggestions("""
@@ -17,7 +17,6 @@ package com.intellij.refactoring.inline;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
@@ -27,7 +26,6 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.LightRefactoringTestCase;
import com.intellij.refactoring.MockInlineMethodOptions;
import com.intellij.refactoring.util.InlineUtil;
import com.intellij.testFramework.IdeaTestUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -369,9 +367,4 @@ public class InlineMethodTest extends LightRefactoringTestCase {
new InlineMethodProcessor(getProject(), method, refExpr, myEditor, options.isInlineThisOnly(), nonCode, nonCode);
processor.run();
}
@Override
protected Sdk getProjectJDK() {
return IdeaTestUtil.getMockJdk18();
}
}
Binary file not shown.
@@ -241,8 +241,8 @@ public abstract class InspectionTestCase extends PsiTestCase {
}
protected Sdk getTestProjectSdk() {
Sdk sdk = IdeaTestUtil.getMockJdk17();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
Sdk sdk = IdeaTestUtil.getMockJdk18();
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
return sdk;
}
@@ -16,4 +16,12 @@ public interface JsonSchemaFileProvider {
SchemaType getSchemaType();
int getOrder();
interface Orders {
int CORE = -1000;
int EMBEDDED_BASE = 1;
int PACKAGE_JSON = 2;
int TEST = 10;
int USER = 1000;
}
}
@@ -77,7 +77,7 @@ public class JsonSchemaImportedProviderFactory implements JsonSchemaProviderFact
@Override
public int getOrder() {
return 1000;
return Orders.USER;
}
@NotNull
@@ -70,7 +70,7 @@ public class JsonSchemaProjectSelfProviderFactory implements JsonSchemaProviderF
@Override
public int getOrder() {
return -1000;
return Orders.CORE;
}
}
}

Some files were not shown because too many files have changed in this diff Show More