--- /dev/null
+<component name="ProjectDictionaryState">
+ <dictionary name="kirillk" />
+</component>
\ No newline at end of file
<inspection_tool class="ObjectEqualsNull" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ObjectNotify" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ObsoleteCollection" enabled="true" level="WARNING" enabled_by_default="true">
- <option name="ignoreLibraryArguments" value="false" />
+ <option name="ignoreRequiredObsoleteCollectionTypes" value="false" />
</inspection_tool>
<inspection_tool class="PointlessArithmeticExpression" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_ignoreExpressionsContainingConstants" value="true" />
<root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-swing.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-javamail.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/ant/src/bundled_ant_src.zip!/bundled_ant_src/main" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/cglib-nodep-2.1_3.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/cglib-src-2.1_3.jar!/src/proxy" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/dtdparser113.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<root url="jar://$PROJECT_DIR$/lib/dev/easymockclassextension.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/dev/easymock.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/org.eclipse.jdt.core.source_3.5.2.v_981_R35x.jar!/" />
</SOURCES>
<CLASSES>
<root url="file://$PROJECT_DIR$/build/lib/gant/lib" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/build/lib/gant/src.zip!/groovy" />
<root url="jar://$PROJECT_DIR$/build/lib/gant/jps-sources.zip!/" />
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/groovy-all-1.7.3.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/groovy-src-1.7.3.zip!/" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jdom.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/jdom.zip!/" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-1.0.1.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-cglib-1.0.1.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/junit-4.7.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/junit-4.7-src.jar!/" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jh.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/jhsrc.jar!/src" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jaxen-1.1.1.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/log4j.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/log4j.zip!/" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/build/conf/mac/lib/quaqua.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/eawtstub.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/eawtstub_src.zip!/src" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/lib/dev/hamcrest-library-1.0.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/dev/hamcrest-api-1.0.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/nanoxml-2.2.3.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/nanoxml.zip!/" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/oromatcher.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/plugins/testng/lib/testng-jdk15.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/trove4j.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/trove4j_src.jar!/util/src" />
<root url="jar://$PROJECT_DIR$/lib/src/trove4j_src.jar!/src" />
<root url="jar://$PROJECT_DIR$/lib/velocity.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/velocity-1.5-src.zip!/java" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/xstream.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/xerces.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/Xerces-J-src.2.8.1.zip!/xerces-2_8_1/src" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/lib/xbean.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/resolver.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/xmlrpc-2.0.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/xmlrpc2.src.zip!/" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/lib/asm.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/asm-commons.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/asm-src.zip!/" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-codec-1.3.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-collections.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/commons-collections-3.1-src.zip!/commons-collections-3.1/src/java" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-net-2.0-patched.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/commons-net-2.0-patched-src.zip!/commons-net-2.0-src/src/main/java" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jcip-annotations.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jgoodies-forms.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/jgoodies-forms-src.zip!/" />
</SOURCES>
<root url="jar://$PROJECT_DIR$/lib/jna-utils.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/jna.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<root url="jar://$PROJECT_DIR$/lib/microba.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/src/microba-src.zip!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</component>
\ No newline at end of file
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/picocontainer.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/picocontainer-src.zip!/picocontainer-1_2/container/src/java" />
</SOURCES>
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/serviceMessages.jar!/" />
</CLASSES>
+ <JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/serviceMessages_201292_src.zip!/src" />
</SOURCES>
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" filepath="$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" group="plugins" />
+ <module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" group="plugins/IntelliLang" />
- <module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLangJava.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLangJava.iml" group="plugins/IntelliLang" />
<module fileurl="file://$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" filepath="$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" filepath="$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins" />
- <module fileurl="file://$PROJECT_DIR$/plugins/relaxng/relaxng.iml" filepath="$PROJECT_DIR$/plugins/relaxng/relaxng.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/boot/boot.iml" filepath="$PROJECT_DIR$/platform/boot/boot.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" filepath="$PROJECT_DIR$/platform/bootstrap/bootstrap.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/build/build.iml" filepath="$PROJECT_DIR$/build/build.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources/platform-resources.iml" filepath="$PROJECT_DIR$/platform/platform-resources/platform-resources.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml" filepath="$PROJECT_DIR$/platform/platform-resources-en/platform-resources-en.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/properties/properties.iml" filepath="$PROJECT_DIR$/plugins/properties/properties.iml" group="plugins" />
+ <module fileurl="file://$PROJECT_DIR$/plugins/relaxng/relaxng.iml" filepath="$PROJECT_DIR$/plugins/relaxng/relaxng.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/resources/resources.iml" filepath="$PROJECT_DIR$/resources/resources.iml" />
<module fileurl="file://$PROJECT_DIR$/resources-en/resources-en.iml" filepath="$PROJECT_DIR$/resources-en/resources-en.iml" />
<module fileurl="file://$PROJECT_DIR$/platform/smRunner/smRunner.iml" filepath="$PROJECT_DIR$/platform/smRunner/smRunner.iml" group="platform" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="JSP_INDENT_OPTIONS">
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="XML_INDENT_OPTIONS">
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="OTHER_INDENT_OPTIONS">
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="FIELD_NAME_PREFIX" value="my" />
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
- <option name="OPTIMIZE_IMPORTS_ON_THE_FLY" value="true" />
- <option name="ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY" value="true" />
<option name="RIGHT_MARGIN" value="140" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="groovy">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="gsp">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="haml">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="java">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="js">
<option name="INDENT_SIZE" value="4" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="rb">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="txt">
<option name="INDENT_SIZE" value="4" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
<option name="INDENT_SIZE" value="2" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
</value>
</option>
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
- <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
+ <extension name="coverage" enabled="false" sample_coverage="true" runner="idea" merge="false" />
<extension name="snapshooter" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value=" -ea -Xbootclasspath/p:../out/classes/production/boot -Xmx192m -Didea.is.internal=true -XX:MaxPermSize=150m " />
patchPropertiesFile(paths.distWin)
ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: args.vmoptions.replace(' ', '\n'))
- ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.win.zip") {
+ def winZipPath = "$paths.artifacts/idea${args.buildNumber}.win.zip"
+ ant.zip(zipfile: winZipPath) {
fileset(dir: paths.distAll)
fileset(dir: paths.distWin)
}
+ notifyArtifactBuilt(winZipPath)
}
private def layoutMac(Map args, String home, Paths paths) {
def root = isEap() ? "${version}-${args.buildNumber}.app" : "IntelliJ IDEA ${version} CE.app"
- ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.mac.zip") {
+ def macZipPath = "$paths.artifacts/idea${args.buildNumber}.mac.zip"
+ ant.zip(zipfile: macZipPath) {
[paths.distAll, paths.distMac].each {
tarfileset(dir: it, prefix: root) {
exclude(name: "bin/*.sh")
include(name: "Contents/MacOS/idea")
}
}
+ notifyArtifactBuilt(macZipPath)
}
def layoutLinux(Map args, String home, Paths paths) {
}
}
- ant.gzip(src: tarPath, zipfile: "${tarPath}.gz")
+ def gzPath = "${tarPath}.gz"
+ ant.gzip(src: tarPath, zipfile: gzPath)
ant.delete(file: tarPath)
+ notifyArtifactBuilt(gzPath)
}
dir("IntelliLang") {
dir("lib") {
jar("IntelliLang.jar") {
- module("IntelliLangJava")
+ module("IntelliLang")
module("IntelliLang-java")
module("IntelliLang-xml")
module("IntelliLang-javaee")
requireProperty("home", guessHome())
project.builder.buildInfoPrinter = new org.jetbrains.jps.teamcity.TeamcityBuildInfoPrinter()
+
+binding.setVariable("notifyArtifactBuilt", { String artifactPath ->
+ if (!artifactPath.startsWith(home)) {
+ project.error("Artifact path $artifactPath should start with $home")
+ }
+ def relativePath = artifactPath.substring(home.length())
+ project.info("##teamcity[publishArtifacts '$relativePath']")
+})
\ No newline at end of file
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../lib/dev/compilerapi.jar!/" />
</CLASSES>
+ <JAVADOC />
+ <SOURCES />
</library>
</orderEntry>
<orderEntry type="module" module-name="lang-impl" />
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.compiler.impl.javaCompiler;
+package com.intellij.compiler;
import com.intellij.openapi.compiler.CompileContext;
+import com.intellij.openapi.extensions.ExtensionPointName;
/**
* @author Eugene Zhuravlev
* Date: Aug 19, 2008
*/
public interface DependencyProcessor {
+ ExtensionPointName<DependencyProcessor> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.compiler.makeDependencyProcessor");
+
void processDependencies(CompileContext context, int classQualifiedName);
}
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
-import com.intellij.util.Chunk;
-import com.intellij.util.LocalTimeCounter;
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.ThrowableRunnable;
+import com.intellij.util.*;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.containers.OrderedSet;
+import gnu.trove.TIntHashSet;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
final Set<FileType> generatedTypes = new HashSet<FileType>();
Collection<VirtualFile> chunkFiles = chunkMap.get(currentChunk);
try {
- for (int currentCompiler = 0, translatorsLength = translators.length; currentCompiler < translatorsLength; currentCompiler++) {
- sink.setCurrentCompilerIndex(currentCompiler);
- final TranslatingCompiler compiler = translators[currentCompiler];
- if (context.getProgressIndicator().isCanceled()) {
- throw new ExitException(ExitStatus.CANCELLED);
+ int round = 0;
+ final Set<VirtualFile> filesToRecompile = new HashSet<VirtualFile>();
+ final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();
+ Collection<VirtualFile> dependentFiles = Collections.emptyList();
+ final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> dependencyFilter = new DependentClassesCumulativeFilter();
+
+ do {
+ for (int currentCompiler = 0, translatorsLength = translators.length; currentCompiler < translatorsLength; currentCompiler++) {
+ sink.setCurrentCompilerIndex(currentCompiler);
+ final TranslatingCompiler compiler = translators[currentCompiler];
+ if (context.getProgressIndicator().isCanceled()) {
+ throw new ExitException(ExitStatus.CANCELLED);
+ }
+
+ DumbService.getInstance(myProject).waitForSmartMode();
+
+ if (round == 0) {
+ if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {
+ // rescan snapshot if previously generated files may influence the input of this compiler
+ snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
+ public VirtualFile[] compute() {
+ return context.getCompileScope().getFiles(null, true);
+ }
+ });
+ recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap);
+ chunkFiles = chunkMap.get(currentChunk);
+ total = snapshot.length * translatorsLength;
+ }
+ }
+
+ final CompileContextEx _context;
+ if (compiler instanceof IntermediateOutputCompiler) {
+ // wrap compile context so that output goes into intermediate directories
+ final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;
+ _context = new CompileContextExProxy(context) {
+ public VirtualFile getModuleOutputDirectory(final Module module) {
+ return getGenerationOutputDir(_compiler, module, false);
+ }
+
+ public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
+ return getGenerationOutputDir(_compiler, module, true);
+ }
+ };
+ }
+ else {
+ _context = context;
+ }
+ final boolean compiledSomething =
+ compileSources(_context, currentChunk, compiler, chunkFiles, round == 0? forceCompile : true, isRebuild, trackDependencies, onlyCheckStatus, sink);
+
+ processed += chunkFiles.size();
+ _context.getProgressIndicator().setFraction(((double)processed) / total);
+
+ if (compiledSomething) {
+ generatedTypes.addAll(compilerManager.getRegisteredOutputTypes(compiler));
+ }
+
+ if (_context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
+ throw new ExitException(ExitStatus.ERRORS);
+ }
+
+ didSomething |= compiledSomething;
}
- DumbService.getInstance(myProject).waitForSmartMode();
+ final boolean hasUnprocessedTraverseRoots = context.getDependencyCache().hasUnprocessedTraverseRoots();
+ if (!isRebuild && (didSomething || hasUnprocessedTraverseRoots)) {
+ final Set<VirtualFile> compiledWithSuccess;
+ final Set<VirtualFile> compiledWithErrors = CacheUtils.getFilesCompiledWithErrors(context);
+ if (compiledWithErrors.isEmpty()) {
+ compiledWithSuccess = sink.getCompiledSources();
+ }
+ else {
+ compiledWithSuccess = new HashSet<VirtualFile>();
+ compiledWithSuccess.addAll(sink.getCompiledSources());
+ compiledWithSuccess.removeAll(compiledWithErrors);
+ }
+ filesToRecompile.removeAll(compiledWithSuccess);
+ filesToRecompile.addAll(compiledWithErrors);
- if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {
- // rescan snapshot if previously generated files may influence the input of this compiler
- snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
- public VirtualFile[] compute() {
- return context.getCompileScope().getFiles(null, true);
- }
- });
- final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
- for (Chunk<Module> moduleChunk : sortedChunks) {
- List<VirtualFile> files = Collections.emptyList();
- for (Module module : moduleChunk.getNodes()) {
- final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
- if (moduleFiles != null) {
- files = ContainerUtil.concat(files, moduleFiles);
+ dependentFiles = CacheUtils.findDependentFiles(context, compiledWithSuccess, dependencyFilter);
+
+ if (ourDebugMode) {
+ if (!dependentFiles.isEmpty()) {
+ for (VirtualFile dependentFile : dependentFiles) {
+ System.out.println("FOUND TO RECOMPILE: " + dependentFile.getPresentableUrl());
}
}
- chunkMap.put(moduleChunk, files);
+ else {
+ System.out.println("NO FILES TO RECOMPILE");
+ }
}
- total = snapshot.length * translatorsLength;
- chunkFiles = chunkMap.get(currentChunk);
- }
- final CompileContextEx _context;
- if (compiler instanceof IntermediateOutputCompiler) {
- // wrap compile context so that output goes into intermediate directories
- final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;
- _context = new CompileContextExProxy(context) {
- public VirtualFile getModuleOutputDirectory(final Module module) {
- return getGenerationOutputDir(_compiler, module, false);
+ if (!dependentFiles.isEmpty()) {
+ filesToRecompile.addAll(dependentFiles);
+ allDependent.addAll(dependentFiles);
+ if (context.getProgressIndicator().isCanceled() || context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
+ break;
}
-
- public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
- return getGenerationOutputDir(_compiler, module, true);
+ final List<VirtualFile> filesInScope = getFilesInScope(context, currentChunk, dependentFiles);
+ if (filesInScope.isEmpty()) {
+ break;
}
- };
- }
- else {
- _context = context;
+ context.getDependencyCache().clearTraverseRoots();
+ chunkFiles = filesInScope;
+ total += chunkFiles.size() * translators.length;
+ }
+
+ didSomething |= (hasUnprocessedTraverseRoots != context.getDependencyCache().hasUnprocessedTraverseRoots());
}
- final boolean compiledSomething =
- compileSources(_context, currentChunk, compiler, chunkFiles, forceCompile, isRebuild, trackDependencies, onlyCheckStatus, sink);
- processed += chunkFiles.size();
- _context.getProgressIndicator().setFraction(((double)processed) / total);
+ round++;
+ }
+ while (!dependentFiles.isEmpty() && context.getMessageCount(CompilerMessageCategory.ERROR) == 0);
- if (compiledSomething) {
- generatedTypes.addAll(compilerManager.getRegisteredOutputTypes(compiler));
- }
+ if (CompilerConfiguration.MAKE_ENABLED) {
+ if (!context.getProgressIndicator().isCanceled()) {
+ // when cancelled pretend nothing was compiled and next compile will compile everything from the scratch
+ final ProgressIndicator indicator = context.getProgressIndicator();
+ final DependencyCache cache = context.getDependencyCache();
- if (_context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
- throw new ExitException(ExitStatus.ERRORS);
- }
+ indicator.pushState();
+ indicator.setText(CompilerBundle.message("progress.updating.caches"));
+ indicator.setText2("");
+
+ cache.update();
+
+ indicator.setText(CompilerBundle.message("progress.saving.caches"));
+ cache.resetState();
- didSomething |= compiledSomething;
+ indicator.popState();
+ }
+ }
+
+ if (context.getMessageCount(CompilerMessageCategory.ERROR) != 0) {
+ filesToRecompile.addAll(allDependent);
}
+ if (filesToRecompile.size() > 0) {
+ sink.add(null, Collections.<TranslatingCompiler.OutputItem>emptyList(), VfsUtil.toVirtualFileArray(filesToRecompile));
+ }
+ }
+ catch (CacheCorruptedException e) {
+ LOG.info(e);
+ context.requestRebuildNextTime(e.getMessage());
}
finally {
if (context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
ProgressManager.getInstance().executeNonCancelableSection(new Runnable() {
public void run() {
try {
- final Collection<VirtualFile> deps = CacheUtils.findDependentFiles(context, Collections.<VirtualFile>emptySet(), null, null);
+ final Collection<VirtualFile> deps = CacheUtils.findDependentFiles(context, Collections.<VirtualFile>emptySet(), null);
if (deps.size() > 0) {
TranslatingCompilerFilesMonitor.getInstance().update(context, null, Collections.<TranslatingCompiler.OutputItem>emptyList(),
VfsUtil.toVirtualFileArray(deps));
return didSomething;
}
+ private static List<VirtualFile> getFilesInScope(final CompileContextEx context, final Chunk<Module> chunk, final Collection<VirtualFile> files) {
+ final List<VirtualFile> filesInScope = new ArrayList<VirtualFile>(files.size());
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ for (VirtualFile file : files) {
+ if (context.getCompileScope().belongs(file.getUrl())) {
+ final Module module = context.getModuleByFile(file);
+ if (chunk.getNodes().contains(module)) {
+ filesInScope.add(file);
+ }
+ }
+ }
+ }
+ });
+ return filesInScope;
+ }
+
+ private static void recalculateChunkToFilesMap(CompileContextEx context, List<Chunk<Module>> allChunks, VirtualFile[] snapshot, Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {
+ final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
+ for (Chunk<Module> moduleChunk : allChunks) {
+ List<VirtualFile> files = Collections.emptyList();
+ for (Module module : moduleChunk.getNodes()) {
+ final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
+ if (moduleFiles != null) {
+ files = ContainerUtil.concat(files, moduleFiles);
+ }
+ }
+ chunkMap.put(moduleChunk, files);
+ }
+ }
+
private interface FileProcessingCompilerAdapterFactory {
FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler);
}
final ArrayList<Trinity<File, String, Boolean>> toDelete = new ArrayList<Trinity<File, String, Boolean>>();
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
- TranslatingCompilerFilesMonitor.getInstance()
- .collectFiles(context, (TranslatingCompiler)compiler, Arrays.<VirtualFile>asList(allSources).iterator(), true
- /*pass true to make sure that every source in scope file is processed*/, false
- /*important! should pass false to enable collection of files to delete*/,
- new ArrayList<VirtualFile>(), toDelete);
+ TranslatingCompilerFilesMonitor.getInstance().collectFiles(
+ context,
+ (TranslatingCompiler)compiler, Arrays.<VirtualFile>asList(allSources).iterator(),
+ true /*pass true to make sure that every source in scope file is processed*/,
+ false /*important! should pass false to enable collection of files to delete*/,
+ new ArrayList<VirtualFile>(),
+ toDelete
+ );
}
});
for (Trinity<File, String, Boolean> trinity : toDelete) {
context.getProgressIndicator().pushState();
final boolean[] wereFilesDeleted = new boolean[]{false};
- boolean traverseRootsProcessed = false;
try {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
}
}
- final boolean hadUnprocessedTraverseRoots = context.getDependencyCache().hasUnprocessedTraverseRoots();
- if ((wereFilesDeleted[0] || hadUnprocessedTraverseRoots || !toCompile.isEmpty()) && context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
+ if ((wereFilesDeleted[0] || !toCompile.isEmpty()) && context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
compiler.compile(context, moduleChunk, VfsUtil.toVirtualFileArray(toCompile), sink);
- traverseRootsProcessed = hadUnprocessedTraverseRoots != context.getDependencyCache().hasUnprocessedTraverseRoots();
}
}
finally {
context.getProgressIndicator().popState();
}
- return !toCompile.isEmpty() || traverseRootsProcessed || wereFilesDeleted[0];
+ return !toCompile.isEmpty() || wereFilesDeleted[0];
}
private static boolean syncOutputDir(final CompileContextEx context, final Collection<Trinity<File, String, Boolean>> toDelete) throws CacheCorruptedException {
private final CompileContextEx myContext;
private final TranslatingCompiler[] myCompilers;
private int myCurrentCompilerIdx;
+ private final Set<VirtualFile> myCompiledSources = new HashSet<VirtualFile>();
//private LinkedBlockingQueue<Future> myFutures = new LinkedBlockingQueue<Future>();
private TranslatorsOutputSink(CompileContextEx context, TranslatingCompiler[] compilers) {
myCurrentCompilerIdx = index;
}
+ public Set<VirtualFile> getCompiledSources() {
+ return Collections.unmodifiableSet(myCompiledSources);
+ }
+
public void add(final String outputRoot, final Collection<TranslatingCompiler.OutputItem> items, final VirtualFile[] filesToRecompile) {
+ for (TranslatingCompiler.OutputItem item : items) {
+ final VirtualFile file = item.getSourceFile();
+ if (file != null) {
+ myCompiledSources.add(file);
+ }
+ }
final TranslatingCompiler compiler = myCompilers[myCurrentCompilerIdx];
if (compiler instanceof IntermediateOutputCompiler) {
final LocalFileSystem lfs = LocalFileSystem.getInstance();
}
}
- private void addItemToMap(Map<String, Collection<TranslatingCompiler.OutputItem>> map, String outputDir, TranslatingCompiler.OutputItem item) {
+ private static void addItemToMap(Map<String, Collection<TranslatingCompiler.OutputItem>> map, String outputDir, TranslatingCompiler.OutputItem item) {
Collection<TranslatingCompiler.OutputItem> collection = map.get(outputDir);
if (collection == null) {
collection = new ArrayList<TranslatingCompiler.OutputItem>();
}
}
}
+
+ private static class DependentClassesCumulativeFilter implements Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> {
+
+ private final TIntHashSet myProcessedNames = new TIntHashSet();
+ private final Set<VirtualFile> myProcessedFiles = new HashSet<VirtualFile>();
+
+ public Pair<int[], Set<VirtualFile>> fun(Pair<int[], Set<VirtualFile>> deps) {
+ final TIntHashSet currentDeps = new TIntHashSet(deps.getFirst());
+ currentDeps.removeAll(myProcessedNames.toArray());
+ myProcessedNames.addAll(deps.getFirst());
+
+ final Set<VirtualFile> depFiles = new HashSet<VirtualFile>(deps.getSecond());
+ depFiles.removeAll(myProcessedFiles);
+ myProcessedFiles.addAll(deps.getSecond());
+ return new Pair<int[], Set<VirtualFile>>(currentDeps.toArray(), depFiles);
+ }
+ }
}
if (srcFile != null) {
final SourceFileInfo srcInfo = loadSourceInfo(srcFile);
if (srcInfo != null) {
+ final boolean srcWillBeDeleted = VfsUtil.isAncestor(eventFile, srcFile, false);
for (int projectId : srcInfo.getProjectIds().toArray()) {
if (srcInfo.isAssociated(projectId, filePath)) {
- addSourceForRecompilation(projectId, srcFile, srcInfo);
+ if (srcWillBeDeleted) {
+ if (LOG.isDebugEnabled() || ourDebugMode) {
+ final String message = "Unschedule recompilation because of deletion " + srcFile.getPresentableUrl();
+ LOG.debug(message);
+ if (ourDebugMode) {
+ System.out.println(message);
+ }
+ }
+ removeSourceForRecompilation(projectId, Math.abs(getFileId(srcFile)));
+ }
+ else {
+ addSourceForRecompilation(projectId, srcFile, srcInfo);
+ }
}
}
}
final TIntHashSet projects = srcInfo.getProjectIds();
if (!projects.isEmpty()) {
final ScheduleOutputsForDeletionProc deletionProc = new ScheduleOutputsForDeletionProc(file.getUrl());
+ deletionProc.setRootBeingDeleted(eventFile);
+ final int sourceFileId = Math.abs(getFileId(file));
for (int projectId : projects.toArray()) {
// mark associated outputs for deletion
srcInfo.processOutputPaths(projectId, deletionProc);
System.out.println(message);
}
}
- removeSourceForRecompilation(projectId, Math.abs(getFileId(file)));
+ removeSourceForRecompilation(projectId, sourceFileId);
}
}
}
private class ScheduleOutputsForDeletionProc implements Proc {
private final String mySrcUrl;
private final LocalFileSystem myFileSystem;
+ @Nullable
+ private VirtualFile myRootBeingDeleted;
private ScheduleOutputsForDeletionProc(final String srcUrl) {
mySrcUrl = srcUrl;
myFileSystem = LocalFileSystem.getInstance();
}
+ public void setRootBeingDeleted(@Nullable VirtualFile rootBeingDeleted) {
+ myRootBeingDeleted = rootBeingDeleted;
+ }
+
public boolean execute(final int projectId, String outputPath) {
final VirtualFile outFile = myFileSystem.findFileByPath(outputPath);
if (outFile != null) { // not deleted yet
- final OutputFileInfo outputInfo = loadOutputInfo(outFile);
- final String classname = outputInfo != null? outputInfo.getClassName() : null;
- markOutputPathForDeletion(projectId, outputPath, classname, mySrcUrl);
+ if (myRootBeingDeleted != null && VfsUtil.isAncestor(myRootBeingDeleted, outFile, false)) {
+ unmarkOutputPathForDeletion(outputPath);
+ }
+ else {
+ final OutputFileInfo outputInfo = loadOutputInfo(outFile);
+ final String classname = outputInfo != null? outputInfo.getClassName() : null;
+ markOutputPathForDeletion(projectId, outputPath, classname, mySrcUrl);
+ }
}
return true;
}
void compileFinished();
- @Nullable
- DependencyProcessor getDependencyProcessor();
}
import com.intellij.compiler.classParsing.AnnotationConstantValue;
import com.intellij.compiler.classParsing.MethodInfo;
import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.make.*;
+import com.intellij.compiler.make.Cache;
+import com.intellij.compiler.make.CacheCorruptedException;
+import com.intellij.compiler.make.DependencyCache;
+import com.intellij.compiler.make.MakeUtil;
import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.module.JavaModuleType;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
-import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkType;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Chunk;
-import com.intellij.util.Function;
import com.intellij.util.cls.ClsFormatException;
import gnu.trove.THashMap;
-import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper");
private final BackendCompiler myCompiler;
- private final Set<VirtualFile> mySuccesfullyCompiledJavaFiles; // VirtualFile
private final CompileContextEx myCompileContext;
private final List<VirtualFile> myFilesToCompile;
private final TranslatingCompiler.OutputSink mySink;
private final Chunk<Module> myChunk;
private final Project myProject;
- private final Set<VirtualFile> myFilesToRecompile;
private final Map<Module, VirtualFile> myModuleToTempDirMap = new THashMap<Module, VirtualFile>();
private final ProjectFileIndex myProjectFileIndex;
@NonNls private static final String PACKAGE_ANNOTATION_FILE_NAME = "package-info.java";
private static final FileObject myStopThreadToken = new FileObject(new File(""), new byte[0]);
public final Map<String, Set<CompiledClass>> myFileNameToSourceMap= new THashMap<String, Set<CompiledClass>>();
-
+ private final Set<VirtualFile> myProcessedPackageInfos = new HashSet<VirtualFile>();
public BackendCompilerWrapper(Chunk<Module> chunk, @NotNull final Project project,
@NotNull List<VirtualFile> filesToCompile,
myCompiler = compiler;
myCompileContext = compileContext;
myFilesToCompile = filesToCompile;
- myFilesToRecompile = new HashSet<VirtualFile>(filesToCompile);
mySink = sink;
myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
- mySuccesfullyCompiledJavaFiles = new HashSet<VirtualFile>(filesToCompile.size());
}
public void compile() throws CompilerException, CacheCorruptedException {
Application application = ApplicationManager.getApplication();
- final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();
- COMPILE:
try {
if (!myFilesToCompile.isEmpty()) {
if (application.isUnitTestMode()) {
saveTestData();
}
-
compileModules(buildModuleToFilesMap(myFilesToCompile));
}
-
- Collection<VirtualFile> dependentFiles;
- do {
- dependentFiles = CacheUtils.findDependentFiles(myCompileContext, mySuccesfullyCompiledJavaFiles, myCompiler.getDependencyProcessor(), DEPENDENCY_FILTER);
-
- if (!dependentFiles.isEmpty()) {
- myFilesToRecompile.addAll(dependentFiles);
- allDependent.addAll(dependentFiles);
- if (myCompileContext.getProgressIndicator().isCanceled() || myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
- break COMPILE;
- }
- final List<VirtualFile> filesInScope = getFilesInScope(dependentFiles);
- if (filesInScope.isEmpty()) {
- break;
- }
- myCompileContext.getDependencyCache().clearTraverseRoots();
- compileModules(buildModuleToFilesMap(filesInScope));
- }
- }
- while (!dependentFiles.isEmpty() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0);
}
catch (SecurityException e) {
throw new CompilerException(CompilerBundle.message("error.compiler.process.not.started", e.getMessage()), e);
myModuleToTempDirMap.clear();
}
- // do not update caches if cancelled because there is a chance that they will be incomplete
- if (CompilerConfiguration.MAKE_ENABLED) {
- if (!myCompileContext.getProgressIndicator().isCanceled()) {
- // when cancelled pretend nothing was compiled and next compile will compile everything from the scratch
- final ProgressIndicator indicator = myCompileContext.getProgressIndicator();
- final DependencyCache cache = myCompileContext.getDependencyCache();
-
- indicator.pushState();
- indicator.setText(CompilerBundle.message("progress.updating.caches"));
- indicator.setText2("");
-
- cache.update();
-
- indicator.setText(CompilerBundle.message("progress.saving.caches"));
- cache.resetState();
-
- indicator.popState();
+ if (!myFilesToCompile.isEmpty() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
+ // package-info.java hack
+ final List<TranslatingCompiler.OutputItem> outputs = new ArrayList<TranslatingCompiler.OutputItem>();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ for (final VirtualFile file : myFilesToCompile) {
+ if (PACKAGE_ANNOTATION_FILE_NAME.equals(file.getName()) && !myProcessedPackageInfos.contains(file)) {
+ outputs.add(new OutputItemImpl(file));
+ }
+ }
+ }
+ });
+ if (!outputs.isEmpty()) {
+ mySink.add(null, outputs, VirtualFile.EMPTY_ARRAY);
}
}
-
- myFilesToRecompile.removeAll(mySuccesfullyCompiledJavaFiles);
- if (myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) != 0) {
- myFilesToRecompile.addAll(allDependent);
- }
- final List<TranslatingCompiler.OutputItem> outputs = processPackageInfoFiles();
- if (myFilesToRecompile.size() > 0 || outputs.size() > 0) {
- mySink.add(null, outputs, VfsUtil.toVirtualFileArray(myFilesToRecompile));
- }
}
private Map<Module, List<VirtualFile>> buildModuleToFilesMap(final List<VirtualFile> filesToCompile) {
return CompilerUtil.buildModuleToFilesMap(myCompileContext, filesToCompile);
}
- // package-info.java hack
- private List<TranslatingCompiler.OutputItem> processPackageInfoFiles() {
- if (myFilesToRecompile.isEmpty()) {
- return Collections.emptyList();
- }
- final List<TranslatingCompiler.OutputItem> outputs = new ArrayList<TranslatingCompiler.OutputItem>();
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- final List<VirtualFile> packageInfoFiles = new ArrayList<VirtualFile>(myFilesToRecompile.size());
- for (final VirtualFile file : myFilesToRecompile) {
- if (PACKAGE_ANNOTATION_FILE_NAME.equals(file.getName())) {
- packageInfoFiles.add(file);
- }
- }
- if (!packageInfoFiles.isEmpty()) {
- final Set<VirtualFile> badFiles = getFilesCompiledWithErrors();
- for (final VirtualFile packageInfoFile : packageInfoFiles) {
- if (!badFiles.contains(packageInfoFile)) {
- outputs.add(new OutputItemImpl(packageInfoFile));
- myFilesToRecompile.remove(packageInfoFile);
- }
- }
- }
- }
- });
- return outputs;
- }
-
- private List<VirtualFile> getFilesInScope(final Collection<VirtualFile> files) {
- final List<VirtualFile> filesInScope = new ArrayList<VirtualFile>(files.size());
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- public void run() {
- for (VirtualFile file : files) {
- if (myCompileContext.getCompileScope().belongs(file.getUrl())) {
- final Module module = myCompileContext.getModuleByFile(file);
- if (myChunk.getNodes().contains(module)) {
- filesInScope.add(file);
- }
- }
- }
- }
- });
- return filesInScope;
- }
-
private void compileModules(final Map<Module, List<VirtualFile>> moduleToFilesMap) throws CompilerException {
myProcessedFilesCount = 0;
try {
});
}
- private final TIntHashSet myProcessedNames = new TIntHashSet();
- private final Set<VirtualFile> myProcessedFiles = new HashSet<VirtualFile>();
- private final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> DEPENDENCY_FILTER = new Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>>() {
- public Pair<int[], Set<VirtualFile>> fun(Pair<int[], Set<VirtualFile>> deps) {
- final TIntHashSet currentDeps = new TIntHashSet(deps.getFirst());
- currentDeps.removeAll(myProcessedNames.toArray());
- myProcessedNames.addAll(deps.getFirst());
-
- final Set<VirtualFile> depFiles = new HashSet<VirtualFile>(deps.getSecond());
- depFiles.removeAll(myProcessedFiles);
- myProcessedFiles.addAll(deps.getSecond());
- return new Pair<int[], Set<VirtualFile>>(currentDeps.toArray(), depFiles);
- }
- };
-
private final Object lock = new Object();
private class SynchedCompilerParsing extends CompilerParsingThread {
}
private void compileFinished(int exitValue, final ModuleChunk chunk, final String outputDir) {
- if (exitValue != 0 && !myCompileContext.getProgressIndicator().isCanceled() &&
- myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
+ if (exitValue != 0 && !myCompileContext.getProgressIndicator().isCanceled() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
myCompileContext.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("error.compiler.internal.error", exitValue), null, -1, -1);
}
try {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
- final Set<VirtualFile> compiledWithErrors = getFilesCompiledWithErrors();
final FileTypeManager typeManager = FileTypeManager.getInstance();
final String outputDirPath = outputDir.replace(File.separatorChar, '/');
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\"");
}
- buildOutputItemsList(outputDirPath, module, root, typeManager, compiledWithErrors, root, packagePrefix, toRefresh, results);
+ buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results);
}
}
}
myFileNameToSourceMap.clear(); // clear the map before the next use
}
- private Set<VirtualFile> getFilesCompiledWithErrors() {
- CompilerMessage[] messages = myCompileContext.getMessages(CompilerMessageCategory.ERROR);
- Set<VirtualFile> compiledWithErrors = Collections.emptySet();
- if (messages.length > 0) {
- compiledWithErrors = new HashSet<VirtualFile>(messages.length);
- for (CompilerMessage message : messages) {
- final VirtualFile file = message.getVirtualFile();
- if (file != null) {
- compiledWithErrors.add(file);
- }
- }
- }
- return compiledWithErrors;
- }
-
private void buildOutputItemsList(final String outputDir, Module module, VirtualFile from,
final FileTypeManager typeManager,
- final Set<VirtualFile> compiledWithErrors,
final VirtualFile sourceRoot,
final String packagePrefix, final List<File> filesToRefresh, final Map<String, Collection<TranslatingCompiler.OutputItem>> results) throws CacheCorruptedException {
final Ref<CacheCorruptedException> exRef = new Ref<CacheCorruptedException>(null);
try {
assert child.isValid();
if (!child.isDirectory() && myCompiler.getCompilableFileTypes().contains(typeManager.getFileTypeByFile(child))) {
- updateOutputItemsList(outputDir, child, compiledWithErrors, sourceRoot, packagePrefix, filesToRefresh, results);
+ updateOutputItemsList(outputDir, child, sourceRoot, packagePrefix, filesToRefresh, results);
}
return true;
}
paths.add(new CompiledClass(classQName, relativePathToSource, pathToClass));
}
- private void updateOutputItemsList(final String outputDir, VirtualFile srcFile, Set<VirtualFile> compiledWithErrors,
+ private void updateOutputItemsList(final String outputDir, VirtualFile srcFile,
VirtualFile sourceRoot,
final String packagePrefix, final List<File> filesToRefresh,
Map<String, Collection<TranslatingCompiler.OutputItem>> results) throws CacheCorruptedException {
results.put(realLocation.getFirst(), outputs);
}
outputs.add(new OutputItemImpl(realLocation.getSecond(), srcFile));
+ if (PACKAGE_ANNOTATION_FILE_NAME.equals(srcFile.getName())) {
+ myProcessedPackageInfos.add(srcFile);
+ }
if (CompilerConfiguration.MAKE_ENABLED) {
newCache.setPath(cc.qName, realLocation.getSecond());
}
LOG.debug("Added output item: [outputDir; outputPath; sourceFile] = [" + realLocation.getFirst() + "; " +
realLocation.getSecond() + "; " + srcFile.getPresentableUrl() + "]");
}
- if (!compiledWithErrors.contains(srcFile)) {
- mySuccesfullyCompiledJavaFiles.add(srcFile);
- }
}
else {
myCompileContext.addMessage(CompilerMessageCategory.ERROR, "Failed to copy from temporary location to output directory: " + outputPath + " (see idea.log for details)", null, -1, -1);
* @param packagePrefix
* @return A 'package'-path to a given src file relative to a specified root. "/" slashes must be used
*/
- protected String calcPackagePath(VirtualFile srcFile, VirtualFile sourceRoot, String packagePrefix) {
+ protected static String calcPackagePath(VirtualFile srcFile, VirtualFile sourceRoot, String packagePrefix) {
final String prefix = packagePrefix != null && packagePrefix.length() > 0 ? packagePrefix.replace('.', '/') + "/" : "";
return prefix + VfsUtil.getRelativePath(srcFile, sourceRoot, '/');
}
return COMPILABLE_TYPES;
}
- public DependencyProcessor getDependencyProcessor() {
- return null;
- }
-
@NotNull
public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
final String[] commands = createStartupCommand(chunk, compileContext, outputDir);
import com.intellij.compiler.OutputParser;
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.DependencyProcessor;
import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
import com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler;
import com.intellij.compiler.impl.javaCompiler.javac.JavacConfigurable;
myProject = project;
}
- public DependencyProcessor getDependencyProcessor() {
- return null;
- }
-
public boolean checkCompiler(final CompileScope scope) {
return true;
}
import com.intellij.compiler.OutputParser;
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.DependencyProcessor;
import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
import com.intellij.compiler.impl.javaCompiler.javac.JavacSettings;
import com.intellij.openapi.application.ApplicationManager;
myEclipseCompilerDriver = new EclipseCompilerDriver();
}
- public DependencyProcessor getDependencyProcessor() {
- return null;
- }
-
public boolean checkCompiler(final CompileScope scope) {
return myEclipseCompilerDriver != null && myEclipseExternalCompiler.checkCompiler(scope);
}
import com.intellij.compiler.CompilerManagerImpl;
import com.intellij.compiler.SymbolTable;
import com.intellij.compiler.classParsing.MethodInfo;
-import com.intellij.compiler.impl.javaCompiler.DependencyProcessor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompilerBundle;
+import com.intellij.openapi.compiler.CompilerMessage;
+import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.compiler.ex.CompileContextEx;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.util.Function;
import com.intellij.util.StringBuilderSpinAllocator;
import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
return true;
}
- public static Collection<VirtualFile> findDependentFiles(final CompileContextEx context, final Set<VirtualFile> succesfullyCompiledJavaFiles,
- final @Nullable DependencyProcessor additionalDependencyProcessor,
- final @Nullable Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> filter) throws CacheCorruptedException {
+ public static Collection<VirtualFile> findDependentFiles(
+ final CompileContextEx context,
+ final Set<VirtualFile> succesfullyCompiledJavaFiles,
+ final @Nullable Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> filter) throws CacheCorruptedException {
+
if (!CompilerConfiguration.MAKE_ENABLED) {
return Collections.emptyList();
}
final DependencyCache dependencyCache = context.getDependencyCache();
final Pair<int[], Set<VirtualFile>> deps =
- dependencyCache.findDependentClasses(context, context.getProject(), succesfullyCompiledJavaFiles, additionalDependencyProcessor);
+ dependencyCache.findDependentClasses(context, context.getProject(), succesfullyCompiledJavaFiles);
final Pair<int[], Set<VirtualFile>> filteredDeps = filter != null? filter.fun(deps) : deps;
final Set<VirtualFile> dependentFiles = new HashSet<VirtualFile>();
return dependentFiles;
}
+
+ @NotNull
+ public static Set<VirtualFile> getFilesCompiledWithErrors(final CompileContextEx context) {
+ CompilerMessage[] messages = context.getMessages(CompilerMessageCategory.ERROR);
+ Set<VirtualFile> compiledWithErrors = Collections.emptySet();
+ if (messages.length > 0) {
+ compiledWithErrors = new HashSet<VirtualFile>(messages.length);
+ for (CompilerMessage message : messages) {
+ final VirtualFile file = message.getVirtualFile();
+ if (file != null) {
+ compiledWithErrors.add(file);
+ }
+ }
+ }
+ return compiledWithErrors;
+ }
}
*/
package com.intellij.compiler.make;
+import com.intellij.compiler.DependencyProcessor;
import com.intellij.compiler.SymbolTable;
import com.intellij.compiler.classParsing.*;
-import com.intellij.compiler.impl.javaCompiler.DependencyProcessor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.diagnostic.Logger;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
/**
* @return qualified names of the classes that should be additionally recompiled
*/
- public Pair<int[], Set<VirtualFile>> findDependentClasses(CompileContext context, Project project, Set<VirtualFile> successfullyCompiled, @Nullable final DependencyProcessor additionalProcessor)
- throws CacheCorruptedException {
+ public Pair<int[], Set<VirtualFile>> findDependentClasses(CompileContext context, Project project, Set<VirtualFile> successfullyCompiled)
+ throws CacheCorruptedException {
- markDependencies(context, project, successfullyCompiled, additionalProcessor);
+ markDependencies(context, project, successfullyCompiled);
return new Pair<int[], Set<VirtualFile>>(myMarkedInfos.toArray(), Collections.unmodifiableSet(myMarkedFiles));
}
- private void markDependencies(CompileContext context, Project project, final Set<VirtualFile> successfullyCompiled,
- @Nullable final DependencyProcessor additionalProcessor) throws CacheCorruptedException {
+ private void markDependencies(CompileContext context, Project project, final Set<VirtualFile> successfullyCompiled) throws CacheCorruptedException {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("====================Marking dependent files=====================");
).run();
}
changedRetentionPolicyDependencyProcessor.checkAnnotationRetentionPolicyChanges(qName);
- if (additionalProcessor != null) {
+ for (DependencyProcessor additionalProcessor : DependencyProcessor.EXTENSION_POINT_NAME.getExtensions()) {
additionalProcessor.processDependencies(context, qName);
}
}
VirtualFile dir = files[0];
try {
if (!dir.getName().equals(MANIFEST_DIR_NAME)) {
- VirtualFile newDir = dir.findChild(MANIFEST_DIR_NAME);
- if (newDir == null) {
- newDir = dir.createChildDirectory(this, MANIFEST_DIR_NAME);
- }
- dir = newDir;
+ dir = VfsUtil.createDirectoryIfMissing(dir, MANIFEST_DIR_NAME);
}
- result.setResult(dir.createChildData(this, MANIFEST_FILE_NAME));
+ final VirtualFile file = dir.createChildData(this, MANIFEST_FILE_NAME);
+ final OutputStream output = file.getOutputStream(this);
+ try {
+ final Manifest manifest = new Manifest();
+ ManifestBuilder.setVersionAttribute(manifest.getMainAttributes());
+ manifest.write(output);
+ }
+ finally {
+ output.close();
+ }
+ result.setResult(file);
}
catch (IOException e) {
exc.set(e);
}
}
if (myNestedFormDirs != null) {
- for(Iterator it = myNestedFormDirs.iterator(); it.hasNext(); ) {
- String path = (String) it.next();
- if (path.replace(File.separatorChar, '/').toLowerCase().endsWith(formFileFullName)) {
- return loadForm(formFileName, new FileInputStream(path));
- }
+ String[] list = myNestedFormDirs.list();
+ for (int i = 0, listLength = list.length; i < listLength; i++) {
+ String formPath = list[i];
+ if (!formPath.endsWith("/")) {
+ formPath += "/";
+ }
+ if (formFileFullName.startsWith("/")) {
+ formPath += formFileName.substring(1);
+ }
+ else {
+ formPath += formFileName;
+ }
+ File formFile = new File(formPath.replace('/', File.separatorChar));
+ if (formFile.isFile()) {
+ return loadForm(formFileName, new FileInputStream(formFile));
}
+ }
}
InputStream resourceStream = myLoader.getResourceAsStream(formFileName);
if (resourceStream != null) {
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.*;
+import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInsight.lookup.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
return o.toString();
}
}
- return memberValue.getText();
+ return memberValue != null ? memberValue.getText() : "";
}
LOG.assertTrue(callText != null, myMethodCall.getMethodExpression());
PsiType[] expectedTypes;
PsiType type;
+ PsiField field = targetClass.findFieldByName(fieldName, true);
if (callText.startsWith(GET_PREFIX)) {
- expectedTypes = CreateFromUsageUtils.guessType(myMethodCall, false);
+ expectedTypes = field != null ? new PsiType[]{field.getType()} : CreateFromUsageUtils.guessType(myMethodCall, false);
type = expectedTypes[0];
}
else if (callText.startsWith(IS_PREFIX)) {
IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
try {
- PsiField field = targetClass.findFieldByName(fieldName, true);
+
if (field == null) {
field = factory.createField(fieldName, type);
PsiUtil.setModifierProperty(field, PsiModifier.STATIC, isStatic);
return new JavaPushDownHandler();
}
- public RefactoringActionHandler getExtractModuleHandler() {
+ public RefactoringActionHandler getExtractInterfaceHandler() {
return new ExtractInterfaceHandler();
}
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.lang.LighterASTNode;
import com.intellij.lang.PsiBuilder;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Pair;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.impl.source.tree.ElementType;
import com.intellij.psi.impl.source.tree.JavaElementType;
FILE, CLASS, CODE_BLOCK, ANNOTATION_INTERFACE
}
+ private static final Logger LOG = Logger.getInstance("#com.intellij.lang.java.parser.DeclarationParser");
+
private static final TokenSet AFTER_END_DECLARATION_SET = TokenSet.create(JavaElementType.FIELD, JavaElementType.METHOD);
private DeclarationParser() { }
marker.drop();
builder.advanceLexer();
+ final PsiBuilder builderWrapper = braceMatchingBuilder(builder);
if (isEnum) {
- parseEnumConstants(builder);
+ parseEnumConstants(builderWrapper);
}
- parseClassBodyDeclarations(builder, isAnnotation);
+ parseClassBodyDeclarations(builderWrapper, isAnnotation);
expectOrError(builder, JavaTokenType.RBRACE, JavaErrorMessages.message("expected.rbrace"));
final PsiBuilder.Marker declaration = builder.mark();
- final PsiBuilder.Marker modList = parseModifierList(builder);
+ final Pair<PsiBuilder.Marker, Boolean> modListInfo = parseModifierList(builder);
+ final PsiBuilder.Marker modList = modListInfo.first;
if (expect(builder, JavaTokenType.AT)) {
- if (tokenType == JavaTokenType.INTERFACE_KEYWORD) {
+ if (builder.getTokenType() == JavaTokenType.INTERFACE_KEYWORD) {
return parseClassFromKeyword(builder, declaration, true);
}
else {
return null;
}
}
- else if (ElementType.CLASS_KEYWORD_BIT_SET.contains(tokenType)) {
+ else if (ElementType.CLASS_KEYWORD_BIT_SET.contains(builder.getTokenType())) {
final PsiBuilder.Marker root = parseClassFromKeyword(builder, declaration, false);
-
if (context == Context.FILE) {
// todo: append following declarations to root
boolean declarationsAfterEnd = false;
}
if (context == Context.FILE) {
- if (typeParams == null) {
- error(builder, JavaErrorMessages.message("expected.class.or.interface"));
+ error(builder, JavaErrorMessages.message("expected.class.or.interface"), typeParams);
+ declaration.drop();
+ return modList;
+ }
+
+ PsiBuilder.Marker type;
+ if (ElementType.PRIMITIVE_TYPE_BIT_SET.contains(builder.getTokenType())) {
+ type = parseTypeNotNull(builder);
+ }
+ else if (builder.getTokenType() == JavaTokenType.IDENTIFIER) {
+ final PsiBuilder.Marker idPos = builder.mark();
+ type = parseTypeNotNull(builder);
+ if (builder.getTokenType() == JavaTokenType.LPARENTH) { // constructor
+ if (context == Context.CODE_BLOCK) {
+ declaration.rollbackTo();
+ return null;
+ }
+ idPos.rollbackTo();
+ if (typeParams == null) {
+ emptyElement(builder, JavaElementType.TYPE_PARAMETER_LIST);
+ }
+ builder.advanceLexer();
+ if (builder.getTokenType() != JavaTokenType.LPARENTH) {
+ declaration.rollbackTo();
+ return null;
+ }
+ return parseMethodFromLeftParenth(builder, declaration, false);
+ }
+ idPos.drop();
+ }
+ else if (builder.getTokenType() == JavaTokenType.LBRACE) {
+ if (context == Context.CODE_BLOCK) {
+ error(builder, JavaErrorMessages.message("expected.identifier.or.type"), typeParams);
+ declaration.drop();
+ return modList;
+ }
+
+ final PsiBuilder.Marker codeBlock = StatementParser.parseCodeBlock(builder);
+ LOG.assertTrue(codeBlock != null);
+
+ if (typeParams != null) {
+ final PsiBuilder.Marker error = typeParams.precede();
+ error.errorBefore(JavaErrorMessages.message("unexpected.token"), codeBlock);
+ }
+ declaration.done(JavaElementType.CLASS_INITIALIZER);
+ return declaration;
+ }
+ else {
+ final PsiBuilder.Marker error;
+ if (typeParams != null) {
+ error = typeParams.precede();
}
else {
- typeParams.precede().errorBefore(JavaErrorMessages.message("expected.class.or.interface"), typeParams);
+ error = builder.mark();
}
- declaration.drop();
+ error.error(JavaErrorMessages.message("expected.identifier.or.type"));
return modList;
}
- // todo: implement
- throw new UnsupportedOperationException(builder.toString() + context);
+ if (!expect(builder, JavaTokenType.IDENTIFIER)) {
+ if (context == Context.CODE_BLOCK && modListInfo.second) {
+ declaration.rollbackTo();
+ return null;
+ }
+ else {
+ if (typeParams != null) {
+ typeParams.precede().errorBefore(JavaErrorMessages.message("unexpected.token"), type);
+ }
+ builder.error(JavaErrorMessages.message("expected.identifier"));
+ declaration.drop();
+ return modList;
+ }
+ }
+
+ if (builder.getTokenType() == JavaTokenType.LPARENTH) {
+ if (context == Context.CLASS || context == Context.ANNOTATION_INTERFACE) { // method
+ if (typeParams == null) {
+ emptyElement(type, JavaElementType.TYPE_PARAMETER_LIST);
+ }
+ return parseMethodFromLeftParenth(builder, declaration, (context == Context.ANNOTATION_INTERFACE));
+ }
+ }
+
+ if (typeParams != null) {
+ typeParams.precede().errorBefore(JavaErrorMessages.message("unexpected.token"), type);
+ }
+ return parseFieldOrLocalVariable(builder, declaration, context);
+ }
+
+ @NotNull
+ private static PsiBuilder.Marker parseTypeNotNull(final PsiBuilder builder) {
+ final ReferenceParser.TypeInfo typeInfo = ReferenceParser.parseType(builder);
+ assert typeInfo != null : builder.getOriginalText();
+ return typeInfo.marker;
}
@NotNull
- private static PsiBuilder.Marker parseModifierList(final PsiBuilder builder) {
+ private static Pair<PsiBuilder.Marker, Boolean> parseModifierList(final PsiBuilder builder) {
final PsiBuilder.Marker modList = builder.mark();
+ boolean isEmpty = true;
while (true) {
final IElementType tokenType = builder.getTokenType();
if (tokenType == null) break;
if (ElementType.MODIFIER_BIT_SET.contains(tokenType)) {
builder.advanceLexer();
+ isEmpty = false;
}
else if (tokenType == JavaTokenType.AT) {
final PsiBuilder.Marker pos = builder.mark();
break;
}
parseAnnotation(builder);
+ isEmpty = false;
}
else {
break;
}
modList.done(JavaElementType.MODIFIER_LIST);
- return modList;
+ return Pair.create(modList, isEmpty);
+ }
+
+ private static PsiBuilder.Marker parseMethodFromLeftParenth(final PsiBuilder builder, final PsiBuilder.Marker declaration,
+ final boolean anno) {
+ parseParameterList(builder);
+
+ eatBrackets(builder);
+
+ if (areTypeAnnotationsSupported(builder)) {
+ final PsiBuilder.Marker receiver = builder.mark();
+ final PsiBuilder.Marker annotations = parseAnnotations(builder);
+ if (annotations != null) {
+ receiver.done(JavaElementType.METHOD_RECEIVER);
+ }
+ else {
+ receiver.drop();
+ }
+ }
+
+ ReferenceParser.parseReferenceList(builder, JavaTokenType.THROWS_KEYWORD, JavaElementType.THROWS_LIST, JavaTokenType.COMMA);
+
+ if (anno && expect(builder, JavaTokenType.DEFAULT_KEYWORD)) {
+ parseAnnotationValue(builder);
+ }
+
+ final IElementType tokenType = builder.getTokenType();
+ if (tokenType == JavaTokenType.SEMICOLON) {
+ builder.advanceLexer();
+ }
+ else if (tokenType == JavaTokenType.LBRACE) {
+ StatementParser.parseCodeBlock(builder);
+ }
+ else {
+ error(builder, JavaErrorMessages.message("expected.lbrace.or.semicolon"));
+ // todo: special treatment - like in fields (DeclarationParserTest.testMultiLineUnclosed())
+ }
+
+ declaration.done(anno ? JavaElementType.ANNOTATION_METHOD : JavaElementType.METHOD);
+ return declaration;
+ }
+
+ @NotNull
+ private static PsiBuilder.Marker parseParameterList(final PsiBuilder builder) {
+ assert builder.getTokenType() == JavaTokenType.LPARENTH : builder.getTokenType();
+ final PsiBuilder.Marker paramList = builder.mark();
+ builder.advanceLexer();
+
+ PsiBuilder.Marker invalidElements = null;
+ boolean commaExpected = false;
+ int paramCount = 0;
+ while (true) {
+ final IElementType tokenType = builder.getTokenType();
+ if (tokenType == null || tokenType == JavaTokenType.RPARENTH) {
+ boolean noLastParam = !commaExpected && paramCount > 0;
+ if (noLastParam) {
+ error(builder, JavaErrorMessages.message("expected.identifier.or.type"));
+ }
+ if (!expect(builder, JavaTokenType.RPARENTH)) {
+ if (!noLastParam) {
+ error(builder, JavaErrorMessages.message("expected.rparen"));
+ }
+ }
+ break;
+ }
+
+ if (commaExpected) {
+ if (builder.getTokenType() == JavaTokenType.COMMA) {
+ commaExpected = false;
+ if (invalidElements != null) {
+ invalidElements.error(JavaErrorMessages.message("expected.parameter"));
+ invalidElements = null;
+ }
+ builder.advanceLexer();
+ continue;
+ }
+ }
+ else {
+ final PsiBuilder.Marker param = parseParameter(builder, true);
+ if (param != null) {
+ commaExpected = true;
+ if (invalidElements != null) {
+ invalidElements.errorBefore(JavaErrorMessages.message("expected.comma"), param);
+ invalidElements = null;
+ }
+ paramCount++;
+ continue;
+ }
+ }
+
+ if (invalidElements == null) {
+ if (builder.getTokenType() == JavaTokenType.COMMA) {
+ error(builder, JavaErrorMessages.message("expected.parameter"));
+ builder.advanceLexer();
+ continue;
+ }
+ else {
+ invalidElements = builder.mark();
+ }
+ }
+
+ // adding a reference, not simple tokens allows "Browse .." to work well
+ final PsiBuilder.Marker ref = ReferenceParser.parseJavaCodeReference(builder, true, true, false);
+ if (ref == null && builder.getTokenType() != null) {
+ builder.advanceLexer();
+ }
+ }
+
+ if (invalidElements != null) {
+ invalidElements.error(commaExpected ? JavaErrorMessages.message("expected.comma") : JavaErrorMessages.message("expected.parameter"));
+ }
+
+ paramList.done(JavaElementType.PARAMETER_LIST);
+ return paramList;
+ }
+
+ @Nullable
+ private static PsiBuilder.Marker parseParameter(final PsiBuilder builder, final boolean ellipsis) {
+ final PsiBuilder.Marker param = builder.mark();
+
+ final Pair<PsiBuilder.Marker, Boolean> modListInfo = parseModifierList(builder);
+ final PsiBuilder.Marker type = ellipsis ? ReferenceParser.parseTypeWithEllipsis(builder, true, true) :
+ ReferenceParser.parseType(builder, true, true);
+
+ if (type == null && modListInfo.second) {
+ param.rollbackTo();
+ return null;
+ }
+
+ if (type == null) {
+ error(builder, JavaErrorMessages.message("expected.type"));
+ emptyElement(builder, JavaElementType.TYPE);
+ }
+
+ if (expect(builder, JavaTokenType.IDENTIFIER)) {
+ eatBrackets(builder);
+ }
+ else {
+ error(builder, JavaErrorMessages.message("expected.identifier"));
+ }
+
+ param.done(JavaElementType.PARAMETER);
+ return param;
+ }
+
+ @Nullable
+ private static PsiBuilder.Marker parseFieldOrLocalVariable(final PsiBuilder builder, final PsiBuilder.Marker declaration,
+ final Context context) {
+ final IElementType varType;
+ if (context == Context.CLASS || context == Context.ANNOTATION_INTERFACE) {
+ varType = JavaElementType.FIELD;
+ }
+ else if (context == Context.CODE_BLOCK) {
+ varType = JavaElementType.LOCAL_VARIABLE;
+ }
+ else {
+ LOG.error("Unexpected context: " + context);
+ declaration.drop();
+ return null;
+ }
+
+ PsiBuilder.Marker variable = declaration;
+ boolean openMarker = true;
+ boolean eatSemicolon = true;
+ boolean expectSemicolon = true;
+ while (true) {
+ if (!eatBrackets(builder)) {
+ expectSemicolon = false;
+ }
+
+ if (expect(builder, JavaTokenType.EQ)) {
+ final PsiBuilder.Marker expr = ExpressionParser.parse(builder);
+ if (expr == null) {
+ error(builder, JavaErrorMessages.message("expected.expression"));
+ expectSemicolon = false;
+ break;
+ }
+ }
+
+ if (builder.getTokenType() == JavaTokenType.COMMA) {
+ variable.done(varType);
+ builder.advanceLexer();
+ variable = builder.mark();
+ }
+ else {
+ break;
+ }
+
+ if (!expect(builder, JavaTokenType.IDENTIFIER)) {
+ variable.drop();
+ error(builder, JavaErrorMessages.message("expected.identifier"));
+ openMarker = false;
+ eatSemicolon = false;
+ break;
+ }
+ }
+
+ if (eatSemicolon) {
+ if (!expect(builder, JavaTokenType.SEMICOLON) && expectSemicolon) {
+ error(builder, JavaErrorMessages.message("expected.semicolon"));
+ }
+ // todo: special treatment - see DeclarationParserTest.testMultiLineUnclosed()
+ }
+
+ if (openMarker) {
+ variable.done(varType);
+ }
+
+ return declaration;
+ }
+
+ private static boolean eatBrackets(final PsiBuilder builder) {
+ while (expect(builder, JavaTokenType.LBRACKET)) {
+ if (!expect(builder, JavaTokenType.RBRACKET)) {
+ error(builder, JavaErrorMessages.message("expected.rbracket"));
+ return false;
+ }
+ }
+ return true;
}
@Nullable
@NotNull
private static PsiBuilder.Marker parseAnnotation(final PsiBuilder builder) {
+ assert builder.getTokenType() == JavaTokenType.AT : builder.getTokenType();
final PsiBuilder.Marker anno = builder.mark();
builder.advanceLexer();
@NotNull
private static PsiBuilder.Marker parseAnnotationArrayInitializer(final PsiBuilder builder) {
+ assert builder.getTokenType() == JavaTokenType.LBRACE : builder.getTokenType();
final PsiBuilder.Marker annoArray = builder.mark();
builder.advanceLexer();
*/
package com.intellij.lang.java.parser;
-import com.intellij.lang.PsiBuilder;
-import com.intellij.lang.PsiBuilderUtil;
+import com.intellij.lang.*;
import com.intellij.openapi.util.Key;
import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.JavaTokenType;
import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.tree.TokenSet;
+import com.intellij.util.diff.FlyweightCapableTreeStructure;
+import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
public class JavaParserUtil {
@NotNull
private static LanguageLevel getLanguageLevel(final PsiBuilder builder) {
final LanguageLevel level = builder.getUserData(LANG_LEVEL_KEY);
- assert level != null;
+ assert level != null : builder;
return level;
}
builder.mark().error(message);
}
+ public static void error(final PsiBuilder builder, final String message, @Nullable final PsiBuilder.Marker before) {
+ if (before == null) {
+ error(builder, message);
+ }
+ else {
+ before.precede().errorBefore(message, before);
+ }
+ }
+
public static boolean expectOrError(final PsiBuilder builder, final IElementType expectedType, final String errorMessage) {
if (!PsiBuilderUtil.expect(builder, expectedType)) {
error(builder, errorMessage);
public static void emptyElement(final PsiBuilder builder, final IElementType type) {
builder.mark().done(type);
}
+
+ public static void emptyElement(final PsiBuilder.Marker before, final IElementType type) {
+ before.precede().doneBefore(type, before);
+ }
+
+ public static PsiBuilder braceMatchingBuilder(final PsiBuilder builder) {
+ return new PsiBuilderAdapter(builder) {
+ private int braceCount = 1;
+ private int lastOffset = -1;
+
+ @Override
+ public IElementType getTokenType() {
+ final IElementType tokenType = super.getTokenType();
+ if (getCurrentOffset() != lastOffset) {
+ if (tokenType == JavaTokenType.LBRACE) {
+ braceCount++;
+ }
+ else if (tokenType == JavaTokenType.RBRACE) {
+ braceCount--;
+ }
+ lastOffset = getCurrentOffset();
+ }
+ return (braceCount == 0 ? null : tokenType);
+ }
+ };
+ }
+
+ public static class PsiBuilderAdapter implements PsiBuilder {
+ protected final PsiBuilder myDelegate;
+
+ public PsiBuilderAdapter(final PsiBuilder delegate) {
+ myDelegate = delegate;
+ }
+
+ public CharSequence getOriginalText() {
+ return myDelegate.getOriginalText();
+ }
+
+ public void advanceLexer() {
+ myDelegate.advanceLexer();
+ }
+
+ @Nullable
+ public IElementType getTokenType() {
+ return myDelegate.getTokenType();
+ }
+
+ public void setTokenTypeRemapper(final ITokenTypeRemapper remapper) {
+ myDelegate.setTokenTypeRemapper(remapper);
+ }
+
+ @Nullable @NonNls
+ public String getTokenText() {
+ return myDelegate.getTokenText();
+ }
+
+ public int getCurrentOffset() {
+ return myDelegate.getCurrentOffset();
+ }
+
+ public Marker mark() {
+ return myDelegate.mark();
+ }
+
+ public void error(final String messageText) {
+ myDelegate.error(messageText);
+ }
+
+ public boolean eof() {
+ return myDelegate.eof();
+ }
+
+ public ASTNode getTreeBuilt() {
+ return myDelegate.getTreeBuilt();
+ }
+
+ public FlyweightCapableTreeStructure<LighterASTNode> getLightTree() {
+ return myDelegate.getLightTree();
+ }
+
+ public void setDebugMode(final boolean dbgMode) {
+ myDelegate.setDebugMode(dbgMode);
+ }
+
+ public void enforceCommentTokens(final TokenSet tokens) {
+ myDelegate.enforceCommentTokens(tokens);
+ }
+
+ @Nullable
+ public LighterASTNode getLatestDoneMarker() {
+ return myDelegate.getLatestDoneMarker();
+ }
+
+ @Nullable
+ public <T> T getUserData(@NotNull final Key<T> key) {
+ return myDelegate.getUserData(key);
+ }
+
+ public <T> void putUserData(@NotNull final Key<T> key, @Nullable final T value) {
+ myDelegate.putUserData(key, value);
+ }
+ }
}
return typeInfo != null ? typeInfo.marker : null;
}
+ @Nullable
+ public static PsiBuilder.Marker parseTypeWithEllipsis(final PsiBuilder builder, final boolean eatLastDot, final boolean wildcard) {
+ final TypeInfo typeInfo = parseTypeWithInfo(builder, eatLastDot, wildcard);
+ if (typeInfo == null) return null;
+
+ PsiBuilder.Marker type = typeInfo.marker;
+ if (builder.getTokenType() == JavaTokenType.ELLIPSIS) {
+ type = typeInfo.marker.precede();
+ builder.advanceLexer();
+ type.done(JavaElementType.TYPE);
+ }
+
+ return type;
+ }
+
@Nullable
private static TypeInfo parseTypeWithInfo(final PsiBuilder builder, final boolean eatLastDot, final boolean wildcard) {
if (builder.getTokenType() == null) return null;
return null;
}
- if (expect(builder, JavaTokenType.EXTENDS_KEYWORD)) {
- parseReferenceList(builder, JavaElementType.EXTENDS_BOUND_LIST, JavaTokenType.AND);
- }
- else {
- emptyElement(builder, JavaElementType.EXTENDS_BOUND_LIST);
- }
+ parseReferenceList(builder, JavaTokenType.EXTENDS_KEYWORD, JavaElementType.EXTENDS_BOUND_LIST, JavaTokenType.AND);
param.done(JavaElementType.TYPE_PARAMETER);
return param;
}
@NotNull
- private static PsiBuilder.Marker parseReferenceList(final PsiBuilder builder, final IElementType type, final IElementType delimiter) {
+ public static PsiBuilder.Marker parseReferenceList(final PsiBuilder builder, final IElementType start,
+ final IElementType type, final IElementType delimiter) {
final PsiBuilder.Marker element = builder.mark();
- while (true) {
- final PsiBuilder.Marker classReference = parseJavaCodeReference(builder, true, true, true);
- if (classReference == null) {
- error(builder, JavaErrorMessages.message("expected.identifier"));
- }
- if (!expect(builder, delimiter)) {
- break;
+ if (expect(builder, start)) {
+ while (true) {
+ final PsiBuilder.Marker classReference = parseJavaCodeReference(builder, true, true, true);
+ if (classReference == null) {
+ error(builder, JavaErrorMessages.message("expected.identifier"));
+ }
+ if (!expect(builder, delimiter)) {
+ break;
+ }
}
}
--- /dev/null
+/*
+ * Copyright 2000-2010 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 com.intellij.lang.java.parser;
+
+import com.intellij.lang.PsiBuilder;
+import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.impl.source.tree.JavaElementType;
+import org.jetbrains.annotations.Nullable;
+
+
+public class StatementParser {
+ private StatementParser() { }
+
+ @Nullable
+ public static PsiBuilder.Marker parseCodeBlock(final PsiBuilder builder) {
+ if (builder.getTokenType() != JavaTokenType.LBRACE) return null;
+
+ final PsiBuilder.Marker codeBlock = builder.mark();
+ builder.advanceLexer();
+
+ // temp
+ if (builder.getTokenType() == JavaTokenType.RBRACE) {
+ builder.advanceLexer();
+ codeBlock.done(JavaElementType.CODE_BLOCK);
+ return codeBlock;
+ }
+
+ // todo: implement
+ throw new UnsupportedOperationException(builder.toString());
+ }
+}
aClass.rawAddChildren(invalidElementsGroup);
while (true) {
IElementType tokenType = lexer.getTokenType();
- if (tokenType == JavaTokenType.IDENTIFIER || tokenType == JavaTokenType.COMMA || tokenType == JavaTokenType.EXTENDS_KEYWORD || tokenType ==
- JavaTokenType.IMPLEMENTS_KEYWORD) {
+ if (tokenType == JavaTokenType.IDENTIFIER || tokenType == JavaTokenType.COMMA || tokenType == JavaTokenType.EXTENDS_KEYWORD ||
+ tokenType == JavaTokenType.IMPLEMENTS_KEYWORD) {
invalidElementsGroup.rawAddChildren(ParseUtil.createTokenElement(lexer, myContext.getCharTable()));
}
else {
if (type == null) {
type = ASTFactory.composite(JavaElementType.TYPE);
- param.rawAddChildren(Factory.createErrorElement("Parameter type missing"));
+ param.rawAddChildren(Factory.createErrorElement(JavaErrorMessages.message("expected.type")));
}
param.rawAddChildren(type);
return dummyRoot.getFirstChildNode();
}
+ @Nullable
public TreeElement parseCodeBlock(Lexer lexer, boolean deep) {
if (lexer.getTokenType() != JavaTokenType.LBRACE) return null;
Lexer badLexer = lexer instanceof StoppableLexerAdapter ? ((StoppableLexerAdapter)lexer).getDelegate() : lexer;
List<IElementType> list = new SmartList<IElementType>();
while (true) {
final IElementType type = lexer.getTokenType();
- if (ElementType.PRIMITIVE_TYPE_BIT_SET.contains(type) || type == JavaTokenType.IDENTIFIER || ElementType.MODIFIER_BIT_SET.contains(type) ||
- type == JavaTokenType.LT || type == JavaTokenType.GT || type == JavaTokenType.GTGT || type == JavaTokenType.GTGTGT || type ==
- JavaTokenType.COMMA || type ==
- JavaTokenType.DOT ||
- type == JavaTokenType.EXTENDS_KEYWORD || type == JavaTokenType.IMPLEMENTS_KEYWORD) {
+ if (ElementType.PRIMITIVE_TYPE_BIT_SET.contains(type) || ElementType.MODIFIER_BIT_SET.contains(type) ||
+ type == JavaTokenType.IDENTIFIER || type == JavaTokenType.LT || type == JavaTokenType.GT ||
+ type == JavaTokenType.GTGT || type == JavaTokenType.GTGTGT || type == JavaTokenType.COMMA ||
+ type == JavaTokenType.DOT || type == JavaTokenType.EXTENDS_KEYWORD || type == JavaTokenType.IMPLEMENTS_KEYWORD) {
list.add(type);
lexer.advance();
} else {
IElementType CLASS_OBJECT_ACCESS_EXPRESSION = new IJavaElementType("CLASS_OBJECT_ACCESS_EXPRESSION");
IElementType EMPTY_EXPRESSION = new IJavaElementType("EMPTY_EXPRESSION");
- IElementType EXPRESSION_LIST = new IJavaElementType("EXPRESSION_LIST");
+ IElementType EXPRESSION_LIST = new IJavaElementType("EXPRESSION_LIST", true);
IElementType EMPTY_STATEMENT = new IJavaElementType("EMPTY_STATEMENT");
IElementType BLOCK_STATEMENT = new IJavaElementType("BLOCK_STATEMENT");
PsiExpression qExpression = ((PsiReferenceExpression)expr).getQualifierExpression();
if (qExpression != null) {
if (initializer1 instanceof PsiMethodCallExpression) {
- ((PsiMethodCallExpression)initializer1).getMethodExpression().setQualifierExpression(qExpression);
+ PsiReferenceExpression methodExpression = ((PsiMethodCallExpression)initializer1).getMethodExpression();
+ if (methodExpression.getQualifierExpression() == null) {
+ methodExpression.setQualifierExpression(qExpression);
+ }
} else if (initializer1 instanceof PsiReferenceExpression) {
- ((PsiReferenceExpression)initializer1).setQualifierExpression(qExpression);
+ PsiReferenceExpression referenceExpression = (PsiReferenceExpression)initializer1;
+ if (referenceExpression.getQualifierExpression() == null) {
+ referenceExpression.setQualifierExpression(qExpression);
+ }
}
}
}
else if (!isSameConstant(argument, refConstantInitializer.get())) {
return false;
}
- }
- else {
+ } else if (!isRecursiveReferencedParameter(argument, psiParameter)) {
if (!refConstantInitializer.isNull()) return false;
refInitializer.set(argument);
refMethodCall.set(methodCall);
return null;
}
+ private static boolean isRecursiveReferencedParameter(final PsiExpression argument, final PsiParameter param) {
+ if (argument instanceof PsiReferenceExpression) {
+ final PsiElement element = ((PsiReferenceExpression)argument).resolve();
+ if (element instanceof PsiParameter) {
+ return element.equals(param);
+ }
+ }
+ return false;
+ }
+
private static boolean isSameConstant(final PsiExpression expr1, final PsiExpression expr2) {
boolean expr1Null = InlineToAnonymousConstructorProcessor.ourNullPattern.accepts(expr1);
boolean expr2Null = InlineToAnonymousConstructorProcessor.ourNullPattern.accepts(expr2);
package com.intellij.refactoring.inlineSuperClass.usageInfo;
import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiJavaCodeReferenceElement;
-import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteExtendsClassUsageInfo;
import com.intellij.refactoring.util.FixableUsageInfo;
import com.intellij.util.IncorrectOperationException;
public class ReplaceExtendsListUsageInfo extends FixableUsageInfo {
- private final SafeDeleteExtendsClassUsageInfo mySafeDeleteUsageInfo;
public ReplaceExtendsListUsageInfo(PsiJavaCodeReferenceElement element, final PsiClass superClass, final PsiClass targetClass) {
super(element);
- mySafeDeleteUsageInfo = new SafeDeleteExtendsClassUsageInfo(element, superClass, targetClass);
+
}
public void fixUsage() throws IncorrectOperationException {
- if (mySafeDeleteUsageInfo.isSafeDelete()) {
- mySafeDeleteUsageInfo.deleteElement();
+ final PsiElement element = getElement();
+ if (element != null) {
+ element.delete();
}
}
}
return tempExpr;
}
- public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, final int startOffset, final int endOffset) {
+ public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, int startOffset, int endOffset) {
- final PsiElement elementAtStart = file.findElementAt(startOffset);
- if (elementAtStart == null) return null;
- final PsiElement elementAtEnd = file.findElementAt(endOffset - 1);
- if (elementAtEnd == null) return null;
+ PsiElement elementAtStart = file.findElementAt(startOffset);
+ if (elementAtStart == null || elementAtStart instanceof PsiWhiteSpace || elementAtStart instanceof PsiComment) {
+ elementAtStart = PsiTreeUtil.skipSiblingsForward(elementAtStart, PsiWhiteSpace.class, PsiComment.class);
+ if (elementAtStart == null) return null;
+ startOffset = elementAtStart.getTextOffset();
+ }
+ PsiElement elementAtEnd = file.findElementAt(endOffset - 1);
+ if (elementAtEnd == null || elementAtEnd instanceof PsiWhiteSpace || elementAtEnd instanceof PsiComment) {
+ elementAtEnd = PsiTreeUtil.skipSiblingsBackward(elementAtEnd, PsiWhiteSpace.class, PsiComment.class);
+ if (elementAtEnd == null) return null;
+ endOffset = elementAtEnd.getTextRange().getEndOffset();
+ }
PsiExpression tempExpr;
PsiElement elementAt = PsiTreeUtil.findCommonParent(elementAtStart, elementAtEnd);
tempExpr.putUserData(ElementToWorkOn.PARENT, parent);
}
else {
- PsiErrorElement errorElement = PsiTreeUtil.getNextSiblingOfType(elementAtStart, PsiErrorElement.class);
+ PsiErrorElement errorElement = elementAtStart instanceof PsiErrorElement
+ ? (PsiErrorElement)elementAtStart
+ : PsiTreeUtil.getNextSiblingOfType(elementAtStart, PsiErrorElement.class);
if (errorElement == null) {
errorElement = PsiTreeUtil.getParentOfType(elementAtStart, PsiErrorElement.class);
}
break;
}
}
- if (!anyOverridingRefs && isMultipleInterfacesImplementation(overridingMethod, allElementsToDelete)) {
+ if (!anyOverridingRefs && isMultipleInterfacesImplementation(overridingMethod, originalMethod, allElementsToDelete)) {
anyOverridingRefs = true;
multipleInterfaceImplementations.add(overridingMethod);
}
return validOverriding;
}
- private static boolean isMultipleInterfacesImplementation(final PsiMethod method, final PsiElement[] allElementsToDelete) {
+ private static boolean isMultipleInterfacesImplementation(final PsiMethod method,
+ PsiMethod originalMethod,
+ final PsiElement[] allElementsToDelete) {
final PsiMethod[] methods = method.findSuperMethods();
for(PsiMethod superMethod: methods) {
- if (ArrayUtil.find(allElementsToDelete, superMethod) < 0) {
+ if (ArrayUtil.find(allElementsToDelete, superMethod) < 0 && !MethodSignatureUtil.isSuperMethod(originalMethod, superMethod)) {
return true;
}
}
--- /dev/null
+// "Create Getter" "true"
+public class Test {
+ Integer field;
+ public foo() {
+ getField();
+ }
+
+ public Integer getField() {
+ return field;
+ }
+}
--- /dev/null
+// "Create Getter" "true"
+public class Test {
+ Integer field;
+ public foo() {
+ get<caret>Field();
+ }
+}
--- /dev/null
+PsiJavaFile:CompletionHack0.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:s
+ PsiModifierList:
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:X
+ PsiIdentifier:X('X')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiErrorElement:Unexpected identifier
+ PsiIdentifier:IntelliJIdeaRulezz('IntelliJIdeaRulezz')
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace('\n ')
+ PsiTypeElement:String
+ PsiJavaCodeReferenceElement:String
+ PsiIdentifier:String('String')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:s('s')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiWhiteSpace(' ')
+ PsiLiteralExpression:""
+ PsiJavaToken:STRING_LITERAL('""')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:CompletionHack1.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:s
+ PsiModifierList:
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:X
+ PsiIdentifier:X('X')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiErrorElement:'>' expected.
+ <empty list>
+ PsiWhiteSpace('\n ')
+ PsiTypeElement:String
+ PsiJavaCodeReferenceElement:String
+ PsiIdentifier:String('String')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:s('s')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiWhiteSpace(' ')
+ PsiLiteralExpression:""
+ PsiJavaToken:STRING_LITERAL('""')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EmptyBody0.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:EmptyBody1.java
+ PsiJavaToken:LBRACE('{')
+ PsiErrorElement:'}' expected
+ <empty list>
+ PsiWhiteSpace(' ')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EnumBody0.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:EnumBody1.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:RED
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:RED('RED')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:GREEN
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:GREEN('GREEN')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:BLUE
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:BLUE('BLUE')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EnumBody2.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:RED
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:RED('RED')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:GREEN
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:GREEN('GREEN')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:BLUE
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:BLUE('BLUE')
+ PsiExpressionList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EnumBody3.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:RED
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:RED('RED')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:GREEN
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:GREEN('GREEN')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:BLUE
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:BLUE('BLUE')
+ PsiExpressionList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EnumBody4.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:RED
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:RED('RED')
+ PsiExpressionList
+ PsiJavaToken:LPARENTH('(')
+ PsiLiteralExpression:0
+ PsiJavaToken:INTEGER_LITERAL('0')
+ PsiJavaToken:RPARENTH(')')
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:GREEN
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:GREEN('GREEN')
+ PsiExpressionList
+ PsiJavaToken:LPARENTH('(')
+ PsiLiteralExpression:1
+ PsiJavaToken:INTEGER_LITERAL('1')
+ PsiJavaToken:RPARENTH(')')
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:BLUE
+ PsiModifierList:
+ <empty list>
+ PsiIdentifier:BLUE('BLUE')
+ PsiExpressionList
+ PsiJavaToken:LPARENTH('(')
+ PsiLiteralExpression:2
+ PsiJavaToken:INTEGER_LITERAL('2')
+ PsiJavaToken:RPARENTH(')')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:EnumBody5.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiEnumConstant:A
+ PsiModifierList:@ANNOTATION
+ PsiAnnotation
+ PsiJavaToken:AT('@')
+ PsiJavaCodeReferenceElement:ANNOTATION
+ PsiIdentifier:ANNOTATION('ANNOTATION')
+ PsiReferenceParameterList
+ <empty list>
+ PsiAnnotationParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:A('A')
+ PsiExpressionList
+ PsiJavaToken:LPARENTH('(')
+ PsiLiteralExpression:10
+ PsiJavaToken:INTEGER_LITERAL('10')
+ PsiJavaToken:RPARENTH(')')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Errors.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiModifierList:public static
+ PsiKeyword:public('public')
+ PsiWhiteSpace(' ')
+ PsiKeyword:static('static')
+ PsiWhiteSpace(' ')
+ PsiErrorElement:Unexpected token
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:error
+ PsiIdentifier:error('error')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiErrorElement:'>' expected.
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiTypeElement:descr
+ PsiJavaCodeReferenceElement:descr
+ PsiIdentifier:descr('descr')
+ PsiReferenceParameterList
+ <empty list>
+ PsiErrorElement:Identifier expected
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiJavaToken:EQ('=')
+ PsiJavaToken:STRING_LITERAL('"2"')
+ PsiJavaToken:GT('>')
+ PsiField:f1
+ PsiModifierList:protected
+ PsiKeyword:protected('protected')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f1('f1')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiWhiteSpace(' ')
+ PsiLiteralExpression:0
+ PsiJavaToken:INTEGER_LITERAL('0')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:FieldMulti.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field1
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field1('field1')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiWhiteSpace(' ')
+ PsiLiteralExpression:0
+ PsiJavaToken:INTEGER_LITERAL('0')
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiField:field2
+ PsiIdentifier:field2('field2')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:FieldSimple.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiWhiteSpace(' ')
+ PsiLiteralExpression:0
+ PsiJavaToken:INTEGER_LITERAL('0')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:GenericMethod.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:test
+ PsiModifierList:public static
+ PsiKeyword:public('public')
+ PsiWhiteSpace(' ')
+ PsiKeyword:static('static')
+ PsiWhiteSpace(' ')
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:E
+ PsiIdentifier:E('E')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:test('test')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace('\n ')
+ PsiMethod:test1
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:E
+ PsiIdentifier:E('E')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:test1('test1')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace('\n ')
+ PsiMethod:test2
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:E1
+ PsiIdentifier:E1('E1')
+ PsiWhiteSpace(' ')
+ PsiElement(EXTENDS_BOUND_LIST)
+ PsiKeyword:extends('extends')
+ PsiWhiteSpace(' ')
+ PsiJavaCodeReferenceElement:Integer
+ PsiIdentifier:Integer('Integer')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiWhiteSpace(' ')
+ PsiTypeParameter:E2
+ PsiIdentifier:E2('E2')
+ PsiWhiteSpace(' ')
+ PsiElement(EXTENDS_BOUND_LIST)
+ PsiKeyword:extends('extends')
+ PsiWhiteSpace(' ')
+ PsiJavaCodeReferenceElement:Runnable
+ PsiIdentifier:Runnable('Runnable')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:String
+ PsiJavaCodeReferenceElement:String
+ PsiIdentifier:String('String')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:test2('test2')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:GenericMethodErrors.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiModifierList:
+ <empty list>
+ PsiErrorElement:Unexpected token
+ PsiTypeParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeParameter:Error
+ PsiIdentifier:Error('Error')
+ PsiElement(EXTENDS_BOUND_LIST)
+ <empty list>
+ PsiErrorElement:'>' expected.
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiTypeElement:sss
+ PsiJavaCodeReferenceElement:sss
+ PsiIdentifier:sss('sss')
+ PsiReferenceParameterList
+ <empty list>
+ PsiErrorElement:Identifier expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiErrorElement:Unexpected token
+ PsiJavaToken:DIV('/')
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiJavaCodeReferenceElement:test <error>
+ PsiIdentifier:test('test')
+ PsiWhiteSpace(' ')
+ PsiReferenceParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeElement:error
+ PsiJavaCodeReferenceElement:error
+ PsiIdentifier:error('error')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:MethodNormal0.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiCodeBlock
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:MethodNormal1.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:MissingInitializer.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:EQ('=')
+ PsiErrorElement:Expression expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:MissingInitializerExpression.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiJavaToken:EQ('=')
+ PsiErrorElement:Expression expected
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:MultiLineUnclosed.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiErrorElement:Identifier expected
+ <empty list>
+ PsiWhiteSpace(' \n ')
+ PsiField:o
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:Object
+ PsiJavaCodeReferenceElement:Object
+ PsiIdentifier:Object('Object')
+ PsiReferenceParameterList
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiIdentifier:o('o')
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Unclosed0.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiErrorElement:'{' or ';' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:Unclosed1.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:(
+ PsiJavaToken:LPARENTH('(')
+ PsiErrorElement:')' expected
+ <empty list>
+ PsiReferenceList
+ <empty list>
+ PsiErrorElement:'{' or ';' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Unclosed2.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiErrorElement:'{' or ';' expected
+ <empty list>
+ PsiWhiteSpace('\n ')
+ PsiMethod:g
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:g('g')
+ PsiParameterList:()
+ PsiJavaToken:LPARENTH('(')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:Unclosed3.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:(int a
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:a
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:a('a')
+ PsiErrorElement:')' expected
+ <empty list>
+ PsiReferenceList
+ <empty list>
+ PsiErrorElement:'{' or ';' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Unclosed4.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:(int a,,
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:a
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:a('a')
+ PsiJavaToken:COMMA(',')
+ PsiErrorElement:Parameter expected
+ <empty list>
+ PsiJavaToken:COMMA(',')
+ PsiErrorElement:Identifier or type expected
+ <empty list>
+ PsiReferenceList
+ <empty list>
+ PsiErrorElement:'{' or ';' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Unclosed5.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:f
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:void
+ PsiKeyword:void('void')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:f('f')
+ PsiParameterList:(int a,)
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:a
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:a('a')
+ PsiJavaToken:COMMA(',')
+ PsiErrorElement:Identifier or type expected
+ <empty list>
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:UnclosedBracket.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiJavaToken:LBRACKET('[')
+ PsiErrorElement:']' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:UnclosedComma.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiJavaToken:COMMA(',')
+ PsiErrorElement:Identifier expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:UnclosedSemicolon.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiField:field
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:int
+ PsiKeyword:int('int')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:field('field')
+ PsiErrorElement:';' expected
+ <empty list>
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
--- /dev/null
+PsiJavaFile:WildcardParsing.java
+ PsiJavaToken:LBRACE('{')
+ PsiWhiteSpace(' ')
+ PsiMethod:x
+ PsiModifierList:
+ <empty list>
+ PsiTypeParameterList
+ <empty list>
+ PsiTypeElement:List<? extends B>
+ PsiJavaCodeReferenceElement:List<? extends B>
+ PsiIdentifier:List('List')
+ PsiReferenceParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeElement:? extends B
+ PsiJavaToken:QUEST('?')
+ PsiWhiteSpace(' ')
+ PsiKeyword:extends('extends')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:B
+ PsiJavaCodeReferenceElement:B
+ PsiIdentifier:B('B')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:x('x')
+ PsiParameterList:(Collection<? super B> x)
+ PsiJavaToken:LPARENTH('(')
+ PsiParameter:x
+ PsiModifierList:
+ <empty list>
+ PsiTypeElement:Collection<? super B>
+ PsiJavaCodeReferenceElement:Collection<? super B>
+ PsiIdentifier:Collection('Collection')
+ PsiReferenceParameterList
+ PsiJavaToken:LT('<')
+ PsiTypeElement:? super B
+ PsiJavaToken:QUEST('?')
+ PsiWhiteSpace(' ')
+ PsiKeyword:super('super')
+ PsiWhiteSpace(' ')
+ PsiTypeElement:B
+ PsiJavaCodeReferenceElement:B
+ PsiIdentifier:B('B')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:GT('>')
+ PsiWhiteSpace(' ')
+ PsiIdentifier:x('x')
+ PsiJavaToken:RPARENTH(')')
+ PsiReferenceList
+ <empty list>
+ PsiJavaToken:SEMICOLON(';')
+ PsiWhiteSpace(' ')
+ PsiJavaToken:RBRACE('}')
\ No newline at end of file
--- /dev/null
+PsiJavaFile:Type5.java
+ PsiTypeElement:Object[]...
+ PsiTypeElement:Object[]
+ PsiTypeElement:Object
+ PsiJavaCodeReferenceElement:Object
+ PsiIdentifier:Object('Object')
+ PsiReferenceParameterList
+ <empty list>
+ PsiJavaToken:LBRACKET('[')
+ PsiJavaToken:RBRACKET(']')
+ PsiJavaToken:ELLIPSIS('...')
\ No newline at end of file
PsiTypeParameter:T
PsiIdentifier:T('T')
PsiWhiteSpace(' ')
- PsiKeyword:extends('extends')
- PsiWhiteSpace(' ')
PsiElement(EXTENDS_BOUND_LIST)
+ PsiKeyword:extends('extends')
+ PsiWhiteSpace(' ')
PsiJavaCodeReferenceElement:X
PsiIdentifier:X('X')
PsiReferenceParameterList
PsiTypeParameter:T
PsiIdentifier:T('T')
PsiWhiteSpace(' ')
- PsiKeyword:extends('extends')
- PsiWhiteSpace(' ')
PsiElement(EXTENDS_BOUND_LIST)
+ PsiKeyword:extends('extends')
+ PsiWhiteSpace(' ')
PsiJavaCodeReferenceElement:X
PsiIdentifier:X('X')
PsiReferenceParameterList
--- /dev/null
+class QTest {
+ final int myI = Source.CONST;
+ public static void main(String[] args) {
+ System.out.println(new QTest().my<caret>I);
+ }
+}
+
+class Source {
+ int CONST = 0;
+}
\ No newline at end of file
--- /dev/null
+class QTest {
+ public static void main(String[] args) {
+ System.out.println(Source.CONST);
+ }
+}
+
+class Source {
+ int CONST = 0;
+}
\ No newline at end of file
--- /dev/null
+import java.lang.Integer;
+import java.util.*;
+import java.util.ArrayList;
+
+public class ExpData {
+ private final List<Integer> myResult = new ArrayList<Integer>();
+ {
+ m(10, myResult);
+ }
+
+ private void m(int i, List<Integer> re<caret>sult) {
+ if (i > 0) {
+ m(i - 1, result);
+ }
+ result.add(i);
+ m(2, new ArrayList<Integer>());
+ }
+}
--- /dev/null
+import java.util.*;
+
+public class ExpData {
+ private final List<Integer> myResult = new ArrayList<Integer>();
+ {
+ m(10, myResult);
+ }
+
+ private void m(int i, List<Integer> re<caret>sult) {
+ if (i > 0) {
+ m(i - 1, result);
+ }
+ result.add(i);
+ }
+}
--- /dev/null
+import java.util.*;
+
+public class ExpData {
+ private final List<Integer> myResult = new ArrayList<Integer>();
+ {
+ m(10);
+ }
+
+ private void m(int i) {
+ if (i > 0) {
+ m(i - 1);
+ }
+ myResult.add(i);
+ }
+}
--- /dev/null
+interface ISuper {}
\ No newline at end of file
--- /dev/null
+class Test implements ISuper {}
\ No newline at end of file
--- /dev/null
+class Test1 implements ISuper {
+}
\ No newline at end of file
--- /dev/null
+interface ISuper {}
\ No newline at end of file
--- /dev/null
+public interface Super extends ISuper{}
--- /dev/null
+class Test implements Super {}
\ No newline at end of file
--- /dev/null
+class Test1 implements Super{
+}
\ No newline at end of file
--- /dev/null
+class A {
+ public void test(boolean a, boolean b) {
+ final boolean ab = a &&
+ b;
+ if (true && ab
+//some comment
+
+ );
+ }
+}
\ No newline at end of file
--- /dev/null
+class A {
+ public void test(boolean a, boolean b) {
+ if (true && <selection>a &&
+ b
+//some comment
+</selection>
+ );
+ }
+}
\ No newline at end of file
--- /dev/null
+public class Super {
+
+}
+
+class Child extends Super {
+ }
+
+class ChildChild extends Child {
+ }
\ No newline at end of file
--- /dev/null
+public class Super {
+ void f<caret>oo() {
+ }
+
+}
+
+class Child extends Super {
+ void foo(){
+ super.foo();
+ System.out.println("do some staff");
+ }
+}
+
+class ChildChild extends Child {
+ void foo(){
+ super.foo();
+ System.out.println("here do smth else");
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2000-2010 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 com.intellij.lang.java.parser.partial;
+
+import com.intellij.lang.PsiBuilder;
+import com.intellij.lang.java.parser.DeclarationParser;
+import com.intellij.lang.java.parser.JavaParsingTestCase;
+
+
+public class DeclarationParserTest extends JavaParsingTestCase {
+ public DeclarationParserTest() {
+ super("parser-partial/declarations");
+ }
+
+ public void testEmptyBody0() { doParserTest("{ }", false, false); }
+ public void testEmptyBody1() { doParserTest("{ ", false, false); }
+
+ public void testEnumBody0() { doParserTest("{ ; }", false, true); }
+ public void testEnumBody1() { doParserTest("{ RED, GREEN, BLUE; }", false, true); }
+ public void testEnumBody2() { doParserTest("{ RED, GREEN, BLUE }", false, true); }
+ public void testEnumBody3() { doParserTest("{ RED, GREEN, BLUE, }", false, true); }
+ public void testEnumBody4() { doParserTest("{ RED(0), GREEN(1), BLUE(2); }", false, true); }
+ public void testEnumBody5() { doParserTest("{ @ANNOTATION A(10) }", false, true); }
+
+ public void testFieldSimple() { doParserTest("{ int field = 0; }", false, false); }
+ public void testFieldMulti() { doParserTest("{ int field1 = 0, field2; }", false, false); }
+ public void testUnclosedBracket() { doParserTest("{ int field[ }", false, false); }
+ public void testMissingInitializer() { doParserTest("{ int field = }", false, false); }
+ public void testUnclosedComma() { doParserTest("{ int field, }", false, false); }
+ public void testUnclosedSemicolon() { doParserTest("{ int field }", false, false); }
+ public void testMissingInitializerExpression() { doParserTest("{ int field=; }", false, false); }
+ //public void testMultiLineUnclosed() { doParserTest("{ int \n Object o; }", false, false); } // todo: implement
+
+ //public void testMethodNormal0() { doParserTest("{ void f() { } }", false, false); } // todo: parse code block correctly
+ public void testMethodNormal1() { doParserTest("{ void f(); }", false, false); }
+ public void testUnclosed0() { doParserTest("{ void f() }", false, false); }
+ public void testUnclosed1() { doParserTest("{ void f( }", false, false); }
+ public void testUnclosed2() { doParserTest("{ void f()\n void g(); }", false, false); }
+ public void testUnclosed3() { doParserTest("{ void f(int a }", false, false); }
+ public void testUnclosed4() { doParserTest("{ void f(int a,, }", false, false); }
+ public void testUnclosed5() { doParserTest("{ void f(int a,); }", false, false); }
+ public void testGenericMethod() { doParserTest("{ public static <E> test();\n" +
+ " <E> void test1();\n" +
+ " <E1 extends Integer, E2 extends Runnable> String test2(); }", false, false); }
+ public void testGenericMethodErrors() { doParserTest("{ <Error sss /> test <error>(); }", false, false); }
+ public void testErrors() { doParserTest("{ public static <error descr=\"2\">protected int f1 = 0; }", false, false); }
+ public void testCompletionHack0() { doParserTest("{ <X IntelliJIdeaRulezz>\n String s = \"\"; }", false, false); }
+ public void testCompletionHack1() { doParserTest("{ <X\n String s = \"\"; }", false, false); }
+ public void testWildcardParsing() { doParserTest("{ List<? extends B> x(Collection<? super B> x); }", false, false); }
+
+ private void doParserTest(final String text, final boolean isAnnotation, final boolean isEnum) {
+ doParserTest(text, new Parser() {
+ public void parse(final PsiBuilder builder) {
+ DeclarationParser.parseClassBodyWithBraces(builder, isAnnotation, isEnum);
+ }
+ });
+ }
+}
public void testType2() { doTypeParserTest("int[]", false); }
public void testType3() { doTypeParserTest("int[][", false); }
public void testType4() { doTypeParserTest("Map<String,List<String>>", false); }
+ public void testType5() { doTypeParserTest("Object[]...", false); }
public void testTypeParams0() { doTypeParamsParserTest("<T>"); }
public void testTypeParams1() { doTypeParamsParserTest("<T, U>"); }
private void doTypeParserTest(final String text, final boolean incomplete) {
doParserTest(text, new Parser() {
public void parse(final PsiBuilder builder) {
- ReferenceParser.parseType(builder, incomplete, false);
+ ReferenceParser.parseTypeWithEllipsis(builder, incomplete, false);
}
});
}
doTestMultipleSubclasses();
}
+ public void testMultipleSubclassesInheritsOneBaseBase() throws Exception {
+ doTestMultipleSubclasses();
+ }
+
private void doTestMultipleSubclasses() throws Exception {
doTest(new PerformAction() {
public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) throws Exception {
public void testAndAndSubexpression() throws Exception {
doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
}
+
+ public void testSubexpressionWithSpacesInSelection() throws Exception {
+ doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
+ }
public void testDuplicatesAnonymousClassCreationWithSimilarParameters () throws Exception {
doTest(new MockIntroduceVariableHandler("foo1", true, true, false, "Foo"));
doTest("Super");
}
+ public void testMethodDeepHierarchy() throws Exception {
+ myDoCompare = false;
+ doTest("Super");
+ }
+
public void testLocalVariableSideEffect() throws Exception {
myDoCompare = false;
try {
doTest();
}
+ public void testQualifiedConstantExpressionReplacedWithAnotherOne() throws Exception {
+ doTest();
+ }
+
@Override
protected Sdk getProjectJDK() {
return JavaSdkImpl.getMockJdk17("java 1.5");
doTest(false);
}
+ public void testInlineRecursive() throws Exception {
+ doTest(false);
+ }
+
+ public void testCantInlineRecursive() throws Exception {
+ try {
+ doTest(false);
+ }
+ catch (CommonRefactoringUtil.RefactoringErrorHintException e) {
+ assertEquals("Cannot find constant initializer for parameter", e.getMessage());
+ return;
+ }
+ fail("Initializer shoul not be found");
+ }
+
public void testParameterDefWithWriteAccess() throws Exception {
try {
doTest(false);
"<orderEntry type=\"module-library\">" +
"<library>" +
"<CLASSES><root url=\"file://$MODULE_DIR$/unnamedLibClasses\" /></CLASSES>" +
+ "<JAVADOC />" +
+ "<SOURCES />" +
"</library>" +
"</orderEntry>" +
"<orderEntry type=\"module-library\">" +
"<library name=\"namedLibrary\">" +
"<CLASSES><root url=\"file://$MODULE_DIR$/namedLibClasses\" /></CLASSES>" +
+ "<JAVADOC />" +
+ "<SOURCES />" +
"</library>" +
"</orderEntry>" +
"</root>", module);
final Element element = new Element("root");
library.writeExternal(element);
- assertEquals("<root><library name=\"library\"><CLASSES><root url=\"file://x.jar\" /></CLASSES><SOURCES><root url=\"file://x-src.jar\" /></SOURCES></library></root>",
+ assertEquals("<root><library name=\"library\"><CLASSES><root url=\"file://x.jar\" /></CLASSES><JAVADOC /><SOURCES><root url=\"file://x-src.jar\" /></SOURCES></library></root>",
new XMLOutputter().outputString(element));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
package com.intellij.lang.jsp;
-import com.intellij.lang.Language;
-import org.jetbrains.annotations.NotNull;
-
import java.util.Set;
/**
* @author ik
*/
public interface JspFileViewProvider extends JspxFileViewProvider {
- @NotNull
- Language getTemplateDataLanguage();
Set<String> getKnownTaglibPrefixes();
}
XmlTag[] getDirectiveTags(JspDirectiveKind directiveKind, final boolean searchInIncludes);
XmlTag createDirective(XmlTag context, JspDirectiveKind directiveKind);
+ /**
+ * Method with a bad name. Returns file corresponding to getTemplateDataLanguage() method of ViewProvider
+ * @see com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider#getTemplateDataLanguage()
+ */
PsiFile getBaseLanguageRoot();
/**
* @return file which the errorPage directive references,
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.problems.WolfTheProblemSolver;
import com.intellij.psi.*;
import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.regex.Pattern;
-public class PatternPackageSet implements PackageSet {
+public class PatternPackageSet implements PatternBasedPackageSet {
@NonNls public static final String SCOPE_TEST = "test";
@NonNls public static final String SCOPE_SOURCE = "src";
@NonNls public static final String SCOPE_LIBRARY = "lib";
return buf.toString();
}
+ @Override
+ public String getModulePattern() {
+ return myModulePatternText;
+ }
+
+ @Override
+ public boolean isOn(String oldQName) {
+ return Comparing.strEqual(oldQName, myAspectJSyntaxPattern) || //class qname
+ Comparing.strEqual(oldQName + "..*", myAspectJSyntaxPattern) || //package req
+ Comparing.strEqual(oldQName + ".*", myAspectJSyntaxPattern); //package
+ }
+
+ @Override
+ public String getPattern() {
+ return myAspectJSyntaxPattern;
+ }
}
\ No newline at end of file
*/
void replaceRange(TextRange rangeWithinElement, String replacementText);
+ /**
+ * Creates a replacement box for the specified text range within the container element.
+ * @param rangeWithinElement range within the container element.
+ * @param expression the replacement expression.
+ */
+ public void replaceRange(TextRange rangeWithinElement, Expression expression);
+
/**
* Shows the live template and initiates editing process.
*/
return null;
}
+ public RefactoringActionHandler getExtractInterfaceHandler() {
+ return null;
+ }
+
public RefactoringActionHandler getExtractModuleHandler() {
return null;
}
*/
@Nullable RefactoringActionHandler getPushDownHandler();
+ /**
+ * @return handler for extracting members to an interface in this language
+ * @see com.intellij.refactoring.RefactoringActionHandler
+ */
+ @Nullable RefactoringActionHandler getExtractInterfaceHandler();
+
/**
* @return handler for extracting members to some module in this language
* @see com.intellij.refactoring.RefactoringActionHandler
public int getNodePriority() {
return 1;
}
+
+ public PackageSet getComplementarySet() {
+ return myComplementarySet;
+ }
}
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import java.util.regex.Pattern;
-public class FilePatternPackageSet implements PackageSet {
+public class FilePatternPackageSet implements PatternBasedPackageSet {
public static final @NonNls String SCOPE_FILE = "file";
private Pattern myModulePattern;
private Pattern myModuleGroupPattern;
return buf.toString();
}
+ @Override
+ public String getPattern() {
+ return myPathPattern;
+ }
+
+ @Override
+ public String getModulePattern() {
+ return myModulePatternText;
+ }
+
+ @Override
+ public boolean isOn(String oldQName) {
+ return Comparing.strEqual(myPathPattern, oldQName);
+ }
+
public static String getRelativePath(final VirtualFile virtualFile, final ProjectFileIndex index, final boolean useFQName) {
final Module module = index.getModuleForFile(virtualFile);
if (module != null) {
return buf.toString();
}
+
+ public PackageSet getFirstSet() {
+ return myFirstSet;
+ }
+
+ public PackageSet getSecondSet() {
+ return mySecondSet;
+ }
}
--- /dev/null
+/*
+ * Copyright 2000-2010 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 com.intellij.psi.search.scope.packageSet;
+
+/**
+ * User: anna
+ * Date: Jul 26, 2010
+ */
+public interface PatternBasedPackageSet extends PackageSet{
+ String getPattern();
+ String getModulePattern();
+
+ boolean isOn(String oldQName);
+}
public String getText() {
return myFirstSet.getText() + "||" + mySecondSet.getText();
}
+
+ public PackageSet getFirstSet() {
+ return myFirstSet;
+ }
+
+ public PackageSet getSecondSet() {
+ return mySecondSet;
+ }
}
\ No newline at end of file
public interface TemplateLanguageFileViewProvider extends FileViewProvider {
/**
+ * e.g. JSP
* @return instanceof {@link com.intellij.psi.templateLanguages.TemplateLanguage}
*/
@NotNull
Language getBaseLanguage();
/**
+ * e.g. HTML for JSP files
* @return not instanceof {@link com.intellij.lang.DependentLanguage}
*/
@NotNull
}
@Nullable public static <T extends PsiElement> T findChildOfType(@NotNull final PsiElement element, @NotNull final Class<T> aClass, final boolean strict) {
+ return findChildOfAnyType(element, strict, aClass);
+ }
+
+ @Nullable public static <T extends PsiElement> T findChildOfAnyType(@NotNull final PsiElement element, @NotNull final Class<T>... classes) {
+ return findChildOfAnyType(element, true, classes);
+ }
+
+ @Nullable public static <T extends PsiElement> T findChildOfAnyType(@NotNull final PsiElement element, final boolean strict, @NotNull final Class<T>... classes) {
PsiElementProcessor.FindElement<PsiElement> processor = new PsiElementProcessor.FindElement<PsiElement>() {
@Override
public boolean execute(PsiElement each) {
if (strict && each == element) return true;
- if (instanceOf(aClass, each)) {
- return setFound(each);
+ for (Class<T> eachClass : classes) {
+ if (instanceOf(eachClass, each)) {
+ return setFound(each);
+ }
}
return true;
}
ExtensionPointName<NameSuggestionProvider> EP_NAME = ExtensionPointName.create("com.intellij.nameSuggestionProvider");
@Nullable
- SuggestedNameInfo getSuggestedNames(PsiElement element, PsiElement nameSuggestionContext, Set<String> result);
+ SuggestedNameInfo getSuggestedNames(PsiElement element, @Nullable PsiElement nameSuggestionContext, Set<String> result);
@Nullable
- Collection<LookupElement> completeName(PsiElement element, final PsiElement nameSuggestionContext, final String prefix);
+ Collection<LookupElement> completeName(PsiElement element, @Nullable final PsiElement nameSuggestionContext, final String prefix);
}
myElements.add(key);
}
+ public void replaceRange(TextRange rangeWithinElement, Expression expression) {
+ final RangeMarker key = myDocument.createRangeMarker(rangeWithinElement);
+ myExpressions.put(key, expression);
+ myElements.add(key);
+ }
+
/**
* Adds end variable after the specified element
*/
import com.intellij.openapi.editor.actions.EditorActionUtil;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.event.*;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.RangeHighlighterEx;
myEditorDocument = editorFactory.createDocument("");
setLanguage(language);
myConsoleEditor = (EditorEx)editorFactory.createEditor(myEditorDocument, myProject);
+ myConsoleEditor.setBackgroundColor(myConsoleEditor.getColorsScheme().getColor(ConsoleViewContentType.CONSOLE_BACKGROUND_KEY));
myCurrentEditor = myConsoleEditor;
myHistoryViewer = (EditorEx)editorFactory.createViewer(((EditorFactoryImpl)editorFactory).createDocument(true), myProject);
+ myHistoryViewer.setBackgroundColor(myHistoryViewer.getColorsScheme().getColor(ConsoleViewContentType.CONSOLE_BACKGROUND_KEY));
myPanel.add(myHistoryViewer.getComponent(), BorderLayout.NORTH);
myPanel.add(myConsoleEditor.getComponent(), BorderLayout.CENTER);
setupComponents();
batch(new Progressive() {
public void run(@NotNull ProgressIndicator indicator) {
final Ref<Object> target = new Ref<Object>();
- _select(value, finalVFile, false, Conditions.<AbstractTreeNode>alwaysTrue(), cb, indicator, target, focusRequestor);
+ _select(value, finalVFile, false, Conditions.<AbstractTreeNode>alwaysTrue(), cb, indicator, target, focusRequestor, false);
cb.doWhenDone(new Runnable() {
public void run() {
result.setDone(target.get());
public void run() {
batch(new Progressive() {
public void run(@NotNull ProgressIndicator indicator) {
- _select(element, file, requestFocus, nonStopCondition, result, indicator, null, requestor);
+ _select(element, file, requestFocus, nonStopCondition, result, indicator, null, requestor, false);
}
});
}
}
private void _select(Object element,
- VirtualFile file,
+ final VirtualFile file,
final boolean requestFocus,
final Condition<AbstractTreeNode> nonStopCondition,
final ActionCallback result,
- ProgressIndicator indicator,
+ final ProgressIndicator indicator,
@Nullable final Ref<Object> virtualSelectTarget,
- final FocusRequestor focusRequestor) {
+ final FocusRequestor focusRequestor,
+ final boolean isSecondAttempt) {
AbstractTreeNode alreadySelected = alreadySelectedNode(element);
final Runnable onDone = new Runnable() {
onDone.run();
}
}
- }).notifyWhenRejected(result);
+ }).doWhenRejected(new Runnable() {
+ @Override
+ public void run() {
+ if (isSecondAttempt) {
+ result.setRejected();
+ } else {
+ _select(file, file, requestFocus, nonStopCondition, result, indicator, virtualSelectTarget, focusRequestor, true);
+ }
+ }
+ });
}
else {
if (virtualSelectTarget == null) {
import com.intellij.openapi.module.impl.ModuleImpl;
import com.intellij.openapi.module.impl.scopes.JdkScope;
import com.intellij.openapi.module.impl.scopes.LibraryRuntimeClasspathScope;
-import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.DumbServiceImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectEx;
return; // in test mode suppress addition to a queue unless project is properly initialized
}
}
- myStartupManager.runWhenProjectIsInitialized(new DumbAwareRunnable() {
- public void run() {
- DumbServiceImpl.getInstance(myProject).queueCacheUpdate(myRefreshCacheUpdaters);
- }
- });
+ DumbServiceImpl.getInstance(myProject).queueCacheUpdate(myRefreshCacheUpdaters);
}
private void addRootsToWatch() {
if (roots.size() == 0 && rootType.skipWriteIfEmpty()) continue; //compatibility iml/ipr
final Element rootTypeElement = new Element(rootType.name());
roots.writeExternal(rootTypeElement, ROOT_PATH_ELEMENT);
- if (rootTypeElement.getAttributes().size() > 0 || rootTypeElement.getContent().size() > 0) element.addContent(rootTypeElement);
+ element.addContent(rootTypeElement);
}
List<String> urls = new ArrayList<String>(myJarDirectories.keySet());
Collections.sort(urls, new Comparator<String>() {